From 6bcdad20c24457393c0d9eeb385d0ff5aa872cd0 Mon Sep 17 00:00:00 2001 From: Lars Thorsen Date: Wed, 25 Apr 2018 15:09:14 +0200 Subject: Move the corba applcations to separate repository All corba applications are moved to a separate repository. E.g. orber, ic, cosEvent, cosEventDomain, cosNotifications cosTime, cosTransactions, cosProperty and cosFileTransfer. --- .gitignore | 9 - HOWTO/BOOTSTRAP.md | 3 +- HOWTO/INSTALL.md | 2 +- Makefile.in | 50 - erts/autoconf/configure.vxworks | 8 - erts/configure.in | 2 - lib/.gitignore | 383 ---- lib/Makefile | 7 +- lib/cosEvent/AUTHORS | 5 - lib/cosEvent/Makefile | 42 - lib/cosEvent/doc/html/.gitignore | 0 lib/cosEvent/doc/man3/.gitignore | 0 lib/cosEvent/doc/man6/.gitignore | 0 lib/cosEvent/doc/pdf/.gitignore | 0 lib/cosEvent/doc/src/CosEventChannelAdmin.xml | 78 - .../doc/src/CosEventChannelAdmin_ConsumerAdmin.xml | 73 - .../doc/src/CosEventChannelAdmin_EventChannel.xml | 95 - .../src/CosEventChannelAdmin_ProxyPullConsumer.xml | 85 - .../src/CosEventChannelAdmin_ProxyPullSupplier.xml | 112 - .../src/CosEventChannelAdmin_ProxyPushConsumer.xml | 99 - .../src/CosEventChannelAdmin_ProxyPushSupplier.xml | 85 - .../doc/src/CosEventChannelAdmin_SupplierAdmin.xml | 73 - lib/cosEvent/doc/src/Makefile | 145 -- lib/cosEvent/doc/src/book.xml | 50 - lib/cosEvent/doc/src/ch_contents.xml | 71 - lib/cosEvent/doc/src/ch_event_service.xml | 222 -- lib/cosEvent/doc/src/ch_introduction.xml | 57 - lib/cosEvent/doc/src/cosEventApp.xml | 169 -- lib/cosEvent/doc/src/e_s_components.gif | Bin 4458 -> 0 bytes lib/cosEvent/doc/src/e_s_models.gif | Bin 10354 -> 0 bytes lib/cosEvent/doc/src/notes.xml | 348 --- lib/cosEvent/doc/src/part.xml | 40 - lib/cosEvent/doc/src/ref_man.xml | 46 - lib/cosEvent/ebin/.gitignore | 0 lib/cosEvent/example/.gitignore | 0 lib/cosEvent/include/.gitignore | 0 lib/cosEvent/info | 2 - lib/cosEvent/src/CosEventChannelAdmin.cfg | 6 - lib/cosEvent/src/CosEventChannelAdmin.idl | 66 - ...CosEventChannelAdmin_ProxyPullConsumer_impl.erl | 206 -- ...CosEventChannelAdmin_ProxyPushConsumer_impl.erl | 170 -- .../CosEventChannelAdmin_SupplierAdmin_impl.erl | 160 -- lib/cosEvent/src/CosEventComm.idl | 37 - lib/cosEvent/src/Makefile | 217 -- lib/cosEvent/src/cosEvent.app.src | 46 - lib/cosEvent/src/cosEvent.appup.src | 6 - lib/cosEvent/src/cosEventApp.cfg | 15 - lib/cosEvent/src/cosEventApp.erl | 301 --- lib/cosEvent/src/cosEventApp.hrl | 63 - lib/cosEvent/src/cosEventApp.idl | 26 - lib/cosEvent/src/oe_CosEventComm_CAdmin_impl.erl | 234 -- lib/cosEvent/src/oe_CosEventComm_Channel_impl.erl | 247 -- lib/cosEvent/src/oe_CosEventComm_PullerS_impl.erl | 282 --- lib/cosEvent/src/oe_CosEventComm_PusherS_impl.erl | 218 -- lib/cosEvent/test/Makefile | 150 -- lib/cosEvent/test/cosEvent.cover | 2 - lib/cosEvent/test/cosEvent.spec | 1 - lib/cosEvent/test/event_channel_SUITE.erl | 326 --- lib/cosEvent/test/event_test_PullC_impl.erl | 44 - lib/cosEvent/test/event_test_PullS_impl.erl | 58 - lib/cosEvent/test/event_test_PushC_impl.erl | 47 - lib/cosEvent/test/event_test_PushS_impl.erl | 42 - lib/cosEvent/test/event_test_server.idl | 48 - lib/cosEvent/test/generated_SUITE.erl | 473 ---- lib/cosEvent/test/idl_output/.gitignore | 0 lib/cosEvent/vsn.mk | 2 - lib/cosEventDomain/AUTHORS | 4 - lib/cosEventDomain/Makefile | 42 - lib/cosEventDomain/doc/html/.gitignore | 0 lib/cosEventDomain/doc/man3/.gitignore | 0 lib/cosEventDomain/doc/man6/.gitignore | 0 lib/cosEventDomain/doc/pdf/.gitignore | 0 lib/cosEventDomain/doc/src/CosEventDomainAdmin.xml | 93 - .../doc/src/CosEventDomainAdmin_EventDomain.xml | 627 ----- .../src/CosEventDomainAdmin_EventDomainFactory.xml | 88 - lib/cosEventDomain/doc/src/Makefile | 137 -- lib/cosEventDomain/doc/src/book.xml | 49 - lib/cosEventDomain/doc/src/ch_QoS.xml | 118 - lib/cosEventDomain/doc/src/ch_contents.xml | 69 - .../doc/src/ch_event_domain_service.xml | 111 - lib/cosEventDomain/doc/src/ch_introduction.xml | 53 - lib/cosEventDomain/doc/src/cosEventDomainApp.xml | 150 -- lib/cosEventDomain/doc/src/notes.xml | 331 --- lib/cosEventDomain/doc/src/part.xml | 40 - lib/cosEventDomain/doc/src/ref_man.xml | 40 - lib/cosEventDomain/ebin/.gitignore | 0 lib/cosEventDomain/example/.gitignore | 0 lib/cosEventDomain/include/.gitignore | 0 lib/cosEventDomain/info | 2 - lib/cosEventDomain/src/CosEventDomainAdmin.cfg | 4 - lib/cosEventDomain/src/CosEventDomainAdmin.idl | 280 --- ...CosEventDomainAdmin_EventDomainFactory_impl.erl | 183 -- .../src/CosEventDomainAdmin_EventDomain_impl.erl | 1426 ------------ lib/cosEventDomain/src/Makefile | 185 -- lib/cosEventDomain/src/cosEventDomain.app.src | 33 - lib/cosEventDomain/src/cosEventDomain.appup.src | 6 - lib/cosEventDomain/src/cosEventDomainApp.erl | 341 --- lib/cosEventDomain/src/cosEventDomainApp.hrl | 70 - lib/cosEventDomain/test/Makefile | 104 - lib/cosEventDomain/test/cosEventDomain.cover | 2 - lib/cosEventDomain/test/cosEventDomain.spec | 1 - lib/cosEventDomain/test/event_domain_SUITE.erl | 464 ---- lib/cosEventDomain/test/generated_SUITE.erl | 384 ---- lib/cosEventDomain/vsn.mk | 2 - lib/cosFileTransfer/AUTHORS | 4 - lib/cosFileTransfer/Makefile | 42 - lib/cosFileTransfer/doc/html/.gitignore | 0 lib/cosFileTransfer/doc/man3/.gitignore | 0 lib/cosFileTransfer/doc/man6/.gitignore | 0 lib/cosFileTransfer/doc/pdf/.gitignore | 0 lib/cosFileTransfer/doc/src/CosFileTransfer.gif | Bin 10889 -> 0 bytes .../doc/src/CosFileTransfer_Directory.xml | 69 - .../doc/src/CosFileTransfer_File.xml | 94 - .../doc/src/CosFileTransfer_FileIterator.xml | 86 - .../src/CosFileTransfer_FileTransferSession.xml | 191 -- .../doc/src/CosFileTransfer_VirtualFileSystem.xml | 83 - lib/cosFileTransfer/doc/src/Makefile | 142 -- lib/cosFileTransfer/doc/src/book.xml | 49 - lib/cosFileTransfer/doc/src/ch_contents.xml | 75 - lib/cosFileTransfer/doc/src/ch_example.xml | 96 - lib/cosFileTransfer/doc/src/ch_install.xml | 58 - lib/cosFileTransfer/doc/src/ch_introduction.xml | 57 - lib/cosFileTransfer/doc/src/ch_system.xml | 138 -- lib/cosFileTransfer/doc/src/cosFileTransferApp.xml | 173 -- lib/cosFileTransfer/doc/src/notes.xml | 379 --- lib/cosFileTransfer/doc/src/part.xml | 41 - lib/cosFileTransfer/doc/src/ref_man.xml | 42 - lib/cosFileTransfer/ebin/.gitignore | 0 lib/cosFileTransfer/examples/.gitignore | 0 lib/cosFileTransfer/include/.gitignore | 0 lib/cosFileTransfer/info | 3 - lib/cosFileTransfer/priv/.gitignore | 0 lib/cosFileTransfer/src/CosFileTransfer.cfg | 10 - lib/cosFileTransfer/src/CosFileTransfer.idl | 157 -- .../src/CosFileTransfer_Directory_impl.erl | 453 ---- .../src/CosFileTransfer_FileIterator_impl.erl | 158 -- .../CosFileTransfer_FileTransferSession_impl.erl | 1061 --------- .../src/CosFileTransfer_File_impl.erl | 385 ---- .../src/CosFileTransfer_VirtualFileSystem_impl.erl | 217 -- lib/cosFileTransfer/src/Makefile | 188 -- lib/cosFileTransfer/src/cosFileTransfer.app.src | 43 - lib/cosFileTransfer/src/cosFileTransfer.appup.src | 7 - lib/cosFileTransfer/src/cosFileTransferApp.erl | 471 ---- lib/cosFileTransfer/src/cosFileTransferApp.hrl | 69 - .../src/cosFileTransferNATIVE_file.erl | 359 --- lib/cosFileTransfer/test/Makefile | 132 -- lib/cosFileTransfer/test/cosFileTransfer.cover | 2 - lib/cosFileTransfer/test/cosFileTransfer.spec | 1 - lib/cosFileTransfer/test/fileTransfer_SUITE.erl | 938 -------- lib/cosFileTransfer/vsn.mk | 1 - lib/cosNotification/AUTHORS | 4 - lib/cosNotification/Makefile | 42 - lib/cosNotification/doc/html/.gitignore | 0 lib/cosNotification/doc/man3/.gitignore | 0 lib/cosNotification/doc/man6/.gitignore | 0 lib/cosNotification/doc/pdf/.gitignore | 0 lib/cosNotification/doc/src/CosNotification.xml | 235 -- .../src/CosNotification_AdminPropertiesAdmin.xml | 79 - .../doc/src/CosNotification_QoSAdmin.xml | 107 - .../src/CosNotifyChannelAdmin_ConsumerAdmin.xml | 242 -- .../doc/src/CosNotifyChannelAdmin_EventChannel.xml | 226 -- .../CosNotifyChannelAdmin_EventChannelFactory.xml | 89 - .../src/CosNotifyChannelAdmin_ProxyConsumer.xml | 128 -- .../CosNotifyChannelAdmin_ProxyPullConsumer.xml | 113 - .../CosNotifyChannelAdmin_ProxyPullSupplier.xml | 112 - .../CosNotifyChannelAdmin_ProxyPushConsumer.xml | 98 - .../CosNotifyChannelAdmin_ProxyPushSupplier.xml | 110 - .../src/CosNotifyChannelAdmin_ProxySupplier.xml | 175 -- ...otifyChannelAdmin_SequenceProxyPullConsumer.xml | 112 - ...otifyChannelAdmin_SequenceProxyPullSupplier.xml | 146 -- ...otifyChannelAdmin_SequenceProxyPushConsumer.xml | 109 - ...otifyChannelAdmin_SequenceProxyPushSupplier.xml | 111 - ...ifyChannelAdmin_StructuredProxyPullConsumer.xml | 110 - ...ifyChannelAdmin_StructuredProxyPullSupplier.xml | 140 -- ...ifyChannelAdmin_StructuredProxyPushConsumer.xml | 110 - ...ifyChannelAdmin_StructuredProxyPushSupplier.xml | 110 - .../src/CosNotifyChannelAdmin_SupplierAdmin.xml | 195 -- .../doc/src/CosNotifyComm_NotifyPublish.xml | 66 - .../doc/src/CosNotifyComm_NotifySubscribe.xml | 64 - .../doc/src/CosNotifyFilter_Filter.xml | 223 -- .../doc/src/CosNotifyFilter_FilterAdmin.xml | 112 - .../doc/src/CosNotifyFilter_FilterFactory.xml | 74 - .../doc/src/CosNotifyFilter_MappingFilter.xml | 228 -- lib/cosNotification/doc/src/Makefile | 167 -- lib/cosNotification/doc/src/book.xml | 49 - lib/cosNotification/doc/src/ch_BNF.xml | 457 ---- lib/cosNotification/doc/src/ch_QoS.xml | 252 -- lib/cosNotification/doc/src/ch_contents.xml | 75 - lib/cosNotification/doc/src/ch_example.xml | 170 -- lib/cosNotification/doc/src/ch_install.xml | 147 -- lib/cosNotification/doc/src/ch_introduction.xml | 58 - lib/cosNotification/doc/src/ch_system.xml | 84 - lib/cosNotification/doc/src/cosNotificationApp.xml | 309 --- lib/cosNotification/doc/src/eventstructure.gif | Bin 89760 -> 0 bytes lib/cosNotification/doc/src/notes.xml | 632 ----- lib/cosNotification/doc/src/notificationFlow.gif | Bin 167734 -> 0 bytes lib/cosNotification/doc/src/part.xml | 43 - lib/cosNotification/doc/src/ref_man.xml | 64 - lib/cosNotification/ebin/.gitignore | 0 lib/cosNotification/examples/.gitignore | 0 lib/cosNotification/include/.gitignore | 0 lib/cosNotification/info | 3 - lib/cosNotification/priv/.gitignore | 0 lib/cosNotification/src/CosEvent.cfg | 20 - lib/cosNotification/src/CosNotification.cfg | 0 lib/cosNotification/src/CosNotification.idl | 146 -- lib/cosNotification/src/CosNotification_Common.erl | 1240 ---------- .../src/CosNotification_Definitions.hrl | 343 --- lib/cosNotification/src/CosNotifyChannelAdmin.cfg | 60 - lib/cosNotification/src/CosNotifyChannelAdmin.idl | 275 --- .../CosNotifyChannelAdmin_ConsumerAdmin_impl.erl | 671 ------ ...NotifyChannelAdmin_EventChannelFactory_impl.erl | 143 -- .../CosNotifyChannelAdmin_EventChannel_impl.erl | 722 ------ .../CosNotifyChannelAdmin_SupplierAdmin_impl.erl | 580 ----- lib/cosNotification/src/CosNotifyComm.cfg | 0 lib/cosNotification/src/CosNotifyComm.idl | 83 - lib/cosNotification/src/CosNotifyFilter.cfg | 6 - lib/cosNotification/src/CosNotifyFilter.idl | 140 -- .../src/CosNotifyFilter_FilterFactory_impl.erl | 126 - .../src/CosNotifyFilter_Filter_impl.erl | 672 ------ .../src/CosNotifyFilter_MappingFilter_impl.erl | 580 ----- lib/cosNotification/src/CosTypedEvent.idl | 57 - lib/cosNotification/src/CosTypedNotification.idl | 109 - lib/cosNotification/src/Makefile | 379 --- lib/cosNotification/src/PullerConsumer_impl.erl | 774 ------- lib/cosNotification/src/PullerSupplier_impl.erl | 915 -------- lib/cosNotification/src/PusherConsumer_impl.erl | 730 ------ lib/cosNotification/src/PusherSupplier_impl.erl | 1053 --------- lib/cosNotification/src/cosNotification.app.src | 122 - lib/cosNotification/src/cosNotification.appup.src | 7 - lib/cosNotification/src/cosNotificationApp.erl | 436 ---- lib/cosNotification/src/cosNotificationAppComm.idl | 17 - lib/cosNotification/src/cosNotificationComm.cfg | 3 - lib/cosNotification/src/cosNotification_Filter.erl | 965 -------- .../src/cosNotification_Grammar.yrl | 168 -- .../src/cosNotification_Scanner.erl | 269 --- .../src/cosNotification_eventDB.erl | 1351 ----------- lib/cosNotification/test/Makefile | 192 -- lib/cosNotification/test/cosNotification.cover | 2 - lib/cosNotification/test/cosNotification.spec | 1 - lib/cosNotification/test/eventDB_SUITE.erl | 896 -------- lib/cosNotification/test/generated_SUITE.erl | 1928 ---------------- lib/cosNotification/test/grammar_SUITE.erl | 1091 --------- lib/cosNotification/test/notification_SUITE.erl | 2163 ----------------- lib/cosNotification/test/notify_test_impl.erl | 300 --- lib/cosNotification/test/notify_test_server.cfg | 55 - lib/cosNotification/test/notify_test_server.idl | 114 - lib/cosNotification/vsn.mk | 2 - lib/cosProperty/AUTHORS | 4 - lib/cosProperty/Makefile | 42 - lib/cosProperty/doc/html/.gitignore | 0 lib/cosProperty/doc/man3/.gitignore | 0 lib/cosProperty/doc/man6/.gitignore | 0 lib/cosProperty/doc/pdf/.gitignore | 0 .../src/CosPropertyService_PropertiesIterator.xml | 95 - .../CosPropertyService_PropertyNamesIterator.xml | 97 - .../doc/src/CosPropertyService_PropertySet.xml | 201 -- .../doc/src/CosPropertyService_PropertySetDef.xml | 168 -- .../CosPropertyService_PropertySetDefFactory.xml | 95 - .../src/CosPropertyService_PropertySetFactory.xml | 93 - lib/cosProperty/doc/src/Makefile | 144 -- lib/cosProperty/doc/src/book.xml | 49 - lib/cosProperty/doc/src/ch_contents.xml | 75 - lib/cosProperty/doc/src/ch_example.xml | 76 - lib/cosProperty/doc/src/ch_install.xml | 56 - lib/cosProperty/doc/src/ch_introduction.xml | 54 - lib/cosProperty/doc/src/cosProperty.xml | 150 -- lib/cosProperty/doc/src/notes.xml | 377 --- lib/cosProperty/doc/src/part.xml | 40 - lib/cosProperty/doc/src/ref_man.xml | 43 - lib/cosProperty/ebin/.gitignore | 0 lib/cosProperty/examples/.gitignore | 0 lib/cosProperty/include/.gitignore | 0 lib/cosProperty/info | 2 - lib/cosProperty/priv/.gitignore | 0 lib/cosProperty/src/CosProperty.cfg | 5 - lib/cosProperty/src/CosProperty.idl | 192 -- .../CosPropertyService_PropertiesIterator_impl.erl | 167 -- ...sPropertyService_PropertyNamesIterator_impl.erl | 159 -- ...sPropertyService_PropertySetDefFactory_impl.erl | 186 -- .../src/CosPropertyService_PropertySetDef_impl.erl | 1042 --------- .../CosPropertyService_PropertySetFactory_impl.erl | 183 -- lib/cosProperty/src/Makefile | 188 -- lib/cosProperty/src/cosProperty.app.src | 47 - lib/cosProperty/src/cosProperty.appup.src | 6 - lib/cosProperty/src/cosProperty.erl | 416 ---- lib/cosProperty/src/cosProperty.hrl | 82 - lib/cosProperty/test/Makefile | 129 -- lib/cosProperty/test/cosProperty.cover | 2 - lib/cosProperty/test/cosProperty.spec | 1 - lib/cosProperty/test/generated_SUITE.erl | 546 ----- lib/cosProperty/test/property_SUITE.erl | 736 ------ lib/cosProperty/vsn.mk | 2 - lib/cosTime/AUTHORS | 4 - lib/cosTime/Makefile | 42 - lib/cosTime/doc/html/.gitignore | 0 lib/cosTime/doc/man3/.gitignore | 0 lib/cosTime/doc/man6/.gitignore | 0 lib/cosTime/doc/pdf/.gitignore | 0 lib/cosTime/doc/src/CosTime_TIO.xml | 109 - lib/cosTime/doc/src/CosTime_TimeService.xml | 104 - lib/cosTime/doc/src/CosTime_UTO.xml | 156 -- .../doc/src/CosTimerEvent_TimerEventHandler.xml | 125 - .../doc/src/CosTimerEvent_TimerEventService.xml | 84 - lib/cosTime/doc/src/Makefile | 138 -- lib/cosTime/doc/src/book.xml | 49 - lib/cosTime/doc/src/ch_contents.xml | 75 - lib/cosTime/doc/src/ch_example.xml | 113 - lib/cosTime/doc/src/ch_install.xml | 56 - lib/cosTime/doc/src/ch_introduction.xml | 59 - lib/cosTime/doc/src/cosTime.xml | 175 -- lib/cosTime/doc/src/notes.xml | 360 --- lib/cosTime/doc/src/part.xml | 40 - lib/cosTime/doc/src/ref_man.xml | 42 - lib/cosTime/ebin/.gitignore | 0 lib/cosTime/examples/.gitignore | 0 lib/cosTime/include/.gitignore | 0 lib/cosTime/info | 12 - lib/cosTime/priv/.gitignore | 0 lib/cosTime/src/CosTime.cfg | 6 - lib/cosTime/src/CosTime.idl | 59 - lib/cosTime/src/CosTime_TIO_impl.erl | 201 -- lib/cosTime/src/CosTime_TimeService_impl.erl | 182 -- lib/cosTime/src/CosTime_UTO_impl.erl | 242 -- lib/cosTime/src/CosTimerEvent.cfg | 4 - lib/cosTime/src/CosTimerEvent.idl | 45 - .../src/CosTimerEvent_TimerEventHandler_impl.erl | 305 --- .../src/CosTimerEvent_TimerEventService_impl.erl | 119 - lib/cosTime/src/Makefile | 207 -- lib/cosTime/src/TimeBase.idl | 22 - lib/cosTime/src/cosTime.app.src | 32 - lib/cosTime/src/cosTime.appup.src | 6 - lib/cosTime/src/cosTime.erl | 343 --- lib/cosTime/src/cosTimeApp.hrl | 77 - lib/cosTime/test/Makefile | 135 -- lib/cosTime/test/cosTime.cover | 2 - lib/cosTime/test/cosTime.spec | 1 - lib/cosTime/test/generated_SUITE.erl | 289 --- lib/cosTime/test/time_SUITE.erl | 301 --- lib/cosTime/vsn.mk | 2 - lib/cosTransactions/AUTHORS | 4 - lib/cosTransactions/Makefile | 42 - lib/cosTransactions/doc/html/.gitignore | 0 lib/cosTransactions/doc/man3/.gitignore | 0 lib/cosTransactions/doc/man6/.gitignore | 0 lib/cosTransactions/doc/pdf/.gitignore | 0 .../doc/src/CosTransactions_Control.xml | 74 - .../doc/src/CosTransactions_Coordinator.xml | 230 -- .../src/CosTransactions_RecoveryCoordinator.xml | 82 - .../doc/src/CosTransactions_Resource.xml | 129 -- ...CosTransactions_SubtransactionAwareResource.xml | 75 - .../doc/src/CosTransactions_Synchronization.xml | 70 - .../doc/src/CosTransactions_Terminator.xml | 73 - .../doc/src/CosTransactions_TransactionFactory.xml | 64 - .../src/CosTransactions_TransactionalObject.xml | 43 - lib/cosTransactions/doc/src/Makefile | 142 -- lib/cosTransactions/doc/src/book.xml | 49 - lib/cosTransactions/doc/src/ch_contents.xml | 75 - lib/cosTransactions/doc/src/ch_example.xml | 283 --- lib/cosTransactions/doc/src/ch_install.xml | 104 - lib/cosTransactions/doc/src/ch_introduction.xml | 65 - lib/cosTransactions/doc/src/ch_skeletons.xml | 214 -- lib/cosTransactions/doc/src/cosTransactions.xml | 142 -- lib/cosTransactions/doc/src/notes.xml | 407 ---- lib/cosTransactions/doc/src/part.xml | 41 - lib/cosTransactions/doc/src/ref_man.xml | 44 - lib/cosTransactions/ebin/.gitignore | 0 lib/cosTransactions/examples/Makefile | 158 -- lib/cosTransactions/include/.gitignore | 0 lib/cosTransactions/info | 2 - lib/cosTransactions/priv/.gitignore | 0 lib/cosTransactions/src/CosTransactions.cfg | 15 - lib/cosTransactions/src/CosTransactions.idl | 193 -- .../src/CosTransactions_Terminator_impl.erl | 363 --- .../CosTransactions_TransactionFactory_impl.erl | 180 -- lib/cosTransactions/src/ETraP_Common.erl | 187 -- lib/cosTransactions/src/ETraP_Common.hrl | 341 --- lib/cosTransactions/src/ETraP_Server_impl.erl | 1745 -------------- lib/cosTransactions/src/Makefile | 181 -- lib/cosTransactions/src/cosTransactions.app.src | 44 - lib/cosTransactions/src/cosTransactions.appup.src | 6 - lib/cosTransactions/src/cosTransactions.erl | 116 - lib/cosTransactions/src/etrap_logmgr.erl | 201 -- lib/cosTransactions/test/Makefile | 151 -- lib/cosTransactions/test/cosTransactions.cover | 2 - lib/cosTransactions/test/cosTransactions.spec | 1 - lib/cosTransactions/test/etrap_test.cfg | 21 - lib/cosTransactions/test/etrap_test.idl | 39 - lib/cosTransactions/test/etrap_test_lib.erl | 126 - lib/cosTransactions/test/etrap_test_lib.hrl | 101 - .../test/etrap_test_server_impl.erl | 211 -- lib/cosTransactions/test/generated_SUITE.erl | 543 ----- lib/cosTransactions/test/transactions_SUITE.erl | 396 ---- lib/cosTransactions/vsn.mk | 1 - lib/ic/AUTHORS | 8 - lib/ic/Makefile | 42 - lib/ic/c_src/Makefile | 25 - lib/ic/c_src/Makefile.in | 165 -- lib/ic/c_src/Makefile.win32 | 109 - lib/ic/c_src/ic.c | 613 ----- lib/ic/c_src/ic_tmo.c | 136 -- lib/ic/c_src/oe_ei_code_erlang_binary.c | 106 - lib/ic/c_src/oe_ei_decode_longlong.c | 26 - lib/ic/c_src/oe_ei_decode_ulonglong.c | 26 - lib/ic/c_src/oe_ei_decode_wchar.c | 26 - lib/ic/c_src/oe_ei_decode_wstring.c | 108 - lib/ic/c_src/oe_ei_encode_atom.c | 56 - lib/ic/c_src/oe_ei_encode_char.c | 45 - lib/ic/c_src/oe_ei_encode_double.c | 44 - lib/ic/c_src/oe_ei_encode_list_header.c | 42 - lib/ic/c_src/oe_ei_encode_long.c | 45 - lib/ic/c_src/oe_ei_encode_longlong.c | 45 - lib/ic/c_src/oe_ei_encode_pid.c | 46 - lib/ic/c_src/oe_ei_encode_port.c | 47 - lib/ic/c_src/oe_ei_encode_ref.c | 47 - lib/ic/c_src/oe_ei_encode_string.c | 48 - lib/ic/c_src/oe_ei_encode_term.c | 49 - lib/ic/c_src/oe_ei_encode_tuple_header.c | 45 - lib/ic/c_src/oe_ei_encode_ulong.c | 44 - lib/ic/c_src/oe_ei_encode_ulonglong.c | 45 - lib/ic/c_src/oe_ei_encode_version.c | 43 - lib/ic/c_src/oe_ei_encode_wchar.c | 28 - lib/ic/c_src/oe_ei_encode_wstring.c | 63 - lib/ic/doc/html/.gitignore | 0 lib/ic/doc/man1/.gitignore | 0 lib/ic/doc/man3/.gitignore | 0 lib/ic/doc/pdf/.gitignore | 0 lib/ic/doc/src/CORBA_Environment_alloc.xml | 143 -- lib/ic/doc/src/Makefile | 227 -- lib/ic/doc/src/book.xml | 50 - lib/ic/doc/src/c-part.xml | 39 - lib/ic/doc/src/ch_basic_idl.xml | 164 -- lib/ic/doc/src/ch_c_client.xml | 150 -- lib/ic/doc/src/ch_c_corba_env.xml | 386 ---- lib/ic/doc/src/ch_c_mapping.xml | 893 -------- lib/ic/doc/src/ch_c_server.xml | 149 -- lib/ic/doc/src/ch_erl_genserv.xml | 206 -- lib/ic/doc/src/ch_erl_plain.xml | 176 -- lib/ic/doc/src/ch_ic_protocol.xml | 234 -- lib/ic/doc/src/ch_introduction.xml | 149 -- lib/ic/doc/src/ch_java.xml | 738 ------ lib/ic/doc/src/erl-part.xml | 37 - lib/ic/doc/src/ic.xml | 468 ---- lib/ic/doc/src/ic_c_protocol.xml | 157 -- lib/ic/doc/src/ic_clib.xml | 247 -- lib/ic/doc/src/java-part.xml | 36 - lib/ic/doc/src/notes.xml | 806 ------- lib/ic/doc/src/part.xml | 46 - lib/ic/doc/src/ref_man.xml | 39 - lib/ic/ebin/.gitignore | 0 lib/ic/examples/all-against-all/Makefile | 118 - lib/ic/examples/all-against-all/Makefile.win32 | 139 -- lib/ic/examples/all-against-all/ReadMe | 122 - lib/ic/examples/all-against-all/callbacks.c | 46 - lib/ic/examples/all-against-all/client.c | 154 -- lib/ic/examples/all-against-all/client.erl | 54 - lib/ic/examples/all-against-all/client.java | 61 - lib/ic/examples/all-against-all/random.idl | 51 - .../examples/all-against-all/rmod_random_impl.erl | 49 - lib/ic/examples/all-against-all/server.c | 262 --- lib/ic/examples/all-against-all/server.erl | 41 - lib/ic/examples/all-against-all/server.java | 83 - lib/ic/examples/all-against-all/serverImpl.java | 43 - lib/ic/examples/c-client/Makefile | 87 - lib/ic/examples/c-client/ReadMe | 46 - lib/ic/examples/c-client/client.c | 131 -- lib/ic/examples/c-client/random.idl | 52 - lib/ic/examples/c-client/rmod_random_impl.erl | 53 - lib/ic/examples/c-client/test.erl | 44 - lib/ic/examples/c-server/Makefile | 90 - lib/ic/examples/c-server/ReadMe | 45 - lib/ic/examples/c-server/callbacks.c | 46 - lib/ic/examples/c-server/client.c | 125 - lib/ic/examples/c-server/client.erl | 45 - lib/ic/examples/c-server/random.idl | 50 - lib/ic/examples/c-server/server.c | 246 -- lib/ic/examples/erl-genserv/ReadMe | 30 - lib/ic/examples/erl-genserv/random.idl | 51 - lib/ic/examples/erl-genserv/rmod_random_impl.erl | 64 - lib/ic/examples/erl-plain/ReadMe | 27 - lib/ic/examples/erl-plain/random.idl | 53 - lib/ic/examples/erl-plain/rmod_random_impl.erl | 33 - lib/ic/examples/java-client-server/ReadMe | 69 - lib/ic/examples/java-client-server/client.java | 61 - lib/ic/examples/java-client-server/random.idl | 50 - lib/ic/examples/java-client-server/server.java | 83 - lib/ic/examples/java-client-server/serverImpl.java | 43 - lib/ic/examples/pre_post_condition/Makefile | 135 -- lib/ic/examples/pre_post_condition/ReadMe.txt | 74 - lib/ic/examples/pre_post_condition/ex.idl | 30 - lib/ic/examples/pre_post_condition/m_i_impl.erl | 50 - lib/ic/examples/pre_post_condition/tracer.erl | 57 - lib/ic/include/erlang.idl | 58 - lib/ic/include/ic.h | 432 ---- lib/ic/info | 2 - lib/ic/internal_doc/c-improvements-1.txt | 84 - lib/ic/internal_doc/protocol.txt | 182 -- lib/ic/java_src/Makefile | 42 - lib/ic/java_src/com/ericsson/otp/ic/Any.java | 1026 --------- lib/ic/java_src/com/ericsson/otp/ic/AnyHelper.java | 79 - lib/ic/java_src/com/ericsson/otp/ic/AnyHolder.java | 61 - .../com/ericsson/otp/ic/BooleanHolder.java | 63 - .../java_src/com/ericsson/otp/ic/ByteHolder.java | 62 - .../java_src/com/ericsson/otp/ic/CharHolder.java | 64 - .../java_src/com/ericsson/otp/ic/DoubleHolder.java | 62 - .../java_src/com/ericsson/otp/ic/Environment.java | 480 ---- .../java_src/com/ericsson/otp/ic/FloatHolder.java | 63 - lib/ic/java_src/com/ericsson/otp/ic/Holder.java | 34 - lib/ic/java_src/com/ericsson/otp/ic/IntHolder.java | 63 - .../java_src/com/ericsson/otp/ic/LongHolder.java | 61 - lib/ic/java_src/com/ericsson/otp/ic/Makefile | 122 - lib/ic/java_src/com/ericsson/otp/ic/Pid.java | 56 - lib/ic/java_src/com/ericsson/otp/ic/PidHelper.java | 145 -- lib/ic/java_src/com/ericsson/otp/ic/PidHolder.java | 55 - lib/ic/java_src/com/ericsson/otp/ic/Port.java | 49 - .../java_src/com/ericsson/otp/ic/PortHelper.java | 141 -- .../java_src/com/ericsson/otp/ic/PortHolder.java | 57 - lib/ic/java_src/com/ericsson/otp/ic/Ref.java | 61 - lib/ic/java_src/com/ericsson/otp/ic/RefHelper.java | 142 -- lib/ic/java_src/com/ericsson/otp/ic/RefHolder.java | 55 - .../java_src/com/ericsson/otp/ic/ShortHolder.java | 62 - .../java_src/com/ericsson/otp/ic/StringHolder.java | 63 - lib/ic/java_src/com/ericsson/otp/ic/TCKind.java | 200 -- lib/ic/java_src/com/ericsson/otp/ic/Term.java | 1113 --------- .../java_src/com/ericsson/otp/ic/TermHelper.java | 142 -- .../java_src/com/ericsson/otp/ic/TermHolder.java | 59 - lib/ic/java_src/com/ericsson/otp/ic/TypeCode.java | 883 ------- lib/ic/prebuild.skip | 1 - lib/ic/priv/lib/.gitignore | 0 lib/ic/priv/obj/.gitignore | 0 lib/ic/src/Makefile | 219 -- lib/ic/src/ic.app.src | 53 - lib/ic/src/ic.erl | 415 ---- lib/ic/src/ic.hrl | 159 -- lib/ic/src/ic_array_java.erl | 296 --- lib/ic/src/ic_attribute_java.erl | 413 ---- lib/ic/src/ic_cbe.erl | 1307 ----------- lib/ic/src/ic_cclient.erl | 1210 ---------- lib/ic/src/ic_code.erl | 585 ----- lib/ic/src/ic_codegen.erl | 423 ---- lib/ic/src/ic_constant_java.erl | 100 - lib/ic/src/ic_cserver.erl | 2420 -------------------- lib/ic/src/ic_debug.hrl | 38 - lib/ic/src/ic_enum_java.erl | 313 --- lib/ic/src/ic_erl_template.erl | 640 ------ lib/ic/src/ic_erlbe.erl | 1142 --------- lib/ic/src/ic_error.erl | 376 --- lib/ic/src/ic_fetch.erl | 389 ---- lib/ic/src/ic_file.erl | 448 ---- lib/ic/src/ic_forms.erl | 442 ---- lib/ic/src/ic_genobj.erl | 245 -- lib/ic/src/ic_java_type.erl | 1214 ---------- lib/ic/src/ic_jbe.erl | 1488 ------------ lib/ic/src/ic_noc.erl | 1117 --------- lib/ic/src/ic_options.erl | 364 --- lib/ic/src/ic_plainbe.erl | 356 --- lib/ic/src/ic_pp.erl | 2245 ------------------ lib/ic/src/ic_pragma.erl | 1957 ---------------- lib/ic/src/ic_sequence_java.erl | 240 -- lib/ic/src/ic_struct_java.erl | 315 --- lib/ic/src/ic_symtab.erl | 235 -- lib/ic/src/ic_union_java.erl | 755 ------ lib/ic/src/ic_util.erl | 314 --- lib/ic/src/icenum.erl | 206 -- lib/ic/src/iceval.erl | 556 ----- lib/ic/src/icforms.hrl | 70 - lib/ic/src/icparse.yrl | 872 ------- lib/ic/src/icpreproc.erl | 112 - lib/ic/src/icscan.erl | 453 ---- lib/ic/src/icstruct.erl | 1917 ---------------- lib/ic/src/ictk.erl | 874 ------- lib/ic/src/ictype.erl | 1417 ------------ lib/ic/src/icunion.erl | 1491 ------------ lib/ic/src/icyeccpre.hrl | 125 - lib/ic/test/Makefile | 276 --- lib/ic/test/c_client_erl_server_SUITE.erl | 265 --- .../c_client_erl_server_SUITE_data/Makefile.src | 155 -- .../test/c_client_erl_server_SUITE_data/c_client.c | 1760 -------------- .../c_client_erl_server_SUITE_data/c_erl_test.idl | 175 -- .../c_client_erl_server_SUITE_data/erl_server.erl | 29 - .../c_client_erl_server_SUITE_data/m_i_impl.erl | 162 -- lib/ic/test/c_client_erl_server_proto_SUITE.erl | 265 --- .../Makefile.src | 156 -- .../c_client.c | 1764 -------------- .../c_erl_test.idl | 174 -- .../erl_server.erl | 29 - .../m_i_impl.erl | 162 -- .../test/c_client_erl_server_proto_SUITE_data/my.c | 51 - .../test/c_client_erl_server_proto_tmo_SUITE.erl | 265 --- .../Makefile.src | 155 -- .../c_client.c | 1764 -------------- .../c_erl_test.idl | 174 -- .../erl_server.erl | 29 - .../m_i_impl.erl | 162 -- .../c_client_erl_server_proto_tmo_SUITE_data/my.c | 52 - lib/ic/test/erl_client_c_server_SUITE.erl | 298 --- .../erl_client_c_server_SUITE_data/Makefile.src | 160 -- .../test/erl_client_c_server_SUITE_data/c_server.c | 300 --- .../erl_client_c_server_SUITE_data/callbacks.c | 611 ----- .../erl_client_c_server_SUITE_data/erl_c_test.idl | 175 -- .../erl_client_c_server_SUITE_data/erl_client.erl | 332 --- lib/ic/test/erl_client_c_server_proto_SUITE.erl | 298 --- .../Makefile.src | 160 -- .../c_server.c | 300 --- .../callbacks.c | 611 ----- .../erl_c_test.idl | 175 -- .../erl_client.erl | 332 --- .../test/erl_client_c_server_proto_SUITE_data/my.c | 35 - lib/ic/test/ic.cover | 2 - lib/ic/test/ic.spec | 1 - lib/ic/test/ic.spec.vxworks | 2 - lib/ic/test/ic_SUITE.erl | 894 -------- lib/ic/test/ic_SUITE_data/Corba.idl | 1013 -------- lib/ic/test/ic_SUITE_data/Coss.idl | 1537 ------------- lib/ic/test/ic_SUITE_data/attr.idl | 30 - lib/ic/test/ic_SUITE_data/c_err1.idl | 64 - lib/ic/test/ic_SUITE_data/c_err2.idl | 31 - lib/ic/test/ic_SUITE_data/c_err3.idl | 29 - lib/ic/test/ic_SUITE_data/c_norm.idl | 164 -- lib/ic/test/ic_SUITE_data/enum.idl | 33 - lib/ic/test/ic_SUITE_data/forward.idl | 35 - lib/ic/test/ic_SUITE_data/include.idl | 31 - lib/ic/test/ic_SUITE_data/include2.idl | 27 - lib/ic/test/ic_SUITE_data/include3.idl | 26 - lib/ic/test/ic_SUITE_data/inherit.idl | 69 - lib/ic/test/ic_SUITE_data/inherit_err.idl | 72 - lib/ic/test/ic_SUITE_data/inherit_warn.idl | 65 - lib/ic/test/ic_SUITE_data/mult_ids.idl | 93 - lib/ic/test/ic_SUITE_data/nasty.idl | 61 - lib/ic/test/ic_SUITE_data/one.idl | 30 - lib/ic/test/ic_SUITE_data/one_followed.idl | 55 - lib/ic/test/ic_SUITE_data/one_out.idl | 29 - lib/ic/test/ic_SUITE_data/one_raises.idl | 33 - lib/ic/test/ic_SUITE_data/one_void.idl | 31 - lib/ic/test/ic_SUITE_data/raises_reg.idl | 53 - lib/ic/test/ic_SUITE_data/struct.idl | 54 - lib/ic/test/ic_SUITE_data/syntax1.idl | 29 - lib/ic/test/ic_SUITE_data/syntax2.idl | 28 - lib/ic/test/ic_SUITE_data/syntax3.idl | 21 - lib/ic/test/ic_SUITE_data/syntax4.idl | 24 - lib/ic/test/ic_SUITE_data/syntax5.idl | 23 - lib/ic/test/ic_SUITE_data/syntax6.idl | 21 - lib/ic/test/ic_SUITE_data/type.idl | 191 -- lib/ic/test/ic_SUITE_data/typeid.idl | 29 - lib/ic/test/ic_SUITE_data/u_case_mult.idl | 55 - lib/ic/test/ic_SUITE_data/u_default.idl | 52 - lib/ic/test/ic_SUITE_data/u_mult.idl | 62 - lib/ic/test/ic_SUITE_data/u_norm.idl | 64 - lib/ic/test/ic_SUITE_data/u_type.idl | 83 - lib/ic/test/ic_SUITE_data/undef_id.idl | 64 - lib/ic/test/ic_be_SUITE.erl | 75 - lib/ic/test/ic_be_SUITE_data/plain.idl | 34 - lib/ic/test/ic_pp_SUITE.erl | 569 ----- lib/ic/test/ic_pp_SUITE_data/arg.idl | 39 - lib/ic/test/ic_pp_SUITE_data/cascade.idl | 30 - lib/ic/test/ic_pp_SUITE_data/comment.idl | 73 - lib/ic/test/ic_pp_SUITE_data/concat.idl | 61 - lib/ic/test/ic_pp_SUITE_data/define.idl | 42 - lib/ic/test/ic_pp_SUITE_data/if.idl | 33 - lib/ic/test/ic_pp_SUITE_data/if_zero.idl | 32 - .../test/ic_pp_SUITE_data/improp_nest_constr.idl | 31 - lib/ic/test/ic_pp_SUITE_data/inc.idl | 69 - lib/ic/test/ic_pp_SUITE_data/included1.idl | 36 - lib/ic/test/ic_pp_SUITE_data/included2.idl | 42 - lib/ic/test/ic_pp_SUITE_data/includer.idl | 46 - lib/ic/test/ic_pp_SUITE_data/line.idl | 46 - lib/ic/test/ic_pp_SUITE_data/misc.idl | 45 - lib/ic/test/ic_pp_SUITE_data/nopara.idl | 36 - lib/ic/test/ic_pp_SUITE_data/predef.idl | 34 - lib/ic/test/ic_pp_SUITE_data/predef_time.idl | 25 - lib/ic/test/ic_pp_SUITE_data/self_ref.idl | 27 - lib/ic/test/ic_pp_SUITE_data/separate.idl | 38 - lib/ic/test/ic_pp_SUITE_data/swallow_sc.idl | 38 - lib/ic/test/ic_pp_SUITE_data/unintended_grp.idl | 30 - lib/ic/test/ic_pragma_SUITE.erl | 301 --- lib/ic/test/ic_pragma_SUITE_data/reg_m0.idl | 78 - lib/ic/test/ic_pragma_SUITE_data/reg_m1.idl | 76 - lib/ic/test/ic_pragma_SUITE_data/reg_m2.idl | 41 - lib/ic/test/ic_pragma_SUITE_data/reg_m3.idl | 39 - lib/ic/test/ic_pragma_SUITE_data/reg_m4.idl | 65 - lib/ic/test/ic_pragma_SUITE_data/reg_m5.idl | 29 - lib/ic/test/ic_pragma_SUITE_data/reg_m6.idl | 39 - lib/ic/test/ic_pragma_SUITE_data/reg_m7.idl | 63 - lib/ic/test/ic_pragma_SUITE_data/uggly.idl | 205 -- lib/ic/test/ic_register_SUITE.erl | 422 ---- lib/ic/test/ic_register_SUITE_data/reg_m10.idl | 38 - lib/ic/test/ic_register_SUITE_data/reg_m11.idl | 33 - lib/ic/test/ic_register_SUITE_data/reg_m12.idl | 41 - lib/ic/test/ic_register_SUITE_data/reg_m8.idl | 33 - lib/ic/test/ic_register_SUITE_data/reg_m9.idl | 33 - lib/ic/test/ic_smoke.spec | 1 - lib/ic/test/java_client_erl_server_SUITE.erl | 319 --- .../JavaClient.java | 760 ------ .../java_client_erl_server_SUITE_data/Makefile.src | 101 - .../java_erl_test.idl | 69 - .../java_client_erl_server_SUITE_data/m_i_impl.erl | 170 -- lib/ic/vsn.mk | 1 - lib/orber/AUTHORS | 8 - .../CosNaming/CosNaming_BindingIterator_impl.erl | 94 - .../CosNaming/CosNaming_NamingContextExt_impl.erl | 756 ------ lib/orber/COSS/CosNaming/Makefile | 153 -- lib/orber/COSS/CosNaming/cos_naming.idl | 77 - lib/orber/COSS/CosNaming/cos_naming_ext.idl | 37 - lib/orber/COSS/CosNaming/lname.erl | 134 -- lib/orber/COSS/CosNaming/lname.hrl | 34 - lib/orber/COSS/CosNaming/lname_component.erl | 84 - lib/orber/COSS/CosNaming/orber_cosnaming.hrl | 64 - lib/orber/COSS/CosNaming/orber_cosnaming_utils.erl | 762 ------ lib/orber/Makefile | 42 - lib/orber/c_src/InitialReference.cc | 206 -- lib/orber/c_src/InitialReference.hh | 60 - lib/orber/c_src/Makefile | 24 - lib/orber/c_src/Makefile.in | 100 - lib/orber/c_src/main.cc | 32 - lib/orber/doc/etc/.gitignore | 0 lib/orber/doc/html/.gitignore | 0 lib/orber/doc/javadoc/.gitignore | 0 lib/orber/doc/man1/.gitignore | 0 lib/orber/doc/man3/.gitignore | 0 lib/orber/doc/pdf/.gitignore | 0 lib/orber/doc/src/CosNaming.xml | 71 - lib/orber/doc/src/CosNaming_BindingIterator.xml | 99 - lib/orber/doc/src/CosNaming_NamingContext.xml | 243 -- lib/orber/doc/src/CosNaming_NamingContextExt.xml | 102 - lib/orber/doc/src/Makefile | 172 -- lib/orber/doc/src/Module_Interface.xml | 356 --- lib/orber/doc/src/Orber/InitialReference.java | 131 -- lib/orber/doc/src/Orber/Makefile | 71 - lib/orber/doc/src/any.xml | 114 - lib/orber/doc/src/book.xml | 49 - lib/orber/doc/src/ch_contents.xml | 173 -- lib/orber/doc/src/ch_debugging.xml | 210 -- lib/orber/doc/src/ch_exceptions.xml | 238 -- lib/orber/doc/src/ch_idl_to_erlang_mapping.xml | 1504 ------------ lib/orber/doc/src/ch_ifr.xml | 50 - lib/orber/doc/src/ch_install.xml | 1001 -------- lib/orber/doc/src/ch_interceptors.xml | 278 --- lib/orber/doc/src/ch_introduction.xml | 145 -- lib/orber/doc/src/ch_naming_service.xml | 465 ---- lib/orber/doc/src/ch_orber_kernel.xml | 103 - lib/orber/doc/src/ch_orberweb.xml | 221 -- lib/orber/doc/src/ch_security.xml | 96 - lib/orber/doc/src/ch_stubs.xml | 284 --- lib/orber/doc/src/corba.xml | 454 ---- lib/orber/doc/src/corba_object.xml | 194 -- lib/orber/doc/src/dataframe1.gif | Bin 21074 -> 0 bytes lib/orber/doc/src/dataframe2.gif | Bin 27848 -> 0 bytes lib/orber/doc/src/dataframe3.gif | Bin 30290 -> 0 bytes lib/orber/doc/src/dataframe4.gif | Bin 40114 -> 0 bytes lib/orber/doc/src/dataframe5.gif | Bin 11184 -> 0 bytes lib/orber/doc/src/dataframe6.gif | Bin 12331 -> 0 bytes lib/orber/doc/src/dataframe7.gif | Bin 12768 -> 0 bytes lib/orber/doc/src/dataframe8.gif | Bin 29939 -> 0 bytes lib/orber/doc/src/dependent.gif | Bin 1936 -> 0 bytes lib/orber/doc/src/example_part.xml | 36 - lib/orber/doc/src/firewall_nat.gif | Bin 11939 -> 0 bytes lib/orber/doc/src/fixed.xml | 160 -- lib/orber/doc/src/ifr_notes.txt | 53 - lib/orber/doc/src/iiop.gif | Bin 5899 -> 0 bytes lib/orber/doc/src/images/GridBagEx.gif | Bin 2453 -> 0 bytes lib/orber/doc/src/images/OpenBookIcon.gif | Bin 2241 -> 0 bytes lib/orber/doc/src/images/blue-ball-small.gif | Bin 255 -> 0 bytes lib/orber/doc/src/images/blue-ball.gif | Bin 925 -> 0 bytes lib/orber/doc/src/images/class-index.gif | Bin 1497 -> 0 bytes lib/orber/doc/src/images/constructor-index.gif | Bin 1711 -> 0 bytes lib/orber/doc/src/images/constructors.gif | Bin 1565 -> 0 bytes lib/orber/doc/src/images/cyan-ball-small.gif | Bin 255 -> 0 bytes lib/orber/doc/src/images/cyan-ball.gif | Bin 925 -> 0 bytes lib/orber/doc/src/images/error-index.gif | Bin 1438 -> 0 bytes lib/orber/doc/src/images/exception-index.gif | Bin 1707 -> 0 bytes lib/orber/doc/src/images/green-ball-small.gif | Bin 102 -> 0 bytes lib/orber/doc/src/images/green-ball.gif | Bin 886 -> 0 bytes lib/orber/doc/src/images/interface-index.gif | Bin 1648 -> 0 bytes lib/orber/doc/src/images/magenta-ball-small.gif | Bin 104 -> 0 bytes lib/orber/doc/src/images/magenta-ball.gif | Bin 896 -> 0 bytes lib/orber/doc/src/images/method-index.gif | Bin 1588 -> 0 bytes lib/orber/doc/src/images/methods.gif | Bin 1403 -> 0 bytes lib/orber/doc/src/images/package-index.gif | Bin 1607 -> 0 bytes lib/orber/doc/src/images/red-ball-small.gif | Bin 255 -> 0 bytes lib/orber/doc/src/images/red-ball.gif | Bin 527 -> 0 bytes lib/orber/doc/src/images/variable-index.gif | Bin 1576 -> 0 bytes lib/orber/doc/src/images/variables.gif | Bin 1380 -> 0 bytes lib/orber/doc/src/images/yellow-ball-small.gif | Bin 255 -> 0 bytes lib/orber/doc/src/images/yellow-ball.gif | Bin 925 -> 0 bytes lib/orber/doc/src/interceptor_operations.gif | Bin 14537 -> 0 bytes lib/orber/doc/src/interceptors.xml | 284 --- lib/orber/doc/src/intro_part.xml | 41 - lib/orber/doc/src/lname.xml | 166 -- lib/orber/doc/src/lname_component.xml | 113 - lib/orber/doc/src/menuframe.gif | Bin 12007 -> 0 bytes lib/orber/doc/src/name.gif | Bin 5015 -> 0 bytes lib/orber/doc/src/notes.xml | 860 ------- lib/orber/doc/src/orber.xml | 653 ------ lib/orber/doc/src/orber_acl.xml | 107 - lib/orber/doc/src/orber_diagnostics.xml | 81 - lib/orber/doc/src/orber_ifr.xml | 1035 --------- lib/orber/doc/src/orber_tc.xml | 259 --- lib/orber/doc/src/orbs.gif | Bin 2817 -> 0 bytes lib/orber/doc/src/part.xml | 49 - lib/orber/doc/src/ref_man.xml | 53 - lib/orber/doc/src/theORB.gif | Bin 4706 -> 0 bytes lib/orber/doc/src/tools_debugging_part.xml | 40 - lib/orber/ebin/.gitignore | 0 lib/orber/examples/Makefile | 42 - lib/orber/examples/Stack/InitialReferences.idl | 12 - lib/orber/examples/Stack/Makefile | 128 -- lib/orber/examples/Stack/StackClient.cc | 97 - lib/orber/examples/Stack/StackClient.java | 73 - .../Stack/StackModule_StackFactory_impl.erl | 41 - .../examples/Stack/StackModule_Stack_impl.erl | 47 - lib/orber/examples/Stack/stack.idl | 27 - lib/orber/examples/Stack/stack_client.erl | 56 - lib/orber/examples/Stack/stack_factory.erl | 38 - lib/orber/include/corba.hrl | 149 -- lib/orber/include/ifr_types.hrl | 73 - lib/orber/include/orber_pi.hrl | 77 - lib/orber/info | 2 - lib/orber/java_src/Makefile | 42 - lib/orber/java_src/Orber/InitialReference.java | 131 -- lib/orber/java_src/Orber/Makefile | 71 - lib/orber/prebuild.skip | 5 - lib/orber/priv/Makefile | 67 - lib/orber/priv/Orber/.gitignore | 0 lib/orber/priv/bin/.gitignore | 0 lib/orber/priv/blank.html | 6 - lib/orber/priv/info_frames.html | 9 - lib/orber/priv/main_frame.html | 9 - lib/orber/priv/obj/.gitignore | 0 lib/orber/priv/orber.tool | 2 - lib/orber/priv/orber_help.txt | 42 - lib/orber/priv/start_info.html | 31 - lib/orber/src/CORBA.idl | 22 - lib/orber/src/Makefile | 263 --- lib/orber/src/OrberApp_IFR_impl.erl | 102 - lib/orber/src/OrberCSIv2.asn1 | 45 - lib/orber/src/OrberCSIv2.set.asn | 5 - lib/orber/src/OrberIFR.idl | 12 - lib/orber/src/PKIX1Algorithms88.asn1 | 274 --- lib/orber/src/PKIX1Explicit88.asn1 | 619 ----- lib/orber/src/PKIX1Implicit88.asn1 | 349 --- lib/orber/src/PKIXAttributeCertificate.asn1 | 189 -- lib/orber/src/any.erl | 74 - lib/orber/src/cdr_decode.erl | 1536 ------------- lib/orber/src/cdr_encode.erl | 1172 ---------- lib/orber/src/cdrlib.erl | 415 ---- lib/orber/src/corba.erl | 2206 ------------------ lib/orber/src/corba_boa.erl | 135 -- lib/orber/src/corba_nvlist.erl | 98 - lib/orber/src/corba_object.erl | 221 -- lib/orber/src/fixed.erl | 306 --- lib/orber/src/ifr_objects.hrl | 422 ---- lib/orber/src/iop_ior.erl | 1717 -------------- lib/orber/src/orber.app.src | 111 - lib/orber/src/orber.appup.src | 7 - lib/orber/src/orber.erl | 1238 ---------- lib/orber/src/orber_acl.erl | 397 ---- lib/orber/src/orber_diagnostics.erl | 241 -- lib/orber/src/orber_env.erl | 1545 ------------- lib/orber/src/orber_exceptions.erl | 718 ------ lib/orber/src/orber_ifr.erl | 1820 --------------- lib/orber/src/orber_ifr.hrl | 35 - lib/orber/src/orber_ifr_aliasdef.erl | 135 -- lib/orber/src/orber_ifr_arraydef.erl | 104 - lib/orber/src/orber_ifr_attributedef.erl | 138 -- lib/orber/src/orber_ifr_constantdef.erl | 148 -- lib/orber/src/orber_ifr_contained.erl | 248 -- lib/orber/src/orber_ifr_container.erl | 464 ---- lib/orber/src/orber_ifr_enumdef.erl | 130 -- lib/orber/src/orber_ifr_exceptiondef.erl | 145 -- lib/orber/src/orber_ifr_fixeddef.erl | 80 - lib/orber/src/orber_ifr_idltype.erl | 75 - lib/orber/src/orber_ifr_interfacedef.erl | 340 --- lib/orber/src/orber_ifr_irobject.erl | 73 - lib/orber/src/orber_ifr_moduledef.erl | 184 -- lib/orber/src/orber_ifr_operationdef.erl | 192 -- lib/orber/src/orber_ifr_orb.erl | 100 - lib/orber/src/orber_ifr_primitivedef.erl | 70 - lib/orber/src/orber_ifr_repository.erl | 288 --- lib/orber/src/orber_ifr_sequencedef.erl | 104 - lib/orber/src/orber_ifr_stringdef.erl | 75 - lib/orber/src/orber_ifr_structdef.erl | 156 -- lib/orber/src/orber_ifr_typecode.erl | 108 - lib/orber/src/orber_ifr_typedef.erl | 125 - lib/orber/src/orber_ifr_uniondef.erl | 176 -- lib/orber/src/orber_ifr_utils.erl | 437 ---- lib/orber/src/orber_ifr_wstringdef.erl | 73 - lib/orber/src/orber_iiop.erl | 551 ----- lib/orber/src/orber_iiop.hrl | 1016 -------- lib/orber/src/orber_iiop_inproxy.erl | 399 ---- lib/orber/src/orber_iiop_inrequest.erl | 541 ----- lib/orber/src/orber_iiop_insup.erl | 86 - lib/orber/src/orber_iiop_net.erl | 511 ----- lib/orber/src/orber_iiop_net_accept.erl | 95 - lib/orber/src/orber_iiop_outproxy.erl | 511 ----- lib/orber/src/orber_iiop_outsup.erl | 88 - lib/orber/src/orber_iiop_pm.erl | 894 -------- lib/orber/src/orber_iiop_socketsup.erl | 86 - lib/orber/src/orber_iiop_tracer.erl | 232 -- lib/orber/src/orber_iiop_tracer_silent.erl | 191 -- lib/orber/src/orber_iiop_tracer_stealth.erl | 187 -- lib/orber/src/orber_initial_references.erl | 328 --- lib/orber/src/orber_interceptors.erl | 154 -- lib/orber/src/orber_objectkeys.erl | 571 ----- lib/orber/src/orber_pi.erl | 1213 ---------- lib/orber/src/orber_request_number.erl | 83 - lib/orber/src/orber_socket.erl | 530 ----- lib/orber/src/orber_tb.erl | 222 -- lib/orber/src/orber_tc.erl | 284 --- lib/orber/src/orber_typedefs.erl | 83 - lib/orber/src/orber_web.erl | 864 ------- lib/orber/src/orber_web_server.erl | 190 -- lib/orber/test/Makefile | 220 -- lib/orber/test/cdrcoding_10_SUITE.erl | 587 ----- lib/orber/test/cdrcoding_11_SUITE.erl | 587 ----- lib/orber/test/cdrcoding_12_SUITE.erl | 575 ----- lib/orber/test/cdrlib_SUITE.erl | 479 ---- lib/orber/test/corba_SUITE.erl | 897 -------- lib/orber/test/csiv2_SUITE.erl | 889 ------- lib/orber/test/data_types_SUITE.erl | 187 -- lib/orber/test/generated_SUITE.erl | 372 --- lib/orber/test/idl_output/.gitignore | 0 lib/orber/test/iiop_module_do_test_impl.erl | 113 - lib/orber/test/iiop_module_test_impl.erl | 129 -- lib/orber/test/iiop_test.idl | 112 - lib/orber/test/iiop_test_impl.erl | 35 - lib/orber/test/interceptors_SUITE.erl | 349 --- lib/orber/test/iop_ior_10_SUITE.erl | 184 -- lib/orber/test/iop_ior_11_SUITE.erl | 203 -- lib/orber/test/iop_ior_12_SUITE.erl | 204 -- lib/orber/test/ip_v4v6_interop_SUITE.erl | 199 -- lib/orber/test/lname_SUITE.erl | 213 -- lib/orber/test/multi_ORB_SUITE.erl | 2286 ------------------ lib/orber/test/naming_context_SUITE.erl | 390 ---- lib/orber/test/orber.cover | 2 - lib/orber/test/orber.spec | 1 - lib/orber/test/orber_SUITE.erl | 213 -- lib/orber/test/orber_acl_SUITE.erl | 299 --- lib/orber/test/orber_firewall_ipv4_in_SUITE.erl | 284 --- lib/orber/test/orber_firewall_ipv4_out_SUITE.erl | 229 -- lib/orber/test/orber_firewall_ipv6_in_SUITE.erl | 315 --- lib/orber/test/orber_firewall_ipv6_out_SUITE.erl | 236 -- lib/orber/test/orber_nat_SUITE.erl | 364 --- lib/orber/test/orber_test.idl | 96 - lib/orber/test/orber_test_lib.erl | 1564 ------------- lib/orber/test/orber_test_server.cfg | 28 - lib/orber/test/orber_test_server.idl | 177 -- lib/orber/test/orber_test_server_impl.erl | 276 --- lib/orber/test/orber_test_timeout_server_impl.erl | 66 - lib/orber/test/orber_web_SUITE.erl | 440 ---- lib/orber/test/tc_SUITE.erl | 605 ----- lib/orber/vsn.mk | 1 - .../system_architecture_intro/sys_arch_intro.xml | 14 - 952 files changed, 5 insertions(+), 190611 deletions(-) delete mode 100644 lib/cosEvent/AUTHORS delete mode 100644 lib/cosEvent/Makefile delete mode 100644 lib/cosEvent/doc/html/.gitignore delete mode 100644 lib/cosEvent/doc/man3/.gitignore delete mode 100644 lib/cosEvent/doc/man6/.gitignore delete mode 100644 lib/cosEvent/doc/pdf/.gitignore delete mode 100644 lib/cosEvent/doc/src/CosEventChannelAdmin.xml delete mode 100644 lib/cosEvent/doc/src/CosEventChannelAdmin_ConsumerAdmin.xml delete mode 100644 lib/cosEvent/doc/src/CosEventChannelAdmin_EventChannel.xml delete mode 100644 lib/cosEvent/doc/src/CosEventChannelAdmin_ProxyPullConsumer.xml delete mode 100644 lib/cosEvent/doc/src/CosEventChannelAdmin_ProxyPullSupplier.xml delete mode 100644 lib/cosEvent/doc/src/CosEventChannelAdmin_ProxyPushConsumer.xml delete mode 100644 lib/cosEvent/doc/src/CosEventChannelAdmin_ProxyPushSupplier.xml delete mode 100644 lib/cosEvent/doc/src/CosEventChannelAdmin_SupplierAdmin.xml delete mode 100644 lib/cosEvent/doc/src/Makefile delete mode 100644 lib/cosEvent/doc/src/book.xml delete mode 100644 lib/cosEvent/doc/src/ch_contents.xml delete mode 100644 lib/cosEvent/doc/src/ch_event_service.xml delete mode 100644 lib/cosEvent/doc/src/ch_introduction.xml delete mode 100644 lib/cosEvent/doc/src/cosEventApp.xml delete mode 100644 lib/cosEvent/doc/src/e_s_components.gif delete mode 100644 lib/cosEvent/doc/src/e_s_models.gif delete mode 100644 lib/cosEvent/doc/src/notes.xml delete mode 100644 lib/cosEvent/doc/src/part.xml delete mode 100644 lib/cosEvent/doc/src/ref_man.xml delete mode 100644 lib/cosEvent/ebin/.gitignore delete mode 100644 lib/cosEvent/example/.gitignore delete mode 100644 lib/cosEvent/include/.gitignore delete mode 100644 lib/cosEvent/info delete mode 100644 lib/cosEvent/src/CosEventChannelAdmin.cfg delete mode 100644 lib/cosEvent/src/CosEventChannelAdmin.idl delete mode 100644 lib/cosEvent/src/CosEventChannelAdmin_ProxyPullConsumer_impl.erl delete mode 100644 lib/cosEvent/src/CosEventChannelAdmin_ProxyPushConsumer_impl.erl delete mode 100644 lib/cosEvent/src/CosEventChannelAdmin_SupplierAdmin_impl.erl delete mode 100644 lib/cosEvent/src/CosEventComm.idl delete mode 100644 lib/cosEvent/src/Makefile delete mode 100644 lib/cosEvent/src/cosEvent.app.src delete mode 100644 lib/cosEvent/src/cosEvent.appup.src delete mode 100644 lib/cosEvent/src/cosEventApp.cfg delete mode 100644 lib/cosEvent/src/cosEventApp.erl delete mode 100644 lib/cosEvent/src/cosEventApp.hrl delete mode 100644 lib/cosEvent/src/cosEventApp.idl delete mode 100644 lib/cosEvent/src/oe_CosEventComm_CAdmin_impl.erl delete mode 100644 lib/cosEvent/src/oe_CosEventComm_Channel_impl.erl delete mode 100644 lib/cosEvent/src/oe_CosEventComm_PullerS_impl.erl delete mode 100644 lib/cosEvent/src/oe_CosEventComm_PusherS_impl.erl delete mode 100644 lib/cosEvent/test/Makefile delete mode 100644 lib/cosEvent/test/cosEvent.cover delete mode 100644 lib/cosEvent/test/cosEvent.spec delete mode 100644 lib/cosEvent/test/event_channel_SUITE.erl delete mode 100644 lib/cosEvent/test/event_test_PullC_impl.erl delete mode 100644 lib/cosEvent/test/event_test_PullS_impl.erl delete mode 100644 lib/cosEvent/test/event_test_PushC_impl.erl delete mode 100644 lib/cosEvent/test/event_test_PushS_impl.erl delete mode 100644 lib/cosEvent/test/event_test_server.idl delete mode 100644 lib/cosEvent/test/generated_SUITE.erl delete mode 100644 lib/cosEvent/test/idl_output/.gitignore delete mode 100644 lib/cosEvent/vsn.mk delete mode 100644 lib/cosEventDomain/AUTHORS delete mode 100644 lib/cosEventDomain/Makefile delete mode 100644 lib/cosEventDomain/doc/html/.gitignore delete mode 100644 lib/cosEventDomain/doc/man3/.gitignore delete mode 100644 lib/cosEventDomain/doc/man6/.gitignore delete mode 100644 lib/cosEventDomain/doc/pdf/.gitignore delete mode 100644 lib/cosEventDomain/doc/src/CosEventDomainAdmin.xml delete mode 100644 lib/cosEventDomain/doc/src/CosEventDomainAdmin_EventDomain.xml delete mode 100644 lib/cosEventDomain/doc/src/CosEventDomainAdmin_EventDomainFactory.xml delete mode 100644 lib/cosEventDomain/doc/src/Makefile delete mode 100644 lib/cosEventDomain/doc/src/book.xml delete mode 100644 lib/cosEventDomain/doc/src/ch_QoS.xml delete mode 100644 lib/cosEventDomain/doc/src/ch_contents.xml delete mode 100644 lib/cosEventDomain/doc/src/ch_event_domain_service.xml delete mode 100644 lib/cosEventDomain/doc/src/ch_introduction.xml delete mode 100644 lib/cosEventDomain/doc/src/cosEventDomainApp.xml delete mode 100644 lib/cosEventDomain/doc/src/notes.xml delete mode 100644 lib/cosEventDomain/doc/src/part.xml delete mode 100644 lib/cosEventDomain/doc/src/ref_man.xml delete mode 100644 lib/cosEventDomain/ebin/.gitignore delete mode 100644 lib/cosEventDomain/example/.gitignore delete mode 100644 lib/cosEventDomain/include/.gitignore delete mode 100644 lib/cosEventDomain/info delete mode 100644 lib/cosEventDomain/src/CosEventDomainAdmin.cfg delete mode 100644 lib/cosEventDomain/src/CosEventDomainAdmin.idl delete mode 100644 lib/cosEventDomain/src/CosEventDomainAdmin_EventDomainFactory_impl.erl delete mode 100644 lib/cosEventDomain/src/CosEventDomainAdmin_EventDomain_impl.erl delete mode 100644 lib/cosEventDomain/src/Makefile delete mode 100644 lib/cosEventDomain/src/cosEventDomain.app.src delete mode 100644 lib/cosEventDomain/src/cosEventDomain.appup.src delete mode 100644 lib/cosEventDomain/src/cosEventDomainApp.erl delete mode 100644 lib/cosEventDomain/src/cosEventDomainApp.hrl delete mode 100644 lib/cosEventDomain/test/Makefile delete mode 100644 lib/cosEventDomain/test/cosEventDomain.cover delete mode 100644 lib/cosEventDomain/test/cosEventDomain.spec delete mode 100644 lib/cosEventDomain/test/event_domain_SUITE.erl delete mode 100644 lib/cosEventDomain/test/generated_SUITE.erl delete mode 100644 lib/cosEventDomain/vsn.mk delete mode 100644 lib/cosFileTransfer/AUTHORS delete mode 100644 lib/cosFileTransfer/Makefile delete mode 100644 lib/cosFileTransfer/doc/html/.gitignore delete mode 100644 lib/cosFileTransfer/doc/man3/.gitignore delete mode 100644 lib/cosFileTransfer/doc/man6/.gitignore delete mode 100644 lib/cosFileTransfer/doc/pdf/.gitignore delete mode 100644 lib/cosFileTransfer/doc/src/CosFileTransfer.gif delete mode 100644 lib/cosFileTransfer/doc/src/CosFileTransfer_Directory.xml delete mode 100644 lib/cosFileTransfer/doc/src/CosFileTransfer_File.xml delete mode 100644 lib/cosFileTransfer/doc/src/CosFileTransfer_FileIterator.xml delete mode 100644 lib/cosFileTransfer/doc/src/CosFileTransfer_FileTransferSession.xml delete mode 100644 lib/cosFileTransfer/doc/src/CosFileTransfer_VirtualFileSystem.xml delete mode 100644 lib/cosFileTransfer/doc/src/Makefile delete mode 100644 lib/cosFileTransfer/doc/src/book.xml delete mode 100644 lib/cosFileTransfer/doc/src/ch_contents.xml delete mode 100644 lib/cosFileTransfer/doc/src/ch_example.xml delete mode 100644 lib/cosFileTransfer/doc/src/ch_install.xml delete mode 100644 lib/cosFileTransfer/doc/src/ch_introduction.xml delete mode 100644 lib/cosFileTransfer/doc/src/ch_system.xml delete mode 100644 lib/cosFileTransfer/doc/src/cosFileTransferApp.xml delete mode 100644 lib/cosFileTransfer/doc/src/notes.xml delete mode 100644 lib/cosFileTransfer/doc/src/part.xml delete mode 100644 lib/cosFileTransfer/doc/src/ref_man.xml delete mode 100644 lib/cosFileTransfer/ebin/.gitignore delete mode 100644 lib/cosFileTransfer/examples/.gitignore delete mode 100644 lib/cosFileTransfer/include/.gitignore delete mode 100644 lib/cosFileTransfer/info delete mode 100644 lib/cosFileTransfer/priv/.gitignore delete mode 100644 lib/cosFileTransfer/src/CosFileTransfer.cfg delete mode 100644 lib/cosFileTransfer/src/CosFileTransfer.idl delete mode 100644 lib/cosFileTransfer/src/CosFileTransfer_Directory_impl.erl delete mode 100644 lib/cosFileTransfer/src/CosFileTransfer_FileIterator_impl.erl delete mode 100644 lib/cosFileTransfer/src/CosFileTransfer_FileTransferSession_impl.erl delete mode 100644 lib/cosFileTransfer/src/CosFileTransfer_File_impl.erl delete mode 100644 lib/cosFileTransfer/src/CosFileTransfer_VirtualFileSystem_impl.erl delete mode 100644 lib/cosFileTransfer/src/Makefile delete mode 100644 lib/cosFileTransfer/src/cosFileTransfer.app.src delete mode 100644 lib/cosFileTransfer/src/cosFileTransfer.appup.src delete mode 100644 lib/cosFileTransfer/src/cosFileTransferApp.erl delete mode 100644 lib/cosFileTransfer/src/cosFileTransferApp.hrl delete mode 100644 lib/cosFileTransfer/src/cosFileTransferNATIVE_file.erl delete mode 100644 lib/cosFileTransfer/test/Makefile delete mode 100644 lib/cosFileTransfer/test/cosFileTransfer.cover delete mode 100644 lib/cosFileTransfer/test/cosFileTransfer.spec delete mode 100644 lib/cosFileTransfer/test/fileTransfer_SUITE.erl delete mode 100644 lib/cosFileTransfer/vsn.mk delete mode 100644 lib/cosNotification/AUTHORS delete mode 100644 lib/cosNotification/Makefile delete mode 100644 lib/cosNotification/doc/html/.gitignore delete mode 100644 lib/cosNotification/doc/man3/.gitignore delete mode 100644 lib/cosNotification/doc/man6/.gitignore delete mode 100644 lib/cosNotification/doc/pdf/.gitignore delete mode 100644 lib/cosNotification/doc/src/CosNotification.xml delete mode 100644 lib/cosNotification/doc/src/CosNotification_AdminPropertiesAdmin.xml delete mode 100644 lib/cosNotification/doc/src/CosNotification_QoSAdmin.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_ConsumerAdmin.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_EventChannel.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_EventChannelFactory.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyConsumer.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPullConsumer.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPullSupplier.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPushConsumer.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPushSupplier.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxySupplier.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPullConsumer.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPullSupplier.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPushConsumer.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPushSupplier.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPullConsumer.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPullSupplier.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPushConsumer.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPushSupplier.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyChannelAdmin_SupplierAdmin.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyComm_NotifyPublish.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyComm_NotifySubscribe.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyFilter_Filter.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyFilter_FilterAdmin.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyFilter_FilterFactory.xml delete mode 100644 lib/cosNotification/doc/src/CosNotifyFilter_MappingFilter.xml delete mode 100644 lib/cosNotification/doc/src/Makefile delete mode 100644 lib/cosNotification/doc/src/book.xml delete mode 100644 lib/cosNotification/doc/src/ch_BNF.xml delete mode 100644 lib/cosNotification/doc/src/ch_QoS.xml delete mode 100644 lib/cosNotification/doc/src/ch_contents.xml delete mode 100644 lib/cosNotification/doc/src/ch_example.xml delete mode 100644 lib/cosNotification/doc/src/ch_install.xml delete mode 100644 lib/cosNotification/doc/src/ch_introduction.xml delete mode 100644 lib/cosNotification/doc/src/ch_system.xml delete mode 100644 lib/cosNotification/doc/src/cosNotificationApp.xml delete mode 100644 lib/cosNotification/doc/src/eventstructure.gif delete mode 100644 lib/cosNotification/doc/src/notes.xml delete mode 100644 lib/cosNotification/doc/src/notificationFlow.gif delete mode 100644 lib/cosNotification/doc/src/part.xml delete mode 100644 lib/cosNotification/doc/src/ref_man.xml delete mode 100644 lib/cosNotification/ebin/.gitignore delete mode 100644 lib/cosNotification/examples/.gitignore delete mode 100644 lib/cosNotification/include/.gitignore delete mode 100644 lib/cosNotification/info delete mode 100644 lib/cosNotification/priv/.gitignore delete mode 100644 lib/cosNotification/src/CosEvent.cfg delete mode 100644 lib/cosNotification/src/CosNotification.cfg delete mode 100644 lib/cosNotification/src/CosNotification.idl delete mode 100644 lib/cosNotification/src/CosNotification_Common.erl delete mode 100644 lib/cosNotification/src/CosNotification_Definitions.hrl delete mode 100644 lib/cosNotification/src/CosNotifyChannelAdmin.cfg delete mode 100644 lib/cosNotification/src/CosNotifyChannelAdmin.idl delete mode 100644 lib/cosNotification/src/CosNotifyChannelAdmin_ConsumerAdmin_impl.erl delete mode 100644 lib/cosNotification/src/CosNotifyChannelAdmin_EventChannelFactory_impl.erl delete mode 100644 lib/cosNotification/src/CosNotifyChannelAdmin_EventChannel_impl.erl delete mode 100644 lib/cosNotification/src/CosNotifyChannelAdmin_SupplierAdmin_impl.erl delete mode 100644 lib/cosNotification/src/CosNotifyComm.cfg delete mode 100644 lib/cosNotification/src/CosNotifyComm.idl delete mode 100644 lib/cosNotification/src/CosNotifyFilter.cfg delete mode 100644 lib/cosNotification/src/CosNotifyFilter.idl delete mode 100644 lib/cosNotification/src/CosNotifyFilter_FilterFactory_impl.erl delete mode 100644 lib/cosNotification/src/CosNotifyFilter_Filter_impl.erl delete mode 100644 lib/cosNotification/src/CosNotifyFilter_MappingFilter_impl.erl delete mode 100644 lib/cosNotification/src/CosTypedEvent.idl delete mode 100644 lib/cosNotification/src/CosTypedNotification.idl delete mode 100644 lib/cosNotification/src/Makefile delete mode 100644 lib/cosNotification/src/PullerConsumer_impl.erl delete mode 100644 lib/cosNotification/src/PullerSupplier_impl.erl delete mode 100644 lib/cosNotification/src/PusherConsumer_impl.erl delete mode 100644 lib/cosNotification/src/PusherSupplier_impl.erl delete mode 100644 lib/cosNotification/src/cosNotification.app.src delete mode 100644 lib/cosNotification/src/cosNotification.appup.src delete mode 100644 lib/cosNotification/src/cosNotificationApp.erl delete mode 100644 lib/cosNotification/src/cosNotificationAppComm.idl delete mode 100644 lib/cosNotification/src/cosNotificationComm.cfg delete mode 100644 lib/cosNotification/src/cosNotification_Filter.erl delete mode 100644 lib/cosNotification/src/cosNotification_Grammar.yrl delete mode 100644 lib/cosNotification/src/cosNotification_Scanner.erl delete mode 100644 lib/cosNotification/src/cosNotification_eventDB.erl delete mode 100644 lib/cosNotification/test/Makefile delete mode 100644 lib/cosNotification/test/cosNotification.cover delete mode 100644 lib/cosNotification/test/cosNotification.spec delete mode 100644 lib/cosNotification/test/eventDB_SUITE.erl delete mode 100644 lib/cosNotification/test/generated_SUITE.erl delete mode 100644 lib/cosNotification/test/grammar_SUITE.erl delete mode 100644 lib/cosNotification/test/notification_SUITE.erl delete mode 100644 lib/cosNotification/test/notify_test_impl.erl delete mode 100644 lib/cosNotification/test/notify_test_server.cfg delete mode 100644 lib/cosNotification/test/notify_test_server.idl delete mode 100644 lib/cosNotification/vsn.mk delete mode 100644 lib/cosProperty/AUTHORS delete mode 100644 lib/cosProperty/Makefile delete mode 100644 lib/cosProperty/doc/html/.gitignore delete mode 100644 lib/cosProperty/doc/man3/.gitignore delete mode 100644 lib/cosProperty/doc/man6/.gitignore delete mode 100644 lib/cosProperty/doc/pdf/.gitignore delete mode 100644 lib/cosProperty/doc/src/CosPropertyService_PropertiesIterator.xml delete mode 100644 lib/cosProperty/doc/src/CosPropertyService_PropertyNamesIterator.xml delete mode 100644 lib/cosProperty/doc/src/CosPropertyService_PropertySet.xml delete mode 100644 lib/cosProperty/doc/src/CosPropertyService_PropertySetDef.xml delete mode 100644 lib/cosProperty/doc/src/CosPropertyService_PropertySetDefFactory.xml delete mode 100644 lib/cosProperty/doc/src/CosPropertyService_PropertySetFactory.xml delete mode 100644 lib/cosProperty/doc/src/Makefile delete mode 100644 lib/cosProperty/doc/src/book.xml delete mode 100644 lib/cosProperty/doc/src/ch_contents.xml delete mode 100644 lib/cosProperty/doc/src/ch_example.xml delete mode 100644 lib/cosProperty/doc/src/ch_install.xml delete mode 100644 lib/cosProperty/doc/src/ch_introduction.xml delete mode 100644 lib/cosProperty/doc/src/cosProperty.xml delete mode 100644 lib/cosProperty/doc/src/notes.xml delete mode 100644 lib/cosProperty/doc/src/part.xml delete mode 100644 lib/cosProperty/doc/src/ref_man.xml delete mode 100644 lib/cosProperty/ebin/.gitignore delete mode 100644 lib/cosProperty/examples/.gitignore delete mode 100644 lib/cosProperty/include/.gitignore delete mode 100644 lib/cosProperty/info delete mode 100644 lib/cosProperty/priv/.gitignore delete mode 100644 lib/cosProperty/src/CosProperty.cfg delete mode 100644 lib/cosProperty/src/CosProperty.idl delete mode 100644 lib/cosProperty/src/CosPropertyService_PropertiesIterator_impl.erl delete mode 100644 lib/cosProperty/src/CosPropertyService_PropertyNamesIterator_impl.erl delete mode 100644 lib/cosProperty/src/CosPropertyService_PropertySetDefFactory_impl.erl delete mode 100644 lib/cosProperty/src/CosPropertyService_PropertySetDef_impl.erl delete mode 100644 lib/cosProperty/src/CosPropertyService_PropertySetFactory_impl.erl delete mode 100644 lib/cosProperty/src/Makefile delete mode 100644 lib/cosProperty/src/cosProperty.app.src delete mode 100644 lib/cosProperty/src/cosProperty.appup.src delete mode 100644 lib/cosProperty/src/cosProperty.erl delete mode 100644 lib/cosProperty/src/cosProperty.hrl delete mode 100644 lib/cosProperty/test/Makefile delete mode 100644 lib/cosProperty/test/cosProperty.cover delete mode 100644 lib/cosProperty/test/cosProperty.spec delete mode 100644 lib/cosProperty/test/generated_SUITE.erl delete mode 100644 lib/cosProperty/test/property_SUITE.erl delete mode 100644 lib/cosProperty/vsn.mk delete mode 100644 lib/cosTime/AUTHORS delete mode 100644 lib/cosTime/Makefile delete mode 100644 lib/cosTime/doc/html/.gitignore delete mode 100644 lib/cosTime/doc/man3/.gitignore delete mode 100644 lib/cosTime/doc/man6/.gitignore delete mode 100644 lib/cosTime/doc/pdf/.gitignore delete mode 100644 lib/cosTime/doc/src/CosTime_TIO.xml delete mode 100644 lib/cosTime/doc/src/CosTime_TimeService.xml delete mode 100644 lib/cosTime/doc/src/CosTime_UTO.xml delete mode 100644 lib/cosTime/doc/src/CosTimerEvent_TimerEventHandler.xml delete mode 100644 lib/cosTime/doc/src/CosTimerEvent_TimerEventService.xml delete mode 100644 lib/cosTime/doc/src/Makefile delete mode 100644 lib/cosTime/doc/src/book.xml delete mode 100644 lib/cosTime/doc/src/ch_contents.xml delete mode 100644 lib/cosTime/doc/src/ch_example.xml delete mode 100644 lib/cosTime/doc/src/ch_install.xml delete mode 100644 lib/cosTime/doc/src/ch_introduction.xml delete mode 100644 lib/cosTime/doc/src/cosTime.xml delete mode 100644 lib/cosTime/doc/src/notes.xml delete mode 100644 lib/cosTime/doc/src/part.xml delete mode 100644 lib/cosTime/doc/src/ref_man.xml delete mode 100644 lib/cosTime/ebin/.gitignore delete mode 100644 lib/cosTime/examples/.gitignore delete mode 100644 lib/cosTime/include/.gitignore delete mode 100644 lib/cosTime/info delete mode 100644 lib/cosTime/priv/.gitignore delete mode 100644 lib/cosTime/src/CosTime.cfg delete mode 100644 lib/cosTime/src/CosTime.idl delete mode 100644 lib/cosTime/src/CosTime_TIO_impl.erl delete mode 100644 lib/cosTime/src/CosTime_TimeService_impl.erl delete mode 100644 lib/cosTime/src/CosTime_UTO_impl.erl delete mode 100644 lib/cosTime/src/CosTimerEvent.cfg delete mode 100644 lib/cosTime/src/CosTimerEvent.idl delete mode 100644 lib/cosTime/src/CosTimerEvent_TimerEventHandler_impl.erl delete mode 100644 lib/cosTime/src/CosTimerEvent_TimerEventService_impl.erl delete mode 100644 lib/cosTime/src/Makefile delete mode 100644 lib/cosTime/src/TimeBase.idl delete mode 100644 lib/cosTime/src/cosTime.app.src delete mode 100644 lib/cosTime/src/cosTime.appup.src delete mode 100644 lib/cosTime/src/cosTime.erl delete mode 100644 lib/cosTime/src/cosTimeApp.hrl delete mode 100644 lib/cosTime/test/Makefile delete mode 100644 lib/cosTime/test/cosTime.cover delete mode 100644 lib/cosTime/test/cosTime.spec delete mode 100644 lib/cosTime/test/generated_SUITE.erl delete mode 100644 lib/cosTime/test/time_SUITE.erl delete mode 100644 lib/cosTime/vsn.mk delete mode 100644 lib/cosTransactions/AUTHORS delete mode 100644 lib/cosTransactions/Makefile delete mode 100644 lib/cosTransactions/doc/html/.gitignore delete mode 100644 lib/cosTransactions/doc/man3/.gitignore delete mode 100644 lib/cosTransactions/doc/man6/.gitignore delete mode 100644 lib/cosTransactions/doc/pdf/.gitignore delete mode 100644 lib/cosTransactions/doc/src/CosTransactions_Control.xml delete mode 100644 lib/cosTransactions/doc/src/CosTransactions_Coordinator.xml delete mode 100644 lib/cosTransactions/doc/src/CosTransactions_RecoveryCoordinator.xml delete mode 100644 lib/cosTransactions/doc/src/CosTransactions_Resource.xml delete mode 100644 lib/cosTransactions/doc/src/CosTransactions_SubtransactionAwareResource.xml delete mode 100644 lib/cosTransactions/doc/src/CosTransactions_Synchronization.xml delete mode 100644 lib/cosTransactions/doc/src/CosTransactions_Terminator.xml delete mode 100644 lib/cosTransactions/doc/src/CosTransactions_TransactionFactory.xml delete mode 100644 lib/cosTransactions/doc/src/CosTransactions_TransactionalObject.xml delete mode 100644 lib/cosTransactions/doc/src/Makefile delete mode 100644 lib/cosTransactions/doc/src/book.xml delete mode 100644 lib/cosTransactions/doc/src/ch_contents.xml delete mode 100644 lib/cosTransactions/doc/src/ch_example.xml delete mode 100644 lib/cosTransactions/doc/src/ch_install.xml delete mode 100644 lib/cosTransactions/doc/src/ch_introduction.xml delete mode 100644 lib/cosTransactions/doc/src/ch_skeletons.xml delete mode 100644 lib/cosTransactions/doc/src/cosTransactions.xml delete mode 100644 lib/cosTransactions/doc/src/notes.xml delete mode 100644 lib/cosTransactions/doc/src/part.xml delete mode 100644 lib/cosTransactions/doc/src/ref_man.xml delete mode 100644 lib/cosTransactions/ebin/.gitignore delete mode 100644 lib/cosTransactions/examples/Makefile delete mode 100644 lib/cosTransactions/include/.gitignore delete mode 100644 lib/cosTransactions/info delete mode 100644 lib/cosTransactions/priv/.gitignore delete mode 100644 lib/cosTransactions/src/CosTransactions.cfg delete mode 100644 lib/cosTransactions/src/CosTransactions.idl delete mode 100644 lib/cosTransactions/src/CosTransactions_Terminator_impl.erl delete mode 100644 lib/cosTransactions/src/CosTransactions_TransactionFactory_impl.erl delete mode 100644 lib/cosTransactions/src/ETraP_Common.erl delete mode 100644 lib/cosTransactions/src/ETraP_Common.hrl delete mode 100644 lib/cosTransactions/src/ETraP_Server_impl.erl delete mode 100644 lib/cosTransactions/src/Makefile delete mode 100644 lib/cosTransactions/src/cosTransactions.app.src delete mode 100644 lib/cosTransactions/src/cosTransactions.appup.src delete mode 100644 lib/cosTransactions/src/cosTransactions.erl delete mode 100644 lib/cosTransactions/src/etrap_logmgr.erl delete mode 100644 lib/cosTransactions/test/Makefile delete mode 100644 lib/cosTransactions/test/cosTransactions.cover delete mode 100644 lib/cosTransactions/test/cosTransactions.spec delete mode 100644 lib/cosTransactions/test/etrap_test.cfg delete mode 100644 lib/cosTransactions/test/etrap_test.idl delete mode 100644 lib/cosTransactions/test/etrap_test_lib.erl delete mode 100644 lib/cosTransactions/test/etrap_test_lib.hrl delete mode 100644 lib/cosTransactions/test/etrap_test_server_impl.erl delete mode 100644 lib/cosTransactions/test/generated_SUITE.erl delete mode 100644 lib/cosTransactions/test/transactions_SUITE.erl delete mode 100644 lib/cosTransactions/vsn.mk delete mode 100644 lib/ic/AUTHORS delete mode 100644 lib/ic/Makefile delete mode 100644 lib/ic/c_src/Makefile delete mode 100644 lib/ic/c_src/Makefile.in delete mode 100644 lib/ic/c_src/Makefile.win32 delete mode 100644 lib/ic/c_src/ic.c delete mode 100644 lib/ic/c_src/ic_tmo.c delete mode 100644 lib/ic/c_src/oe_ei_code_erlang_binary.c delete mode 100644 lib/ic/c_src/oe_ei_decode_longlong.c delete mode 100644 lib/ic/c_src/oe_ei_decode_ulonglong.c delete mode 100644 lib/ic/c_src/oe_ei_decode_wchar.c delete mode 100644 lib/ic/c_src/oe_ei_decode_wstring.c delete mode 100644 lib/ic/c_src/oe_ei_encode_atom.c delete mode 100644 lib/ic/c_src/oe_ei_encode_char.c delete mode 100644 lib/ic/c_src/oe_ei_encode_double.c delete mode 100644 lib/ic/c_src/oe_ei_encode_list_header.c delete mode 100644 lib/ic/c_src/oe_ei_encode_long.c delete mode 100644 lib/ic/c_src/oe_ei_encode_longlong.c delete mode 100644 lib/ic/c_src/oe_ei_encode_pid.c delete mode 100644 lib/ic/c_src/oe_ei_encode_port.c delete mode 100644 lib/ic/c_src/oe_ei_encode_ref.c delete mode 100644 lib/ic/c_src/oe_ei_encode_string.c delete mode 100644 lib/ic/c_src/oe_ei_encode_term.c delete mode 100644 lib/ic/c_src/oe_ei_encode_tuple_header.c delete mode 100644 lib/ic/c_src/oe_ei_encode_ulong.c delete mode 100644 lib/ic/c_src/oe_ei_encode_ulonglong.c delete mode 100644 lib/ic/c_src/oe_ei_encode_version.c delete mode 100644 lib/ic/c_src/oe_ei_encode_wchar.c delete mode 100644 lib/ic/c_src/oe_ei_encode_wstring.c delete mode 100644 lib/ic/doc/html/.gitignore delete mode 100644 lib/ic/doc/man1/.gitignore delete mode 100644 lib/ic/doc/man3/.gitignore delete mode 100644 lib/ic/doc/pdf/.gitignore delete mode 100644 lib/ic/doc/src/CORBA_Environment_alloc.xml delete mode 100644 lib/ic/doc/src/Makefile delete mode 100644 lib/ic/doc/src/book.xml delete mode 100644 lib/ic/doc/src/c-part.xml delete mode 100644 lib/ic/doc/src/ch_basic_idl.xml delete mode 100644 lib/ic/doc/src/ch_c_client.xml delete mode 100644 lib/ic/doc/src/ch_c_corba_env.xml delete mode 100644 lib/ic/doc/src/ch_c_mapping.xml delete mode 100644 lib/ic/doc/src/ch_c_server.xml delete mode 100644 lib/ic/doc/src/ch_erl_genserv.xml delete mode 100644 lib/ic/doc/src/ch_erl_plain.xml delete mode 100644 lib/ic/doc/src/ch_ic_protocol.xml delete mode 100644 lib/ic/doc/src/ch_introduction.xml delete mode 100644 lib/ic/doc/src/ch_java.xml delete mode 100644 lib/ic/doc/src/erl-part.xml delete mode 100644 lib/ic/doc/src/ic.xml delete mode 100644 lib/ic/doc/src/ic_c_protocol.xml delete mode 100644 lib/ic/doc/src/ic_clib.xml delete mode 100644 lib/ic/doc/src/java-part.xml delete mode 100644 lib/ic/doc/src/notes.xml delete mode 100644 lib/ic/doc/src/part.xml delete mode 100644 lib/ic/doc/src/ref_man.xml delete mode 100644 lib/ic/ebin/.gitignore delete mode 100644 lib/ic/examples/all-against-all/Makefile delete mode 100644 lib/ic/examples/all-against-all/Makefile.win32 delete mode 100644 lib/ic/examples/all-against-all/ReadMe delete mode 100644 lib/ic/examples/all-against-all/callbacks.c delete mode 100644 lib/ic/examples/all-against-all/client.c delete mode 100644 lib/ic/examples/all-against-all/client.erl delete mode 100644 lib/ic/examples/all-against-all/client.java delete mode 100644 lib/ic/examples/all-against-all/random.idl delete mode 100644 lib/ic/examples/all-against-all/rmod_random_impl.erl delete mode 100644 lib/ic/examples/all-against-all/server.c delete mode 100644 lib/ic/examples/all-against-all/server.erl delete mode 100644 lib/ic/examples/all-against-all/server.java delete mode 100644 lib/ic/examples/all-against-all/serverImpl.java delete mode 100644 lib/ic/examples/c-client/Makefile delete mode 100644 lib/ic/examples/c-client/ReadMe delete mode 100644 lib/ic/examples/c-client/client.c delete mode 100644 lib/ic/examples/c-client/random.idl delete mode 100644 lib/ic/examples/c-client/rmod_random_impl.erl delete mode 100644 lib/ic/examples/c-client/test.erl delete mode 100644 lib/ic/examples/c-server/Makefile delete mode 100644 lib/ic/examples/c-server/ReadMe delete mode 100644 lib/ic/examples/c-server/callbacks.c delete mode 100644 lib/ic/examples/c-server/client.c delete mode 100644 lib/ic/examples/c-server/client.erl delete mode 100644 lib/ic/examples/c-server/random.idl delete mode 100644 lib/ic/examples/c-server/server.c delete mode 100644 lib/ic/examples/erl-genserv/ReadMe delete mode 100644 lib/ic/examples/erl-genserv/random.idl delete mode 100644 lib/ic/examples/erl-genserv/rmod_random_impl.erl delete mode 100644 lib/ic/examples/erl-plain/ReadMe delete mode 100644 lib/ic/examples/erl-plain/random.idl delete mode 100644 lib/ic/examples/erl-plain/rmod_random_impl.erl delete mode 100644 lib/ic/examples/java-client-server/ReadMe delete mode 100644 lib/ic/examples/java-client-server/client.java delete mode 100644 lib/ic/examples/java-client-server/random.idl delete mode 100644 lib/ic/examples/java-client-server/server.java delete mode 100644 lib/ic/examples/java-client-server/serverImpl.java delete mode 100644 lib/ic/examples/pre_post_condition/Makefile delete mode 100644 lib/ic/examples/pre_post_condition/ReadMe.txt delete mode 100644 lib/ic/examples/pre_post_condition/ex.idl delete mode 100644 lib/ic/examples/pre_post_condition/m_i_impl.erl delete mode 100644 lib/ic/examples/pre_post_condition/tracer.erl delete mode 100644 lib/ic/include/erlang.idl delete mode 100644 lib/ic/include/ic.h delete mode 100644 lib/ic/info delete mode 100644 lib/ic/internal_doc/c-improvements-1.txt delete mode 100644 lib/ic/internal_doc/protocol.txt delete mode 100644 lib/ic/java_src/Makefile delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/Any.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/AnyHelper.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/AnyHolder.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/BooleanHolder.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/ByteHolder.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/CharHolder.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/DoubleHolder.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/Environment.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/FloatHolder.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/Holder.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/IntHolder.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/LongHolder.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/Makefile delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/Pid.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/PidHelper.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/PidHolder.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/Port.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/PortHelper.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/PortHolder.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/Ref.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/RefHelper.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/RefHolder.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/ShortHolder.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/StringHolder.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/TCKind.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/Term.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/TermHelper.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/TermHolder.java delete mode 100644 lib/ic/java_src/com/ericsson/otp/ic/TypeCode.java delete mode 100644 lib/ic/prebuild.skip delete mode 100644 lib/ic/priv/lib/.gitignore delete mode 100644 lib/ic/priv/obj/.gitignore delete mode 100644 lib/ic/src/Makefile delete mode 100644 lib/ic/src/ic.app.src delete mode 100644 lib/ic/src/ic.erl delete mode 100644 lib/ic/src/ic.hrl delete mode 100644 lib/ic/src/ic_array_java.erl delete mode 100644 lib/ic/src/ic_attribute_java.erl delete mode 100644 lib/ic/src/ic_cbe.erl delete mode 100644 lib/ic/src/ic_cclient.erl delete mode 100644 lib/ic/src/ic_code.erl delete mode 100644 lib/ic/src/ic_codegen.erl delete mode 100644 lib/ic/src/ic_constant_java.erl delete mode 100644 lib/ic/src/ic_cserver.erl delete mode 100644 lib/ic/src/ic_debug.hrl delete mode 100644 lib/ic/src/ic_enum_java.erl delete mode 100644 lib/ic/src/ic_erl_template.erl delete mode 100644 lib/ic/src/ic_erlbe.erl delete mode 100644 lib/ic/src/ic_error.erl delete mode 100644 lib/ic/src/ic_fetch.erl delete mode 100644 lib/ic/src/ic_file.erl delete mode 100644 lib/ic/src/ic_forms.erl delete mode 100644 lib/ic/src/ic_genobj.erl delete mode 100644 lib/ic/src/ic_java_type.erl delete mode 100644 lib/ic/src/ic_jbe.erl delete mode 100644 lib/ic/src/ic_noc.erl delete mode 100644 lib/ic/src/ic_options.erl delete mode 100644 lib/ic/src/ic_plainbe.erl delete mode 100644 lib/ic/src/ic_pp.erl delete mode 100644 lib/ic/src/ic_pragma.erl delete mode 100644 lib/ic/src/ic_sequence_java.erl delete mode 100644 lib/ic/src/ic_struct_java.erl delete mode 100644 lib/ic/src/ic_symtab.erl delete mode 100644 lib/ic/src/ic_union_java.erl delete mode 100644 lib/ic/src/ic_util.erl delete mode 100644 lib/ic/src/icenum.erl delete mode 100644 lib/ic/src/iceval.erl delete mode 100644 lib/ic/src/icforms.hrl delete mode 100644 lib/ic/src/icparse.yrl delete mode 100644 lib/ic/src/icpreproc.erl delete mode 100644 lib/ic/src/icscan.erl delete mode 100644 lib/ic/src/icstruct.erl delete mode 100644 lib/ic/src/ictk.erl delete mode 100644 lib/ic/src/ictype.erl delete mode 100644 lib/ic/src/icunion.erl delete mode 100644 lib/ic/src/icyeccpre.hrl delete mode 100644 lib/ic/test/Makefile delete mode 100644 lib/ic/test/c_client_erl_server_SUITE.erl delete mode 100644 lib/ic/test/c_client_erl_server_SUITE_data/Makefile.src delete mode 100644 lib/ic/test/c_client_erl_server_SUITE_data/c_client.c delete mode 100644 lib/ic/test/c_client_erl_server_SUITE_data/c_erl_test.idl delete mode 100644 lib/ic/test/c_client_erl_server_SUITE_data/erl_server.erl delete mode 100644 lib/ic/test/c_client_erl_server_SUITE_data/m_i_impl.erl delete mode 100644 lib/ic/test/c_client_erl_server_proto_SUITE.erl delete mode 100644 lib/ic/test/c_client_erl_server_proto_SUITE_data/Makefile.src delete mode 100644 lib/ic/test/c_client_erl_server_proto_SUITE_data/c_client.c delete mode 100644 lib/ic/test/c_client_erl_server_proto_SUITE_data/c_erl_test.idl delete mode 100644 lib/ic/test/c_client_erl_server_proto_SUITE_data/erl_server.erl delete mode 100644 lib/ic/test/c_client_erl_server_proto_SUITE_data/m_i_impl.erl delete mode 100644 lib/ic/test/c_client_erl_server_proto_SUITE_data/my.c delete mode 100644 lib/ic/test/c_client_erl_server_proto_tmo_SUITE.erl delete mode 100644 lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/Makefile.src delete mode 100644 lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/c_client.c delete mode 100644 lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/c_erl_test.idl delete mode 100644 lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/erl_server.erl delete mode 100644 lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/m_i_impl.erl delete mode 100644 lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/my.c delete mode 100644 lib/ic/test/erl_client_c_server_SUITE.erl delete mode 100644 lib/ic/test/erl_client_c_server_SUITE_data/Makefile.src delete mode 100644 lib/ic/test/erl_client_c_server_SUITE_data/c_server.c delete mode 100644 lib/ic/test/erl_client_c_server_SUITE_data/callbacks.c delete mode 100644 lib/ic/test/erl_client_c_server_SUITE_data/erl_c_test.idl delete mode 100644 lib/ic/test/erl_client_c_server_SUITE_data/erl_client.erl delete mode 100644 lib/ic/test/erl_client_c_server_proto_SUITE.erl delete mode 100644 lib/ic/test/erl_client_c_server_proto_SUITE_data/Makefile.src delete mode 100644 lib/ic/test/erl_client_c_server_proto_SUITE_data/c_server.c delete mode 100644 lib/ic/test/erl_client_c_server_proto_SUITE_data/callbacks.c delete mode 100644 lib/ic/test/erl_client_c_server_proto_SUITE_data/erl_c_test.idl delete mode 100644 lib/ic/test/erl_client_c_server_proto_SUITE_data/erl_client.erl delete mode 100644 lib/ic/test/erl_client_c_server_proto_SUITE_data/my.c delete mode 100644 lib/ic/test/ic.cover delete mode 100644 lib/ic/test/ic.spec delete mode 100644 lib/ic/test/ic.spec.vxworks delete mode 100644 lib/ic/test/ic_SUITE.erl delete mode 100644 lib/ic/test/ic_SUITE_data/Corba.idl delete mode 100644 lib/ic/test/ic_SUITE_data/Coss.idl delete mode 100644 lib/ic/test/ic_SUITE_data/attr.idl delete mode 100644 lib/ic/test/ic_SUITE_data/c_err1.idl delete mode 100644 lib/ic/test/ic_SUITE_data/c_err2.idl delete mode 100644 lib/ic/test/ic_SUITE_data/c_err3.idl delete mode 100644 lib/ic/test/ic_SUITE_data/c_norm.idl delete mode 100644 lib/ic/test/ic_SUITE_data/enum.idl delete mode 100644 lib/ic/test/ic_SUITE_data/forward.idl delete mode 100644 lib/ic/test/ic_SUITE_data/include.idl delete mode 100644 lib/ic/test/ic_SUITE_data/include2.idl delete mode 100644 lib/ic/test/ic_SUITE_data/include3.idl delete mode 100644 lib/ic/test/ic_SUITE_data/inherit.idl delete mode 100644 lib/ic/test/ic_SUITE_data/inherit_err.idl delete mode 100644 lib/ic/test/ic_SUITE_data/inherit_warn.idl delete mode 100644 lib/ic/test/ic_SUITE_data/mult_ids.idl delete mode 100644 lib/ic/test/ic_SUITE_data/nasty.idl delete mode 100644 lib/ic/test/ic_SUITE_data/one.idl delete mode 100644 lib/ic/test/ic_SUITE_data/one_followed.idl delete mode 100644 lib/ic/test/ic_SUITE_data/one_out.idl delete mode 100644 lib/ic/test/ic_SUITE_data/one_raises.idl delete mode 100644 lib/ic/test/ic_SUITE_data/one_void.idl delete mode 100644 lib/ic/test/ic_SUITE_data/raises_reg.idl delete mode 100644 lib/ic/test/ic_SUITE_data/struct.idl delete mode 100644 lib/ic/test/ic_SUITE_data/syntax1.idl delete mode 100644 lib/ic/test/ic_SUITE_data/syntax2.idl delete mode 100644 lib/ic/test/ic_SUITE_data/syntax3.idl delete mode 100644 lib/ic/test/ic_SUITE_data/syntax4.idl delete mode 100644 lib/ic/test/ic_SUITE_data/syntax5.idl delete mode 100644 lib/ic/test/ic_SUITE_data/syntax6.idl delete mode 100644 lib/ic/test/ic_SUITE_data/type.idl delete mode 100644 lib/ic/test/ic_SUITE_data/typeid.idl delete mode 100644 lib/ic/test/ic_SUITE_data/u_case_mult.idl delete mode 100644 lib/ic/test/ic_SUITE_data/u_default.idl delete mode 100644 lib/ic/test/ic_SUITE_data/u_mult.idl delete mode 100644 lib/ic/test/ic_SUITE_data/u_norm.idl delete mode 100644 lib/ic/test/ic_SUITE_data/u_type.idl delete mode 100644 lib/ic/test/ic_SUITE_data/undef_id.idl delete mode 100644 lib/ic/test/ic_be_SUITE.erl delete mode 100644 lib/ic/test/ic_be_SUITE_data/plain.idl delete mode 100644 lib/ic/test/ic_pp_SUITE.erl delete mode 100644 lib/ic/test/ic_pp_SUITE_data/arg.idl delete mode 100644 lib/ic/test/ic_pp_SUITE_data/cascade.idl delete mode 100644 lib/ic/test/ic_pp_SUITE_data/comment.idl delete mode 100644 lib/ic/test/ic_pp_SUITE_data/concat.idl delete mode 100644 lib/ic/test/ic_pp_SUITE_data/define.idl delete mode 100644 lib/ic/test/ic_pp_SUITE_data/if.idl delete mode 100644 lib/ic/test/ic_pp_SUITE_data/if_zero.idl delete mode 100644 lib/ic/test/ic_pp_SUITE_data/improp_nest_constr.idl delete mode 100644 lib/ic/test/ic_pp_SUITE_data/inc.idl delete mode 100644 lib/ic/test/ic_pp_SUITE_data/included1.idl delete mode 100644 lib/ic/test/ic_pp_SUITE_data/included2.idl delete mode 100644 lib/ic/test/ic_pp_SUITE_data/includer.idl delete mode 100644 lib/ic/test/ic_pp_SUITE_data/line.idl delete mode 100644 lib/ic/test/ic_pp_SUITE_data/misc.idl delete mode 100644 lib/ic/test/ic_pp_SUITE_data/nopara.idl delete mode 100644 lib/ic/test/ic_pp_SUITE_data/predef.idl delete mode 100644 lib/ic/test/ic_pp_SUITE_data/predef_time.idl delete mode 100644 lib/ic/test/ic_pp_SUITE_data/self_ref.idl delete mode 100644 lib/ic/test/ic_pp_SUITE_data/separate.idl delete mode 100644 lib/ic/test/ic_pp_SUITE_data/swallow_sc.idl delete mode 100644 lib/ic/test/ic_pp_SUITE_data/unintended_grp.idl delete mode 100644 lib/ic/test/ic_pragma_SUITE.erl delete mode 100644 lib/ic/test/ic_pragma_SUITE_data/reg_m0.idl delete mode 100644 lib/ic/test/ic_pragma_SUITE_data/reg_m1.idl delete mode 100644 lib/ic/test/ic_pragma_SUITE_data/reg_m2.idl delete mode 100644 lib/ic/test/ic_pragma_SUITE_data/reg_m3.idl delete mode 100644 lib/ic/test/ic_pragma_SUITE_data/reg_m4.idl delete mode 100644 lib/ic/test/ic_pragma_SUITE_data/reg_m5.idl delete mode 100644 lib/ic/test/ic_pragma_SUITE_data/reg_m6.idl delete mode 100644 lib/ic/test/ic_pragma_SUITE_data/reg_m7.idl delete mode 100644 lib/ic/test/ic_pragma_SUITE_data/uggly.idl delete mode 100644 lib/ic/test/ic_register_SUITE.erl delete mode 100644 lib/ic/test/ic_register_SUITE_data/reg_m10.idl delete mode 100644 lib/ic/test/ic_register_SUITE_data/reg_m11.idl delete mode 100644 lib/ic/test/ic_register_SUITE_data/reg_m12.idl delete mode 100644 lib/ic/test/ic_register_SUITE_data/reg_m8.idl delete mode 100644 lib/ic/test/ic_register_SUITE_data/reg_m9.idl delete mode 100644 lib/ic/test/ic_smoke.spec delete mode 100644 lib/ic/test/java_client_erl_server_SUITE.erl delete mode 100644 lib/ic/test/java_client_erl_server_SUITE_data/JavaClient.java delete mode 100644 lib/ic/test/java_client_erl_server_SUITE_data/Makefile.src delete mode 100644 lib/ic/test/java_client_erl_server_SUITE_data/java_erl_test.idl delete mode 100644 lib/ic/test/java_client_erl_server_SUITE_data/m_i_impl.erl delete mode 100644 lib/ic/vsn.mk delete mode 100644 lib/orber/AUTHORS delete mode 100644 lib/orber/COSS/CosNaming/CosNaming_BindingIterator_impl.erl delete mode 100644 lib/orber/COSS/CosNaming/CosNaming_NamingContextExt_impl.erl delete mode 100644 lib/orber/COSS/CosNaming/Makefile delete mode 100644 lib/orber/COSS/CosNaming/cos_naming.idl delete mode 100644 lib/orber/COSS/CosNaming/cos_naming_ext.idl delete mode 100644 lib/orber/COSS/CosNaming/lname.erl delete mode 100644 lib/orber/COSS/CosNaming/lname.hrl delete mode 100644 lib/orber/COSS/CosNaming/lname_component.erl delete mode 100644 lib/orber/COSS/CosNaming/orber_cosnaming.hrl delete mode 100644 lib/orber/COSS/CosNaming/orber_cosnaming_utils.erl delete mode 100644 lib/orber/Makefile delete mode 100644 lib/orber/c_src/InitialReference.cc delete mode 100644 lib/orber/c_src/InitialReference.hh delete mode 100644 lib/orber/c_src/Makefile delete mode 100644 lib/orber/c_src/Makefile.in delete mode 100644 lib/orber/c_src/main.cc delete mode 100644 lib/orber/doc/etc/.gitignore delete mode 100644 lib/orber/doc/html/.gitignore delete mode 100644 lib/orber/doc/javadoc/.gitignore delete mode 100644 lib/orber/doc/man1/.gitignore delete mode 100644 lib/orber/doc/man3/.gitignore delete mode 100644 lib/orber/doc/pdf/.gitignore delete mode 100644 lib/orber/doc/src/CosNaming.xml delete mode 100644 lib/orber/doc/src/CosNaming_BindingIterator.xml delete mode 100644 lib/orber/doc/src/CosNaming_NamingContext.xml delete mode 100644 lib/orber/doc/src/CosNaming_NamingContextExt.xml delete mode 100644 lib/orber/doc/src/Makefile delete mode 100644 lib/orber/doc/src/Module_Interface.xml delete mode 100644 lib/orber/doc/src/Orber/InitialReference.java delete mode 100644 lib/orber/doc/src/Orber/Makefile delete mode 100644 lib/orber/doc/src/any.xml delete mode 100644 lib/orber/doc/src/book.xml delete mode 100644 lib/orber/doc/src/ch_contents.xml delete mode 100644 lib/orber/doc/src/ch_debugging.xml delete mode 100644 lib/orber/doc/src/ch_exceptions.xml delete mode 100644 lib/orber/doc/src/ch_idl_to_erlang_mapping.xml delete mode 100644 lib/orber/doc/src/ch_ifr.xml delete mode 100644 lib/orber/doc/src/ch_install.xml delete mode 100644 lib/orber/doc/src/ch_interceptors.xml delete mode 100644 lib/orber/doc/src/ch_introduction.xml delete mode 100644 lib/orber/doc/src/ch_naming_service.xml delete mode 100644 lib/orber/doc/src/ch_orber_kernel.xml delete mode 100644 lib/orber/doc/src/ch_orberweb.xml delete mode 100644 lib/orber/doc/src/ch_security.xml delete mode 100644 lib/orber/doc/src/ch_stubs.xml delete mode 100644 lib/orber/doc/src/corba.xml delete mode 100644 lib/orber/doc/src/corba_object.xml delete mode 100644 lib/orber/doc/src/dataframe1.gif delete mode 100644 lib/orber/doc/src/dataframe2.gif delete mode 100644 lib/orber/doc/src/dataframe3.gif delete mode 100644 lib/orber/doc/src/dataframe4.gif delete mode 100644 lib/orber/doc/src/dataframe5.gif delete mode 100644 lib/orber/doc/src/dataframe6.gif delete mode 100644 lib/orber/doc/src/dataframe7.gif delete mode 100644 lib/orber/doc/src/dataframe8.gif delete mode 100644 lib/orber/doc/src/dependent.gif delete mode 100644 lib/orber/doc/src/example_part.xml delete mode 100644 lib/orber/doc/src/firewall_nat.gif delete mode 100644 lib/orber/doc/src/fixed.xml delete mode 100644 lib/orber/doc/src/ifr_notes.txt delete mode 100644 lib/orber/doc/src/iiop.gif delete mode 100644 lib/orber/doc/src/images/GridBagEx.gif delete mode 100644 lib/orber/doc/src/images/OpenBookIcon.gif delete mode 100644 lib/orber/doc/src/images/blue-ball-small.gif delete mode 100644 lib/orber/doc/src/images/blue-ball.gif delete mode 100644 lib/orber/doc/src/images/class-index.gif delete mode 100644 lib/orber/doc/src/images/constructor-index.gif delete mode 100644 lib/orber/doc/src/images/constructors.gif delete mode 100644 lib/orber/doc/src/images/cyan-ball-small.gif delete mode 100644 lib/orber/doc/src/images/cyan-ball.gif delete mode 100644 lib/orber/doc/src/images/error-index.gif delete mode 100644 lib/orber/doc/src/images/exception-index.gif delete mode 100644 lib/orber/doc/src/images/green-ball-small.gif delete mode 100644 lib/orber/doc/src/images/green-ball.gif delete mode 100644 lib/orber/doc/src/images/interface-index.gif delete mode 100644 lib/orber/doc/src/images/magenta-ball-small.gif delete mode 100644 lib/orber/doc/src/images/magenta-ball.gif delete mode 100644 lib/orber/doc/src/images/method-index.gif delete mode 100644 lib/orber/doc/src/images/methods.gif delete mode 100644 lib/orber/doc/src/images/package-index.gif delete mode 100644 lib/orber/doc/src/images/red-ball-small.gif delete mode 100644 lib/orber/doc/src/images/red-ball.gif delete mode 100644 lib/orber/doc/src/images/variable-index.gif delete mode 100644 lib/orber/doc/src/images/variables.gif delete mode 100644 lib/orber/doc/src/images/yellow-ball-small.gif delete mode 100644 lib/orber/doc/src/images/yellow-ball.gif delete mode 100644 lib/orber/doc/src/interceptor_operations.gif delete mode 100644 lib/orber/doc/src/interceptors.xml delete mode 100644 lib/orber/doc/src/intro_part.xml delete mode 100644 lib/orber/doc/src/lname.xml delete mode 100644 lib/orber/doc/src/lname_component.xml delete mode 100644 lib/orber/doc/src/menuframe.gif delete mode 100644 lib/orber/doc/src/name.gif delete mode 100644 lib/orber/doc/src/notes.xml delete mode 100644 lib/orber/doc/src/orber.xml delete mode 100644 lib/orber/doc/src/orber_acl.xml delete mode 100644 lib/orber/doc/src/orber_diagnostics.xml delete mode 100644 lib/orber/doc/src/orber_ifr.xml delete mode 100644 lib/orber/doc/src/orber_tc.xml delete mode 100644 lib/orber/doc/src/orbs.gif delete mode 100644 lib/orber/doc/src/part.xml delete mode 100644 lib/orber/doc/src/ref_man.xml delete mode 100644 lib/orber/doc/src/theORB.gif delete mode 100644 lib/orber/doc/src/tools_debugging_part.xml delete mode 100644 lib/orber/ebin/.gitignore delete mode 100644 lib/orber/examples/Makefile delete mode 100644 lib/orber/examples/Stack/InitialReferences.idl delete mode 100644 lib/orber/examples/Stack/Makefile delete mode 100644 lib/orber/examples/Stack/StackClient.cc delete mode 100644 lib/orber/examples/Stack/StackClient.java delete mode 100644 lib/orber/examples/Stack/StackModule_StackFactory_impl.erl delete mode 100644 lib/orber/examples/Stack/StackModule_Stack_impl.erl delete mode 100644 lib/orber/examples/Stack/stack.idl delete mode 100644 lib/orber/examples/Stack/stack_client.erl delete mode 100644 lib/orber/examples/Stack/stack_factory.erl delete mode 100644 lib/orber/include/corba.hrl delete mode 100644 lib/orber/include/ifr_types.hrl delete mode 100644 lib/orber/include/orber_pi.hrl delete mode 100644 lib/orber/info delete mode 100644 lib/orber/java_src/Makefile delete mode 100644 lib/orber/java_src/Orber/InitialReference.java delete mode 100644 lib/orber/java_src/Orber/Makefile delete mode 100644 lib/orber/prebuild.skip delete mode 100644 lib/orber/priv/Makefile delete mode 100644 lib/orber/priv/Orber/.gitignore delete mode 100644 lib/orber/priv/bin/.gitignore delete mode 100644 lib/orber/priv/blank.html delete mode 100644 lib/orber/priv/info_frames.html delete mode 100644 lib/orber/priv/main_frame.html delete mode 100644 lib/orber/priv/obj/.gitignore delete mode 100644 lib/orber/priv/orber.tool delete mode 100644 lib/orber/priv/orber_help.txt delete mode 100644 lib/orber/priv/start_info.html delete mode 100644 lib/orber/src/CORBA.idl delete mode 100644 lib/orber/src/Makefile delete mode 100644 lib/orber/src/OrberApp_IFR_impl.erl delete mode 100644 lib/orber/src/OrberCSIv2.asn1 delete mode 100644 lib/orber/src/OrberCSIv2.set.asn delete mode 100644 lib/orber/src/OrberIFR.idl delete mode 100644 lib/orber/src/PKIX1Algorithms88.asn1 delete mode 100644 lib/orber/src/PKIX1Explicit88.asn1 delete mode 100644 lib/orber/src/PKIX1Implicit88.asn1 delete mode 100644 lib/orber/src/PKIXAttributeCertificate.asn1 delete mode 100644 lib/orber/src/any.erl delete mode 100644 lib/orber/src/cdr_decode.erl delete mode 100644 lib/orber/src/cdr_encode.erl delete mode 100644 lib/orber/src/cdrlib.erl delete mode 100644 lib/orber/src/corba.erl delete mode 100644 lib/orber/src/corba_boa.erl delete mode 100644 lib/orber/src/corba_nvlist.erl delete mode 100644 lib/orber/src/corba_object.erl delete mode 100644 lib/orber/src/fixed.erl delete mode 100644 lib/orber/src/ifr_objects.hrl delete mode 100644 lib/orber/src/iop_ior.erl delete mode 100644 lib/orber/src/orber.app.src delete mode 100644 lib/orber/src/orber.appup.src delete mode 100644 lib/orber/src/orber.erl delete mode 100644 lib/orber/src/orber_acl.erl delete mode 100644 lib/orber/src/orber_diagnostics.erl delete mode 100644 lib/orber/src/orber_env.erl delete mode 100644 lib/orber/src/orber_exceptions.erl delete mode 100644 lib/orber/src/orber_ifr.erl delete mode 100644 lib/orber/src/orber_ifr.hrl delete mode 100644 lib/orber/src/orber_ifr_aliasdef.erl delete mode 100644 lib/orber/src/orber_ifr_arraydef.erl delete mode 100644 lib/orber/src/orber_ifr_attributedef.erl delete mode 100644 lib/orber/src/orber_ifr_constantdef.erl delete mode 100644 lib/orber/src/orber_ifr_contained.erl delete mode 100644 lib/orber/src/orber_ifr_container.erl delete mode 100644 lib/orber/src/orber_ifr_enumdef.erl delete mode 100644 lib/orber/src/orber_ifr_exceptiondef.erl delete mode 100644 lib/orber/src/orber_ifr_fixeddef.erl delete mode 100644 lib/orber/src/orber_ifr_idltype.erl delete mode 100644 lib/orber/src/orber_ifr_interfacedef.erl delete mode 100644 lib/orber/src/orber_ifr_irobject.erl delete mode 100644 lib/orber/src/orber_ifr_moduledef.erl delete mode 100644 lib/orber/src/orber_ifr_operationdef.erl delete mode 100644 lib/orber/src/orber_ifr_orb.erl delete mode 100644 lib/orber/src/orber_ifr_primitivedef.erl delete mode 100644 lib/orber/src/orber_ifr_repository.erl delete mode 100644 lib/orber/src/orber_ifr_sequencedef.erl delete mode 100644 lib/orber/src/orber_ifr_stringdef.erl delete mode 100644 lib/orber/src/orber_ifr_structdef.erl delete mode 100644 lib/orber/src/orber_ifr_typecode.erl delete mode 100644 lib/orber/src/orber_ifr_typedef.erl delete mode 100644 lib/orber/src/orber_ifr_uniondef.erl delete mode 100644 lib/orber/src/orber_ifr_utils.erl delete mode 100644 lib/orber/src/orber_ifr_wstringdef.erl delete mode 100644 lib/orber/src/orber_iiop.erl delete mode 100644 lib/orber/src/orber_iiop.hrl delete mode 100644 lib/orber/src/orber_iiop_inproxy.erl delete mode 100644 lib/orber/src/orber_iiop_inrequest.erl delete mode 100644 lib/orber/src/orber_iiop_insup.erl delete mode 100644 lib/orber/src/orber_iiop_net.erl delete mode 100644 lib/orber/src/orber_iiop_net_accept.erl delete mode 100644 lib/orber/src/orber_iiop_outproxy.erl delete mode 100644 lib/orber/src/orber_iiop_outsup.erl delete mode 100644 lib/orber/src/orber_iiop_pm.erl delete mode 100644 lib/orber/src/orber_iiop_socketsup.erl delete mode 100644 lib/orber/src/orber_iiop_tracer.erl delete mode 100644 lib/orber/src/orber_iiop_tracer_silent.erl delete mode 100644 lib/orber/src/orber_iiop_tracer_stealth.erl delete mode 100644 lib/orber/src/orber_initial_references.erl delete mode 100644 lib/orber/src/orber_interceptors.erl delete mode 100644 lib/orber/src/orber_objectkeys.erl delete mode 100644 lib/orber/src/orber_pi.erl delete mode 100644 lib/orber/src/orber_request_number.erl delete mode 100644 lib/orber/src/orber_socket.erl delete mode 100644 lib/orber/src/orber_tb.erl delete mode 100644 lib/orber/src/orber_tc.erl delete mode 100644 lib/orber/src/orber_typedefs.erl delete mode 100644 lib/orber/src/orber_web.erl delete mode 100644 lib/orber/src/orber_web_server.erl delete mode 100644 lib/orber/test/Makefile delete mode 100644 lib/orber/test/cdrcoding_10_SUITE.erl delete mode 100644 lib/orber/test/cdrcoding_11_SUITE.erl delete mode 100644 lib/orber/test/cdrcoding_12_SUITE.erl delete mode 100644 lib/orber/test/cdrlib_SUITE.erl delete mode 100644 lib/orber/test/corba_SUITE.erl delete mode 100644 lib/orber/test/csiv2_SUITE.erl delete mode 100644 lib/orber/test/data_types_SUITE.erl delete mode 100644 lib/orber/test/generated_SUITE.erl delete mode 100644 lib/orber/test/idl_output/.gitignore delete mode 100644 lib/orber/test/iiop_module_do_test_impl.erl delete mode 100644 lib/orber/test/iiop_module_test_impl.erl delete mode 100644 lib/orber/test/iiop_test.idl delete mode 100644 lib/orber/test/iiop_test_impl.erl delete mode 100644 lib/orber/test/interceptors_SUITE.erl delete mode 100644 lib/orber/test/iop_ior_10_SUITE.erl delete mode 100644 lib/orber/test/iop_ior_11_SUITE.erl delete mode 100644 lib/orber/test/iop_ior_12_SUITE.erl delete mode 100644 lib/orber/test/ip_v4v6_interop_SUITE.erl delete mode 100644 lib/orber/test/lname_SUITE.erl delete mode 100644 lib/orber/test/multi_ORB_SUITE.erl delete mode 100644 lib/orber/test/naming_context_SUITE.erl delete mode 100644 lib/orber/test/orber.cover delete mode 100644 lib/orber/test/orber.spec delete mode 100644 lib/orber/test/orber_SUITE.erl delete mode 100644 lib/orber/test/orber_acl_SUITE.erl delete mode 100644 lib/orber/test/orber_firewall_ipv4_in_SUITE.erl delete mode 100644 lib/orber/test/orber_firewall_ipv4_out_SUITE.erl delete mode 100644 lib/orber/test/orber_firewall_ipv6_in_SUITE.erl delete mode 100644 lib/orber/test/orber_firewall_ipv6_out_SUITE.erl delete mode 100644 lib/orber/test/orber_nat_SUITE.erl delete mode 100644 lib/orber/test/orber_test.idl delete mode 100644 lib/orber/test/orber_test_lib.erl delete mode 100644 lib/orber/test/orber_test_server.cfg delete mode 100644 lib/orber/test/orber_test_server.idl delete mode 100644 lib/orber/test/orber_test_server_impl.erl delete mode 100644 lib/orber/test/orber_test_timeout_server_impl.erl delete mode 100644 lib/orber/test/orber_web_SUITE.erl delete mode 100644 lib/orber/test/tc_SUITE.erl delete mode 100644 lib/orber/vsn.mk diff --git a/.gitignore b/.gitignore index 234d21c7df..79b1d5dfad 100644 --- a/.gitignore +++ b/.gitignore @@ -80,14 +80,10 @@ lib/erl_interface/obj.mdd/ lib/erl_interface/src/win32/ lib/gs/priv/tcl/ lib/gs/tcl/binaries/ -lib/ic/c_src/win32/ -lib/ic/priv/lib/win32/ -lib/ic/priv/obj/win32/ lib/megaco/src/flex/win32/ lib/odbc/c_src/win32/ lib/odbc/priv/bin/odbcserver.exe lib/odbc/priv/obj/win32/odbcserver.o -lib/orber/c_src/win32/ lib/os_mon/c_src/win32/ lib/os_mon/priv/bin/win32/ lib/os_mon/priv/obj/win32/ @@ -107,9 +103,6 @@ make/otp_doc_built # OSE *.d -# Used by ic & orber & cos* applications. -IDL-GENERATED - # Used by applications that run javadoc (e.g. ic). JAVADOC-GENERATED @@ -127,8 +120,6 @@ JAVADOC-GENERATED /bootstrap/lib/edoc /bootstrap/lib/erl_docgen /bootstrap/lib/hipe -/bootstrap/lib/ic -/bootstrap/lib/orber /bootstrap/lib/parsetools /bootstrap/lib/runtime_tools /bootstrap/lib/sasl diff --git a/HOWTO/BOOTSTRAP.md b/HOWTO/BOOTSTRAP.md index 59e31165cf..6f5f417d51 100644 --- a/HOWTO/BOOTSTRAP.md +++ b/HOWTO/BOOTSTRAP.md @@ -14,8 +14,7 @@ Primary bootstrap The two types of version controlled code are fundamentally different. The primary bootstrap is code compiled from source files in -the lib/{kernel,stdlib,compiler} (and header files from -lib/orber/include. They are checked in in the version control system +the lib/{kernel,stdlib,compiler} (They are checked in in the version control system to make it possible to build directly from the code base tree without the need for an earlier version of the compiler. When a new version of OTP is released, these files are updated manually (or rather, by using diff --git a/HOWTO/INSTALL.md b/HOWTO/INSTALL.md index f7de69166a..2597794496 100644 --- a/HOWTO/INSTALL.md +++ b/HOWTO/INSTALL.md @@ -72,7 +72,7 @@ also find the utilities needed for building the documentation. as the binary command program `openssl`. At least version 0.9.8 of OpenSSL is required. Read more and download from . * Oracle Java SE JDK -- The Java Development Kit (Standard Edition). - Required for building the application `jinterface` and parts of `ic` and `orber`. + Required for building the application `jinterface`. At least version 1.6.0 of the JDK is required. Download from . diff --git a/Makefile.in b/Makefile.in index ca31955c7d..6803e4b77e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -590,8 +590,6 @@ secondary_bootstrap_copy: $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools ; fi $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/ebin ; fi $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/include ; fi - $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/orber ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/orber ; fi - $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/orber/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/orber/include ; fi $(V_at)for x in lib/parsetools/ebin/*.beam; do \ BN=`basename $$x`; \ TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/ebin/$$BN; \ @@ -639,16 +637,6 @@ secondary_bootstrap_copy: true; \ done # $(V_at)cp -f lib/asn1/src/*.erl lib/asn1/src/*.hrl $(BOOTSTRAP_ROOT)/bootstrap/lib/asn1/src - $(V_at)for x in lib/orber/include/*.hrl; do \ - BN=`basename $$x`; \ - TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/orber/include/$$BN; \ - test -f $$TF && \ - test '!' -z "`find $$x -newer $$TF -print`" && \ - cp $$x $$TF; \ - test '!' -f $$TF && \ - cp $$x $$TF; \ - true; \ - done $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/xmerl ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/xmerl ; fi $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/xmerl/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/xmerl/include ; fi $(V_at)for x in lib/xmerl/include/*.hrl; do \ @@ -686,9 +674,6 @@ tertiary_bootstrap_copy: $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl ; fi $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl/ebin ; fi $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/sasl/include ; fi - $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/ic ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/ic ; fi - $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/ic/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/ic/ebin ; fi - $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/ic/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/ic/include ; fi $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/wx ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/wx ; fi $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/wx/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/wx/ebin ; fi $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/wx/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/wx/include ; fi @@ -696,38 +681,6 @@ tertiary_bootstrap_copy: $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/common_test/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/common_test/include ; fi $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/runtime_tools ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/runtime_tools ; fi $(V_at)if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/runtime_tools/include ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/runtime_tools/include ; fi - $(V_at)for x in lib/ic/ebin/*.beam; do \ - BN=`basename $$x`; \ - TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/ic/ebin/$$BN; \ - test -f $$TF && \ - test '!' -z "`find $$x -newer $$TF -print`" && \ - cp $$x $$TF; \ - test '!' -f $$TF && \ - cp $$x $$TF; \ - true; \ - done -# $(V_at)cp lib/ic/ebin/*.beam $(BOOTSTRAP_ROOT)/bootstrap/lib/ic/ebin - $(V_at)for x in lib/ic/include/*.idl; do \ - BN=`basename $$x`; \ - TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/ic/include/$$BN; \ - test -f $$TF && \ - test '!' -z "`find $$x -newer $$TF -print`" && \ - cp $$x $$TF; \ - test '!' -f $$TF && \ - cp $$x $$TF; \ - true; \ - done - $(V_at)for x in lib/ic/include/*.h; do \ - BN=`basename $$x`; \ - TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/ic/include/$$BN; \ - test -f $$TF && \ - test '!' -z "`find $$x -newer $$TF -print`" && \ - cp $$x $$TF; \ - test '!' -f $$TF && \ - cp $$x $$TF; \ - true; \ - done -# $(V_at)cp -f lib/ic/include/*.idl lib/ic/include/*.h $(BOOTSTRAP_ROOT)/bootstrap/lib/ic/include $(V_at)for x in lib/sasl/ebin/*.beam; do \ BN=`basename $$x`; \ TF=$(BOOTSTRAP_ROOT)/bootstrap/lib/sasl/ebin/$$BN; \ @@ -978,14 +931,11 @@ primary_bootstrap_mkdirs: || mkdir -p $(BOOTSTRAP_TOP)/lib/compiler/egen $(V_at)test -d $(BOOTSTRAP_TOP)/lib/compiler/ebin \ || mkdir -p $(BOOTSTRAP_TOP)/lib/compiler/ebin - $(V_at)test -d $(BOOTSTRAP_TOP)/lib/orber/include \ - || mkdir -p $(BOOTSTRAP_TOP)/lib/orber/include primary_bootstrap_copy: $(make_verbose) $(V_at)cp -f lib/kernel/include/*.hrl $(BOOTSTRAP_TOP)/lib/kernel/include $(V_at)cp -f lib/stdlib/include/*.hrl $(BOOTSTRAP_TOP)/lib/stdlib/include - $(V_at)cp -f lib/orber/include/* $(BOOTSTRAP_TOP)/lib/orber/include # To remove modules left by the bootstrap building, but leave (restore) # the modules in kernel which are needed for an emulator build diff --git a/erts/autoconf/configure.vxworks b/erts/autoconf/configure.vxworks index a13e0a6c56..18ca1718d6 100755 --- a/erts/autoconf/configure.vxworks +++ b/erts/autoconf/configure.vxworks @@ -68,10 +68,6 @@ WIND_BASE=${WIND_BASE:=`ypmatch tornado passwd | awk -F: '{print $6}'`/$VXTOP} # These are created by autoconf. MKDIRS="${ERL_TOP}/lib/os_mon/priv/bin/$target ${ERL_TOP}/lib/os_mon/priv/obj/$target - ${ERL_TOP}/lib/orber/priv/obj/$target - ${ERL_TOP}/lib/orber/priv/bin/$target - ${ERL_TOP}/lib/ic/priv/lib/$target - ${ERL_TOP}/lib/ic/priv/obj/$target ${ERL_TOP}/lib/asn1/priv/lib/$target ${ERL_TOP}/lib/asn1/priv/obj/$target ${ERL_TOP}/lib/erl_interface/obj/$target @@ -100,8 +96,6 @@ etcdir=${ERL_TOP}/erts/etc/common erlint_dir=${ERL_TOP}/lib/erl_interface/src epmd_dir=${ERL_TOP}/erts/epmd/src os_mon_dir=${ERL_TOP}/lib/os_mon/c_src -orber_dir=${ERL_TOP}/lib/orber/c_src -ic_dir=${ERL_TOP}/lib/ic/c_src internal_tools_dir=${ERL_TOP} libdir=${ERL_TOP}/lib tsdir=$libdir/test_server/src @@ -121,10 +115,8 @@ CONFIG_FILES="${ERL_TOP}/erts/emulator/$host/Makefile $internal_tools_dir/make/$host/otp.mk $os_mon_dir/$host/Makefile $zlibdir/$host/Makefile - $ic_dir/$host/Makefile $runtime_tools_dir/$host/Makefile $tools_dir/$host/Makefile - $orber_dir/$host/Makefile" for file in $CONFIG_FILES; do new_name=`echo $file|sed "s%/$host/%/$target/%"` diff --git a/erts/configure.in b/erts/configure.in index 5d9dc9aa43..d1c5fe324b 100644 --- a/erts/configure.in +++ b/erts/configure.in @@ -4818,10 +4818,8 @@ dnl The ones below should be moved to their respective lib dnl dnl ../lib/ssl/c_src/$host/Makefile:../lib/ssl/c_src/Makefile.in AC_CONFIG_FILES([ - ../lib/ic/c_src/$host/Makefile:../lib/ic/c_src/Makefile.in ../lib/os_mon/c_src/$host/Makefile:../lib/os_mon/c_src/Makefile.in ../lib/crypto/c_src/$host/Makefile:../lib/crypto/c_src/Makefile.in - ../lib/orber/c_src/$host/Makefile:../lib/orber/c_src/Makefile.in ../lib/runtime_tools/c_src/$host/Makefile:../lib/runtime_tools/c_src/Makefile.in ../lib/tools/c_src/$host/Makefile:../lib/tools/c_src/Makefile.in ]) diff --git a/lib/.gitignore b/lib/.gitignore index 7cef9d7cf3..07a94c7ae6 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -91,386 +91,3 @@ /megaco/src/text/megaco_text_parser_v1.erl /megaco/src/text/megaco_text_parser_v2.erl /megaco/src/text/megaco_text_parser_v3.erl - -# orber & cos* applications - -/orber/test/idl_output -/cosEvent/test/idl_output -/cosNotification/test/idl_output -/cosTransactions/test/idl_output - -/cosEvent/include/CosEventChannelAdmin.hrl -/cosEvent/include/CosEventChannelAdmin_ConsumerAdmin.hrl -/cosEvent/include/CosEventChannelAdmin_EventChannel.hrl -/cosEvent/include/CosEventChannelAdmin_ProxyPullConsumer.hrl -/cosEvent/include/CosEventChannelAdmin_ProxyPullSupplier.hrl -/cosEvent/include/CosEventChannelAdmin_ProxyPushConsumer.hrl -/cosEvent/include/CosEventChannelAdmin_ProxyPushSupplier.hrl -/cosEvent/include/CosEventChannelAdmin_SupplierAdmin.hrl -/cosEvent/include/CosEventComm.hrl -/cosEvent/include/CosEventComm_PullConsumer.hrl -/cosEvent/include/CosEventComm_PullSupplier.hrl -/cosEvent/include/CosEventComm_PushConsumer.hrl -/cosEvent/include/CosEventComm_PushSupplier.hrl -/cosEvent/include/oe_CosEventChannelAdmin.hrl -/cosEvent/include/oe_CosEventComm.hrl -/cosEvent/src/CosEventChannelAdmin_AlreadyConnected.erl -/cosEvent/src/CosEventChannelAdmin_ConsumerAdmin.erl -/cosEvent/src/CosEventChannelAdmin_EventChannel.erl -/cosEvent/src/CosEventChannelAdmin_ProxyPullConsumer.erl -/cosEvent/src/CosEventChannelAdmin_ProxyPullSupplier.erl -/cosEvent/src/CosEventChannelAdmin_ProxyPushConsumer.erl -/cosEvent/src/CosEventChannelAdmin_ProxyPushSupplier.erl -/cosEvent/src/CosEventChannelAdmin_SupplierAdmin.erl -/cosEvent/src/CosEventChannelAdmin_TypeError.erl -/cosEvent/src/CosEventComm_Disconnected.erl -/cosEvent/src/CosEventComm_PullConsumer.erl -/cosEvent/src/CosEventComm_PullSupplier.erl -/cosEvent/src/CosEventComm_PushConsumer.erl -/cosEvent/src/CosEventComm_PushSupplier.erl -/cosEvent/src/oe_CosEventChannelAdmin.erl -/cosEvent/src/oe_CosEventComm.erl -/cosEvent/src/oe_CosEventComm_CAdmin.erl -/cosEvent/src/oe_CosEventComm_CAdmin.hrl -/cosEvent/src/oe_CosEventComm_Channel.erl -/cosEvent/src/oe_CosEventComm_Channel.hrl -/cosEvent/src/oe_CosEventComm_Event.erl -/cosEvent/src/oe_CosEventComm_Event.hrl -/cosEvent/src/oe_CosEventComm_PullerS.erl -/cosEvent/src/oe_CosEventComm_PullerS.hrl -/cosEvent/src/oe_CosEventComm_PusherS.erl -/cosEvent/src/oe_CosEventComm_PusherS.hrl -/cosEvent/src/oe_cosEventApp.erl -/cosEvent/src/oe_cosEventApp.hrl -/cosEventDomain/include/CosEventDomainAdmin.hrl -/cosEventDomain/include/CosEventDomainAdmin_EventDomain.hrl -/cosEventDomain/include/CosEventDomainAdmin_EventDomainFactory.hrl -/cosEventDomain/include/oe_CosEventDomainAdmin.hrl -/cosEventDomain/src/CosEventDomainAdmin.erl -/cosEventDomain/src/CosEventDomainAdmin_AlreadyExists.erl -/cosEventDomain/src/CosEventDomainAdmin_Connection.erl -/cosEventDomain/src/CosEventDomainAdmin_ConnectionIDSeq.erl -/cosEventDomain/src/CosEventDomainAdmin_ConnectionNotFound.erl -/cosEventDomain/src/CosEventDomainAdmin_CycleCreationForbidden.erl -/cosEventDomain/src/CosEventDomainAdmin_CycleSeq.erl -/cosEventDomain/src/CosEventDomainAdmin_DiamondCreationForbidden.erl -/cosEventDomain/src/CosEventDomainAdmin_DiamondSeq.erl -/cosEventDomain/src/CosEventDomainAdmin_DomainIDSeq.erl -/cosEventDomain/src/CosEventDomainAdmin_DomainNotFound.erl -/cosEventDomain/src/CosEventDomainAdmin_EventDomain.erl -/cosEventDomain/src/CosEventDomainAdmin_EventDomainFactory.erl -/cosEventDomain/src/CosEventDomainAdmin_MemberIDSeq.erl -/cosEventDomain/src/CosEventDomainAdmin_RouteSeq.erl -/cosEventDomain/src/oe_CosEventDomainAdmin.erl -/cosFileTransfer/include/CosFileTransfer.hrl -/cosFileTransfer/include/CosFileTransfer_Directory.hrl -/cosFileTransfer/include/CosFileTransfer_File.hrl -/cosFileTransfer/include/CosFileTransfer_FileIterator.hrl -/cosFileTransfer/include/CosFileTransfer_FileTransferSession.hrl -/cosFileTransfer/include/CosFileTransfer_VirtualFileSystem.hrl -/cosFileTransfer/include/oe_CosFileTransfer.hrl -/cosFileTransfer/src/CosFileTransfer.erl -/cosFileTransfer/src/CosFileTransfer_AccessLevel.erl -/cosFileTransfer/src/CosFileTransfer_CommandNotImplementedException.erl -/cosFileTransfer/src/CosFileTransfer_Directory.erl -/cosFileTransfer/src/CosFileTransfer_File.erl -/cosFileTransfer/src/CosFileTransfer_FileIterator.erl -/cosFileTransfer/src/CosFileTransfer_FileList.erl -/cosFileTransfer/src/CosFileTransfer_FileNameList.erl -/cosFileTransfer/src/CosFileTransfer_FileNotFoundException.erl -/cosFileTransfer/src/CosFileTransfer_FileTransferSession.erl -/cosFileTransfer/src/CosFileTransfer_FileWrapper.erl -/cosFileTransfer/src/CosFileTransfer_IllegalOperationException.erl -/cosFileTransfer/src/CosFileTransfer_ProtocolAddressList.erl -/cosFileTransfer/src/CosFileTransfer_ProtocolSupport.erl -/cosFileTransfer/src/CosFileTransfer_RequestFailureException.erl -/cosFileTransfer/src/CosFileTransfer_SessionException.erl -/cosFileTransfer/src/CosFileTransfer_SupportedProtocolAddresses.erl -/cosFileTransfer/src/CosFileTransfer_TransferException.erl -/cosFileTransfer/src/CosFileTransfer_VirtualFileSystem.erl -/cosFileTransfer/src/CosFileTransfer_VirtualFileSystem_ContentList.erl -/cosFileTransfer/src/oe_CosFileTransfer.erl -/cosNotification/include/CosNotification.hrl -/cosNotification/include/CosNotification_AdminPropertiesAdmin.hrl -/cosNotification/include/CosNotification_QoSAdmin.hrl -/cosNotification/include/CosNotifyChannelAdmin.hrl -/cosNotification/include/CosNotifyChannelAdmin_ConsumerAdmin.hrl -/cosNotification/include/CosNotifyChannelAdmin_EventChannel.hrl -/cosNotification/include/CosNotifyChannelAdmin_EventChannelFactory.hrl -/cosNotification/include/CosNotifyChannelAdmin_ProxyConsumer.hrl -/cosNotification/include/CosNotifyChannelAdmin_ProxyPullConsumer.hrl -/cosNotification/include/CosNotifyChannelAdmin_ProxyPullSupplier.hrl -/cosNotification/include/CosNotifyChannelAdmin_ProxyPushConsumer.hrl -/cosNotification/include/CosNotifyChannelAdmin_ProxyPushSupplier.hrl -/cosNotification/include/CosNotifyChannelAdmin_ProxySupplier.hrl -/cosNotification/include/CosNotifyChannelAdmin_SequenceProxyPullConsumer.hrl -/cosNotification/include/CosNotifyChannelAdmin_SequenceProxyPullSupplier.hrl -/cosNotification/include/CosNotifyChannelAdmin_SequenceProxyPushConsumer.hrl -/cosNotification/include/CosNotifyChannelAdmin_SequenceProxyPushSupplier.hrl -/cosNotification/include/CosNotifyChannelAdmin_StructuredProxyPullConsumer.hrl -/cosNotification/include/CosNotifyChannelAdmin_StructuredProxyPullSupplier.hrl -/cosNotification/include/CosNotifyChannelAdmin_StructuredProxyPushConsumer.hrl -/cosNotification/include/CosNotifyChannelAdmin_StructuredProxyPushSupplier.hrl -/cosNotification/include/CosNotifyChannelAdmin_SupplierAdmin.hrl -/cosNotification/include/CosNotifyComm.hrl -/cosNotification/include/CosNotifyComm_NotifyPublish.hrl -/cosNotification/include/CosNotifyComm_NotifySubscribe.hrl -/cosNotification/include/CosNotifyComm_PullConsumer.hrl -/cosNotification/include/CosNotifyComm_PullSupplier.hrl -/cosNotification/include/CosNotifyComm_PushConsumer.hrl -/cosNotification/include/CosNotifyComm_PushSupplier.hrl -/cosNotification/include/CosNotifyComm_SequencePullConsumer.hrl -/cosNotification/include/CosNotifyComm_SequencePullSupplier.hrl -/cosNotification/include/CosNotifyComm_SequencePushConsumer.hrl -/cosNotification/include/CosNotifyComm_SequencePushSupplier.hrl -/cosNotification/include/CosNotifyComm_StructuredPullConsumer.hrl -/cosNotification/include/CosNotifyComm_StructuredPullSupplier.hrl -/cosNotification/include/CosNotifyComm_StructuredPushConsumer.hrl -/cosNotification/include/CosNotifyComm_StructuredPushSupplier.hrl -/cosNotification/include/CosNotifyFilter.hrl -/cosNotification/include/CosNotifyFilter_Filter.hrl -/cosNotification/include/CosNotifyFilter_FilterAdmin.hrl -/cosNotification/include/CosNotifyFilter_FilterFactory.hrl -/cosNotification/include/CosNotifyFilter_MappingFilter.hrl -/cosNotification/include/oe_CosNotification.hrl -/cosNotification/include/oe_CosNotifyChannelAdmin.hrl -/cosNotification/include/oe_CosNotifyComm.hrl -/cosNotification/include/oe_CosNotifyFilter.hrl -/cosNotification/src/CosNotification.erl -/cosNotification/src/CosNotification_AdminPropertiesAdmin.erl -/cosNotification/src/CosNotification_EventBatch.erl -/cosNotification/src/CosNotification_EventHeader.erl -/cosNotification/src/CosNotification_EventType.erl -/cosNotification/src/CosNotification_EventTypeSeq.erl -/cosNotification/src/CosNotification_FixedEventHeader.erl -/cosNotification/src/CosNotification_NamedPropertyRange.erl -/cosNotification/src/CosNotification_NamedPropertyRangeSeq.erl -/cosNotification/src/CosNotification_Property.erl -/cosNotification/src/CosNotification_PropertyError.erl -/cosNotification/src/CosNotification_PropertyErrorSeq.erl -/cosNotification/src/CosNotification_PropertyRange.erl -/cosNotification/src/CosNotification_PropertySeq.erl -/cosNotification/src/CosNotification_QoSAdmin.erl -/cosNotification/src/CosNotification_StructuredEvent.erl -/cosNotification/src/CosNotification_UnsupportedAdmin.erl -/cosNotification/src/CosNotification_UnsupportedQoS.erl -/cosNotification/src/CosNotifyChannelAdmin_AdminIDSeq.erl -/cosNotification/src/CosNotifyChannelAdmin_AdminLimit.erl -/cosNotification/src/CosNotifyChannelAdmin_AdminLimitExceeded.erl -/cosNotification/src/CosNotifyChannelAdmin_AdminNotFound.erl -/cosNotification/src/CosNotifyChannelAdmin_ChannelIDSeq.erl -/cosNotification/src/CosNotifyChannelAdmin_ChannelNotFound.erl -/cosNotification/src/CosNotifyChannelAdmin_ConnectionAlreadyActive.erl -/cosNotification/src/CosNotifyChannelAdmin_ConnectionAlreadyInactive.erl -/cosNotification/src/CosNotifyChannelAdmin_ConsumerAdmin.erl -/cosNotification/src/CosNotifyChannelAdmin_EventChannel.erl -/cosNotification/src/CosNotifyChannelAdmin_EventChannelFactory.erl -/cosNotification/src/CosNotifyChannelAdmin_NotConnected.erl -/cosNotification/src/CosNotifyChannelAdmin_ProxyConsumer.erl -/cosNotification/src/CosNotifyChannelAdmin_ProxyIDSeq.erl -/cosNotification/src/CosNotifyChannelAdmin_ProxyNotFound.erl -/cosNotification/src/CosNotifyChannelAdmin_ProxyPullConsumer.erl -/cosNotification/src/CosNotifyChannelAdmin_ProxyPullSupplier.erl -/cosNotification/src/CosNotifyChannelAdmin_ProxyPushConsumer.erl -/cosNotification/src/CosNotifyChannelAdmin_ProxyPushSupplier.erl -/cosNotification/src/CosNotifyChannelAdmin_ProxySupplier.erl -/cosNotification/src/CosNotifyChannelAdmin_SequenceProxyPullConsumer.erl -/cosNotification/src/CosNotifyChannelAdmin_SequenceProxyPullSupplier.erl -/cosNotification/src/CosNotifyChannelAdmin_SequenceProxyPushConsumer.erl -/cosNotification/src/CosNotifyChannelAdmin_SequenceProxyPushSupplier.erl -/cosNotification/src/CosNotifyChannelAdmin_StructuredProxyPullConsumer.erl -/cosNotification/src/CosNotifyChannelAdmin_StructuredProxyPullSupplier.erl -/cosNotification/src/CosNotifyChannelAdmin_StructuredProxyPushConsumer.erl -/cosNotification/src/CosNotifyChannelAdmin_StructuredProxyPushSupplier.erl -/cosNotification/src/CosNotifyChannelAdmin_SupplierAdmin.erl -/cosNotification/src/CosNotifyComm_InvalidEventType.erl -/cosNotification/src/CosNotifyComm_NotifyPublish.erl -/cosNotification/src/CosNotifyComm_NotifySubscribe.erl -/cosNotification/src/CosNotifyComm_PullConsumer.erl -/cosNotification/src/CosNotifyComm_PullSupplier.erl -/cosNotification/src/CosNotifyComm_PushConsumer.erl -/cosNotification/src/CosNotifyComm_PushSupplier.erl -/cosNotification/src/CosNotifyComm_SequencePullConsumer.erl -/cosNotification/src/CosNotifyComm_SequencePullSupplier.erl -/cosNotification/src/CosNotifyComm_SequencePushConsumer.erl -/cosNotification/src/CosNotifyComm_SequencePushSupplier.erl -/cosNotification/src/CosNotifyComm_StructuredPullConsumer.erl -/cosNotification/src/CosNotifyComm_StructuredPullSupplier.erl -/cosNotification/src/CosNotifyComm_StructuredPushConsumer.erl -/cosNotification/src/CosNotifyComm_StructuredPushSupplier.erl -/cosNotification/src/CosNotifyFilter_CallbackIDSeq.erl -/cosNotification/src/CosNotifyFilter_CallbackNotFound.erl -/cosNotification/src/CosNotifyFilter_ConstraintExp.erl -/cosNotification/src/CosNotifyFilter_ConstraintExpSeq.erl -/cosNotification/src/CosNotifyFilter_ConstraintIDSeq.erl -/cosNotification/src/CosNotifyFilter_ConstraintInfo.erl -/cosNotification/src/CosNotifyFilter_ConstraintInfoSeq.erl -/cosNotification/src/CosNotifyFilter_ConstraintNotFound.erl -/cosNotification/src/CosNotifyFilter_DuplicateConstraintID.erl -/cosNotification/src/CosNotifyFilter_Filter.erl -/cosNotification/src/CosNotifyFilter_FilterAdmin.erl -/cosNotification/src/CosNotifyFilter_FilterFactory.erl -/cosNotification/src/CosNotifyFilter_FilterIDSeq.erl -/cosNotification/src/CosNotifyFilter_FilterNotFound.erl -/cosNotification/src/CosNotifyFilter_InvalidConstraint.erl -/cosNotification/src/CosNotifyFilter_InvalidGrammar.erl -/cosNotification/src/CosNotifyFilter_InvalidValue.erl -/cosNotification/src/CosNotifyFilter_MappingConstraintInfo.erl -/cosNotification/src/CosNotifyFilter_MappingConstraintInfoSeq.erl -/cosNotification/src/CosNotifyFilter_MappingConstraintPair.erl -/cosNotification/src/CosNotifyFilter_MappingConstraintPairSeq.erl -/cosNotification/src/CosNotifyFilter_MappingFilter.erl -/cosNotification/src/CosNotifyFilter_UnsupportedFilterableData.erl -/cosNotification/src/cosNotification_Grammar.erl -/cosNotification/src/oe_CosNotification.erl -/cosNotification/src/oe_CosNotificationComm.hrl -/cosNotification/src/oe_CosNotificationComm_Event.erl -/cosNotification/src/oe_CosNotificationComm_Event.hrl -/cosNotification/src/oe_CosNotifyChannelAdmin.erl -/cosNotification/src/oe_CosNotifyComm.erl -/cosNotification/src/oe_CosNotifyFilter.erl -/cosNotification/src/oe_cosNotificationAppComm.erl -/cosNotification/src/oe_cosNotificationAppComm.hrl -/cosProperty/include/CosPropertyService.hrl -/cosProperty/include/CosPropertyService_PropertiesIterator.hrl -/cosProperty/include/CosPropertyService_PropertyNamesIterator.hrl -/cosProperty/include/CosPropertyService_PropertySet.hrl -/cosProperty/include/CosPropertyService_PropertySetDef.hrl -/cosProperty/include/CosPropertyService_PropertySetDefFactory.hrl -/cosProperty/include/CosPropertyService_PropertySetFactory.hrl -/cosProperty/include/oe_CosProperty.hrl -/cosProperty/src/CosPropertyService_ConflictingProperty.erl -/cosProperty/src/CosPropertyService_ConstraintNotSupported.erl -/cosProperty/src/CosPropertyService_FixedProperty.erl -/cosProperty/src/CosPropertyService_InvalidPropertyName.erl -/cosProperty/src/CosPropertyService_MultipleExceptions.erl -/cosProperty/src/CosPropertyService_Properties.erl -/cosProperty/src/CosPropertyService_PropertiesIterator.erl -/cosProperty/src/CosPropertyService_Property.erl -/cosProperty/src/CosPropertyService_PropertyDef.erl -/cosProperty/src/CosPropertyService_PropertyDefs.erl -/cosProperty/src/CosPropertyService_PropertyException.erl -/cosProperty/src/CosPropertyService_PropertyExceptions.erl -/cosProperty/src/CosPropertyService_PropertyMode.erl -/cosProperty/src/CosPropertyService_PropertyModes.erl -/cosProperty/src/CosPropertyService_PropertyNames.erl -/cosProperty/src/CosPropertyService_PropertyNamesIterator.erl -/cosProperty/src/CosPropertyService_PropertyNotFound.erl -/cosProperty/src/CosPropertyService_PropertySet.erl -/cosProperty/src/CosPropertyService_PropertySetDef.erl -/cosProperty/src/CosPropertyService_PropertySetDefFactory.erl -/cosProperty/src/CosPropertyService_PropertySetFactory.erl -/cosProperty/src/CosPropertyService_PropertyTypes.erl -/cosProperty/src/CosPropertyService_ReadOnlyProperty.erl -/cosProperty/src/CosPropertyService_UnsupportedMode.erl -/cosProperty/src/CosPropertyService_UnsupportedProperty.erl -/cosProperty/src/CosPropertyService_UnsupportedTypeCode.erl -/cosProperty/src/oe_CosProperty.erl -/cosTime/include/CosTime.hrl -/cosTime/include/CosTime_TIO.hrl -/cosTime/include/CosTime_TimeService.hrl -/cosTime/include/CosTime_UTO.hrl -/cosTime/include/CosTimerEvent.hrl -/cosTime/include/CosTimerEvent_TimerEventHandler.hrl -/cosTime/include/CosTimerEvent_TimerEventService.hrl -/cosTime/include/TimeBase.hrl -/cosTime/include/oe_CosTime.hrl -/cosTime/include/oe_CosTimerEvent.hrl -/cosTime/include/oe_TimeBase.hrl -/cosTime/src/CosTime_TIO.erl -/cosTime/src/CosTime_TimeService.erl -/cosTime/src/CosTime_TimeUnavailable.erl -/cosTime/src/CosTime_UTO.erl -/cosTime/src/CosTimerEvent_TimerEventHandler.erl -/cosTime/src/CosTimerEvent_TimerEventService.erl -/cosTime/src/CosTimerEvent_TimerEventT.erl -/cosTime/src/TimeBase_IntervalT.erl -/cosTime/src/TimeBase_UtcT.erl -/cosTime/src/oe_CosTime.erl -/cosTime/src/oe_CosTimerEvent.erl -/cosTime/src/oe_TimeBase.erl -/cosTransactions/include/CosTransactions.hrl -/cosTransactions/include/CosTransactions_Control.hrl -/cosTransactions/include/CosTransactions_Coordinator.hrl -/cosTransactions/include/CosTransactions_RecoveryCoordinator.hrl -/cosTransactions/include/CosTransactions_Resource.hrl -/cosTransactions/include/CosTransactions_SubtransactionAwareResource.hrl -/cosTransactions/include/CosTransactions_Terminator.hrl -/cosTransactions/include/CosTransactions_TransactionFactory.hrl -/cosTransactions/include/ETraP.hrl -/cosTransactions/include/ETraP_Server.hrl -/cosTransactions/include/oe_CosTransactions.hrl -/cosTransactions/src/CosTransactions_Control.erl -/cosTransactions/src/CosTransactions_Coordinator.erl -/cosTransactions/src/CosTransactions_HeuristicCommit.erl -/cosTransactions/src/CosTransactions_HeuristicHazard.erl -/cosTransactions/src/CosTransactions_HeuristicMixed.erl -/cosTransactions/src/CosTransactions_HeuristicRollback.erl -/cosTransactions/src/CosTransactions_Inactive.erl -/cosTransactions/src/CosTransactions_InvalidControl.erl -/cosTransactions/src/CosTransactions_NoTransaction.erl -/cosTransactions/src/CosTransactions_NotPrepared.erl -/cosTransactions/src/CosTransactions_NotSubtransaction.erl -/cosTransactions/src/CosTransactions_PropagationContext.erl -/cosTransactions/src/CosTransactions_RecoveryCoordinator.erl -/cosTransactions/src/CosTransactions_Resource.erl -/cosTransactions/src/CosTransactions_SubtransactionAwareResource.erl -/cosTransactions/src/CosTransactions_SubtransactionsUnavailable.erl -/cosTransactions/src/CosTransactions_SynchronizationUnavailable.erl -/cosTransactions/src/CosTransactions_Terminator.erl -/cosTransactions/src/CosTransactions_TransIdentity.erl -/cosTransactions/src/CosTransactions_TransactionFactory.erl -/cosTransactions/src/CosTransactions_Unavailable.erl -/cosTransactions/src/CosTransactions_WrongTransaction.erl -/cosTransactions/src/CosTransactions_otid_t.erl -/cosTransactions/src/ETraP_Server.erl -/cosTransactions/src/oe_CosTransactions.erl -/orber/COSS/CosNaming/CosNaming.hrl -/orber/COSS/CosNaming/CosNaming_Binding.erl -/orber/COSS/CosNaming/CosNaming_BindingIterator.erl -/orber/COSS/CosNaming/CosNaming_BindingIterator.hrl -/orber/COSS/CosNaming/CosNaming_BindingList.erl -/orber/COSS/CosNaming/CosNaming_Name.erl -/orber/COSS/CosNaming/CosNaming_NameComponent.erl -/orber/COSS/CosNaming/CosNaming_NamingContext.erl -/orber/COSS/CosNaming/CosNaming_NamingContext.hrl -/orber/COSS/CosNaming/CosNaming_NamingContextExt.erl -/orber/COSS/CosNaming/CosNaming_NamingContextExt.hrl -/orber/COSS/CosNaming/CosNaming_NamingContextExt_AlreadyBound.erl -/orber/COSS/CosNaming/CosNaming_NamingContextExt_CannotProceed.erl -/orber/COSS/CosNaming/CosNaming_NamingContextExt_InvalidAddress.erl -/orber/COSS/CosNaming/CosNaming_NamingContextExt_InvalidName.erl -/orber/COSS/CosNaming/CosNaming_NamingContextExt_NotEmpty.erl -/orber/COSS/CosNaming/CosNaming_NamingContextExt_NotFound.erl -/orber/COSS/CosNaming/CosNaming_NamingContext_AlreadyBound.erl -/orber/COSS/CosNaming/CosNaming_NamingContext_CannotProceed.erl -/orber/COSS/CosNaming/CosNaming_NamingContext_InvalidName.erl -/orber/COSS/CosNaming/CosNaming_NamingContext_NotEmpty.erl -/orber/COSS/CosNaming/CosNaming_NamingContext_NotFound.erl -/orber/COSS/CosNaming/oe_cos_naming.erl -/orber/COSS/CosNaming/oe_cos_naming.hrl -/orber/COSS/CosNaming/oe_cos_naming_ext.erl -/orber/COSS/CosNaming/oe_cos_naming_ext.hrl -/orber/examples/Stack/StackModule.hrl -/orber/examples/Stack/StackModule_EmptyStack.erl -/orber/examples/Stack/StackModule_Stack.erl -/orber/examples/Stack/StackModule_Stack.hrl -/orber/examples/Stack/StackModule_StackFactory.erl -/orber/examples/Stack/StackModule_StackFactory.hrl -/orber/examples/Stack/oe_stack.erl -/orber/examples/Stack/oe_stack.hrl -/orber/src/CORBA.hrl -/orber/src/OrberApp.hrl -/orber/src/OrberApp_IFR.erl -/orber/src/OrberApp_IFR.hrl -/orber/src/erlang.hrl -/orber/src/erlang_binary.erl -/orber/src/erlang_pid.erl -/orber/src/erlang_port.erl -/orber/src/erlang_ref.erl -/orber/src/oe_CORBA.erl -/orber/src/oe_CORBA.hrl -/orber/src/oe_OrberIFR.erl -/orber/src/oe_OrberIFR.hrl -/orber/src/oe_erlang.erl -/orber/src/oe_erlang.hrl diff --git a/lib/Makefile b/lib/Makefile index d67e605875..0053238826 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -1,7 +1,7 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 1996-2016. All Rights Reserved. +# Copyright Ericsson AB 1996-2018. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -31,10 +31,9 @@ ERLANG_APPLICATIONS = tools common_test runtime_tools inets parsetools ALL_ERLANG_APPLICATIONS = xmerl edoc erl_docgen snmp otp_mibs erl_interface \ asn1 jinterface \ wx debugger reltool \ - ic mnesia crypto orber os_mon syntax_tools \ + mnesia crypto os_mon syntax_tools \ public_key ssl observer odbc diameter \ - cosTransactions cosEvent cosTime cosNotification \ - cosProperty cosFileTransfer cosEventDomain et megaco \ + et megaco \ eunit ssh eldap dialyzer hipe ftp tftp ifdef BUILD_ALL diff --git a/lib/cosEvent/AUTHORS b/lib/cosEvent/AUTHORS deleted file mode 100644 index 624d275f78..0000000000 --- a/lib/cosEvent/AUTHORS +++ /dev/null @@ -1,5 +0,0 @@ -Original Authors: -Niclas Eklund - -Contributors: - diff --git a/lib/cosEvent/Makefile b/lib/cosEvent/Makefile deleted file mode 100644 index 276b7bd865..0000000000 --- a/lib/cosEvent/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include vsn.mk -VSN=$(COSEVENT_VSN) - -# ---------------------------------------------------- -# Common Macros -# ---------------------------------------------------- - -SUB_DIRECTORIES = src doc/src - -SPECIAL_TARGETS = - -# ---------------------------------------------------- -# Default Subdir Targets -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_subdir.mk - diff --git a/lib/cosEvent/doc/html/.gitignore b/lib/cosEvent/doc/html/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosEvent/doc/man3/.gitignore b/lib/cosEvent/doc/man3/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosEvent/doc/man6/.gitignore b/lib/cosEvent/doc/man6/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosEvent/doc/pdf/.gitignore b/lib/cosEvent/doc/pdf/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosEvent/doc/src/CosEventChannelAdmin.xml b/lib/cosEvent/doc/src/CosEventChannelAdmin.xml deleted file mode 100644 index 29336c1878..0000000000 --- a/lib/cosEvent/doc/src/CosEventChannelAdmin.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - -
- - 19972016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosEventChannelAdmin - - - - - - 1997-11-13 - PA1 - CosEventChannelAdmin.xml -
- CosEventChannelAdmin - The CosEventChannelAdmin defines a set if event service interfaces that enables decoupled asynchronous communication between objects and implements generic (untyped) version of the OMG COSS standard event service. - -

The event service defines two roles for objects: the supplier role and - the consumer role. Suppliers supply event data to the event channel and - consumers receive event data from the channel. Suppliers do not need to - know the identity of the consumers, and vice versa. Consumers and - suppliers are connected to the event channel via proxies, which are managed - by ConsumerAdmin and SupplierAdmin objects.

-

There are four general models of communication. These are:

- - The canonical push model. It allows the suppliers of events to initiate the - transfer of event data to consumers. Event channels play the role of - . Active suppliers use event channel to push data to - passive consumers registered with the event channel. - The canonical pull model. It allows consumers to request events from - suppliers. Event channels play the role of since they - procure events on behalf of consumers. Active consumers can explicitly - pull data from passive suppliers via the event channels. - The hybrid push/pull model. It allows consumers request events queued at - a channel by suppliers. Event channels play the role of . - Active consumers explicitly pull data deposited by active suppliers via - the event channels. - The hybrid pull/push model. It allows the channel to pull events from - suppliers and push them to consumers. Event channels play the role of - . Active event channels can pull data from - passive suppliers to push it to passive consumers. - -

To get access to all definitions, e.g., exceptions, - include necessary files by using:

-

There are seven different interfaces supported in the service:

- - ProxyPushConsumer - ProxyPullSupplier - ProxyPullConsumer - ProxyPushSupplier - ConsumerAdmin - SupplierAdmin - EventChannel - -
- -
- diff --git a/lib/cosEvent/doc/src/CosEventChannelAdmin_ConsumerAdmin.xml b/lib/cosEvent/doc/src/CosEventChannelAdmin_ConsumerAdmin.xml deleted file mode 100644 index 80d36ba5c5..0000000000 --- a/lib/cosEvent/doc/src/CosEventChannelAdmin_ConsumerAdmin.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - -
- - 1997 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosEventChannelAdmin_ConsumerAdmin - - - - - - 1997-11-13 - PA1 - CosEventChannelAdmin_ConsumerAdmin.xml -
- CosEventChannelAdmin_ConsumerAdmin - This module implements a ConsumerAdmin interface, which allows consumers to be connected to the event channel. - -

The ConsumerAdmin interface defines the first step for connecting consumers - to the event channel. It acts as a factory for creating proxy suppliers. - Both consumer administration and supplier administration are defined as separate - objects so that the creator of the channel can control the addition of - suppliers and consumers.

-

To get access to all definitions include necessary files by using:

-
- - - obtain_push_supplier(Object) -> Return - Create a ProxyPushSupplier object - - Object = #objref - Return = #objref - - -

This operation returns a ProxyPushSupplier object reference.

-
-
- - obtain_pull_supplier(Object) -> Return - Create a ProxyPullSupplier object - - Object = #objref - Return = #objref - - -

This operation returns a ProxyPullSupplier object reference.

-
-
-
- -
- diff --git a/lib/cosEvent/doc/src/CosEventChannelAdmin_EventChannel.xml b/lib/cosEvent/doc/src/CosEventChannelAdmin_EventChannel.xml deleted file mode 100644 index f32e742240..0000000000 --- a/lib/cosEvent/doc/src/CosEventChannelAdmin_EventChannel.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - -
- - 1997 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosEventChannelAdmin_EventChannel - - - - - - 1997-11-13 - PA1 - CosEventChannelAdmin_EventChannel.xml -
- CosEventChannelAdmin_EventChannel - This module implements an Event Channel interface, which plays the role of a mediator between consumers and suppliers. - -

An event channel is an object that allows multiple suppliers to communicate - with multiple consumers in a highly decoupled, asynchronous manner. The event - channel is built up incrementally. When an event channel is - created no suppliers or consumers are connected to it. Event Channel can - implement group communication by serving as a replicator, broadcaster, or - multicaster that forward events from one or more suppliers to multiple - consumers.

-

It is up to the user to decide when an event channel is created and how - references to the event channel are obtained. By representing the event - channel as an object, it has all of the properties that apply to objects. - One way to manage an event channel is to register it in a naming context, - or export it through an operation on an object.

-

To get access to all definitions include necessary files by using:

-

Any object that possesses an object reference that supports the ProxyPullConsumer - interface can perform the following operations:

-
- - - for_consumers(Object) -> Return - Return a ConsumerAdmin object - - Object = #objref - Return = #objref - - -

This operation returns a ConsumerAdmin object reference. If ConsumerAdmin - object does not exist already it creates one.

-
-
- - for_suppliers(Object) -> Return - Return a SupplierAdmin object - - Object = #objref - Return = #objref - - -

This operation returns a SupplierAdmin object reference. If SupplierAdmin - object does not exist already it creates one.

-
-
- - destroy(Object) -> Return - Destroy the event channel - - Object = #objref - Return = #objref - - -

-
-
-
- -
- diff --git a/lib/cosEvent/doc/src/CosEventChannelAdmin_ProxyPullConsumer.xml b/lib/cosEvent/doc/src/CosEventChannelAdmin_ProxyPullConsumer.xml deleted file mode 100644 index 83bf8acbf2..0000000000 --- a/lib/cosEvent/doc/src/CosEventChannelAdmin_ProxyPullConsumer.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - -
- - 1997 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosEventChannelAdmin_ProxyPullConsumer - - - - - - 1997-11-13 - PA1 - CosEventChannelAdmin_ProxyPullConsumer.xml -
- CosEventChannelAdmin_ProxyPullConsumer - This module implements a ProxyPullConsumer interface which acts as a middleman between pull supplier and the event channel. - -

The ProxyPullConsumer interface defines the second step for connecting pull - suppliers to the event channel. A proxy consumer is similar to a normal consumer, - but includes an additional method for connecting a supplier to the proxy - consumer.

-

To get access to all definitions, e.g., exceptions, - include necessary files by using:

-

Any object that possesses an object reference that supports the ProxyPullConsumer - interface can perform the following operations:

-
- - - connect_pull_supplier(Object, PullSupplier) -> Return - Connect the pull supplier to the proxy pull consumer - - Object = #objref - PullSupplier = #objref of PullSupplier type - Return = ok | {'EXCEPTION', E} - E = #'CosEventChannelAdmin_AlreadyConnected'{} | #'CosEventChannelAdmin_TypeError'{} - - -

This operation connects PullSupplier object to the ProxyPullConsumer object. - If a nil object reference is passed CORBA standard exception - is raised. If the ProxyPullConsumer is already connected to a PullSupplier, - then the exception is raised. - Implementations of ProxyPullConsumers may require additional interface - functionality; if these requirements are not met the - exception will be raised.

-
-
- - disconnect_pull_consumer(Object) -> Return - Disconnect the ProxyPullConsumer object from the event channel. - - Object = #objref - Return = ok - - -

This operation disconnects proxy pull consumer from the event channel and - sends a notification about the loss of the connection to the pull supplier - attached to it.

-
-
-
- -
- diff --git a/lib/cosEvent/doc/src/CosEventChannelAdmin_ProxyPullSupplier.xml b/lib/cosEvent/doc/src/CosEventChannelAdmin_ProxyPullSupplier.xml deleted file mode 100644 index 0060e71e2b..0000000000 --- a/lib/cosEvent/doc/src/CosEventChannelAdmin_ProxyPullSupplier.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - -
- - 1997 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosEventChannelAdmin_ProxyPullSupplier - - - - Lars Thors - - 1997-11-13 - PA1 - CosEventChannelAdmin_ProxyPullSupplier.xml -
- CosEventChannelAdmin_ProxyPullSupplier - This module implements a ProxyPullSupplier interface which acts as a middleman between pull consumer and the event channel. - -

The ProxyPullSupplier interface defines the second step for connecting pull consumers to the event channel. A proxy supplier is similar to a normal supplier, - but includes an additional method for connecting a consumer to the proxy - supplier.

-

To get access to all definitions, e.g., exceptions, - include necessary files by using:

-

Any object that possesses an object reference that supports the ProxyPullSupplier - interface can perform the following operations:

-
- - - connect_pull_consumer(Object, PullConsumer) -> Return - Connect the pull consumer to the proxy pull supplier - - Object = #objref - PullConsumer = #objref of PullConsumer type - Return = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} - - -

This operation connects PullConsumer object to the ProxyPullSupplier object. - A nil object reference can be passed to this operation. If so a channel - cannot invoke the disconnect_pull_consumer operation on the consumer; - the consumer may be disconnected from the channel without being - informed. If the ProxyPullSupplier is already connected to a - PullConsumer, then the - exception is raised.

-
-
- - disconnect_pull_supplier(Object) -> Return - Disconnect the ProxyPullSupplier object from the event channel. - - Object = #objref - Return = ok - - -

This operation disconnects proxy pull supplier from the event channel. - It sends a notification about the loss of the connection to the pull consumer - attached to it, unless nil object reference was passed at the connection - time.

-
-
- - pull(Object) -> Return - Transmit data from suppliers to consumers. - - Object = #objref - Return = any - - -

This operation blocks until the event data is available or the - exception is raised. - It returns the event data to the consumer.

-
-
- - try_pull(Object) -> Return - Transmit data from suppliers to consumers. - - Object = #objref - Return = {any, bool()} - - -

This operation does not block: if the event data is available, it returns - the event data and sets the data availability flag to true; otherwise - it returns a long with an undefined value and sets the data availability to - false. If the event communication has already been disconnected, the - exception is raised.

-
-
-
- -
- diff --git a/lib/cosEvent/doc/src/CosEventChannelAdmin_ProxyPushConsumer.xml b/lib/cosEvent/doc/src/CosEventChannelAdmin_ProxyPushConsumer.xml deleted file mode 100644 index 9f19d001f9..0000000000 --- a/lib/cosEvent/doc/src/CosEventChannelAdmin_ProxyPushConsumer.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - -
- - 1997 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosEventChannelAdmin_ProxyPushConsumer - - - - - - 1997-11-13 - PA1 - CosEventChannelAdmin_ProxyPushConsumer.xml -
- CosEventChannelAdmin_ProxyPushConsumer - This module implements a ProxyPushConsumer interface which acts as a middleman between push supplier and the event channel. - -

The ProxyPushConsumer interface defines the second step for connecting push - suppliers to the event channel. A proxy consumer is similar to a normal consumer, - but includes an additional method for connecting a supplier to the proxy - consumer.

-

To get access to all definitions, e.g., exceptions, - include necessary files by using:

-

Any object that possesses an object reference that supports the ProxyPushConsumer - interface can perform the following operations:

-
- - - connect_push_supplier(Object, PushSupplier) -> Return - Connect the push supplier to the proxy push consumer - - Object = #objref - PushSupplier = #objref of PushSupplier type - Return = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} - - -

This operation connects PushSupplier object to the ProxyPushConsumer object. - A nil object reference can be passed to this operation. If so a channel - cannot invoke the disconnect_push_supplier operation on the supplier; - the supplier may be disconnected from the channel without being - informed. If the ProxyPushConsumer is already connected to a - PushSupplier, then the - exception is raised.

-
-
- - disconnect_push_consumer(Object) -> Return - Disconnect the ProxyPushConsumer object from the event channel. - - Object = #objref - Return = ok - - -

This operation disconnects proxy push consumer from the event channel. - Sends a notification about the loss of the connection to the push supplier - attached to it, unless nil object reference was passed at the connection - time.

-
-
- - push(Object, Data) -> Return - Communicate event data to the consumers. - - Object = #objref - Data = any - Return = ok | {'EXCEPTION', #'CosEventComm_Disconnected'{}} - - -

This operation sends event data to all connected consumers via the - event channel. If the event communication has already been disconnected, - the is raised.

-
-
-
- -
- diff --git a/lib/cosEvent/doc/src/CosEventChannelAdmin_ProxyPushSupplier.xml b/lib/cosEvent/doc/src/CosEventChannelAdmin_ProxyPushSupplier.xml deleted file mode 100644 index 2b1098b9a7..0000000000 --- a/lib/cosEvent/doc/src/CosEventChannelAdmin_ProxyPushSupplier.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - -
- - 1997 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosEventChannelAdmin_ProxyPushSupplier - - - - - - 1997-11-13 - PA1 - CosEventChannelAdmin_ProxyPushSupplier.xml -
- CosEventChannelAdmin_ProxyPushSupplier - This module implements a ProxyPushSupplier interface which acts as a middleman between push consumer and the event channel. - -

The ProxyPushSupplier interface defines the second step for connecting push - consumers to the event channel. A proxy supplier is similar to a normal supplier, - but includes an additional method for connecting a consumer to the proxy - supplier.

-

To get access to all definitions, e.g., exceptions, - include necessary files by using:

-

Any object that possesses an object reference that supports the ProxyPushSupplier - interface can perform the following operations:

-
- - - connect_push_consumer(Object, PushConsumer) -> Return - Connect the push consumer to the proxy push supplier - - Object = #objref - PushConsumer = #objref of PushConsumer type - Return = ok | {'EXCEPTION', E} - E = #'CosEventChannelAdmin_AlreadyConnected'{} | #'CosEventChannelAdmin_TypeError'{} - - -

This operation connects PushConsumer object to the ProxyPushSupplier object. - If a nil object reference is passed CORBA standard exception - is raised. If the ProxyPushSupplier is already connected to a PushConsumer, - then the exception is raised. - Implementations of ProxyPushSuppliers may require additional interface - functionality; if these requirements are not met the - exception will be raised.

-
-
- - disconnect_push_supplier(Object) -> Return - Disconnect the ProxyPushSupplier object from the event channel. - - Object = #objref - Return = ok - - -

This operation disconnects proxy push supplier from the event channel and - sends a notification about the loss of the connection to the push consumer - attached to it.

-
-
-
- -
- diff --git a/lib/cosEvent/doc/src/CosEventChannelAdmin_SupplierAdmin.xml b/lib/cosEvent/doc/src/CosEventChannelAdmin_SupplierAdmin.xml deleted file mode 100644 index 2a58c0a873..0000000000 --- a/lib/cosEvent/doc/src/CosEventChannelAdmin_SupplierAdmin.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - -
- - 1997 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosEventChannelAdmin_SupplierAdmin - - - - - - 1997-11-13 - PA1 - CosEventChannelAdmin_SupplierAdmin.xml -
- CosEventChannelAdmin_SupplierAdmin - This module implements a SupplierAdmin interface, which allows suppliers to be connected to the event channel. - -

The SupplierAdmin interface defines the first step for connecting suppliers - to the event channel. It acts as a factory for creating proxy consumers. - Both consumer administration and supplier administration are defined as separate - objects so that the creator of the channel can control the addition of - suppliers and consumers.

-

To get access to all definitions include necessary files by using:

-
- - - obtain_push_consumer(Object) -> Return - Create a ProxyPushConsumer object - - Object = #objref - Return = #objref - - -

This operation returns a ProxyPushConsumer object reference.

-
-
- - obtain_pull_consumer(Object) -> Return - Create a ProxyPullConsumer object - - Object = #objref - Return = #objref - - -

This operation returns a ProxyPullConsumer object reference.

-
-
-
- -
- diff --git a/lib/cosEvent/doc/src/Makefile b/lib/cosEvent/doc/src/Makefile deleted file mode 100644 index 4fcb210e5a..0000000000 --- a/lib/cosEvent/doc/src/Makefile +++ /dev/null @@ -1,145 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2017. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../../vsn.mk -VSN=$(COSEVENT_VSN) -APPLICATION=cosEvent - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN) - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -XML_APPLICATION_FILES = ref_man.xml -XML_REF3_FILES = \ - CosEventChannelAdmin.xml \ - CosEventChannelAdmin_ConsumerAdmin.xml \ - CosEventChannelAdmin_SupplierAdmin.xml \ - CosEventChannelAdmin_EventChannel.xml \ - CosEventChannelAdmin_ProxyPullConsumer.xml \ - CosEventChannelAdmin_ProxyPullSupplier.xml \ - CosEventChannelAdmin_ProxyPushConsumer.xml \ - CosEventChannelAdmin_ProxyPushSupplier.xml \ - cosEventApp.xml - -XML_PART_FILES = \ - part.xml -XML_CHAPTER_FILES = \ - ch_contents.xml \ - ch_introduction.xml \ - ch_event_service.xml \ - notes.xml - -BOOK_FILES = book.xml - -XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \ - $(XML_PART_FILES) $(XML_CHAPTER_FILES) - -TECHNICAL_DESCR_FILES = - -GIF_FILES = \ - e_s_components.gif \ - e_s_models.gif - - -PS_FILES = - - -# ---------------------------------------------------- - -INTERNAL_HTML_FILES = $(TECHNICAL_DESCR_FILES:%.xml=$(HTMLDIR)/%.html) - -HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \ - $(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html) - -INFO_FILE = ../../info -EXTRA_FILES = \ - $(DEFAULT_GIF_FILES) \ - $(DEFAULT_HTML_FILES) \ - $(XML_REF3_FILES:%.xml=$(HTMLDIR)/%.html) \ - $(XML_CHAPTER_FILES:%.xml=$(HTMLDIR)/%.html) - -MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3) - -HTML_REF_MAN_FILE = $(HTMLDIR)/index.html - -TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -XML_FLAGS += -DVIPS_FLAGS += - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -$(HTMLDIR)/%.gif: %.gif - $(INSTALL_DATA) $< $@ - -docs: pdf html man - -$(TOP_PDF_FILE): $(XML_FILES) - -pdf: $(TOP_PDF_FILE) - -html: gifs $(HTML_REF_MAN_FILE) - -clean clean_docs: - rm -rf $(HTMLDIR)/* - rm -f $(MAN3DIR)/* - rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) - rm -f errs core *~ - rm -f $(JD_HTML) $(JD_PACK) - -man: $(MAN3_FILES) - -gifs: $(GIF_FILES:%=$(HTMLDIR)/%) - -$(INDEX_TARGET): $(INDEX_SRC) - sed -e 's;%VSN%;$(VSN);' $(INDEX_SRC) > $(INDEX_TARGET) - -debug opt: - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_docs_spec: docs - $(INSTALL_DIR) "$(RELSYSDIR)/doc/pdf" - $(INSTALL_DATA) $(TOP_PDF_FILE) "$(RELSYSDIR)/doc/pdf" - $(INSTALL_DIR) "$(RELSYSDIR)/doc/html" - $(INSTALL_DATA) $(HTMLDIR)/* \ - "$(RELSYSDIR)/doc/html" - $(INSTALL_DATA) $(INFO_FILE) "$(RELSYSDIR)" - $(INSTALL_DIR) "$(RELEASE_PATH)/man/man3" - $(INSTALL_DATA) $(MAN3DIR)/* "$(RELEASE_PATH)/man/man3" - -release_spec: diff --git a/lib/cosEvent/doc/src/book.xml b/lib/cosEvent/doc/src/book.xml deleted file mode 100644 index 5c0172b4cd..0000000000 --- a/lib/cosEvent/doc/src/book.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosEvent - - - 1998-04-25 - 1.0 - book.xml -
- - - cosEvent - - - - - - - - - - - - - - -
- diff --git a/lib/cosEvent/doc/src/ch_contents.xml b/lib/cosEvent/doc/src/ch_contents.xml deleted file mode 100644 index 07773877ea..0000000000 --- a/lib/cosEvent/doc/src/ch_contents.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - -
- - 1999 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - The cosEvent Application - Niclas Eklund - - 1999-09-17 - B - ch_contents.xml -
- -
- Content Overview -

The cosEvent documentation is divided into three sections: -

- - -

PART ONE - The User's Guide -

Description of the cosEvent Application including - services and a small tutorial demonstrating - the development of a simple service.

-
- -

PART TWO - Release Notes -

A concise history of cosEvent.

-
- -

PART THREE - The Reference Manual -

A quick reference guide, including a - brief description, to all the functions available in cosEvent.

-
-
-
- -
- Brief Description of the User's Guide -

The User's Guide contains the following parts:

- - -

CosEvent overview

-
- -

CosEvent installation and examples

-
-
-
-
- diff --git a/lib/cosEvent/doc/src/ch_event_service.xml b/lib/cosEvent/doc/src/ch_event_service.xml deleted file mode 100644 index 3a783234af..0000000000 --- a/lib/cosEvent/doc/src/ch_event_service.xml +++ /dev/null @@ -1,222 +0,0 @@ - - - - -
- - 19972016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Event Service - - - 97-11-19 - A - ch_es_intro.xml -
- -
- Overview of the CosEvent Service -

The Event service allows programmers to subscribe to - information channels. Suppliers can generate events without knowing the - consumer identities and the consumer can receive events without knowing - the supplier identity. Both push and pull event delivery are supported. - The Event service will queue information and processes. -

-

The CORBA Event service provides a flexible model for - asynchronous, decoupled communication between objects. This - chapter outlines communication models and the roles and - relationships of key components in the CosEvent service. It - shows a simple example on use of this service.

-
- -
- Event Service Components -

There are five components in the OMG CosEvent service architecture. These - are described below:

- - - -Figure 1: Event service Components - - - Suppliers and consumers: Consumers are the ultimate targets of - events generated by suppliers. Consumers and suppliers can both play active - and - passive roles. There could be two types of consumers and suppliers: push - or pull. A PushSupplier object can actively push an event to a passive - PushConsumer object. Likewise, a PullSupplier object can passively - wait for a PullConsumer object to actively pull an event from it. - EventChannel: The central abstraction in the CosEvent service is the - EventChannel which plays the role of a mediator between consumers and - suppliers. Consumers and suppliers register their interest with the - EventChannel. It can provide many-to-many communication. The channel - consumes events from one or more suppliers, and supplies events to one - or more consumers. An EventChannel can support consumers and suppliers - using different communication models. - ProxySuppliers and ProxyConsumers: ProxySuppliers act as middlemen - between consumers and the EventChannel. A ProxySupplier is similar to - a normal supplier, but includes an additional method for connecting a - consumer to the ProxySupplier. Likewise, ProxyConsumers act as - middlemen between suppliers and the EventChannel. A ProxyConsumer is - similar to a normal consumer, but includes an additional method for - connecting a supplier to the ProxyConsumer. - Supplier and consumer administrations: Consumer administration acts as - a factory for creating ProxySuppliers. Supplier administration acts as - a factory for creating ProxyConsumers. - -
- -
- Event Service Communication Models -

There are four general models of component collaboration in the OMG CosEvent service - architecture. The following describes these models: - (Please note that proxies are not shown in the diagrams for simplicity).

- - - -Figure 2: Event service Communication Models - - - The Canonical Push Model: The Canonical push model shown in figure 2(A) allows - the suppliers of events to initiate the transfer of event data to consumers. - In this model, suppliers are active initiators and consumers are the passive - targets of the requests. EventChannels play the role of . - Thus, active suppliers use EventChannels to push data to passive consumers that - have registered with the EventChannels. - The Canonical Pull Model:The Canonical pull model shown - in figure 2(B) - allows consumers to request events from suppliers. In this model, - Consumers are - active initiators and suppliers are the passive targets of the pull - requests. - EventChannel plays the role of since it procures - events - on behalf of consumers. Thus, active consumers can explicitly pull - data - from passive suppliers via the EventChannels. - The Hybrid Push/Pull Model: The push/pull model shown in figure 2(C) is a - hybrid that allows consumers to request events queued at an EventChannel - by suppliers. In this model, both suppliers and consumers are active - initiators of the requests. EventChannels play the role of . - Thus, active consumers can explicitly pull data deposited by active - suppliers via the EventChannels. - The Hybrid Pull/Push Model: The pull/push model shown in figure 2(D) is another - hybrid that allows the channel to pull events from suppliers and push them - to consumers. In this model, suppliers are passive targets of pull requests - and consumers are passive targets of pushes. EventChannels play the role of - . Thus, active EventChannels can pull data from - passive suppliers and push that data to passive consumers. - -
- -
- A Tutorial on How to Create a Simple Service -

To be able to use the cosEvent application supplier and consumer objects - must be implemented, which must inherit from the appropriate interface - defined in the CosEventComm.idl specification.

-

We start by creating an interface which inherits from the correct interface, - e.g., CosEventComm::PushConsumer. Hence, we must also implement all - operations defined in the PushConsumer interface. The IDL-file could look like: -

- - -module myClientImpl { - - interface ownInterface:CosEventComm::PushConsumer { - - void ownFunctions(in any NeededArguments) - raises(OwnExceptions); - - }; -}; - -#endif - ]]> -

Run the IDL compiler on this file by calling the function. - This will produce the API named . - After generating the API stubs and the server skeletons it is time to - implement the servers and if no special options are sent - to the IDl compiler the file name is .

-
- -
- How to Run Everything -

Below is a short transcript on how to run cosEvent.

- -

The example above, exemplifies a event system, i.e., the Canonical Push Model, where the Supplier client in some way generates event - and pushes them to the proxy. The push supplier proxies will eventually - push the events to each Consumer client.

-
-
- diff --git a/lib/cosEvent/doc/src/ch_introduction.xml b/lib/cosEvent/doc/src/ch_introduction.xml deleted file mode 100644 index c88e96e40d..0000000000 --- a/lib/cosEvent/doc/src/ch_introduction.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - -
- - 1999 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - Introduction to cosEvent - Niclas Eklund - - 1999-09-17 - - ch_introduction.xml -
- -
- Overview -

The cosEvent application is a Event Service compliant with the OMG - Event Service CosEvent. -

- -
- Purpose and Dependencies -

CosEvent is dependent on Orber, which provides CORBA functionality in an Erlang environment.

-
- -
- Prerequisites -

To fully understand the concepts presented in the - documentation, it is recommended that the user is familiar - with distributed programming and CORBA. -

-

Recommended reading includes CORBA, Fundamentals and Programming - Jon Siegel and Open Telecom Platform Documentation Set. It is also helpful to have read - Concurrent Programming in Erlang.

-
-
-
- diff --git a/lib/cosEvent/doc/src/cosEventApp.xml b/lib/cosEvent/doc/src/cosEventApp.xml deleted file mode 100644 index d26512e0c3..0000000000 --- a/lib/cosEvent/doc/src/cosEventApp.xml +++ /dev/null @@ -1,169 +0,0 @@ - - - - -
- - 2001 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - cosEventApp - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 2000-01-31 - PA1 - cosEventApp.xml -
- cosEventApp - The main module of the cosEvent application. - -

To get access to the record definitions for the structures use:

-

This module contains the functions for starting and stopping the application.

-
- - - install() -> Return - Install the cosEvent application - - Return = ok | {'EXCEPTION', E} | {'EXIT', R} - - -

This operation installs the cosEvent application.

-
-
- - uninstall() -> Return - Uninstall the cosEvent application - - Return = ok | {'EXCEPTION', E} | {'EXIT', R} - - -

This operation uninstalls the cosEvent application.

-
-
- - start() -> Return - Start the cosEvent application - - Return = ok | {error, Reason} - - -

This operation starts the cosEvent application.

-
-
- - stop() -> Return - Stop the cosEvent application - - Return = ok | {error, Reason} - - -

This operation stops the cosEvent application.

-
-
- - start_channel() -> Channel - Start a channel with default settings - - Channel = #objref - - -

This operation creates a new instance of a - Event Channel - using the default settings.

-
-
- - start_channel(Options) -> Channel - Start a channel with settings defined by the given options - - Options = [Option] - Option = {pull_interval, Seconds} | {typecheck, Boolean} | {maxEvents, Integer} | {blocking, Boolean} - Channel = #objref - - -

This operation creates a new instance of a - Event Channel

-

- - - determine how often Proxy Pull - Consumers will check for new events with the client application. The - default value is 20 seconds. - - if this option is set to true the - proxies will check if the supplied client object is of correct type. - The default value is false. - - this option determine how many events - the will store before discarding events. - If the limit is reached events will be discarded in any order. - The default value is 300. - - this option determine the behavior of - the channel when handling events internally. If set to the - risk of a single event supplier floods the system is reduced, but - the performance may also be reduced. - The default value is . - -
-
- - start_channel_link() -> Channel - Start a channel, which is linked to the invoking process, with default settings - - Channel = #objref - - -

This operation creates a new instance of a - Event Channel, - which is linked to the invoking process, using the default settings.

-
-
- - start_channel_link(Options) -> Channel - Start a channel, which is linked to the invoking process, with settings defined by the given options - - Options = [Option] - Option = {pull_interval, Seconds} | {typecheck, Boolean} | {maxEvents, Integer} | {blocking, Boolean} - Channel = #objref - - -

This operation creates a new instance of a - Event Channel, - which is linked to the invoking process, with settings defined by the - given options. Allowed options are the same as for - .

-
-
- - stop_channel(Channel) -> Reply - Terminate the target object - - Channel = #objref - Reply = ok | {'EXCEPTION', E} - - -

This operation stop the target event channel.

-
-
-
- -
- diff --git a/lib/cosEvent/doc/src/e_s_components.gif b/lib/cosEvent/doc/src/e_s_components.gif deleted file mode 100644 index a448c14ce0..0000000000 Binary files a/lib/cosEvent/doc/src/e_s_components.gif and /dev/null differ diff --git a/lib/cosEvent/doc/src/e_s_models.gif b/lib/cosEvent/doc/src/e_s_models.gif deleted file mode 100644 index 329b0858d1..0000000000 Binary files a/lib/cosEvent/doc/src/e_s_models.gif and /dev/null differ diff --git a/lib/cosEvent/doc/src/notes.xml b/lib/cosEvent/doc/src/notes.xml deleted file mode 100644 index ba0b0d88db..0000000000 --- a/lib/cosEvent/doc/src/notes.xml +++ /dev/null @@ -1,348 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosEvent Release Notes - - - - - - 99-02-12 - A - notes.xml -
- -
cosEvent 2.2.2 - -
Fixed Bugs and Malfunctions - - -

Removed all old unused files in the documentation. -

-

- Own Id: OTP-14475 Aux Id: ERL-409, PR-1493

-
-
-
- -
- -
cosEvent 2.2.1 - -
Improvements and New Features - - -

- Internal changes

-

- Own Id: OTP-13551

-
-
-
- -
- -
cosEvent 2.2 - -
Improvements and New Features - - -

Remove the usage of erlang:now() from all Corba - applications and use the new rand module instead of - random.

-

- Own Id: OTP-12687

-
-
-
- -
- -
cosEvent 2.1.15 - -
Improvements and New Features - - -

The default encoding of Erlang files has been changed - from ISO-8859-1 to UTF-8.

The encoding of XML - files has also been changed to UTF-8.

-

- Own Id: OTP-10907

-
-
-
- -
- -
cosEvent 2.1.14 - -
Improvements and New Features - - -

Postscript files no longer needed for the generation - of PDF files have been removed.

-

- Own Id: OTP-11016

-
-
-
- -
- -
cosEvent 2.1.13 - -
Improvements and New Features - - -

- Misc build updates

-

- Own Id: OTP-10784

-
-
-
- -
- -
cosEvent 2.1.12 - -
Improvements and New Features - - -

Erlang/OTP can now be built using parallel make if you - limit the number of jobs, for instance using 'make - -j6' or 'make -j10'. 'make -j' does not - work at the moment because of some missing - dependencies.

-

- Own Id: OTP-9451

-
-
-
- -
- -
- cosEvent 2.1.11 - -
- Improvements and New Features - - -

- Removed superfluous usage of shy in the documentation since it can cause problem if - a buggy tool is used.

-

- Own Id: OTP-9319 Aux Id:

-
-
-
-
- -
- cosEvent 2.1.10 - -
- Improvements and New Features - - -

- Eliminated Dialyzer warnings when using exit or throw.

-

- Own Id: OTP-9050 Aux Id:

-
-
-
-
- -
- cosEvent 2.1.9 - -
- Improvements and New Features - - -

- Test suites published.

-

- Own Id: OTP-8543 Aux Id:

-
-
-
-
- -
- cosEvent 2.1.8 - -
- Improvements and New Features - - -

- Removed the usage of the codeinclude tag in the documentation.

-

- Own Id: OTP-8409 Aux Id:

-
-
-
-
- -
- cosEvent 2.1.7 - -
- Improvements and New Features - - -

- The documentation is now built with open source tools (xsltproc and fop) - that exists on most platforms. One visible change is that the frames are removed.

-

- Own Id: OTP-8201 Aux Id:

-
-
-
-
- -
- cosEvent 2.1.6 - -
- Improvements and New Features - - -

Obsolete guards, e.g. record vs is_record, has been changed - to avoid compiler warnings.

-

Own id: OTP-7987

-
-
-
-
- -
- cosEvent 2.1.5 - -
- Improvements and New Features - - -

Updated file headers.

-

Own id: OTP-7837

-
-
-
-
- -
- cosEvent 2.1.4 - -
- Improvements and New Features - - -

Documentation source included in open source releases.

-

Own id: OTP-7595

-
-
-
-
- -
- cosEvent 2.1.3 - -
- Improvements and New Features - - -

Updated file headers.

-

Own id: OTP-7011

-
-
-
-
- -
- cosEvent 2.1.2 - -
- Improvements and New Features - - -

The documentation source has been converted from SGML to XML.

-

Own id: OTP-6754

-
-
-
-
- -
- cosEvent 2.1.1 - -
- Improvements and New Features - - -

Minor Makefile changes.

-

Own id: OTP-6701

-
-
-
-
- -
- cosEvent 2.1 - -
- Improvements and New Features - - -

The stub/skeleton-files generated by IC have been improved, - i.e., depending on the IDL-files, reduced the size of the - erl- and beam-files and decreased dependencies off Orber's - Interface Repository. It is necessary to re-compile all IDL-files - and use COS-applications, including Orber, compiled with - IC-4.2.

-

Own id: OTP-4576

-
-
-
-
- -
- cosEvent 2.0 - -
- Fixed Bugs and Malfunctions - - -

This version is a completely new version of the cosEvent - application; older versions was not compliant with the OMG - specification. The have been changed - to be more uniform with the other COS-services.

-
-
-
-
-
- diff --git a/lib/cosEvent/doc/src/part.xml b/lib/cosEvent/doc/src/part.xml deleted file mode 100644 index 5e32455ebb..0000000000 --- a/lib/cosEvent/doc/src/part.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosEvent User's Guide - - - 1998-04-26 - 1.0 - part.xml -
- -

The cosEvent application is an Erlang implementation of a - CORBA Service CosEvent.

-
- - - -
- diff --git a/lib/cosEvent/doc/src/ref_man.xml b/lib/cosEvent/doc/src/ref_man.xml deleted file mode 100644 index 5db5626478..0000000000 --- a/lib/cosEvent/doc/src/ref_man.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosEvent Reference Manual - - - 1998-05-05 - 2.0 - ref_man.xml -
- -

The cosEvent application is an Erlang implementation of - a CORBA Service CosEvent.

-
- - - - - - - - - -
- diff --git a/lib/cosEvent/ebin/.gitignore b/lib/cosEvent/ebin/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosEvent/example/.gitignore b/lib/cosEvent/example/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosEvent/include/.gitignore b/lib/cosEvent/include/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosEvent/info b/lib/cosEvent/info deleted file mode 100644 index dc9f7b7404..0000000000 --- a/lib/cosEvent/info +++ /dev/null @@ -1,2 +0,0 @@ -group: orb -short: Orber OMG Event Service diff --git a/lib/cosEvent/src/CosEventChannelAdmin.cfg b/lib/cosEvent/src/CosEventChannelAdmin.cfg deleted file mode 100644 index 0de579bd6f..0000000000 --- a/lib/cosEvent/src/CosEventChannelAdmin.cfg +++ /dev/null @@ -1,6 +0,0 @@ -{this, "CosEventChannelAdmin::SupplierAdmin"}. -{{handle_info, "CosEventChannelAdmin::SupplierAdmin"}, true}. -{this, "CosEventChannelAdmin::ProxyPushConsumer"}. -{{handle_info, "CosEventChannelAdmin::ProxyPushConsumer"}, true}. -{this, "CosEventChannelAdmin::ProxyPullConsumer"}. -{{handle_info, "CosEventChannelAdmin::ProxyPullConsumer"}, true}. diff --git a/lib/cosEvent/src/CosEventChannelAdmin.idl b/lib/cosEvent/src/CosEventChannelAdmin.idl deleted file mode 100644 index d5cb92c4e0..0000000000 --- a/lib/cosEvent/src/CosEventChannelAdmin.idl +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef _COSEVENTCHANELADMIN_IDL -#define _COSEVENTCHANELADMIN_IDL - -#include "CosEventComm.idl" - -#pragma prefix "omg.org" - -module CosEventChannelAdmin -{ - exception AlreadyConnected{}; - exception TypeError{}; - - interface ProxyPushConsumer: CosEventComm::PushConsumer - { - void connect_push_supplier(in CosEventComm:: - PushSupplier push_supplier) - raises (AlreadyConnected); - }; - - interface ProxyPullSupplier: CosEventComm::PullSupplier - { - void connect_pull_consumer(in CosEventComm:: - PullConsumer pull_consumer) - raises (AlreadyConnected); - }; - - interface ProxyPullConsumer: CosEventComm::PullConsumer - { - void connect_pull_supplier(in CosEventComm:: - PullSupplier pull_supplier) - raises (AlreadyConnected, TypeError); - }; - - interface ProxyPushSupplier: CosEventComm::PushSupplier - { - void connect_push_consumer(in CosEventComm:: - PushConsumer push_consumer) - raises (AlreadyConnected, TypeError); - }; - - interface ConsumerAdmin - { - ProxyPushSupplier obtain_push_supplier(); - ProxyPullSupplier obtain_pull_supplier(); - }; - - interface SupplierAdmin - { - ProxyPushConsumer obtain_push_consumer(); - ProxyPullConsumer obtain_pull_consumer(); - }; - - interface EventChannel - { - ConsumerAdmin for_consumers(); - SupplierAdmin for_suppliers(); - void destroy(); - }; - -}; - -#endif - - - - diff --git a/lib/cosEvent/src/CosEventChannelAdmin_ProxyPullConsumer_impl.erl b/lib/cosEvent/src/CosEventChannelAdmin_ProxyPullConsumer_impl.erl deleted file mode 100644 index cb9bb4f4a4..0000000000 --- a/lib/cosEvent/src/CosEventChannelAdmin_ProxyPullConsumer_impl.erl +++ /dev/null @@ -1,206 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosEventChannelAdmin_ProxyPullConsumer_impl.erl -%% Description : -%% -%%---------------------------------------------------------------------- --module('CosEventChannelAdmin_ProxyPullConsumer_impl'). - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include("CosEventChannelAdmin.hrl"). --include("CosEventComm.hrl"). --include("cosEventApp.hrl"). - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- -%% Mandatory --export([init/1, - terminate/2, - code_change/3, - handle_info/2]). - -%% Interface functions --export([connect_pull_supplier/3]). - -%% Exports from "CosEventComm::PullConsumer" --export([disconnect_pull_consumer/2]). - - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {admin, admin_pid, channel, client, - typecheck, pull_interval, timer_ref}). - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%---------------------------------------------------------------------- -init([Admin, AdminPid, Channel, TypeCheck, PullInterval]) -> - process_flag(trap_exit, true), - Secs = timer:seconds(PullInterval), - timer:start(), - {ok, #state{admin = Admin, admin_pid = AdminPid, channel = Channel, - typecheck = TypeCheck, pull_interval = Secs}}. - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Returns : any (ignored by gen_server) -%% Description: Shutdown the server -%%---------------------------------------------------------------------- -terminate(_Reason, #state{client = undefined}) -> - ?DBG("Terminating ~p; no client connected.~n", [_Reason]), - ok; -terminate(_Reason, #state{client = Client} = State) -> - stop_timer(State), - ?DBG("Terminating ~p~n", [_Reason]), - cosEventApp:disconnect('CosEventComm_PullSupplier', - disconnect_pull_supplier, Client), - ok. - -%%---------------------------------------------------------------------- -%% Function : code_change/3 -%% Returns : {ok, NewState} -%% Description: Convert process state when code is changed -%%---------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%---------------------------------------------------------------------% -%% function : handle_info -%% Arguments: -%% Returns : {noreply, State} | -%% {stop, Reason, State} -%% Effect : If the Parent Admin or the Channel terminates so must this object. -%%---------------------------------------------------------------------- -handle_info({'EXIT', Pid, Reason}, #state{admin_pid = Pid} = State) -> - ?DBG("Parent Admin terminated ~p~n", [Reason]), - orber:dbg("[~p] CosEventChannelAdmin_ProxyPullConsumer:handle_info(~p);~n" - "My Admin terminated and so will I.", [?LINE, Reason], ?DEBUG_LEVEL), - {stop, Reason, State}; -handle_info(try_pull_event, State) -> - try_pull_event(State); -handle_info(_Info, State) -> - ?DBG("Unknown Info ~p~n", [_Info]), - {noreply, State}. - -%%---------------------------------------------------------------------- -%% Function : connect_pull_supplier -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -connect_pull_supplier(_OE_This, #state{client = undefined, - typecheck = TypeCheck} = State, NewClient) -> - case corba_object:is_nil(NewClient) of - true -> - ?DBG("A NIL client supplied.~n", []), - orber:dbg("[~p] CosEventChannelAdmin_ProxyPullConsumer:connect_pull_supplier(..);~n" - "Supplied a NIL reference which is not allowed.", - [?LINE], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status = ?COMPLETED_NO}); - false -> - cosEventApp:type_check(NewClient, 'CosEventComm_PullSupplier', TypeCheck), - NewState = start_timer(State), - {reply, ok, NewState#state{client = NewClient}} - end; -connect_pull_supplier(_, _, _) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}). - - -%%---------------------------------------------------------------------- -%% Function : disconnect_pull_consumer -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -disconnect_pull_consumer(_OE_This, State) -> - NewState = stop_timer(State), - ?DBG("Disconnect invoked ~p~n", [NewState]), - {stop, normal, ok, NewState#state{client = undefined}}. - -%%====================================================================== -%% Internal functions -%%====================================================================== -%% Start timer which send a message each time we should pull for new events. -start_timer(State) -> - case catch timer:send_interval(State#state.pull_interval, try_pull_event) of - {ok,PullTRef} -> - ?DBG("Started timer: ~p~n", [State#state.pull_interval]), - State#state{timer_ref = PullTRef}; - _ -> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. -stop_timer(#state{timer_ref = undefined} = State) -> - ?DBG("No timer to stop~n",[]), - State; -stop_timer(State) -> - ?DBG("Stopped timer~n",[]), - timer:cancel(State#state.timer_ref), - State#state{timer_ref = undefined}. - - -try_pull_event(State) -> - case catch 'CosEventComm_PullSupplier':try_pull(State#state.client) of - {_,false} -> - ?DBG("Client did not supply event~n", []), - {noreply, State}; - {Any, true} -> - 'oe_CosEventComm_Channel':send_sync(State#state.channel, Any), - ?DBG("Received Event ~p and forwarded it successfully.~n", [Any]), - {noreply, State}; - {'EXCEPTION', #'CosEventComm_Disconnected'{}} -> - ?DBG("Client claims we are disconnectedwhen trying to pull event.~n", []), - orber:dbg("[~p] CosEventChannelAdmin_ProxyPullConsumer:try_pull_event();~n" - "Client claims we are disconnected when trying to pull event so I terminate.", - [?LINE], ?DEBUG_LEVEL), - {stop, normal, State#state{client = undefined}}; - What -> - orber:dbg("[~p] CosEventChannelAdmin_ProxyPullConsumer:try_pull_event(~p);~n" - "My Client behaves badly so I terminate.", - [?LINE, What], ?DEBUG_LEVEL), - {stop, normal, State} - end. - - -%%====================================================================== -%% END OF MODULE -%%====================================================================== diff --git a/lib/cosEvent/src/CosEventChannelAdmin_ProxyPushConsumer_impl.erl b/lib/cosEvent/src/CosEventChannelAdmin_ProxyPushConsumer_impl.erl deleted file mode 100644 index 4c2b8629f2..0000000000 --- a/lib/cosEvent/src/CosEventChannelAdmin_ProxyPushConsumer_impl.erl +++ /dev/null @@ -1,170 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosEventChannelAdmin_ProxyPushConsumer_impl.erl -%% Description : -%% -%%---------------------------------------------------------------------- --module('CosEventChannelAdmin_ProxyPushConsumer_impl'). - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include("CosEventChannelAdmin.hrl"). --include("CosEventComm.hrl"). --include("cosEventApp.hrl"). - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- -%% Mandatory --export([init/1, - terminate/2, - code_change/3, - handle_info/2]). - -%% Exports from "CosEventChannelAdmin::ProxyPushConsumer" --export([connect_push_supplier/3]). - -%% Exports from "CosEventComm::PushConsumer" --export([push/3, - disconnect_push_consumer/2]). - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {admin, admin_pid, channel, client, typecheck}). - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%---------------------------------------------------------------------- -init([Admin, AdminPid, Channel, TypeCheck]) -> - process_flag(trap_exit, true), - {ok, #state{admin = Admin, admin_pid = AdminPid, channel = Channel, - typecheck = TypeCheck}}. - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Returns : any (ignored by gen_server) -%% Description: Shutdown the server -%%---------------------------------------------------------------------- -terminate(_Reason, #state{client = undefined}) -> - ?DBG("Terminating ~p; no client connected.~n", [_Reason]), - ok; -terminate(_Reason, #state{client = Client} = _State) -> - ?DBG("Terminating ~p~n", [_Reason]), - cosEventApp:disconnect('CosEventComm_PushSupplier', - disconnect_push_supplier, Client), - ok. - -%%---------------------------------------------------------------------- -%% Function : code_change/3 -%% Returns : {ok, NewState} -%% Description: Convert process state when code is changed -%%---------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%---------------------------------------------------------------------% -%% function : handle_info -%% Arguments: -%% Returns : {noreply, State} | -%% {stop, Reason, State} -%% Effect : If the Parnet Admin or the Channel terminates so must this object. -%%---------------------------------------------------------------------- -handle_info({'EXIT', Pid, Reason}, #state{admin_pid = Pid} = State) -> - ?DBG("Parent Admin terminated ~p~n", [Reason]), - orber:dbg("[~p] CosEventChannelAdmin_ProxyPushConsumer:handle_info(~p);~n" - "My Admin terminated and so will I.", - [?LINE, Reason], ?DEBUG_LEVEL), - {stop, Reason, State}; -handle_info(_Info, State) -> - ?DBG("Unknown Info ~p~n", [_Info]), - {noreply, State}. - -%%---------------------------------------------------------------------- -%% Function : connect_push_supplier -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -connect_push_supplier(_OE_This, #state{client = undefined, - typecheck = TypeCheck} = State, NewClient) -> - case corba_object:is_nil(NewClient) of - true -> - ?DBG("A NIL client supplied.~n", []), - {reply, ok, State}; - false -> - cosEventApp:type_check(NewClient, 'CosEventComm_PushSupplier', TypeCheck), - ?DBG("Connected to client.~n", []), - {reply, ok, State#state{client = NewClient}} - end; -connect_push_supplier(_, _, _) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}). - - -%%---------------------------------------------------------------------- -%% Function : push -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -push(_OE_This, State, Any) -> - %% We should not use corba:reply here since if we block incoming - %% events this will prevent producers to flood the system. - ?DBG("Received Event ~p and forwarded it successfully.~n", [Any]), - 'oe_CosEventComm_Channel':send_sync(State#state.channel, Any), - {reply, ok, State}. - -%%---------------------------------------------------------------------- -%% Function : disconnect_push_consumer -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -disconnect_push_consumer(_OE_This, State) -> - ?DBG("Disconnect invoked ~p~n", [State]), - {stop, normal, ok, State#state{client = undefined}}. - -%%====================================================================== -%% Internal functions -%%====================================================================== - -%%====================================================================== -%% END OF MODULE -%%====================================================================== diff --git a/lib/cosEvent/src/CosEventChannelAdmin_SupplierAdmin_impl.erl b/lib/cosEvent/src/CosEventChannelAdmin_SupplierAdmin_impl.erl deleted file mode 100644 index fb5304292b..0000000000 --- a/lib/cosEvent/src/CosEventChannelAdmin_SupplierAdmin_impl.erl +++ /dev/null @@ -1,160 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosEventChannelAdmin_SupplierAdmin_impl.erl -%% Created : 21 Mar 2001 -%% Description : -%% -%%---------------------------------------------------------------------- --module('CosEventChannelAdmin_SupplierAdmin_impl'). - - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include("cosEventApp.hrl"). - - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- -%% Mandatory --export([init/1, - terminate/2, - code_change/3, - handle_info/2]). - -%% Exports from "CosEventChannelAdmin::SupplierAdmin" --export([obtain_push_consumer/2, - obtain_pull_consumer/2]). - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {channel, channel_pid, typecheck, pull_interval, server_options}). - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%---------------------------------------------------------------------- -init([Channel, ChannelPid, TypeCheck, PullInterval, ServerOpts]) -> - process_flag(trap_exit, true), - {ok, #state{channel = Channel, channel_pid = ChannelPid, typecheck = TypeCheck, - pull_interval = PullInterval, server_options = ServerOpts}}. - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Returns : any (ignored by gen_server) -%% Description: Shutdown the server -%%---------------------------------------------------------------------- -terminate(_Reason, _State) -> - ?DBG("Terminating ~p~n", [_Reason]), - ok. - -%%---------------------------------------------------------------------- -%% Function : code_change/3 -%% Returns : {ok, NewState} -%% Description: Convert process state when code is changed -%%---------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%---------------------------------------------------------------------% -%% function : handle_info -%% Arguments: -%% Returns : {noreply, State} | -%% {stop, Reason, State} -%% Effect : Functions demanded by the gen_server module. -%%---------------------------------------------------------------------- -handle_info({'EXIT', Pid, Reason}, #state{channel_pid = Pid} = State) -> - ?DBG("Parent Channel terminated ~p~n", [Reason]), - orber:dbg("[~p] CosEventChannelAdmin_SupplierAdmin:handle_info(~p);~n" - "My Channel terminated and so will I.", - [?LINE, Reason], ?DEBUG_LEVEL), - {stop, Reason, State}; -handle_info(_Info, State) -> - ?DBG("Unknown Info ~p~n", [_Info]), - {noreply, State}. - - -%%---------------------------------------------------------------------- -%% Function : obtain_push_consumer -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -obtain_push_consumer(OE_This, #state{channel = Channel, - channel_pid = _ChannelPid, - typecheck = TypeCheck, - server_options = ServerOpts} = State) -> - ?DBG("Starting a new CosEventChannelAdmin_ProxyPushConsumer.~n", []), - {reply, - 'CosEventChannelAdmin_ProxyPushConsumer':oe_create_link([OE_This, - self(), - Channel, - TypeCheck], - ServerOpts), - State}. - -%%---------------------------------------------------------------------- -%% Function : obtain_pull_consumer -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -obtain_pull_consumer(OE_This, #state{channel = Channel, - channel_pid = _ChannelPid, - typecheck = TypeCheck, - pull_interval= PullInterval, - server_options = ServerOpts} = State) -> - ?DBG("Starting a new CosEventChannelAdmin_ProxyPullConsumer.~n", []), - {reply, - 'CosEventChannelAdmin_ProxyPullConsumer':oe_create_link([OE_This, - self(), - Channel, - TypeCheck, - PullInterval], - ServerOpts), - State}. - -%%====================================================================== -%% Internal functions -%%====================================================================== - -%%====================================================================== -%% END OF MODULE -%%====================================================================== diff --git a/lib/cosEvent/src/CosEventComm.idl b/lib/cosEvent/src/CosEventComm.idl deleted file mode 100644 index bb0c107394..0000000000 --- a/lib/cosEvent/src/CosEventComm.idl +++ /dev/null @@ -1,37 +0,0 @@ - -#ifndef _COSEVENTCOMM_IDL -#define _COSEVENTCOMM_IDL - -#pragma prefix "omg.org" - -module CosEventComm -{ - exception Disconnected{}; - - interface PushConsumer - { - void push(in any data) raises (Disconnected); - void disconnect_push_consumer(); - }; - - - interface PushSupplier - { - void disconnect_push_supplier(); - }; - - interface PullSupplier - { - any pull() raises(Disconnected); - any try_pull(out boolean has_event) raises(Disconnected); - void disconnect_pull_supplier(); - }; - - interface PullConsumer - { - void disconnect_pull_consumer(); - }; -}; - -#endif - diff --git a/lib/cosEvent/src/Makefile b/lib/cosEvent/src/Makefile deleted file mode 100644 index 29d6223005..0000000000 --- a/lib/cosEvent/src/Makefile +++ /dev/null @@ -1,217 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1997-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -ifeq ($(TYPE),debug) -ERL_COMPILE_FLAGS += -Ddebug -W -endif -EBIN=../ebin -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSEVENT_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/cosEvent-$(VSN) -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- - -MODULES = \ - CosEventChannelAdmin_ProxyPullConsumer_impl \ - CosEventChannelAdmin_ProxyPushConsumer_impl \ - CosEventChannelAdmin_SupplierAdmin_impl \ - oe_CosEventComm_CAdmin_impl \ - oe_CosEventComm_Channel_impl \ - oe_CosEventComm_PullerS_impl \ - oe_CosEventComm_PusherS_impl \ - cosEventApp - - - -ERL_FILES = $(MODULES:%=%.erl) -HRL_FILES = cosEventApp.hrl - - -GEN_ERL_FILES1 = \ - oe_CosEventChannelAdmin.erl \ - CosEventChannelAdmin_ConsumerAdmin.erl \ - CosEventChannelAdmin_EventChannel.erl \ - CosEventChannelAdmin_ProxyPullConsumer.erl \ - CosEventChannelAdmin_ProxyPullSupplier.erl \ - CosEventChannelAdmin_ProxyPushConsumer.erl \ - CosEventChannelAdmin_ProxyPushSupplier.erl \ - CosEventChannelAdmin_SupplierAdmin.erl \ - CosEventChannelAdmin_AlreadyConnected.erl \ - CosEventChannelAdmin_TypeError.erl - -GEN_ERL_FILES2 = \ - oe_CosEventComm_CAdmin.erl \ - oe_CosEventComm_Channel.erl \ - oe_CosEventComm_Event.erl \ - oe_CosEventComm_PullerS.erl \ - oe_CosEventComm_PusherS.erl \ - oe_cosEventApp.erl - -GEN_ERL_FILES3 = \ - oe_CosEventComm.erl \ - CosEventComm_Disconnected.erl \ - CosEventComm_PullConsumer.erl \ - CosEventComm_PullSupplier.erl \ - CosEventComm_PushConsumer.erl \ - CosEventComm_PushSupplier.erl - -GEN_ERL_FILES = \ - $(GEN_ERL_FILES1) $(GEN_ERL_FILES2) $(GEN_ERL_FILES3) - -EXTERNAL_INC_PATH = ../include - -GEN_HRL_FILES1 = \ - oe_CosEventChannelAdmin.hrl \ - CosEventChannelAdmin.hrl \ - CosEventChannelAdmin_ConsumerAdmin.hrl \ - CosEventChannelAdmin_EventChannel.hrl \ - CosEventChannelAdmin_ProxyPullConsumer.hrl \ - CosEventChannelAdmin_ProxyPullSupplier.hrl \ - CosEventChannelAdmin_ProxyPushConsumer.hrl \ - CosEventChannelAdmin_ProxyPushSupplier.hrl \ - CosEventChannelAdmin_SupplierAdmin.hrl - -EXTERNAL_GEN_HRL_FILES1 = $(GEN_HRL_FILES1:%=$(EXTERNAL_INC_PATH)/%) - -GEN_HRL_FILES2 = \ - oe_CosEventComm_PullerS.hrl \ - oe_CosEventComm_CAdmin.hrl \ - oe_CosEventComm_PusherS.hrl \ - oe_CosEventComm_Channel.hrl \ - oe_cosEventApp.hrl \ - oe_CosEventComm_Event.hrl - -GEN_HRL_FILES3 = \ - oe_CosEventComm.hrl \ - CosEventComm.hrl \ - CosEventComm_PullConsumer.hrl \ - CosEventComm_PullSupplier.hrl \ - CosEventComm_PushConsumer.hrl \ - CosEventComm_PushSupplier.hrl - -EXTERNAL_GEN_HRL_FILES3 = $(GEN_HRL_FILES3:%=$(EXTERNAL_INC_PATH)/%) - -GEN_HRL_FILES = \ - $(EXTERNAL_GEN_HRL_FILES1) $(GEN_HRL_FILES2) $(EXTERNAL_GEN_HRL_FILES3) - -TARGET_FILES = \ - $(GEN_ERL_FILES:%.erl=$(EBIN)/%.$(EMULATOR)) \ - $(MODULES:%=$(EBIN)/%.$(EMULATOR)) - -GEN_FILES = $(GEN_HRL_FILES) $(GEN_ERL_FILES) - -IDL_FILES = \ - CosEventChannelAdmin.idl \ - CosEventComm.idl \ - cosEventApp.idl - -APPUP_FILE = cosEvent.appup -APPUP_SRC = $(APPUP_FILE).src -APPUP_TARGET = $(EBIN)/$(APPUP_FILE) - -APP_FILE = cosEvent.app -APP_SRC = $(APP_FILE).src -APP_TARGET = $(EBIN)/$(APP_FILE) - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/cosEvent/ebin -pa $(ERL_TOP)/lib/ic/ebin -# The -pa option is just used temporary until erlc can handle -# includes from other directories than ../include . -ERL_COMPILE_FLAGS += \ - $(ERL_IDL_FLAGS) \ - -I$(ERL_TOP)/lib/orber/include \ - -I$(ERL_TOP)/lib/cosEvent/include \ - +'{parse_transform,sys_pre_attributes}' \ - +'{attribute,insert,app_vsn,"cosEvent_$(COSEVENT_VSN)"}' - -YRL_FLAGS = - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) - -debug: - @${MAKE} TYPE=debug opt - -clean: - rm -f $(TARGET_FILES) $(GEN_FILES) $(APP_TARGET) $(APPUP_TARGET) IDL-GENERATED - rm -f errs core *~ - -$(APP_TARGET): $(APP_SRC) - $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $(APP_SRC) > $(APP_TARGET) -$(APPUP_TARGET): $(APPUP_SRC) - $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $(APPUP_SRC) > $(APPUP_TARGET) - -docs: - -# ---------------------------------------------------- -# Special Build Targets -# ---------------------------------------------------- - -IDL-GENERATED: CosEventChannelAdmin.idl cosEventApp.idl CosEventComm.idl - $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosEventChannelAdmin.cfg"}' CosEventChannelAdmin.idl - $(V_at)mv $(GEN_HRL_FILES1) $(EXTERNAL_INC_PATH) - $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"cosEventApp.cfg"}' cosEventApp.idl - $(V_at)erlc $(ERL_IDL_FLAGS) CosEventComm.idl - $(V_at)mv $(GEN_HRL_FILES3) $(EXTERNAL_INC_PATH) - $(V_at)>IDL-GENERATED - -$(GEN_FILES): IDL-GENERATED - -$(TARGET_FILES): IDL-GENERATED - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - - -release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)" - $(INSTALL_DATA) ../info "$(RELSYSDIR)" - $(INSTALL_DIR) "$(RELSYSDIR)/ebin" - $(INSTALL_DATA) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) "$(RELSYSDIR)/ebin" - $(INSTALL_DIR) "$(RELSYSDIR)/src" - $(INSTALL_DATA) $(ERL_FILES) $(HRL_FILES) $(GEN_ERL_FILES) $(IDL_FILES) "$(RELSYSDIR)/src" - $(INSTALL_DIR) "$(RELSYSDIR)/include" - $(INSTALL_DATA) $(GEN_HRL_FILES) "$(RELSYSDIR)/include" - - -release_docs_spec: - - - - - - diff --git a/lib/cosEvent/src/cosEvent.app.src b/lib/cosEvent/src/cosEvent.app.src deleted file mode 100644 index 5ffd12bc6b..0000000000 --- a/lib/cosEvent/src/cosEvent.app.src +++ /dev/null @@ -1,46 +0,0 @@ -{application, cosEvent, - [{description, "The Erlang CosEvent application"}, - {vsn, "%VSN%"}, - {modules, - [ - 'CosEventChannelAdmin_ProxyPullConsumer_impl', - 'CosEventChannelAdmin_ProxyPushConsumer_impl', - 'CosEventChannelAdmin_SupplierAdmin_impl', - 'oe_CosEventComm_CAdmin_impl', - 'oe_CosEventComm_Channel_impl', - 'oe_CosEventComm_PullerS_impl', - 'oe_CosEventComm_PusherS_impl', - 'cosEventApp', - 'oe_CosEventChannelAdmin', - 'CosEventChannelAdmin_AlreadyConnected', - 'CosEventChannelAdmin_ConsumerAdmin', - 'CosEventChannelAdmin_EventChannel', - 'CosEventChannelAdmin_ProxyPullConsumer', - 'CosEventChannelAdmin_ProxyPullSupplier', - 'CosEventChannelAdmin_ProxyPushConsumer', - 'CosEventChannelAdmin_ProxyPushSupplier', - 'CosEventChannelAdmin_SupplierAdmin', - 'CosEventChannelAdmin_TypeError', - 'oe_CosEventComm_CAdmin', - 'oe_CosEventComm_Channel', - 'oe_CosEventComm_Event', - 'oe_CosEventComm_PullerS', - 'oe_CosEventComm_PusherS', - 'oe_cosEventApp', - 'oe_CosEventComm', - 'CosEventComm_PushSupplier', - 'CosEventComm_PushConsumer', - 'CosEventComm_PullSupplier', - 'CosEventComm_PullConsumer', - 'CosEventComm_Disconnected' - ] - }, - {registered, []}, - {applications, [orber, stdlib, kernel]}, - {env, []}, - {mod, {cosEventApp, []}}, - {runtime_dependencies, ["stdlib-2.0","orber-3.6.27","kernel-3.0","erts-7.0"]} -]}. - - - diff --git a/lib/cosEvent/src/cosEvent.appup.src b/lib/cosEvent/src/cosEvent.appup.src deleted file mode 100644 index d69b2ef20c..0000000000 --- a/lib/cosEvent/src/cosEvent.appup.src +++ /dev/null @@ -1,6 +0,0 @@ -{"%VSN%", - [ - ], - [ - ] -} diff --git a/lib/cosEvent/src/cosEventApp.cfg b/lib/cosEvent/src/cosEventApp.cfg deleted file mode 100644 index bbacd134f7..0000000000 --- a/lib/cosEvent/src/cosEventApp.cfg +++ /dev/null @@ -1,15 +0,0 @@ -{this, "oe_CosEventComm::Event"}. -{from, "oe_CosEventComm::Event"}. -{{handle_info, "oe_CosEventComm::Event"}, true}. -{this, "oe_CosEventComm::Channel"}. -{from, "oe_CosEventComm::Channel"}. -{{handle_info, "oe_CosEventComm::Channel"}, true}. -{this, "oe_CosEventComm::CAdmin"}. -{from, "oe_CosEventComm::CAdmin"}. -{{handle_info, "oe_CosEventComm::CAdmin"}, true}. -{this, "oe_CosEventComm::PullerS"}. -{from, "oe_CosEventComm::PullerS"}. -{{handle_info, "oe_CosEventComm::PullerS"}, true}. -{this, "oe_CosEventComm::PusherS"}. -{from, "oe_CosEventComm::PusherS"}. -{{handle_info, "oe_CosEventComm::PusherS"}, true}. diff --git a/lib/cosEvent/src/cosEventApp.erl b/lib/cosEvent/src/cosEventApp.erl deleted file mode 100644 index b3c38cef0e..0000000000 --- a/lib/cosEvent/src/cosEventApp.erl +++ /dev/null @@ -1,301 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : cosEventApp.erl -%% Description : -%% -%%---------------------------------------------------------------------- --module(cosEventApp). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include("cosEventApp.hrl"). - - -%%--------------- EXPORTS------------------------------------- -%% cosEvent API external --export([start/0, stop/0, install/0, uninstall/0, start_channel/0, start_channel/1, - start_channel_link/0, start_channel_link/1, stop_channel/1]). - -%% cosEvent API internal --export([create_link/3, get_option/2, type_check/3, disconnect/3, do_disconnect/3]). - -%% Application callbacks --export([start/2, init/1, stop/1]). - -%%--------------- DEFINES ------------------------------------ --define(IDL_MODULES, ['oe_CosEventComm', - 'oe_CosEventChannelAdmin', - 'oe_cosEventApp']). - --define(SUPERVISOR_NAME, oe_cosEventSup). --define(SUP_FLAG, {simple_one_for_one,50,10}). - --define(SUP_SPEC(Name, Args), - ['CosEventChannel_EventChannel',Args, - [{sup_child, true}, {regname, {global, Name}}]]). --define(SUP_CHILD, - {"oe_EventChild", - {cosEventApp,create_link, []}, - transient,100000,worker, - ['CosEventChannel_EventChannel']}). - - -%%-----------------------------------------------------------% -%% function : install -%% Arguments: - -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Install necessary data in the IFR DB -%%------------------------------------------------------------ -install() -> - case install_loop(?IDL_MODULES, []) of - ok -> - ok; - {error, Reason} -> - exit(Reason) - end. - -install_loop([], _) -> - ok; -install_loop([H|T], Accum) -> - case catch H:'oe_register'() of - {'EXIT',{unregistered,App}} -> - ?write_ErrorMsg("Unable to register '~p'; application ~p not registered.\n" - "Trying to unregister ~p~n", [H,App,Accum]), - uninstall_loop(Accum, {exit, register}); - {'EXCEPTION',_} -> - ?write_ErrorMsg("Unable to register '~p'; propably already registered.\n" - "You are adviced to confirm this.\n" - "Trying to unregister ~p~n", [H,Accum]), - uninstall_loop(Accum, {exit, register}); - ok -> - install_loop(T, [H|Accum]); - _ -> - ?write_ErrorMsg("Unable to register '~p'; reason unknown.\n" - "Trying to unregister ~p~n", [H,Accum]), - uninstall_loop(Accum, {exit, register}) - end. - -%%-----------------------------------------------------------% -%% function : uninstall -%% Arguments: - -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Remove data related to cosEvent from the IFR DB -%%------------------------------------------------------------ -uninstall() -> - case uninstall_loop(lists:reverse(?IDL_MODULES), ok) of - ok -> - ok; - {error, Reason} -> - exit(Reason) - end. - -uninstall_loop([],ok) -> - ok; -uninstall_loop([],{exit, register}) -> - {error, {?MODULE, "oe_register failed"}}; -uninstall_loop([],{exit, unregister}) -> - {error, {?MODULE, "oe_unregister failed"}}; -uninstall_loop([],{exit, both}) -> - {error, {?MODULE, "oe_register and, for some of those already registered, oe_unregister failed"}}; -uninstall_loop([H|T], Status) -> - case catch H:'oe_unregister'() of - ok -> - uninstall_loop(T, Status); - _ when Status == ok -> - ?write_ErrorMsg("Unable to unregister '~p'; propably already unregistered.\n" - "You are adviced to confirm this.\n",[H]), - uninstall_loop(T, {exit, unregister}); - _ -> - ?write_ErrorMsg("Unable to unregister '~p'; propably already unregistered.\n" - "You are adviced to confirm this.\n",[H]), - uninstall_loop(T, {exit, both}) - end. - -%%-----------------------------------------------------------% -%% function : start/stop -%% Arguments: -%% Returns : -%% Effect : Starts or stops the cosTime application. -%%------------------------------------------------------------ - -start() -> - application:start(cosEvent). -stop() -> - application:stop(cosEvent). - -%%-----------------------------------------------------------% -%% function : start -%% Arguments: Type - see module application -%% Arg - see module application -%% Returns : -%% Effect : Module callback for application -%%------------------------------------------------------------ - -start(_, _) -> - supervisor:start_link({local, ?SUPERVISOR_NAME}, cosEventApp, app_init). - - -%%-----------------------------------------------------------% -%% function : stop -%% Arguments: Arg - see module application -%% Returns : -%% Effect : Module callback for application -%%------------------------------------------------------------ - -stop(_) -> - ok. - -%%-----------------------------------------------------------% -%% function : start_channel -%% Arguments: - -%% Returns : -%% Effect : -%%------------------------------------------------------------ -start_channel() -> - start_channel(?DEFAULT_OPTIONS). - -start_channel(Options) when is_list(Options) -> - ServerOpts = get_option(?SERVER, Options), - 'oe_CosEventComm_Channel':oe_create([Options, ServerOpts], ServerOpts); -start_channel(Options) -> - orber:dbg("[~p] cosEventApp:start_channel(~p);~n" - "Options not correct.", [?LINE, Options], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%-----------------------------------------------------------% -%% function : start_channel -%% Arguments: - -%% Returns : -%% Effect : -%%------------------------------------------------------------ -start_channel_link() -> - start_channel_link(?DEFAULT_OPTIONS). - -start_channel_link(Options) when is_list(Options) -> - ServerOpts = get_option(?SERVER, Options), - 'oe_CosEventComm_Channel':oe_create_link([Options, ServerOpts], ServerOpts); -start_channel_link(Options) -> - orber:dbg("[~p] cosEventApp:start_channel_link(~p);~n" - "Options not correct.", [?LINE, Options], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%-----------------------------------------------------------% -%% function : stop_factory -%% Arguments: ChannelObj -%% Returns : -%% Effect : -%%------------------------------------------------------------ -stop_channel(ChannelObj) -> - corba:dispose(ChannelObj). - -%%-----------------------------------------------------------% -%% function : init -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ - -%% Starting using create_factory/X -init(own_init) -> - {ok,{?SUP_FLAG, [?SUP_CHILD]}}; -%% When starting as an application. -init(app_init) -> - {ok,{?SUP_FLAG, [?SUP_CHILD]}}. - -%%-----------------------------------------------------------% -%% function : create_link -%% Arguments: Module - which Module to call -%% Env/ArgList - ordinary oe_create arguments. -%% Returns : -%% Exception: -%% Effect : Necessary since we want the supervisor to be a -%% 'simple_one_for_one'. Otherwise, using for example, -%% 'one_for_one', we have to call supervisor:delete_child -%% to remove the childs startspecification from the -%% supervisors internal state. -%%------------------------------------------------------------ -create_link(Module, Env, ArgList) -> - Module:oe_create_link(Env, ArgList). - - -%%-----------------------------------------------------------% -%% function : get_option -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -get_option(Key, OptionList) -> - case lists:keysearch(Key, 1, OptionList) of - {value,{Key,Value}} -> - Value; - _ -> - case lists:keysearch(Key, 1, ?DEFAULT_OPTIONS) of - {value,{Key,Value}} -> - Value; - _-> - {error, "Invalid option"} - end - end. - -%%-----------------------------------------------------------% -%% function : type_check -%% Arguments: Obj - objectrefernce to test. -%% Mod - Module which contains typeID/0. -%% Returns : 'ok' or raises exception. -%% Effect : -%%------------------------------------------------------------ -type_check(_Obj, _Mod, false) -> - ok; -type_check(Obj, Mod, _) -> - case catch corba_object:is_a(Obj, Mod:typeID()) of - true -> - ok; - _ -> - orber:dbg("[~p] cosEventApp:type_check(~p) failed; Should be ~p", - [?LINE, Obj, Mod], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end. - -%%-----------------------------------------------------------% -%% function : disconnect -%% Arguments: Module - one of the interfaces defined in CosEventComm. -%% Function - the appropriate disconnect function. -%% Object - the client object reference. -%% Returns : ok -%% Exception: -%% Effect : If the process would try to diconnect itself it could -%% result in a deadlock. Hence, we spawn a new process to do it. -%%------------------------------------------------------------ -disconnect(Module, Function, Object) -> - spawn(cosEventApp, do_disconnect, [Module, Function, Object]), - ok. - -do_disconnect(Module, Function, Object) -> - catch Module:Function(Object), - ?DBG("Disconnect ~p:~p(..).~n", [Module, Function]), - ok. - -%%--------------- END OF MODULE ------------------------------ - - diff --git a/lib/cosEvent/src/cosEventApp.hrl b/lib/cosEvent/src/cosEventApp.hrl deleted file mode 100644 index d801e83530..0000000000 --- a/lib/cosEvent/src/cosEventApp.hrl +++ /dev/null @@ -1,63 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : cosEventApp.hrl -%% Description : -%% -%%---------------------------------------------------------------------- - -%%--------------- INCLUDES ----------------------------------- -%% External --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). - --define(write_ErrorMsg(Txt, Arg), -error_logger:error_msg("================ CosEvent =================~n" - Txt - "===========================================~n", - Arg)). - - --define(PULL_INTERVAL, pull_interval). --define(TYPECHECK, typecheck). --define(MAXEVENTS, maxEvents). --define(BLOCKING, blocking). --define(SERVER, server_options). --define(DEFAULT_OPTIONS, [{?PULL_INTERVAL, 20}, - {?BLOCKING, true}, - {?TYPECHECK, false}, - {?MAXEVENTS, 300}, - {?SERVER, []}]). - --define(DEBUG_LEVEL, 3). - --ifdef(debug). --define(DBG(F,A), - io:format("[~p (~p)] "++F,[?MODULE, ?LINE]++A)). --else. --define(DBG(F,A), ok). --endif. - - - - -%%--------------- END OF MODULE ---------------------------------------- diff --git a/lib/cosEvent/src/cosEventApp.idl b/lib/cosEvent/src/cosEventApp.idl deleted file mode 100644 index e5a134685f..0000000000 --- a/lib/cosEvent/src/cosEventApp.idl +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _COS_EVENT_APP_IDL_ -#define _COS_EVENT_APP_IDL_ - -#include - - -module oe_CosEventComm { - - - interface Event { - oneway void send(in any event); - void send_sync(in any event); - }; - - interface Channel : CosEventChannelAdmin::EventChannel, Event {}; - - interface CAdmin : CosEventChannelAdmin::ConsumerAdmin, Event {}; - - interface PullerS : CosEventChannelAdmin::ProxyPullSupplier, Event {}; - - interface PusherS : CosEventChannelAdmin::ProxyPushSupplier, Event {}; - -}; - - -#endif diff --git a/lib/cosEvent/src/oe_CosEventComm_CAdmin_impl.erl b/lib/cosEvent/src/oe_CosEventComm_CAdmin_impl.erl deleted file mode 100644 index 728c4cc5ab..0000000000 --- a/lib/cosEvent/src/oe_CosEventComm_CAdmin_impl.erl +++ /dev/null @@ -1,234 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : oe_CosEventComm_CAdmin_impl.erl -%% Description : -%% -%%---------------------------------------------------------------------- --module(oe_CosEventComm_CAdmin_impl). - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include_lib("orber/include/corba.hrl"). --include("cosEventApp.hrl"). - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- --export([init/1, - terminate/2, - code_change/3, - handle_info/2]). - -%% Exports from "CosEventChannelAdmin::ConsumerAdmin" --export([obtain_push_supplier/3, - obtain_pull_supplier/3]). - - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- -%% Exports from "oe_CosEventComm::Event" --export([send/3, send_sync/4]). - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {channel_pid, typecheck, maxevents, proxies = [], - server_options}). - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- - - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%---------------------------------------------------------------------- -init([ChannelPid, TypeCheck, MaxEvents, ServerOpts]) -> - process_flag(trap_exit, true), - {ok, #state{channel_pid = ChannelPid, typecheck = TypeCheck, - maxevents = MaxEvents, server_options = ServerOpts}}. - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Returns : any (ignored by gen_server) -%% Description: Shutdown the server -%%---------------------------------------------------------------------- -terminate(_Reason, _State) -> - ?DBG("Terminating ~p~n", [_Reason]), - ok. - -%%---------------------------------------------------------------------- -%% Function : code_change/3 -%% Returns : {ok, NewState} -%% Description: Convert process state when code is changed -%%---------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%---------------------------------------------------------------------% -%% function : handle_info -%% Arguments: -%% Returns : {noreply, State} | -%% {stop, Reason, State} -%% Effect : Functions demanded by the gen_server module. -%%---------------------------------------------------------------------- -handle_info({'EXIT', Pid, Reason}, #state{channel_pid = Pid} = State) -> - ?DBG("Parent Channel terminated ~p~n", [Reason]), - orber:dbg("[~p] oe_CosEventComm_PullerS_impl:handle_info(~p);~n" - "My Channel terminated and so will I which will cause" - " my children to do the same thing.", - [?LINE, Reason], ?DEBUG_LEVEL), - {stop, Reason, State}; -handle_info({'EXIT', Pid, _Reason}, #state{proxies = Proxies} = State) -> - %% A child terminated which is normal. Hence, no logging. - ?DBG("Probably a child terminated ~p~n", [_Reason]), - {noreply, State#state{proxies = lists:keydelete(Pid, 2, Proxies)}}; -handle_info(_Info, State) -> - ?DBG("Unknown Info ~p~n", [_Info]), - {noreply, State}. - -%%---------------------------------------------------------------------- -%% Function : obtain_push_supplier -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -obtain_push_supplier(_, _, #state{server_options = ServerOpts} = State) -> - case catch 'oe_CosEventComm_PusherS':oe_create_link([self(), - State#state.typecheck], - [{sup_child, true}|ServerOpts]) of - {ok, Pid, Proxy} -> - ?DBG("Started a new oe_CosEventComm_PusherS.~n", []), - {reply, Proxy, State#state{proxies = [{Proxy, Pid}|State#state.proxies]}}; - Other -> - orber:dbg("[~p] oe_CosEventComm_CAdmin:obtain_push_supplier();~nError: ~p", - [?LINE, Other], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%---------------------------------------------------------------------- -%% Function : obtain_pull_supplier -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -obtain_pull_supplier(_, _, #state{server_options = ServerOpts} = State) -> - case catch 'oe_CosEventComm_PullerS':oe_create_link([self(), - State#state.typecheck, - State#state.maxevents], - [{sup_child, true}|ServerOpts]) of - {ok, Pid, Proxy} -> - ?DBG("Started a new oe_CosEventComm_PullerS.~n", []), - {reply, Proxy, State#state{proxies = [{Proxy, Pid}|State#state.proxies]}}; - Other -> - orber:dbg("[~p] oe_CosEventComm_CAdmin:obtain_pull_supplier();~nError: ~p", - [?LINE, Other], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - - -%%---------------------------------------------------------------------- -%% Function : send -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -send(_, #state{proxies = Proxies} = State, Any) -> - ?DBG("Received Event ~p~n", [Any]), - case send_helper(Proxies, Any, [], false) of - ok -> - ?DBG("Received Event and forwarded it successfully.~n", []), - {noreply, State}; - {error, Dropped} -> - ?DBG("Received Event but forward failed to: ~p~n", [Dropped]), - RemainingProxies = delete_proxies(Dropped, Proxies), - {noreply, State#state{proxies = RemainingProxies}} - end. - -%%---------------------------------------------------------------------- -%% Function : send_sync -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -send_sync(_, OE_From, #state{proxies = Proxies} = State, Any) -> - ?DBG("Received Event ~p~n", [Any]), - corba:reply(OE_From, ok), - case send_helper(Proxies, Any, [], true) of - ok -> - ?DBG("Received Event and forwarded (sync) it successfully.~n", []), - {noreply, State}; - {error, Dropped} -> - ?DBG("Received Event but forward (sync) failed to: ~p~n", [Dropped]), - RemainingProxies = delete_proxies(Dropped, Proxies), - {noreply, State#state{proxies = RemainingProxies}} - end. - - -%%====================================================================== -%% Internal functions -%%====================================================================== -send_helper([], _, [], _) -> - ok; -send_helper([], _, Dropped, _) -> - {error, Dropped}; -send_helper([{ObjRef, Pid}|T], Event, Dropped, false) -> - case catch 'oe_CosEventComm_Event':send(ObjRef, Event) of - ok -> - send_helper(T, Event, Dropped, false); - What -> - orber:dbg("[~p] oe_CosEventComm_CAdmin:send_helper(~p, ~p);~n" - "Bad return value ~p. Closing connection.", - [?LINE, ObjRef, Event, What], ?DEBUG_LEVEL), - send_helper(T, Event, [{ObjRef, Pid}|Dropped], false) - end; -send_helper([{ObjRef, Pid}|T], Event, Dropped, Sync) -> - case catch 'oe_CosEventComm_Event':send_sync(ObjRef, Event) of - ok -> - send_helper(T, Event, Dropped, Sync); - What -> - orber:dbg("[~p] oe_CosEventComm_CAdmin:send_helper(~p, ~p);~n" - "Bad return value ~p. Closing connection.", - [?LINE, ObjRef, Event, What], ?DEBUG_LEVEL), - send_helper(T, Event, [{ObjRef, Pid}|Dropped], Sync) - end. - -delete_proxies([], RemainingProxies) -> - RemainingProxies; -delete_proxies([{_,Pid}|T], Proxies) -> - Rest = lists:keydelete(Pid, 2, Proxies), - delete_proxies(T, Rest). - -%%====================================================================== -%% END OF MODULE -%%====================================================================== diff --git a/lib/cosEvent/src/oe_CosEventComm_Channel_impl.erl b/lib/cosEvent/src/oe_CosEventComm_Channel_impl.erl deleted file mode 100644 index 4f53ca6164..0000000000 --- a/lib/cosEvent/src/oe_CosEventComm_Channel_impl.erl +++ /dev/null @@ -1,247 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : oe_CosEventComm_Channel_impl.erl -%% Description : -%% -%%---------------------------------------------------------------------- --module(oe_CosEventComm_Channel_impl). - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include_lib("orber/include/corba.hrl"). --include("cosEventApp.hrl"). - - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- -%% Mandatory --export([init/1, - terminate/2, - code_change/3, - handle_info/2]). - -%% Exports from "CosEventChannelAdmin::EventChannel" --export([for_consumers/3, - for_suppliers/3, - destroy/3]). - - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- -%% Exports from "oe_CosEventComm::Event" --export([send/3, send_sync/4]). - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {typecheck, pull_interval, maxevents, blocking, cadmins = [], - server_options}). - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%---------------------------------------------------------------------- -init([Options, ServerOpts]) -> - process_flag(trap_exit, true), - PullI = cosEventApp:get_option(?PULL_INTERVAL, Options), - TC = cosEventApp:get_option(?TYPECHECK, Options), - Max = cosEventApp:get_option(?MAXEVENTS, Options), - Blocking = cosEventApp:get_option(?BLOCKING, Options), - {ok, #state{typecheck = TC, pull_interval = PullI, maxevents = Max, - blocking = Blocking, server_options = ServerOpts}}. - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Returns : any (ignored by gen_server) -%% Description: Shutdown the server -%%---------------------------------------------------------------------- -terminate(_Reason, _State) -> - ?DBG("Terminating ~p~n", [_Reason]), - ok. - -%%---------------------------------------------------------------------- -%% Function : code_change/3 -%% Returns : {ok, NewState} -%% Description: Convert process state when code is changed -%%---------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%---------------------------------------------------------------------% -%% function : handle_info -%% Arguments: -%% Returns : {noreply, State} | -%% {stop, Reason, State} -%% Effect : Functions demanded by the gen_server module. -%%---------------------------------------------------------------------- -handle_info({'EXIT', Pid, _Reason}, #state{cadmins = CAdmins} = State) -> - ?DBG("Probably a child terminated with Reason: ~p~n", [_Reason]), - {noreply, State#state{cadmins = lists:keydelete(Pid, 2, CAdmins)}}; -handle_info(_Info, State) -> - ?DBG("Unknown Info ~p~n", [_Info]), - {noreply, State}. - - -%%---------------------------------------------------------------------- -%% Function : for_consumers -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -for_consumers(_, _, #state{server_options = ServerOpts} = State) -> - case catch 'oe_CosEventComm_CAdmin':oe_create_link([self(), - State#state.typecheck, - State#state.maxevents, - ServerOpts], - [{sup_child, true}|ServerOpts]) of - {ok, Pid, AdminCo} -> - ?DBG("Created a new oe_CosEventComm_CAdmin.~n", []), - {reply, AdminCo, - State#state{cadmins = [{AdminCo, Pid}|State#state.cadmins]}}; - Other -> - orber:dbg("[~p] oe_CosEventComm_Channel:for_consumers(); Error: ~p", - [?LINE, Other], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%---------------------------------------------------------------------- -%% Function : for_suppliers -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -for_suppliers(OE_This, _, #state{server_options = ServerOpts} = State) -> - case catch 'CosEventChannelAdmin_SupplierAdmin':oe_create_link([OE_This, self(), - State#state.typecheck, - State#state.pull_interval, - ServerOpts], - [{sup_child, true}|ServerOpts]) of - {ok, _Pid, AdminSu} -> - ?DBG("Created a new CosEventChannelAdmin_SupplierAdmin.~n", []), - {reply, AdminSu, State}; - Other -> - orber:dbg("[~p] oe_CosEventComm_Channel:for_suppliers();~nError: ~p", - [?LINE, Other], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%---------------------------------------------------------------------- -%% Function : destroy -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -destroy(_, _, State) -> - ?DBG("Destroy invoked.", []), - {stop, normal, ok, State}. - -%%---------------------------------------------------------------------- -%% Function : send -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -send(_OE_This, #state{cadmins = CAdmins} = State, Any) -> - ?DBG("Received Event ~p~n", [Any]), - case send_helper(CAdmins, Any, [], false) of - ok -> - ?DBG("Received Event and forwarded it successfully.~n", []), - {noreply, State}; - {error, Dropped} -> - ?DBG("Received Event but forward failed for: ~p~n", [Dropped]), - RemainingAdmins = delete_cadmin(Dropped, CAdmins), - {noreply, State#state{cadmins = RemainingAdmins}} - end. - -%%---------------------------------------------------------------------- -%% Function : send_sync -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -send_sync(_OE_This, OE_From, #state{cadmins = CAdmins, blocking = BL} = State, Any) -> - ?DBG("Received Event ~p~n", [Any]), - corba:reply(OE_From, ok), - case send_helper(CAdmins, Any, [], BL) of - ok -> - ?DBG("Received Event and forwarded (sync) it successfully.~n", []), - {reply, ok, State}; - {error, Dropped} -> - ?DBG("Received Event but forward (sync) failed for: ~p~n", [Dropped]), - RemainingAdmins = delete_cadmin(Dropped, CAdmins), - {reply, ok, State#state{cadmins = RemainingAdmins}} - end. - - -%%====================================================================== -%% Internal functions -%%====================================================================== -send_helper([], _, [], _) -> - ok; -send_helper([], _, Dropped, _) -> - {error, Dropped}; -send_helper([{ObjRef, Pid}|T], Event, Dropped, false) -> - case catch 'oe_CosEventComm_CAdmin':send(ObjRef, Event) of - ok -> - send_helper(T, Event, Dropped, false); - What -> - orber:dbg("[~p] oe_CosEventComm_Channel:send_helper(~p, ~p);~n" - "Bad return value ~p. Closing connection.", - [?LINE, ObjRef, Event, What], ?DEBUG_LEVEL), - send_helper(T, Event, [{ObjRef, Pid}|Dropped], false) - end; -send_helper([{ObjRef, Pid}|T], Event, Dropped, Sync) -> - case catch 'oe_CosEventComm_CAdmin':send_sync(ObjRef, Event) of - ok -> - send_helper(T, Event, Dropped, Sync); - What -> - orber:dbg("[~p] oe_CosEventComm_Channel:send_helper(~p, ~p);~n" - "Bad return value ~p. Closing connection.", - [?LINE, ObjRef, Event, What], ?DEBUG_LEVEL), - send_helper(T, Event, [{ObjRef, Pid}|Dropped], Sync) - end. - - -delete_cadmin([], RemainingAdmins) -> - RemainingAdmins; -delete_cadmin([{_,Pid}|T], CAdmins) -> - Rest = lists:keydelete(Pid, 2, CAdmins), - delete_cadmin(T, Rest). - -%%====================================================================== -%% END OF MODULE -%%====================================================================== diff --git a/lib/cosEvent/src/oe_CosEventComm_PullerS_impl.erl b/lib/cosEvent/src/oe_CosEventComm_PullerS_impl.erl deleted file mode 100644 index b431296624..0000000000 --- a/lib/cosEvent/src/oe_CosEventComm_PullerS_impl.erl +++ /dev/null @@ -1,282 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : oe_CosEventComm_PullerS_impl.erl -%% Description : -%% -%%---------------------------------------------------------------------- --module(oe_CosEventComm_PullerS_impl). - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include_lib("orber/include/corba.hrl"). --include("CosEventChannelAdmin.hrl"). --include("CosEventComm.hrl"). --include("cosEventApp.hrl"). - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- --export([init/1, - terminate/2, - code_change/3, - handle_info/2]). -%% Exports from "CosEventChannelAdmin::ProxyPullSupplier" --export([connect_pull_consumer/4]). - -%% Exports from "CosEventComm::PullSupplier" --export([pull/3, - try_pull/3, - disconnect_pull_supplier/3]). - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- -%% Exports from "oe_CosEventComm::Event --export([send/3, send_sync/4]). - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {admin_pid, client, db, respond_to, typecheck, maxevents}). - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------% -%% Function : init/1 -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%---------------------------------------------------------------------- -init([AdminPid, TypeCheck, MaxEvents]) -> - process_flag(trap_exit, true), - {ok, #state{admin_pid = AdminPid, - db = ets:new(oe_ets, [set, private, ordered_set]), - typecheck = TypeCheck, maxevents = MaxEvents}}. - -%%---------------------------------------------------------------------% -%% function : handle_info -%% Arguments: -%% Returns : {noreply, State} | -%% {stop, Reason, State} -%% Effect : Functions demanded by the gen_server module. -%% The CosEvent specification states: -%% "A nil object reference may be passed to the connect_pull_consumer operation; -%% if so a channel cannot invoke a disconnect_pull_consumer operation on the -%% consumer; the consumer may be disconnected from the channel without being -%% informed." -%% If we would invoke the disconnect_pull_consumer operation -%% at the same time as the client tries to pull an event it -%% would cause a dead-lock. We can solve this by spawning a process -%% but as is the client will discover that the object no longer exists -%% the next time it tries to pull an event. -%%---------------------------------------------------------------------- -handle_info({'EXIT', Pid, Reason}, #state{admin_pid = Pid} = State) -> - orber:dbg("[~p] oe_CosEventComm_PullerS_impl:handle_info(~p);~n" - "My Admin terminated and so will I.", - [?LINE, Reason], ?DEBUG_LEVEL), - {stop, Reason, State}; -handle_info(_Info, State) -> - ?DBG("Unknown Info ~p~n", [_Info]), - {noreply, State}. - -%%---------------------------------------------------------------------% -%% Function : terminate/2 -%% Returns : any (ignored by gen_server) -%% Description: Shutdown the server -%%---------------------------------------------------------------------- -terminate(_Reason, #state{client = undefined, respond_to = undefined, db = DB}) -> - ?DBG("Terminating ~p; no client connected and no pending pull's.~n", [_Reason]), - ets:delete(DB), - ok; -terminate(_Reason, #state{client = undefined, respond_to = ReplyTo, db = DB}) -> - ?DBG("Terminating ~p; no client connected but a pending pull.~n", [_Reason]), - corba:reply(ReplyTo, {'EXCEPTION', #'CosEventComm_Disconnected'{}}), - ets:delete(DB), - ok; -terminate(_Reason, #state{client = Client, respond_to = undefined, db = DB}) -> - ?DBG("Terminating ~p; no pending pull~n", [_Reason]), - cosEventApp:disconnect('CosEventComm_PullConsumer', - disconnect_pull_consumer, Client), - ets:delete(DB), - ok; -terminate(_Reason, #state{client = Client, respond_to = ReplyTo, db = DB}) -> - ?DBG("Terminating ~p; pending pull~n", [_Reason]), - corba:reply(ReplyTo, {'EXCEPTION', #'CosEventComm_Disconnected'{}}), - cosEventApp:disconnect('CosEventComm_PullConsumer', - disconnect_pull_consumer, Client), - ets:delete(DB), - ok. - -%%---------------------------------------------------------------------% -%% Function : code_change/3 -%% Returns : {ok, NewState} -%% Description: Convert process state when code is changed -%%---------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_pull_consumer -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -connect_pull_consumer(_OE_This, _OE_From, #state{client = undefined, - typecheck = TypeCheck} = State, - NewClient) -> - case corba_object:is_nil(NewClient) of - true -> - ?DBG("A NIL client supplied.~n", []), - {reply, ok, State}; - false -> - cosEventApp:type_check(NewClient, 'CosEventComm_PullConsumer', TypeCheck), - ?DBG("Connected to client.~n", []), - {reply, ok, State#state{client = NewClient}} - end; -connect_pull_consumer(_, _, _, _) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}). - - -%%---------------------------------------------------------------------% -%% Function : pull -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -pull(_OE_This, OE_From, State) -> - case get_event(State#state.db) of - false -> - ?DBG("pull invoked but no event stored; put the client on hold.~n", []), - {noreply, State#state{respond_to = OE_From}}; - Event -> - ?DBG("pull invoked and returned: ~p~n", [Event]), - {reply, Event, State} - end. - -%%---------------------------------------------------------------------% -%% Function : try_pull -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -try_pull(_OE_This, _OE_From, State) -> - case get_event(State#state.db) of - false -> - ?DBG("try_pull invoked but no event stored.~n", []), - {reply, {any:create(orber_tc:long(), 0), false}, State}; - Event -> - ?DBG("try_pull invoked and returned: ~p~n", [Event]), - {reply, {Event, true}, State} - end. - -%%---------------------------------------------------------------------% -%% Function : disconnect_pull_supplier -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -disconnect_pull_supplier(_OE_This, _OE_From, State) -> - ?DBG("Disconnect invoked ~p ~n", [State]), - {stop, normal, ok, State#state{client = undefined}}. - - -%%====================================================================== -%% Internal functions -%%====================================================================== -%%---------------------------------------------------------------------% -%% Function : send -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -send(_OE_This, #state{respond_to = undefined} = State, Any) -> - ?DBG("Received event ~p and stored it.~n", [Any]), - store_event(State#state.db, State#state.maxevents, Any), - {noreply, State}; -send(_OE_This, State, Any) -> - ?DBG("Received event ~p and sent it to pending client.~n", [Any]), - corba:reply(State#state.respond_to, Any), - {noreply, State#state{respond_to = undefined}}. - -%%---------------------------------------------------------------------% -%% Function : send_sync -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -send_sync(_OE_This, _OE_From, #state{respond_to = undefined} = State, Any) -> - ?DBG("Received event ~p and stored it (sync).~n", [Any]), - store_event(State#state.db, State#state.maxevents, Any), - {reply, ok, State}; -send_sync(_OE_This, _OE_From, State, Any) -> - ?DBG("Received event ~p and sent it to pending client (sync).~n", [Any]), - corba:reply(State#state.respond_to, Any), - {reply, ok, State#state{respond_to = undefined}}. - - -%%---------------------------------------------------------------------% -%% Function : store_event -%% Arguments : DB - ets reference -%% Event - CORBA::Any -%% Returns : true -%% Description: Insert the event in FIFO order. -%%---------------------------------------------------------------------- -store_event(DB, Max, Event) -> - case ets:info(DB, size) of - CurrentSize when CurrentSize < Max -> - ets:insert(DB, {{erlang:system_time(), erlang:unique_integer([positive])}, - Event}); - _ -> - orber:dbg("[~p] oe_CosEventComm_PullerS:store_event(~p); DB full drop event.", - [?LINE, Event], ?DEBUG_LEVEL), - true - end. - -%%---------------------------------------------------------------------% -%% Function : get_event -%% Arguments : DB - ets reference -%% Event - CORBA::Any -%% Returns : false | Event (CORBA::Any) -%% Description: Lookup event in FIFO order; return false if no event exists. -%%---------------------------------------------------------------------- -get_event(DB) -> - case ets:first(DB) of - '$end_of_table' -> - false; - Key -> - [{_, Event}] = ets:lookup(DB, Key), - ets:delete(DB, Key), - Event - end. - -%%====================================================================== -%% END OF MODULE -%%====================================================================== diff --git a/lib/cosEvent/src/oe_CosEventComm_PusherS_impl.erl b/lib/cosEvent/src/oe_CosEventComm_PusherS_impl.erl deleted file mode 100644 index ac23412000..0000000000 --- a/lib/cosEvent/src/oe_CosEventComm_PusherS_impl.erl +++ /dev/null @@ -1,218 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : oe_CosEventComm_PusherS_impl.erl -%% Description : -%% -%%---------------------------------------------------------------------- --module(oe_CosEventComm_PusherS_impl). - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include_lib("orber/include/corba.hrl"). --include("CosEventChannelAdmin.hrl"). --include("CosEventComm.hrl"). --include("cosEventApp.hrl"). - - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- --export([init/1, - terminate/2, - code_change/3, - handle_info/2]). - -%% Exports from "CosEventChannelAdmin::ProxyPushSupplier" --export([connect_push_consumer/4]). - -%% Exports from "CosEventComm::PushSupplier" --export([disconnect_push_supplier/3]). - - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- -%% Exports from "oe_CosEventComm::Event" --export([send/3, send_sync/4]). - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {admin_pid, client, typecheck}). - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%---------------------------------------------------------------------- -init([AdminPid, TypeCheck]) -> - process_flag(trap_exit, true), - {ok, #state{admin_pid = AdminPid, typecheck = TypeCheck}}. - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Returns : any (ignored by gen_server) -%% Description: Shutdown the server -%%---------------------------------------------------------------------- -terminate(_Reason, #state{client = undefined}) -> - ?DBG("Terminating ~p; no client connected.~n", [_Reason]), - ok; -terminate(_Reason, #state{client = Client} = _State) -> - ?DBG("Terminating ~p~n", [_Reason]), - cosEventApp:disconnect('CosEventComm_PushConsumer', - disconnect_push_consumer, Client), - ok. - -%%---------------------------------------------------------------------- -%% Function : code_change/3 -%% Returns : {ok, NewState} -%% Description: Convert process state when code is changed -%%---------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%---------------------------------------------------------------------% -%% function : handle_info -%% Arguments: -%% Returns : {noreply, State} | -%% {stop, Reason, State} -%% Effect : Functions demanded by the gen_server module. -%%---------------------------------------------------------------------- -handle_info({'EXIT', Pid, Reason}, #state{admin_pid = Pid} = State) -> - ?DBG("Parent Admin terminated ~p~n", [Reason]), - orber:dbg("[~p] oe_CosEventComm_PusherS_impl:handle_info(~p);~n" - "My Admin terminated and so will I.", - [?LINE, Reason], ?DEBUG_LEVEL), - {stop, Reason, State}; -handle_info(_Info, State) -> - ?DBG("Unknown Info ~p~n", [_Info]), - {noreply, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_push_consumer -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -connect_push_consumer(_OE_This, _, #state{client = undefined, - typecheck = TypeCheck} = State, NewClient) -> - case corba_object:is_nil(NewClient) of - true -> - orber:dbg("[~p] oe_CosEventComm_PusherS_impl:connect_push_consumer(..);~n" - "Supplied a NIL reference which is not allowed.", - [?LINE], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status = ?COMPLETED_NO}); - false -> - cosEventApp:type_check(NewClient, 'CosEventComm_PushConsumer', TypeCheck), - ?DBG("Connected to client.~n", []), - {reply, ok, State#state{client = NewClient}} - end; -connect_push_consumer(_, _, _, _) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}). - - -%%---------------------------------------------------------------------% -%% Function : disconnect_push_supplier -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -disconnect_push_supplier(_OE_This, _, State) -> - ?DBG("Disconnect invoked ~p ~n", [State]), - {stop, normal, ok, State#state{client = undefined}}. - -%%====================================================================== -%% Internal functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : send -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -send(_OE_This, #state{client = undefined} = State, _Any) -> - %% No consumer connected. - ?DBG("Received event ~p but have no client.~n", [_Any]), - {noreply, State}; -send(_OE_This, #state{client = Client} = State, Any) -> - %% Push Data - case catch 'CosEventComm_PushConsumer':push(Client, Any) of - ok -> - ?DBG("Received event ~p and delivered it client.~n", [Any]), - {noreply, State}; - {'EXCEPTION', #'CosEventComm_Disconnected'{}} -> - ?DBG("Received event ~p but failed to deliver it since the client claims we are disconnected.~n", [Any]), - {stop, normal, State#state{client = undefined}}; - Other -> - ?DBG("Received event ~p but failed to deliver it to client.~n", [Any]), - orber:dbg("[~p] oe_CosEventComm_PusherS_impl:send(~p);~n" - "My Client behaves badly, returned ~p, so I will terminate.", - [?LINE, Any, Other], ?DEBUG_LEVEL), - {stop, normal, State} - end. - - -%%---------------------------------------------------------------------- -%% Function : send_sync -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -send_sync(_OE_This, _OE_From, #state{client = undefined} = State, _Any) -> - %% No consumer connected. - ?DBG("Received event ~p but have no client.~n", [_Any]), - {reply, ok, State}; -send_sync(_OE_This, OE_From, #state{client = Client} = State, Any) -> - corba:reply(OE_From, ok), - %% Push Data - case catch 'CosEventComm_PushConsumer':push(Client, Any) of - ok -> - ?DBG("Received event ~p and delivered (sync) it client.~n", [Any]), - {noreply, State}; - {'EXCEPTION', #'CosEventComm_Disconnected'{}} -> - ?DBG("Received event ~p but failed to deliver (sync) it since the client claims we are disconnected.~n", [Any]), - {stop, normal, State#state{client = undefined}}; - Other -> - ?DBG("Received event ~p but failed to deliver (sync) it to client.~n", [Any]), - orber:dbg("[~p] oe_CosEventComm_PusherS_impl:send_sync(~p);~n" - "My Client behaves badly, returned ~p, so I will terminate.", - [?LINE, Any, Other], ?DEBUG_LEVEL), - {stop, normal, State} - end. - - -%%====================================================================== -%% END OF MODULE -%%====================================================================== - diff --git a/lib/cosEvent/test/Makefile b/lib/cosEvent/test/Makefile deleted file mode 100644 index 878e1c8a4c..0000000000 --- a/lib/cosEvent/test/Makefile +++ /dev/null @@ -1,150 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSEVENT_VSN) -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/cosEvent_test - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -TEST_SPEC_FILE = cosEvent.spec -COVER_FILE = cosEvent.cover - - -IDL_FILES = \ - event_test_server.idl \ - -IDLOUTDIR = idl_output - -MODULES = \ - event_test_PushC_impl \ - event_test_PullC_impl \ - event_test_PushS_impl \ - event_test_PullS_impl \ - event_channel_SUITE \ - generated_SUITE - -GEN_MOD_COS = \ - event_test_PullC \ - event_test_PushS \ - event_test_PullS \ - oe_event_test_server \ - event_test_PushC - -GEN_HRL_COS = \ - event_test.hrl \ - event_test_PushC.hrl \ - event_test_PullC.hrl \ - event_test_PushS.hrl \ - event_test_PullS.hrl \ - oe_event_test_server.hrl - - -GEN_MODULES = $(GEN_MOD_COS) - -ERL_FILES = $(MODULES:%=%.erl) - -HRL_FILES = - -GEN_HRL_FILES = $(GEN_HRL_COS) - -GEN_FILES = \ - $(GEN_HRL_FILES:%=$(IDLOUTDIR)/%) \ - $(GEN_MODULES:%=$(IDLOUTDIR)/%.erl) - -GEN_TARGET_FILES = $(GEN_MODULES:%=$(IDLOUTDIR)/%.$(EMULATOR)) - -SUITE_TARGET_FILES = $(MODULES:%=%.$(EMULATOR)) - -TARGET_FILES = \ - $(GEN_TARGET_FILES) \ - $(SUITE_TARGET_FILES) - -# ---------------------------------------------------- -# PROGRAMS -# ---------------------------------------------------- -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/orber/ebin -pa $(ERL_TOP)/lib/ic/ebin - -ERL_COMPILE_FLAGS += $(ERL_IDL_FLAGS) \ - -pa $(ERL_TOP)/lib/cosEvent/ebin \ - -pa $(ERL_TOP)/lib/cosEvent/test/idl_output \ - -I$(ERL_TOP)/lib/cosEvent \ - -I$(ERL_TOP)/lib/cosEvent/test/$(IDLOUTDIR) - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -tests debug opt: $(TARGET_FILES) - -clean: - rm -f idl_output/* - rm -rf java_initial_reference_idl java_cos_naming_idl - rm -rf java_iiop_module_idl java_output/* - rm -f $(TARGET_FILES) - rm -f errs core *~ - - -docs: - -# ---------------------------------------------------- -# Special Targets -# ---------------------------------------------------- - -IDL-GENERATED: event_test_server.idl - erlc $(ERL_IDL_FLAGS) -o$(IDLOUTDIR) event_test_server.idl - >IDL-GENERATED - -$(GEN_FILES): IDL-GENERATED - -$(TARGET_FILES): IDL-GENERATED - -# ---------------------------------------------------- -# Release Targets -# ---------------------------------------------------- -# We don't copy generated intermediate erlang and hrl files - -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: - -release_docs_spec: - -release_tests_spec: tests - $(INSTALL_DIR) "$(RELSYSDIR)" - $(INSTALL_DATA) $(IDL_FILES) $(TEST_SPEC_FILE) \ - $(COVER_FILE) $(ERL_FILES) "$(RELSYSDIR)" - $(INSTALL_DATA) $(SUITE_TARGET_FILES) "$(RELSYSDIR)" - $(INSTALL_DIR) "$(RELSYSDIR)/$(IDLOUTDIR)" - $(INSTALL_DATA) $(GEN_TARGET_FILES) $(GEN_FILES) \ - "$(RELSYSDIR)/$(IDLOUTDIR)" - diff --git a/lib/cosEvent/test/cosEvent.cover b/lib/cosEvent/test/cosEvent.cover deleted file mode 100644 index df12ea3ca9..0000000000 --- a/lib/cosEvent/test/cosEvent.cover +++ /dev/null @@ -1,2 +0,0 @@ -{incl_app,cosEvent,details}. - diff --git a/lib/cosEvent/test/cosEvent.spec b/lib/cosEvent/test/cosEvent.spec deleted file mode 100644 index f793693779..0000000000 --- a/lib/cosEvent/test/cosEvent.spec +++ /dev/null @@ -1 +0,0 @@ -{suites,"../cosEvent_test",all}. diff --git a/lib/cosEvent/test/event_channel_SUITE.erl b/lib/cosEvent/test/event_channel_SUITE.erl deleted file mode 100644 index bbae8d782a..0000000000 --- a/lib/cosEvent/test/event_channel_SUITE.erl +++ /dev/null @@ -1,326 +0,0 @@ -%%----------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- - --module(event_channel_SUITE). - --include_lib("common_test/include/ct.hrl"). --include_lib("orber/include/corba.hrl"). --include_lib("orber/COSS/CosNaming/CosNaming.hrl"). --include_lib("orber/src/orber_iiop.hrl"). - -%%----------------------------------------------------------------- -%% Macros -%%----------------------------------------------------------------- - --define(default_timeout, test_server:minutes(5)). - - --define(match(ExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - io:format("------ CORRECT RESULT ------~n~p~n", - [AcTuAlReS]), - AcTuAlReS; - _ -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS) - end - end()). - - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, - event_objects_api/1, events_api/1, events_sync_api/1, - cases/0, init_per_suite/1, end_per_suite/1, - init_per_testcase/2, end_per_testcase/2, app_test/1]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- - -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - cases(). - -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -cases() -> - [events_api, events_sync_api, event_objects_api, - app_test]. - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- - -init_per_testcase(_Case, Config) -> - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - - -end_per_testcase(_Case, Config) -> - Dog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -init_per_suite(Config) when is_list(Config) -> - Path = code:which(?MODULE), - code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), - mnesia:delete_schema([node()]), - mnesia:create_schema([node()]), - orber:install([node()]), - application:start(mnesia), - application:start(orber), - cosEventApp:install(), - cosEventApp:start(), - oe_event_test_server:oe_register(), - Config. - -end_per_suite(Config) when is_list(Config) -> - oe_event_test_server:oe_unregister(), - cosEventApp:stop(), - cosEventApp:uninstall(), - application:stop(orber), - application:stop(mnesia), - mnesia:delete_schema([node()]), - Path = code:which(?MODULE), - code:del_path(filename:join(filename:dirname(Path), "idl_output")), - Config. - -%%----------------------------------------------------------------- -%% Tests app file -%%----------------------------------------------------------------- -app_test(doc) -> []; -app_test(suite) -> []; -app_test(_Config) -> - ok=test_server:app_test(cosEvent), - ok. - - - -%% Testing the CosEvent API to setup a complete service -event_objects_api(_Config) -> - - Ch = ?match({_,key,_,_,_,_}, cosEventApp:start_channel([{typecheck, true}, - {pull_interval, 300}])), - - AC=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_EventChannel':for_consumers(Ch)), - AS=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_EventChannel':for_suppliers(Ch)), - - PPushS=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_ConsumerAdmin':obtain_push_supplier(AC)), - PPullS=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_ConsumerAdmin':obtain_pull_supplier(AC)), - - PPushC=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_SupplierAdmin':obtain_push_consumer(AS)), - PPullC=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_SupplierAdmin':obtain_pull_consumer(AS)), - - PushC=?match({_,key,_,_,_,_}, - 'event_test_PushC':oe_create([])), - PullC=?match({_,key,_,_,_,_}, - 'event_test_PullC':oe_create(PPullC)), - - PushS=?match({_,key,_,_,_,_}, - 'event_test_PushS':oe_create(PPushC)), - - PullS=?match({_,key,_,_,_,_}, - 'event_test_PullS':oe_create([])), - - NIL = corba:create_nil_objref(), - - ?match({'EXCEPTION',{'BAD_PARAM',_,_,_}}, - 'CosEventChannelAdmin_ProxyPushSupplier':connect_push_consumer(PPushS, NIL)), - ?match({'EXCEPTION',{'BAD_PARAM',_,_,_}}, - 'CosEventChannelAdmin_ProxyPushSupplier':connect_push_consumer(PPushS, PullS)), - ?match(ok, 'CosEventChannelAdmin_ProxyPushSupplier':connect_push_consumer(PPushS, PushC)), - ?match({'EXCEPTION',{'CosEventChannelAdmin_AlreadyConnected',_}}, - 'CosEventChannelAdmin_ProxyPushSupplier':connect_push_consumer(PPushS, PushC)), - - ?match(ok, 'CosEventChannelAdmin_ProxyPullSupplier':connect_pull_consumer(PPullS, NIL)), - ?match({'EXCEPTION',{'BAD_PARAM',_,_,_}}, - 'CosEventChannelAdmin_ProxyPullSupplier':connect_pull_consumer(PPullS, PullS)), - ?match(ok, 'CosEventChannelAdmin_ProxyPullSupplier':connect_pull_consumer(PPullS, PullC)), - ?match({'EXCEPTION',{'CosEventChannelAdmin_AlreadyConnected',_}}, - 'CosEventChannelAdmin_ProxyPullSupplier':connect_pull_consumer(PPullS, PullC)), - - ?match(ok, 'CosEventChannelAdmin_ProxyPushConsumer':connect_push_supplier(PPushC, NIL)), - ?match({'EXCEPTION',{'BAD_PARAM',_,_,_}}, - 'CosEventChannelAdmin_ProxyPushConsumer':connect_push_supplier(PPushC, PullS)), - ?match(ok, 'CosEventChannelAdmin_ProxyPushConsumer':connect_push_supplier(PPushC, PushS)), - ?match({'EXCEPTION',{'CosEventChannelAdmin_AlreadyConnected',_}}, - 'CosEventChannelAdmin_ProxyPushConsumer':connect_push_supplier(PPushC, PushS)), - - ?match({'EXCEPTION',{'BAD_PARAM',_,_,_}}, - 'CosEventChannelAdmin_ProxyPullConsumer':connect_pull_supplier(PPullC, NIL)), - ?match({'EXCEPTION',{'BAD_PARAM',_,_,_}}, - 'CosEventChannelAdmin_ProxyPullConsumer':connect_pull_supplier(PPullC, PushS)), - ?match(ok, 'CosEventChannelAdmin_ProxyPullConsumer':connect_pull_supplier(PPullC, PullS)), - ?match({'EXCEPTION',{'CosEventChannelAdmin_AlreadyConnected',_}}, - 'CosEventChannelAdmin_ProxyPullConsumer':connect_pull_supplier(PPullC, PullS)), - - - catch corba:dispose(AC), - %% Wait a couple of seconds to be sure all data removed from DB. - timer:sleep(2000), - - %% Since we terminated ConsumerAdmin only the Supplier Proxies should be terminated. - ?match(true, corba_object:non_existent(AC)), - ?match(true, corba_object:non_existent(PPushS)), - ?match(true, corba_object:non_existent(PPullS)), - - ?match(false, corba_object:non_existent(Ch)), - ?match(false, corba_object:non_existent(AS)), - ?match(false, corba_object:non_existent(PPullC)), - ?match(false, corba_object:non_existent(PPushC)), - - %% Terminate a proxy and check that its admin is unaffected. - catch corba:dispose(PPullC), - timer:sleep(2000), - ?match(false, corba_object:non_existent(AS)), - ?match(true, corba_object:non_existent(PPullC)), - - catch corba:dispose(Ch), - timer:sleep(2000), - - ?match(true, corba_object:non_existent(Ch)), - ?match(true, corba_object:non_existent(AS)), - ?match(true, corba_object:non_existent(PPullC)), - ?match(true, corba_object:non_existent(PPushC)), - - %% The client should be notified; wait for a couple of seconds and check it. - timer:sleep(2000), - ?match(true, corba_object:non_existent(PushC)), - ?match(true, corba_object:non_existent(PullC)), - ?match(true, corba_object:non_existent(PushS)), - ?match(true, corba_object:non_existent(PullS)), - - ok. - -%% Testing the CosEvent API for sending events asynchronous -events_api(_Config) -> - - Ch = ?match({_,key,_,_,_,_}, cosEventApp:start_channel([{typecheck, true}, - {pull_interval, 2}, - {blocking, false}])), - event_sender(Ch). - - -%% Testing the CosEvent API for sending events synchronous -events_sync_api(_Config) -> - - Ch = ?match({_,key,_,_,_,_}, cosEventApp:start_channel([{typecheck, true}, - {pull_interval, 2}, - {blocking, true}])), - event_sender(Ch). - -event_sender(Ch) -> - Event1 = #any{typecode=tk_long, value = 1}, - Event2 = #any{typecode=tk_long, value = 2}, - Event3 = #any{typecode=tk_long, value = 3}, - Event4 = #any{typecode=tk_long, value = 4}, - Event5 = #any{typecode=tk_long, value = 5}, - Event6 = #any{typecode=tk_long, value = 6}, - - AC=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_EventChannel':for_consumers(Ch)), - AS=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_EventChannel':for_suppliers(Ch)), - - PPushS=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_ConsumerAdmin':obtain_push_supplier(AC)), - PPullS=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_ConsumerAdmin':obtain_pull_supplier(AC)), - - PPushC=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_SupplierAdmin':obtain_push_consumer(AS)), - PPullC=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_SupplierAdmin':obtain_pull_consumer(AS)), - - PushC=?match({_,key,_,_,_,_}, 'event_test_PushC':oe_create([])), - PullC=?match({_,key,_,_,_,_}, 'event_test_PullC':oe_create(PPullS)), - - PushS=?match({_,key,_,_,_,_}, 'event_test_PushS':oe_create(PPushC)), - - PullS=?match({_,key,_,_,_,_}, 'event_test_PullS':oe_create([])), - - ?match(ok, 'CosEventChannelAdmin_ProxyPushSupplier':connect_push_consumer(PPushS, PushC)), - ?match(ok, 'CosEventChannelAdmin_ProxyPullSupplier':connect_pull_consumer(PPullS, PullC)), - ?match(ok, 'CosEventChannelAdmin_ProxyPushConsumer':connect_push_supplier(PPushC, PushS)), - ?match(ok, 'CosEventChannelAdmin_ProxyPullConsumer':connect_pull_supplier(PPullC, PullS)), - - %% No events should be available at the consumer side at this point. - ?match({_, false}, event_test_PullC:do_try_pull(PullC)), - ?match([], event_test_PushC:get_data(PushC)), - - %% Push an event and wait to be sure it have reached the destination. - ?match(ok, event_test_PushS:do_push(PushS, Event1)), - ?match(ok, event_test_PushS:do_push(PushS, Event2)), - ?match(ok, event_test_PushS:do_push(PushS, Event3)), - timer:sleep(2000), - ?match({Event1, true}, event_test_PullC:do_try_pull(PullC)), - ?match({Event2, true}, event_test_PullC:do_try_pull(PullC)), - ?match({Event3, true}, event_test_PullC:do_try_pull(PullC)), - ?match({_, false}, event_test_PullC:do_try_pull(PullC)), - ?match([Event1, Event2, Event3], event_test_PushC:get_data(PushC)), - - ?match(ok, event_test_PullS:add_event(PullS, Event4)), - ?match(ok, event_test_PullS:add_event(PullS, Event5)), - ?match(ok, event_test_PullS:add_event(PullS, Event6)), - - %% Since the pull operation is blocking we do not need to "sleep". - %% The ProxyPullConsumer will pull for events according to the pull_interval - %% parameter given when started the channel. - ?match(Event4, event_test_PullC:do_pull(PullC)), - ?match(Event5, event_test_PullC:do_pull(PullC)), - ?match(Event6, event_test_PullC:do_pull(PullC)), - - timer:sleep(2000), - ?match([Event4, Event5, Event6], event_test_PushC:get_data(PushC)), - - - catch corba:dispose(Ch), - %% The client should be notified; wait for a couple of seconds and check it. - timer:sleep(2000), - ?match(true, corba_object:non_existent(PushC)), - ?match(true, corba_object:non_existent(PullC)), - ?match(true, corba_object:non_existent(PushS)), - ?match(true, corba_object:non_existent(PullS)), - - ok. diff --git a/lib/cosEvent/test/event_test_PullC_impl.erl b/lib/cosEvent/test/event_test_PullC_impl.erl deleted file mode 100644 index fb72d2e595..0000000000 --- a/lib/cosEvent/test/event_test_PullC_impl.erl +++ /dev/null @@ -1,44 +0,0 @@ -%%------------------------------------------------------------------------ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%------------------------------------------------------------------------ -%% Description: a very simple implementation of PullConsumer interface -%%------------------------------------------------------------------------ --module(event_test_PullC_impl). - --export([init/1, terminate/2, disconnect_pull_consumer/1, do_pull/1, do_try_pull/1]). - -init(Proxy) -> - {ok, Proxy}. - -terminate(_From, _Reason) -> - ok. - -disconnect_pull_consumer(Proxy) -> - io:format("event_test_PullC terminates~n",[]), - {stop, normal, ok, Proxy}. - -do_pull(Proxy) -> - {reply, 'CosEventComm_PullSupplier':pull(Proxy), Proxy}. - -do_try_pull(Proxy) -> - {reply, 'CosEventComm_PullSupplier':try_pull(Proxy), Proxy}. - diff --git a/lib/cosEvent/test/event_test_PullS_impl.erl b/lib/cosEvent/test/event_test_PullS_impl.erl deleted file mode 100644 index de59b251da..0000000000 --- a/lib/cosEvent/test/event_test_PullS_impl.erl +++ /dev/null @@ -1,58 +0,0 @@ -%%------------------------------------------------------------------------ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%------------------------------------------------------------------------ -%% Description: a very simple implementation of Pull Supplier interface -%%------------------------------------------------------------------------ --module(event_test_PullS_impl). - --include_lib("orber/include/corba.hrl"). - --export([init/1, terminate/2, pull/1, try_pull/1, disconnect_pull_supplier/1, - add_event/2]). - -init(_) -> - {ok, []}. - -terminate(_From, _Reason) -> - ok. - -pull([]) -> - corba:raise(#'INTERNAL'{completion_status = ?COMPLETED_NO}); -pull([Event|Events]) -> - {reply, Event, Events}. - -try_pull([]) -> - {reply, {#any{typecode=tk_null, value = null}, false}, []}; -try_pull([Event|Events]) -> - {reply, {Event, true}, Events}. - -disconnect_pull_supplier(Events) -> - io:format("event_test_PullS terminates ~p~n", [Events]), - {stop, normal, ok, Events}. - - -add_event(Events, Event) -> - %% Store in FIFO order; don't really care if we use '++' since - %% this operation is used in tests only. - {reply, ok, Events ++ [Event]}. - - diff --git a/lib/cosEvent/test/event_test_PushC_impl.erl b/lib/cosEvent/test/event_test_PushC_impl.erl deleted file mode 100644 index 98e4d611fc..0000000000 --- a/lib/cosEvent/test/event_test_PushC_impl.erl +++ /dev/null @@ -1,47 +0,0 @@ -%%------------------------------------------------------------------------ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%------------------------------------------------------------------------ -%% Description: a very simple implementation of Push Consumer interface -%%------------------------------------------------------------------------ - --module(event_test_PushC_impl). - --export([init/1, terminate/2, push/2, disconnect_push_consumer/1, get_data/1]). - -init(_) -> - {ok, []}. - -terminate(_From, _Reason) -> - ok. - -push(Events, Event) -> - {reply, ok, [Event|Events]}. - -disconnect_push_consumer(Events) -> - io:format("event_test_PushC terminates: ~p~n", [Events]), - {stop, normal, ok, Events}. - - -get_data(Events) -> - %% Returns Events in FIFO order and reset state. - {reply, lists:reverse(Events), []}. - diff --git a/lib/cosEvent/test/event_test_PushS_impl.erl b/lib/cosEvent/test/event_test_PushS_impl.erl deleted file mode 100644 index 062ee8a311..0000000000 --- a/lib/cosEvent/test/event_test_PushS_impl.erl +++ /dev/null @@ -1,42 +0,0 @@ -%%------------------------------------------------------------------------ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%------------------------------------------------------------------------ -%% Description: a very simple implementation of Push Supplier interface -%%------------------------------------------------------------------------ - --module(event_test_PushS_impl). - --export([init/1, terminate/2, disconnect_push_supplier/1, do_push/2]). - -init(Proxy) -> - {ok, Proxy}. - -terminate(_From, _Reason) -> - ok. - -disconnect_push_supplier(Proxy) -> - io:format("event_test_PullC terminates~n",[]), - {stop, normal, ok, Proxy}. - -do_push(Proxy, Event) -> - {reply, 'CosEventComm_PushConsumer':push(Proxy, Event), Proxy}. - diff --git a/lib/cosEvent/test/event_test_server.idl b/lib/cosEvent/test/event_test_server.idl deleted file mode 100644 index f76ac085e1..0000000000 --- a/lib/cosEvent/test/event_test_server.idl +++ /dev/null @@ -1,48 +0,0 @@ -// -// %CopyrightBegin% -// -// Copyright Ericsson AB 2001-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -// - -#ifndef _EVENT_TEST_SERVER_IDL -#define _EVENT_TEST_SERVER_IDL - -#include <../src/CosEventComm.idl> - -module event_test { - - interface PushC : CosEventComm::PushConsumer { - typedef sequence AnySeq; - AnySeq get_data(); - }; - interface PullC : CosEventComm::PullConsumer { - any do_pull(); - any do_try_pull(out boolean has_event); - }; - - interface PushS : CosEventComm::PushSupplier { - void do_push(in any Event); - }; - interface PullS : CosEventComm::PullSupplier { - void add_event(in any Event); - }; - -}; - -#endif - - diff --git a/lib/cosEvent/test/generated_SUITE.erl b/lib/cosEvent/test/generated_SUITE.erl deleted file mode 100644 index 86794023af..0000000000 --- a/lib/cosEvent/test/generated_SUITE.erl +++ /dev/null @@ -1,473 +0,0 @@ -%%----------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File : generated_SUITE.erl -%% Purpose : -%%----------------------------------------------------------------- - --module(generated_SUITE). - --include_lib("common_test/include/ct.hrl"). --include_lib("orber/include/corba.hrl"). - --define(default_timeout, test_server:minutes(3)). - --define(match(ExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - AcTuAlReS; - _ -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS) - end - end()). - --define(nomatch(Not, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - Not -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS); - _ -> - AcTuAlReS - end - end()). - - --define(checktc(_Op), - fun(TC) -> - case orber_tc:check_tc(TC) of - false -> - io:format("###### ERROR ERROR ######~n~p - ~p~n", [Op, TC]), - exit(TC); - true -> - true - end - end). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --compile(export_all). - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - ['CosEventChannelAdmin_AlreadyConnected', - 'CosEventChannelAdmin_TypeError', - 'CosEventComm_Disconnected', - 'CosEventChannelAdmin_ConsumerAdmin', - 'CosEventChannelAdmin_EventChannel', - 'CosEventChannelAdmin_ProxyPullConsumer', - 'CosEventChannelAdmin_ProxyPullSupplier', - 'CosEventChannelAdmin_ProxyPushConsumer', - 'CosEventChannelAdmin_ProxyPushSupplier', - 'CosEventChannelAdmin_SupplierAdmin', - oe_CosEventComm_CAdmin, oe_CosEventComm_Channel, - oe_CosEventComm_Event, oe_CosEventComm_PullerS, - oe_CosEventComm_PusherS, 'CosEventComm_PullConsumer', - 'CosEventComm_PullSupplier', - 'CosEventComm_PushConsumer', - 'CosEventComm_PushSupplier']. - -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- -init_per_testcase(_Case, Config) -> - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - - -end_per_testcase(_Case, Config) -> - Dog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventChannelAdmin_AlreadyConnected' -%% Description: -%%----------------------------------------------------------------- -'CosEventChannelAdmin_AlreadyConnected'(_) -> - ?match(true, orber_tc:check_tc('CosEventChannelAdmin_AlreadyConnected':tc())), - ?match("IDL:omg.org/CosEventChannelAdmin/AlreadyConnected:1.0", - 'CosEventChannelAdmin_AlreadyConnected':id()), - ?match("CosEventChannelAdmin_AlreadyConnected", - 'CosEventChannelAdmin_AlreadyConnected':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventChannelAdmin_TypeError' -%% Description: -%%----------------------------------------------------------------- -'CosEventChannelAdmin_TypeError'(_) -> - ?match(true, orber_tc:check_tc('CosEventChannelAdmin_TypeError':tc())), - ?match("IDL:omg.org/CosEventChannelAdmin/TypeError:1.0", - 'CosEventChannelAdmin_TypeError':id()), - ?match("CosEventChannelAdmin_TypeError", - 'CosEventChannelAdmin_TypeError':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventComm_Disconnected' -%% Description: -%%----------------------------------------------------------------- -'CosEventComm_Disconnected'(_) -> - ?match(true, orber_tc:check_tc('CosEventComm_Disconnected':tc())), - ?match("IDL:omg.org/CosEventComm/Disconnected:1.0", - 'CosEventComm_Disconnected':id()), - ?match("CosEventComm_Disconnected", 'CosEventComm_Disconnected':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventChannelAdmin_ConsumerAdmin' -%% Description: -%%----------------------------------------------------------------- -'CosEventChannelAdmin_ConsumerAdmin'(_) -> - ?nomatch(undefined, 'CosEventChannelAdmin_ConsumerAdmin':oe_tc(obtain_push_supplier)), - ?nomatch(undefined, 'CosEventChannelAdmin_ConsumerAdmin':oe_tc(obtain_pull_supplier)), - ?match(undefined, 'CosEventChannelAdmin_ConsumerAdmin':oe_tc(undefined)), - ?match([_|_], 'CosEventChannelAdmin_ConsumerAdmin':oe_get_interface()), - ?match("IDL:omg.org/CosEventChannelAdmin/ConsumerAdmin:1.0", - 'CosEventChannelAdmin_ConsumerAdmin':typeID()), - check_tc('CosEventChannelAdmin_ConsumerAdmin':oe_get_interface()), - ?match(true, 'CosEventChannelAdmin_ConsumerAdmin':oe_is_a('CosEventChannelAdmin_ConsumerAdmin':typeID())), - ?match(false, 'CosEventChannelAdmin_ConsumerAdmin':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventChannelAdmin_EventChannel' -%% Description: -%%----------------------------------------------------------------- -'CosEventChannelAdmin_EventChannel'(_) -> - ?nomatch(undefined, 'CosEventChannelAdmin_EventChannel':oe_tc(for_consumers)), - ?nomatch(undefined, 'CosEventChannelAdmin_EventChannel':oe_tc(for_suppliers)), - ?nomatch(undefined, 'CosEventChannelAdmin_EventChannel':oe_tc(destroy)), - ?match(undefined, 'CosEventChannelAdmin_EventChannel':oe_tc(undefined)), - ?match([_|_], 'CosEventChannelAdmin_EventChannel':oe_get_interface()), - ?match("IDL:omg.org/CosEventChannelAdmin/EventChannel:1.0", - 'CosEventChannelAdmin_EventChannel':typeID()), - check_tc('CosEventChannelAdmin_EventChannel':oe_get_interface()), - ?match(true, 'CosEventChannelAdmin_EventChannel':oe_is_a('CosEventChannelAdmin_EventChannel':typeID())), - ?match(false, 'CosEventChannelAdmin_EventChannel':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventChannelAdmin_ProxyPullConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosEventChannelAdmin_ProxyPullConsumer'(_) -> - ?nomatch(undefined, 'CosEventChannelAdmin_ProxyPullConsumer':oe_tc(connect_pull_supplier)), - ?nomatch(undefined, 'CosEventChannelAdmin_ProxyPullConsumer':oe_tc(disconnect_pull_consumer)), - ?match(undefined, 'CosEventChannelAdmin_ProxyPullConsumer':oe_tc(undefined)), - ?match([_|_], 'CosEventChannelAdmin_ProxyPullConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosEventChannelAdmin/ProxyPullConsumer:1.0", - 'CosEventChannelAdmin_ProxyPullConsumer':typeID()), - check_tc('CosEventChannelAdmin_ProxyPullConsumer':oe_get_interface()), - ?match(true, 'CosEventChannelAdmin_ProxyPullConsumer':oe_is_a('CosEventChannelAdmin_ProxyPullConsumer':typeID())), - ?match(true, 'CosEventChannelAdmin_ProxyPullConsumer':oe_is_a('CosEventComm_PullConsumer':typeID())), - ?match(false, 'CosEventChannelAdmin_ProxyPullConsumer':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventChannelAdmin_ProxyPullSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosEventChannelAdmin_ProxyPullSupplier'(_) -> - ?nomatch(undefined, 'CosEventChannelAdmin_ProxyPullSupplier':oe_tc(connect_pull_consumer)), - ?nomatch(undefined, 'CosEventChannelAdmin_ProxyPullSupplier':oe_tc(pull)), - ?nomatch(undefined, 'CosEventChannelAdmin_ProxyPullSupplier':oe_tc(try_pull)), - ?nomatch(undefined, 'CosEventChannelAdmin_ProxyPullSupplier':oe_tc(disconnect_pull_supplier)), - ?match(undefined, 'CosEventChannelAdmin_ProxyPullSupplier':oe_tc(undefined)), - ?match([_|_], 'CosEventChannelAdmin_ProxyPullSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosEventChannelAdmin/ProxyPullSupplier:1.0", - 'CosEventChannelAdmin_ProxyPullSupplier':typeID()), - check_tc('CosEventChannelAdmin_ProxyPullSupplier':oe_get_interface()), - ?match(true, 'CosEventChannelAdmin_ProxyPullSupplier':oe_is_a('CosEventChannelAdmin_ProxyPullSupplier':typeID())), - ?match(true, 'CosEventChannelAdmin_ProxyPullSupplier':oe_is_a('CosEventComm_PullSupplier':typeID())), - ?match(false, 'CosEventChannelAdmin_ProxyPullSupplier':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventChannelAdmin_ProxyPushConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosEventChannelAdmin_ProxyPushConsumer'(_) -> - ?nomatch(undefined, 'CosEventChannelAdmin_ProxyPushConsumer':oe_tc(connect_push_supplier)), - ?nomatch(undefined, 'CosEventChannelAdmin_ProxyPushConsumer':oe_tc(push)), - ?nomatch(undefined, 'CosEventChannelAdmin_ProxyPushConsumer':oe_tc(disconnect_push_consumer)), - ?match(undefined, 'CosEventChannelAdmin_ProxyPushConsumer':oe_tc(undefined)), - ?match([_|_], 'CosEventChannelAdmin_ProxyPushConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosEventChannelAdmin/ProxyPushConsumer:1.0", - 'CosEventChannelAdmin_ProxyPushConsumer':typeID()), - check_tc('CosEventChannelAdmin_ProxyPushConsumer':oe_get_interface()), - ?match(true, 'CosEventChannelAdmin_ProxyPushConsumer':oe_is_a('CosEventChannelAdmin_ProxyPushConsumer':typeID())), - ?match(true, 'CosEventChannelAdmin_ProxyPushConsumer':oe_is_a('CosEventComm_PushConsumer':typeID())), - ?match(false, 'CosEventChannelAdmin_ProxyPushConsumer':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventChannelAdmin_ProxyPushSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosEventChannelAdmin_ProxyPushSupplier'(_) -> - ?nomatch(undefined, 'CosEventChannelAdmin_ProxyPushSupplier':oe_tc(connect_push_consumer)), - ?nomatch(undefined, 'CosEventChannelAdmin_ProxyPushSupplier':oe_tc(disconnect_push_supplier)), - ?match(undefined, 'CosEventChannelAdmin_ProxyPushSupplier':oe_tc(undefined)), - ?match([_|_], 'CosEventChannelAdmin_ProxyPushSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosEventChannelAdmin/ProxyPushSupplier:1.0", - 'CosEventChannelAdmin_ProxyPushSupplier':typeID()), - check_tc('CosEventChannelAdmin_ProxyPushSupplier':oe_get_interface()), - ?match(true, 'CosEventChannelAdmin_ProxyPushSupplier':oe_is_a('CosEventChannelAdmin_ProxyPushSupplier':typeID())), - ?match(true, 'CosEventChannelAdmin_ProxyPushSupplier':oe_is_a('CosEventComm_PushSupplier':typeID())), - ?match(false, 'CosEventChannelAdmin_ProxyPushSupplier':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventChannelAdmin_SupplierAdmin' -%% Description: -%%----------------------------------------------------------------- -'CosEventChannelAdmin_SupplierAdmin'(_) -> - ?nomatch(undefined, 'CosEventChannelAdmin_SupplierAdmin':oe_tc(obtain_push_consumer)), - ?nomatch(undefined, 'CosEventChannelAdmin_SupplierAdmin':oe_tc(obtain_pull_consumer)), - ?match(undefined, 'CosEventChannelAdmin_SupplierAdmin':oe_tc(undefined)), - ?match([_|_], 'CosEventChannelAdmin_SupplierAdmin':oe_get_interface()), - ?match("IDL:omg.org/CosEventChannelAdmin/SupplierAdmin:1.0", - 'CosEventChannelAdmin_SupplierAdmin':typeID()), - check_tc('CosEventChannelAdmin_SupplierAdmin':oe_get_interface()), - ?match(true, 'CosEventChannelAdmin_SupplierAdmin':oe_is_a('CosEventChannelAdmin_SupplierAdmin':typeID())), - ?match(false, 'CosEventChannelAdmin_SupplierAdmin':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'oe_CosEventComm_CAdmin' -%% Description: -%%----------------------------------------------------------------- -'oe_CosEventComm_CAdmin'(_) -> - ?nomatch(undefined, 'oe_CosEventComm_CAdmin':oe_tc(obtain_push_supplier)), - ?nomatch(undefined, 'oe_CosEventComm_CAdmin':oe_tc(obtain_pull_supplier)), - ?nomatch(undefined, 'oe_CosEventComm_CAdmin':oe_tc(send)), - ?nomatch(undefined, 'oe_CosEventComm_CAdmin':oe_tc(send_sync)), - ?match(undefined, 'oe_CosEventComm_CAdmin':oe_tc(undefined)), - ?match([_|_], 'oe_CosEventComm_CAdmin':oe_get_interface()), - ?match("IDL:oe_CosEventComm/CAdmin:1.0", - 'oe_CosEventComm_CAdmin':typeID()), - check_tc('oe_CosEventComm_CAdmin':oe_get_interface()), - ?match(true, 'oe_CosEventComm_CAdmin':oe_is_a('oe_CosEventComm_CAdmin':typeID())), - ?match(true, 'oe_CosEventComm_CAdmin':oe_is_a('CosEventChannelAdmin_ConsumerAdmin':typeID())), - ?match(true, 'oe_CosEventComm_CAdmin':oe_is_a('oe_CosEventComm_Event':typeID())), - ?match(false, 'oe_CosEventComm_CAdmin':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'oe_CosEventComm_Channel' -%% Description: -%%----------------------------------------------------------------- -'oe_CosEventComm_Channel'(_) -> - ?nomatch(undefined, 'oe_CosEventComm_Channel':oe_tc(for_consumers)), - ?nomatch(undefined, 'oe_CosEventComm_Channel':oe_tc(for_suppliers)), - ?nomatch(undefined, 'oe_CosEventComm_Channel':oe_tc(destroy)), - ?nomatch(undefined, 'oe_CosEventComm_Channel':oe_tc(send)), - ?nomatch(undefined, 'oe_CosEventComm_Channel':oe_tc(send_sync)), - ?match(undefined, 'oe_CosEventComm_Channel':oe_tc(undefined)), - ?match([_|_], 'oe_CosEventComm_Channel':oe_get_interface()), - ?match("IDL:oe_CosEventComm/Channel:1.0", - 'oe_CosEventComm_Channel':typeID()), - check_tc('oe_CosEventComm_Channel':oe_get_interface()), - ?match(true, 'oe_CosEventComm_Channel':oe_is_a('oe_CosEventComm_Channel':typeID())), - ?match(true, 'oe_CosEventComm_Channel':oe_is_a('CosEventChannelAdmin_EventChannel':typeID())), - ?match(true, 'oe_CosEventComm_Channel':oe_is_a('oe_CosEventComm_Event':typeID())), - ?match(false, 'oe_CosEventComm_Channel':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'oe_CosEventComm_Event' -%% Description: -%%----------------------------------------------------------------- -'oe_CosEventComm_Event'(_) -> - ?nomatch(undefined, 'oe_CosEventComm_Event':oe_tc(send)), - ?nomatch(undefined, 'oe_CosEventComm_Event':oe_tc(send_sync)), - ?match(undefined, 'oe_CosEventComm_Event':oe_tc(undefined)), - ?match([_|_], 'oe_CosEventComm_Event':oe_get_interface()), - ?match("IDL:oe_CosEventComm/Event:1.0", - 'oe_CosEventComm_Event':typeID()), - check_tc('oe_CosEventComm_Event':oe_get_interface()), - ?match(true, 'oe_CosEventComm_Event':oe_is_a('oe_CosEventComm_Event':typeID())), - ?match(false, 'oe_CosEventComm_Event':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'oe_CosEventComm_PullerS' -%% Description: -%%----------------------------------------------------------------- -'oe_CosEventComm_PullerS'(_) -> - ?nomatch(undefined, 'oe_CosEventComm_PullerS':oe_tc(connect_pull_consumer)), - ?nomatch(undefined, 'oe_CosEventComm_PullerS':oe_tc(pull)), - ?nomatch(undefined, 'oe_CosEventComm_PullerS':oe_tc(try_pull)), - ?nomatch(undefined, 'oe_CosEventComm_PullerS':oe_tc(disconnect_pull_supplier)), - ?nomatch(undefined, 'oe_CosEventComm_PullerS':oe_tc(send)), - ?nomatch(undefined, 'oe_CosEventComm_PullerS':oe_tc(send_sync)), - ?match(undefined, 'oe_CosEventComm_PullerS':oe_tc(undefined)), - ?match([_|_], 'oe_CosEventComm_PullerS':oe_get_interface()), - ?match("IDL:oe_CosEventComm/PullerS:1.0", - 'oe_CosEventComm_PullerS':typeID()), - check_tc('oe_CosEventComm_PullerS':oe_get_interface()), - ?match(true, 'oe_CosEventComm_PullerS':oe_is_a('oe_CosEventComm_PullerS':typeID())), - ?match(true, 'oe_CosEventComm_PullerS':oe_is_a('CosEventChannelAdmin_ProxyPullSupplier':typeID())), - ?match(true, 'oe_CosEventComm_PullerS':oe_is_a('CosEventComm_PullSupplier':typeID())), - ?match(true, 'oe_CosEventComm_PullerS':oe_is_a('oe_CosEventComm_Event':typeID())), - ?match(false, 'oe_CosEventComm_PullerS':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'oe_CosEventComm_PusherS' -%% Description: -%%----------------------------------------------------------------- -'oe_CosEventComm_PusherS'(_) -> - ?nomatch(undefined, 'oe_CosEventComm_PusherS':oe_tc(connect_push_consumer)), - ?nomatch(undefined, 'oe_CosEventComm_PusherS':oe_tc(disconnect_push_supplier)), - ?nomatch(undefined, 'oe_CosEventComm_PusherS':oe_tc(send)), - ?nomatch(undefined, 'oe_CosEventComm_PusherS':oe_tc(send_sync)), - ?match(undefined, 'oe_CosEventComm_PusherS':oe_tc(undefined)), - ?match([_|_], 'oe_CosEventComm_PusherS':oe_get_interface()), - ?match("IDL:oe_CosEventComm/PusherS:1.0", - 'oe_CosEventComm_PusherS':typeID()), - check_tc('oe_CosEventComm_PusherS':oe_get_interface()), - ?match(true, 'oe_CosEventComm_PusherS':oe_is_a('oe_CosEventComm_PusherS':typeID())), - ?match(true, 'oe_CosEventComm_PusherS':oe_is_a('CosEventChannelAdmin_ProxyPushSupplier':typeID())), - ?match(true, 'oe_CosEventComm_PusherS':oe_is_a('CosEventComm_PushSupplier':typeID())), - ?match(true, 'oe_CosEventComm_PusherS':oe_is_a('oe_CosEventComm_Event':typeID())), - ?match(false, 'oe_CosEventComm_PusherS':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventComm_PullConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosEventComm_PullConsumer'(_) -> - ?nomatch(undefined, 'CosEventComm_PullConsumer':oe_tc(disconnect_pull_consumer)), - ?match(undefined, 'CosEventComm_PullConsumer':oe_tc(undefined)), - ?match([_|_], 'CosEventComm_PullConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosEventComm/PullConsumer:1.0", - 'CosEventComm_PullConsumer':typeID()), - check_tc('CosEventComm_PullConsumer':oe_get_interface()), - ?match(true, 'CosEventComm_PullConsumer':oe_is_a('CosEventComm_PullConsumer':typeID())), - ?match(false, 'CosEventComm_PullConsumer':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventComm_PullSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosEventComm_PullSupplier'(_) -> - ?nomatch(undefined, 'CosEventComm_PullSupplier':oe_tc(pull)), - ?nomatch(undefined, 'CosEventComm_PullSupplier':oe_tc(try_pull)), - ?nomatch(undefined, 'CosEventComm_PullSupplier':oe_tc(disconnect_pull_supplier)), - ?match(undefined, 'CosEventComm_PullSupplier':oe_tc(undefined)), - ?match([_|_], 'CosEventComm_PullSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosEventComm/PullSupplier:1.0", - 'CosEventComm_PullSupplier':typeID()), - check_tc('CosEventComm_PullSupplier':oe_get_interface()), - ?match(true, 'CosEventComm_PullSupplier':oe_is_a('CosEventComm_PullSupplier':typeID())), - ?match(false, 'CosEventComm_PullSupplier':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventComm_PushConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosEventComm_PushConsumer'(_) -> - ?nomatch(undefined, 'CosEventComm_PushConsumer':oe_tc(push)), - ?nomatch(undefined, 'CosEventComm_PushConsumer':oe_tc(disconnect_push_consumer)), - ?match(undefined, 'CosEventComm_PushConsumer':oe_tc(undefined)), - ?match([_|_], 'CosEventComm_PushConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosEventComm/PushConsumer:1.0", - 'CosEventComm_PushConsumer':typeID()), - check_tc('CosEventComm_PushConsumer':oe_get_interface()), - ?match(true, 'CosEventComm_PushConsumer':oe_is_a('CosEventComm_PushConsumer':typeID())), - ?match(false, 'CosEventComm_PushConsumer':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventComm_PushSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosEventComm_PushSupplier'(_) -> - ?nomatch(undefined, 'CosEventComm_PushSupplier':oe_tc(disconnect_push_supplier)), - ?match(undefined, 'CosEventComm_PushSupplier':oe_tc(undefined)), - ?match([_|_], 'CosEventComm_PushSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosEventComm/PushSupplier:1.0", - 'CosEventComm_PushSupplier':typeID()), - check_tc('CosEventComm_PushSupplier':oe_get_interface()), - ?match(true, 'CosEventComm_PushSupplier':oe_is_a('CosEventComm_PushSupplier':typeID())), - ?match(false, 'CosEventComm_PushSupplier':oe_is_a("wrong")), - ok. - - - -%%----------------------------------------------------------------- -%% MISC functions -%%----------------------------------------------------------------- -check_tc([]) -> - ok; -check_tc([{Op, {RetType, InParameters, OutParameters}}|T]) -> - io:format("checked - ~s~n", [Op]), - lists:all(?checktc(Op), [RetType|InParameters]), - lists:all(?checktc(Op), OutParameters), - check_tc(T). - - diff --git a/lib/cosEvent/test/idl_output/.gitignore b/lib/cosEvent/test/idl_output/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosEvent/vsn.mk b/lib/cosEvent/vsn.mk deleted file mode 100644 index 578950294a..0000000000 --- a/lib/cosEvent/vsn.mk +++ /dev/null @@ -1,2 +0,0 @@ -COSEVENT_VSN = 2.2.2 - diff --git a/lib/cosEventDomain/AUTHORS b/lib/cosEventDomain/AUTHORS deleted file mode 100644 index 6d03df4c5a..0000000000 --- a/lib/cosEventDomain/AUTHORS +++ /dev/null @@ -1,4 +0,0 @@ -Original Authors: -Niclas Eklund - -Contributors: diff --git a/lib/cosEventDomain/Makefile b/lib/cosEventDomain/Makefile deleted file mode 100644 index 8e8ae7e4da..0000000000 --- a/lib/cosEventDomain/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2001-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include vsn.mk -VSN=$(COSEVENTDOMAIN_VSN) - -# ---------------------------------------------------- -# Common Macros -# ---------------------------------------------------- - -SUB_DIRECTORIES = src doc/src - -SPECIAL_TARGETS = - -# ---------------------------------------------------- -# Default Subdir Targets -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_subdir.mk - diff --git a/lib/cosEventDomain/doc/html/.gitignore b/lib/cosEventDomain/doc/html/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosEventDomain/doc/man3/.gitignore b/lib/cosEventDomain/doc/man3/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosEventDomain/doc/man6/.gitignore b/lib/cosEventDomain/doc/man6/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosEventDomain/doc/pdf/.gitignore b/lib/cosEventDomain/doc/pdf/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosEventDomain/doc/src/CosEventDomainAdmin.xml b/lib/cosEventDomain/doc/src/CosEventDomainAdmin.xml deleted file mode 100644 index 6931059e67..0000000000 --- a/lib/cosEventDomain/doc/src/CosEventDomainAdmin.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - -
- - 2002 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosEventDomainAdmin - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 2001-08-20 - PA1 -
- CosEventDomainAdmin - This module export functions which return QoS and Admin Properties constants. - -

To get access to all definitions include necessary files by using:

-
- - - 'CycleDetection'() -> string() - Return the CycleDetection identifier required when defining QoS Properties - -

This function returns the CycleDetection identifier; required when - defining QoS Properties.

-
-
- - 'AuthorizeCycles'() -> short() - Return the AuthorizeCycles value; required when defining QoS Properties - -

This function returns the AuthorizeCycles value; required when - defining QoS Properties.

-
-
- - 'ForbidCycles'() -> short() - Return the ForbidCycles value; required when defining QoS Properties - -

This function returns the ForbidCycles value; required when - defining QoS Properties.

-
-
- - 'DiamondDetection'() -> string() - Return the DiamondDetection identifier required when defining QoS Properties - -

This function returns the DiamondDetection identifier; required when - defining QoS Properties.

-
-
- - 'AuthorizeDiamonds'() -> short() - Return the AuthorizeDiamonds value; required when defining QoS Properties - -

This function returns the AuthorizeDiamonds value; required when - defining QoS Properties.

-
-
- - 'ForbidDiamonds'() -> short() - Return the ForbidDiamonds value; required when defining QoS Properties - -

This function returns the ForbidDiamonds value; required when - defining QoS Properties.

-
-
-
- -
- diff --git a/lib/cosEventDomain/doc/src/CosEventDomainAdmin_EventDomain.xml b/lib/cosEventDomain/doc/src/CosEventDomainAdmin_EventDomain.xml deleted file mode 100644 index e99c8d380b..0000000000 --- a/lib/cosEventDomain/doc/src/CosEventDomainAdmin_EventDomain.xml +++ /dev/null @@ -1,627 +0,0 @@ - - - - -
- - 20012016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosEventDomainAdmin_EventDomain - - - Niclas Eklund - - 2001-08-20 - PA1 -
- CosEventDomainAdmin_EventDomain - This module implements the Event Domain interface. - -

To get access to all definitions include necessary files by using:

-

This module also exports the functions described in:

- - CosNotification_QoSAdmin - CosNotification_AdminPropertiesAdmin - -
- - - add_channel(EventDomain, Channel) -> MemberID - Add a new channel to the EventDomain - - EventDomain = Channel = #objref - MemberID = long() - - -

Adds the given channel to the target domain. The channel - must be a .

-
-
- - get_all_channels(EventDomain) -> MemberIDSeq - Return all channel id's associated with target object - - EventDomain = #objref - MemberIDSeq = [long()] - - -

Returns a a sequence of all channels associated with - the target object.

-
-
- - get_channel(EventDomain, MemberID) -> Reply - Return the channel associated with the given id - - EventDomain = #objref - MemberID = long() - Reply = Channel | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - Channel = #objref - - -

If the target domain have a - represented by the given id this channel is returned. Otherwise, - an exception is raised.

-
-
- - remove_channel(EventDomain, MemberID) -> Reply - Remove the channel associated with the given id and remove all connections of that channel - - EventDomain = #objref - MemberID = long() - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a with the - exists it will removed and all its - terminated. Otherwise an exception is raised.

-
-
- - add_connection(EventDomain, Connection) -> Reply - If possible, setup a connection described by the struct - - EventDomain = #objref - Connection = 'CosEventDomainAdmin_Connection'{supplier_id=MemberID, consumer_id=MemberID, ctype=Type, notification_style=Style} - MemberID = long() - Type = 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' - Style = 'Pull' | 'Push' - Reply = ConnectionID | {'EXCEPTION', Exc} - ConnectionID = long() - Exc = #'CosNotifyChannelAdmin_ChannelNotFound'{} | #'CosNotifyChannelAdmin_TypeError'{} | #'CosEventDomainAdmin_AlreadyExists'{} | #'CosEventDomainAdmin_DiamondCreationForbidden'{diam=RouteSeq} | #'CosEventDomainAdmin_CycleCreationForbidden'{cyc=MemberIDSeq} - RouteSeq = [MemberIDSeq] - MemberIDSeq = [long()] - - -

The Connection parameter must contain valid data to enable - the target domain to setup a connection between two channels. - The struct members and - determines which channel should produce and consume events. - which type of events and if the supplier should push or the - consumer pull events is determined by and - respectively.

-

If the target domain is not able to setup the connection - the appropriate exception is raised.

-
-
- - get_all_connections(EventDomain) -> ConnectionIDSeq - Return a sequence of all connections within the target domain - - EventDomain = #objref - ConnectionIDSeq = [long()] - - -

This operation returns a sequence of all connections within - the target domain.

-
-
- - get_connection(EventDomain, ConnectionID) -> Reply - Return a struct describing the connection associated with the given id within the target domain - - EventDomain = #objref - ConnectionID = long() - Reply = Connection | {'EXCEPTION', #'CosEventDomainAdmin_ConnectionNotFound'{}} - Connection = 'CosEventDomainAdmin_Connection'{supplier_id=MemberID, consumer_id=MemberID, ctype=Type, notification_style=Style} - MemberID = long() - Type = 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' - Style = 'Pull' | 'Push' - - -

If a connection identified by the given id exists within the - target domain, a which - describe the connection is returned. Otherwise, an exception - is raised.

-
-
- - remove_connection(EventDomain, ConnectionID) -> Reply - Remove the connection identified by the given id from the target domain - - EventDomain = #objref - ConnectionID = long() - Reply = ok | {'EXCEPTION', #'CosEventDomainAdmin_ConnectionNotFound'{}} - - -

If the supplied connection id exists, the connection the - id represents is terminated. Otherwise, an exception is raised.

-
-
- - get_offer_channels(EventDomain, MemberID) -> Reply - Return all id's of the channels which produce events received by the channel identified by the given id - - EventDomain = #objref - MemberID = long() - Reply = MemberIDSeq | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

This operation returns a sequence, containing the member id's - of all channels within the target domain which will supply events - to the channel identified by the given id. But, if no such - id exists in this domain, an exception is raised.

-
-
- - get_subscription_channels(EventDomain, MemberID) -> Reply - Return all id's of the channels which consume events supplied by the channel identified by the given id - - EventDomain = #objref - Reply = MemberIDSeq | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

This operations behaves like ; - the difference is that the id's returned identifies channels - which will consume events supplied by the channel associated - with the given id.

-
-
- - destroy(EventDomain) -> ok - Destroy the event domain and all connections within it - - EventDomain = #objref - - -

Calling this operation will terminate all connections - within the target domain. The domain will terminate but - all channels will not be affected.

-
-
- - get_cycles(EventDomain) -> RouteSeq - Return a list of all cycles which exists within the target domain - - EventDomain = #objref - RouteSeq = [MemberIDSeq] - MemberIDSeq = [long()] - - -

Returns a list of all cycles within the target domain.

-
-
- - get_diamonds(EventDomain) -> DiamondSeq - Return a list of all diamonds which exists within the target domain - - EventDomain = #objref - DiamondSeq = [RouteSeq] - RouteSeq = [MemberIDSeq] - MemberIDSeq = [long()] - - -

Returns a list of all diamonds within the target domain

-
-
- - set_default_consumer_channel(EventDomain, MemberID) -> Reply - Set the channel represented by the given id as default for supplier clients - - EventDomain = #objref - Reply = MemberID | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - MemberID = long() - - -

If the given id represents a channel within the target domain, - this channel will be used when connection a supplier client - without specifying a certain channel. If no such channel exists - an exceptions is raised.

-
-
- - set_default_supplier_channel(EventDomain, MemberID) -> Reply - Set the channel represented by the given id as default for supplier clients - - EventDomain = #objref - Reply = MemberID | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - MemberID = long() - - -

If the given id represents a channel within the target domain, - this channel will be used when connection a consumer client - without specifying a certain channel. If no such channel exists - an exceptions is raised.

-
-
- - connect_push_consumer(EventDomain, Consumer) -> Reply - Connect the PushConsumer to the default Channel - - EventDomain = #objref - Consumer = CosEventComm::PushConsumer - Reply = CosNotifyChannelAdmin::ProxyPushSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a default Channel have been set, this operation connects the given - PushConsumer to it. Otherwise, the - exception is raised.

-
-
- - connect_pull_consumer(EventDomain, Consumer) -> Reply - Connect the PullConsumer to the default Channel - - EventDomain = #objref - Consumer = CosEventComm::PullConsumer - Reply = CosNotifyChannelAdmin::ProxyPullSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a default Channel have been set, this operation connects the given - PullConsumer to it. Otherwise, the - exception is raised.

-
-
- - connect_push_supplier(EventDomain, Supplier) -> Reply - Connect the PushSupplier to the default Channel - - EventDomain = #objref - Supplier = CosEventComm::PushSupplier - Reply = CosNotifyChannelAdmin::ProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a default Channel have been set, this operation connects the given - PushSupplier to it. Otherwise, the - exception is raised.

-
-
- - connect_pull_supplier(EventDomain, Supplier) -> Reply - Connect the PullSupplier to the default Channel - - EventDomain = #objref - Supplier = CosEventComm::PullSupplier - Reply = CosNotifyChannelAdmin::ProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a default Channel have been set, this operation connects the given - PullSupplier to it. Otherwise, the - exception is raised.

-
-
- - connect_structured_push_consumer(EventDomain, Consumer) -> Reply - Connect the StructuredPushConsumer to the default Channel - - EventDomain = #objref - Consumer = CosNotifyComm::StructuredPushConsumer - Reply = CosNotifyChannelAdmin::StructuredProxyPushSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a default Channel have been set, this operation connects the given - StructuredPushConsumer to it. Otherwise, the - exception is raised.

-
-
- - connect_structured_pull_consumer(EventDomain, Consumer) -> Reply - Connect the StructuredPullConsumer to the default Channel - - EventDomain = #objref - Consumer = CosNotifyComm::StructuredPullConsumer - Reply = CosNotifyChannelAdmin::StructuredProxyPullSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a default Channel have been set, this operation connects the given - StructuredPullConsumer to it. Otherwise, the - exception is raised.

-
-
- - connect_structured_push_supplier(EventDomain, Supplier) -> Reply - Connect the StructuredPushSupplier to the default Channel - - EventDomain = #objref - Supplier = CosNotifyComm::StructuredPushSupplier - Reply = CosNotifyChannelAdmin::StructuredProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a default Channel have been set, this operation connects the given - StructuredPushSupplier to it. Otherwise, the - exception is raised.

-
-
- - connect_structured_pull_supplier(EventDomain, Supplier) -> Reply - Connect the StructuredPullSupplier to the default Channel - - EventDomain = #objref - Supplier = CosNotifyComm::StructuredPullSupplier - Reply = CosNotifyChannelAdmin::StructuredProxyPullConsume | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a default Channel have been set, this operation connects the given - StructuredPullSupplier to it. Otherwise, the - exception is raised.

-
-
- - connect_sequence_push_consumer(EventDomain, Consumer) -> Reply - Connect the SequencePushConsumer to the default Channel - - EventDomain = #objref - Consumer = CosNotifyComm::SequencePushConsumer - Reply = CosNotifyChannelAdmin::SequenceProxyPushSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a default Channel have been set, this operation connects the given - SequencePushConsumer to it. Otherwise, the - exception is raised.

-
-
- - connect_sequence_pull_consumer(EventDomain, Consumer) -> Reply - Connect the SequencePullConsumer to the default Channel - - EventDomain = #objref - Consumer = CosNotifyComm::SequencePullConsumer - Reply = CosNotifyChannelAdmin::SequenceProxyPullSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a default Channel have been set, this operation connects the given - SequencePullConsumer to it. Otherwise, the - exception is raised.

-
-
- - connect_sequence_push_supplier(EventDomain, Supplier) -> Reply - Connect the SequencePushSupplier to the default Channel - - EventDomain = #objref - Supplier = CosNotifyComm::SequencePushSupplier - Reply = CosNotifyChannelAdmin::SequenceProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a default Channel have been set, this operation connects the given - SequencePushSupplier to it. Otherwise, the - exception is raised.

-
-
- - connect_sequence_pull_supplier(EventDomain, Supplier) -> Reply - Connect the SequencePullSupplier to the default Channel - - EventDomain = #objref - Supplier = CosNotifyComm::SequencePullSupplier - Reply = CosNotifyChannelAdmin::SequenceProxyPullConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a default Channel have been set, this operation connects the given - SequencePullSupplier to it. Otherwise, the - exception is raised.

-
-
- - connect_push_consumer_with_id(EventDomain, Consumer, MemberID) -> Reply - Connect the PushConsumer to the Channel with the given MemberID - - EventDomain = #objref - Consumer = CosEventComm::PushConsumer - MemberID = long() - Reply = CosNotifyChannelAdmin::ProxyPushSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a Channel associated with the given MemberID exists within the - target Domain, this operation connects the given PushConsumer - to it. Otherwise, the - exception is raised.

-
-
- - connect_pull_consumer_with_id(EventDomain, Consumer, MemberID) -> Reply - Connect the PullConsumer to the Channel with the given MemberID - - EventDomain = #objref - Consumer = CosEventComm::PullConsumer - MemberID = long() - Reply = CosNotifyChannelAdmin::ProxyPullSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a Channel associated with the given MemberID exists within the - target Domain, this operation connects the given PullConsumer - to it. Otherwise, the - exception is raised.

-
-
- - connect_push_supplier_with_id(EventDomain, Supplier, MemberID) -> Reply - Connect the PushSupplier to the Channel with the given MemberID - - EventDomain = #objref - Supplier = CosEventComm::PushSupplier - MemberID = long() - Reply = CosNotifyChannelAdmin::ProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a Channel associated with the given MemberID exists within the - target Domain, this operation connects the given PushSupplier - to it. Otherwise, the - exception is raised.

-
-
- - connect_pull_supplier_with_id(EventDomain, Supplier, MemberID) -> Reply - Connect the PullSupplier to the Channel with the given MemberID - - EventDomain = #objref - Supplier = CosEventComm::PullSupplier - MemberID = long() - Reply = CosNotifyChannelAdmin::ProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a Channel associated with the given MemberID exists within the - target Domain, this operation connects the given PullSupplier - to it. Otherwise, the - exception is raised.

-
-
- - connect_structured_push_consumer_with_id(EventDomain, Consumer, MemberID) -> Reply - Connect the StructuredPushConsumer to the Channel with the given MemberID - - EventDomain = #objref - Consumer = CosNotifyComm::StructuredPushConsumer - MemberID = long() - Reply = CosNotifyChannelAdmin::StructuredProxyPushSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a Channel associated with the given MemberID exists within the - target Domain, this operation connects the given StructuredPushConsumer - to it. Otherwise, the - exception is raised.

-
-
- - connect_structured_pull_consumer_with_id(EventDomain, Consumer, MemberID) -> Reply - Connect the StructuredPullConsumer to the Channel with the given MemberID - - EventDomain = #objref - Consumer = CosNotifyComm::StructuredPullConsumer - MemberID = long() - Reply = CosNotifyChannelAdmin::StructuredProxyPullSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a Channel associated with the given MemberID exists within the - target Domain, this operation connects the given StructuredPullConsumer - to it. Otherwise, the - exception is raised.

-
-
- - connect_structured_push_supplier_with_id(EventDomain, Supplier, MemberID) -> Reply - Connect the StructuredPushSupplier to the Channel with the given MemberID - - EventDomain = #objref - Supplier = CosNotifyComm::StructuredPushSupplier - MemberID = long() - Reply = CosNotifyChannelAdmin::StructuredProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a Channel associated with the given MemberID exists within the - target Domain, this operation connects the given StructuredPushSupplier - to it. Otherwise, the - exception is raised.

-
-
- - connect_structured_pull_supplier_with_id(EventDomain, Supplier, MemberID) -> Reply - Connect the StructuredPullSupplier to the Channel with the given MemberID - - EventDomain = #objref - Supplier = CosNotifyComm::StructuredPullSupplier - MemberID = long() - Reply = CosNotifyChannelAdmin::StructuredProxyPullConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a Channel associated with the given MemberID exists within the - target Domain, this operation connects the given StructuredPullSupplier - to it. Otherwise, the - exception is raised.

-
-
- - connect_sequence_push_consumer_with_id(EventDomain, Consumer, MemberID) -> Reply - Connect the SequencePushConsumer to the Channel with the given MemberID - - EventDomain = #objref - Consumer = CosNotifyComm::SequencePushConsumer - MemberID = long() - Reply = CosNotifyChannelAdmin::SequenceProxyPushSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a Channel associated with the given MemberID exists within the - target Domain, this operation connects the given SequencePushConsumer - to it. Otherwise, the - exception is raised.

-
-
- - connect_sequence_pull_consumer_with_id(EventDomain, Consumer, MemberID) -> Reply - Connect the SequencePullConsumer to the Channel with the given MemberID - - EventDomain = #objref - Consumer = CosNotifyComm::SequencePullConsumer - MemberID = long() - Reply = CosNotifyChannelAdmin::SequenceProxyPullSupplier | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a Channel associated with the given MemberID exists within the - target Domain, this operation connects the given SequencePullConsumer - to it. Otherwise, the - exception is raised.

-
-
- - connect_sequence_push_supplier_with_id(EventDomain, Supplier, MemberID) -> Reply - Connect the SequencePushSupplier to the Channel with the given MemberID - - EventDomain = #objref - Supplier = CosNotifyComm::SequencePushSupplier - MemberID = long() - Reply = CosNotifyChannelAdmin::SequenceProxyPushConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a Channel associated with the given MemberID exists within the - target Domain, this operation connects the given SequencePushSupplier - to it. Otherwise, the - exception is raised.

-
-
- - connect_sequence_pull_supplier_with_id(EventDomain, Supplier, MemberID) -> Reply - Connect the SequencePullSupplier to the Channel with the given MemberID - - EventDomain = #objref - Supplier = CosNotifyComm::SequencePullSupplier - MemberID = long() - Reply = CosNotifyChannelAdmin::SequenceProxyPullConsumer | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - - -

If a Channel associated with the given MemberID exists within the - target Domain, this operation connects the given SequencePullSupplier - to it. Otherwise, the - exception is raised.

-
-
-
- -
- diff --git a/lib/cosEventDomain/doc/src/CosEventDomainAdmin_EventDomainFactory.xml b/lib/cosEventDomain/doc/src/CosEventDomainAdmin_EventDomainFactory.xml deleted file mode 100644 index 602e0e5fb0..0000000000 --- a/lib/cosEventDomain/doc/src/CosEventDomainAdmin_EventDomainFactory.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - -
- - 2001 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosEventDomainAdmin_EventDomainFactory - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 2001-08-20 - PA1 -
- CosEventDomainAdmin_EventDomainFactory - This module implements an Event Domain Factory interface, which is used to create new Event Domain instances. - -

To get access to all definitions include necessary files by using:

-
- - - create_event_domain(Factory, QoS, Admin) -> Reply - Create a new ConsumerAdmin object - - Factory = #objref - QoS = CosNotification::QoSProperties - Admin = CosNotification::AdminProperties - Reply = {EventDomain, DomainID} | {'EXCEPTION', #'CosNotification_UnsupportedQoS'{}} | {'EXCEPTION', #'CosNotification_UnsupportedAdmin'{}} - EventDomain = #objref - - -

To create a new EventDomain this operation is used. If it is not - possible to support the given or - an exception is raised, which list the properties not supported. For more - information see the user's guide.

-
-
- - get_all_domains(Factory) -> DomainIDSeq - Return a DomainID sequence of all domains associated with the target object - - Factory = #objref - DomainIDSeq = [long()] - - -

This function returns a DomainID sequence of all domains associated with the - target object.

-
-
- - get_event_domain(Factory, DomainID) -> Reply - Return the domain associated with the given id - - Factory = #objref - DomainID = long() - Reply = EventDomain | {'EXCEPTION', #'CosEventDomainAdmin_DomainNotFound'{}} - EventDomain = #objref - - -

This operation returns the EventDomain object associated with the - given DomainID. If no such binding exists an exception is raised.

-
-
-
- -
- diff --git a/lib/cosEventDomain/doc/src/Makefile b/lib/cosEventDomain/doc/src/Makefile deleted file mode 100644 index 9faf65394d..0000000000 --- a/lib/cosEventDomain/doc/src/Makefile +++ /dev/null @@ -1,137 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2001-2017. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../../vsn.mk -VSN=$(COSEVENTDOMAIN_VSN) -APPLICATION=cosEventDomain - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN) - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -XML_APPLICATION_FILES = ref_man.xml -XML_REF3_FILES = \ - CosEventDomainAdmin_EventDomainFactory.xml \ - CosEventDomainAdmin_EventDomain.xml \ - CosEventDomainAdmin.xml \ - cosEventDomainApp.xml - -XML_PART_FILES = \ - part.xml -XML_CHAPTER_FILES = \ - ch_contents.xml \ - ch_introduction.xml \ - ch_QoS.xml \ - ch_event_domain_service.xml \ - notes.xml - -BOOK_FILES = book.xml - -XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \ - $(XML_PART_FILES) $(XML_CHAPTER_FILES) - -TECHNICAL_DESCR_FILES = - -GIF_FILES = - -PS_FILES = - -# ---------------------------------------------------- - -INTERNAL_HTML_FILES = $(TECHNICAL_DESCR_FILES:%.xml=$(HTMLDIR)/%.html) - -HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \ - $(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html) - -INFO_FILE = ../../info -EXTRA_FILES = \ - $(DEFAULT_GIF_FILES) \ - $(DEFAULT_HTML_FILES) \ - $(XML_REF3_FILES:%.xml=$(HTMLDIR)/%.html) \ - $(XML_CHAPTER_FILES:%.xml=$(HTMLDIR)/%.html) - -MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3) - -HTML_REF_MAN_FILE = $(HTMLDIR)/index.html - -TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -XML_FLAGS += -DVIPS_FLAGS += - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -$(HTMLDIR)/%.gif: %.gif - $(INSTALL_DATA) $< $@ - -docs: pdf html man - -$(TOP_PDF_FILE): $(XML_FILES) - -pdf: $(TOP_PDF_FILE) - -html: gifs $(HTML_REF_MAN_FILE) - -clean clean_docs: - rm -rf $(HTMLDIR)/* - rm -f $(MAN3DIR)/* - rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) - rm -f errs core *~ - rm -f $(JD_HTML) $(JD_PACK) - -man: $(MAN3_FILES) - -gifs: $(GIF_FILES:%=$(HTMLDIR)/%) - -$(INDEX_TARGET): $(INDEX_SRC) - sed -e 's;%VSN%;$(VSN);' $(INDEX_SRC) > $(INDEX_TARGET) - -debug opt: - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_docs_spec: docs - $(INSTALL_DIR) "$(RELSYSDIR)/doc/pdf" - $(INSTALL_DATA) $(TOP_PDF_FILE) "$(RELSYSDIR)/doc/pdf" - $(INSTALL_DIR) "$(RELSYSDIR)/doc/html" - $(INSTALL_DATA) $(HTMLDIR)/* \ - "$(RELSYSDIR)/doc/html" - $(INSTALL_DATA) $(INFO_FILE) "$(RELSYSDIR)" - $(INSTALL_DIR) "$(RELEASE_PATH)/man/man3" - $(INSTALL_DATA) $(MAN3DIR)/* "$(RELEASE_PATH)/man/man3" - -release_spec: diff --git a/lib/cosEventDomain/doc/src/book.xml b/lib/cosEventDomain/doc/src/book.xml deleted file mode 100644 index b073e5edc0..0000000000 --- a/lib/cosEventDomain/doc/src/book.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - -
- - 20012016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosEventDomain - Niclas Eklund - - 2001-08-20 - 1.0 -
- - - cosEventDomain - - - - - - - - - - - - - - -
- diff --git a/lib/cosEventDomain/doc/src/ch_QoS.xml b/lib/cosEventDomain/doc/src/ch_QoS.xml deleted file mode 100644 index c356e38752..0000000000 --- a/lib/cosEventDomain/doc/src/ch_QoS.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - -
- - 20022016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Quality Of Service and Admin Properties - - - 2000-05-29 - - ch_QoS.xml -
- -
- Quality Of Service and Admin Properties -

This chapter explains the allowed properties it is possible to set for this - application.

- -
- Quality Of Service -

The cosEventDomain application supports the following QoS settings:

- - - QoS - Range - Default - - - CycleDetection - AuthorizeCycles/ForbidCycles - ForbidCycles - - - DiamondDetection - AuthorizeDiamonds/ForbidDiamonds - ForbidDiamonds - - Supported QoS settings -
-







Comments on the table 'Supported QoS Settings':

- - CycleDetection - If a cycle is created, the user must be aware of the fact - that unless they set timeout on events, events that are not filtered - will loop endlessly through the topology. - DiamondDetection - A Diamond in this context, means that the same - event may reach a point in the graph by more than one route - (i.e. transitive). Hence, it is possible that multiple copies - are delivered. - -
- -
- Setting Quality Of Service -

Assume we have a Consumer Admin object which we want to change - the current Quality of Service. Typical usage:

- -

If it is not possible to set the requested QoS the - exception is raised, which includes a sequence of 's - describing which QoS, possible range and why is not allowed. The error - codes are:

- - UNSUPPORTED_PROPERTY - QoS not supported for this type of target object. - UNAVAILABLE_PROPERTY - due to current QoS settings the given property - is not allowed. - UNSUPPORTED_VALUE - property value out of range; valid range is returned. - UNAVAILABLE_VALUE - due to current QoS settings the given value is - not allowed; valid range is returned. - BAD_PROPERTY - unrecognized property. - BAD_TYPE - type of supplied property is incorrect. - BAD_VALUE - illegal value. - -

The CosEventDomainAdmin_EventDomain interface also supports an operation - called . The purpose of this operations is to check - if a QoS setting is supported by the target object and if so, the operation - returns additional properties which could be optionally added as well.

-
- -
- Admin Properties -

The OMG specification do not contain any definitions of Admin Properties. - Hence, the cosEventDomain application currently does not support any Admin - Properties.

-
-
-
- diff --git a/lib/cosEventDomain/doc/src/ch_contents.xml b/lib/cosEventDomain/doc/src/ch_contents.xml deleted file mode 100644 index b8fefecf44..0000000000 --- a/lib/cosEventDomain/doc/src/ch_contents.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - -
- - 20012016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - The cosEventDomain Application - Niclas Eklund - - 2001-08-20 - B - ch_contents.xml -
- -
- Content Overview -

The cosEventDomain documentation is divided into three sections: -

- - -

PART ONE - The User's Guide -

Description of the cosEventDomain Application including - services and a small tutorial demonstrating - the development of a simple service.

-
- -

PART TWO - Release Notes -

A concise history of cosEventDomain.

-
- -

PART THREE - The Reference Manual -

A quick reference guide, including a - brief description, to all the functions available in cosEventDomain.

-
-
-
- -
- Brief Description of the User's Guide -

The User's Guide contains the following parts:

- - -

CosEventDomain overview

-
- -

CosEventDomain installation and examples

-
-
-
-
- diff --git a/lib/cosEventDomain/doc/src/ch_event_domain_service.xml b/lib/cosEventDomain/doc/src/ch_event_domain_service.xml deleted file mode 100644 index a0ecf20415..0000000000 --- a/lib/cosEventDomain/doc/src/ch_event_domain_service.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - -
- - 20012016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Event Domain Service - Niclas Eklund - - 2001-08-20 - A - ch_event_domain_service.xml -
- -
- Overview of the CosEventDomain Service -

The Event Domain service allows programmers to manage a cluster - of information channels.

- -
- Event Domain Service Components -

There are two components in the OMG CosEventDomainAdmin service architecture:

- - EventDomainFactory: a factory for creating EventDomains. - EventDomain: supplies a tool, which makes it easy to create - topologies of interconnected channels (i.e. a directed graph). - -
- -
- A Tutorial on How to Create a Simple Service -

To be able to use the cosEventDomain application, the cosNotification - and, possibly, the cosTime application must be installed.

-
- -
- How to Run Everything -

Below is a short transcript on how to run cosEventDomain.

- -
-
-
- diff --git a/lib/cosEventDomain/doc/src/ch_introduction.xml b/lib/cosEventDomain/doc/src/ch_introduction.xml deleted file mode 100644 index f7a3426673..0000000000 --- a/lib/cosEventDomain/doc/src/ch_introduction.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - -
- - 20012016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Introduction to cosEventDomain - Niclas Eklund - - 2001-08-20 - - ch_introduction.xml -
- -
- Overview -

The cosEventDomain application is a Event Domain Service compliant with the OMG - Service CosEventDomainAdmin. -

- -
- Purpose and Dependencies -

CosEventDomain is dependent on Orber, which provides CORBA functionality in an Erlang environment.

-
- -
- Prerequisites -

To fully understand the concepts presented in the - documentation, it is recommended that the user is familiar - with distributed programming and CORBA. -

-
-
-
- diff --git a/lib/cosEventDomain/doc/src/cosEventDomainApp.xml b/lib/cosEventDomain/doc/src/cosEventDomainApp.xml deleted file mode 100644 index c75ee05512..0000000000 --- a/lib/cosEventDomain/doc/src/cosEventDomainApp.xml +++ /dev/null @@ -1,150 +0,0 @@ - - - - -
- - 2001 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - cosEventDomainApp - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 2001-08-20 - PA1 -
- cosEventDomainApp - The main module of the cosEventDomain application. - -

To get access to the record definitions for the structures use:

-

This module contains the functions for starting and stopping the application.

-
- - - install() -> Return - Install the cosEventDomain application - - Return = ok | {'EXCEPTION', E} | {'EXIT', R} - - -

This operation installs the cosEventDomain application.

-
-
- - uninstall() -> Return - Uninstall the cosEventDomain application - - Return = ok | {'EXCEPTION', E} | {'EXIT', R} - - -

This operation uninstalls the cosEventDomain application.

-
-
- - start() -> Return - Start the cosEventDomain application - - Return = ok | {error, Reason} - - -

This operation starts the cosEventDomain application.

-
-
- - stop() -> Return - Stop the cosEventDomain application - - Return = ok | {error, Reason} - - -

This operation stops the cosEventDomain application.

-
-
- - start_factory() -> Factory - Start a factory with default settings - - Factory = #objref - - -

This operation creates a new instance of a - Event Domain Factory - using the default settings.

-
-
- - start_factory(Options) -> Factory - Start a factory with settings defined by the given options - - Options = [Option] - Option = currently no options defined. - Factory = #objref - - -

This operation creates a new instance of a - Event Domain Factory

-
-
- - start_factory_link() -> Factory - Start a factory, which is linked to the invoking process, with default settings - - Factory = #objref - - -

This operation creates a new instance of a - Event Domain Factory, - which is linked to the invoking process, using the default settings.

-
-
- - start_factory_link(Options) -> Factory - Start a factory, which is linked to the invoking process, with settings defined by the given options - - Options = [Option] - Option = currently no options defined. - Factory = #objref - - -

This operation creates a new instance of a - Event Domain Factory, - which is linked to the invoking process, with settings defined by the - given options. Allowed options are the same as for - .

-
-
- - stop_factory(Factory) -> Reply - Terminate the target object - - Factory = #objref - Reply = ok | {'EXCEPTION', E} - - -

This operation stop the target factory.

-
-
-
- -
- diff --git a/lib/cosEventDomain/doc/src/notes.xml b/lib/cosEventDomain/doc/src/notes.xml deleted file mode 100644 index bd0a119ad2..0000000000 --- a/lib/cosEventDomain/doc/src/notes.xml +++ /dev/null @@ -1,331 +0,0 @@ - - - - -
- - 20012016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosEventDomain Release Notes - Niclas Eklund - - - - 2001-08-20 - A - notes.xml -
- -
cosEventDomain 1.2.2 - -
Fixed Bugs and Malfunctions - - -

Removed all old unused files in the documentation. -

-

- Own Id: OTP-14475 Aux Id: ERL-409, PR-1493

-
-
-
- -
- -
cosEventDomain 1.2.1 - -
Improvements and New Features - - -

- Internal changes

-

- Own Id: OTP-13551

-
-
-
- -
- -
cosEventDomain 1.2 - -
Improvements and New Features - - -

Remove the usage of erlang:now() from all Corba - applications and use the new rand module instead of - random.

-

- Own Id: OTP-12687

-
-
-
- -
- -
cosEventDomain 1.1.14 - -
Improvements and New Features - - -

The default encoding of Erlang files has been changed - from ISO-8859-1 to UTF-8.

The encoding of XML - files has also been changed to UTF-8.

-

- Own Id: OTP-10907

-
-
-
- -
- -
cosEventDomain 1.1.13 - -
Improvements and New Features - - -

- Misc build updates

-

- Own Id: OTP-10784

-
-
-
- -
- -
cosEventDomain 1.1.12 - -
Improvements and New Features - - -

Erlang/OTP can now be built using parallel make if you - limit the number of jobs, for instance using 'make - -j6' or 'make -j10'. 'make -j' does not - work at the moment because of some missing - dependencies.

-

- Own Id: OTP-9451

-
-
-
- -
- -
- cosEventDomain 1.1.11 - -
- Improvements and New Features - - -

- Removed superfluous usage of shy in the documentation since it can cause problem if - a buggy tool is used.

-

- Own Id: OTP-9319 Aux Id:

-
-
-
-
- -
- cosEventDomain 1.1.10 - -
- Improvements and New Features - - -

- Eliminated Dialyzer warnings when using exit or throw.

-

- Own Id: OTP-9050 Aux Id:

-
-
-
-
- -
- cosEventDomain 1.1.9 - -
- Improvements and New Features - - -

- Test suites published.

-

- Own Id: OTP-8543 Aux Id:

-
-
-
-
- -
- cosEventDomain 1.1.8 - -
- Fixed Bugs and Malfunctions - - -

Removed superfluous VT in the documentation.

-

Own id: OTP-8353 Aux Id:

-
- -

The documentation EIX file was not generated.

-

Own id: OTP-8355 Aux Id:

-
-
-
-
- -
- cosEventDomain 1.1.7 - -
- Improvements and New Features - - -

- The documentation is now built with open source tools (xsltproc and fop) - that exists on most platforms. One visible change is that the frames are removed.

-

- Own Id: OTP-8201 Aux Id:

-
-
-
-
- -
- cosEventDomain 1.1.6 - -
- Improvements and New Features - - -

Obsolete guards, e.g. record vs is_record, has been changed - to avoid compiler warnings.

-

Own id: OTP-7987

-
-
-
-
- -
- cosEventDomain 1.1.5 - -
- Improvements and New Features - - -

Updated file headers.

-

Own id: OTP-7837

-
-
-
-
- -
- cosEventDomain 1.1.4 - -
- Improvements and New Features - - -

Documentation source included in open source releases.

-

Own id: OTP-7595

-
-
-
-
- -
- cosEventDomain 1.1.3 - -
- Improvements and New Features - - -

Updated file headers.

-

Own id: OTP-7011

-
-
-
-
- -
- cosEventDomain 1.1.2 - -
- Improvements and New Features - - -

The documentation source has been converted from SGML to XML.

-

Own id: OTP-6754

-
-
-
-
- -
- cosEventDomain 1.1.1 - -
- Improvements and New Features - - -

Minor Makefile changes.

-

Own id: OTP-6701

-
-
-
-
- -
- cosEventDomain 1.1 - -
- Improvements and New Features - - -

The stub/skeleton-files generated by IC have been improved, - i.e., depending on the IDL-files, reduced the size of the - erl- and beam-files and decreased dependencies off Orber's - Interface Repository. It is necessary to re-compile all IDL-files - and use COS-applications, including Orber, compiled with - IC-4.2.

-

Own id: OTP-4576

-
-
-
-
- -
- cosEventDomain 1.0 - -
- Improvements and New Features - - -

First release of the cosEventDomain application.

-
-
-
-
-
- diff --git a/lib/cosEventDomain/doc/src/part.xml b/lib/cosEventDomain/doc/src/part.xml deleted file mode 100644 index 328fdfc20f..0000000000 --- a/lib/cosEventDomain/doc/src/part.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - -
- - 20012016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosEventDomain User's Guide - Niclas Eklund - - 2001-08-20 - 1.0 -
- -

The cosEventDomain application is an Erlang implementation of a - CORBA Service CosEventDomainAdmin.

-
- - - - -
- diff --git a/lib/cosEventDomain/doc/src/ref_man.xml b/lib/cosEventDomain/doc/src/ref_man.xml deleted file mode 100644 index 14b826e4f9..0000000000 --- a/lib/cosEventDomain/doc/src/ref_man.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - -
- - 20012016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosEventDomain Reference Manual - Niclas Eklund - - 2001-08-20 - 1.0 -
- -

The cosEventDomain application is an Erlang implementation of - a CORBA Service CosEventDomainAdmin.

-
- - - - -
- diff --git a/lib/cosEventDomain/ebin/.gitignore b/lib/cosEventDomain/ebin/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosEventDomain/example/.gitignore b/lib/cosEventDomain/example/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosEventDomain/include/.gitignore b/lib/cosEventDomain/include/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosEventDomain/info b/lib/cosEventDomain/info deleted file mode 100644 index 46ecf9504d..0000000000 --- a/lib/cosEventDomain/info +++ /dev/null @@ -1,2 +0,0 @@ -group: orb -short: Orber OMG Event Domain Service diff --git a/lib/cosEventDomain/src/CosEventDomainAdmin.cfg b/lib/cosEventDomain/src/CosEventDomainAdmin.cfg deleted file mode 100644 index 75a2720088..0000000000 --- a/lib/cosEventDomain/src/CosEventDomainAdmin.cfg +++ /dev/null @@ -1,4 +0,0 @@ -{this, "CosEventDomainAdmin::EventDomain"}. -{{handle_info, "CosEventDomainAdmin::EventDomain"}, true}. -{this, "CosEventDomainAdmin::EventDomainFactory"}. -{{handle_info, "CosEventDomainAdmin::EventDomainFactory"}, true}. diff --git a/lib/cosEventDomain/src/CosEventDomainAdmin.idl b/lib/cosEventDomain/src/CosEventDomainAdmin.idl deleted file mode 100644 index 2ecd935c67..0000000000 --- a/lib/cosEventDomain/src/CosEventDomainAdmin.idl +++ /dev/null @@ -1,280 +0,0 @@ -#ifndef _COS_EVENT_DOMAIN_ADMIN_IDL_ -#define _COS_EVENT_DOMAIN_ADMIN_IDL_ - -#pragma prefix "omg.org" - -// Event Domain Interface -#include "CosNotification.idl" -#include "CosEventComm.idl" -#include "CosNotifyComm.idl" -#include "CosNotifyChannelAdmin.idl" - - -module CosEventDomainAdmin { - - // The following constant declarations define the Event Domain - // QoS property names and the associated values each property can - // take on. The name/value pairs for each Event Domain property - // are grouped, beginning with a string constant defined for the - // property name, followed by the values the property can take on. - - const string CycleDetection = "CycleDetection"; - const short AuthorizeCycles = 0; // Default value - const short ForbidCycles = 1; - - const string DiamondDetection = "DiamondDetection"; - const short AuthorizeDiamonds = 0; // Default value - const short ForbidDiamonds = 1; - - - // The following enum declaration defines the types that a channel - // can be of. It is used to specify channel types while externalizing - // and instantiating topologies. - enum ChannelType - { - CHANNEL, - TYPED_CHANNEL, - LOG_CHANNEL, - TYPED_LOG_CHANNEL - }; - - enum NotificationStyle { - Push, - Pull - }; - - typedef long MemberID; - typedef sequence MemberIDSeq; - typedef long ConnectionID; - typedef sequence ConnectionIDSeq; - - struct Connection { - MemberID supplier_id; - MemberID consumer_id; - CosNotifyChannelAdmin::ClientType ctype; - NotificationStyle notification_style; - }; - - - typedef MemberIDSeq Route; - typedef sequence RouteSeq; - - typedef Route Cycle; - typedef sequence CycleSeq; - - typedef RouteSeq Diamond; - typedef sequence DiamondSeq; - - exception CycleCreationForbidden - { - Cycle cyc; - }; - - exception DiamondCreationForbidden - { - Diamond diam; - }; - - // Forward declarations - interface ConsumerAdmin; - interface SupplierAdmin; - - - typedef long DomainID; - typedef sequence DomainIDSeq; - typedef long ItemID; - - - // EventDomain administrates EventChannels that reside in the same - // administrative domain - exception ConnectionNotFound {}; - exception AlreadyExists {}; - - - interface EventDomain : - CosNotification::QoSAdmin , - CosNotification::AdminPropertiesAdmin { - - MemberID add_channel ( in CosNotifyChannelAdmin::EventChannel channel ); - - MemberIDSeq get_all_channels (); - - CosNotifyChannelAdmin::EventChannel get_channel ( in MemberID channel ) - raises ( CosNotifyChannelAdmin::ChannelNotFound ); - - void remove_channel ( in MemberID channel) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - ConnectionID add_connection ( in Connection connection) - raises (CosNotifyChannelAdmin::ChannelNotFound, - CosEventChannelAdmin::TypeError, - AlreadyExists, - CycleCreationForbidden, - DiamondCreationForbidden); - - ConnectionIDSeq get_all_connections (); - - Connection get_connection ( in ConnectionID connection ) - raises ( ConnectionNotFound ); - - void remove_connection ( in ConnectionID connection ) - raises ( ConnectionNotFound ); - - CosNotifyChannelAdmin::ChannelIDSeq get_offer_channels ( in MemberID channel ) - raises ( CosNotifyChannelAdmin::ChannelNotFound ); - - CosNotifyChannelAdmin::ChannelIDSeq get_subscription_channels ( in MemberID channel ) - raises ( CosNotifyChannelAdmin::ChannelNotFound ); - - void destroy(); - - // Cycle and diamond configurations listing - CycleSeq get_cycles(); - - DiamondSeq get_diamonds(); - - - // Connection of clients to the domain - // - using no specific information - // - for any clients - void set_default_consumer_channel(in MemberID channel) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - void set_default_supplier_channel(in MemberID channel) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - CosNotifyChannelAdmin::ProxyPushSupplier - connect_push_consumer(in CosEventComm::PushConsumer client) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - CosNotifyChannelAdmin::ProxyPullSupplier - connect_pull_consumer(in CosEventComm::PullConsumer client) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - CosNotifyChannelAdmin::ProxyPushConsumer - connect_push_supplier(in CosEventComm::PushSupplier client) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - CosNotifyChannelAdmin::ProxyPullConsumer - connect_pull_supplier(in CosEventComm::PullSupplier client) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - // - for structured clients - CosNotifyChannelAdmin::StructuredProxyPushSupplier - connect_structured_push_consumer(in CosNotifyComm::StructuredPushConsumer client) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - CosNotifyChannelAdmin::StructuredProxyPullSupplier - connect_structured_pull_consumer(in CosNotifyComm::StructuredPullConsumer client) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - CosNotifyChannelAdmin::StructuredProxyPushConsumer - connect_structured_push_supplier(in CosNotifyComm::StructuredPushSupplier client) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - CosNotifyChannelAdmin::StructuredProxyPullConsumer - connect_structured_pull_supplier(in CosNotifyComm::StructuredPullSupplier client) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - // - for sequence clients - CosNotifyChannelAdmin::SequenceProxyPushSupplier - connect_sequence_push_consumer(in CosNotifyComm::SequencePushConsumer client) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - CosNotifyChannelAdmin::SequenceProxyPullSupplier - connect_sequence_pull_consumer(in CosNotifyComm::SequencePullConsumer client) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - CosNotifyChannelAdmin::SequenceProxyPushConsumer - connect_sequence_push_supplier(in CosNotifyComm::SequencePushSupplier client) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - CosNotifyChannelAdmin::SequenceProxyPullConsumer - connect_sequence_pull_supplier(in CosNotifyComm::SequencePullSupplier client) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - // - using a channel id - // - for any clients - CosNotifyChannelAdmin::ProxyPushSupplier - connect_push_consumer_with_id(in CosEventComm::PushConsumer client, - in MemberID channel) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - CosNotifyChannelAdmin::ProxyPullSupplier - connect_pull_consumer_with_id(in CosEventComm::PullConsumer client, - in MemberID channel) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - CosNotifyChannelAdmin::ProxyPushConsumer - connect_push_supplier_with_id(in CosEventComm::PushSupplier client, - in MemberID channel) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - CosNotifyChannelAdmin::ProxyPullConsumer - connect_pull_supplier_with_id(in CosEventComm::PullSupplier client, - in MemberID channel) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - // - for structured clients - CosNotifyChannelAdmin::StructuredProxyPushSupplier - connect_structured_push_consumer_with_id(in CosNotifyComm::StructuredPushConsumer client, - in MemberID channel) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - CosNotifyChannelAdmin::StructuredProxyPullSupplier - connect_structured_pull_consumer_with_id(in CosNotifyComm::StructuredPullConsumer client, - in MemberID channel) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - CosNotifyChannelAdmin::StructuredProxyPushConsumer - connect_structured_push_supplier_with_id(in CosNotifyComm::StructuredPushSupplier client, - in MemberID channel) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - CosNotifyChannelAdmin::StructuredProxyPullConsumer - connect_structured_pull_supplier_with_id(in CosNotifyComm::StructuredPullSupplier client, - in MemberID channel) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - // - for sequence clients - CosNotifyChannelAdmin::SequenceProxyPushSupplier - connect_sequence_push_consumer_with_id(in CosNotifyComm::SequencePushConsumer client, - in MemberID channel) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - CosNotifyChannelAdmin::SequenceProxyPullSupplier - connect_sequence_pull_consumer_with_id(in CosNotifyComm::SequencePullConsumer client, - in MemberID channel) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - CosNotifyChannelAdmin::SequenceProxyPushConsumer - connect_sequence_push_supplier_with_id(in CosNotifyComm::SequencePushSupplier client, - in MemberID channel) - raises (CosNotifyChannelAdmin::ChannelNotFound); - - CosNotifyChannelAdmin::SequenceProxyPullConsumer - connect_sequence_pull_supplier_with_id(in CosNotifyComm::SequencePullSupplier client, - in MemberID channel) - raises (CosNotifyChannelAdmin::ChannelNotFound); - }; - - exception DomainNotFound {}; - - interface EventDomainFactory { - - EventDomain create_event_domain( in CosNotification::QoSProperties initialQoS , - in CosNotification::AdminProperties initialAdmin, - out DomainID id ) - raises ( CosNotification::UnsupportedQoS, - CosNotification::UnsupportedAdmin ); - - DomainIDSeq get_all_domains (); - - EventDomain get_event_domain ( - in DomainID id ) - raises ( DomainNotFound ); - }; -}; - -#endif // _COS_EVENT_DOMAIN_ADMIN_IDL_ - diff --git a/lib/cosEventDomain/src/CosEventDomainAdmin_EventDomainFactory_impl.erl b/lib/cosEventDomain/src/CosEventDomainAdmin_EventDomainFactory_impl.erl deleted file mode 100644 index 75ff81196c..0000000000 --- a/lib/cosEventDomain/src/CosEventDomainAdmin_EventDomainFactory_impl.erl +++ /dev/null @@ -1,183 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosEventDomainAdmin_EventDomainFactory_impl.erl -%% Description : -%% -%%---------------------------------------------------------------------- --module('CosEventDomainAdmin_EventDomainFactory_impl'). - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). --include_lib("cosNotification/include/CosNotification.hrl"). - --include("CosEventDomainAdmin.hrl"). --include("cosEventDomainApp.hrl"). - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- --export([init/1, - terminate/2, - code_change/3, - handle_info/2]). - --export([create_event_domain/4, - get_all_domains/2, - get_event_domain/3]). - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- --export([]). - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {current_id = -1, domains = []}). - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%---------------------------------------------------------------------- -init([]) -> - process_flag(trap_exit, true), - {ok, #state{}}. - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Returns : any (ignored by gen_server) -%% Description: Shutdown the server -%%---------------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -%%---------------------------------------------------------------------- -%% Function : code_change/3 -%% Returns : {ok, NewState} -%% Description: Convert process state when code is changed -%%---------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%---------------------------------------------------------------------- -%% Function : handle_info/2 -%% Returns : {noreply, State} | -%% {stop, Reason, State} -%% Description: Handle, for example, exit signals. -%%---------------------------------------------------------------------- -handle_info({'EXIT', Pid, _Reason}, State) -> - {noreply, State#state{domains=delete_domain(State#state.domains, Pid, [])}}; -handle_info(_Info, State) -> - {noreply, State}. - - -%%---------------------------------------------------------------------- -%% Function : create_event_domain -%% Arguments : InitialQoS - CosNotification::QoSProperties -%% InitialAdmin - CosNotification::AdminProperties -%% Returns : CosEventDomainAdmin::EventDomain | -%% {'EXCEPTION', #'CosNotification_UnsupportedQoS'{}} | -%% {'EXCEPTION', #'CosNotification_UnsupportedAdmin'{}} | -%% Description: -%%---------------------------------------------------------------------- -create_event_domain(_OE_This, State, InitialQoS, InitialAdmin) -> - Id = cosEventDomainApp:create_id(State#state.current_id), - Admin = cosEventDomainApp:get_admin(InitialAdmin), - QoS = cosEventDomainApp:get_qos(InitialQoS), - case catch 'CosEventDomainAdmin_EventDomain':oe_create_link([self(), Id, - QoS, Admin], - [{sup_child, true}]) of - {ok, Pid, ED} -> - {reply, {ED, Id}, State#state{current_id = Id, - domains = [{Id, ED, Pid}|State#state.domains]}}; - What -> - orber:dbg("[~p] CosEventDomainAdmin_EventDomainFactory:" - "create_event_domain();~n" - "Failed creatin a new EventDomain due to: ~p", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%---------------------------------------------------------------------- -%% Function : get_all_domains -%% Arguments : - -%% Returns : CosEventDomainAdmin::DomainIDSeq - [long()] -%% Description: -%%---------------------------------------------------------------------- -get_all_domains(_OE_This, State) -> - {reply, get_all_domains_helper(State#state.domains, []), State}. - -get_all_domains_helper([], Acc) -> - Acc; -get_all_domains_helper([{Id, _, _}|T], Acc) -> - get_all_domains_helper(T, [Id|Acc]). - - -%%---------------------------------------------------------------------- -%% Function : get_event_domain -%% Arguments : CosEventDomainAdmin::DomainID - long() -%% Returns : CosEventDomainAdmin::EventDomain | -%% {'EXCEPTION', #'CosEventDomainAdmin_DomainNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -get_event_domain(_OE_This, State, DomainID) -> - {reply, get_event_domain_helper(State#state.domains, DomainID), State}. - -get_event_domain_helper([], _) -> - corba:raise(#'CosEventDomainAdmin_DomainNotFound'{}); -get_event_domain_helper([{Id, ED, _}|_], Id) -> - ED; -get_event_domain_helper([_|T], Id) -> - get_event_domain_helper(T, Id). - -%%====================================================================== -%% Internal functions -%%====================================================================== -delete_domain([], _, Acc) -> - %% The domain didn't exist. - Acc; -delete_domain([{_Id, _, Pid}], Pid, Acc) -> - Acc; -delete_domain([{_Id, _, Pid}|T], Pid, Acc) -> - T++Acc; -delete_domain([H|T], Pid, Acc) -> - delete_domain(T, Pid, [H|Acc]). - -%%====================================================================== -%% END OF MODULE -%%====================================================================== - diff --git a/lib/cosEventDomain/src/CosEventDomainAdmin_EventDomain_impl.erl b/lib/cosEventDomain/src/CosEventDomainAdmin_EventDomain_impl.erl deleted file mode 100644 index a31a70acc2..0000000000 --- a/lib/cosEventDomain/src/CosEventDomainAdmin_EventDomain_impl.erl +++ /dev/null @@ -1,1426 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosEventDomainAdmin_EventDomain_impl.erl -%% Description : -%% -%%---------------------------------------------------------------------- --module('CosEventDomainAdmin_EventDomain_impl'). - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). --include_lib("cosNotification/include/CosNotifyChannelAdmin.hrl"). --include_lib("cosNotification/include/CosNotification.hrl"). - --include("cosEventDomainApp.hrl"). --include("CosEventDomainAdmin.hrl"). - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- --export([init/1, - terminate/2, - code_change/3, - handle_info/2]). - -%%------------------ CosEventDomainAdmin::EventDomain ------------------ --export([add_channel/3, - get_all_channels/2, - get_channel/3, - remove_channel/3, - add_connection/3, - get_all_connections/2, - get_connection/3, - remove_connection/3, - get_offer_channels/3, - get_subscription_channels/3, - destroy/2, - get_cycles/2, - get_diamonds/2, - set_default_consumer_channel/3, - set_default_supplier_channel/3, - connect_push_consumer/3, - connect_pull_consumer/3, - connect_push_supplier/3, - connect_pull_supplier/3, - connect_structured_push_consumer/3, - connect_structured_pull_consumer/3, - connect_structured_push_supplier/3, - connect_structured_pull_supplier/3, - connect_sequence_push_consumer/3, - connect_sequence_pull_consumer/3, - connect_sequence_push_supplier/3, - connect_sequence_pull_supplier/3, - connect_push_consumer_with_id/4, - connect_pull_consumer_with_id/4, - connect_push_supplier_with_id/4, - connect_pull_supplier_with_id/4, - connect_structured_push_consumer_with_id/4, - connect_structured_pull_consumer_with_id/4, - connect_structured_push_supplier_with_id/4, - connect_structured_pull_supplier_with_id/4, - connect_sequence_push_consumer_with_id/4, - connect_sequence_pull_consumer_with_id/4, - connect_sequence_push_supplier_with_id/4, - connect_sequence_pull_supplier_with_id/4]). - -%%------------------ CosNotification::QoSAdmin ------------------------- --export([get_qos/2, - set_qos/3, - validate_qos/3]). - -%%------------------ CosNotification::AdminPropertiesAdmin ------------- --export([get_admin/2, - set_admin/3]). - - - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- --export([]). - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {parent_pid, id, graph, ch_counter=-1, - co_counter=-1, def_supplier, def_consumer, diamonds, cyclic}). - --record(connection, {supplier, consumer, data}). - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%---------------------------------------------------------------------- -init([ParentPid, MyId, QoS, _Admin]) -> - process_flag(trap_exit, true), - Diamonds = case lists:keysearch(?DiamondDetection, 1, QoS) of - false -> - ?ForbidDiamonds; - {value, {_, Value}} -> - Value - end, - case lists:keysearch(?CycleDetection, 1, QoS) of - {value, {_, ?AuthorizeCycles}} -> - {ok, #state{parent_pid = ParentPid, id = MyId, - graph = digraph:new([private]), - diamonds = Diamonds, cyclic = ?AuthorizeCycles}}; - _ -> - {ok, #state{parent_pid = ParentPid, id = MyId, - graph = digraph:new([acyclic, private]), - diamonds = Diamonds, cyclic = ?ForbidCycles}} - end. - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Returns : any (ignored by gen_server) -%% Description: Shutdown the server -%%---------------------------------------------------------------------- -terminate(_Reason, #state{graph = DG} = _State) -> - Connections = digraph:edges(DG), - close_connections(DG, Connections), - digraph:delete(DG), - ok. - -%%---------------------------------------------------------------------- -%% Function : code_change/3 -%% Returns : {ok, NewState} -%% Description: Convert process state when code is changed -%%---------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%---------------------------------------------------------------------- -%% Function : handle_info/2 -%% Returns : {noreply, State} | -%% {stop, Reason, State} -%% Description: Handle, for example, exit signals. -%%---------------------------------------------------------------------- -handle_info({'EXIT', Pid, Reason}, #state{parent_pid = Pid} = State) -> - {stop, Reason, State}; -handle_info(_Info, State) -> - {noreply, State}. - -%%---------------------------------------------------------------------- -%%------------------ CosEventDomainAdmin::EventDomain ------------------ -%%---------------------------------------------------------------------% -%% Function : add_channel -%% Arguments : Channel - CosNotifyChannelAdmin::EventChannel -%% Returns : MemberId - long() -%% Description: -%%---------------------------------------------------------------------- -add_channel(_OE_This, #state{ch_counter=C, graph = DG} = State, Channel) -> - type_check(Channel, 'CosNotifyChannelAdmin_EventChannel'), - Id = cosEventDomainApp:create_id(C), - digraph:add_vertex(DG, Id, Channel), - {reply, Id, State#state{ch_counter=Id}}. - -%%---------------------------------------------------------------------% -%% Function : get_all_channels -%% Arguments : - -%% Returns : CosEventDomainAdmin::MemberIDSeq ([long()]) -%% Description: -%%---------------------------------------------------------------------- -get_all_channels(_OE_This, #state{graph = DG} = State) -> - {reply, digraph:vertices(DG), State}. - -%%---------------------------------------------------------------------% -%% Function : get_channel -%% Arguments : Id - CosEventDomainAdmin::MemberID (long()) -%% Returns : CosNotifyChannelAdmin::EventChannel | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} -%% Description: -%%---------------------------------------------------------------------- -get_channel(_OE_This, #state{graph = DG} = State, Id) -> - {reply, lookup_channel(DG, Id), State}. - -%%---------------------------------------------------------------------% -%% Function : remove_channel -%% Arguments : Id - CosEventDomainAdmin::MemberID (long()) -%% Returns : ok | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} -%% Description: -%%---------------------------------------------------------------------- -remove_channel(_OE_This, #state{graph = DG} = State, Id) -> - lookup_channel(DG, Id), - close_connections(DG, digraph:edges(DG, Id)), - digraph:del_vertex(DG, Id), - {reply, ok, State}. - -%%---------------------------------------------------------------------% -%% Function : add_connection -%% Arguments : Connection - CosEventDomainAdmin::Connection -%% Returns : ConnectionID | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_TypeError'{}} | -%% {'EXCEPTION', #'CosEventDomainAdmin_AlreadyExists'{}} | -%% {'EXCEPTION', #'CosEventDomainAdmin_CycleCreationForbidden'{cyc}} | -%% {'EXCEPTION', #'CosEventDomainAdmin_DiamondCreationForbidden'{diam}} -%% Description: -%%---------------------------------------------------------------------- -add_connection(_OE_This, #state{graph = DG, co_counter = C} = State, - Connection) when is_record(Connection, - 'CosEventDomainAdmin_Connection') -> - SId = Connection#'CosEventDomainAdmin_Connection'.supplier_id, - SChannel = lookup_channel(DG, SId), - CId = Connection#'CosEventDomainAdmin_Connection'.consumer_id, - CChannel = lookup_channel(DG, CId), - case lists:member(CId, digraph:out_neighbours(DG, SId)) of - false -> - Id = cosEventDomainApp:create_id(C), - %% Try to insert the new connection before we actually setup a connection. - %% Note that #connection is NOT complete, hence, we must update it later. - case digraph:add_edge(DG, Id, SId, CId, #connection{data=Connection}) of - {error, {bad_edge, Path}} -> - corba:raise(#'CosEventDomainAdmin_CycleCreationForbidden'{cyc=Path}); - Id when State#state.diamonds == ?AuthorizeDiamonds -> - case catch setup_connection(Connection, SChannel, CChannel) of - {ok, SProxy, CProxy} -> - %% Now we can update the connection with complete data. - digraph:add_edge(DG, Id, SId, CId, #connection{supplier=SProxy, - consumer=CProxy, - data=Connection}), - {reply, Id, State#state{co_counter = Id}}; - {'EXCEPTION', E} -> - digraph:del_edge(DG, Id), - corba:raise(E); - What -> - digraph:del_edge(DG, Id), - orber:dbg("[~p] CosEventDomainAdmin_EventDomain:" - "add_connection(~p);~nFailed setting up" - " connection due to: ~p", - [?LINE, Connection, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_MAYBE}) - end; - Id -> - case get_diamonds_helper(State, false, SId) of - [] -> - case catch setup_connection(Connection, SChannel, CChannel) of - {ok, SProxy, CProxy} -> - %% Now we can update the connection with complete data. - digraph:add_edge(DG, Id, SId, CId, #connection{supplier=SProxy, - consumer=CProxy, - data=Connection}), - {reply, Id, State#state{co_counter = Id}}; - {'EXCEPTION', E} -> - digraph:del_edge(DG, Id), - corba:raise(E); - What -> - digraph:del_edge(DG, Id), - orber:dbg("[~p] CosEventDomainAdmin_EventDomain:" - "add_connection(~p);~nFailed setting" - " up connection due to: ~p", - [?LINE, Connection, What], - ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_MAYBE}) - end; - Diamond -> - %% Since no diamonds should exist the returned list can - %% only describe the diamond we just created. - digraph:del_edge(DG, Id), - corba:raise(#'CosEventDomainAdmin_DiamondCreationForbidden' - {diam=Diamond}) - end - end; - true -> - corba:raise(#'CosEventDomainAdmin_AlreadyExists'{}) - end. - - -%%---------------------------------------------------------------------% -%% Function : get_all_connections -%% Arguments : - -%% Returns : CosEventDomainAdmin::ConnectionIDSeq - [long()] -%% Description: -%%---------------------------------------------------------------------- -get_all_connections(_OE_This, #state{graph = DG} = State) -> - {reply, digraph:edges(DG), State}. - -%%---------------------------------------------------------------------% -%% Function : get_connection -%% Arguments : Id - CosEventDomainAdmin::ConnectionID (long()) -%% Returns : CosEventDomainAdmin::Connection | -%% {'EXCEPTION', #'CosEventDomainAdmin_ConnectionNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -get_connection(_OE_This, #state{graph = DG} = State, Id) -> - {reply, lookup_connection_data(DG, Id), State}. - -%%---------------------------------------------------------------------% -%% Function : remove_connection -%% Arguments : Id - CosEventDomainAdmin::ConnectionID (long()) -%% Returns : ok | -%% {'EXCEPTION', #'CosEventDomainAdmin_ConnectionNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -remove_connection(_OE_This, #state{graph = DG} = State, Id) -> - #connection{supplier=S, consumer=C, data=Connection} = - lookup_connection(DG, Id), - close_connection(Connection, S, C), - digraph:del_edge(DG, Id), - {reply, ok, State}. - - -%%---------------------------------------------------------------------% -%% Function : get_offer_channels -%% Arguments : Id - CosEventDomainAdmin::MemberID (long()) -%% Returns : CosNotifyChannelAdmin::ChannelIDSeq | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -get_offer_channels(_OE_This, #state{graph = DG, cyclic = Cyclic} = State, Id) -> - lookup_channel(DG, Id), - case digraph:vertex(DG, Id) of - {Id, _Channel} when Cyclic == ?ForbidCycles -> - {reply, digraph_utils:reaching_neighbours([Id], DG), State}; - {Id, _Channel} -> - %% If cyclic graphs is allowed 'Id' will appear in the returned list. - %% Hence, we must delete it. - {reply,lists:delete(Id, digraph_utils:reaching_neighbours([Id], DG)), - State}; - false -> - corba:raise(#'CosNotifyChannelAdmin_ChannelNotFound'{}) - end. - -%%---------------------------------------------------------------------% -%% Function : get_subscription_channels -%% Arguments : Id - CosEventDomainAdmin::MemberID (long()) -%% Returns : CosNotifyChannelAdmin::ChannelIDSeq | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -get_subscription_channels(_OE_This, #state{graph = DG, cyclic = Cyclic} = State, Id) -> - lookup_channel(DG, Id), - case digraph:vertex(DG, Id) of - {Id, _Channel} when Cyclic == ?ForbidCycles -> - {reply, digraph_utils:reachable_neighbours([Id], DG), State}; - {Id, _Channel} -> - %% If cyclic graphs is allowed 'Id' will appear in the returned list. - %% Hence, we must delete it. - {reply, lists:delete(Id, digraph_utils:reachable_neighbours([Id], DG)), - State}; - false -> - corba:raise(#'CosNotifyChannelAdmin_ChannelNotFound'{}) - end. - -%%---------------------------------------------------------------------% -%% Function : destroy -%% Arguments : - -%% Returns : ok -%% Description: -%%---------------------------------------------------------------------- -destroy(_OE_This, #state{graph = _DG} = State) -> - {stop, normal, ok, State}. - -%%---------------------------------------------------------------------% -%% Function : get_cycles -%% Arguments : - -%% Returns : CosEventDomainAdmin::CycleSeq -%% Description: -%%---------------------------------------------------------------------- -get_cycles(_OE_This, #state{cyclic = ?ForbidCycles} = State) -> - {reply, [], State}; -get_cycles(_OE_This, #state{graph = DG} = State) -> - {reply, digraph_utils:cyclic_strong_components(DG), State}. - -%%---------------------------------------------------------------------- -%% Function : get_diamonds -%% Arguments : - -%% Returns : CosEventDomainAdmin::DiamondSeq -%% Description: -%%---------------------------------------------------------------------- -get_diamonds(_OE_This, #state{diamonds = ?ForbidDiamonds} = State) -> - {reply, [], State}; -get_diamonds(_OE_This, State) -> - {reply, get_diamonds_helper(State, true), State}. - -get_diamonds_helper(#state{graph = DG} = _State, FindAll) -> - case find_candidates(DG) of - {[], _, _} -> - []; - {_, [], _} -> - []; - {COut, CIn, Max} -> - %% In this case we cannot tell if a diamond exists. Got to - %% check the paths between the candidates. - evaluate_candidates(DG, COut, CIn, [], Max, FindAll) - end. - -get_diamonds_helper(#state{graph = DG} = _State, FindAll, Vertex) -> - case find_candidates(DG, Vertex) of - {[], _, _} -> - []; - {_, [], _} -> - []; - {COut, CIn, Max} -> - %% In this case we cannot tell if a diamond exists. Got to - %% check the paths between the candidates. - evaluate_candidates(DG, COut, CIn, [], Max, FindAll) - end. - -%%---------------------------------------------------------------------% -%% Function : set_default_consumer_channel -%% Arguments : Id - CosEventDomainAdmin::MemberID (long()) -%% Returns : ok | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -set_default_consumer_channel(_OE_This, #state{graph = DG} = State, Id) -> - lookup_channel(DG, Id), - {reply, ok, State#state{def_consumer=Id}}. - -%%---------------------------------------------------------------------% -%% Function : set_default_supplier_channel -%% Arguments : Id - CosEventDomainAdmin::MemberID (long()) -%% Returns : ok | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -set_default_supplier_channel(_OE_This, #state{graph = DG} = State, Id) -> - lookup_channel(DG, Id), - {reply, ok, State#state{def_supplier=Id}}. - -%%---------------------------------------------------------------------% -%% Function : connect_push_consumer -%% Arguments : PC - CosEventComm::PushConsumer -%% Returns : CosNotifyChannelAdmin::ProxyPushSupplier | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_push_consumer(_OE_This, #state{def_supplier = Ch} = State, PC) -> - type_check(PC, 'CosEventComm_PushConsumer'), - Proxy = connect_a_push_consumer(Ch, PC, 'ANY_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_pull_consumer -%% Arguments : PC - CosEventComm::PullConsumer -%% Returns : CosNotifyChannelAdmin::ProxyPullSupplier | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_pull_consumer(_OE_This, #state{def_consumer = Ch} = State, PC) -> - Proxy = connect_a_pull_consumer(Ch, PC, 'ANY_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_push_supplier -%% Arguments : PS - CosEventComm::PushSupplier -%% Returns : CosNotifyChannelAdmin::ProxyPushConsumer | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_push_supplier(_OE_This, #state{def_supplier = Ch} = State, PS) -> - Proxy = connect_a_push_supplier(Ch, PS, 'ANY_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_pull_supplier -%% Arguments : PS - CosEventComm::PullSupplier -%% Returns : CosNotifyChannelAdmin::ProxyPullConsumer -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_pull_supplier(_OE_This, #state{def_consumer = Ch} = State, PS) -> - type_check(PS, 'CosEventComm_PullSupplier'), - Proxy = connect_a_pull_supplier(Ch, PS, 'ANY_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_structured_push_consumer -%% Arguments : PC - CosNotifyComm::StructuredPushConsumer -%% Returns : CosNotifyChannelAdmin::StructuredProxyPushSupplier | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_structured_push_consumer(_OE_This, #state{def_supplier = Ch} = State, PC) -> - type_check(PC, 'CosNotifyComm_StructuredPushConsumer'), - Proxy = connect_a_push_consumer(Ch, PC, 'STRUCTURED_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_structured_pull_consumer -%% Arguments : PC - CosNotifyComm::StructuredPullConsumer -%% Returns : CosNotifyChannelAdmin::StructuredProxyPullSupplier | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_structured_pull_consumer(_OE_This, #state{def_supplier = Ch} = State, PC) -> - Proxy = connect_a_pull_consumer(Ch, PC, 'STRUCTURED_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_structured_push_supplier -%% Arguments : PS - CosNotifyComm::StructuredPushSupplier -%% Returns : CosNotifyChannelAdmin::StructuredProxyPushConsumer | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_structured_push_supplier(_OE_This, #state{def_consumer = Ch} = State, PS) -> - Proxy = connect_a_push_supplier(Ch, PS, 'STRUCTURED_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_structured_pull_supplier -%% Arguments : PS - CosNotifyComm::StructuredPullSupplier -%% Returns : CosNotifyChannelAdmin::StructuredProxyPullConsumer | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_structured_pull_supplier(_OE_This, #state{def_consumer = Ch} = State, PS) -> - type_check(PS, 'CosNotifyComm_StructuredPullSupplier'), - Proxy = connect_a_pull_supplier(Ch, PS, 'STRUCTURED_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_sequence_push_consumer -%% Arguments : PC - CosNotifyComm::SequencePushConsumer -%% Returns : CosNotifyChannelAdmin::SequenceProxyPushSupplier | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_sequence_push_consumer(_OE_This, #state{def_supplier = Ch} = State, PC) -> - type_check(PC, 'CosNotifyComm_SequencePushConsumer'), - Proxy = connect_a_push_consumer(Ch, PC, 'SEQUENCE_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_sequence_pull_consumer -%% Arguments : PC - CosNotifyComm::SequencePullConsumer -%% Returns : CosNotifyChannelAdmin::SequenceProxyPullSupplier | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_sequence_pull_consumer(_OE_This, #state{def_supplier = Ch} = State, PC) -> - Proxy = connect_a_pull_consumer(Ch, PC, 'SEQUENCE_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_sequence_push_supplier -%% Arguments : PS - CosNotifyComm::SequencePushSupplier -%% Returns : CosNotifyChannelAdmin::SequenceProxyPushConsumer | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_sequence_push_supplier(_OE_This, #state{def_consumer = Ch} = State, PS) -> - Proxy = connect_a_push_supplier(Ch, PS, 'SEQUENCE_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_sequence_pull_supplier -%% Arguments : PS - CosNotifyComm::SequencePullSupplier -%% Returns : CosNotifyChannelAdmin::SequenceProxyPullConsumer | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_sequence_pull_supplier(_OE_This, #state{def_consumer = Ch} = State, PS) -> - type_check(PS, 'CosNotifyComm_SequencePullSupplier'), - Proxy = connect_a_pull_supplier(Ch, PS, 'SEQUENCE_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_push_consumer_with_id -%% Arguments : PC - CosEventComm::PushConsumer -%% Id - CosEventDomainAdmin::MemberID (long()) -%% Returns : CosNotifyChannelAdmin::ProxyPushSupplier | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_push_consumer_with_id(_OE_This, #state{graph = DG} = State, PC, Id) -> - type_check(PC, 'CosEventComm_PushConsumer'), - Channel = lookup_channel(DG, Id), - Proxy = connect_a_push_consumer(Channel, PC, 'ANY_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_pull_consumer_with_id -%% Arguments : PC - CosEventComm::PullConsumer -%% Id - CosEventDomainAdmin::MemberID (long()) -%% Returns : CosNotifyChannelAdmin::ProxyPullSupplier | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_pull_consumer_with_id(_OE_This, #state{graph = DG} = State, PC, Id) -> - Channel = lookup_channel(DG, Id), - Proxy = connect_a_pull_consumer(Channel, PC, 'ANY_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_push_supplier_with_id -%% Arguments : PS - CosEventComm::PushSupplier -%% Id - CosEventDomainAdmin::MemberID (long()) -%% Returns : CosNotifyChannelAdmin::ProxyPushConsumer | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_push_supplier_with_id(_OE_This, #state{graph = DG} = State, PS, Id) -> - Channel = lookup_channel(DG, Id), - Proxy = connect_a_push_supplier(Channel, PS, 'ANY_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_pull_supplier_with_id -%% Arguments : PS - CosEventComm::PullSupplier -%% Id - CosEventDomainAdmin::MemberID (long()) -%% Returns : CosNotifyChannelAdmin::ProxyPullConsumer | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_pull_supplier_with_id(_OE_This, #state{graph = DG} = State, PS, Id) -> - type_check(PS, 'CosEventComm_PullSupplier'), - Channel = lookup_channel(DG, Id), - Proxy = connect_a_pull_supplier(Channel, PS, 'ANY_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_structured_push_consumer_with_id -%% Arguments : PC - CosNotifyComm::StructuredPushConsumer -%% Id - CosEventDomainAdmin::MemberID (long()) -%% Returns : CosNotifyChannelAdmin::StructuredProxyPushSupplier | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_structured_push_consumer_with_id(_OE_This, #state{graph = DG} = State, PC, Id) -> - type_check(PC, 'CosNotifyComm_StructuredPushConsumer'), - Channel = lookup_channel(DG, Id), - Proxy = connect_a_push_consumer(Channel, PC, 'STRUCTURED_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_structured_pull_consumer_with_id -%% Arguments : PC - CosNotifyComm::StructuredPullConsumer -%% Id - CosEventDomainAdmin::MemberID (long()) -%% Returns : CosNotifyChannelAdmin::StructuredProxyPullSupplier | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_structured_pull_consumer_with_id(_OE_This, #state{graph = DG} = State, PC, Id) -> - Channel = lookup_channel(DG, Id), - Proxy = connect_a_pull_consumer(Channel, PC, 'STRUCTURED_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_structured_push_supplier_with_id -%% Arguments : PS - CosNotifyComm::StructuredPushSupplier -%% Id - CosEventDomainAdmin::MemberID (long()) -%% Returns : CosNotifyChannelAdmin::StructuredProxyPushConsumer | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_structured_push_supplier_with_id(_OE_This, #state{graph = DG} = State, PS, Id) -> - Channel = lookup_channel(DG, Id), - Proxy = connect_a_push_supplier(Channel, PS, 'STRUCTURED_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_structured_pull_supplier_with_id -%% Arguments : PS - CosNotifyComm::StructuredPullSupplier -%% Id - CosEventDomainAdmin::MemberID (long()) -%% Returns : CosNotifyChannelAdmin::StructuredProxyPullConsumer | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_structured_pull_supplier_with_id(_OE_This, #state{graph = DG} = State, PS, Id) -> - type_check(PS, 'CosNotifyComm_StructuredPullSupplier'), - Channel = lookup_channel(DG, Id), - Proxy = connect_a_pull_supplier(Channel, PS, 'STRUCTURED_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_sequence_push_consumer_with_id -%% Arguments : PC - CosNotifyComm::SequencePushConsumer -%% Id - CosEventDomainAdmin::MemberID (long()) -%% Returns : CosNotifyChannelAdmin::SequenceProxyPushSupplier | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_sequence_push_consumer_with_id(_OE_This, #state{graph = DG} = State, PC, Id) -> - type_check(PC, 'CosNotifyComm_SequencePushConsumer'), - Channel = lookup_channel(DG, Id), - Proxy = connect_a_push_consumer(Channel, PC, 'SEQUENCE_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_sequence_pull_consumer_with_id -%% Arguments : PC - CosNotifyComm::SequencePullConsumer -%% Id - CosEventDomainAdmin::MemberID (long()) -%% Returns : CosNotifyChannelAdmin::SequenceProxyPullSupplier | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_sequence_pull_consumer_with_id(_OE_This, #state{graph = DG} = State, PC, Id) -> - Channel = lookup_channel(DG, Id), - Proxy = connect_a_pull_consumer(Channel, PC, 'SEQUENCE_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_sequence_push_supplier_with_id -%% Arguments : PS - CosNotifyComm::SequencePushSupplier -%% Id - CosEventDomainAdmin::MemberID (long()) -%% Returns : CosNotifyChannelAdmin::SequenceProxyPushConsumer | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_sequence_push_supplier_with_id(_OE_This, #state{graph = DG} = State, PS, Id) -> - Channel = lookup_channel(DG, Id), - Proxy = connect_a_push_supplier(Channel, PS, 'SEQUENCE_EVENT'), - {reply, Proxy, State}. - -%%---------------------------------------------------------------------% -%% Function : connect_sequence_pull_supplier_with_id -%% Arguments : PS - CosNotifyComm::SequencePullSupplier -%% Id - CosEventDomainAdmin::MemberID (long()) -%% Returns : CosNotifyChannelAdmin::SequenceProxyPullConsumer | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} | -%% Description: -%%---------------------------------------------------------------------- -connect_sequence_pull_supplier_with_id(_OE_This, #state{graph = DG} = State, PS, Id) -> - type_check(PS, 'CosNotifyComm_SequencePullSupplier'), - Channel = lookup_channel(DG, Id), - Proxy = connect_a_pull_supplier(Channel, PS, 'SEQUENCE_EVENT'), - {reply, Proxy, State}. - - -%%---------------------------------------------------------------------- -%%------------------ CosNotification::QoSAdmin ------------------------- -%%---------------------------------------------------------------------% -%% Function : get_qos -%% Arguments : - -%% Returns : CosNotification::QoSProperties -%% Description: -%%---------------------------------------------------------------------- -get_qos(_OE_This, #state{cyclic = Cyclic, diamonds = Diamonds} = State) -> - {reply, [#'CosNotification_Property' - {name = ?DiamondDetection, - value = any:create(orber_tc:short(), Diamonds)}, - #'CosNotification_Property' - {name = ?CycleDetection, - value = any:create(orber_tc:short(), Cyclic)}], State}. - -%%---------------------------------------------------------------------% -%% Function : set_qos -%% Arguments : NewQoS - CosNotification::QoSProperties -%% Returns : ok | -%% {'EXCEPTION', #'CosNotification_UnsupportedQoS{}} -%% Description: -%%---------------------------------------------------------------------- -set_qos(_OE_This, State, NewQoS) -> - QoS = cosEventDomainApp:get_qos(NewQoS), - case set_qos_helper(QoS, State, []) of - {ok, NewState} -> - {reply, ok, NewState}; - {error, Errors} -> - corba:raise(#'CosNotification_UnsupportedQoS'{qos_err = Errors}) - end. - -set_qos_helper([], State, []) -> - {ok, State}; %{reply, ok, State}; -set_qos_helper([], _, Errors) -> - {error, Errors}; -set_qos_helper([{?DiamondDetection, Diamonds}|T], #state{diamonds = Diamonds} = State, - Errors) -> - set_qos_helper(T, State, Errors); -set_qos_helper([{?CycleDetection, Cyclic}|T], #state{cyclic = Cyclic} = State, - Errors) -> - set_qos_helper(T, State, Errors); -set_qos_helper([{?DiamondDetection, ?AuthorizeDiamonds}|T], State, Errors) -> - %% Diamonds have not been allowed so far so it's safe to allow it. - set_qos_helper(T, State#state{diamonds = ?AuthorizeDiamonds}, Errors); -set_qos_helper([{?DiamondDetection, ?ForbidDiamonds}|T], State, Errors) -> - %% If any diamonds already exists we cannot allow this. Hence, now we must check - %% if we can update the QoS. - case get_diamonds_helper(State, false) of - [] -> - set_qos_helper(T, State#state{diamonds = ?ForbidDiamonds}, Errors); - _ -> - set_qos_helper(T, State, - [#'CosNotification_PropertyError' - {code = 'UNAVAILABLE_VALUE', - name = ?DiamondDetection, - available_range = #'CosNotification_PropertyRange' - {low_val=any:create(orber_tc:short(), ?AuthorizeDiamonds), - high_val=any:create(orber_tc:short(), ?AuthorizeDiamonds)}}|Errors]) - end; -set_qos_helper([{?CycleDetection, _}|T], #state{cyclic = Cyclic} = State, Errors) -> - %% Currently we do not support changing the Cycle schema. If we want to, - %% we must copy the graph to a new instance of the correct type. - set_qos_helper(T, State, - [#'CosNotification_PropertyError' - {code = 'UNAVAILABLE_VALUE', - name = ?CycleDetection, - available_range = #'CosNotification_PropertyRange' - {low_val=any:create(orber_tc:short(), Cyclic), - high_val=any:create(orber_tc:short(), Cyclic)}}|Errors]). - -%%---------------------------------------------------------------------% -%% Function : validate_qos -%% Arguments : WantedQoS - CosNotification::QoSProperties -%% Returns : {ok, CosNotification::NamedPropertyRangeSeq} | -%% {'EXCEPTION', #'CosNotification_UnsupportedQoS{}} -%% Description: NamedPropertyRangeSeq is of out-type -%%---------------------------------------------------------------------- -validate_qos(_OE_This, State, WantedQoS) -> - QoS = cosEventDomainApp:get_qos(WantedQoS), - case validate_qos_helper(QoS, State, [], []) of - {ok, Properties} -> - {reply, {ok, Properties}, State}; - {error, Errors} -> - corba:raise(#'CosNotification_UnsupportedQoS'{qos_err = Errors}) - end. - -validate_qos_helper([], _, Properties, []) -> - {ok, Properties}; -validate_qos_helper([], _, _, Errors) -> - {error, Errors}; -validate_qos_helper([{?DiamondDetection, ?ForbidDiamonds}|T], State, Properties, - Errors) -> - case get_diamonds_helper(State, false) of - [] -> - Property = - #'CosNotification_NamedPropertyRange' - {name = ?DiamondDetection, - range = #'CosNotification_PropertyRange' - {low_val=any:create(orber_tc:short(), ?AuthorizeDiamonds), - high_val=any:create(orber_tc:short(), ?ForbidDiamonds)}}, - validate_qos_helper(T, State, [Property|Properties], Errors); - _ -> - Error = - #'CosNotification_PropertyError' - {code = 'UNAVAILABLE_VALUE', - name = ?DiamondDetection, - available_range = #'CosNotification_PropertyRange' - {low_val=any:create(orber_tc:short(), ?AuthorizeDiamonds), - high_val=any:create(orber_tc:short(), ?AuthorizeDiamonds)}}, - validate_qos_helper(T, State, Properties, [Error|Errors]) - end; -validate_qos_helper([{?DiamondDetection, ?AuthorizeDiamonds}|T], State, Properties, - Errors) -> - Property = - #'CosNotification_NamedPropertyRange' - {name = ?DiamondDetection, - range = #'CosNotification_PropertyRange' - {low_val=any:create(orber_tc:short(), ?AuthorizeDiamonds), - high_val=any:create(orber_tc:short(), ?ForbidDiamonds)}}, - validate_qos_helper(T, State, [Property|Properties], Errors); -validate_qos_helper([{?CycleDetection, Cyclic}|T], #state{cyclic = Cyclic} = State, - Properties, Errors) -> - validate_qos_helper(T, State, Properties, Errors); -validate_qos_helper([{?CycleDetection, _}|T], #state{cyclic = Cyclic} = State, - Properties, Errors) -> - Error = - #'CosNotification_PropertyError' - {code = 'UNAVAILABLE_VALUE', - name = ?CycleDetection, - available_range = #'CosNotification_PropertyRange' - {low_val=any:create(orber_tc:short(), Cyclic), - high_val=any:create(orber_tc:short(), Cyclic)}}, - validate_qos_helper(T, State, Properties, [Error|Errors]). - - -%%---------------------------------------------------------------------- -%%------------------ CosNotification::AdminPropertiesAdmin ------------- -%%---------------------------------------------------------------------% -%% Function : get_admin -%% Arguments : - -%% Returns : CosNotification::AdminProperties -%% Description: No Admins currently supported -%%---------------------------------------------------------------------- -get_admin(_OE_This, State) -> - {reply, [], State}. - -%%---------------------------------------------------------------------% -%% Function : set_admin -%% Arguments : NewAdmins - CosNotification::AdminProperties -%% Returns : ok | -%% {'EXCEPTION', #'CosNotification_UnsupportedAdmin{}} -%% Description: No Admins currently supported -%%---------------------------------------------------------------------- -set_admin(_OE_This, State, NewAdmins) -> - cosEventDomainApp:get_admin(NewAdmins), - {reply, ok, State}. - - -%%====================================================================== -%% Internal functions -%%====================================================================== -%%---------------------------------------------------------------------% -%% Function : find_candidates -%% Arguments : Digraph reference -%% (Vertex - if we're interested in a specific vertex. -%% Returns : {[SourceVertices], [SinkVertices], Max} -%% SourceVertices - {Vertice, [ReachableVertices]} -%% SinkVertices - {Vertice, [ReachingVertices]} -%% Max - number of edges in the graph. -%% Description: To be a part of a diamond ("transitive" relation xRy, yRz => xRz; -%% in comparison with discrete mathematics we do not require that the -%% entire graph is transitive) a vertex must have more than one -%% outgoing and/or incoming. Hence, a digraph must contain at least -%% one vertex with more than one outgoing edges and at least -%% one with more than one incoming edges for a diamond to exist. -%% Hence, the purpose of this function is to find vertices that -%% look like: -%% -%% Vout->V1 V6->Vin -%% \ and ^ -%% +->V2 | -%% V8--+ -%%---------------------------------------------------------------------- -find_candidates(DG) -> - Edges = digraph:edges(DG), - {COut, CIn, Max} = find_candidates_helper(Edges, [], [], DG, 0), - {filter_candidates(COut), filter_candidates(CIn), Max}. - - -find_candidates(DG, _Vertex) -> - %% We should use the fact that we know one of the vertices. - Edges = digraph:edges(DG), - {COut, CIn, Max} = find_candidates_helper(Edges, [], [], DG, 0), - {filter_candidates(COut), filter_candidates(CIn), Max}. - -find_candidates_helper([], AccOut, AccIn, _, Counter) -> - {lists:sort(AccOut), lists:sort(AccIn), Counter}; -find_candidates_helper([H|T], AccOut, AccIn, DG, Counter) -> - {H, V1, V2, _Label} = digraph:edge(DG, H), - find_candidates_helper(T, [{V1, V2}|AccOut], [{V2,V1}|AccIn], DG, Counter+1). - -filter_candidates([]) -> - []; -filter_candidates([{V1, V2}|T]) -> - filter_candidates([{V1, V2}|T], V1, [], []). -filter_candidates([], _V, [_Acc1], Acc2) -> - %% Only one in/out connection. Hence, cannot be start- or end-point - %% of a diamond. - lists:reverse(Acc2); -filter_candidates([], V, Acc1, Acc2) -> - lists:reverse([{V, lists:reverse(Acc1)}|Acc2]); -filter_candidates([{V1, V2}|T], V1, Acc1, Acc2) -> - filter_candidates(T, V1, [V2|Acc1], Acc2); -filter_candidates([{V1, V2}|T], _V, [_Acc1], Acc2) -> - %% Only one in/out connection. Hence, cannot be start- or end-point - %% of a diamond. - filter_candidates(T, V1, [V2], Acc2); -filter_candidates([{V1, V2}|T], V, Acc1, Acc2) -> - filter_candidates(T, V1, [V2], [{V, lists:reverse(Acc1)}|Acc2]). - -%%---------------------------------------------------------------------% -%% Function : evaluate_candidates -%% Arguments : - -%% Returns : [Diamond] -%% Description: There are several scenarios but they can be categorized as: -%% (1) (2) (3) (4) -%% 2 2 2-..-56 -%% / \ / \ / \ -%% 1---4 1---4 1---4 1 4 -%% \ / \ / \ / -%% 3 3 3-..-11 -%% -%% The purpose of this function is to find these in the cheapest -%% way possible. For complex diamonds (may also include cycles) -%% duplicates may be generated. For example, #2/#3 is a sub-set of #1 -%% but they are as well diamonds. -%%---------------------------------------------------------------------- -evaluate_candidates(_DG, [], _, Acc, _Max, _) -> - Acc; -evaluate_candidates(DG, [{V, OutV}|T], CIn, Acc, Max, FindAll) -> - case evaluate_candidates_helper(DG, V, OutV, CIn, [], FindAll) of - [] -> - evaluate_candidates(DG, T, CIn, Acc, Max, FindAll); - Diamonds when FindAll == true -> - %% May be more than one diamond. - evaluate_candidates(DG, T, CIn, Diamonds ++ Acc, Max, FindAll); - Diamond -> - Diamond - end. - -evaluate_candidates_helper(_, _, _, _, [Diamond], false) -> - Diamond; -evaluate_candidates_helper(_, _, _, [], Diamonds, _) -> - Diamonds; -evaluate_candidates_helper(DG, V1, OutV, [{V1, _InV}|T], Diamonds, FindAll) -> - evaluate_candidates_helper(DG, V1, OutV, T, Diamonds, FindAll); -evaluate_candidates_helper(DG, V1, OutV, [{V2, InV}|T], Diamonds, FindAll) -> - case double_match(OutV, InV, [], V1, V2) of - [] -> - case is_member(InV, V1) of - true -> - %% At this point we know that we have: - %% x -> y - %% For this pair to be a part of a diamond we have two options: - %% (1) x - y (2) x ---- y - %% \ / or \ / or a additional path besides z1-zN, - %% z z1-zN - case double_match_exclude(OutV, InV, [], V1, V2) of - [] -> - %% Nope it's not #1. - case digraph_match(OutV, V2, V1, DG, 1) of - false -> - evaluate_candidates_helper(DG, V1, OutV, T, - Diamonds, FindAll); - Diamond -> - evaluate_candidates_helper(DG, V1, OutV, T, - [[[V1, V2]|Diamond]|Diamonds], - FindAll) - end; - Diamond -> - %% We've found a diamond looking like: - %% x - y xRy, yRz => xRz - %% \ / - %% z - evaluate_candidates_helper(DG, V1, OutV, T, - [[[V1, V2]|Diamond]|Diamonds], - FindAll) - end; - false -> - case digraph_match(OutV, V2, V1, DG) of - false -> - evaluate_candidates_helper(DG, V1, OutV, T, - Diamonds, FindAll); - Diamond -> - evaluate_candidates_helper(DG, V1, OutV, T, - [Diamond|Diamonds], FindAll) - end - end; - Diamond -> - %% We've found a diamond looking something like: - %% 2 - %% / \ - %% 1-5-4 V1 eq. 1, V2 eq 4. - %% \ / - %% 3 - evaluate_candidates_helper(DG, V1, OutV, T, [Diamond|Diamonds], - FindAll) - end. - -is_member([], _) -> - false; -is_member([H|_], H) -> - true; -is_member([H|_], H2) when H > H2 -> - %% Since it's a sorted list no need to look any further. - false; -is_member([_|T], H) -> - is_member(T, H). - -double_match([], _, [_Matched], _, _) -> - []; -double_match([], _, Matched, _, _) -> - Matched; -double_match(_, [], [_Matched], _, _) -> - []; -double_match(_, [], Matched, _, _) -> - Matched; -double_match([H|T1], [H|T2], Matched, V1, V2) -> - double_match(T1, T2, [[V1,H,V2] | Matched], V1, V2); -double_match([H1|T1], [H2|T2], Matched, V1, V2) when H1 > H2 -> - double_match([H1|T1], T2, Matched, V1, V2); -double_match([_H1|T1], [H2|T2], Matched, V1, V2) -> - double_match(T1, [H2|T2], Matched, V1, V2). - -double_match_exclude([], _, Matched, _, _) -> - Matched; -double_match_exclude(_, [], Matched, _, _) -> - Matched; -%% exclude it -double_match_exclude([V2|T1], CIn, Matched, V1, V2) -> - double_match_exclude(T1, CIn, Matched, V1, V2); -%% exclude it -double_match_exclude(COut, [V1|T2], Matched, V1, V2) -> - double_match_exclude(COut, T2, Matched, V1, V2); -%% Found match -double_match_exclude([H|T1], [H|T2], Matched, V1, V2) -> - double_match_exclude(T1, T2, [[V1,H,V2] | Matched], V1, V2); -double_match_exclude([H1|T1], [H2|T2], Matched, V1, V2) when H1 > H2 -> - double_match_exclude([H1|T1], T2, Matched, V1, V2); -double_match_exclude([_H1|T1], [H2|T2], Matched, V1, V2) -> - double_match_exclude(T1, [H2|T2], Matched, V1, V2). - - -digraph_match(OutV, V2, V1, DG) -> - digraph_match(OutV, V2, V1, DG, [], 0). - -digraph_match(OutV, V2, V1, DG, Counter) -> - digraph_match(OutV, V2, V1, DG, [], Counter). - -digraph_match([], _, _, _, _, Counter) when Counter < 2 -> - false; -digraph_match([], _, _, _, Acc, _) -> - Acc; -digraph_match([Vin|T], Vin, Vout, DG, Acc, Counter) -> - digraph_match(T, Vin, Vout, DG, Acc, Counter); -digraph_match([H|T], Vin, Vout, DG, Acc, Counter) -> - case get_path(DG, H, Vin, H, Vout) of - false -> - digraph_match(T, Vin, Vout, DG, Acc, Counter); - Path -> - %% Found one path; now me must se if there are one more. - digraph_match(T, Vin, Vout, DG, [[Vout|lists:reverse(Path)] | Acc], - Counter+1) - end. - -get_path(G, V1, V2, E1, E2) -> - one_path(digraph:out_neighbours(G, V1), V2, [], [V1], [V1], G, E1, E2). - -one_path([E1|_Vs], W, Cont, Xs, Ps, G, E1, E2) -> - one_path([], W, Cont, Xs, Ps, G, E1, E2); -one_path([E2|_Vs], W, Cont, Xs, Ps, G, E1, E2) -> - one_path([], W, Cont, Xs, Ps, G, E1, E2); -one_path([W|_Ws], W, _Cont, _Xs, Ps, _G, _E1, _E2) -> - [W|Ps]; -one_path([V|Vs], W, Cont, Xs, Ps, G, E1, E2) -> - case lists:member(V, Xs) of - true -> one_path(Vs, W, Cont, Xs, Ps, G, E1, E2); - false -> one_path(digraph:out_neighbours(G, V), W, - [{Vs,Ps} | Cont], [V|Xs], [V|Ps], G, E1, E2) - end; -one_path([], W, [{Vs,Ps}|Cont], Xs, _, G, E1, E2) -> - one_path(Vs, W, Cont, Xs, Ps, G, E1, E2); -one_path([], _, [], _, _, _, _, _) -> false. - -%%---------------------------------------------------------------------% -%% function : type_check -%% Arguments: Obj - objectrefernce to test. -%% Mod - Module which contains typeID/0. -%% Returns : 'ok' or raises exception. -%% Effect : -%%---------------------------------------------------------------------- -type_check(Obj, Mod) -> - case catch corba_object:is_a(Obj,Mod:typeID()) of - true -> - ok; - What -> - orber:dbg("[~p] CosEventDomainAdmin:type_check();~n" - "Object of incorrect type supplied; should be: ~p~n" - "Failed due to: ~p", [?LINE, Mod, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{minor=507, completion_status=?COMPLETED_NO}) - end. - -%%---------------------------------------------------------------------% -%% function : lookup_channel -%% Arguments: DG - digraph reference -%% Id - CosEventDomainAdmin::MemberID (long()) -%% Returns : CosNotifyChannelAdmin::EventChannel | -%% {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} -%% Effect : -%%---------------------------------------------------------------------- -lookup_channel(DG, Id) -> - case digraph:vertex(DG, Id) of - {Id, Channel} -> - Channel; - false -> - corba:raise(#'CosNotifyChannelAdmin_ChannelNotFound'{}) - end. - - -%%---------------------------------------------------------------------% -%% function : lookup_connection -%% Arguments: DG - digraph reference -%% Id - CosEventDomainAdmin::ConnectionID (long()) -%% Returns : #connectio{} | -%% {'EXCEPTION', #'CosEventDomainAdmin_ConnectionNotFound'{}} -%% Effect : -%%---------------------------------------------------------------------- -lookup_connection(DG, Id) -> - case digraph:edge(DG, Id) of - {Id, _SId, _CId, Connection} -> - Connection; - false -> - corba:raise(#'CosEventDomainAdmin_ConnectionNotFound'{}) - end. - -%%---------------------------------------------------------------------% -%% function : lookup_connection_data -%% Arguments: DG - digraph reference -%% Id - CosEventDomainAdmin::ConnectionID (long()) -%% Returns : CosEventDomainAdmin::Connection | -%% {'EXCEPTION', #'CosEventDomainAdmin_ConnectionNotFound'{}} -%% Effect : -%%---------------------------------------------------------------------- -lookup_connection_data(DG, Id) -> - case digraph:edge(DG, Id) of - {Id, _SId, _CId, #connection{data = Connection}} -> - Connection; - false -> - corba:raise(#'CosEventDomainAdmin_ConnectionNotFound'{}) - end. - -%%---------------------------------------------------------------------% -%% function : close_connections -%% Arguments: DG -digraph reference -%% [CosEventDomainAdmin::ConnectionID] - [long()] -%% Returns : ok -%% Effect : -%%---------------------------------------------------------------------- -close_connections(_DG, []) -> - ok; -close_connections(DG, [H|T]) -> - #connection{supplier=S, consumer=C, data=Connection} = - lookup_connection(DG, H), - close_connection(Connection, S, C), - digraph:del_edge(DG, H), - close_connections(DG, T). - -%%---------------------------------------------------------------------% -%% function : close_connection -%% Arguments: CosEventDomainAdmin::Connection -%% S - SupplierProxy -%% C - ConsumerProxy -%% Returns : ok -%% Effect : -%%---------------------------------------------------------------------- -close_connection(#'CosEventDomainAdmin_Connection'{ctype=Type, - notification_style = Style}, - S, C) -> - case {Type, Style} of - {'ANY_EVENT', 'Push'} -> - catch 'CosNotifyChannelAdmin_ProxyPushSupplier':disconnect_push_supplier(S), - catch 'CosNotifyChannelAdmin_ProxyPushConsumer':disconnect_push_consumer(C); - {'ANY_EVENT', 'Pull'} -> - catch 'CosNotifyChannelAdmin_ProxyPullSupplier':disconnect_pull_supplier(S), - catch 'CosNotifyChannelAdmin_ProxyPullConsumer':disconnect_pull_consumer(C); - {'STRUCTURED_EVENT', 'Push'} -> - catch 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':disconnect_structured_push_supplier(S), - catch 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':disconnect_structured_push_consumer(C); - {'STRUCTURED_EVENT', 'Pull'} -> - catch 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':disconnect_structured_pull_supplier(S), - catch 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':disconnect_structured_pull_consumer(C); - {'SEQUENCE_EVENT', 'Push'} -> - catch 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':disconnect_sequence_push_supplier(S), - catch 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':disconnect_sequence_push_consumer(C); - {'SEQUENCE_EVENT', 'Pull'}-> - catch 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':disconnect_sequence_pull_supplier(S), - catch 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':disconnect_sequence_pull_consumer(C) - end, - ok. - -%%---------------------------------------------------------------------% -%% function : setup_connection -%% Arguments: CosEventDomainAdmin::Connection -%% S - SupplierProxy -%% C - ConsumerProxy -%% Returns : {ok, SupplierProxy, ConsumerProxy}; -%% Effect : -%%---------------------------------------------------------------------- -setup_connection(#'CosEventDomainAdmin_Connection'{ctype=Type, - notification_style = Style}, - S, C) -> - Admin = - 'CosNotifyChannelAdmin_EventChannel':'_get_default_consumer_admin'(S), - case Style of - 'Push' -> - {Proxy, _Id} = - 'CosNotifyChannelAdmin_ConsumerAdmin': - obtain_notification_push_supplier(Admin, Type), - CProxy = connect_a_push_supplier(C, Proxy, Type), - case Type of - 'ANY_EVENT' -> - 'CosNotifyChannelAdmin_ProxyPushSupplier': - connect_any_push_consumer(Proxy, CProxy); - 'STRUCTURED_EVENT' -> - 'CosNotifyChannelAdmin_StructuredProxyPushSupplier': - connect_structured_push_consumer(Proxy, CProxy); - 'SEQUENCE_EVENT' -> - 'CosNotifyChannelAdmin_SequenceProxyPushSupplier': - connect_sequence_push_consumer(Proxy, CProxy) - end, - {ok, Proxy, CProxy}; - 'Pull' -> - {Proxy, _Id} = - 'CosNotifyChannelAdmin_ConsumerAdmin': - obtain_notification_pull_supplier(Admin, Type), - CProxy = connect_a_pull_supplier(C, Proxy, Type), - case Type of - 'ANY_EVENT' -> - 'CosNotifyChannelAdmin_ProxyPullSupplier': - connect_any_pull_consumer(Proxy, CProxy); - 'STRUCTURED_EVENT' -> - 'CosNotifyChannelAdmin_StructuredProxyPullSupplier': - connect_structured_pull_consumer(Proxy, CProxy); - 'SEQUENCE_EVENT' -> - 'CosNotifyChannelAdmin_SequenceProxyPullSupplier': - connect_sequence_pull_consumer(Proxy, CProxy) - end, - {ok, Proxy, CProxy} - end. - -%%---------------------------------------------------------------------% -%% function : connect_a_pull_consumer -%% Arguments: Channel - CosNotifyChannelAdmin::EventChannel | undefined -%% PC - a PullConsumer -%% Type - 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' -%% Returns : -%% Effect : -%%---------------------------------------------------------------------- -connect_a_pull_consumer(undefined, _, _) -> - corba:raise(#'CosNotifyChannelAdmin_ChannelNotFound'{}); -connect_a_pull_consumer(Channel, PC, Type) -> - Admin = - 'CosNotifyChannelAdmin_EventChannel':'_get_default_consumer_admin'(Channel), - {Proxy, _Id} = - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_pull_supplier(Admin, - Type), - case Type of - 'ANY_EVENT' -> - 'CosNotifyChannelAdmin_ProxyPullSupplier':connect_any_pull_consumer(Proxy, PC); - 'STRUCTURED_EVENT' -> - 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':connect_structured_pull_consumer(Proxy, PC); - 'SEQUENCE_EVENT' -> - 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':connect_sequence_pull_consumer(Proxy, PC) - end, - Proxy. - -%%---------------------------------------------------------------------% -%% function : connect_a_push_consumer -%% Arguments: Channel - CosNotifyChannelAdmin::EventChannel | undefined -%% PC - a PushConsumer -%% Type - 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' -%% Returns : -%% Effect : -%%---------------------------------------------------------------------- -connect_a_push_consumer(undefined, _, _) -> - corba:raise(#'CosNotifyChannelAdmin_ChannelNotFound'{}); -connect_a_push_consumer(Channel, PC, Type) -> - Admin = - 'CosNotifyChannelAdmin_EventChannel':'_get_default_consumer_admin'(Channel), - {Proxy, _Id} = - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_push_supplier(Admin, - Type), - case Type of - 'ANY_EVENT' -> - 'CosNotifyChannelAdmin_ProxyPushSupplier':connect_any_push_consumer(Proxy, PC); - 'STRUCTURED_EVENT' -> - 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':connect_structured_push_consumer(Proxy, PC); - 'SEQUENCE_EVENT' -> - 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':connect_sequence_push_consumer(Proxy, PC) - end, - Proxy. - -%%---------------------------------------------------------------------% -%% function : connect_a_pull_supplier -%% Arguments: Channel - CosNotifyChannelAdmin::EventChannel | undefined -%% PC - a PullSupplier -%% Type - 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' -%% Returns : -%% Effect : -%%---------------------------------------------------------------------- -connect_a_pull_supplier(undefined, _, _) -> - corba:raise(#'CosNotifyChannelAdmin_ChannelNotFound'{}); -connect_a_pull_supplier(Channel, PS, Type) -> - Admin = - 'CosNotifyChannelAdmin_EventChannel':'_get_default_supplier_admin'(Channel), - {Proxy, _Id} = - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_pull_consumer(Admin, - Type), - case Type of - 'ANY_EVENT' -> - 'CosNotifyChannelAdmin_ProxyPullConsumer':connect_any_pull_supplier(Proxy, PS); - 'STRUCTURED_EVENT' -> - 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':connect_structured_pull_supplier(Proxy, PS); - 'SEQUENCE_EVENT' -> - 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':connect_sequence_pull_supplier(Proxy, PS) - end, - Proxy. - -%%---------------------------------------------------------------------% -%% function : connect_a_push_supplier -%% Arguments: Channel - CosNotifyChannelAdmin::EventChannel | undefined -%% PC - a PushSupplier -%% Type - 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' -%% Returns : -%% Effect : -%%---------------------------------------------------------------------- -connect_a_push_supplier(undefined, _, _) -> - corba:raise(#'CosNotifyChannelAdmin_ChannelNotFound'{}); -connect_a_push_supplier(Channel, PS, Type) -> - Admin = - 'CosNotifyChannelAdmin_EventChannel':'_get_default_supplier_admin'(Channel), - {Proxy, _Id} = - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_push_consumer(Admin, - Type), - case Type of - 'ANY_EVENT' -> - 'CosNotifyChannelAdmin_ProxyPushConsumer':connect_any_push_supplier(Proxy, PS); - 'STRUCTURED_EVENT' -> - 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':connect_structured_push_supplier(Proxy, PS); - 'SEQUENCE_EVENT' -> - 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':connect_sequence_push_supplier(Proxy, PS) - end, - Proxy. - - -%%====================================================================== -%% END OF MODULE -%%====================================================================== - diff --git a/lib/cosEventDomain/src/Makefile b/lib/cosEventDomain/src/Makefile deleted file mode 100644 index cdaf9e5f1f..0000000000 --- a/lib/cosEventDomain/src/Makefile +++ /dev/null @@ -1,185 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2001-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -ifeq ($(TYPE),debug) -ERL_COMPILE_FLAGS += -Ddebug -W -endif -EBIN=../ebin -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSEVENTDOMAIN_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/cosEventDomain-$(VSN) -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- - -MODULES = \ - CosEventDomainAdmin_EventDomainFactory_impl \ - CosEventDomainAdmin_EventDomain_impl \ - cosEventDomainApp - -ERL_FILES = $(MODULES:%=%.erl) -HRL_FILES = cosEventDomainApp.hrl - -EXTERNAL_INC_PATH = ../include - -GEN_ERL_FILES = \ - oe_CosEventDomainAdmin.erl \ - CosEventDomainAdmin.erl \ - CosEventDomainAdmin_DiamondSeq.erl \ - CosEventDomainAdmin_AlreadyExists.erl \ - CosEventDomainAdmin_DomainIDSeq.erl \ - CosEventDomainAdmin_Connection.erl \ - CosEventDomainAdmin_ConnectionIDSeq.erl \ - CosEventDomainAdmin_ConnectionNotFound.erl \ - CosEventDomainAdmin_CycleCreationForbidden.erl \ - CosEventDomainAdmin_CycleSeq.erl \ - CosEventDomainAdmin_DiamondCreationForbidden.erl \ - CosEventDomainAdmin_DomainNotFound.erl \ - CosEventDomainAdmin_EventDomain.erl \ - CosEventDomainAdmin_EventDomainFactory.erl \ - CosEventDomainAdmin_MemberIDSeq.erl \ - CosEventDomainAdmin_RouteSeq.erl - - - -GEN_HRL_FILES = \ - oe_CosEventDomainAdmin.hrl \ - CosEventDomainAdmin.hrl \ - CosEventDomainAdmin_EventDomainFactory.hrl \ - CosEventDomainAdmin_EventDomain.hrl - -EXTERNAL_GEN_HRL_FILES = \ - $(GEN_HRL_FILES:%=$(EXTERNAL_INC_PATH)/%) - - -TARGET_FILES = \ - $(GEN_ERL_FILES:%.erl=$(EBIN)/%.$(EMULATOR)) \ - $(MODULES:%=$(EBIN)/%.$(EMULATOR)) - -GEN_FILES = $(GEN_HRL_FILES) $(GEN_ERL_FILES) - -IDL_FILES = \ - CosEventDomainAdmin.idl - -APPUP_FILE = cosEventDomain.appup -APPUP_SRC = $(APPUP_FILE).src -APPUP_TARGET = $(EBIN)/$(APPUP_FILE) - -APP_FILE = cosEventDomain.app -APP_SRC = $(APP_FILE).src -APP_TARGET = $(EBIN)/$(APP_FILE) - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += \ - -pa $(ERL_TOP)/lib/cosEventDomain/ebin \ - -pa $(ERL_TOP)/lib/cosEventDomain/include \ - -pa $(ERL_TOP)/lib/cosNotification/include \ - -pa $(ERL_TOP)/lib/cosNotification/ebin \ - -pa $(ERL_TOP)/lib/ic/ebin \ - -I$(ERL_TOP)/lib/cosNotification/include \ - -I$(ERL_TOP)/lib/cosNotification/ebin \ - -I$(ERL_TOP)/lib/cosNotification/src \ - -I$(ERL_TOP)/lib/cosEvent/src \ - -I$(ERL_TOP)/lib/cosEventDomain/include -# The -pa option is just used temporary until erlc can handle -# includes from other directories than ../include . -ERL_COMPILE_FLAGS += \ - $(ERL_IDL_FLAGS) \ - -pa $(ERL_TOP)/lib/cosEventDomain/include \ - -pa $(ERL_TOP)/lib/cosNotification/ebin \ - -pa $(ERL_TOP)/lib/cosNotification/include \ - -pa $(ERL_TOP)/lib/cosNotification/src \ - -I$(ERL_TOP)/lib/cosEventDomain/include \ - -I$(ERL_TOP)/lib/cosNotification/ebin \ - -I$(ERL_TOP)/lib/cosNotification/include \ - -I$(ERL_TOP)/lib/cosNotification/src \ - -I$(ERL_TOP)/lib/cosEvent/src \ - -I$(ERL_TOP)/lib/cosEvent/include \ - +'{parse_transform,sys_pre_attributes}' \ - +'{attribute,insert,app_vsn,"cosEventDomain_$(COSEVENTDOMAIN_VSN)"}' - -YRL_FLAGS = - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) - -debug: - @${MAKE} TYPE=debug opt - -clean: - rm -f $(TARGET_FILES) $(GEN_FILES) $(APP_TARGET) $(APPUP_TARGET) IDL-GENERATED - rm -f errs core *~ - -$(APP_TARGET): $(APP_SRC) - $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $(APP_SRC) > $(APP_TARGET) -$(APPUP_TARGET): $(APPUP_SRC) - $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $(APPUP_SRC) > $(APPUP_TARGET) - -docs: - -# ---------------------------------------------------- -# Special Build Targets -# ---------------------------------------------------- -IDL-GENERATED: CosEventDomainAdmin.idl - $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosEventDomainAdmin.cfg"}' CosEventDomainAdmin.idl - $(V_at)mv $(GEN_HRL_FILES) $(EXTERNAL_INC_PATH) - $(V_at)>IDL-GENERATED - -$(GEN_FILES): IDL-GENERATED - -$(TARGET_FILES): IDL-GENERATED - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - - -release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)" - $(INSTALL_DATA) ../info "$(RELSYSDIR)" - $(INSTALL_DIR) "$(RELSYSDIR)/ebin" - $(INSTALL_DATA) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) "$(RELSYSDIR)/ebin" - $(INSTALL_DIR) "$(RELSYSDIR)/src" - $(INSTALL_DATA) $(ERL_FILES) $(HRL_FILES) $(GEN_ERL_FILES) $(IDL_FILES) "$(RELSYSDIR)/src" - $(INSTALL_DIR) "$(RELSYSDIR)/include" - $(INSTALL_DATA) $(EXTERNAL_GEN_HRL_FILES) "$(RELSYSDIR)/include" - - -release_docs_spec: - - - - - diff --git a/lib/cosEventDomain/src/cosEventDomain.app.src b/lib/cosEventDomain/src/cosEventDomain.app.src deleted file mode 100644 index f218ac853e..0000000000 --- a/lib/cosEventDomain/src/cosEventDomain.app.src +++ /dev/null @@ -1,33 +0,0 @@ -{application, cosEventDomain, - [{description, "The Erlang CosEventDomain application"}, - {vsn, "%VSN%"}, - {modules, - [ - 'CosEventDomainAdmin_EventDomainFactory_impl', - 'CosEventDomainAdmin_EventDomain_impl', - 'cosEventDomainApp', - 'oe_CosEventDomainAdmin', - 'CosEventDomainAdmin', - 'CosEventDomainAdmin_DiamondSeq', - 'CosEventDomainAdmin_AlreadyExists', - 'CosEventDomainAdmin_DomainIDSeq', - 'CosEventDomainAdmin_Connection', - 'CosEventDomainAdmin_ConnectionIDSeq', - 'CosEventDomainAdmin_ConnectionNotFound', - 'CosEventDomainAdmin_CycleCreationForbidden', - 'CosEventDomainAdmin_CycleSeq', - 'CosEventDomainAdmin_DiamondCreationForbidden', - 'CosEventDomainAdmin_DomainNotFound', - 'CosEventDomainAdmin_EventDomain', - 'CosEventDomainAdmin_EventDomainFactory', - 'CosEventDomainAdmin_MemberIDSeq', - 'CosEventDomainAdmin_RouteSeq' - ] - }, - {registered, []}, - {applications, [orber, stdlib, kernel]}, - {env, []}, - {mod, {cosEventDomainApp, []}}, - {runtime_dependencies, ["stdlib-2.0","orber-3.6.27","kernel-3.0","erts-7.0", - "cosNotification-1.1.21"]} -]}. diff --git a/lib/cosEventDomain/src/cosEventDomain.appup.src b/lib/cosEventDomain/src/cosEventDomain.appup.src deleted file mode 100644 index d69b2ef20c..0000000000 --- a/lib/cosEventDomain/src/cosEventDomain.appup.src +++ /dev/null @@ -1,6 +0,0 @@ -{"%VSN%", - [ - ], - [ - ] -} diff --git a/lib/cosEventDomain/src/cosEventDomainApp.erl b/lib/cosEventDomain/src/cosEventDomainApp.erl deleted file mode 100644 index be7c2f518a..0000000000 --- a/lib/cosEventDomain/src/cosEventDomainApp.erl +++ /dev/null @@ -1,341 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%-------------------------------------------------------------------- -%% File : cosEventDomainApp.erl -%% Purpose : -%%-------------------------------------------------------------------- - --module(cosEventDomainApp). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). --include_lib("cosNotification/include/CosNotification.hrl"). -%% Application files --include("cosEventDomainApp.hrl"). --include("CosEventDomainAdmin.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%% External MISC --export([get_option/3, - create_id/1, - is_debug_compiled/0, - install/0, - uninstall/0, - start_factory/0, - start_factory/1, - start_factory_link/0, - start_factory_link/1, - stop_factory/1, - start/0, - stop/0, - create_link/3, - get_qos/1, - get_admin/1]). - -%% Application callbacks --export([start/2, init/1, stop/1]). - -%%--------------- DEFINES ------------------------------------ - --define(SUPERVISOR_NAME, oe_cosEventDomainSup). --define(SUP_FLAG, {simple_one_for_one,50,10}). - --define(SUP_SPEC(Name, Args), - ['CosEventDomainAdmin_EventDomain',Args, - [{sup_child, true}, {regname, {global, Name}}]]). --define(SUP_CHILD, - {"oe_EventDomainChild", - {cosEventDomainApp,create_link, []}, - transient,100000,worker, - ['CosEventDomainAdmin_EventDomain']}). - - --define(DEFAULT_OPTIONS, []). - -%%--------------- DEFINITIONS OF CONSTANTS ------------------- -%%--------------- EXTERNAL MISC FUNCTIONS -------------------- -%%-----------------------------------------------------------% -%% function : install -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -install() -> - oe_CosEventDomainAdmin:oe_register(). - -%%-----------------------------------------------------------% -%% function : uninstall -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -uninstall() -> - oe_CosEventDomainAdmin:oe_unregister(). - -%%-----------------------------------------------------------% -%% function : start/stop -%% Arguments: -%% Returns : -%% Effect : Starts or stops the cosTime application. -%%------------------------------------------------------------ - -start() -> - application:start(cosEventDomain). -stop() -> - application:stop(cosEventDomain). - -%%-----------------------------------------------------------% -%% function : start -%% Arguments: Type - see module application -%% Arg - see module application -%% Returns : -%% Effect : Module callback for application -%%------------------------------------------------------------ - -start(_, _) -> - supervisor:start_link({local, ?SUPERVISOR_NAME}, cosEventDomainApp, app_init). - - -%%-----------------------------------------------------------% -%% function : stop -%% Arguments: Arg - see module application -%% Returns : -%% Effect : Module callback for application -%%------------------------------------------------------------ - -stop(_) -> - ok. - -%%-----------------------------------------------------------% -%% function : start_channel -%% Arguments: - -%% Returns : -%% Effect : -%%------------------------------------------------------------ -start_factory() -> - start_factory(?DEFAULT_OPTIONS). - -start_factory(Options) when is_list(Options) -> - 'CosEventDomainAdmin_EventDomainFactory':oe_create(Options); -start_factory(Options) -> - orber:dbg("[~p] cosEventDomainApp:start_factory(~p);~n" - "Options not correct.", - [?LINE, Options], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%-----------------------------------------------------------% -%% function : start_channel -%% Arguments: - -%% Returns : -%% Effect : -%%------------------------------------------------------------ -start_factory_link() -> - start_factory_link(?DEFAULT_OPTIONS). - -start_factory_link(Options) when is_list(Options) -> - 'CosEventDomainAdmin_EventDomainFactory':oe_create_link(Options); -start_factory_link(Options) -> - orber:dbg("[~p] cosEventDomainApp:start_factory_link(~p);~n" - "Options not correct.", - [?LINE, Options], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%-----------------------------------------------------------% -%% function : stop_factory -%% Arguments: ChannelObj -%% Returns : -%% Effect : -%%------------------------------------------------------------ -stop_factory(ChannelObj) -> - corba:dispose(ChannelObj). - -%%-----------------------------------------------------------% -%% function : init -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ - -%% Starting using create_factory/X -init(own_init) -> - {ok,{?SUP_FLAG, [?SUP_CHILD]}}; -%% When starting as an application. -init(app_init) -> - {ok,{?SUP_FLAG, [?SUP_CHILD]}}. - - -%%------------------------------------------------------------ -%% function : create_link -%% Arguments: Module - which Module to call -%% Env/ArgList - ordinary oe_create arguments. -%% Returns : -%% Exception: -%% Effect : Necessary since we want the supervisor to be a -%% 'simple_one_for_one'. Otherwise, using for example, -%% 'one_for_one', we have to call supervisor:delete_child -%% to remove the childs startspecification from the -%% supervisors internal state. -%%------------------------------------------------------------ -create_link(Module, Env, ArgList) -> - Module:oe_create_link(Env, ArgList). - -%%-----------------------------------------------------------% -%% function : get_option -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -get_option(Key, OptionList, DefaultList) -> - case lists:keysearch(Key, 1, OptionList) of - {value,{Key,Value}} -> - Value; - _ -> - case lists:keysearch(Key, 1, DefaultList) of - {value,{Key,Value}} -> - Value; - _-> - {error, "Invalid option"} - end - end. - -%%------------------------------------------------------------ -%% function : create_id/1 -%% Arguments: CosEventDomainAdmin::DomainID (long) -%% Returns : CosEventDomainAdmin::DomainID (long) -%% Exception: -%% Purpose : -%%------------------------------------------------------------ -create_id(2147483647) -> - -2147483648; -create_id(OldID) -> - OldID+1. - -%%------------------------------------------------------------ -%% function : get_qos -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -get_qos([]) -> - []; -get_qos(Properties) -> - case get_qos(Properties, [], []) of - {ok, Supported} -> - Supported; - {error, Unsupported} -> - corba:raise(#'CosNotification_UnsupportedQoS'{qos_err = Unsupported}) - end. - -get_qos([], Supported, []) -> - {ok, Supported}; -get_qos([], _, Unsupported) -> - {error, Unsupported}; -get_qos([#'CosNotification_Property'{name = ?CycleDetection, - value= #any{value = ?AuthorizeCycles}}|T], - Supported, Unsupported) -> - get_qos(T, [{?CycleDetection, ?AuthorizeCycles}|Supported], Unsupported); -get_qos([#'CosNotification_Property'{name = ?CycleDetection, - value= #any{value = ?ForbidCycles}}|T], - Supported, Unsupported) -> - get_qos(T, [{?CycleDetection, ?ForbidCycles}|Supported], Unsupported); -get_qos([#'CosNotification_Property'{name = ?CycleDetection}|T], - Supported, Unsupported) -> - %% Illegal value supplied. - get_qos(T, Supported, - [#'CosNotification_PropertyError' - {code = 'UNSUPPORTED_VALUE', - name = ?CycleDetection, - available_range = #'CosNotification_PropertyRange' - {low_val=any:create(orber_tc:short(), ?AuthorizeCycles), - high_val=any:create(orber_tc:short(), ?ForbidCycles)}}|Unsupported]); -get_qos([#'CosNotification_Property'{name = ?DiamondDetection, - value= #any{value = ?AuthorizeDiamonds}}|T], - Supported, Unsupported) -> - get_qos(T, [{?DiamondDetection, ?AuthorizeDiamonds}|Supported], Unsupported); -get_qos([#'CosNotification_Property'{name = ?DiamondDetection, - value= #any{value = ?ForbidDiamonds}}|T], - Supported, Unsupported) -> - get_qos(T, [{?DiamondDetection, ?ForbidDiamonds}|Supported], Unsupported); -get_qos([#'CosNotification_Property'{name = ?DiamondDetection}|T], - Supported, Unsupported) -> - %% Illegal value supplied. - get_qos(T, Supported, - [#'CosNotification_PropertyError' - {code = 'UNSUPPORTED_VALUE', - name = ?DiamondDetection, - available_range = #'CosNotification_PropertyRange' - {low_val=any:create(orber_tc:short(), ?AuthorizeDiamonds), - high_val=any:create(orber_tc:short(), ?ForbidDiamonds) - }} | Unsupported]); -get_qos([#'CosNotification_Property'{name = Name}|T], Supported, Unsupported) -> - %% Unknown QoS supplied. - get_qos(T, Supported, - [#'CosNotification_PropertyError' - {code = 'BAD_PROPERTY', - name = Name, - available_range = #'CosNotification_PropertyRange' - {low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null)}} | Unsupported]). - -%%------------------------------------------------------------ -%% function : get_admin -%% Arguments: -%% Returns : {"EXCEPTION', #'CosNotification_PropertyError'{}} -%% Exception: -%% Effect : No Admin supported. -%%------------------------------------------------------------ -get_admin([]) -> - []; -get_admin(Properties) -> - get_admin(Properties, []). - -get_admin([], Unsupported) -> - corba:raise(#'CosNotification_UnsupportedAdmin'{admin_err = Unsupported}); -get_admin([#'CosNotification_Property'{name = Name}|T], Unsupported) -> - %% Unknown QoS supplied. - get_admin(T, [#'CosNotification_PropertyError' - {code = 'BAD_PROPERTY', - name = Name, - available_range = #'CosNotification_PropertyRange' - {low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null)}} | Unsupported]). - - -%%------------------------------------------------------------ -%% function : is_debug_compiled -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ --ifdef(debug). - is_debug_compiled() -> true. --else. - is_debug_compiled() -> false. --endif. - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosEventDomain/src/cosEventDomainApp.hrl b/lib/cosEventDomain/src/cosEventDomainApp.hrl deleted file mode 100644 index 6df20692be..0000000000 --- a/lib/cosEventDomain/src/cosEventDomainApp.hrl +++ /dev/null @@ -1,70 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : cosEventDomainApp.hrl -%% Purpose : -%%---------------------------------------------------------------------- - - -%%--------------- INCLUDES ----------------------------------- -%% External - -%% Local - --define(write_ErrorMsg(Txt, Arg), -error_logger:error_msg("============== CosEventDomain =============~n" - Txt - "===========================================~n", - Arg)). - --define(DEBUG_LEVEL, 3). - --ifdef(debug). --define(DBG(F,A), - io:format("[LINE: ~p MODULE: ~p] "++F,[?LINE, ?MODULE]++A)). --else. --define(DBG(F,A), ok). --endif. - -%%%%%% WARNING! These definitions are defined in the CosEventDomainAdmin.idl -%%%%%% file. If the specification is changed so must the definitions!! -%%%%%% We use this approach to be able to use them as guards. - -%%%% Constant: 'CycleDetection' --define(CycleDetection, "CycleDetection"). - -%%%% Constant: 'AuthorizeCycles' --define(AuthorizeCycles, 0). - -%%%% Constant: 'ForbidCycles' --define(ForbidCycles, 1). - -%%%% Constant: 'DiamondDetection' --define(DiamondDetection, "DiamondDetection"). - -%%%% Constant: 'AuthorizeDiamonds' --define(AuthorizeDiamonds, 0). - -%%%% Constant: 'ForbidDiamonds' --define(ForbidDiamonds, 1). - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosEventDomain/test/Makefile b/lib/cosEventDomain/test/Makefile deleted file mode 100644 index 1841676be7..0000000000 --- a/lib/cosEventDomain/test/Makefile +++ /dev/null @@ -1,104 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2001-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSEVENTDOMAIN_VSN) -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/cosEventDomain_test - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -TEST_SPEC_FILE = cosEventDomain.spec -COVER_FILE = cosEventDomain.cover - - -MODULES = \ - event_domain_SUITE \ - generated_SUITE - -ERL_FILES = $(MODULES:%=%.erl) - -HRL_FILES = - -SUITE_TARGET_FILES = $(MODULES:%=%.$(EMULATOR)) - -TARGET_FILES = \ - $(SUITE_TARGET_FILES) - -# ---------------------------------------------------- -# PROGRAMS -# ---------------------------------------------------- -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/orber/ebin -pa $(ERL_TOP)/lib/ic/ebin - -ERL_COMPILE_FLAGS += \ - $(ERL_IDL_FLAGS) \ - -pa $(ERL_TOP)/lib/cosEventDomain/ebin \ - -pa $(ERL_TOP)/lib/cosEventDomain/include \ - -pa $(ERL_TOP)/lib/cosNotification/ebin \ - -pa $(ERL_TOP)/lib/cosNotification/include \ - -I$(ERL_TOP)/lib/cosEventDomain/include \ - -I$(ERL_TOP)/lib/cosNotification/include \ - -I$(ERL_TOP)/lib/cosNotification/ebin - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -tests debug opt: $(TARGET_FILES) - -clean: - rm -f $(TARGET_FILES) - rm -f errs core *~ - - -docs: - -# ---------------------------------------------------- -# Special Targets -# ---------------------------------------------------- - -# ---------------------------------------------------- -# Release Targets -# ---------------------------------------------------- -# We don't copy generated intermediate erlang and hrl files - -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: - -release_docs_spec: - -release_tests_spec: tests - $(INSTALL_DIR) "$(RELSYSDIR)" - $(INSTALL_DATA) $(TEST_SPEC_FILE) \ - $(COVER_FILE) $(ERL_FILES) "$(RELSYSDIR)" - $(INSTALL_DATA) $(SUITE_TARGET_FILES) "$(RELSYSDIR)" - diff --git a/lib/cosEventDomain/test/cosEventDomain.cover b/lib/cosEventDomain/test/cosEventDomain.cover deleted file mode 100644 index f87f6d97bf..0000000000 --- a/lib/cosEventDomain/test/cosEventDomain.cover +++ /dev/null @@ -1,2 +0,0 @@ -{incl_app,cosEventDomain,details}. - diff --git a/lib/cosEventDomain/test/cosEventDomain.spec b/lib/cosEventDomain/test/cosEventDomain.spec deleted file mode 100644 index bcee74c5f1..0000000000 --- a/lib/cosEventDomain/test/cosEventDomain.spec +++ /dev/null @@ -1 +0,0 @@ -{suites,"../cosEventDomain_test",all}. diff --git a/lib/cosEventDomain/test/event_domain_SUITE.erl b/lib/cosEventDomain/test/event_domain_SUITE.erl deleted file mode 100644 index 031b7726c5..0000000000 --- a/lib/cosEventDomain/test/event_domain_SUITE.erl +++ /dev/null @@ -1,464 +0,0 @@ -%%----------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- - --module(event_domain_SUITE). - --include_lib("common_test/include/ct.hrl"). --include_lib("orber/include/corba.hrl"). --include_lib("cosNotification/include/CosNotifyChannelAdmin.hrl"). --include_lib("cosNotification/include/CosNotification.hrl"). - --include_lib("cosEventDomain/include/CosEventDomainAdmin.hrl"). --include_lib("cosEventDomain/src/cosEventDomainApp.hrl"). - -%%----------------------------------------------------------------- -%% Macros -%%----------------------------------------------------------------- - --define(default_timeout, test_server:minutes(5)). - - --define(match(ExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - io:format("------ CORRECT RESULT ------~n~p~n", - [AcTuAlReS]), - AcTuAlReS; - _ -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS) - end - end()). - - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, - event_domain_api/1, event_domain_factory_api/1, - cases/0, init_per_suite/1, end_per_suite/1, - init_per_testcase/2, end_per_testcase/2, app_test/1]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- - -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - cases(). - -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -cases() -> - [event_domain_api, event_domain_factory_api, app_test]. - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- - -init_per_testcase(_Case, Config) -> - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - - -end_per_testcase(_Case, Config) -> - Dog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -init_per_suite(Config) when is_list(Config) -> - mnesia:delete_schema([node()]), - mnesia:create_schema([node()]), - ok = corba:orb_init([{flags, 16#02}, - {orber_debug_level, 10}]), - orber:install([node()]), - application:start(mnesia), - application:start(orber), - cosEventApp:install(), - cosEventApp:start(), - cosNotificationApp:install(), - cosNotificationApp:start(), - cosEventDomainApp:install(), - cosEventDomainApp:start(), - Config. - -end_per_suite(Config) when is_list(Config) -> - cosEventDomainApp:stop(), - cosEventDomainApp:uninstall(), - cosNotificationApp:stop(), - cosNotificationApp:uninstall(), - cosEventApp:stop(), - cosEventApp:uninstall(), - application:stop(orber), - application:stop(mnesia), - mnesia:delete_schema([node()]), - Config. - -%%----------------------------------------------------------------- -%% Tests app file -%%----------------------------------------------------------------- -app_test(_Config) -> - ok=test_server:app_test(cosEventDomain), - ok. - - -%% Testing the CosEventDomain Domain API -event_domain_api(_Config) -> - - %% We will setup a cluster looking like: - %% 7-8---> - %% / - %% 2 - 4 6-> - %% \ / - %% 5---9-1-3 - - %% 2-4 - %% 4-1 - %% 1-3 - %% 3-6 - %% 5-9 - %% 9-1 - %% 4-7 - %% 7-8 - - - ChFac = ?match({_,key,_,_,_,_}, - cosNotificationApp:start_global_factory([{pullInterval,1}])), - {Ch0,_} = ?match({{_,key,_,_,_,_}, _}, - 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(ChFac, [], [])), - Fac = ?match({_,key,_,_,_,_}, - cosEventDomainApp:start_factory()), - {ED, _} = ?match({{_,key,_,_,_,_}, _}, - 'CosEventDomainAdmin_EventDomainFactory':create_event_domain(Fac, [], [])), - ID0 = 'CosEventDomainAdmin_EventDomain':add_channel(ED, Ch0), - ?match(Ch0, 'CosEventDomainAdmin_EventDomain':get_channel(ED, ID0)), - ?match([0], 'CosEventDomainAdmin_EventDomain':get_all_channels(ED)), - ?match({'EXCEPTION',{'CosNotifyChannelAdmin_ChannelNotFound',_}}, - 'CosEventDomainAdmin_EventDomain':get_channel(ED, 100)), - ?match({'EXCEPTION',{'CosNotifyChannelAdmin_ChannelNotFound',_}}, - 'CosEventDomainAdmin_EventDomain':remove_channel(ED, 100)), - ?match(ok, 'CosEventDomainAdmin_EventDomain':remove_channel(ED, 0)), - ?match([], 'CosEventDomainAdmin_EventDomain':get_all_channels(ED)), - ?match({'EXCEPTION',{'CosNotifyChannelAdmin_ChannelNotFound',_}}, - 'CosEventDomainAdmin_EventDomain':remove_channel(ED, 0)), - - %% Create a new event channel. - {Ch1,_} = ?match({{_,key,_,_,_,_}, _}, - 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(ChFac, [], [])), - {Ch2,_} = ?match({{_,key,_,_,_,_}, _}, - 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(ChFac, [], [])), - {Ch3,_} = ?match({{_,key,_,_,_,_}, _}, - 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(ChFac, [], [])), - {Ch4,_} = ?match({{_,key,_,_,_,_}, _}, - 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(ChFac, [], [])), - {Ch5,_} = ?match({{_,key,_,_,_,_}, _}, - 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(ChFac, [], [])), - {Ch6,_} = ?match({{_,key,_,_,_,_}, _}, - 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(ChFac, [], [])), - {Ch7,_} = ?match({{_,key,_,_,_,_}, _}, - 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(ChFac, [], [])), - {Ch8,_} = ?match({{_,key,_,_,_,_}, _}, - 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(ChFac, [], [])), - {Ch9,_} = ?match({{_,key,_,_,_,_}, _}, - 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(ChFac, [], [])), - - ID1 = 'CosEventDomainAdmin_EventDomain':add_channel(ED, Ch1), - ID2 = 'CosEventDomainAdmin_EventDomain':add_channel(ED, Ch2), - ID3 = 'CosEventDomainAdmin_EventDomain':add_channel(ED, Ch3), - ID4 = 'CosEventDomainAdmin_EventDomain':add_channel(ED, Ch4), - ID5 = 'CosEventDomainAdmin_EventDomain':add_channel(ED, Ch5), - ID6 = 'CosEventDomainAdmin_EventDomain':add_channel(ED, Ch6), - ID7 = 'CosEventDomainAdmin_EventDomain':add_channel(ED, Ch7), - ID8 = 'CosEventDomainAdmin_EventDomain':add_channel(ED, Ch8), - ID9 = 'CosEventDomainAdmin_EventDomain':add_channel(ED, Ch9), - ?match([_,_,_,_,_,_,_,_,_], - 'CosEventDomainAdmin_EventDomain':get_all_channels(ED)), - - ?match([], 'CosEventDomainAdmin_EventDomain':get_all_connections(ED)), - C1 = #'CosEventDomainAdmin_Connection'{supplier_id=ID2, - consumer_id=ID4, - ctype='STRUCTURED_EVENT', - notification_style='Pull'}, - C2 = #'CosEventDomainAdmin_Connection'{supplier_id=ID4, - consumer_id=ID1, - ctype='ANY_EVENT', - notification_style='Push'}, - C3 = #'CosEventDomainAdmin_Connection'{supplier_id=ID1, - consumer_id=ID3, - ctype='ANY_EVENT', - notification_style='Pull'}, - C4 = #'CosEventDomainAdmin_Connection'{supplier_id=ID3, - consumer_id=ID6, - ctype='STRUCTURED_EVENT', - notification_style='Push'}, - C5 = #'CosEventDomainAdmin_Connection'{supplier_id=ID5, - consumer_id=ID9, - ctype='ANY_EVENT', - notification_style='Pull'}, - C6 = #'CosEventDomainAdmin_Connection'{supplier_id=ID9, - consumer_id=ID1, - ctype='ANY_EVENT', - notification_style='Push'}, - C7 = #'CosEventDomainAdmin_Connection'{supplier_id=ID4, - consumer_id=ID7, - ctype='STRUCTURED_EVENT', - notification_style='Pull'}, - C8 = #'CosEventDomainAdmin_Connection'{supplier_id=ID7, - consumer_id=ID8, - ctype='ANY_EVENT', - notification_style='Push'}, - C9 = #'CosEventDomainAdmin_Connection'{supplier_id=ID8, - consumer_id=ID4, - ctype='ANY_EVENT', - notification_style='Pull'}, - C10 = #'CosEventDomainAdmin_Connection'{supplier_id=ID5, - consumer_id=ID4, - ctype='ANY_EVENT', - notification_style='Pull'}, - C11 = #'CosEventDomainAdmin_Connection'{supplier_id=ID4, - consumer_id=ID6, - ctype='ANY_EVENT', - notification_style='Pull'}, - C12 = #'CosEventDomainAdmin_Connection'{supplier_id=ID8, - consumer_id=ID6, - ctype='ANY_EVENT', - notification_style='Pull'}, - - CID1 = 'CosEventDomainAdmin_EventDomain':add_connection(ED, C1), - ?match([CID1], 'CosEventDomainAdmin_EventDomain':get_all_connections(ED)), - _CID2 = 'CosEventDomainAdmin_EventDomain':add_connection(ED, C2), - ?match([_,_], - 'CosEventDomainAdmin_EventDomain':get_all_connections(ED)), - _CID3 = 'CosEventDomainAdmin_EventDomain':add_connection(ED, C3), - ?match([_,_,_], - 'CosEventDomainAdmin_EventDomain':get_all_connections(ED)), - _CID4 = 'CosEventDomainAdmin_EventDomain':add_connection(ED, C4), - ?match([_,_,_,_], - 'CosEventDomainAdmin_EventDomain':get_all_connections(ED)), - _CID5 = 'CosEventDomainAdmin_EventDomain':add_connection(ED, C5), - ?match([_,_,_,_,_], - 'CosEventDomainAdmin_EventDomain':get_all_connections(ED)), - _CID6 = 'CosEventDomainAdmin_EventDomain':add_connection(ED, C6), - ?match([_,_,_,_,_,_], - 'CosEventDomainAdmin_EventDomain':get_all_connections(ED)), - CID7 = 'CosEventDomainAdmin_EventDomain':add_connection(ED, C7), - ?match([_,_,_,_,_,_,_], - 'CosEventDomainAdmin_EventDomain':get_all_connections(ED)), - _CID8 = 'CosEventDomainAdmin_EventDomain':add_connection(ED, C8), - ?match([_,_,_,_,_,_,_,_], - 'CosEventDomainAdmin_EventDomain':get_all_connections(ED)), - - ?match({'EXCEPTION',{'CosEventDomainAdmin_AlreadyExists', _}}, - 'CosEventDomainAdmin_EventDomain':add_connection(ED, C8)), - %% No cycles should exist. - ?match([], 'CosEventDomainAdmin_EventDomain':get_cycles(ED)), - - ?match([_, _], 'CosEventDomainAdmin_EventDomain':get_qos(ED)), - AllowCyclic = #'CosNotification_Property'{name=?CycleDetection, - value=any:create(orber_tc:short(), - ?AuthorizeCycles)}, - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosEventDomainAdmin_EventDomain':set_qos(ED, [AllowCyclic])), - ForbidCyclic = #'CosNotification_Property'{name=?CycleDetection, - value=any:create(orber_tc:short(), - ?ForbidCycles)}, - %% The same as before; must work. - ?match(ok, 'CosEventDomainAdmin_EventDomain':set_qos(ED, [ForbidCyclic])), - - AllowDiamonds = #'CosNotification_Property'{name=?DiamondDetection, - value=any:create(orber_tc:short(), - ?AuthorizeDiamonds)}, - %% Since no diamonds allowed before this is always ok. - ?match(ok, 'CosEventDomainAdmin_EventDomain':set_qos(ED, [AllowDiamonds])), - - ?match([_, _], 'CosEventDomainAdmin_EventDomain':get_qos(ED)), - - ForbidDiamonds = #'CosNotification_Property'{name=?DiamondDetection, - value=any:create(orber_tc:short(), - ?ForbidDiamonds)}, - %% No diamonds created before. Hence, will work. - ?match(ok, 'CosEventDomainAdmin_EventDomain':set_qos(ED, [ForbidDiamonds])), - - ?match([_, _], 'CosEventDomainAdmin_EventDomain':get_qos(ED)), - - ?match({ok, [_]}, 'CosEventDomainAdmin_EventDomain':validate_qos(ED, - [ForbidDiamonds, - ForbidCyclic])), - %% No diamonds exists, hence, this is ok. - ?match({ok, [_]}, 'CosEventDomainAdmin_EventDomain':validate_qos(ED, - [AllowDiamonds, - ForbidCyclic])), - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosEventDomainAdmin_EventDomain':validate_qos(ED, [ForbidDiamonds, - AllowCyclic])), - - %% Since the ED is started is asyclic we may not succeed with this invokation. - ?match({'EXCEPTION',{'CosEventDomainAdmin_CycleCreationForbidden',_,_}}, - 'CosEventDomainAdmin_EventDomain':add_connection(ED, C9)), - ?match([], 'CosEventDomainAdmin_EventDomain':get_offer_channels(ED, ID2)), - - ?match([2], 'CosEventDomainAdmin_EventDomain':get_offer_channels(ED, ID4)), - ?match([_,_,_], 'CosEventDomainAdmin_EventDomain':get_offer_channels(ED, ID8)), - ?match({'EXCEPTION',{'CosNotifyChannelAdmin_ChannelNotFound',_}}, - 'CosEventDomainAdmin_EventDomain':get_offer_channels(ED, 100)), - ?match([], 'CosEventDomainAdmin_EventDomain':get_subscription_channels(ED, ID8)), - ?match([_,_,_,_,_], - 'CosEventDomainAdmin_EventDomain':get_subscription_channels(ED, ID4)), - ?match([_,_,_,_,_,_], - 'CosEventDomainAdmin_EventDomain':get_subscription_channels(ED, ID2)), - ?match({'EXCEPTION',{'CosNotifyChannelAdmin_ChannelNotFound',_}}, - 'CosEventDomainAdmin_EventDomain':get_subscription_channels(ED, 100)), - Nil = corba:create_nil_objref(), - - P2=?match({_,key,_,_,_,_}, - 'CosEventDomainAdmin_EventDomain':connect_push_supplier_with_id(ED, Nil, ID2)), - P7=?match({_,key,_,_,_,_}, - 'CosEventDomainAdmin_EventDomain':connect_push_supplier_with_id(ED, Nil, ID7)), - P8=?match({_,key,_,_,_,_}, - 'CosEventDomainAdmin_EventDomain':connect_pull_consumer_with_id(ED, Nil, ID8)), - P6=?match({_,key,_,_,_,_}, - 'CosEventDomainAdmin_EventDomain':connect_pull_consumer_with_id(ED, Nil, ID6)), - E1 = #any{typecode=tk_long, value=1}, - E2 = #any{typecode=tk_long, value=2}, - - ?match(ok, 'CosNotifyChannelAdmin_ProxyPushConsumer':push(P2, E1)), - ?match(E1, 'CosNotifyChannelAdmin_ProxyPullSupplier':pull(P8)), - ?match(E1, 'CosNotifyChannelAdmin_ProxyPullSupplier':pull(P6)), - ?match(ok, 'CosNotifyChannelAdmin_ProxyPushConsumer':push(P7, E2)), - ?match(E2, 'CosNotifyChannelAdmin_ProxyPullSupplier':pull(P8)), - timer:sleep(10000), - ?match({_,false}, 'CosNotifyChannelAdmin_ProxyPullSupplier':try_pull(P6)), - - ?match(ok, 'CosEventDomainAdmin_EventDomain':remove_connection(ED, CID7)), - - ?match({'EXCEPTION',{'CosEventDomainAdmin_ConnectionNotFound',_}}, - 'CosEventDomainAdmin_EventDomain':remove_connection(ED, CID7)), - - ?match({'EXCEPTION',{'CosEventDomainAdmin_ConnectionNotFound',_}}, - 'CosEventDomainAdmin_EventDomain':remove_connection(ED, 100)), - - ?match([], 'CosEventDomainAdmin_EventDomain':get_offer_channels(ED, ID7)), - ?match([2], 'CosEventDomainAdmin_EventDomain':get_offer_channels(ED, ID4)), - - ?match([8], 'CosEventDomainAdmin_EventDomain':get_subscription_channels(ED, ID7)), - ?match([_,_,_], 'CosEventDomainAdmin_EventDomain':get_subscription_channels(ED, ID4)), - - CID10 = ?match(8, 'CosEventDomainAdmin_EventDomain':add_connection(ED, C7)), - - %% Now we'll check diamond management. - %% Currently it should not be possible to create a diamond (due to QoS-setting). - ?match({'EXCEPTION',{'CosEventDomainAdmin_DiamondCreationForbidden',_,_}}, - 'CosEventDomainAdmin_EventDomain':add_connection(ED, C11)), - ?match({'EXCEPTION',{'CosEventDomainAdmin_DiamondCreationForbidden',_,_}}, - 'CosEventDomainAdmin_EventDomain':add_connection(ED, C10)), - ?match({'EXCEPTION',{'CosEventDomainAdmin_DiamondCreationForbidden',_,_}}, - 'CosEventDomainAdmin_EventDomain':add_connection(ED, C12)), - ?match(ok, 'CosEventDomainAdmin_EventDomain':set_qos(ED, [AllowDiamonds])), - - CID11 = ?match(9, 'CosEventDomainAdmin_EventDomain':add_connection(ED, C10)), - ?match([_,_,_,_,_,_,_,_,_], - 'CosEventDomainAdmin_EventDomain':get_all_connections(ED)), - ?match([_], 'CosEventDomainAdmin_EventDomain':get_diamonds(ED)), - - CID12 = ?match(10, 'CosEventDomainAdmin_EventDomain':add_connection(ED, C11)), - ?match([_, _, _], 'CosEventDomainAdmin_EventDomain':get_diamonds(ED)), - - CID13 = ?match(11, 'CosEventDomainAdmin_EventDomain':add_connection(ED, C12)), - - ?match([_, _, _], 'CosEventDomainAdmin_EventDomain':get_diamonds(ED)), - - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosEventDomainAdmin_EventDomain':set_qos(ED, [ForbidDiamonds])), - - ?match(ok, 'CosEventDomainAdmin_EventDomain':remove_connection(ED, CID10)), - ?match(ok, 'CosEventDomainAdmin_EventDomain':remove_connection(ED, CID11)), - ?match(ok, 'CosEventDomainAdmin_EventDomain':remove_connection(ED, CID12)), - ?match(ok, 'CosEventDomainAdmin_EventDomain':remove_connection(ED, CID13)), - ?match(ok, 'CosEventDomainAdmin_EventDomain':set_qos(ED, [ForbidDiamonds])), - ?match([_, _], 'CosEventDomainAdmin_EventDomain':get_qos(ED)), - ?match({'EXCEPTION',{'CosEventDomainAdmin_DiamondCreationForbidden',_,_}}, - 'CosEventDomainAdmin_EventDomain':add_connection(ED, C10)), - - ?match(ok, 'CosEventDomainAdmin_EventDomain':destroy(ED)), - - ok. - -%% Testing the CosEventDomain Factory API -event_domain_factory_api(_Config) -> - - Cyclic = #'CosNotification_Property'{name=?CycleDetection, - value=any:create(orber_tc:short(), - ?ForbidCycles)}, - - BadProp = #'CosNotification_Property'{name="Wrong", - value=any:create(orber_tc:short(), - ?ForbidCycles)}, - - BadQoSVal = #'CosNotification_Property'{name=?CycleDetection, - value=any:create(orber_tc:short(), - 10)}, - - Fac = ?match({_,key,_,_,_,_}, - cosEventDomainApp:start_factory()), - ?match([], 'CosEventDomainAdmin_EventDomainFactory':get_all_domains(Fac)), - ?match({'EXCEPTION',{'CosEventDomainAdmin_DomainNotFound',_}}, - 'CosEventDomainAdmin_EventDomainFactory':get_event_domain(Fac, 0)), - {ED,_} = 'CosEventDomainAdmin_EventDomainFactory':create_event_domain(Fac, [Cyclic], []), - ?match([0], 'CosEventDomainAdmin_EventDomainFactory':get_all_domains(Fac)), - ED = 'CosEventDomainAdmin_EventDomainFactory':get_event_domain(Fac, 0), - ?match({'EXCEPTION',{'CosEventDomainAdmin_DomainNotFound',_}}, - 'CosEventDomainAdmin_EventDomainFactory':get_event_domain(Fac, 1)), - corba:dispose(ED), - timer:sleep(3000), - ?match([], 'CosEventDomainAdmin_EventDomainFactory':get_all_domains(Fac)), - ?match({'EXCEPTION',{'CosEventDomainAdmin_DomainNotFound',_}}, - 'CosEventDomainAdmin_EventDomainFactory':get_event_domain(Fac, 0)), - {ED2,_} = ?match({{_,key,_,_,_,_}, _}, - 'CosEventDomainAdmin_EventDomainFactory':create_event_domain(Fac, [], [])), - ?match([1], 'CosEventDomainAdmin_EventDomainFactory':get_all_domains(Fac)), - ?match(ED2, 'CosEventDomainAdmin_EventDomainFactory':get_event_domain(Fac, 1)), - corba:dispose(ED2), - - ?match({'EXCEPTION', {'CosNotification_UnsupportedQoS',_,_}}, - 'CosEventDomainAdmin_EventDomainFactory':create_event_domain(Fac, [BadProp], [])), - ?match({'EXCEPTION',{'CosNotification_UnsupportedAdmin',_,_}}, - 'CosEventDomainAdmin_EventDomainFactory':create_event_domain(Fac, [], [BadProp])), - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosEventDomainAdmin_EventDomainFactory':create_event_domain(Fac, [BadQoSVal], [])), - ?match({'EXCEPTION',{'CosNotification_UnsupportedAdmin',_,_}}, - 'CosEventDomainAdmin_EventDomainFactory':create_event_domain(Fac, [], [BadQoSVal])), - - corba:dispose(Fac), - ok. diff --git a/lib/cosEventDomain/test/generated_SUITE.erl b/lib/cosEventDomain/test/generated_SUITE.erl deleted file mode 100644 index 172465da2f..0000000000 --- a/lib/cosEventDomain/test/generated_SUITE.erl +++ /dev/null @@ -1,384 +0,0 @@ -%%----------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File : generated_SUITE.erl -%% Purpose : -%%----------------------------------------------------------------- - --module(generated_SUITE). - --include_lib("common_test/include/ct.hrl"). --include_lib("orber/include/corba.hrl"). - --define(default_timeout, test_server:minutes(3)). - --define(match(ExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - AcTuAlReS; - _ -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS) - end - end()). - --define(nomatch(Not, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - Not -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS); - _ -> - AcTuAlReS - end - end()). - - --define(checktc(_Op), - fun(TC) -> - case orber_tc:check_tc(TC) of - false -> - io:format("###### ERROR ERROR ######~n~p - ~p~n", [Op, TC]), - exit(TC); - true -> - true - end - end). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --compile(export_all). - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - ['CosEventDomainAdmin', - 'CosEventDomainAdmin_DiamondSeq', - 'CosEventDomainAdmin_AlreadyExists', - 'CosEventDomainAdmin_DomainIDSeq', - 'CosEventDomainAdmin_Connection', - 'CosEventDomainAdmin_ConnectionIDSeq', - 'CosEventDomainAdmin_ConnectionNotFound', - 'CosEventDomainAdmin_CycleCreationForbidden', - 'CosEventDomainAdmin_CycleSeq', - 'CosEventDomainAdmin_DiamondCreationForbidden', - 'CosEventDomainAdmin_DomainNotFound', - 'CosEventDomainAdmin_MemberIDSeq', - 'CosEventDomainAdmin_RouteSeq', - 'CosEventDomainAdmin_EventDomainFactory', - 'CosEventDomainAdmin_EventDomain']. - -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- -init_per_testcase(_Case, Config) -> - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - - -end_per_testcase(_Case, Config) -> - Dog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventDomainAdmin' -%% Description: -%%----------------------------------------------------------------- -'CosEventDomainAdmin'(_) -> - ?match("CycleDetection", 'CosEventDomainAdmin':'CycleDetection'()), - ?match(0, 'CosEventDomainAdmin':'AuthorizeCycles'()), - ?match(1, 'CosEventDomainAdmin':'ForbidCycles'()), - ?match("DiamondDetection", 'CosEventDomainAdmin':'DiamondDetection'()), - ?match(0, 'CosEventDomainAdmin':'AuthorizeDiamonds'()), - ?match(1, 'CosEventDomainAdmin':'ForbidDiamonds'()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventDomainAdmin_DiamondSeq' -%% Description: -%%----------------------------------------------------------------- -'CosEventDomainAdmin_DiamondSeq'(_) -> - ?match(true, orber_tc:check_tc('CosEventDomainAdmin_DiamondSeq':tc())), - ?match("IDL:omg.org/CosEventDomainAdmin/DiamondSeq:1.0", - 'CosEventDomainAdmin_DiamondSeq':id()), - ?match("CosEventDomainAdmin_DiamondSeq", - 'CosEventDomainAdmin_DiamondSeq':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventDomainAdmin_AlreadyExists' -%% Description: -%%----------------------------------------------------------------- -'CosEventDomainAdmin_AlreadyExists'(_) -> - ?match(true, orber_tc:check_tc('CosEventDomainAdmin_AlreadyExists':tc())), - ?match("IDL:omg.org/CosEventDomainAdmin/AlreadyExists:1.0", - 'CosEventDomainAdmin_AlreadyExists':id()), - ?match("CosEventDomainAdmin_AlreadyExists", - 'CosEventDomainAdmin_AlreadyExists':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventDomainAdmin_DomainIDSeq' -%% Description: -%%----------------------------------------------------------------- -'CosEventDomainAdmin_DomainIDSeq'(_) -> - ?match(true, orber_tc:check_tc('CosEventDomainAdmin_DomainIDSeq':tc())), - ?match("IDL:omg.org/CosEventDomainAdmin/DomainIDSeq:1.0", - 'CosEventDomainAdmin_DomainIDSeq':id()), - ?match("CosEventDomainAdmin_DomainIDSeq", - 'CosEventDomainAdmin_DomainIDSeq':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventDomainAdmin_Connection' -%% Description: -%%----------------------------------------------------------------- -'CosEventDomainAdmin_Connection'(_) -> - ?match(true, orber_tc:check_tc('CosEventDomainAdmin_Connection':tc())), - ?match("IDL:omg.org/CosEventDomainAdmin/Connection:1.0", - 'CosEventDomainAdmin_Connection':id()), - ?match("CosEventDomainAdmin_Connection", - 'CosEventDomainAdmin_Connection':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventDomainAdmin_ConnectionIDSeq' -%% Description: -%%----------------------------------------------------------------- -'CosEventDomainAdmin_ConnectionIDSeq'(_) -> - ?match(true, orber_tc:check_tc('CosEventDomainAdmin_ConnectionIDSeq':tc())), - ?match("IDL:omg.org/CosEventDomainAdmin/ConnectionIDSeq:1.0", - 'CosEventDomainAdmin_ConnectionIDSeq':id()), - ?match("CosEventDomainAdmin_ConnectionIDSeq", - 'CosEventDomainAdmin_ConnectionIDSeq':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventDomainAdmin_ConnectionNotFound' -%% Description: -%%----------------------------------------------------------------- -'CosEventDomainAdmin_ConnectionNotFound'(_) -> - ?match(true, orber_tc:check_tc('CosEventDomainAdmin_ConnectionNotFound':tc())), - ?match("IDL:omg.org/CosEventDomainAdmin/ConnectionNotFound:1.0", - 'CosEventDomainAdmin_ConnectionNotFound':id()), - ?match("CosEventDomainAdmin_ConnectionNotFound", - 'CosEventDomainAdmin_ConnectionNotFound':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventDomainAdmin_CycleCreationForbidden' -%% Description: -%%----------------------------------------------------------------- -'CosEventDomainAdmin_CycleCreationForbidden'(_) -> - ?match(true, orber_tc:check_tc('CosEventDomainAdmin_CycleCreationForbidden':tc())), - ?match("IDL:omg.org/CosEventDomainAdmin/CycleCreationForbidden:1.0", - 'CosEventDomainAdmin_CycleCreationForbidden':id()), - ?match("CosEventDomainAdmin_CycleCreationForbidden", - 'CosEventDomainAdmin_CycleCreationForbidden':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventDomainAdmin_CycleSeq' -%% Description: -%%----------------------------------------------------------------- -'CosEventDomainAdmin_CycleSeq'(_) -> - ?match(true, orber_tc:check_tc('CosEventDomainAdmin_CycleSeq':tc())), - ?match("IDL:omg.org/CosEventDomainAdmin/CycleSeq:1.0", - 'CosEventDomainAdmin_CycleSeq':id()), - ?match("CosEventDomainAdmin_CycleSeq", - 'CosEventDomainAdmin_CycleSeq':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventDomainAdmin_DiamondCreationForbidden' -%% Description: -%%----------------------------------------------------------------- -'CosEventDomainAdmin_DiamondCreationForbidden'(_) -> - ?match(true, orber_tc:check_tc('CosEventDomainAdmin_DiamondCreationForbidden':tc())), - ?match("IDL:omg.org/CosEventDomainAdmin/DiamondCreationForbidden:1.0", - 'CosEventDomainAdmin_DiamondCreationForbidden':id()), - ?match("CosEventDomainAdmin_DiamondCreationForbidden", - 'CosEventDomainAdmin_DiamondCreationForbidden':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventDomainAdmin_DomainNotFound' -%% Description: -%%----------------------------------------------------------------- -'CosEventDomainAdmin_DomainNotFound'(_) -> - ?match(true, orber_tc:check_tc('CosEventDomainAdmin_DomainNotFound':tc())), - ?match("IDL:omg.org/CosEventDomainAdmin/DomainNotFound:1.0", - 'CosEventDomainAdmin_DomainNotFound':id()), - ?match("CosEventDomainAdmin_DomainNotFound", - 'CosEventDomainAdmin_DomainNotFound':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventDomainAdmin_MemberIDSeq' -%% Description: -%%----------------------------------------------------------------- -'CosEventDomainAdmin_MemberIDSeq'(_) -> - ?match(true, orber_tc:check_tc('CosEventDomainAdmin_MemberIDSeq':tc())), - ?match("IDL:omg.org/CosEventDomainAdmin/MemberIDSeq:1.0", - 'CosEventDomainAdmin_MemberIDSeq':id()), - ?match("CosEventDomainAdmin_MemberIDSeq", - 'CosEventDomainAdmin_MemberIDSeq':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventDomainAdmin_RouteSeq' -%% Description: -%%----------------------------------------------------------------- -'CosEventDomainAdmin_RouteSeq'(_) -> - ?match(true, orber_tc:check_tc('CosEventDomainAdmin_RouteSeq':tc())), - ?match("IDL:omg.org/CosEventDomainAdmin/RouteSeq:1.0", - 'CosEventDomainAdmin_RouteSeq':id()), - ?match("CosEventDomainAdmin_RouteSeq", - 'CosEventDomainAdmin_RouteSeq':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventDomainAdmin_EventDomainFactory' -%% Description: -%%----------------------------------------------------------------- -'CosEventDomainAdmin_EventDomainFactory'(_) -> - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomainFactory':oe_tc(create_event_domain)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomainFactory':oe_tc(get_all_domains)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomainFactory':oe_tc(get_event_domain)), - ?match(undefined, 'CosEventDomainAdmin_EventDomainFactory':oe_tc(undefined)), - ?match([_|_], 'CosEventDomainAdmin_EventDomainFactory':oe_get_interface()), - ?match("IDL:omg.org/CosEventDomainAdmin/EventDomainFactory:1.0", - 'CosEventDomainAdmin_EventDomainFactory':typeID()), - check_tc('CosEventDomainAdmin_EventDomainFactory':oe_get_interface()), - ?match(true, 'CosEventDomainAdmin_EventDomainFactory':oe_is_a('CosEventDomainAdmin_EventDomainFactory':typeID())), - ?match(false, 'CosEventDomainAdmin_EventDomainFactory':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosEventDomainAdmin_EventDomain' -%% Description: -%%----------------------------------------------------------------- -'CosEventDomainAdmin_EventDomain'(_) -> - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(add_channel)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(get_all_channels)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(get_channel)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(remove_channel)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(add_connection)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(get_all_connections)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(get_connection)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(remove_connection)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(get_offer_channels)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(get_subscription_channels)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(destroy)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(get_cycles)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(get_diamonds)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(set_default_consumer_channel)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(set_default_supplier_channel)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_push_consumer)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_pull_consumer)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_push_supplier)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_pull_supplier)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_structured_push_consumer)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_structured_pull_consumer)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_structured_push_supplier)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_structured_pull_supplier)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_sequence_push_consumer)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_sequence_pull_consumer)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_sequence_push_supplier)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_sequence_pull_supplier)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_push_consumer_with_id)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_pull_consumer_with_id)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_push_supplier_with_id)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_pull_supplier_with_id)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_structured_push_consumer_with_id)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_structured_pull_consumer_with_id)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_structured_push_supplier_with_id)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_structured_pull_supplier_with_id)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_sequence_push_consumer_with_id)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_sequence_pull_consumer_with_id)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_sequence_push_supplier_with_id)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(connect_sequence_pull_supplier_with_id)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(get_qos)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(set_qos)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(get_admin)), - ?nomatch(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(set_admin)), - ?match(undefined, 'CosEventDomainAdmin_EventDomain':oe_tc(undefined)), - ?match([_|_], 'CosEventDomainAdmin_EventDomain':oe_get_interface()), - ?match("IDL:omg.org/CosEventDomainAdmin/EventDomain:1.0", - 'CosEventDomainAdmin_EventDomain':typeID()), - check_tc('CosEventDomainAdmin_EventDomain':oe_get_interface()), - ?match(true, 'CosEventDomainAdmin_EventDomain':oe_is_a('CosEventDomainAdmin_EventDomain':typeID())), - ?match(true, 'CosEventDomainAdmin_EventDomain':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosEventDomainAdmin_EventDomain':oe_is_a('CosNotification_AdminPropertiesAdmin':typeID())), - ?match(false, 'CosEventDomainAdmin_EventDomain':oe_is_a("wrong")), - ok. - - - -%%----------------------------------------------------------------- -%% MISC functions -%%----------------------------------------------------------------- -check_tc([]) -> - ok; -check_tc([{Op, {RetType, InParameters, OutParameters}}|T]) -> - io:format("checked - ~s~n", [Op]), - lists:all(?checktc(Op), [RetType|InParameters]), - lists:all(?checktc(Op), OutParameters), - check_tc(T). - - diff --git a/lib/cosEventDomain/vsn.mk b/lib/cosEventDomain/vsn.mk deleted file mode 100644 index 0c063a00f9..0000000000 --- a/lib/cosEventDomain/vsn.mk +++ /dev/null @@ -1,2 +0,0 @@ -COSEVENTDOMAIN_VSN = 1.2.2 - diff --git a/lib/cosFileTransfer/AUTHORS b/lib/cosFileTransfer/AUTHORS deleted file mode 100644 index 55d8059989..0000000000 --- a/lib/cosFileTransfer/AUTHORS +++ /dev/null @@ -1,4 +0,0 @@ -Original Authors: -Niclas Eklund - -Contributors: diff --git a/lib/cosFileTransfer/Makefile b/lib/cosFileTransfer/Makefile deleted file mode 100644 index c9c07dcdad..0000000000 --- a/lib/cosFileTransfer/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2000-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include vsn.mk -VSN=$(COSFILETRANSFER_VSN) - -# ---------------------------------------------------- -# Common Macros -# ---------------------------------------------------- -# SUB_DIRECTORIES = src test examples doc/src -# At the moment we don't have any example programs. -SUB_DIRECTORIES = src doc/src - -SPECIAL_TARGETS = - -# ---------------------------------------------------- -# Default Subdir Targets -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_subdir.mk diff --git a/lib/cosFileTransfer/doc/html/.gitignore b/lib/cosFileTransfer/doc/html/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosFileTransfer/doc/man3/.gitignore b/lib/cosFileTransfer/doc/man3/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosFileTransfer/doc/man6/.gitignore b/lib/cosFileTransfer/doc/man6/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosFileTransfer/doc/pdf/.gitignore b/lib/cosFileTransfer/doc/pdf/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosFileTransfer/doc/src/CosFileTransfer.gif b/lib/cosFileTransfer/doc/src/CosFileTransfer.gif deleted file mode 100644 index 16970ad5ad..0000000000 Binary files a/lib/cosFileTransfer/doc/src/CosFileTransfer.gif and /dev/null differ diff --git a/lib/cosFileTransfer/doc/src/CosFileTransfer_Directory.xml b/lib/cosFileTransfer/doc/src/CosFileTransfer_Directory.xml deleted file mode 100644 index da5810521a..0000000000 --- a/lib/cosFileTransfer/doc/src/CosFileTransfer_Directory.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosFileTransfer_Directory - - - - 2000-11-09 - PA1 -
- CosFileTransfer_Directory - This module implements the OMG CosFileTransfer::Directory interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosFileTransfer/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosFileTransfer_File

-
- -

CosPropertyService_PropertySetDef in the cosProperty application.

-
-
-
- - - list(Directory, Max) -> Return - Return a list, of length Maxor less, containing Object References representing files or directories contained within the target Directory and a FileIteratoror a NILobject - - Directory = #objref - Return = {ok, FileList, FileIterator} - FileList = [File] - File = FileIterator = #objref - - -

This operation returns a list, of length Max or less, containing - Object References representing files or directories contained within - the target Directory. If the amount of objects found is less than Max - the returned Iterator will be a NIL object.

-
-
-
- -
- diff --git a/lib/cosFileTransfer/doc/src/CosFileTransfer_File.xml b/lib/cosFileTransfer/doc/src/CosFileTransfer_File.xml deleted file mode 100644 index 373c14d1f1..0000000000 --- a/lib/cosFileTransfer/doc/src/CosFileTransfer_File.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosFileTransfer_File - - - - - 2000-11-09 - PA1 -
- CosFileTransfer_File - This module implements the OMG CosFileTransfer::File interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosFileTransfer/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosPropertyService_PropertySetDef in the cosProperty application.

-
-
-
- - - '_get_name'(File) -> string() - Return the target object's associated name - - File = #objref - - -

This read only attribute represents the target object's associated name.

-
-
- - '_get_complete_file_name'(File) -> string() - Return the target object's associated absolute name. - - File = #objref - - -

This read only attribute represents the target object's associated - absolute name.

-
-
- - '_get_parent'(File) -> Directory - Return the target object's container. - - File = Directory = #objref - - -

This read only attribute represents the target object's container. - In some cases a NIL object will be returned.

-
-
- - '_get_associated_session'(File) -> FileTransferSession - Return the target object's associated FileTransferSession - - File = FileTransferSession = #objref - - -

This read only attribute represents the target object's associated - FileTransferSession.

-
-
-
- -
- diff --git a/lib/cosFileTransfer/doc/src/CosFileTransfer_FileIterator.xml b/lib/cosFileTransfer/doc/src/CosFileTransfer_FileIterator.xml deleted file mode 100644 index f5c219b9c1..0000000000 --- a/lib/cosFileTransfer/doc/src/CosFileTransfer_FileIterator.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosFileTransfer_FileIterator - - - - 2000-11-09 - PA1 -
- CosFileTransfer_FileIterator - This module implements the OMG CosFileTransfer::FileIterator interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosFileTransfer/include/*.hrl").

-
- - - next_one(Iterator) -> Return - Return the next FileWrapperand a boolean which indicate whether the FileWrapperis valid or not. - - Iterator = #objref - Return = {boolean(), #'CosFileTransfer_FileWrapper'{the_file = File file_type = Type}} - File = #objref - Type = nfile | ndirectory - - -

This operation returns true if a FileWrapper exists at the - current position and the out parameter contains a valid File - reference. If false is returned the out parameter is a non-valid - FileWrapper.

-
-
- - next_n(Iterator, Max) -> Return - Return a list, of length Maxor less, containing FileWrappersand a boolean which indicates if more FileWrappersexists - - Iterator = #objref - Max = unsigned long() - Return = {boolean(), FileList} - FileList = [#'CosFileTransfer_FileWrapper'{the_file = File file_type = Type}] - File = #objref - Type = nfile | ndirectory - - -

This operation returns true if the requested number of FileWrappers - can be delivered and there are additional FileWrappers. If false is - returned a list, of length Max or less, containing the last valid - FileWrappers associated with the target object.

-
-
- - destroy(Iterator) -> ok - Terminate the target object - - Iterator = #objref - - -

This operation terminates the target object.

-
-
-
- -
- diff --git a/lib/cosFileTransfer/doc/src/CosFileTransfer_FileTransferSession.xml b/lib/cosFileTransfer/doc/src/CosFileTransfer_FileTransferSession.xml deleted file mode 100644 index 312af3b8c2..0000000000 --- a/lib/cosFileTransfer/doc/src/CosFileTransfer_FileTransferSession.xml +++ /dev/null @@ -1,191 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosFileTransfer_FileTransferSession - - - - 2000-11-09 - PA1 -
- CosFileTransfer_FileTransferSession - This module implements the OMG CosFileTransfer::FileTransferSession interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosFileTransfer/include/*.hrl").

-
- - - '_get_protocols_supported'(FTS) -> Return - Return the protocols supported by the target object - - FTS = #objref - Return = [#'CosFileTransfer_ProtocolSupport'{protocol_name=Type, addresses=[Address]}] - Type = Address = string() - - -

This read only attribute returns the protocols supported by the - target object.

-
-
- - set_directory(FTS, Directory) -> Return - Change the current working directory of the target object's associated file system - - FTS = Directory = #objref - Return = ok | {'EXCEPTION, E} - - -

Invoking this operation will change the current working directory of - the target object's associated file system. If fail to do so the - appropriate exception is raised.

-
-
- - create_file(FTS, FileNameList) -> Return - Create a FileObject representing a file which may or may not exist - - FTS = #objref - FileNameList = [string()] - Return = File | {'EXCEPTION, E} - File = #objref - - -

This operation creates a File Object representing a file which - may or may not exist. - For this operation to be independent of the working directory the - supplied FileNameList must represent the absolute name.

-
-
- - create_directory(FTS, FileNameList) -> Return - Create a new directory in the target objects associated file systems domain - - FTS = #objref - FileNameList = [string()] - Return = Directory | {'EXCEPTION, E} - Directory = #objref - - -

This operation creates a new directory in the target objects associated - file systems domain. If fail to do so an exception is raised but, - if successful, a Directory object representing the new - directory is returned.

-
-
- - get_file(FTS, FileNameList) -> Return - Create a FileWrapperwhich represents a file or directory - - FTS = #objref - FileNameList = [string()] - Return = FileWrapper | {'EXCEPTION, E} - FileWrapper = #'CosFileTransfer_FileWrapper'{the_file = File file_type = Type} - File = #objref - Type = nfile | ndirectory - - -

This operation, creates a FileWrapper which represents a file or directory, and - should be independent of the working Directory, - i.e., a full path name must be supplied. Furthermore, the file or - directory represented by the FileNameList must exist.

-
-
- - delete(FTS, File) -> Return - Delete the file or directory, represented by the Fileobject, from the target objects associated file system - - FTS = File = #objref - Return = ok | {'EXCEPTION', E} - - -

This operation removes the file or directory, represented by the File - object, from the target objects associated file system. If it is a non-empty - directory or non-existing file or directory an exception is raised.

-
-
- - transfer(FTS, SourceFile, DestinationFile) -> Return - Copy the file represented by the SourceFilefrom the target object's file system to a file in the destination FileTransferSession'sfile system - - FTS = SourceFile = DestinationFile = #objref - Return = ok | {'EXCEPTION', E} - - -

If the target object's and the DestinationFile's associated - FileTransferSession's support the same protocol(s) this operation - will copy the file represented by the SourceFile from the target - object's file system to a file in the destination - FileTransferSession's file system. The file is represented by the - DestinationFile object and may not exist. - This operation must be invoked on the FileTransferSession - associated with the SourceFile object.

-
-
- - append(FTS, SourceFile, DestinationFile) -> Return - Append the file represented by the SourceFilefrom the target object's file system to a file in the destination FileTransferSession'sfile system - - FTS = SourceFile = DestinationFile = #objref - Return = ok | {'EXCEPTION', E} - - -

This operation behaves almost like the transfer/3 operation. The - difference is that the DestinationFile must exist since the - SourceFile will be appended to the DestinationFile.

-

Currently, it is not possible to use this operation when the target - object represents FTP.

-
-
- - insert(FTS, SourceFile, DestinationFile, Offset) -> Return - Insert the SourceFileinto the DestinationFile Offsetbytes from the start of the file - - FTS = SourceFile = DestinationFile = #objref - Offset = long() - Return = ok | {'EXCEPTION', E} - - -

This operation behaves almost like the append/3 operation. The - difference is that the SourceFile will be inserted into the - DestinationFile Offset bytes from the start of the file.

-

Currently, it is not possible to use this operation when the target - object represents FTP.

-
-
- - logout(FTS) -> ok - Terminate the target object and close the connection to the file system it represents - - FTS = #objref - - -

This operation terminates the target object and closes the connection - to the file system it represents.

-
-
-
- -
- diff --git a/lib/cosFileTransfer/doc/src/CosFileTransfer_VirtualFileSystem.xml b/lib/cosFileTransfer/doc/src/CosFileTransfer_VirtualFileSystem.xml deleted file mode 100644 index 701e56e660..0000000000 --- a/lib/cosFileTransfer/doc/src/CosFileTransfer_VirtualFileSystem.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosFileTransfer_VirtualFileSystem - - - - 2000-11-09 - PA1 -
- CosFileTransfer_VirtualFileSystem - This module implements the OMG CosFileTransfer::VirtualFileSystem interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosFileTransfer/include/*.hrl").

-
- - - '_get_file_system_type'(VFS) -> Return - Return the target object's associated file system - - VFS = #objref - Return = 'FTP' | 'NATIVE' - - -

This read only attribute represents the target object's associated - file system.

-
-
- - '_get_supported_content_types'(VFS) -> Return - Return the target object's supported content types. - - VFS = #objref - Return = - - -

This read only attribute represents the target object's supported - content types.

-
-
- - login(VFS, User, Password, Account) -> Return - Create a new instance of a FileTransferSessionand a Directory - - VFS = #objref - User = Password = Account = string() - Return = {FileTransferSession, Directory} | {'EXCEPTION', E} - FileTransferSession = Directory = #objref - - -

This operation creates a new instance of a FileTransferSession - and a Directory. The later represents the current working - directory of the returned FileTransferSession.

-
-
-
- -
- diff --git a/lib/cosFileTransfer/doc/src/Makefile b/lib/cosFileTransfer/doc/src/Makefile deleted file mode 100644 index fcaa88c1e2..0000000000 --- a/lib/cosFileTransfer/doc/src/Makefile +++ /dev/null @@ -1,142 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2000-2017. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../../vsn.mk -VSN=$(COSFILETRANSFER_VSN) -APPLICATION=cosFileTransfer - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN) - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -XML_APPLICATION_FILES = ref_man.xml -XML_REF3_FILES = \ - cosFileTransferApp.xml \ - CosFileTransfer_Directory.xml \ - CosFileTransfer_File.xml \ - CosFileTransfer_VirtualFileSystem.xml \ - CosFileTransfer_FileTransferSession.xml \ - CosFileTransfer_FileIterator.xml - -XML_PART_FILES = \ - part.xml -XML_CHAPTER_FILES = \ - ch_contents.xml \ - ch_introduction.xml \ - ch_install.xml \ - ch_system.xml \ - ch_example.xml \ - notes.xml - -BOOK_FILES = book.xml - -XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \ - $(XML_PART_FILES) $(XML_CHAPTER_FILES) - -TECHNICAL_DESCR_FILES = - -GIF_FILES = \ - CosFileTransfer.gif - -PS_FILES = - -# ---------------------------------------------------- - -INTERNAL_HTML_FILES = $(TECHNICAL_DESCR_FILES:%.xml=$(HTMLDIR)/%.html) - -HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \ - $(XML_CHAPTER_FILES:%.xml=$(HTMLDIR)/%.html) \ - $(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html) - - -INFO_FILE = ../../info - -EXTRA_FILES = \ - $(DEFAULT_GIF_FILES) \ - $(DEFAULT_HTML_FILES) \ - $(XML_REF3_FILES:%.xml=$(HTMLDIR)/%.html) - -MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3) - -HTML_REF_MAN_FILE = $(HTMLDIR)/index.html - -TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -XML_FLAGS += -DVIPS_FLAGS += - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -$(HTMLDIR)/%.gif: %.gif - $(INSTALL_DATA) $< $@ - -docs: pdf html man - -$(TOP_PDF_FILE): $(XML_FILES) - -pdf: $(TOP_PDF_FILE) - -html: gifs $(HTML_REF_MAN_FILE) - -clean clean_docs: - rm -rf $(HTMLDIR)/* - rm -f $(MAN3DIR)/* - rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) - rm -f errs core *~ - -man: $(MAN3_FILES) - -gifs: $(GIF_FILES:%=$(HTMLDIR)/%) - -$(INDEX_TARGET): $(INDEX_SRC) - sed -e 's;%VSN%;$(VSN);' $(INDEX_SRC) > $(INDEX_TARGET) - -debug opt: - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_docs_spec: docs - $(INSTALL_DIR) "$(RELSYSDIR)/doc/pdf" - $(INSTALL_DATA) $(TOP_PDF_FILE) "$(RELSYSDIR)/doc/pdf" - $(INSTALL_DIR) "$(RELSYSDIR)/doc/html" - $(INSTALL_DATA) $(HTMLDIR)/* \ - "$(RELSYSDIR)/doc/html" - $(INSTALL_DATA) $(INFO_FILE) "$(RELSYSDIR)" - $(INSTALL_DIR) "$(RELEASE_PATH)/man/man3" - $(INSTALL_DATA) $(MAN3DIR)/* "$(RELEASE_PATH)/man/man3" - -release_spec: diff --git a/lib/cosFileTransfer/doc/src/book.xml b/lib/cosFileTransfer/doc/src/book.xml deleted file mode 100644 index 9a9ec3d0a2..0000000000 --- a/lib/cosFileTransfer/doc/src/book.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosFileTransfer - - - 2000-08-24 - 1.0 -
- - - cosFileTransfer - - - - - - - - - - - - - - -
- diff --git a/lib/cosFileTransfer/doc/src/ch_contents.xml b/lib/cosFileTransfer/doc/src/ch_contents.xml deleted file mode 100644 index bd4ed5116f..0000000000 --- a/lib/cosFileTransfer/doc/src/ch_contents.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - The cosFileTransfer Application - - - 2000-08-24 - 1.0 - ch_contents.xml -
- -
- Content Overview -

The cosFileTransfer documentation is divided into three sections: -

- - -

PART ONE - The User's Guide -

-Description of the cosFileTransfer Application including - services and a small tutorial demonstrating - the development of a simple service.

-
- -

PART TWO - Release Notes -

-A concise history of cosFileTransfer.

-
- -

PART THREE - The Reference Manual -

- A quick reference guide, including a - brief description, to all the functions available in cosFileTransfer.

-
-
-
- -
- Brief description of the User's Guide -

The User's Guide contains the following parts:

- - -

cosFileTransfer overview

-
- -

cosFileTransfer installation

-
- -

A tutorial example

-
-
-
-
- diff --git a/lib/cosFileTransfer/doc/src/ch_example.xml b/lib/cosFileTransfer/doc/src/ch_example.xml deleted file mode 100644 index 7e3c65eedd..0000000000 --- a/lib/cosFileTransfer/doc/src/ch_example.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosFileTransfer Examples - - - 2000-08-24 - A - ch_example.xml -
- -
- A tutorial on how to create a simple service - -
- Initiate the application -

To use the complete cosFileTransfer application cosProperty - must be installed.

-
- -
- How to run everything -

Below is a short transcript on how to run cosFileTransfer.

- - -%% Start Mnesia and Orber -mnesia:delete_schema([node()]), -mnesia:create_schema([node()]), -orber:install([node()]), -mnesia:start(), -orber:start(), - -%% The File Transfer Service depends on the cosProperty -%% application. Hence, we must install cosProperty first. -%% It's NOT necessary to invoke cosProperty:install_db(). -cosProperty:install(), - -%% Install File Transfer Service in the IFR. -cosFileTransfer:install(), - -%% Now start the application and necessary services. -cosFileTransfer:start(), - -%% Create two Virtual File Systems respectively representing an FTP- -%% and the local NFS file system. -VFSFTP = cosFileTransferApp:create_VFS('FTP', [], FTPHost, 21), -VFSNATIVE = cosFileTransferApp: - create_VFS({'NATIVE', 'cosFileTransferNATIVE_file'}, - [], MyLocalHost, 0), - -%% Login to each system. -{FSFTP, DirFTP} = 'CosFileTransfer_VirtualFileSystem': - login(VFSFTP, "myId", "myPwd", "myAccount"), -{FSNATIVE, DirNATIVE} = 'CosFileTransfer_VirtualFileSystem': - login(VFSNATIVE, "myId", "myPwd", "myAccount"), - -%% If we want to copy a file from the NFS to the FTP we must first -%% create a File object which contains its attributes. -Target = 'CosFileTransfer_FileTransferSession':create_file(FSFTP, - ["/", "ftp", "incoming", "targetFile"])), - - #'CosFileTransfer_FileWrapper'{the_file = Dir} = -%% Lookup the file we want to copy. -FileWrapper = 'CosFileTransfer_FileTransferSession':get_file(FSNATIVE, - ["/", "home", "myId", "sourceFile"]), -Source = FileWrapper#'CosFileTransfer_FileWrapper'.the_file, - -%% Now we are ready to transfer the file. Please note that we most -%% call the source Session object. -'CosFileTransfer_FileTransferSession':transfer(FSNATIVE, Source, Target), - -
-
-
- diff --git a/lib/cosFileTransfer/doc/src/ch_install.xml b/lib/cosFileTransfer/doc/src/ch_install.xml deleted file mode 100644 index 9681f98b45..0000000000 --- a/lib/cosFileTransfer/doc/src/ch_install.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Installing cosFileTransfer - - - 2000-08-24 - - ch_install.xml -
- -
- Installation Process -

This chapter describes how to install - cosFileTransferApp in an Erlang Environment. -

- -
- Preparation -

Before starting the installation process for cosFileTransfer, - the application Orber must be running and cosProperty installed by - using cosProperty:install(). Please note that it is NOT necessary - to use cosProperty:install_db() for running the cosFileTransfer application.

-
- -
- Configuration -

When starting the cosFileTransfer application the following configuration parameters - can be used:

- - buffert_size - default is 64000. This option determine - how many bytes will be read at a time when transferring files. - -
-
-
- diff --git a/lib/cosFileTransfer/doc/src/ch_introduction.xml b/lib/cosFileTransfer/doc/src/ch_introduction.xml deleted file mode 100644 index 67616b0a39..0000000000 --- a/lib/cosFileTransfer/doc/src/ch_introduction.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Introduction to cosFileTransfer - - - 2000-08-24 - - ch_introduction.xml -
- -
- Overview -

The cosFileTransfer application is a FileTransfer Service compliant with the - OMG Service CosFileTransfer. -

- -
- Purpose and Dependencies -

If a Virtual File System is started as 'FTP', the inets-2.5.4 application, - or later, must be installed.

-

cosFileTransfer is dependent on Orber, which provides CORBA functionality in an Erlang environment, - and cosProperty.

-
- -
- Prerequisites -

To fully understand the concepts presented in the - documentation, it is recommended that the user is familiar - with distributed programming, CORBA, the Orber and cosProperty applications. -

-

Recommended reading includes CORBA, Fundamentals and Programming - Jon Siegel and Open Telecom Platform Documentation Set. It is also helpful to have read Concurrent Programming in Erlang.

-
-
-
- diff --git a/lib/cosFileTransfer/doc/src/ch_system.xml b/lib/cosFileTransfer/doc/src/ch_system.xml deleted file mode 100644 index 377ec1fa49..0000000000 --- a/lib/cosFileTransfer/doc/src/ch_system.xml +++ /dev/null @@ -1,138 +0,0 @@ - - - - -
- - 20012016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Using the File Transfer Service - - - 2001-08-07 - - ch_system.xml -
- -
- Overview -

This chapter describes how two File Transfer Service applications interact.

- -
- Components -

There are several ways the OMG File Transfer Service can be used. - Below one scenario is visualized:

- - - Figure 1: The File Transfer Service Components. - - - Source ORB: this is the ORB we want to transfer a file from/via and it holds - an object reference to a - Virtual File System (VFS) which, - in this example, represents an FTP server. - Target ORB: the goal may be, for example, to transfer a new file or append to an - existing file placed at the location that this ORB's VFS represents. - In this scenario it is the local disk or the NFS. - Transport Protocol: initially the ORB's, i.e., target and source, communicate via - normal CORBA requests to determine whether or not they can communicate. If the - File Transfer Service's have one, or more, Transport Protocol in common the data - will be streamed using this protocol. The cosFileTransfer application currently supports - TCP/IP and SSL. - -

Which type of file system the VFS is supposed to represent is determined - by the options given when creating it, which is also how one determine which - Transport Protocol to use. Hence, the source and target VFS described above - can be started by invoking, respectively, the following operations:

- -1> SVFS = cosFileTransferApp:create_VFS('FTP', [], Host, 21, [{protocol, tcp}]), -2> TVFS = cosFileTransferApp:create_VFS({'NATIVE', 'cosFileTransferNATIVE_file'}, - [], OtherHost, 0, [{protocol, tcp}]), - -

Naturally can any combination of VFS-types be used and it is also possible - to use own drivers, i.e., {'NATIVE', 'MyDriver'}.

-

After creating necessary VFS's we can login in and perform operations - on files and directories residing on each file system.

-
- -
- How To Use SSL -

To be able to use SSL as transport protocol a few configuration - parameters must be set. The required parameters depend on if Orber is - the target or/and the source ORB. However, the SSL_CERT_FILE variable - must be defined in both cases.

-

Setting of a CA certificate file with an option does not work due to - weaknesses in the SSLeay package. A work-around in the ssl application is - to set the OS environment variable SSL_CERT_FILE before SSL is started. - However, then the CA certificate file will be global for all connections - (both incoming and outgoing calls).

- -
- Configurations when cosFileTransfer is Used as Target -

The following three configuration variables can be used to configure - cosFileTransfer's SSL target behavior.

- - ssl_server_certfile which is a path to a file containing a - chain of PEM encoded certificates for cosFileTransfer as target. - ssl_server_verify which specifies type of verification: - 0 = do not verify peer; 1 = verify peer, verify client once, 2 = - verify peer, verify client once, fail if no peer certificate. - The default value is 0. - ssl_server_depth which specifies verification depth, i.e. - how far in a chain of certificates the verification process shall - proceed before the verification is considered successful. The - default value is 1. - -

There also exist a number of API functions for accessing the values of - these variables:

- - cosFileTransferApp:ssl_server_certfile/0 - cosFileTransferApp:ssl_server_verify/0 - cosFileTransferApp:ssl_server_depth/0 - -
- -
- Configurations when cosFileTransfer is used as Source -

Below is the list of configuration variables used when cosFileTransfer - act as the source application.

- - ssl_client_certfile which is a path to a file containing a - chain of PEM encoded certificates used in outgoing calls. - ssl_client_verify which specifies type of verification: - 0 = do not verify peer; 1 = verify peer, verify client once, 2 = - verify peer, verify client once, fail if no peer certificate. - The default value is 0. - ssl_client_depth which specifies verification depth, i.e. - how far in a chain of certificates the verification process shall - proceed before the verification is considered successful. The - default value is 1. - -

There also exist a number of API functions for accessing the values of - these variables in the client processes:

- - cosFileTransferApp:ssl_client_certfile/0 - cosFileTransferApp:ssl_client_verify/0 - cosFileTransferApp:ssl_client_depth/0 - -
-
-
-
- diff --git a/lib/cosFileTransfer/doc/src/cosFileTransferApp.xml b/lib/cosFileTransfer/doc/src/cosFileTransferApp.xml deleted file mode 100644 index ae7b4f1ec5..0000000000 --- a/lib/cosFileTransfer/doc/src/cosFileTransferApp.xml +++ /dev/null @@ -1,173 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosFileTransferApp - - - - 2000-08-24 - PA1 -
- cosFileTransferApp - The main module of the cosFileTransfer application. - -

To get access to the record definitions for the structures use:

--include_lib("cosFileTransfer/include/*.hrl").

-

This module contains the functions for starting and stopping the application.

-
- - - install() -> Return - Install the cosFileTransfer application - - Return = ok | {'EXIT', Reason} - - -

This operation installs the cosFileTransfer application. Note, the - cosProperty application must be installed prior to invoking this - operation.

-
-
- - uninstall() -> Return - Uninstall the cosFileTransfer application - - Return = ok | {'EXIT', Reason} - - -

This operation uninstalls the cosFileTransfer application.

-
-
- - start() -> Return - Start the cosFileTransfer application - - Return = ok | {error, Reason} - - -

This operation starts the cosFileTransfer application.

-
-
- - stop() -> Return - Stop the cosFileTransfer application - - Return = ok | {error, Reason} - - -

This operation stops the cosFileTransfer application.

-
-
- - create_VFS(Type, Content, Host, Port [,Options]) -> Return - Create a new instance of a Virtual File System - - Type = 'FTP' | {'NATIVE', 'cosFileTransferNATIVE_file'} | {'NATIVE', MyModule} - Content = [] - Host = string(), e.g. "myHost@myServer" or "012.345.678.910" - Port = integer() - Options = [Option] - Option = {protocol, Protocol} | {connect_timeout, Seconds} - Protocol = tcp | ssl - Return = VFS | {'EXCEPTION, E} - VFS = #objref - - -

This operation creates a new instance of a Virtual File System. The - Type parameter determines which type we want the VFS to represent. - 'FTP' maps to the INETS ftp implementation, while - {'NATIVE', 'cosFileTransferNATIVE_file'} uses the file module. - It is also possible to implement own mappings which are activated by - supplying {'NATIVE', MyModule}. The MyModule module must export the same - functions and behave in the same way as the INETS ftp module, and - an operation named open(Host, Port), which shall return - {ok, Pid} or {error, Reason}.

-

If no Options are supplied the default setting will be - used, i.e., tcp and 60 seconds.

-

The Content parameter is currently ignored by must be supplied - as an empty list.

-
-
- - ssl_server_certfile() -> string() - Display the path to the target certificate - -

This function returns a path to a file containing a chain of PEM encoded - certificates for the cosFileTransfer as target. - This is configured by setting the application variable - ssl_server_certfile.

-
-
- - ssl_client_certfile() -> string() - Display the path to the client certificate - -

This function returns a path to a file containing a chain of PEM encoded - certificates used in outgoing calls. - The default value is configured by setting the application variable - ssl_client_certfile.

-
-
- - ssl_server_verify() -> 0 | 1 | 2 - Display the SSL verification type for incoming calls - -

This function returns the type of verification used by SSL during authentication of the other - peer for incoming calls. - It is configured by setting the application variable - ssl_server_verify.

-
-
- - ssl_client_verify() -> 0 | 1 | 2 - Display the SSL verification type for outgoing calls - -

This function returns the type of verification used by SSL during authentication of the other - peer for outgoing calls. - The default value is configured by setting the application variable - ssl_client_verify.

-
-
- - ssl_server_depth() -> int() - Display the SSL verification depth for incoming calls - -

This function returns the SSL verification depth for incoming calls. - It is configured by setting the application variable - ssl_server_depth.

-
-
- - ssl_client_depth() -> int() - Display the SSL verification depth for outgoing calls - -

This function returns the SSL verification depth for outgoing calls. - The default value is configured by setting the application variable - ssl_client_depth.

-
-
-
- -
- diff --git a/lib/cosFileTransfer/doc/src/notes.xml b/lib/cosFileTransfer/doc/src/notes.xml deleted file mode 100644 index e0b4bdf64b..0000000000 --- a/lib/cosFileTransfer/doc/src/notes.xml +++ /dev/null @@ -1,379 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosFileTransfer Release Notes - - - - 2000-08-24 - A - notes.xml -
- -
cosFileTransfer 1.2.2 - -
Fixed Bugs and Malfunctions - - -

Removed all old unused files in the documentation. -

-

- Own Id: OTP-14475 Aux Id: ERL-409, PR-1493

-
-
-
- -
- -
cosFileTransfer 1.2.1 - -
Improvements and New Features - - -

- Internal changes

-

- Own Id: OTP-13551

-
-
-
- -
- -
cosFileTransfer 1.2 - -
Improvements and New Features - - -

Remove the usage of erlang:now() from all Corba - applications and use the new rand module instead of - random.

-

- Own Id: OTP-12687

-
-
-
- -
- -
cosFileTransfer 1.1.16 - -
Improvements and New Features - - -

The default encoding of Erlang files has been changed - from ISO-8859-1 to UTF-8.

The encoding of XML - files has also been changed to UTF-8.

-

- Own Id: OTP-10907

-
-
-
- -
- -
cosFileTransfer 1.1.15 - -
Improvements and New Features - - -

Postscript files no longer needed for the generation - of PDF files have been removed.

-

- Own Id: OTP-11016

-
-
-
- -
- -
cosFileTransfer 1.1.14 - -
Improvements and New Features - - -

- Misc build updates

-

- Own Id: OTP-10784

-
-
-
- -
- -
cosFileTransfer 1.1.13 - -
Improvements and New Features - - -

Erlang/OTP can now be built using parallel make if you - limit the number of jobs, for instance using 'make - -j6' or 'make -j10'. 'make -j' does not - work at the moment because of some missing - dependencies.

-

- Own Id: OTP-9451

-
-
-
- -
- -
cosFileTransfer 1.1.12 - -
Fixed Bugs and Malfunctions - - -

XML files have been corrected.

-

- Own Id: OTP-9550 Aux Id: OTP-9541

-
-
-
- -
- -
- cosFileTransfer 1.1.11 - -
- Improvements and New Features - - -

- Removed superfluous usage of shy in the documentation since it can cause problem if - a buggy tool is used.

-

- Own Id: OTP-9319 Aux Id:

-
-
-
-
- -
- cosFileTransfer 1.1.10 - -
- Improvements and New Features - - -

- Removed obsolete SSL dependency.

-

- Own Id: OTP-8374 Aux Id:

-
-
-
- -
- Fixed Bugs and Malfunctions - - -

The documentation EIX file was not generated.

-

Own id: OTP-8355 Aux Id:

-
-
-
-
- -
- cosFileTransfer 1.1.9 - -
- Improvements and New Features - - -

- The documentation is now built with open source tools (xsltproc and fop) - that exists on most platforms. One visible change is that the frames are removed.

-

- Own Id: OTP-8201 Aux Id:

-
-
-
-
- -
- cosFileTransfer 1.1.8 - -
- Improvements and New Features - - -

Obsolete guards, e.g. record vs is_record, has been changed - to avoid compiler warnings.

-

Own id: OTP-7987

-
-
-
-
- -
- cosFileTransfer 1.1.7 - -
- Improvements and New Features - - -

Updated file headers.

-

Own id: OTP-7837

-
-
-
-
- -
- cosFileTransfer 1.1.6 - -
- Improvements and New Features - - -

Documentation source included in open source releases.

-

Own id: OTP-7595

-
-
-
-
- Fixed Bugs and Malfunctions - - -

When using predefined native file copy the return values from - file operation was not handled correctly.

-

Own id: OTP-7599

-
-
-
-
- -
- cosFileTransfer 1.1.5 - -
- Improvements and New Features - - -

CosFileTransfer now uses the changed Inets API.

-

Own id: OTP-7020

-
-
-
-
- -
- cosFileTransfer 1.1.4 - -
- Improvements and New Features - - -

The documentation source has been converted from SGML to XML.

-

Own id: OTP-6754

-
-
-
-
- -
- cosFileTransfer 1.1.3 - -
- Improvements and New Features - - -

Minor Makefile changes.

-

Own id: OTP-6701

-
-
-
-
- -
- cosFileTransfer 1.1.2 - -
- Improvements and New Features - - -

Due to changed behavior of the ftp client a few changes - has been made.

-

Own id: OTP-5135

-
-
-
-
- -
- cosFileTransfer 1.1.1 - -
- Fixed Bugs and Malfunctions - - -

Depending on which ftp server is used, the operation - CosFileTransfer::Directory::list could fail.

-

Own id: OTP-4954

-
-
-
-
- -
- cosFileTransfer 1.1 - -
- Improvements and New Features - - -

The stub/skeleton-files generated by IC have been improved, - i.e., depending on the IDL-files, reduced the size of the - erl- and beam-files and decreased dependencies off Orber's - Interface Repository. It is necessary to re-compile all IDL-files - and use COS-applications, including Orber, compiled with - IC-4.2.

-

Own id: OTP-4576

-
-
-
-
- -
- cosFileTransfer 1.0.2 - -
- Improvements and New Features - - -

First release of the cosFileTransfer application. Please note that - the OMG specification was not finalized when this version - was released. Hence, the API may be changed in way which is not - compatible with this version. Contact support if you are in doubt.

-

Own Id: -

-
-
-
-
-
- diff --git a/lib/cosFileTransfer/doc/src/part.xml b/lib/cosFileTransfer/doc/src/part.xml deleted file mode 100644 index b4e6f573dd..0000000000 --- a/lib/cosFileTransfer/doc/src/part.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosFileTransfer User's Guide - - - 2000-08-24 - 1.0 -
- -

The cosFileTransfer Application is an Erlang implementation of the OMG - CORBA FileTransfer Service.

-
- - - - - -
- diff --git a/lib/cosFileTransfer/doc/src/ref_man.xml b/lib/cosFileTransfer/doc/src/ref_man.xml deleted file mode 100644 index ce050128e6..0000000000 --- a/lib/cosFileTransfer/doc/src/ref_man.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosFileTransfer Reference Manual - - - 2000-08-24 - 1.0 -
- -

The cosFileTransfer Application is an Erlang implementation of the OMG - CORBA File Transfer Service.

-
- > - > - > - > - > - > -
- diff --git a/lib/cosFileTransfer/ebin/.gitignore b/lib/cosFileTransfer/ebin/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosFileTransfer/examples/.gitignore b/lib/cosFileTransfer/examples/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosFileTransfer/include/.gitignore b/lib/cosFileTransfer/include/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosFileTransfer/info b/lib/cosFileTransfer/info deleted file mode 100644 index e5ca860f1c..0000000000 --- a/lib/cosFileTransfer/info +++ /dev/null @@ -1,3 +0,0 @@ -group: orb -short: Orber OMG File Transfer Service - diff --git a/lib/cosFileTransfer/priv/.gitignore b/lib/cosFileTransfer/priv/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosFileTransfer/src/CosFileTransfer.cfg b/lib/cosFileTransfer/src/CosFileTransfer.cfg deleted file mode 100644 index a98f102e73..0000000000 --- a/lib/cosFileTransfer/src/CosFileTransfer.cfg +++ /dev/null @@ -1,10 +0,0 @@ -{this, "CosFileTransfer::Directory"}. -{{handle_info, "CosFileTransfer::Directory"}, true}. -{this, "CosFileTransfer::File"}. -{{handle_info, "CosFileTransfer::File"}, true}. -{this, "CosFileTransfer::VirtualFileSystem"}. -{{handle_info, "CosFileTransfer::VirtualFileSystem"}, true}. -{this, "CosFileTransfer::FileTransferSession"}. -{{handle_info, "CosFileTransfer::FileTransferSession"}, true}. -{this, "CosFileTransfer::FileIterator"}. -{{handle_info, "CosFileTransfer::FileIterator"}, true}. diff --git a/lib/cosFileTransfer/src/CosFileTransfer.idl b/lib/cosFileTransfer/src/CosFileTransfer.idl deleted file mode 100644 index 2eb310478a..0000000000 --- a/lib/cosFileTransfer/src/CosFileTransfer.idl +++ /dev/null @@ -1,157 +0,0 @@ -//File: CosFileTransfer.idl -#ifndef _COS_FILE_TRANSFER_IDL_ -#define _COS_FILE_TRANSFER_IDL_ - -#include -#pragma prefix "omg.org" - -module CosFileTransfer { - - typedef string Istring; - typedef Istring ProtocolAddress; - typedef long ContentType; - - const ContentType FTAM_1 = 1; - const ContentType FTAM_2 = 2; - const ContentType FTAM_3 = 3; - const ContentType FTAM_4 = 4; - const ContentType FTAM_5 = 5; - const ContentType NBS_9 = 6; - const ContentType INTAP_1 = 7; - - exception CommandNotImplementedException { Istring reason; }; - exception SessionException { Istring reason; }; - exception TransferException { Istring reason; }; - exception FileNotFoundException { Istring reason; }; - exception RequestFailureException { Istring reason; }; - exception IllegalOperationException { Istring reason; }; - - interface VirtualFileSystem; - - struct AccessLevel { - boolean read; - boolean insert; - boolean replace; - boolean extend; - boolean erase; - boolean read_attr; - boolean change_attr; - boolean delete; - }; - - typedef sequence ProtocolAddressList; - - struct ProtocolSupport { - Istring protocol_name; - ProtocolAddressList addresses; - }; - - typedef sequence SupportedProtocolAddresses; - - interface Directory; - interface FileTransferSession; - - typedef Istring FileName; - typedef sequence FileNameList; - - interface File:CosPropertyService::PropertySetDef { - - readonly attribute FileName name; - readonly attribute FileNameList complete_file_name; - readonly attribute Directory parent; - readonly attribute FileTransferSession associated_session; - - }; - - enum FileType {nfile, ndirectory}; - - struct FileWrapper { - File the_file; - FileType file_type; - }; - - typedef sequence FileList; - - interface FileIterator; - interface Directory : File { - - void list(in unsigned long how_many, out FileList fl, out FileIterator fi); - - }; - - interface FileIterator { - - boolean next_one(out FileWrapper f); - boolean next_n(in unsigned long how_many, out FileList fl); - - void destroy(); - }; - - interface FileTransferSession { - - readonly attribute SupportedProtocolAddresses protocols_supported; - - void set_directory(in Directory new_directory) - raises(SessionException, FileNotFoundException, RequestFailureException, - IllegalOperationException); - - File create_file(in FileNameList name) - raises(SessionException, FileNotFoundException, RequestFailureException, - IllegalOperationException); - - Directory create_directory(in FileNameList name) - raises(SessionException, FileNotFoundException, RequestFailureException, - IllegalOperationException); - - FileWrapper get_file(in FileNameList complete_file_name) - raises(SessionException, FileNotFoundException, RequestFailureException, - IllegalOperationException); - - void delete(in File file) - raises(SessionException, FileNotFoundException, RequestFailureException, - IllegalOperationException); - - void transfer(in File src, in File dest) - raises(SessionException, TransferException, FileNotFoundException, - RequestFailureException, IllegalOperationException); - - void append(in File src, in File dest) - raises(CommandNotImplementedException, SessionException, TransferException, - FileNotFoundException, RequestFailureException, - IllegalOperationException); - - void insert(in File src, in File dest, in long offset) - raises(CommandNotImplementedException, SessionException, TransferException, - FileNotFoundException, RequestFailureException, - IllegalOperationException); - - void logout(); - - // WARNING!!! - // Theses are Orber specific operations and may only be used internally!! - // Maybe removed, altered and changed in any way without warning!! - Directory oe_orber_create_directory_current() - raises(SessionException, FileNotFoundException, IllegalOperationException); - FileList oe_orber_get_content(in FileNameList complete_file_name, - in Directory parent); - long oe_orber_count_children(in FileNameList complete_file_name); - - }; - - interface VirtualFileSystem { - - enum NativeFileSystemType { FTAM, FTP, NATIVE }; - - readonly attribute NativeFileSystemType file_system_type; - - typedef sequence ContentList; - - readonly attribute ContentList supported_content_types; - - FileTransferSession login(in Istring username, in Istring password, - in Istring account, out Directory root) - raises(SessionException, FileNotFoundException, IllegalOperationException); - }; -}; - -#endif //_COS_FILE_TRANSFER_IDL_ diff --git a/lib/cosFileTransfer/src/CosFileTransfer_Directory_impl.erl b/lib/cosFileTransfer/src/CosFileTransfer_Directory_impl.erl deleted file mode 100644 index 8ce6cebf77..0000000000 --- a/lib/cosFileTransfer/src/CosFileTransfer_Directory_impl.erl +++ /dev/null @@ -1,453 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosFileTransfer_Directory_impl -%% Description : -%% -%% Created : 12 Sept 2000 -%%---------------------------------------------------------------------- --module('CosFileTransfer_Directory_impl'). - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). - --include_lib("cosProperty/include/CosPropertyService.hrl"). - --include("cosFileTransferApp.hrl"). - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- --export([init/1, - terminate/2]). - -%% Interface functions --export([list/3]). - -%% Inherited CosFileTransfer::File --export(['_get_name'/2, - '_get_complete_file_name'/2, - '_get_parent'/2, - '_get_associated_session'/2]). - -%% Inherited CosPropertyService::PropertySetDef --export([get_allowed_property_types/2, - get_allowed_properties/2, - define_property_with_mode/5, - define_properties_with_modes/3, - get_property_mode/3, - get_property_modes/3, - set_property_mode/4, - set_property_modes/3]). - -%% Inherited CosPropertyService::PropertySet --export([define_property/4, - define_properties/3, - get_number_of_properties/2, - get_all_property_names/3, - get_property_value/3, - get_properties/3, - get_all_properties/3, - delete_property/3, - delete_properties/3, - delete_all_properties/2, - is_property_defined/3]). - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {property, - name, - completeName, - parent, - assocSession}). - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- --define(create_InitState(Pr, N, C, Pa, A), - #state{property = Pr, - name = N, - completeName = C, - parent = Pa, - assocSession = A}). - --define(get_PropertyRef(S), S#state.property). --define(get_Name(S), S#state.name). --define(get_CompleteName(S), S#state.completeName). --define(get_Parent(S), S#state.parent). --define(get_AssocSession(S), S#state.assocSession). - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%---------------------------------------------------------------------- -init([Name, CompleteName, Parent, AssocSession]) -> - PropTypes = [tk_long, tk_boolean], - %% WARNING if the order of the properties is changed so must - %% get_all_properties/3 in this module be as well! - PropDefs = [#'CosPropertyService_PropertyDef' - {property_name = "num_children", - property_value = #any{typecode=tk_long, value=0}, - property_mode = fixed_readonly}, - #'CosPropertyService_PropertyDef' - {property_name = "is_directory", - property_value = #any{typecode=tk_boolean, value=true}, - property_mode = fixed_readonly}], - Prop = cosProperty:create_static_SetDef(PropTypes, PropDefs), - {ok, ?create_InitState(Prop, Name, CompleteName, Parent, AssocSession)}. - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Returns : any (ignored by gen_server) -%% Description: Shutdown the server -%%---------------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -%%====================================================================== -%% CosFileTransfer::Directory -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : list -%% Arguments : Max - ulong() -%% Returns : {ok, FileList, FileIterator} -%% Description: -%%---------------------------------------------------------------------- -list(OE_This, State, Max) -> - case 'CosFileTransfer_FileTransferSession': - oe_orber_get_content(?get_AssocSession(State), ?get_CompleteName(State), - OE_This) of - [] -> - {reply, {ok, [], corba:create_nil_objref()}, State}; - FileList when length(FileList) > Max -> - {reply, - {ok, lists:sublist(FileList, Max), - 'CosFileTransfer_FileIterator':oe_create([lists:nthtail(Max, - FileList)])}, - State}; - FileList -> - {reply, {ok, FileList, corba:create_nil_objref()}, State} - end. - -%%====================================================================== -%% CosFileTransfer::File -%%====================================================================== -%%---------------------------------------------------------------------% -%% Function : '_get_name' -%% Arguments : - -%% Returns : CosFileTransfer::FileName - string -%% Description: -%%---------------------------------------------------------------------- -'_get_name'(_OE_This, State) -> - {reply, ?get_Name(State), State}. - -%%---------------------------------------------------------------------% -%% Function : '_get_complete_file_name' -%% Arguments : - -%% Returns : CosFileTransfer::FileNameList - a list of strings's -%% Description: -%%---------------------------------------------------------------------- -'_get_complete_file_name'(_OE_This, State) -> - {reply, ?get_CompleteName(State), State}. - -%%---------------------------------------------------------------------% -%% Function : '_get_parent' -%% Arguments : - -%% Returns : CosFileTransfer::Directory -%% Description: -%%---------------------------------------------------------------------- -'_get_parent'(_OE_This, State) -> - {reply, ?get_Parent(State), State}. - -%%---------------------------------------------------------------------% -%% Function : '_get_associated_session' -%% Arguments : - -%% Returns : CosFileTransfer::FileTransferSession -%% Description: -%%---------------------------------------------------------------------- -'_get_associated_session'(_OE_This, State) -> - {reply, ?get_AssocSession(State), State}. - -%%====================================================================== -%% CosPropertyService::PropertySetDef -%%====================================================================== -%%---------------------------------------------------------------------% -%% Function : get_allowed_property_types -%% Arguments : - -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_allowed_property_types(_OE_This, State) -> - {reply, 'CosPropertyService_PropertySetDef': - get_allowed_property_types(?get_PropertyRef(State)), State}. - -%%---------------------------------------------------------------------% -%% Function : get_allowed_properties -%% Arguments : - -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_allowed_properties(_OE_This, State) -> - {reply, 'CosPropertyService_PropertySetDef': - get_allowed_properties(?get_PropertyRef(State)), State}. - -%%---------------------------------------------------------------------% -%% Function : define_property_with_mode -%% Arguments : Name - string() -%% Value - #any{} -%% Mode - normal | read_only | fixed_normal | fixed_readonly -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -define_property_with_mode(_OE_This, State, Name, Value, Mode) -> - {reply, 'CosPropertyService_PropertySetDef': - define_property_with_mode(?get_PropertyRef(State), Name, Value, Mode), State}. - -%%---------------------------------------------------------------------% -%% Function : define_properties_with_modes -%% Arguments : PropertyDefs - list of #'CosPropertyService_PropertyDef'{} -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -define_properties_with_modes(_OE_This, State, PropertyDefs) -> - {reply, 'CosPropertyService_PropertySetDef': - define_properties_with_modes(?get_PropertyRef(State), PropertyDefs), State}. - -%%---------------------------------------------------------------------% -%% Function : get_property_mode -%% Arguments : Name - string() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_property_mode(_OE_This, State, Name) -> - {reply, 'CosPropertyService_PropertySetDef': - get_property_mode(?get_PropertyRef(State), Name), State}. - - -%%---------------------------------------------------------------------% -%% Function : get_property_modes -%% Arguments : Names - a list of Name (i.e. string()'s). -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_property_modes(_OE_This, State, Names) -> - {reply, 'CosPropertyService_PropertySetDef': - get_property_modes(?get_PropertyRef(State), Names), State}. - -%%---------------------------------------------------------------------% -%% Function : set_property_mode -%% Arguments : Name - string() -%% Mode - normal | read_only | fixed_normal | fixed_readonly -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -set_property_mode(_OE_This, State, Name, Mode) -> - {reply, 'CosPropertyService_PropertySetDef': - set_property_mode(?get_PropertyRef(State), Name, Mode), State}. - - -%%---------------------------------------------------------------------% -%% Function : set_property_modes -%% Arguments : Modes - a list of #'CosPropertyService_PropertyModes'{} -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -set_property_modes(_OE_This, State, PropertyModes) -> - {reply, 'CosPropertyService_PropertySetDef': - set_property_modes(?get_PropertyRef(State), PropertyModes), State}. - -%%====================================================================== -%% CosPropertyService::PropertySet -%%====================================================================== -%%---------------------------------------------------------------------% -%% Function : define_property -%% Arguments : Name - string() -%% Value - #any{} -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -define_property(_OE_This, State, Name, Value) -> - {reply, 'CosPropertyService_PropertySet': - define_property(?get_PropertyRef(State), Name, Value), State}. - -%%---------------------------------------------------------------------% -%% Function : define_properties -%% Arguments : Properties - a list of #'CosPropertyService_Property'{} -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -define_properties(_OE_This, State, Properties) -> - {reply, 'CosPropertyService_PropertySet': - define_properties(?get_PropertyRef(State), Properties), State}. - - -%%---------------------------------------------------------------------% -%% Function : get_number_of_properties -%% Arguments : - -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_number_of_properties(_OE_This, State) -> - {reply, 'CosPropertyService_PropertySet': - get_number_of_properties(?get_PropertyRef(State)), State}. - -%%---------------------------------------------------------------------% -%% Function : get_all_property_names -%% Arguments : Max - ulong() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_all_property_names(_OE_This, State, Max) -> - {reply, 'CosPropertyService_PropertySet': - get_all_property_names(?get_PropertyRef(State), Max), State}. - -%%---------------------------------------------------------------------% -%% Function : get_property_value -%% Arguments : Name - string() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_property_value(_OE_This, State, "num_children") -> - Count = 'CosFileTransfer_FileTransferSession': - oe_orber_count_children(?get_AssocSession(State), ?get_CompleteName(State)), - {reply, #any{typecode=tk_long, value=Count}, State}; -get_property_value(_OE_This, State, Name) -> - {reply, 'CosPropertyService_PropertySet': - get_property_value(?get_PropertyRef(State), Name), State}. - -%%---------------------------------------------------------------------% -%% Function : get_properties -%% Arguments : Names - a list of Name (i.e. string()'s) -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_properties(_OE_This, State, Names) -> - {Bool, Props} = - 'CosPropertyService_PropertySet':get_properties(?get_PropertyRef(State), - Names), - NewProps = change_property(Props, [], State), - {reply, {Bool, NewProps}, State}. - -change_property([], Acc, _State) -> - Acc; -change_property([H|T], Acc, State) -> - NewAcc = - case H of - #'CosPropertyService_Property'{property_name = "num_children"} -> - Count = 'CosFileTransfer_FileTransferSession': - oe_orber_count_children(?get_AssocSession(State), - ?get_CompleteName(State)), - [H#'CosPropertyService_Property' - {property_value = #any{typecode=tk_long, value=Count}}|Acc]; - _ -> - [H|Acc] - end, - change_property(T, NewAcc, State). - -%%---------------------------------------------------------------------% -%% Function : get_all_properties -%% Arguments : Max - ulong() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_all_properties(_OE_This, State, 0) -> - %% WARNING if we start supporting more than 10 Properties the next line must - %% be updated! - {ok, Props, _Iterator} = - 'CosPropertyService_PropertySet':get_all_properties(?get_PropertyRef(State), - 10), - NewProps = change_property(Props, [], State), - %% WARNING if the cosProperty:start_PropertiesIterator/1 is updated - %% it must be done hear as well. - {reply, {ok, [], cosProperty:start_PropertiesIterator(NewProps)}, State}; -get_all_properties(_OE_This, State, Max) -> - {ok, Props, Iterator} = - 'CosPropertyService_PropertySet':get_all_properties(?get_PropertyRef(State), - Max), - NewProps = change_property(Props, [], State), - {reply, {ok, NewProps, Iterator}, State}. - -%%---------------------------------------------------------------------% -%% Function : delete_property -%% Arguments : Name - string() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -delete_property(_OE_This, State, Name) -> - {reply, 'CosPropertyService_PropertySet': - delete_property(?get_PropertyRef(State), Name), State}. - - -%%---------------------------------------------------------------------% -%% Function : delete_properties -%% Arguments : Names - a list of Name (i.e. string()'s) -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -delete_properties(_OE_This, State, Names) -> - {reply, 'CosPropertyService_PropertySet': - delete_properties(?get_PropertyRef(State), Names), State}. - - -%%---------------------------------------------------------------------% -%% Function : delete_all_properties -%% Arguments : - -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -delete_all_properties(_OE_This, State) -> - {reply, 'CosPropertyService_PropertySet': - delete_all_properties(?get_PropertyRef(State)), State}. - -%%---------------------------------------------------------------------% -%% Function : is_property_defined -%% Arguments : Name - string() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -is_property_defined(_OE_This, State, Name) -> - {reply, 'CosPropertyService_PropertySet': - is_property_defined(?get_PropertyRef(State), Name), State}. - -%%====================================================================== -%% Internal functions -%%====================================================================== - -%%====================================================================== -%% END OF MODULE -%%====================================================================== - diff --git a/lib/cosFileTransfer/src/CosFileTransfer_FileIterator_impl.erl b/lib/cosFileTransfer/src/CosFileTransfer_FileIterator_impl.erl deleted file mode 100644 index d824129147..0000000000 --- a/lib/cosFileTransfer/src/CosFileTransfer_FileIterator_impl.erl +++ /dev/null @@ -1,158 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosFileTransfer_FileIterator_impl.erl -%% Description : -%% -%% Created : 12 Sept 2000 -%%---------------------------------------------------------------------- --module('CosFileTransfer_FileIterator_impl'). - - - - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include("cosFileTransferApp.hrl"). - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- --export([init/1, - terminate/2, - code_change/3, - handle_info/2]). - -%% Interface functions --export([next_one/2, - next_n/3, - destroy/2]). - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- --export([]). - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%---------------------------------------------------------------------- -init([FileList]) -> - {ok, FileList}. - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Returns : any (ignored by gen_server) -%% Description: Shutdown the server -%%---------------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -%%---------------------------------------------------------------------- -%% Function : code_change/3 -%% Returns : {ok, NewState} -%% Description: Convert process state when code is changed -%%---------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%---------------------------------------------------------------------% -%% function : handle_info/2 -%% Arguments: -%% Returns : -%% Effect : -%%---------------------------------------------------------------------- -handle_info(Info, State) -> - case Info of - {'EXIT', _Pid, Reason} -> - {stop, Reason, State}; - _Other -> - {noreply, State} - end. - -%%====================================================================== -%% CosFileTransfer::FileIterator -%%====================================================================== -%%---------------------------------------------------------------------% -%% Function : next_one -%% Arguments : -%% Returns : {boolean(), FileWrapper} -%% Description: -%%---------------------------------------------------------------------- -next_one(_OE_This, []) -> - {reply, {false, - #'CosFileTransfer_FileWrapper'{the_file = corba:create_nil_objref(), - file_type = nfile}}, []}; -next_one(_OE_This, [FileWrapper]) -> - {reply, {true, FileWrapper}, []}; -next_one(_OE_This, [FileWrapper|Rest]) -> - {reply, {true, FileWrapper}, Rest}. - -%%---------------------------------------------------------------------% -%% Function : next_n -%% Arguments : HowMany - ulong() -%% Returns : {boolean(), FileWrapperList} -%% Description: -%%---------------------------------------------------------------------- -next_n(_OE_This, [], _) -> - {reply, {false, []}, []}; -next_n(_OE_This, FileWrapperList, HowMany) when HowMany > length(FileWrapperList) -> - {reply, {true, FileWrapperList}, []}; -next_n(_OE_This, FileWrapperList, HowMany) -> - {reply, {true, lists:sublist(FileWrapperList, HowMany)}, - lists:nthtail(HowMany, FileWrapperList)}. - -%%---------------------------------------------------------------------% -%% Function : destroy -%% Arguments : - -%% Returns : - -%% Description: -%%---------------------------------------------------------------------- -destroy(_OE_This, State) -> - {stop, normal, ok, State}. - - -%%====================================================================== -%% Internal functions -%%====================================================================== - - - -%%====================================================================== -%% END OF MODULE -%%====================================================================== diff --git a/lib/cosFileTransfer/src/CosFileTransfer_FileTransferSession_impl.erl b/lib/cosFileTransfer/src/CosFileTransfer_FileTransferSession_impl.erl deleted file mode 100644 index 3a8285f092..0000000000 --- a/lib/cosFileTransfer/src/CosFileTransfer_FileTransferSession_impl.erl +++ /dev/null @@ -1,1061 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosFileTransfer_FileTransferSession_impl.erl -%% Description : -%% -%% Created : 12 Sept 2000 -%%---------------------------------------------------------------------- --module('CosFileTransfer_FileTransferSession_impl'). - - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). - --include("cosFileTransferApp.hrl"). - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- --export([init/1, - terminate/2, - code_change/3, - handle_info/2]). - -%% Interface functions --export(['_get_protocols_supported'/2, - set_directory/3, - create_file/3, - create_directory/3, - get_file/3, - delete/3, - transfer/4, - append/4, - insert/5, - logout/2]). - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- --export([oe_orber_create_directory_current/2, oe_orber_get_content/4, - oe_orber_count_children/3]). --export([invoke_call/3]). - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {protocols, server, type, current, module, connection, mytype, - connection_timeout}). - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- --define(create_InitState(P, S, T, C, M, Co, Ty, CT), - #state{protocols=P, server=S, type=T, current=C, module=M, connection=Co, - mytype=Ty, connection_timeout=CT}). - --define(get_Protocols(S), S#state.protocols). --define(get_Server(S), S#state.server). --define(get_CurrentDir(S), S#state.current). --define(get_Module(S), S#state.module). --define(get_Connection(S), S#state.connection). --define(get_MyType(S), S#state.mytype). --define(get_ConnectionTimeout(S), S#state.connection_timeout). --define(set_CurrentDir(S, C), S#state{current=C}). - --define(is_FTP(S), S#state.type=='FTP'). --define(is_FTAM(S), S#state.type=='FTAM'). --define(is_NATIVE(S), S#state.type=='NATIVE'). --define(is_ORBER_NATIVE(S), S#state.module==cosFileTransferNATIVE_file). - - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%---------------------------------------------------------------------- -init(['FTP', Host, Port, User, Password, _Account, Protocol, Timeout]) -> - {ok, Pid} = inets:start(ftpc, [{host, Host}, {port, Port}], stand_alone), - ok = ftp:user(Pid, User, Password), - {ok, PWD} = ftp:pwd(Pid), - {Connection, ProtocolSupport} = setup_local(Protocol), - {ok, ?create_InitState(ProtocolSupport, Pid, 'FTP', - PWD, ftp, Connection, Protocol, Timeout)}; -init([{'NATIVE', Mod}, Host, Port, User, Password, _Account, Protocol, Timeout]) -> - {ok, Pid} = Mod:open(Host, Port), - ok = Mod:user(Pid, User, Password), - {ok, PWD} = Mod:pwd(Pid), - {Connection, ProtocolSupport} = setup_local(Protocol), - {ok, ?create_InitState(ProtocolSupport, Pid, 'NATIVE', - PWD, Mod, Connection, Protocol, Timeout)}. - - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Returns : any (ignored by gen_server) -%% Description: Shutdown the server -%%---------------------------------------------------------------------- -terminate(_Reason, #state{type = Type, server = Server, module = Mod} = State) -> - case ?get_MyType(State) of - ssl -> - catch ssl:close(?get_Connection(State)); - _ -> - catch gen_tcp:close(?get_Connection(State)) - end, - case Type of - 'FTP' -> - inets:stop(ftpc, Server); - 'NATIVE' -> - Mod:close(Server); - _ -> - ok - end, - ok. - -%%---------------------------------------------------------------------- -%% Function : code_change/3 -%% Returns : {ok, NewState} -%% Description: Convert process state when code is changed -%%---------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%---------------------------------------------------------------------% -%% function : handle_info/2 -%% Arguments: -%% Returns : -%% Effect : -%%---------------------------------------------------------------------- -handle_info(Info, State) -> - case Info of - {'EXIT', _Pid, Reason} -> - {stop, Reason, State}; - _Other -> - {noreply, State} - end. - -%%====================================================================== -%% CosFileTransfer::FileTransferSession -%%====================================================================== -%%---------------------------------------------------------------------% -%% Function : _get_protocols_supported -%% Arguments : -%% Returns : A list of CosFileTransfer::ProtocolSupport, i.e., -%% struct ProtocolSupport { -%% Istring protocol_name; -%% ProtocolAddressList addresses; %% eq a list of strings. -%% }; -%% Description: -%%---------------------------------------------------------------------- -'_get_protocols_supported'(_OE_This, State) -> - {reply, ?get_Protocols(State), State}. - -%%---------------------------------------------------------------------- -%% Function : set_directory -%% Arguments : Directory - CosFileTransfer::Directory -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -set_directory(_OE_This, State, Directory) when ?is_FTP(State); ?is_NATIVE(State) -> - Mod = ?get_Module(State), - Path = filename:join('CosFileTransfer_Directory': - '_get_complete_file_name'(Directory)), - case catch Mod:cd(?get_Server(State), Path) of - ok -> - {reply, ok, ?set_CurrentDir(State, Path)}; - {error, epath} -> - corba:raise(#'CosFileTransfer_FileNotFoundException' - {reason="Directory not found."}); - {error, elogin} -> - corba:raise(#'CosFileTransfer_SessionException' - {reason="User not loggen in."}); - {error, econn} -> - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Premature connection ending."}); - _ -> - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason = "Unexpected error."}) - end. - -%%---------------------------------------------------------------------- -%% Function : create_file -%% Arguments : FileNameList -%% Returns : File -%% Description: This operation creates a File Object representing a -%% file which may or may not exist. Typically used as -%% argument when invoking transfer/3. See also get_file/2. -%%---------------------------------------------------------------------- -create_file(OE_This, State, FileNameList) -> - {reply, cosFileTransferApp:create_file(OE_This, FileNameList), State}. - -%%---------------------------------------------------------------------- -%% Function : create_directory -%% Arguments : FileNameList - full path name. -%% Returns : Directory -%% Description: -%%---------------------------------------------------------------------- -create_directory(OE_This, State, FileNameList) when ?is_FTP(State); - ?is_NATIVE(State) -> - Mod = ?get_Module(State), - case Mod:mkdir(?get_Server(State), filename:join(FileNameList)) of - ok -> - {reply, cosFileTransferApp:create_dir(OE_This, FileNameList), State}; - {error, epath} -> - corba:raise(#'CosFileTransfer_FileNotFoundException' - {reason="Directory not found."}); - {error, elogin} -> - corba:raise(#'CosFileTransfer_SessionException' - {reason="User not loggen in."}); - {error, econn} -> - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Premature connection ending."}); - _ -> - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Unknown error."}) - end. - - -%%---------------------------------------------------------------------- -%% Function : get_file -%% Arguments : FileNameList -%% Returns : FileWrapper -%% Description: This operation should be independent of the working Directory, -%% i.e., a full path name must be supplied. The file or -%% directory the returned object is supposed to represent -%% MUST(!!!!) exist. -%%---------------------------------------------------------------------- -get_file(OE_This, State, FileNameList) when ?is_FTP(State); - ?is_NATIVE(State) -> - case check_type(OE_This, State, filename:join(FileNameList)) of - {ndirectory, _Listing} -> - {reply, - #'CosFileTransfer_FileWrapper'{the_file = - cosFileTransferApp: - create_dir(OE_This, - FileNameList), - file_type = ndirectory}, - State}; - nfile -> - {reply, - #'CosFileTransfer_FileWrapper'{the_file = - cosFileTransferApp: - create_file(OE_This, - FileNameList), - file_type = nfile}, - State}; - Other -> - %% If we want to return {stop, ....} - Other - end. - -%%---------------------------------------------------------------------- -%% Function : delete -%% Arguments : File -%% Returns : - -%% Description: -%%---------------------------------------------------------------------- -delete(_OE_This, State, File) when ?is_FTP(State); ?is_NATIVE(State) -> - Mod = ?get_Module(State), - Result = - case 'CosPropertyService_PropertySet': - get_property_value(File, "is_directory") of - #any{value=false} -> - Mod:delete(?get_Server(State), - filename:join('CosFileTransfer_File': - '_get_complete_file_name'(File))); - #any{value=true} -> - Mod:rmdir(?get_Server(State), - filename:join('CosFileTransfer_File': - '_get_complete_file_name'(File))); - Other -> - Other - end, - case Result of - ok -> - {reply, ok, State}; - {error, epath} -> - corba:raise(#'CosFileTransfer_FileNotFoundException' - {reason="File or Directory not found."}); - {error, elogin} -> - corba:raise(#'CosFileTransfer_SessionException' - {reason="User not loggen in."}); - {error, econn} -> - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Premature connection ending."}); - _ -> - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Unknown error."}) - end. - -%%---------------------------------------------------------------------- -%% Function : transfer -%% Arguments : SrcFile eq DestFile eq CosFileTransfer::File -%% Returns : - -%% Description: DestFile must be a newly created File object, using create_file() -%% on the Target FileTransferSession, prior to calling transfer(). -%%---------------------------------------------------------------------- -transfer(OE_This, State, SrcFile, DestFile) when ?is_ORBER_NATIVE(State) -> - case which_FTS_type(OE_This, SrcFile, DestFile) of - {source, TargetFTS} -> - %% The source FTS is supposed to be the active one, set up a connection. - Protocols = 'CosFileTransfer_FileTransferSession': - '_get_protocols_supported'(TargetFTS), - SrcName = 'CosFileTransfer_File':'_get_complete_file_name'(SrcFile), - Pid = spawn(?MODULE, invoke_call, [self(), transfer, - [TargetFTS, SrcFile, DestFile]]), - send_file(Protocols, ?get_MyType(State), ?get_ConnectionTimeout(State), - filename:join(SrcName)), - check_reply(Pid), - {reply, ok, State}; - {target, _SourceFTS} -> - DestName = 'CosFileTransfer_File':'_get_complete_file_name'(DestFile), - receive_file(?get_MyType(State), ?get_Connection(State), - ?get_ConnectionTimeout(State), - filename:join(DestName), write), - {reply, ok, State} - end; -transfer(OE_This, State, SrcFile, DestFile) when ?is_FTP(State); ?is_NATIVE(State) -> - case which_FTS_type(OE_This, SrcFile, DestFile) of - {source, TargetFTS} -> - source_FTS_operation(State, SrcFile, DestFile, transfer, 0, TargetFTS); - {target, _SourceFTS} -> - target_FTS_operation(State, SrcFile, DestFile, send, 0) - end. - - -%%---------------------------------------------------------------------- -%% Function : append -%% Arguments : SrcFile eq DestFile eq CosFileTransfer::File -%% Returns : - -%% Description: -%%---------------------------------------------------------------------- -append(OE_This, State, SrcFile, DestFile) when ?is_ORBER_NATIVE(State) -> - case which_FTS_type(OE_This, SrcFile, DestFile) of - {source, TargetFTS} -> - SrcName = filename:join('CosFileTransfer_File': - '_get_complete_file_name'(SrcFile)), - check_type(OE_This, State, SrcName), - %% The source FTS is supposed to be the active one, set up a connection. - Protocols = 'CosFileTransfer_FileTransferSession': - '_get_protocols_supported'(TargetFTS), - Pid = spawn(?MODULE, invoke_call, [self(), append, - [TargetFTS, SrcFile, DestFile]]), - send_file(Protocols, ?get_MyType(State), ?get_ConnectionTimeout(State), - SrcName), - check_reply(Pid), - {reply, ok, State}; - {target, _SourceFTS} -> - DestName = filename:join('CosFileTransfer_File': - '_get_complete_file_name'(DestFile)), - check_type(OE_This, State, DestName), - receive_file(?get_MyType(State), ?get_Connection(State), - ?get_ConnectionTimeout(State), DestName, append), - {reply, ok, State} - end; -append(OE_This, State, SrcFile, DestFile) when ?is_NATIVE(State) -> - case which_FTS_type(OE_This, SrcFile, DestFile) of - {source, TargetFTS} -> - source_FTS_operation(State, SrcFile, DestFile, append, 0, TargetFTS); - {target, _SourceFTS} -> - target_FTS_operation(State, SrcFile, DestFile, append, 0) - end; -append(_OE_This, _State, _SrcFile, _DestFile) -> - corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}). - - -%%---------------------------------------------------------------------- -%% Function : insert -%% Arguments : SrcFile eq DestFile eq CosFileTransfer::File -%% Offset - long -%% Returns : - -%% Description: -%%---------------------------------------------------------------------- -insert(OE_This, State, SrcFile, DestFile, Offset) when ?is_NATIVE(State) -> - case which_FTS_type(OE_This, SrcFile, DestFile) of - {source, TargetFTS} when ?is_ORBER_NATIVE(State) -> - SrcName = 'CosFileTransfer_File':'_get_complete_file_name'(SrcFile), - check_type(OE_This, State, filename:join(SrcName)), - %% The source FTS is supposed to be the active one, set up a connection. - Protocols = 'CosFileTransfer_FileTransferSession': - '_get_protocols_supported'(TargetFTS), - Pid = spawn(?MODULE, invoke_call, [self(), insert, - [TargetFTS, SrcFile, - DestFile, Offset]]), - send_file(Protocols, ?get_MyType(State), ?get_ConnectionTimeout(State), - filename:join(SrcName)), - check_reply(Pid), - {reply, ok, State}; - {source, TargetFTS} -> - source_FTS_operation(State, SrcFile, DestFile, insert, Offset, TargetFTS); - {target, _SourceFTS} -> - target_FTS_operation(State, SrcFile, DestFile, insert, Offset) - end; -insert(_OE_This, _State, _SrcFile, _DestFile, _Offset) -> - corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}). - - -%%---------------------------------------------------------------------- -%% Function : logout -%% Arguments : - -%% Returns : - -%% Description: -%%---------------------------------------------------------------------- -logout(_OE_This, State) when ?is_FTP(State); ?is_NATIVE(State) -> - Mod = ?get_Module(State), - catch Mod:close(?get_Server(State)), - {stop, normal, ok, State}. - -%%====================================================================== -%% Internal functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : oe_orber_create_directory_current -%% Arguments : - -%% Returns : Directory -%% Description: Creates a Directory describing the working directory -%% of the remote server, e.g., an FTP-server. -%%---------------------------------------------------------------------- -oe_orber_create_directory_current(OE_This, State) when ?is_FTP(State); - ?is_NATIVE(State) -> - Mod = ?get_Module(State), - FileNameList = filename:split(?get_CurrentDir(State)), - case Mod:nlist(?get_Server(State), ?get_CurrentDir(State)) of - {ok, _Listing} -> - {reply, cosFileTransferApp:create_dir(OE_This, FileNameList), - State}; - {error, epath} -> - corba:raise(#'CosFileTransfer_FileNotFoundException' - {reason="Directory not found."}); - {error, elogin} -> - corba:raise(#'CosFileTransfer_SessionException' - {reason="User not loggen in."}); - {error, econn} -> - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Premature connection ending."}); - _ -> - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Unknown error."}) - end. -%%---------------------------------------------------------------------- -%% Function : oe_orber_get_content -%% Arguments : - -%% Returns : string -%% Description: -%%---------------------------------------------------------------------- -oe_orber_get_content(OE_This, State, FileNameList, Parent) when ?is_FTP(State); - ?is_NATIVE(State) -> - Mod = ?get_Module(State), - case Mod:nlist(?get_Server(State), filename:join(FileNameList)) of - {ok, Listing} -> - create_content(Listing, OE_This, State, Parent, FileNameList); - {error, epath} -> - {reply, [], State}; - _ -> - corba:raise(#'CosFileTransfer_FileNotFoundException' - {reason="Directory not found."}) - end. - -%%---------------------------------------------------------------------- -%% Function : oe_orber_count_children -%% Arguments : - -%% Returns : string -%% Description: -%%---------------------------------------------------------------------- -oe_orber_count_children(OE_This, State, FileNameList) when ?is_FTP(State); - ?is_NATIVE(State) -> - case catch check_type(OE_This, State, filename:join(FileNameList)) of - {ndirectory, Members} -> - {reply, length(Members), State}; - {stop, normal, _, _} -> - {stop, normal, - {'EXCEPTION', #'INTERNAL'{completion_status=?COMPLETED_NO}}, - State}; - _-> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%---------------------------------------------------------------------- -%% Function : delete_tmp_file -%% Arguments : - -%% Returns : ok | {'EXCEPTION', E} -%% Description: -%%---------------------------------------------------------------------- -delete_tmp_file(TmpFileName, ErrorMsg) -> - case file:delete(TmpFileName) of - ok -> - ok; - _ -> - corba:raise(#'CosFileTransfer_RequestFailureException'{reason=ErrorMsg}) - end. - - -%%---------------------------------------------------------------------- -%% Function : invoke_call -%% Arguments : - -%% Returns : ok | {'EXCEPTION', E} -%% Description: -%%---------------------------------------------------------------------- -invoke_call(Pid, Op, Args) -> - Result = (catch apply('CosFileTransfer_FileTransferSession', Op, Args)), - Pid ! {transfer_result, self(), Result}, - ok. - -%%---------------------------------------------------------------------- -%% Function : check_reply -%% Arguments : Pid - the pid of the spawned process. -%% Returns : ok | {'EXCEPTION', E} -%% Description: -%%---------------------------------------------------------------------- -check_reply(Pid) -> - receive - {transfer_result, Pid, ok} -> - ok; - {transfer_result, Pid, {'EXCEPTION', E}} -> - orber:debug_level_print("[~p] CosFileTransfer_FileTransferSession:check_reply(); -Raised exception: ", [?LINE, E], ?DEBUG_LEVEL), - corba:raise(E); - {transfer_result, Pid, {'EXIT', Reason}} -> - orber:debug_level_print("[~p] CosFileTransfer_FileTransferSession:check_reply(); -Got EXIT-signal with reason: ", [?LINE, Reason], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{minor=199, - completion_status=?COMPLETED_NO}) - after infinity -> - %% Should we add an exception here or do we reuse the iiop_timeout? - %% For now keep as is. - corba:raise(#'INTERNAL'{minor=199, - completion_status=?COMPLETED_NO}) - end. - - -%%---------------------------------------------------------------------- -%% Function : which_FTS_type -%% Arguments : - -%% Returns : {source, FTS} | {target, FTS} | {'EXCEPTION', #'BAD_PARAM'{}} -%% Description: Used to determine if the target FTS is supposed to act -%% as sender or receiver and also return the counter part FTS. -%% An exception is raised if the user supplied incorrect parameters. -%%---------------------------------------------------------------------- -which_FTS_type(OE_This, SrcFile, DestFile) -> - TargetFTS = 'CosFileTransfer_File':'_get_associated_session'(DestFile), - SourceFTS = 'CosFileTransfer_File':'_get_associated_session'(SrcFile), - case corba_object:is_equivalent(OE_This, TargetFTS) of - true -> - {target, SourceFTS}; - false -> - case corba_object:is_equivalent(OE_This, SourceFTS) of - true -> - {source, TargetFTS}; - false -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end - end. - - -%%---------------------------------------------------------------------- -%% Function : setup_connection -%% Arguments : A list of #'CosFileTransfer_ProtocolSupport'{} -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -setup_connection([], Protocol, _) -> - orber:debug_level_print("[~p] CosFileTransfer_FileTransferSession:setup_connection(~p); -The Protocols listed are not supported.", [?LINE, Protocol], ?DEBUG_LEVEL), - corba:raise(#'CosFileTransfer_TransferException'{reason="Unsupported protocol"}); -setup_connection([#'CosFileTransfer_ProtocolSupport'{protocol_name="TCP/IP", - addresses=Addr}|_], - tcp, Timeout) -> - setup_connection_helper(Addr, gen_tcp, [], Timeout); -setup_connection([#'CosFileTransfer_ProtocolSupport'{protocol_name="SSL", - addresses=Addr}|_], - ssl, Timeout) -> - Options = [{certfile, cosFileTransferApp:ssl_client_certfile()}, - {verify, cosFileTransferApp:ssl_client_verify()}, - {depth, cosFileTransferApp:ssl_client_depth()}] ++ - ssl_client_cacertfile_option(), - setup_connection_helper(Addr, ssl, Options, Timeout); -setup_connection([_|T], Type, Timeout) -> - setup_connection(T, Type, Timeout). - -setup_connection_helper([], _, _, _) -> - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Unable to contact remote server."}); -setup_connection_helper([H|T], Driver, Options, Timeout) -> - case string:tokens(H, ":") of - [Host, Port] when Driver == gen_tcp -> - case gen_tcp:connect(Host, list_to_integer(Port), - [binary, - {packet, raw}, - {reuseaddr, true}, - {nodelay, true}|Options], Timeout) of - {ok, Sock} -> - {gen_tcp, Sock}; - _-> - %% No response. - setup_connection_helper(T, Driver, Options, Timeout) - end; - [Host, Port] when Driver == ssl -> - case ssl:connect(Host, list_to_integer(Port), - [binary, - {packet, 0}, - {active, false}|Options], Timeout) of - {ok, Sock} -> - {ssl, Sock}; - _-> - %% No response. - setup_connection_helper(T, Driver, Options, Timeout) - end; - _ -> - %% Badly configured address. - setup_connection_helper(T, Driver, Options, Timeout) - end. - -ssl_client_cacertfile_option() -> - case cosFileTransferApp:ssl_client_cacertfile() of - [] -> - []; - X when is_list(X) -> - {cacertfile, X}; - _ -> - [] - end. - -%%---------------------------------------------------------------------- -%% Function : create_content -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -create_content(Listing, OE_This, State, Parent, PathList) -> - create_content(string:tokens(Listing, ?SEPARATOR), OE_This, - State, Parent, PathList, []). - -create_content([], _OE_This, State, _Parent, _PathList, Acc) -> - {reply, Acc, State}; -create_content([H|T], OE_This, State, Parent, PathList, Acc) -> - FullPathList = PathList ++[filename:basename(H)], - case check_type(OE_This, State, filename:join(FullPathList)) of - nfile -> - create_content(T, OE_This, State, Parent, PathList, - [#'CosFileTransfer_FileWrapper' - {the_file = cosFileTransferApp:create_file(OE_This, - FullPathList, - Parent), - file_type = nfile}|Acc]); - {ndirectory, _Members} -> - create_content(T, OE_This, State, Parent, PathList, - [#'CosFileTransfer_FileWrapper' - {the_file = cosFileTransferApp:create_dir(OE_This, - FullPathList, - Parent), - file_type = ndirectory}|Acc]); - Other -> - Other - end. - - -%%---------------------------------------------------------------------- -%% Function : MISC functions -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -setup_local(tcp) -> - {ok,Socket}=gen_tcp:listen(0, [binary, - {packet, 0}, - {backlog,1}, - {active, false}]), - {ok, Port} = inet:port(Socket), - {Socket, [#'CosFileTransfer_ProtocolSupport'{protocol_name="TCP/IP", - addresses = [local_address(Port)]}]}; -setup_local(ssl) -> - Options = [{certfile, cosFileTransferApp:ssl_server_certfile()}, - {verify, cosFileTransferApp:ssl_server_verify()}, - {depth, cosFileTransferApp:ssl_server_depth()}] ++ - ssl_server_cacertfile_option(), - {ok,Socket}=ssl:listen(0, [binary, - {packet, 0}, - {backlog,1}, - {active, false}|Options]), - {ok, {_Address, Port}} = ssl:sockname(Socket), - {Socket, [#'CosFileTransfer_ProtocolSupport'{protocol_name="SSL", - addresses = [local_address(Port)]}]}. - -local_address(Port) -> - {ok, Hostname} = inet:gethostname(), - {ok, {A1, A2, A3, A4}} = inet:getaddr(Hostname, inet), - integer_to_list(A1) ++ "." ++ integer_to_list(A2) ++ "." ++ integer_to_list(A3) - ++ "." ++ integer_to_list(A4)++":"++integer_to_list(Port). - -ssl_server_cacertfile_option() -> - case cosFileTransferApp:ssl_server_cacertfile() of - [] -> - []; - X when is_list(X) -> - [{cacertfile, X}]; - _ -> - [] - end. - -%%---------------------------------------------------------------------- -%% Function : source_file_operation -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -source_FTS_operation(State, SrcFile, DestFile, Op, Offset, FTS) -> - Mod = ?get_Module(State), - %% The source FTS is supposed to be the active one, set up a connection. - Protocols = 'CosFileTransfer_FileTransferSession':'_get_protocols_supported'(FTS), - SrcName = 'CosFileTransfer_File':'_get_complete_file_name'(SrcFile), - TempName = cosFileTransferApp:create_name("TemporarySrcFile"), - case Mod:recv(?get_Server(State), filename:join(SrcName), TempName) of - ok when Op == insert -> - %% Downloaded the File, we are now ready to transmit. - Pid = spawn(?MODULE, invoke_call, [self(), insert, - [FTS, SrcFile, DestFile, Offset]]), - send_file(Protocols, ?get_MyType(State), ?get_ConnectionTimeout(State), - TempName), - %% Delete the temporary local copy. - delete_tmp_file(TempName, - "Transfer completed but failed to remove temporary local copy."), - check_reply(Pid), - {reply, ok, State}; - ok -> - %% Downloaded the File, we are now ready to transmit. - Pid = spawn(?MODULE, invoke_call, [self(), Op, [FTS, SrcFile, DestFile]]), - send_file(Protocols, ?get_MyType(State), ?get_ConnectionTimeout(State), - TempName), - %% Delete the temporary local copy. - delete_tmp_file(TempName, - "Transfer completed but failed to remove temporary local copy."), - check_reply(Pid), - {reply, ok, State}; - {error, epath} -> - corba:raise(#'CosFileTransfer_FileNotFoundException' - {reason="File not found."}); - {error, elogin} -> - corba:raise(#'CosFileTransfer_SessionException' - {reason="User not loggen in."}); - {error, econn} -> - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Premature connection ending."}) - end. - -%%---------------------------------------------------------------------- -%% Function : target_file_operation -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -target_FTS_operation(State, _SrcFile, DestFile, Op, Offset) -> - Mod = ?get_Module(State), - DestName = 'CosFileTransfer_File':'_get_complete_file_name'(DestFile), - TempName = cosFileTransferApp:create_name("TemporaryDestFile"), - receive_file(?get_MyType(State), ?get_Connection(State), - ?get_ConnectionTimeout(State), TempName, write), - Result = - if - Op == insert -> - Mod:insert(?get_Server(State), TempName, filename:join(DestName), Offset); - true -> - Mod:Op(?get_Server(State), TempName, filename:join(DestName)) - end, - case Result of - ok -> - %% Delete the temporary local copy. - delete_tmp_file(TempName, - "Transfer completed but failed to remove temporary local copy."), - %% Completed the transfer successfully. - {reply, ok, State}; - {error, epath} -> - delete_tmp_file(TempName, - "IllegalOperationException and not able to remove temporary local copy."), - corba:raise(#'CosFileTransfer_IllegalOperationException' - {reason="Not allowed by destination."}); - {error, elogin} -> - delete_tmp_file(TempName, - "SessionException and not able to remove temporary local copy."), - corba:raise(#'CosFileTransfer_SessionException' - {reason="User not logged in."}); - {error, econn} -> - delete_tmp_file(TempName, - "TransferException and not able to remove temporary local copy."), - corba:raise(#'CosFileTransfer_TransferException' - {reason="Premature connection ending."}); - {error, etnospc} -> - delete_tmp_file(TempName, - "RequestFailureException and not able to remove temporary local copy."), - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Premature connection ending."}); - {error, efnamena} -> - delete_tmp_file(TempName, - "IllegalOperationException and not able to remove temporary local copy."), - corba:raise(#'CosFileTransfer_IllegalOperationException' - {reason="Not allowed by destination."}) - end. - -%%---------------------------------------------------------------------- -%% Function : receive_file -%% Arguments : Driver - currently only gen_tcp supported. -%% LSocket - which socket to use. -%% FileName - an absolute file name representing the -%% file we want to create or append to. -%% Type - 'read', 'write', 'append'. -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -receive_file(tcp, LSock, Timeout, FileName, Type) -> - %% The Type can be the ones allowed by the file-module, i.e., - %% 'read', 'write' or 'append' - FD = file_open(FileName, Type), - case gen_tcp:accept(LSock, Timeout) of - {ok, Sock} -> - receive_file_helper(gen_tcp, Sock, FD); - {error, timeout} -> - orber:dbg("[~p] CosFileTransfer_FileTransferSession:receive_file();~n" - "gen_tcp:accept(~p) timed out", [?LINE, Timeout], ?DEBUG_LEVEL), - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="TCP accept timed out.."}); - {error, Why} -> - orber:dbg("[~p] CosFileTransfer_FileTransferSession:receive_file();~n" - "gen_tcp:accept(~p) failed: ~p", [?LINE, Timeout, Why], ?DEBUG_LEVEL), - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="TCP accept failed."}) - end; -receive_file(ssl, LSock, Timeout, FileName, Type) -> - %% The Type can be the ones allowed by the file-module, i.e., - %% 'read', 'write' or 'append' - FD = file_open(FileName, Type), - case ssl:transport_accept(LSock, Timeout) of - {ok, Sock} -> - case ssl:ssl_accept(Sock, Timeout) of - ok -> - receive_file_helper(ssl, Sock, FD); - {error, Error} -> - orber:dbg("[~p] CosFileTransfer_FileTransferSession:receive_file();~n" - "ssl:ssl_accept(~p) failed: ~p", - [?LINE, Timeout, Error], ?DEBUG_LEVEL), - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="TCP accept failed."}) - end; - {error, timeout} -> - orber:dbg("[~p] CosFileTransfer_FileTransferSession:receive_file();~n" - "ssl:transport_accept(~p) timed out", - [?LINE, Timeout], ?DEBUG_LEVEL), - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="TCP accept timed out.."}); - {error, Why} -> - orber:dbg("[~p] CosFileTransfer_FileTransferSession:receive_file();~n" - "ssl:transport_accept(~p) failed: ~p", - [?LINE, Timeout, Why], ?DEBUG_LEVEL), - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="TCP accept failed."}) - end. - -receive_file_helper(Driver, Sock, FD) -> - case Driver:recv(Sock, 0) of - {ok, Bin} -> - file:write(FD, Bin), - receive_file_helper(Driver, Sock, FD); - {error, closed} -> - file:close(FD); - What -> - orber:debug_level_print("[~p] CosFileTransfer_FileTransferSession:receive_file(~p); -Error occured when receiving data: ~p", [?LINE, Driver, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%---------------------------------------------------------------------- -%% Function : send_file -%% Arguments : Driver - currently only gen_tcp supported. -%% Sock - which socket to use. -%% FileName - an absolute file name representing the -%% file we want to send. -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -send_file(Protocols, Type, Timeout, FileName) -> - {Driver, Sock} = setup_connection(Protocols, Type, Timeout), - FD = file_open(FileName, read), - BuffSize = cosFileTransferApp:get_buffert_size(), - send_file_helper(Driver, Sock, FD, BuffSize). - -send_file_helper(Driver, Sock, FD, BuffSize) -> - case file:read(FD, BuffSize) of - eof -> - file:close(FD), - Driver:close(Sock); - {ok, Bin} -> - case Driver:send(Sock, Bin) of - ok -> - send_file_helper(Driver, Sock, FD, BuffSize); - What -> - orber:debug_level_print("[~p] CosFileTransfer_FileTransferSession:send_file_helper(~p); -Error occured when sending data: ~p", [?LINE, Driver, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end - end. - - -file_open(File, Type) -> - case file:open(File, [raw, binary, Type]) of - {ok, FD} -> - FD; - {error, What} -> - orber:debug_level_print("[~p] CosFileTransfer_FileTransferSession:file_open(~p); -Failed to open the file due to: ~p", [?LINE, File, What], ?DEBUG_LEVEL), - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Unable to open given file."}) - end. - -%%---------------------------------------------------------------------- -%% Function : check_type -%% Arguments : FullName - an absolute file name representing the -%% file or directory we want to evaluate. -%% Returns : -%% Description: -%% When communcating with FTP-servers on different platforms a variety of -%% answers can be returned. A few examples: -%% -%% ### ftp:nlist on an empty directory ### -%% {ok, ""}, {error, epath} -%% -%% ### ftp:nlist on a non-existing directory or file ### -%% {ok, "XXX: No such file or directory}, {error, epath} -%% -%% ### ftp:nlist on an existing directory with one contained item ### -%% {ok, "Item"} -%% -%% Comparing the above we see that it's virtually impossible to tell apart -%% {ok, "XXX: No such file or directory} and {ok, "Item"}. -%% Hence, it's easier to test if it's possible to do ftp:cd instead. -%% Ugly, but rather effective. If we look at the bright side, it's only -%% necessary when we try to lookup: -%% * non-existing item -%% * A directory with one member only. -%% * An empty directory. -%% -%% Furthermore, no need for traversing Listings etc. -%%---------------------------------------------------------------------- -check_type(_OE_This, State, FullName) when ?is_FTP(State); ?is_NATIVE(State) -> - Mod = ?get_Module(State), - Result = - case Mod:nlist(?get_Server(State), FullName) of - {ok, Listing} when length(Listing) > 0-> - case string:tokens(Listing, ?SEPARATOR) of - [FullName] -> - nfile; - Members when length(Members) > 1 -> - %% Must test if more than one member since sometimes - %% this operation returns for example: - %% {ok, "XXX No such file or drectory"} - {ndirectory, Members}; - Member -> - case Mod:cd(?get_Server(State), FullName) of - ok -> - case Mod:cd(?get_Server(State), - ?get_CurrentDir(State)) of - ok -> - {ndirectory, Member}; - _ -> - %% Failed, we cannot continue since the - %% FTS now pointso an incorrect Directory. - %% Hence, we must terminate. - {stop, normal, - {'EXCEPTION', - #'CosFileTransfer_RequestFailureException' - {reason="Unknown error."}}, State} - end; - {error, E} -> - {error, E}; - _ -> - nfile - end - end; - {error, epath} -> - %% Might be a file. - DirName = filename:dirname(FullName), - case Mod:nlist(?get_Server(State), DirName) of - {ok, Listing} when length(Listing) > 0-> - Members = string:tokens(Listing, ?SEPARATOR), - case lists:member(FullName, Members) of - true -> - nfile; - _ -> - BName = filename:basename(FullName), - case lists:member(BName, Members) of - true -> - nfile; - _ -> - {error, epath} - end - end; - _ -> - {error, epath} - end; - _ -> - case Mod:cd(?get_Server(State), FullName) of - ok -> - case Mod:cd(?get_Server(State), ?get_CurrentDir(State)) of - ok -> - {ndirectory, []}; - _ -> - %% Failed, we cannot continue since the - %% FTS now pointso an incorrect Directory. - %% Hence, we must terminate. - {stop, normal, - {'EXCEPTION', - #'CosFileTransfer_RequestFailureException' - {reason="Unknown error."}}, State} - end; - _ -> - {error, epath} - end - end, - case Result of - {error, epath} -> - corba:raise(#'CosFileTransfer_FileNotFoundException' - {reason="File or Directory not found."}); - {error, elogin} -> - corba:raise(#'CosFileTransfer_SessionException' - {reason="User not logged in."}); - {error, econn} -> - corba:raise(#'CosFileTransfer_RequestFailureException' - {reason="Premature connection ending."}); - Other -> - Other - end. - - - -%%====================================================================== -%% END OF MODULE -%%====================================================================== diff --git a/lib/cosFileTransfer/src/CosFileTransfer_File_impl.erl b/lib/cosFileTransfer/src/CosFileTransfer_File_impl.erl deleted file mode 100644 index 263255413e..0000000000 --- a/lib/cosFileTransfer/src/CosFileTransfer_File_impl.erl +++ /dev/null @@ -1,385 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosFileTransfer_File_impl.erl -%% Description : -%% -%% Created : 5 Feb 2001 -%%---------------------------------------------------------------------- --module('CosFileTransfer_File_impl'). - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). - --include_lib("cosProperty/include/CosPropertyService.hrl"). - --include("cosFileTransferApp.hrl"). - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- --export([init/1, - terminate/2]). - -%% Interface functions --export(['_get_name'/2, - '_get_complete_file_name'/2, - '_get_parent'/2, - '_get_associated_session'/2]). - -%% Inherited CosPropertyService::PropertySetDef --export([get_allowed_property_types/2, - get_allowed_properties/2, - define_property_with_mode/5, - define_properties_with_modes/3, - get_property_mode/3, - get_property_modes/3, - set_property_mode/4, - set_property_modes/3]). - -%% Inherited CosPropertyService::PropertySet --export([define_property/4, - define_properties/3, - get_number_of_properties/2, - get_all_property_names/3, - get_property_value/3, - get_properties/3, - get_all_properties/3, - delete_property/3, - delete_properties/3, - delete_all_properties/2, - is_property_defined/3]). - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {property, - name, - completeName, - parent, - assocSession}). - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- --define(create_InitState(Pr, N, C, Pa, A), - #state{property = Pr, - name = N, - completeName = C, - parent = Pa, - assocSession = A}). - --define(get_PropertyRef(S), S#state.property). --define(get_Name(S), S#state.name). --define(get_CompleteName(S), S#state.completeName). --define(get_Parent(S), S#state.parent). --define(get_AssocSession(S), S#state.assocSession). - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%---------------------------------------------------------------------- -init([Name, CompleteName, Parent, AssocSession]) -> - PropTypes = [tk_boolean], - PropDefs = [#'CosPropertyService_PropertyDef' - {property_name = "is_directory", - property_value = #any{typecode=tk_boolean, value=false}, - property_mode = fixed_readonly}], - Prop = cosProperty:create_static_SetDef(PropTypes, PropDefs), - {ok, ?create_InitState(Prop, Name, CompleteName, Parent, AssocSession)}. - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Returns : any (ignored by gen_server) -%% Description: Shutdown the server -%%---------------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -%%====================================================================== -%% CosFileTransfer::File -%%====================================================================== -%%---------------------------------------------------------------------% -%% Function : '_get_name' -%% Arguments : - -%% Returns : CosFileTransfer::FileName - string -%% Description: -%%---------------------------------------------------------------------- -'_get_name'(_OE_This, State) -> - {reply, ?get_Name(State), State}. - -%%---------------------------------------------------------------------% -%% Function : '_get_complete_file_name' -%% Arguments : - -%% Returns : CosFileTransfer::FileNameList - a list of strings's -%% Description: -%%---------------------------------------------------------------------- -'_get_complete_file_name'(_OE_This, State) -> - {reply, ?get_CompleteName(State), State}. - -%%---------------------------------------------------------------------% -%% Function : '_get_parent' -%% Arguments : - -%% Returns : CosFileTransfer::Directory -%% Description: -%%---------------------------------------------------------------------- -'_get_parent'(_OE_This, State) -> - {reply, ?get_Parent(State), State}. - -%%---------------------------------------------------------------------% -%% Function : '_get_associated_session' -%% Arguments : - -%% Returns : CosFileTransfer::FileTransferSession -%% Description: -%%---------------------------------------------------------------------- -'_get_associated_session'(_OE_This, State) -> - {reply, ?get_AssocSession(State), State}. - -%%====================================================================== -%% CosPropertyService::PropertySetDef -%%====================================================================== -%%---------------------------------------------------------------------% -%% Function : get_allowed_property_types -%% Arguments : - -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_allowed_property_types(_OE_This, State) -> - {reply, 'CosPropertyService_PropertySetDef': - get_allowed_property_types(?get_PropertyRef(State)), State}. - -%%---------------------------------------------------------------------% -%% Function : get_allowed_properties -%% Arguments : - -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_allowed_properties(_OE_This, State) -> - {reply, 'CosPropertyService_PropertySetDef': - get_allowed_properties(?get_PropertyRef(State)), State}. - -%%---------------------------------------------------------------------% -%% Function : define_property_with_mode -%% Arguments : Name - string() -%% Value - #any{} -%% Mode - normal | read_only | fixed_normal | fixed_readonly -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -define_property_with_mode(_OE_This, State, Name, Value, Mode) -> - {reply, 'CosPropertyService_PropertySetDef': - define_property_with_mode(?get_PropertyRef(State), Name, Value, Mode), State}. - -%%---------------------------------------------------------------------% -%% Function : define_properties_with_modes -%% Arguments : PropertyDefs - list of #'CosPropertyService_PropertyDef'{} -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -define_properties_with_modes(_OE_This, State, PropertyDefs) -> - {reply, 'CosPropertyService_PropertySetDef': - define_properties_with_modes(?get_PropertyRef(State), PropertyDefs), State}. - -%%---------------------------------------------------------------------% -%% Function : get_property_mode -%% Arguments : Name - string() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_property_mode(_OE_This, State, Name) -> - {reply, 'CosPropertyService_PropertySetDef': - get_property_mode(?get_PropertyRef(State), Name), State}. - - -%%---------------------------------------------------------------------% -%% Function : get_property_modes -%% Arguments : Names - a list of Name (i.e. string()'s). -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_property_modes(_OE_This, State, Names) -> - {reply, 'CosPropertyService_PropertySetDef': - get_property_modes(?get_PropertyRef(State), Names), State}. - -%%---------------------------------------------------------------------% -%% Function : set_property_mode -%% Arguments : Name - string() -%% Mode - normal | read_only | fixed_normal | fixed_readonly -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -set_property_mode(_OE_This, State, Name, Mode) -> - {reply, 'CosPropertyService_PropertySetDef': - set_property_mode(?get_PropertyRef(State), Name, Mode), State}. - - -%%---------------------------------------------------------------------% -%% Function : set_property_modes -%% Arguments : Modes - a list of #'CosPropertyService_PropertyModes'{} -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -set_property_modes(_OE_This, State, PropertyModes) -> - {reply, 'CosPropertyService_PropertySetDef': - set_property_modes(?get_PropertyRef(State), PropertyModes), State}. - -%%====================================================================== -%% CosPropertyService::PropertySet -%%====================================================================== -%%---------------------------------------------------------------------% -%% Function : define_property -%% Arguments : Name - string() -%% Value - #any{} -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -define_property(_OE_This, State, Name, Value) -> - {reply, 'CosPropertyService_PropertySet': - define_property(?get_PropertyRef(State), Name, Value), State}. - -%%---------------------------------------------------------------------% -%% Function : define_properties -%% Arguments : Properties - a list of #'CosPropertyService_Property'{} -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -define_properties(_OE_This, State, Properties) -> - {reply, 'CosPropertyService_PropertySet': - define_properties(?get_PropertyRef(State), Properties), State}. - - -%%---------------------------------------------------------------------% -%% Function : get_number_of_properties -%% Arguments : - -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_number_of_properties(_OE_This, State) -> - {reply, 'CosPropertyService_PropertySet': - get_number_of_properties(?get_PropertyRef(State)), State}. - -%%---------------------------------------------------------------------% -%% Function : get_all_property_names -%% Arguments : Max - ulong() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_all_property_names(_OE_This, State, Max) -> - {reply, 'CosPropertyService_PropertySet': - get_all_property_names(?get_PropertyRef(State), Max), State}. - -%%---------------------------------------------------------------------% -%% Function : get_property_value -%% Arguments : Name - string() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_property_value(_OE_This, State, Name) -> - {reply, 'CosPropertyService_PropertySet': - get_property_value(?get_PropertyRef(State), Name), State}. - -%%---------------------------------------------------------------------% -%% Function : get_properties -%% Arguments : Names - a list of Name (i.e. string()'s) -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_properties(_OE_This, State, Names) -> - {reply, 'CosPropertyService_PropertySet': - get_properties(?get_PropertyRef(State), Names), State}. - - -%%---------------------------------------------------------------------% -%% Function : get_all_properties -%% Arguments : Max - ulong() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -get_all_properties(_OE_This, State, Max) -> - {reply, 'CosPropertyService_PropertySet': - get_all_properties(?get_PropertyRef(State), Max), State}. - - -%%---------------------------------------------------------------------% -%% Function : delete_property -%% Arguments : Name - string() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -delete_property(_OE_This, State, Name) -> - {reply, 'CosPropertyService_PropertySet': - delete_property(?get_PropertyRef(State), Name), State}. - - -%%---------------------------------------------------------------------% -%% Function : delete_properties -%% Arguments : Names - a list of Name (i.e. string()'s) -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -delete_properties(_OE_This, State, Names) -> - {reply, 'CosPropertyService_PropertySet': - delete_properties(?get_PropertyRef(State), Names), State}. - - -%%---------------------------------------------------------------------% -%% Function : delete_all_properties -%% Arguments : - -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -delete_all_properties(_OE_This, State) -> - {reply, 'CosPropertyService_PropertySet': - delete_all_properties(?get_PropertyRef(State)), State}. - -%%---------------------------------------------------------------------% -%% Function : is_property_defined -%% Arguments : Name - string() -%% Returns : See cosProperty application. -%% Description: -%%---------------------------------------------------------------------- -is_property_defined(_OE_This, State, Name) -> - {reply, 'CosPropertyService_PropertySet': - is_property_defined(?get_PropertyRef(State), Name), State}. - -%%====================================================================== -%% Internal functions -%%====================================================================== - -%%====================================================================== -%% END OF MODULE -%%====================================================================== - diff --git a/lib/cosFileTransfer/src/CosFileTransfer_VirtualFileSystem_impl.erl b/lib/cosFileTransfer/src/CosFileTransfer_VirtualFileSystem_impl.erl deleted file mode 100644 index 7440498a23..0000000000 --- a/lib/cosFileTransfer/src/CosFileTransfer_VirtualFileSystem_impl.erl +++ /dev/null @@ -1,217 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosFileTransfer_VirtualFileSystem_impl.erl -%% Description : -%% -%% Created : 12 Sept 2000 -%%---------------------------------------------------------------------- --module('CosFileTransfer_VirtualFileSystem_impl'). - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). - --include_lib("cosFileTransfer/include/CosFileTransfer.hrl"). --include("cosFileTransferApp.hrl"). - - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- --export([init/1, - terminate/2, - code_change/3, - handle_info/2]). - -%% Interface functions --export(['_get_file_system_type'/2, - '_get_supported_content_types'/2, - login/5]). - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- --export([]). - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {type, content, host, port, protocol, timeout, module}). - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- --define(create_InitState(T, C, H, P, Pr, TO), - #state{type=T, - content=C, - host=H, - port=P, - protocol=Pr, - timeout=TO}). --define(create_NativeInitState(T, C, H, P, Pr, TO, M), - #state{type=T, - content=C, - host=H, - port=P, - protocol=Pr, - timeout=TO, - module=M}). - --define(get_Type(S), S#state.type). --define(get_Content(S), S#state.content). --define(get_Host(S), S#state.host). --define(get_Port(S), S#state.port). --define(get_StartDir(S), S#state.startdir). --define(get_Module(S), S#state.module). --define(get_Protocol(S), S#state.protocol). --define(get_Timeout(S), S#state.timeout). - --define(is_FTP(S), S#state.type == 'FTP'). --define(is_FTAM(S), S#state.type == 'FTAM'). --define(is_NATIVE(S), S#state.type == 'NATIVE'). - - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%---------------------------------------------------------------------- -init([{Type, Mod}, Content, Host, Port, Options]) -> - Prot = cosFileTransferApp:get_option(protocol, Options, ?DEFAULT_CONFIG), - Time = timer:seconds(cosFileTransferApp:get_option(connect_timeout, Options, - ?DEFAULT_CONFIG)), - {ok, ?create_NativeInitState(Type, Content, Host, Port, Prot, Time, Mod)}; -init([Type, Content, Host, Port, Options]) -> - Prot = cosFileTransferApp:get_option(protocol, Options, ?DEFAULT_CONFIG), - Time = timer:seconds(cosFileTransferApp:get_option(connect_timeout, Options, - ?DEFAULT_CONFIG)), - {ok, ?create_InitState(Type, Content, Host, Port, Prot, Time)}. - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Returns : any (ignored by gen_server) -%% Description: Shutdown the server -%%---------------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -%%---------------------------------------------------------------------- -%% Function : code_change/3 -%% Returns : {ok, NewState} -%% Description: Convert process state when code is changed -%%---------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%---------------------------------------------------------------------% -%% function : handle_info/2 -%% Arguments: -%% Returns : -%% Effect : -%%---------------------------------------------------------------------- -handle_info(_Info, State) -> - {noreply, State}. - -%%====================================================================== -%% CosFileTransfer::VirtualFileSystem -%%====================================================================== -%%---------------------------------------------------------------------% -%% Function : '_get_file_system_type' -%% Arguments : - -%% Returns : CosFileTransfer::NativeFileSystemType, i.e., 'FTP', 'FTAM', -%% or 'NATIVE'. Currently only 'FTP' is allowed. -%% Description: -%%---------------------------------------------------------------------- -'_get_file_system_type'(_OE_This, State) -> - {reply, ?get_Type(State), State}. - -%%---------------------------------------------------------------------% -%% Function : '_get_supported_content_types' -%% Arguments : -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -'_get_supported_content_types'(_OE_This, State) -> - {reply, ?get_Content(State), State}. - -%%---------------------------------------------------------------------- -%% Function : login -%% Arguments : User - string() -%% Password - string() -%% Account - string() -%% Returns : FileTransferSession object and Directory object (out-type). -%% Description: -%%---------------------------------------------------------------------- -login(_OE_This, State, User, Password, Account) when ?is_FTP(State) -> - case catch 'CosFileTransfer_FileTransferSession': - oe_create(['FTP', ?get_Host(State), ?get_Port(State), User, Password, Account, - ?get_Protocol(State), ?get_Timeout(State)], - [{sup_child, true}]) of - {ok, _Pid, FTS} -> - Dir = 'CosFileTransfer_FileTransferSession': - oe_orber_create_directory_current(FTS), - {reply, {FTS, Dir}, State}; - What -> - orber:debug_level_print("[~p] CosFileTransfer_VirtualFileSystem:login(~p ~p ~p ~p); -Unable to create a FileTransferSession: ~p", - [?LINE, ?get_Host(State), ?get_Port(State), User, - ?get_Protocol(State), What], - ?DEBUG_LEVEL), - corba:raise(#'CosFileTransfer_SessionException'{reason="Failed creating a FTS"}) - end; -login(_OE_This, State, User, Password, Account) when ?is_NATIVE(State) -> - case catch 'CosFileTransfer_FileTransferSession': - oe_create([{'NATIVE', ?get_Module(State)}, ?get_Host(State), - ?get_Port(State), User, Password, Account, - ?get_Protocol(State), ?get_Timeout(State)], - [{sup_child, true}]) of - {ok, _Pid, FTS} -> - Dir = 'CosFileTransfer_FileTransferSession': - oe_orber_create_directory_current(FTS), - {reply, {FTS, Dir}, State}; - What -> - orber:debug_level_print("[~p] CosFileTransfer_VirtualFileSystem:login(~p ~p ~p ~p); -Unable to create a FileTransferSession: ~p", - [?LINE, ?get_Host(State), ?get_Port(State), User, - ?get_Protocol(State), What], - ?DEBUG_LEVEL), - corba:raise(#'CosFileTransfer_SessionException'{reason="Failed creating a FTS"}) - end. - -%%====================================================================== -%% Internal functions -%%====================================================================== - - - -%%====================================================================== -%% END OF MODULE -%%====================================================================== diff --git a/lib/cosFileTransfer/src/Makefile b/lib/cosFileTransfer/src/Makefile deleted file mode 100644 index b3967101e9..0000000000 --- a/lib/cosFileTransfer/src/Makefile +++ /dev/null @@ -1,188 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2000-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk - -ifeq ($(TYPE),debug) -ERL_COMPILE_FLAGS += -Ddebug -W -endif - -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSFILETRANSFER_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/cosFileTransfer-$(VSN) - -EXTERNAL_INC_PATH = ../include - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- - -MODULES = \ - cosFileTransferApp \ - CosFileTransfer_Directory_impl \ - CosFileTransfer_File_impl \ - CosFileTransfer_VirtualFileSystem_impl \ - CosFileTransfer_FileTransferSession_impl \ - CosFileTransfer_FileIterator_impl \ - cosFileTransferNATIVE_file \ - -ERL_FILES = $(MODULES:%=%.erl) -HRL_FILES = \ - cosFileTransferApp.hrl \ - -GEN_ERL_FILES = \ - oe_CosFileTransfer.erl \ - CosFileTransfer.erl \ - CosFileTransfer_AccessLevel.erl \ - CosFileTransfer_CommandNotImplementedException.erl \ - CosFileTransfer_Directory.erl \ - CosFileTransfer_File.erl \ - CosFileTransfer_FileIterator.erl \ - CosFileTransfer_FileList.erl \ - CosFileTransfer_FileNameList.erl \ - CosFileTransfer_FileNotFoundException.erl \ - CosFileTransfer_FileTransferSession.erl \ - CosFileTransfer_FileWrapper.erl \ - CosFileTransfer_IllegalOperationException.erl \ - CosFileTransfer_ProtocolAddressList.erl \ - CosFileTransfer_ProtocolSupport.erl \ - CosFileTransfer_RequestFailureException.erl \ - CosFileTransfer_SessionException.erl \ - CosFileTransfer_SupportedProtocolAddresses.erl \ - CosFileTransfer_TransferException.erl \ - CosFileTransfer_VirtualFileSystem.erl \ - CosFileTransfer_VirtualFileSystem_ContentList.erl \ - -LOCAL_HRL_FILES = \ - oe_CosFileTransfer.hrl \ - CosFileTransfer.hrl \ - CosFileTransfer_Directory.hrl \ - CosFileTransfer_File.hrl \ - CosFileTransfer_FileIterator.hrl \ - CosFileTransfer_FileTransferSession.hrl \ - CosFileTransfer_VirtualFileSystem.hrl \ - -GEN_HRL_FILES = $(LOCAL_HRL_FILES:%=$(EXTERNAL_INC_PATH)/%) - -GEN_FILES = \ - $(GEN_HRL_FILES) \ - $(GEN_ERL_FILES) - -TARGET_FILES = \ - $(GEN_ERL_FILES:%.erl=$(EBIN)/%.$(EMULATOR)) \ - $(MODULES:%=$(EBIN)/%.$(EMULATOR)) - -IDL_FILES = \ - CosFileTransfer.idl - -APPUP_FILE = cosFileTransfer.appup -APPUP_SRC = $(APPUP_FILE).src -APPUP_TARGET = $(EBIN)/$(APPUP_FILE) - -APP_FILE = cosFileTransfer.app -APP_SRC = $(APP_FILE).src -APP_TARGET = $(EBIN)/$(APP_FILE) - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/cosFileTransfer/ebin \ - -pa $(ERL_TOP)/lib/cosProperty/ebin \ - -pa $(ERL_TOP)/lib/cosProperty/src \ - -I$(ERL_TOP)/lib/cosProperty/src \ - -pa $(ERL_TOP)/lib/ic/ebin \ - -pa $(ERL_TOP)/lib/orber/ebin - -# The -pa option is just used temporary until erlc can handle -# includes from other directories than ../include . -ERL_COMPILE_FLAGS += \ - $(ERL_IDL_FLAGS) \ - -pa $(ERL_TOP)/lib/orber/include \ - -pa $(ERL_TOP)/lib/cosFileTransfer/include \ - -pa $(ERL_TOP)/lib/cosProperty/include \ - -pa $(ERL_TOP)/lib/cosProperty/src \ - -I$(ERL_TOP)/lib/orber/include \ - -I$(ERL_TOP)/lib/cosFileTransfer/include \ - -I$(ERL_TOP)/lib/cosProperty/include \ - -I$(ERL_TOP)/lib/cosProperty/src \ - +'{parse_transform,sys_pre_attributes}' \ - +'{attribute,insert,app_vsn,"cosFileTransfer_$(COSFILETRANSFER_VSN)"}' - - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) - -debug: - @${MAKE} TYPE=debug opt - -cleanb: - rm -f $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) - rm -f errs core *~ - -clean: - rm -f $(TARGET_FILES) $(GEN_FILES) $(APP_TARGET) $(APPUP_TARGET) IDL-GENERATED - rm -f errs core *~ - -$(APP_TARGET): $(APP_SRC) - $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ - -$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ - -docs: - -# ---------------------------------------------------- -# Special Build Targets -# ---------------------------------------------------- -IDL-GENERATED: CosFileTransfer.idl - $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosFileTransfer.cfg"}' CosFileTransfer.idl - $(V_at)mv $(LOCAL_HRL_FILES) $(EXTERNAL_INC_PATH) - $(V_at)>IDL-GENERATED - -$(GEN_FILES): IDL-GENERATED - -$(TARGET_FILES): IDL-GENERATED - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)/ebin" - $(INSTALL_DATA) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) "$(RELSYSDIR)/ebin" - $(INSTALL_DIR) "$(RELSYSDIR)/src" - $(INSTALL_DATA) $(GEN_FILES) $(IDL_FILES) "$(RELSYSDIR)/src" - $(INSTALL_DATA) $(ERL_FILES) $(HRL_FILES) $(GEN_ERL_FILES) $(IDL_FILES) "$(RELSYSDIR)/src" - $(INSTALL_DIR) "$(RELSYSDIR)/include" - $(INSTALL_DATA) $(GEN_HRL_FILES) "$(RELSYSDIR)/include" - -release_docs_spec: diff --git a/lib/cosFileTransfer/src/cosFileTransfer.app.src b/lib/cosFileTransfer/src/cosFileTransfer.app.src deleted file mode 100644 index 033eec9700..0000000000 --- a/lib/cosFileTransfer/src/cosFileTransfer.app.src +++ /dev/null @@ -1,43 +0,0 @@ -{application, cosFileTransfer, - [{description, "The Erlang CosFileTransfer application"}, - {vsn, "%VSN%"}, - {modules, - [ - 'cosFileTransferApp', - 'CosFileTransfer_Directory_impl', - 'CosFileTransfer_File_impl', - 'CosFileTransfer_VirtualFileSystem_impl', - 'CosFileTransfer_FileTransferSession_impl', - 'CosFileTransfer_FileIterator_impl', - 'cosFileTransferNATIVE_file', - 'oe_CosFileTransfer', - 'CosFileTransfer', - 'CosFileTransfer_AccessLevel', - 'CosFileTransfer_CommandNotImplementedException', - 'CosFileTransfer_Directory', - 'CosFileTransfer_File', - 'CosFileTransfer_FileIterator', - 'CosFileTransfer_FileList', - 'CosFileTransfer_FileNameList', - 'CosFileTransfer_FileNotFoundException', - 'CosFileTransfer_FileTransferSession', - 'CosFileTransfer_FileWrapper', - 'CosFileTransfer_IllegalOperationException', - 'CosFileTransfer_ProtocolAddressList', - 'CosFileTransfer_ProtocolSupport', - 'CosFileTransfer_RequestFailureException', - 'CosFileTransfer_SessionException', - 'CosFileTransfer_SupportedProtocolAddresses', - 'CosFileTransfer_TransferException', - 'CosFileTransfer_VirtualFileSystem', - 'CosFileTransfer_VirtualFileSystem_ContentList' - ] - }, - {registered, []}, - {applications, [orber, stdlib, kernel]}, - {env, []}, - {mod, {cosFileTransferApp, []}}, - {runtime_dependencies, ["stdlib-2.0","ssl-5.3.4","orber-3.6.27","kernel-3.0", - "inets-5.10","erts-7.0","cosProperty-1.1.17"]} -]}. - diff --git a/lib/cosFileTransfer/src/cosFileTransfer.appup.src b/lib/cosFileTransfer/src/cosFileTransfer.appup.src deleted file mode 100644 index 6c3b2833b7..0000000000 --- a/lib/cosFileTransfer/src/cosFileTransfer.appup.src +++ /dev/null @@ -1,7 +0,0 @@ -{"%VSN%", - [ - ], - [ - ] -}. - diff --git a/lib/cosFileTransfer/src/cosFileTransferApp.erl b/lib/cosFileTransfer/src/cosFileTransferApp.erl deleted file mode 100644 index 29a7237d70..0000000000 --- a/lib/cosFileTransfer/src/cosFileTransferApp.erl +++ /dev/null @@ -1,471 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : cosFileTransferApp.erl -%% Purpose : -%% Created : 25 Aug 2000 -%%---------------------------------------------------------------------- --module(cosFileTransferApp). - - -%%--------------- INCLUDES ----------------------------------- --include("cosFileTransferApp.hrl"). - -%%--------------- EXPORTS------------------------------------- -%% cosFileTransferApp API external --export([start/0, stop/0, install/0, uninstall/0, create_VFS/4, create_VFS/5, - get_buffert_size/0]). - -%% cosFileTransferApp API internal --export([create_link/3, get_option/3, type_check/2, configure/2]). - -%% Application callbacks --export([start/2, init/1, stop/1]). - -%% INTERNAL EXPORTS!! DO NOT USE THESE!! --export([create_dir/2, create_dir/3, create_file/2, create_file/3, split_paths/1, - create_name/1]). - --export([ssl_server_certfile/0, ssl_client_certfile/0, ssl_port/0, - ssl_server_verify/0, - ssl_client_verify/0, - ssl_server_depth/0, ssl_client_depth/0, - ssl_server_cacertfile/0, - ssl_client_cacertfile/0]). - - -%%--------------- DEFINES ------------------------------------ --define(SUPERVISOR_NAME, oe_cosFileTransferSup). --define(SUP_FLAG, {simple_one_for_one,50,10}). --define(SUP_DIRECTORY_SPEC(Name, Args), - ['CosFileTransfer_Directory',Args, - [{sup_child, true}, {regname, {global, Name}}]]). --define(SUP_CHILD, - {"oe_FileTransferChild", - {cosFileTransfer,create_link, []}, - transient,100000,worker, - []}). - -%%------------------------------------------------------------ -%% function : install -%% Arguments: - -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Install necessary data in the IFR DB -%%------------------------------------------------------------ -install() -> - oe_CosFileTransfer:oe_register(). - -%%------------------------------------------------------------ -%% function : uninstall -%% Arguments: - -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Remove data related to cosFileTransfer from the IFR DB -%%------------------------------------------------------------ -uninstall() -> - oe_CosFileTransfer:oe_unregister(). - - -%%------------------------------------------------------------ -%% function : start/stop -%% Arguments: -%% Returns : -%% Effect : Starts or stops the cosFileTransfer application. -%%------------------------------------------------------------ -start() -> - application:start(cosFileTransfer). -stop() -> - application:stop(cosFileTransfer). - -%%------------------------------------------------------------ -%% function : start -%% Arguments: Type - see module application -%% Arg - see module application -%% Returns : -%% Effect : Module callback for application -%%------------------------------------------------------------ -start(_, _) -> - supervisor:start_link({local, ?SUPERVISOR_NAME}, cosFileTransferApp, app_init). - - -%%------------------------------------------------------------ -%% function : stop -%% Arguments: Arg - see module application -%% Returns : -%% Effect : Module callback for application -%%------------------------------------------------------------ -stop(_) -> - ok. - -%%-----------------------------------------------------------% -%% function : init -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ -%% Starting using create_factory/X -init(own_init) -> - {ok,{?SUP_FLAG, [?SUP_CHILD]}}; -%% When starting as an application. -init(app_init) -> - {ok,{?SUP_FLAG, [?SUP_CHILD]}}. - -%%------------------------------------------------------------ -%% function : create_VFS -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ -create_VFS(Type, Content, Host, Port) -> - create_VFS(Type, Content, Host, Port, []). - -create_VFS('FTP', Content, Host, Port, Options) - when is_list(Host) andalso is_integer(Port) andalso is_list(Options) -> - 'CosFileTransfer_VirtualFileSystem':oe_create(['FTP', Content, Host, Port, - Options], - [{pseudo, true}]); -create_VFS({'NATIVE', Mod}, Content, Host, Port, Options) - when is_list(Host) andalso is_integer(Port) andalso is_list(Options) -> - 'CosFileTransfer_VirtualFileSystem':oe_create([{'NATIVE', Mod}, Content, - Host, Port, Options], - [{pseudo, true}]); -create_VFS(_, _, _, _, _) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%-----------------------------------------------------------% -%% function : create_link -%% Arguments: Module - which Module to call -%% Env/ArgList - ordinary oe_create arguments. -%% Returns : -%% Exception: -%% Effect : Necessary since we want the supervisor to be a -%% 'simple_one_for_one'. Otherwise, using for example, -%% 'one_for_one', we have to call supervisor:delete_child -%% to remove the childs startspecification from the -%% supervisors internal state. -%%------------------------------------------------------------ -create_link(Module, Env, ArgList) -> - Module:oe_create_link(Env, ArgList). - -%%-----------------------------------------------------------% -%% function : get_option -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -get_option(Key, OptionList, DefaultList) -> - case lists:keysearch(Key, 1, OptionList) of - {value,{Key,Value}} -> - Value; - _ -> - case lists:keysearch(Key, 1, DefaultList) of - {value,{Key,Value}} -> - Value; - _-> - {error, "Invalid option"} - end - end. - -%%-----------------------------------------------------------% -%% function : type_check -%% Arguments: Obj - objectrefernce to test. -%% Mod - Module which contains typeID/0. -%% Returns : 'ok' or raises exception. -%% Effect : -%%------------------------------------------------------------ -type_check(Obj, Mod) -> - case catch corba_object:is_a(Obj,Mod:typeID()) of - true -> - ok; - _ -> - corba:raise(#'BAD_PARAM'{minor=700, completion_status=?COMPLETED_NO}) - end. - - -%%-----------------------------------------------------------% -%% function : create_name/1 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -create_name(Type) -> - Time = erlang:system_time(), - Unique = erlang:unique_integer([positive]), - lists:concat(['oe_',node(),'_',Type,'_',Time,'_',Unique]). - - -%%-----------------------------------------------------------% -%% function : get_buffert_size/0 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : Lookup the configuration variable 'buffert_size' -%%------------------------------------------------------------ -get_buffert_size() -> - case application:get_env(cosFileTransfer, buffert_size) of - {ok, Size} when is_integer(Size) -> - Size; - _ -> - ?DEFAULT_BUFSIZE - end. - -%%-----------------------------------------------------------% -%% function : configure/1 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -configure(buffert_size, Value) when is_integer(Value) -> - do_configure(buffert_size, Value); -configure(ssl_port, Value) when is_integer(Value) -> - do_safe_configure(ssl_port, Value); -configure(ssl_server_certfile, Value) when is_list(Value) -> - do_safe_configure(ssl_server_certfile, Value); -configure(ssl_server_certfile, Value) when is_atom(Value) -> - do_safe_configure(ssl_server_certfile, atom_to_list(Value)); -configure(ssl_client_certfile, Value) when is_list(Value) -> - do_safe_configure(ssl_client_certfile, Value); -configure(ssl_client_certfile, Value) when is_atom(Value) -> - do_safe_configure(ssl_client_certfile, atom_to_list(Value)); -configure(ssl_server_verify, Value) when is_integer(Value) -> - do_safe_configure(ssl_server_verify, Value); -configure(ssl_client_verify, Value) when is_integer(Value) -> - do_safe_configure(ssl_client_verify, Value); -configure(ssl_server_depth, Value) when is_integer(Value) -> - do_safe_configure(ssl_server_depth, Value); -configure(ssl_client_depth, Value) when is_integer(Value) -> - do_safe_configure(ssl_client_depth, Value); -configure(ssl_server_cacertfile, Value) when is_list(Value) -> - do_safe_configure(ssl_server_cacertfile, Value); -configure(ssl_server_cacertfile, Value) when is_atom(Value) -> - do_safe_configure(ssl_server_cacertfile, atom_to_list(Value)); -configure(ssl_client_cacertfile, Value) when is_list(Value) -> - do_safe_configure(ssl_client_cacertfile, Value); -configure(ssl_client_cacertfile, Value) when is_atom(Value) -> - do_safe_configure(ssl_client_cacertfile, atom_to_list(Value)); -configure(_, _) -> - exit({error, "Bad configure parameter(s)"}). - -%% This function may be used as long as it is safe to change a value at any time. -do_configure(Key, Value) -> - case is_loaded() of - false -> - application:load(cosFileTransfer), - application_controller:set_env(cosFileTransfer, Key, Value); - true -> - application_controller:set_env(cosFileTransfer, Key, Value) - end. - - -%% This function MUST(!!) be used when we cannot change a value if cosFileTransfer -%% is running. -do_safe_configure(Key, Value) -> - case is_loaded() of - false -> - application:load(cosFileTransfer), - application_controller:set_env(cosFileTransfer, Key, Value); - true -> - case is_running() of - false -> - application_controller:set_env(cosFileTransfer, Key, Value); - true -> - exit("cosFileTransfer already running, the given key may not be updated!") - end - end. - -%%-----------------------------------------------------------% -%% function : SSL parameter access functions -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -ssl_port() -> - case application:get_env(cosFileTransfer, ssl_port) of - {ok, Port} when is_integer(Port) -> - Port; - _ -> - -1 - end. - -ssl_server_certfile() -> - case application:get_env(cosFileTransfer, ssl_server_certfile) of - {ok, V1} when is_list(V1) -> - V1; - {ok, V2} when is_atom(V2) -> - atom_to_list(V2); - _What -> - {ok, Cwd} = file:get_cwd(), - filename:join(Cwd,"ssl_server_cert.pem") - end. - - -ssl_client_certfile() -> - case application:get_env(cosFileTransfer, ssl_client_certfile) of - {ok, V1} when is_list(V1) -> - V1; - {ok, V2} when is_atom(V2) -> - atom_to_list(V2); - _ -> - {ok, Cwd} = file:get_cwd(), - filename:join(Cwd,"ssl_client_cert.pem") - end. - -ssl_server_verify() -> - Verify = case application:get_env(cosFileTransfer, ssl_server_verify) of - {ok, V} when is_integer(V) -> - V; - _ -> - 0 - end, - if - Verify =< 2, Verify >= 0 -> - Verify; - true -> - 0 - end. - -ssl_client_verify() -> - Verify = case application:get_env(cosFileTransfer, ssl_client_verify) of - {ok, V1} when is_integer(V1) -> - V1; - _ -> - 0 - end, - if - Verify =< 2, Verify >= 0 -> - Verify; - true -> - 0 - end. - -ssl_server_depth() -> - case application:get_env(cosFileTransfer, ssl_server_depth) of - {ok, V1} when is_integer(V1) -> - V1; - _ -> - 1 - end. - -ssl_client_depth() -> - case application:get_env(cosFileTransfer, ssl_client_depth) of - {ok, V1} when is_integer(V1) -> - V1; - _ -> - 1 - end. - - -ssl_server_cacertfile() -> - case application:get_env(cosFileTransfer, ssl_server_cacertfile) of - {ok, V1} when is_list(V1) -> - V1; - {ok, V2} when is_atom(V2) -> - atom_to_list(V2); - _ -> - [] - end. - -ssl_client_cacertfile() -> - case application:get_env(cosFileTransfer, ssl_client_cacertfile) of - {ok, V1} when is_list(V1) -> - V1; - {ok, V2} when is_atom(V2) -> - atom_to_list(V2); - _ -> - [] - end. - - -%%============================================================ -%% Internal functions -%%============================================================ -%%-----------------------------------------------------------% -%% function : is_loaded/0 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : Check if the application is loaded -%%------------------------------------------------------------ -is_loaded() -> - is_loaded(application:loaded_applications()). - -is_running() -> - is_loaded(application:which_applications()). - -is_loaded([]) -> - false; -is_loaded([{cosFileTransfer, _, _} |_As]) -> - true; -is_loaded([_ |As]) -> - is_loaded(As). - - - - -%%-----------------------------------------------------------% -%% function : create_dir/3/4 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -create_dir(Session, FileNameList) -> - create_dir(Session, FileNameList, corba:create_nil_objref()). -create_dir(Session, FileNameList, Parent) -> - 'CosFileTransfer_Directory':oe_create([lists:last(FileNameList), FileNameList, - Parent, Session], - [{pseudo, true}]). - -%%-----------------------------------------------------------% -%% function : create_file/2/3 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -create_file(Session, FileNameList) -> - create_file(Session, FileNameList, corba:create_nil_objref()). -create_file(Session, FileNameList, Parent) -> - 'CosFileTransfer_File':oe_create([lists:last(FileNameList), FileNameList, - Parent, Session], [{pseudo, true}]). - -%%-----------------------------------------------------------% -%% function : split_paths -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -split_paths(Listing) -> - split_paths(string:tokens(Listing, ?SEPARATOR), []). -split_paths([], Acc) -> - Acc; -split_paths([H|T], Acc) -> - split_paths(T, [filename:split(H)|Acc]). - - -%%--------------- END OF MODULE ------------------------------ - - diff --git a/lib/cosFileTransfer/src/cosFileTransferApp.hrl b/lib/cosFileTransfer/src/cosFileTransferApp.hrl deleted file mode 100644 index 037be7a4af..0000000000 --- a/lib/cosFileTransfer/src/cosFileTransferApp.hrl +++ /dev/null @@ -1,69 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : cosFileTransferApp.hrl -%% Purpose : -%% Created : 10 Feb 2000 -%%---------------------------------------------------------------------- - - -%%--------------- INCLUDES ----------------------------------- -%% External --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). --include_lib("cosProperty/include/CosPropertyService.hrl"). - -%% Local --include_lib("cosFileTransfer/include/CosFileTransfer.hrl"). - --define(write_ErrorMsg(Txt, Arg), -error_logger:error_msg("============= CosFileTransfer =============~n" - Txt - "===========================================~n", - Arg)). - --define(FTP_PORT_INT, 21). --define(FTP_PORT_STR, "21"). --define(TCP_ID, "TCP"). --define(FTP_ID, "FTP"). --define(FTAM_ID, "FTAM"). --define(NATIVE_ID, "NATIVE"). --define(SUPPURTED_PROTOCOLS, ["TCP/IP", "SSL"]). - --define(DEFAULT_CONFIG, [{protocol, tcp}, {connect_timeout, 60}]). - --define(SEPARATOR, "\r\n"). - --define(DEFAULT_BUFSIZE, 64000). - --define(DEBUG_LEVEL, 3). - --ifdef(debug). --define(debug_print(F,A), - io:format("[LINE: ~p MODULE: ~p] "++F,[?LINE, ?MODULE]++A)). --define(ft_TypeCheck(O,M), 'cosFileTransferApp':type_check(O,M)). --else. --define(debug_print(F,A), ok). --define(ft_TypeCheck(O,I), ok). --endif. - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosFileTransfer/src/cosFileTransferNATIVE_file.erl b/lib/cosFileTransfer/src/cosFileTransferNATIVE_file.erl deleted file mode 100644 index 2969e61a2b..0000000000 --- a/lib/cosFileTransfer/src/cosFileTransferNATIVE_file.erl +++ /dev/null @@ -1,359 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : cosFileTransferNATIVE_file.erl -%% Description : -%% -%% Created : 9 Nov 2000 -%%---------------------------------------------------------------------- --module('cosFileTransferNATIVE_file'). - - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include("cosFileTransferApp.hrl"). --include_lib("kernel/include/file.hrl"). - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- --export([open/1, - open/2, - open/3, - user/3, - pwd/1, - cd/2, - mkdir/2, - rmdir/2, - nlist/1, - nlist/2, - delete/2, - recv/2, - recv/3, - send/2, - send/3, - close/1, - insert/4]). - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- --export([]). - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% function : open -%% Arguments: -%% Returns : {ok, Ref} | {error, ehost} for future use -%% Effect : -%%---------------------------------------------------------------------- -open(_Host) -> - {ok, 'NATIVE'}. -open(_Host, _Port) -> - {ok, 'NATIVE'}. -open(_Host, _Port, _Flags) -> - {ok, 'NATIVE'}. - -%%---------------------------------------------------------------------- -%% function : user -%% Arguments: Ref - what's returned by open/1/2 -%% User = Password = string() -%% Returns : ok | {error, euser | econn} for future use -%% Effect : -%%---------------------------------------------------------------------- -user(_Ref, _User, _Password) -> - ok. - -%%---------------------------------------------------------------------- -%% function : pwd -%% Arguments: Ref - what's returned by open/1/2 -%% Returns : {ok, string()} | {error, elogin | econn} -%% Effect : -%%---------------------------------------------------------------------- -pwd(_Ref) -> - case file:get_cwd() of - {ok, Cwd} -> - {ok, Cwd}; - _ -> - {error, econn} - end. - -%%---------------------------------------------------------------------- -%% function : cd -%% Arguments: Ref - what's returned by open/1/2 -%% Dir - string() -%% Returns : ok | {error, epath | elogin | econn} -%% Effect : -%%---------------------------------------------------------------------- -cd(_Ref, Dir) -> - case file:set_cwd(Dir) of - ok -> - ok; - {error, _} -> - {error, epath} - end. - -%%---------------------------------------------------------------------- -%% function : mkdir -%% Arguments: Ref - what's returned by open/1/2 -%% Dir - string() -%% Returns : ok | {error, epath} -%% Effect : -%%---------------------------------------------------------------------- -mkdir(_Ref, Dir) -> - case file:make_dir(Dir) of - ok -> - ok; - {error, _Reason} -> - {error, epath} - end. - -%%---------------------------------------------------------------------- -%% function : rmdir -%% Arguments: Ref - what's returned by open/1/2 -%% Dir - string() -%% Returns : ok | {error, epath} -%% Effect : -%%---------------------------------------------------------------------- -rmdir(_Ref, Dir) -> - case file:del_dir(Dir) of - ok -> - ok; - {error, _Reason} -> - {error, epath} - end. - -%%---------------------------------------------------------------------- -%% function : nlist -%% Arguments: Ref - what's returned by open/1/2 -%% Dir - string() -%% Returns : {ok, Listing} | {error, epath | elogin | econn} -%% Effect : -%%---------------------------------------------------------------------- -nlist(_Ref) -> - case file:get_cwd() of - {ok, Cwd} -> - %% Here we can assume that it's a Directory is tested. - convert_to_nlist(file:list_dir(Cwd)); - _ -> - {error, epath} - end. -nlist(_Ref, Dir) -> - case file:list_dir(Dir) of - {error, _} -> - %% Might be a File - case file:read_file_info(Dir) of - {ok, _} -> - convert_to_nlist_helper([Dir], []); - _ -> - {error, epath} - end; - {ok, Content} -> - convert_to_nlist_helper(Content, []) - end. - -convert_to_nlist({error, _}) -> - {error, epath}; -convert_to_nlist({ok, Content}) -> - convert_to_nlist_helper(Content, []). - -convert_to_nlist_helper([], Acc) -> - {ok, lists:concat(Acc)}; -convert_to_nlist_helper([H|T], Acc) -> - convert_to_nlist_helper(T, [H, "\r\n"|Acc]). - -%%---------------------------------------------------------------------- -%% function : delete -%% Arguments: Ref - what's returned by open/1/2 -%% File - string() -%% Returns : ok | {error, epath} -%% Effect : -%%---------------------------------------------------------------------- -delete(_Ref, File) -> - case file:delete(File) of - ok -> - ok; - {error, _Reason} -> - {error, epath} - end. - -%%---------------------------------------------------------------------- -%% function : recv -%% Arguments: Ref - what's returned by open/1/2 -%% Returns : ok | {error, epath | elogin | econn} -%% Effect : -%%---------------------------------------------------------------------- -recv(_Ref, _Remote) -> - ok. -recv(_Ref, Remote, Local) -> - copy_file(Remote, Local). - -%%---------------------------------------------------------------------- -%% function : send -%% Arguments: Ref - what's returned by open/1/2 -%% Returns : ok | {error, epath | elogin | econn | etnospc | epnospc | efnamena} -%% Effect : -%%---------------------------------------------------------------------- -send(_Ref, _Local) -> - ok. -send(_Ref, Local, Remote) -> - copy_file(Local, Remote). - -%%---------------------------------------------------------------------- -%% function : close -%% Arguments: Ref - what's returned by open/1/2 -%% Returns : ok -%% Effect : Currently none. -%%---------------------------------------------------------------------- -close(_) -> - ok. - - -%%---------------------------------------------------------------------- -%% function : insert -%% Arguments: Ref - what's returned by open/1/2 -%% Local - absolute file name -%% Remote - absolute file name -%% Offset - long() -%% Returns : ok -%% Effect : -%%---------------------------------------------------------------------- -insert(_Ref, Source, Target, Offset) -> - case file:open(Source, [raw, binary, read]) of - {ok, SourceDev} -> - case file:open(Target, [raw, binary, read, write]) of - {ok, TargetDev} -> - {ok, #file_info{size=SSize}} = - file:read_file_info(Source), - {ok, #file_info{size=TSize}} = - file:read_file_info(Target), - insert_file_helper(SourceDev, TargetDev, SSize, TSize, Offset); - Reason -> - file:close(SourceDev), - convert_error(Reason) - end; - Reason -> - convert_error(Reason) - end. - - -insert_file_helper(SourceDev, TargetDev, SSize, TSize, Offset) -> - BuffSize = cosFileTransferApp:get_buffert_size(), - move_data(TargetDev, TSize, SSize+TSize, TSize-Offset, BuffSize), - insert_data(SourceDev, TargetDev, 0, Offset, BuffSize), - file:close(SourceDev), - file:close(TargetDev). -move_data(_F, _RLocation, _WLocation, Counter, _BuffSize) when Counter == 0 -> - ok; -move_data(F, RLocation, WLocation, Counter, BuffSize) when Counter =< BuffSize -> - case file:pread(F, RLocation-Counter, Counter) of - {ok, Bin} -> - file:pwrite(F, WLocation-Counter, Bin); - eof -> - ok - end; -move_data(F, RLocation, WLocation, Counter, BuffSize) -> - NewRLC = RLocation-BuffSize, - NewWLC = WLocation-BuffSize, - case file:pread(F, NewRLC, BuffSize) of - {ok, Bin} -> - file:pwrite(F, NewWLC, Bin), - move_data(F, NewRLC, NewWLC, Counter-BuffSize, BuffSize); - eof -> - ok - end. - -insert_data(FSRC, FTGT, RLocation, WLocation, BuffSize) -> - case file:pread(FSRC, RLocation, BuffSize) of - {ok, Bin} -> - file:pwrite(FTGT, WLocation, Bin), - insert_data(FSRC, FTGT, RLocation+BuffSize, WLocation+BuffSize, BuffSize); - eof -> - ok - end. - - -%%====================================================================== -%% Internal functions -%%====================================================================== -copy_file(Source, Target) -> - case file:open(Source, [raw, binary, read]) of - {ok, SourceDev} -> - case file:open(Target, [raw, binary, append]) of - {ok, TargetDev} -> - BuffSize = cosFileTransferApp:get_buffert_size(), - copy_file_helper(SourceDev, TargetDev, BuffSize); - Reason -> - file:close(SourceDev), - convert_error(Reason) - end; - Reason -> - convert_error(Reason) - end. - -copy_file_helper(SourceDev, TargetDev, BuffSize) -> - case file:read(SourceDev, BuffSize) of - eof -> - file:close(SourceDev), - file:close(TargetDev); - {ok, Bin} -> - case file:write(TargetDev, Bin) of - ok -> - copy_file_helper(SourceDev, TargetDev, BuffSize); - Reason -> - file:close(SourceDev), - file:close(TargetDev), - convert_error(Reason) - end; - {error, Reason} -> - file:close(SourceDev), - file:close(TargetDev), - convert_error(Reason) - end. - -convert_error({error, eacces}) -> - {error, elogin}; -convert_error({error, enoent}) -> - {error, epath}; -convert_error({error, enotdir}) -> - {error, epath}; -convert_error({error, eidir}) -> - {error, epath}; -convert_error({error, enospc}) -> - {error, etnospc}; -convert_error(_) -> - {error, epath}. - -%%====================================================================== -%% END OF MODULE -%%====================================================================== diff --git a/lib/cosFileTransfer/test/Makefile b/lib/cosFileTransfer/test/Makefile deleted file mode 100644 index 45c67a95dd..0000000000 --- a/lib/cosFileTransfer/test/Makefile +++ /dev/null @@ -1,132 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2000-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSFILETRANSFER_VSN) -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/cosFileTransfer_test - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -TEST_SPEC_FILE = cosFileTransfer.spec -COVER_FILE = cosFileTransfer.cover - - -IDL_FILES = - -IDLOUTDIR = idl_output - -MODULES = \ - fileTransfer_SUITE \ - -GEN_MODULES = \ - -GEN_HRL_FILES = \ - -ERL_FILES = $(MODULES:%=%.erl) - -HRL_FILES = - -GEN_FILES = \ - $(GEN_HRL_FILES:%=$(IDLOUTDIR)/%) \ - $(GEN_MODULES:%=$(IDLOUTDIR)/%.erl) - -GEN_TARGET_FILES = $(GEN_MODULES:%=$(IDLOUTDIR)/%.$(EMULATOR)) - -SUITE_TARGET_FILES = $(MODULES:%=%.$(EMULATOR)) - -TARGET_FILES = \ - $(GEN_TARGET_FILES) \ - $(SUITE_TARGET_FILES) - - -# ---------------------------------------------------- -# PROGRAMS -# ---------------------------------------------------- -LOCAL_CLASSPATH = $(ERL_TOP)lib/cosFileTransfer/priv:$(ERL_TOP)lib/cosFileTransfer/test -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/cosFileTransfer/ebin \ - -pa $(ERL_TOP)/lib/cosFileTransfer/src \ - -pa $(ERL_TOP)/lib/cosFileTransfer/include \ - -pa $(ERL_TOP)/lib/cosProperty/ebin \ - -pa $(ERL_TOP)/lib/cosProperty/include \ - -pa $(ERL_TOP)/lib/orber/ebin \ - -pa $(ERL_TOP)/lib/ic/ebin - -ERL_COMPILE_FLAGS += \ - $(ERL_IDL_FLAGS) \ - -pa $(ERL_TOP)/lib/orber/include \ - -pa $(ERL_TOP)/lib/cosProperty/include \ - -pa $(ERL_TOP)/lib/cosFileTransfer/ebin \ - -pa $(ERL_TOP)/lib/cosFileTransfer/include \ - -pa $(ERL_TOP)/lib/cosFileTransfer/test/idl_output \ - -I$(ERL_TOP)/lib/orber/include \ - -I$(ERL_TOP)/lib/cosProperty/include \ - -I$(ERL_TOP)/lib/cosFileTransfer/src \ - -I$(ERL_TOP)/lib/cosFileTransfer/include \ - -I$(ERL_TOP)/lib/cosFileTransfer \ - -I$(ERL_TOP)/lib/cosFileTransfer/test/$(IDLOUTDIR) - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- - - -tests debug opt: $(TARGET_FILES) - -clean: - rm -f idl_output/* - rm -f $(TARGET_FILES) - rm -f errs core *~ - -docs: - -# ---------------------------------------------------- -# Special Targets -# ---------------------------------------------------- - -# ---------------------------------------------------- -# Release Targets -# ---------------------------------------------------- -# We don't copy generated intermediate erlang and hrl files - -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: - -release_docs_spec: - -release_tests_spec: tests - $(INSTALL_DIR) "$(RELSYSDIR)" - $(INSTALL_DATA) $(IDL_FILES) $(TEST_SPEC_FILE) \ - $(COVER_FILE) $(ERL_FILES) "$(RELSYSDIR)" - $(INSTALL_DATA) $(SUITE_TARGET_FILES) "$(RELSYSDIR)" - chmod -R u+w "$(RELSYSDIR)" diff --git a/lib/cosFileTransfer/test/cosFileTransfer.cover b/lib/cosFileTransfer/test/cosFileTransfer.cover deleted file mode 100644 index 063dd66990..0000000000 --- a/lib/cosFileTransfer/test/cosFileTransfer.cover +++ /dev/null @@ -1,2 +0,0 @@ -{incl_app,cosFileTransfer,details}. - diff --git a/lib/cosFileTransfer/test/cosFileTransfer.spec b/lib/cosFileTransfer/test/cosFileTransfer.spec deleted file mode 100644 index 290b27d048..0000000000 --- a/lib/cosFileTransfer/test/cosFileTransfer.spec +++ /dev/null @@ -1 +0,0 @@ -{suites,"../cosFileTransfer_test", all}. diff --git a/lib/cosFileTransfer/test/fileTransfer_SUITE.erl b/lib/cosFileTransfer/test/fileTransfer_SUITE.erl deleted file mode 100644 index 12aef2913a..0000000000 --- a/lib/cosFileTransfer/test/fileTransfer_SUITE.erl +++ /dev/null @@ -1,938 +0,0 @@ -%%----------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : fileTransfer_SUITE.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module(fileTransfer_SUITE). - -%%--------------- INCLUDES ----------------------------------- --include_lib("cosFileTransfer/src/cosFileTransferApp.hrl"). - --include_lib("common_test/include/ct.hrl"). - -%%--------------- DEFINES ------------------------------------ --define(default_timeout, test_server:minutes(20)). --define(match(ExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - io:format("------ CORRECT RESULT ------~n~p~n", - [AcTuAlReS]), - AcTuAlReS; - _ -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS) - end - end()). - --define(matchnopr(ExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - io:format("------ CORRECT RESULT (~p) ------~n", [?LINE]), - AcTuAlReS; - _ -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS) - end - end()). - - - - - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0,suite/0,groups/0, - init_per_group/2,end_per_group/2, - cases/0, - init_per_suite/1, - end_per_suite/1, - fileIterator_api/1, - fts_ftp_file_api/1, - fts_ftp_file_ssl_api/1, - fts_ftp_dir_api/1, - fts_native_file_api/1, - fts_native_file_ssl_api/1, - fts_native_dir_api/1, - init_per_testcase/2, - end_per_testcase/2, - install_data/2, - uninstall_data/1, - slave_sup/0, - app_test/1]). - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -suite() -> - [{ct_hooks,[ts_install_cth]}]. - -all() -> - cases(). - -groups() -> - []. - - - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -cases() -> - [fts_ftp_dir_api, fts_ftp_file_api, - fts_ftp_file_ssl_api, fts_native_dir_api, - fts_native_file_api, fts_native_file_ssl_api, - fileIterator_api, app_test]. - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- - -init_per_testcase(_Case, Config) -> - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - - -end_per_testcase(_Case, Config) -> - Dog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -init_per_suite(Config) -> - case crypto_works() of - false -> - {skip,"Could not start crypto!"}; - true -> - orber:jump_start(), - cosProperty:install(), - cosProperty:start(), - Dir = filename:join([code:lib_dir(ssl), "examples", "certs", "etc"]), - %% Client - cosFileTransferApp:configure(ssl_client_certfile, - filename:join([Dir, "client", "cert.pem"])), - cosFileTransferApp:configure(ssl_client_cacertfile, - filename:join([Dir, "client", "cacerts.pem"])), - cosFileTransferApp:configure(ssl_client_verify, 1), - cosFileTransferApp:configure(ssl_client_depth, 0), - %% Server - cosFileTransferApp:configure(ssl_server_certfile, - filename:join([Dir, "server", "cert.pem"])), - cosFileTransferApp:configure(ssl_server_cacertfile, - filename:join([Dir, "server", "cacerts.pem"])), - cosFileTransferApp:configure(ssl_server_verify, 1), - cosFileTransferApp:configure(ssl_server_depth, 0), - crypto:start(), - ssl:start(), - cosFileTransferApp:install(), - cosFileTransferApp:start(), - if - is_list(Config) -> - Config; - true -> - exit("Config not a list") - end - end. - -crypto_works() -> - try crypto:start() of - {error,{already_started,crypto}} -> true; - ok -> true - catch - error:_ -> - false - end. - -end_per_suite(Config) -> - ssl:stop(), - crypto:stop(), - cosFileTransferApp:stop(), - cosProperty:stop(), - cosProperty:uninstall(), - cosFileTransferApp:uninstall(), - orber:jump_stop(), - Config. - -%%----------------------------------------------------------------- -%% Local definitions -%%----------------------------------------------------------------- --define(FTP_USER, "anonymous"). --define(FTP_PASS, "fileTransfer_SUITE@localhost"). --define(TEST_DIR,["/", "incoming"]). - --define(FTP_PORT, 21). --define(FTP_ACC, "anonymous"). - --define(BAD_HOST, "badhostname"). --define(BAD_USER, "baduser"). --define(BAD_DIR, "baddirectory"). - --define(TEST_FILE_DATA, "If this file exists after a completed test an error occurred."). --define(TEST_FILE_DATA2, "1234567890123"). - -%%----------------------------------------------------------------- -%% aoo-file test -%%----------------------------------------------------------------- -app_test(_Config) -> - ok=?t:app_test(cosFileTransfer), - ok. - -%%----------------------------------------------------------------- -%% FileIterator API tests -%%----------------------------------------------------------------- -fileIterator_api(Config) -> - case ftp_host(Config) of - {skipped, SkippedReason} -> - {skipped, SkippedReason}; - Host -> - - {ok, Node} = create_node("fileIterator_api", 4008, normal), - ?match(ok, remote_apply(Node, ?MODULE, install_data, - [tcp, {{'NATIVE', - 'cosFileTransferNATIVE_file'}, Host, - "fileIterator_api"}])), - - %% Create a Virtual File System. -%% VFS = ?match({_,_,_,_,_,_}, -%% cosFileTransferApp:create_VFS({'NATIVE', -%% 'cosFileTransferNATIVE_file'}, -%% [], Host, ?FTP_PORT)), - VFS = ?matchnopr({'IOP_IOR',"IDL:omg.org/CosFileTransfer/VirtualFileSystem:1.0",_}, - corba:string_to_object("corbaname::1.2@localhost:4008/NameService#fileIterator_api")), - - %% Start two File Transfer Sessions (Source and Target). - {FS, Dir} = ?matchnopr({{_,_,_},{_,_,_}}, - 'CosFileTransfer_VirtualFileSystem':login(VFS, - ?FTP_USER, - ?FTP_PASS, - ?FTP_ACC)), - - %% Do some basic test on one of the Directories attributes. - ?match([_H|_], 'CosFileTransfer_Directory':'_get_name'(Dir)), - ?match([_H|_], 'CosFileTransfer_Directory':'_get_complete_file_name'(Dir)), - ?match({'IOP_IOR',[],[]}, 'CosFileTransfer_Directory':'_get_parent'(Dir)), - ?matchnopr(FS, 'CosFileTransfer_Directory':'_get_associated_session'(Dir)), - {ok,[],FileIter} = ?match({ok,[],_}, 'CosFileTransfer_Directory':list(Dir, 0)), - %% Usually the working directory for the test is not empty so no need for - %% creating files of our own?! - #any{value=Children} = ?match({any, _, _}, - 'CosPropertyService_PropertySet': - get_property_value(Dir, "num_children")), - - if - Children > 5 -> - ?matchnopr({true, _}, 'CosFileTransfer_FileIterator':next_one(FileIter)), - ?matchnopr({true, _}, 'CosFileTransfer_FileIterator':next_n(FileIter, 3)), - ?matchnopr({true, _}, 'CosFileTransfer_FileIterator':next_n(FileIter, - Children)), - ?matchnopr({false, _}, 'CosFileTransfer_FileIterator':next_one(FileIter)), - ?match({false, []}, 'CosFileTransfer_FileIterator':next_n(FileIter, 1)), - ok; - true -> - ok - end, - ?match(ok, 'CosFileTransfer_FileIterator':destroy(FileIter)), - ?match(false, corba_object:non_existent(FS)), - ?match(ok, 'CosFileTransfer_FileTransferSession':logout(FS)), - %% To make sure Orber can remove it from mnesia. - timer:sleep(1000), - ?match(true, corba_object:non_existent(FS)), - ?match(ok, remote_apply(Node, ?MODULE, uninstall_data, ["fileIterator_api"])), - stop_orber_remote(Node, normal), - ok - end. - - -%%----------------------------------------------------------------- -%% FileTransferSession API tests -%%----------------------------------------------------------------- -fts_ftp_file_api(Config) -> - {ok, Node} = create_node("ftp_file_api", 4004, normal), - file_helper(Config, 'FTP', ?TEST_DIR, Node, 4004, "ftp_file_api", tcp). - -fts_ftp_file_ssl_api(Config) -> - {ok, Node} = create_node("ftp_file_api_ssl", {4005, 1}, ssl), - file_helper(Config, 'FTP', ?TEST_DIR, Node, 4005, "ftp_file_api_ssl", ssl). - -fts_native_file_api(Config) -> - {ok, Node} = create_node("native_file_api", 4006, normal), - {ok, Pwd} = file:get_cwd(), - file_helper(Config,{'NATIVE', 'cosFileTransferNATIVE_file'},filename:split(Pwd), - Node, 4006, "native_file_api", tcp). - -fts_native_file_ssl_api(Config) -> - {ok, Node} = create_node("native_file_ssl_api", {4007, 1}, ssl), - {ok, Pwd} = file:get_cwd(), - file_helper(Config,{'NATIVE', 'cosFileTransferNATIVE_file'},filename:split(Pwd), - Node, 4007, "native_file_ssl_api", ssl). - - -file_helper(Config, WhichType, TEST_DIR, Node, Port, Name, Type) -> - case ftp_host(Config) of - {skipped, SkippedReason} -> - {skipped, SkippedReason}; - Host -> - TEST_SOURCE = TEST_DIR ++ [create_name(remove_me_source)], - TEST_SOURCE2 = TEST_DIR ++ [create_name(remove_me_source)], - TEST_TARGET = TEST_DIR ++ [create_name(remove_me_target)], - - io:format("<<<<<< CosFileTransfer Testing Configuration >>>>>>~n",[]), - io:format("Source: ~p~nTarget: ~p~n", [TEST_SOURCE, TEST_TARGET]), - - ?match(ok, remote_apply(Node, ?MODULE, install_data, - [Type, {WhichType, Host, Name}])), - - VFST = ?match({'IOP_IOR',"IDL:omg.org/CosFileTransfer/VirtualFileSystem:1.0",_}, - corba:string_to_object("corbaname::1.2@localhost:"++integer_to_list(Port)++"/NameService#"++Name)), - - - %% Create a Virtual File System. - VFS = ?match({_,_,_,_,_,_}, - cosFileTransferApp:create_VFS(WhichType, [], Host, ?FTP_PORT, - [{protocol, Type}])), - %% Start two File Transfer Sessions (Source and Target). - {FST, _DirT} = ?match({{_,_,_},{_,_,_}}, - 'CosFileTransfer_VirtualFileSystem':login(VFST, - ?FTP_USER, - ?FTP_PASS, - ?FTP_ACC)), - {FSS, DirS} = ?match({{_,_,_,_,_,_},{_,_,_,_,_,_}}, - 'CosFileTransfer_VirtualFileSystem':login(VFS, - ?FTP_USER, - ?FTP_PASS, - ?FTP_ACC)), - - %% Do some basic test on one of the Directories attributes. - ?match([_H|_], 'CosFileTransfer_Directory':'_get_name'(DirS)), - ?match([_H|_], 'CosFileTransfer_Directory':'_get_complete_file_name'(DirS)), - ?match({'IOP_IOR',[],[]}, 'CosFileTransfer_Directory':'_get_parent'(DirS)), - ?match(FSS, 'CosFileTransfer_Directory':'_get_associated_session'(DirS)), - - %% Get a FileList before we create any new Files - #'CosFileTransfer_FileWrapper'{the_file = Dir} = - ?match({'CosFileTransfer_FileWrapper', _, ndirectory}, - 'CosFileTransfer_FileTransferSession':get_file(FSS, TEST_DIR)), - {ok,FileList, Iter1} = ?match({ok,_,_}, 'CosFileTransfer_Directory':list(Dir, 10)), - loop_files(FileList), - - case Iter1 of - {'IOP_IOR',[],[]} -> - ok; - _-> - ?match(ok, 'CosFileTransfer_FileIterator':destroy(Iter1)) - end, - - #any{value=Count1} = ?match({any, _, _}, 'CosPropertyService_PropertySet': - get_property_value(Dir, "num_children")), - - %% Now we want to transfer a file from source to target. First, we'll create - %% a a file to work with. - create_file_on_source_node(WhichType, Config, Host, - filename:join(TEST_SOURCE), TEST_DIR, - ?TEST_FILE_DATA), - create_file_on_source_node(WhichType, Config, Host, - filename:join(TEST_SOURCE2), TEST_DIR, - ?TEST_FILE_DATA2), - - #'CosFileTransfer_FileWrapper'{the_file = FileS} = - ?matchnopr({'CosFileTransfer_FileWrapper', _, nfile}, - 'CosFileTransfer_FileTransferSession':get_file(FSS, TEST_SOURCE)), - #'CosFileTransfer_FileWrapper'{the_file = FileS2} = - ?matchnopr({'CosFileTransfer_FileWrapper', _, nfile}, - 'CosFileTransfer_FileTransferSession':get_file(FSS, TEST_SOURCE2)), - - #any{value=Count2} = ?match({any, _, _}, 'CosPropertyService_PropertySet': - get_property_value(Dir, "num_children")), - timer:sleep(2000), - ?match(true, (Count1+2 == Count2)), - - %% Create a target File - FileT = ?matchnopr({_,_,_}, - 'CosFileTransfer_FileTransferSession':create_file(FST, TEST_TARGET)), - %% Try to delete the non-existing file. - ?match({'EXCEPTION', _}, - 'CosFileTransfer_FileTransferSession':delete(FST, FileT)), - - ?match(ok, 'CosFileTransfer_FileTransferSession':transfer(FSS, FileS, FileT)), - - %% Remove this test when ftp supports append. - case WhichType of - {'NATIVE', 'cosFileTransferNATIVE_file'} -> - ?match(ok, 'CosFileTransfer_FileTransferSession':append(FSS, FileS, FileT)), - ?match(ok, 'CosFileTransfer_FileTransferSession':insert(FSS, FileS2, FileT, 7)); - _-> - ok - end, - - %% Delete source and target files - ?match(ok, 'CosFileTransfer_FileTransferSession':delete(FSS, FileS)), - ?match(ok, 'CosFileTransfer_FileTransferSession':delete(FSS, FileS2)), - ?match(ok, 'CosFileTransfer_FileTransferSession':delete(FST, FileT)), - - %% Should be back where we started. - timer:sleep(2000), - #any{value=Count3} = ?match({any, _, _}, 'CosPropertyService_PropertySet': - get_property_value(Dir, "num_children")), - ?match(true, (Count1 == Count3)), - - - ?match(false, corba_object:non_existent(FSS)), - ?match(false, corba_object:non_existent(FST)), - ?match(ok, 'CosFileTransfer_FileTransferSession':logout(FSS)), - ?match(ok, 'CosFileTransfer_FileTransferSession':logout(FST)), - %% To make sure Orber can remove it from mnesia. - timer:sleep(2000), - ?match(true, corba_object:non_existent(FSS)), - ?match(true, corba_object:non_existent(FST)), - ?match(ok, remote_apply(Node, ?MODULE, uninstall_data, [Name])), - stop_orber_remote(Node, normal), - ok - end. - -%%----------------------------------------------------------------- -%% FileTransferSession API tests -%%----------------------------------------------------------------- -fts_ftp_dir_api(Config) -> - {ok, Node} = create_node("ftp_dir_api", 4009, normal), - dir_helper(Config, 'FTP', ?TEST_DIR, Node, 4009, "ftp_dir_api"). - -fts_native_dir_api(Config) -> - {ok, Node} = create_node("native_dir_api", 4010, normal), - {ok, Pwd} = file:get_cwd(), - dir_helper(Config, {'NATIVE', 'cosFileTransferNATIVE_file'}, - filename:split(Pwd), Node, 4010, "native_dir_api"). - -dir_helper(Config, WhichType, TEST_DIR, Node, Port, Name) -> - case ftp_host(Config) of - {skipped, SkippedReason} -> - {skipped, SkippedReason}; - Host -> - TEST_DIR_LEVEL1 = TEST_DIR ++ [create_name(remove_me_dir1)], - TEST_DIR_LEVEL2 = TEST_DIR_LEVEL1 ++ [create_name(remove_me_dir2)], - - io:format("<<<<<< CosFileTransfer Testing Configuration >>>>>>~n",[]), - io:format("Top Dir: ~p~nLevel2 Dir: ~p~n", [TEST_DIR_LEVEL1, TEST_DIR_LEVEL2]), - - ?match(ok, remote_apply(Node, ?MODULE, install_data, - [tcp, {WhichType, Host, Name}])), - - VFS = ?matchnopr({'IOP_IOR',"IDL:omg.org/CosFileTransfer/VirtualFileSystem:1.0",_}, - corba:string_to_object("corbaname::1.2@localhost:"++integer_to_list(Port)++"/NameService#"++Name)), - - %% Start two File Transfer Sessions (Source and Target). - {FS, DirS} = ?matchnopr({{'IOP_IOR',_,_}, _}, - 'CosFileTransfer_VirtualFileSystem':login(VFS, - ?FTP_USER, - ?FTP_PASS, - ?FTP_ACC)), - - %% Do some basic test on one of the Directories attributes. - ?match([_H|_], 'CosFileTransfer_Directory':'_get_name'(DirS)), - ?match([_H|_], 'CosFileTransfer_Directory':'_get_complete_file_name'(DirS)), - ?match({'IOP_IOR',[],[]}, 'CosFileTransfer_Directory':'_get_parent'(DirS)), - ?matchnopr(FS, 'CosFileTransfer_Directory':'_get_associated_session'(DirS)), - - %% Create a Root Directory. Currently we only need to create one but - %% later on, when supporting other protocols than FTP it's not enough. - Dir1 = 'CosFileTransfer_FileTransferSession':create_directory(FS, - TEST_DIR_LEVEL1), - io:format("<<<<<< CosFileTransfer Testing Properties >>>>>>~n",[]), - ?match({ok, [tk_long, tk_boolean]}, - 'CosFileTransfer_Directory':get_allowed_property_types(Dir1)), - ?match({ok, [_,_]}, - 'CosFileTransfer_Directory':get_allowed_properties(Dir1)), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':define_property_with_mode(Dir1, - "num_children", - #any{typecode=tk_long, value=0}, - fixed_readonly)), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':define_property_with_mode(Dir1, - "wrong", - #any{typecode=tk_long, value=0}, - fixed_readonly)), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':define_property_with_mode(Dir1, - "num_children", - #any{typecode=tk_short, value=0}, - fixed_readonly)), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':define_property_with_mode(Dir1, - "num_children", - #any{typecode=tk_long, value=0}, - fixed_normal)), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':define_properties_with_modes(Dir1, - [#'CosPropertyService_PropertyDef' - {property_name = "num_children", - property_value = #any{typecode=tk_long, value=0}, - property_mode = fixed_readonly}])), - ?match(fixed_readonly, - 'CosFileTransfer_Directory':get_property_mode(Dir1, "num_children")), - ?match({true, - [#'CosPropertyService_PropertyMode'{property_name = "num_children", - property_mode = fixed_readonly}]}, - 'CosFileTransfer_Directory':get_property_modes(Dir1, ["num_children"])), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':set_property_mode(Dir1, "num_children", fixed_readonly)), - - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory': - set_property_modes(Dir1, - [#'CosPropertyService_PropertyMode' - {property_name = "num_children", - property_mode = fixed_readonly}])), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory': - set_property_modes(Dir1, - [#'CosPropertyService_PropertyMode' - {property_name = "wrong", - property_mode = fixed_readonly}])), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory': - set_property_modes(Dir1, - [#'CosPropertyService_PropertyMode' - {property_name = "num_children", - property_mode = fixed_normal}])), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':define_property(Dir1, - "num_children", - #any{typecode=tk_long, value=0})), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':define_property(Dir1, - "wrong", - #any{typecode=tk_long, value=0})), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':define_property(Dir1, - "num_children", - #any{typecode=tk_short, value=0})), - - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':define_property(Dir1, - "num_children", - #any{typecode=tk_long, value=0})), - - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory': - define_properties(Dir1, - [#'CosPropertyService_Property' - {property_name = "num_children", - property_value = #any{typecode=tk_long, - value=0}}])), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory': - define_properties(Dir1, - [#'CosPropertyService_Property' - {property_name = "wrong", - property_value = #any{typecode=tk_long, - value=0}}])), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory': - define_properties(Dir1, - [#'CosPropertyService_Property' - {property_name = "num_children", - property_value = #any{typecode=tk_short, - value=0}}])), - ?match(2, 'CosFileTransfer_Directory':get_number_of_properties(Dir1)), - - ?match({ok, ["num_children", "is_directory"], {'IOP_IOR',[],[]}}, - 'CosFileTransfer_Directory':get_all_property_names(Dir1, 2)), - ?match({ok, ["is_directory"], _}, - 'CosFileTransfer_Directory':get_all_property_names(Dir1, 1)), - - ?match(#any{}, - 'CosFileTransfer_Directory':get_property_value(Dir1, "num_children")), - ?match(#any{}, - 'CosFileTransfer_Directory':get_property_value(Dir1, "is_directory")), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':get_property_value(Dir1, "wrong")), - - ?match({true, - [#'CosPropertyService_Property'{property_name = "num_children"}]}, - 'CosFileTransfer_Directory':get_properties(Dir1, ["num_children"])), - ?match({false, - [#'CosPropertyService_Property'{property_name = "wrong"}]}, - 'CosFileTransfer_Directory':get_properties(Dir1, ["wrong"])), - - ?match({ok, [_],_}, - 'CosFileTransfer_Directory':get_all_properties(Dir1, 1)), - ?match({ok, [_,_], {'IOP_IOR',[],[]}}, - 'CosFileTransfer_Directory':get_all_properties(Dir1, 2)), - - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':delete_property(Dir1, "num_children")), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':delete_property(Dir1, "wrong")), - - - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':delete_properties(Dir1, ["num_children"])), - ?match({'EXCEPTION', _}, - 'CosFileTransfer_Directory':delete_properties(Dir1, ["wrong"])), - ?match(false, 'CosFileTransfer_Directory':delete_all_properties(Dir1)), - ?match(true, - 'CosFileTransfer_Directory':is_property_defined(Dir1, "num_children")), - ?match(false, - 'CosFileTransfer_Directory':is_property_defined(Dir1, "wrong")), - - %% The Top Dir should be empty and ... - ?match({ok,[],_}, 'CosFileTransfer_Directory':list(Dir1, 1000)), - ?match( #any{value=0}, - 'CosPropertyService_PropertySet':get_property_value(Dir1, "num_children")), - %% Create a sub-directory. - Dir2 = 'CosFileTransfer_FileTransferSession':create_directory(FS, - TEST_DIR_LEVEL2), - ?match( #any{value=1}, - 'CosPropertyService_PropertySet':get_property_value(Dir1, "num_children")), - - ?match({ok, [_,_], {'IOP_IOR',[],[]}}, - 'CosFileTransfer_Directory':get_all_properties(Dir1, 2)), - {_,_,Iterator1} = ?match({ok, [_], _}, - 'CosFileTransfer_Directory':get_all_properties(Dir1, 1)), - ?match({false, [_]}, - 'CosPropertyService_PropertiesIterator':next_n(Iterator1,4)), - - {_,_,Iterator0} = ?match({ok, [], _}, - 'CosFileTransfer_Directory':get_all_properties(Dir1, 0)), - - ?match({false, [_, {'CosPropertyService_Property', - "num_children",{any,tk_long,1}}]}, - 'CosPropertyService_PropertiesIterator':next_n(Iterator0,4)), - - ?match({true, - [#'CosPropertyService_Property'{property_name = "num_children"}]}, - 'CosFileTransfer_Directory':get_properties(Dir1, ["num_children"])), - - %% The Top Directory is not emtpy any more and ... - {ok,[#'CosFileTransfer_FileWrapper'{the_file = DirRef}],_} = - ?matchnopr({ok,[{'CosFileTransfer_FileWrapper', _, ndirectory}],_}, - 'CosFileTransfer_Directory':list(Dir1, 1000)), - %% ... its name eq. to 'TEST_DIR_LEVEL2' - ?match(TEST_DIR_LEVEL2, - 'CosFileTransfer_Directory':'_get_complete_file_name'(DirRef)), - - #'CosFileTransfer_FileWrapper'{the_file = Dir3} = - ?matchnopr({'CosFileTransfer_FileWrapper', _, ndirectory}, - 'CosFileTransfer_FileTransferSession':get_file(FS, TEST_DIR_LEVEL1)), - - %% Must get the same result for the 'get_file' operation. - {ok,[#'CosFileTransfer_FileWrapper'{the_file = DirRef2}],_} = - ?matchnopr({ok,[{'CosFileTransfer_FileWrapper', _, ndirectory}],_}, - 'CosFileTransfer_Directory':list(Dir3,1000)), - ?match(TEST_DIR_LEVEL2, - 'CosFileTransfer_Directory':'_get_complete_file_name'(DirRef2)), - - %% Since the top directory isn't empty deleting it must fail. - ?match({'EXCEPTION', _}, - 'CosFileTransfer_FileTransferSession':delete(FS, Dir1)), - - %% Delete the sub-directory and ... - ?match(ok, 'CosFileTransfer_FileTransferSession':delete(FS, Dir2)), - %% ... see if the top directory realyy is empty. - ?match({ok,[],_}, 'CosFileTransfer_Directory':list(Dir1, 1000)), - - ?match(ok, 'CosFileTransfer_FileTransferSession':delete(FS, Dir1)), - %% Test if the top directory been removed as intended. - ?match({'EXCEPTION', {'CosFileTransfer_FileNotFoundException', _, _}}, - 'CosFileTransfer_FileTransferSession':get_file(FS, TEST_DIR_LEVEL1)), - - ?match(false, corba_object:non_existent(FS)), - ?match(ok, 'CosFileTransfer_FileTransferSession':logout(FS)), - %% To make sure Orber can remove it from mnesia. - timer:sleep(1000), - ?match(true, corba_object:non_existent(FS)), - ?match(ok, remote_apply(Node, ?MODULE, uninstall_data, [Name])), - stop_orber_remote(Node, normal), - ok - end. - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- -ftp_host(Config) -> - case ?config(ftp_remote_host, Config) of - undefined -> - {skipped, "The configuration parameter 'ftp_remote_host' not defined."}; - Host -> - Host - end. - -loop_files([]) -> - io:format("@@@ DONE @@@~n", []); -loop_files([#'CosFileTransfer_FileWrapper'{the_file = H}|T]) -> - FullName = 'CosFileTransfer_File':'_get_complete_file_name'(H), - Name = 'CosFileTransfer_File':'_get_name'(H), - io:format("FULL NAME: ~p SHORT NAME: ~p~n", [FullName, Name]), - loop_files(T). - - -create_file_on_source_node('FTP', _Config, Host, FileName, Path, Data) -> - io:format("<<<<<< CosFileTransfer Testing File >>>>>>~n",[]), - io:format("Host: ~p~nPath: ~p~nFile: ~p~n", [Host, Path, FileName]), - {ok, Pid} = ?match({ok, _}, inets:start(ftpc, [{host, Host}], stand_alone)), - ?match(ok, ftp:user(Pid, ?FTP_USER, ?FTP_PASS)), - ?match(ok, ftp:cd(Pid, Path)), - ?match(ok, ftp:send_bin(Pid, list_to_binary(Data), FileName)), - ?match(ok, inets:stop(ftpc, Pid)); -create_file_on_source_node({'NATIVE', _}, _Config, Host, FileName, Path, Data) -> - io:format("<<<<<< CosFileTransfer Testing File >>>>>>~n",[]), - io:format("Host: ~p~nPath: ~p~nFile: ~p~n", [Host, Path, FileName]), - ?match(ok, file:write_file(FileName, list_to_binary(Data))). - -create_name(Type) -> - Time = erlang:system_time(), - Unique = erlang:unique_integer([positive]), - lists:concat([Type, '_', Time, '_', Unique]). - - - - -%%------------------------------------------------------------ -%% function : create_node/4 -%% Arguments: Name - the name of the new node (atom()) -%% Port - which iiop_port (integer()) -%% Domain - which domain. -%% Type - if /4 used the types defines the extra arguments -%% to be used. -%% Returns : {ok, Node} | {error, _} -%% Effect : Starts a new slave-node with given (optinally) -%% extra arguments. If fails it retries 'Retries' times. -%%------------------------------------------------------------ -create_node(Name, Port, normal) -> - Args = basic_args(Name), - create_node(Name, Port, 10, normal, Args, []); -create_node(Name, {Port, _Depth}, ssl) -> - Dir = filename:join([code:lib_dir(ssl), "examples", "certs", "etc"]), - Args = basic_args(Name), - {ok, Node} = create_node(list_to_atom(Name), Port, 10, ssl, Args, []), - %% Client - rpc:call(Node, application, set_env, [cosFileTransfer, ssl_client_certfile, - filename:join([Dir, "client", "cert.pem"])]), - rpc:call(Node, application, set_env, [cosFileTransfer, ssl_client_cacertfile, - filename:join([Dir, "client", "cacerts.pem"])]), - rpc:call(Node, application, set_env, [cosFileTransfer, ssl_client_keyfile, - filename:join([Dir, "client", "key.pem"])]), - rpc:call(Node, application, set_env, [cosFileTransfer, ssl_client_verify, 1]), - rpc:call(Node, application, set_env, [cosFileTransfer, ssl_client_depth, 0]), - - %% Server - rpc:call(Node, application, set_env, [cosFileTransfer, ssl_server_certfile, - filename:join([Dir, "server", "cert.pem"])]), - rpc:call(Node, application, set_env, [cosFileTransfer, ssl_server_cacertfile, - filename:join([Dir, "server", "cacerts.pem"])]), - rpc:call(Node, application, set_env, [cosFileTransfer, ssl_server_keyfile, - filename:join([Dir, "server", "key.pem"])]), - rpc:call(Node, application, set_env, [cosFileTransfer, ssl_server_verify, 1]), - rpc:call(Node, application, set_env, [cosFileTransfer, ssl_server_depth, 0]), - {ok, Node}. - -%create_node(Name, {Port, Depth}, ssl) -> -% TestLibs = filename:join(filename:dirname(code:which(?MODULE)), "ssl_data"), -% Args = basic_args(Name), -% SArgs = basic_ssl_args(TestLibs, Args), -% LArgs = level_based_ssl(Depth, TestLibs, SArgs), -% create_node(list_to_atom(Name), Port, 10, ssl, LArgs, [{sslpath, TestLibs}]). - -create_node(Name, Port, Retries, Type, Args, Options) -> - [_, Host] = ?match([_,_],string:tokens(atom_to_list(node()), [$@])), - case starter(Host, Name, Args) of - {ok, NewNode} -> - ?match(pong, net_adm:ping(NewNode)), - {ok, Cwd} = file:get_cwd(), - Path = code:get_path(), - ?match(ok, rpc:call(NewNode, file, set_cwd, [Cwd])), - true = rpc:call(NewNode, code, set_path, [Path]), - ?match(ok, start_orber_remote(NewNode, Type, Options, Port)), - spawn_link(NewNode, ?MODULE, slave_sup, []), - rpc:multicall([node() | nodes()], global, sync, []), - {ok, NewNode}; - {error, Reason} when Retries == 0-> - {error, Reason}; - {error, Reason} -> - io:format("Could not start slavenode ~p ~p retrying~n", - [{Host, Name, Args}, Reason]), - timer:sleep(500), - create_node(Name, Port, Retries - 1, Type, Args, Options) - end. - -starter(Host, Name, Args) -> - slave:start(Host, Name, Args). - -slave_sup() -> - process_flag(trap_exit, true), - receive - {'EXIT', _, _} -> - ignore - end. - - -%%------------------------------------------------------------ -%% function : destroy_node -%% Arguments: Node - which node to destroy. -%% Type - normal | ssl -%% Returns : -%% Effect : -%%------------------------------------------------------------ --ifdef(false). -destroy_node(Node, Type) -> - stopper(Node, Type). - -stopper(Node, Type) -> - catch stop_orber_remote(Node, Type), - slave:stop(Node). --endif. - -%%------------------------------------------------------------ -%% function : remote_apply -%% Arguments: N - Node, M - Module, -%% F - Function, A - Arguments (list) -%% Returns : -%% Effect : -%%------------------------------------------------------------ -remote_apply(N, M,F,A) -> - case rpc:call(N, M, F, A) of - {badrpc, Reason} -> - exit(Reason); - Other -> - Other - end. - -%%------------------------------------------------------------ -%% function : stop_orber_remote -%% Arguments: Node - which node to stop orber on. -%% Type - normal | ssl | light | ....... -%% Returns : ok -%% Effect : Stops orber on given node and, if specified, -%% other applications or programs. -%%------------------------------------------------------------ -stop_orber_remote(Node, ssl) -> - rpc:call(Node, ssl, stop, []), - rpc:call(Node, crypto, stop, []), - orb_rpc_blast(Node, ssl); -stop_orber_remote(Node, Type) -> - orb_rpc_blast(Node, Type). - -orb_rpc_blast(Node, _) -> - rpc:call(Node, cosFileTransferApp, stop, []), - rpc:call(Node, cosProperty, stop, []), - rpc:call(Node, cosFileTransferApp, uninstall, []), - rpc:call(Node, cosProperty, uninstall, []), - rpc:call(Node, orber, jump_stop, []). - -%%------------------------------------------------------------ -%% function : start_orber_remote -%% Arguments: Node - which node to start orber on. -%% Type - normal | ssl | light | ....... -%% Returns : ok -%% Effect : Starts orber on given node and, if specified, -%% other applications or programs. -%%------------------------------------------------------------ -start_orber_remote(Node, ssl, _Options, Port) -> - rpc:call(Node, ssl, start, []), - rpc:call(Node, crypto, start, []), - rpc:call(Node, ssl, seed, ["testing"]), - orb_rpc_setup(Node, ssl, Port); -start_orber_remote(Node, Type, _, Port) -> - orb_rpc_setup(Node, Type, Port). - -orb_rpc_setup(Node, _, Port) -> - rpc:call(Node, orber, jump_start, [Port]), - rpc:call(Node, cosProperty, install, []), - rpc:call(Node, cosProperty, start, []), - rpc:call(Node, cosFileTransferApp, install, []). - -%%--------------- MISC FUNCTIONS ----------------------------- -basic_args(_Name) -> - TestLibs = filename:dirname(code:which(?MODULE)), - " -orber orber_debug_level 10" ++ - " -pa " ++ - TestLibs ++ - " -pa " ++ - filename:join(TestLibs, "all_SUITE_data") ++ - " -pa " ++ - filename:dirname(code:which(cosFileTransferApp)). - --ifdef(false). -basic_ssl_args(TestLibs, Args) -> -% Args ++ -% " -cosFileTransfer ssl_client_certfile \\\"" ++ -% filename:join(TestLibs, "ssl_client_cert.pem") ++ -% "\\\" -cosFileTransfer ssl_server_certfile \\\""++ -% filename:join(TestLibs, "ssl_server_cert.pem")++"\\\"". - - io:format("<<<<<< SSL LIBS ~p >>>>>>~n",[TestLibs]), - NewArgs = Args ++ - " -cosFileTransfer ssl_client_certfile \\\"" ++ - filename:join(TestLibs, "ssl_client_cert.pem") ++ - "\\\" -cosFileTransfer ssl_server_certfile \\\""++ - filename:join(TestLibs, "ssl_server_cert.pem")++"\\\"", - io:format("<<<<<< SSL LIBS ARGS ~p >>>>>>~n",[NewArgs]), - NewArgs. - -level_based_ssl(1, _TestLibs, Args) -> - Args; -level_based_ssl(2, _TestLibs, Args) -> - Args.% ++ -% " -cosFileTransfer ssl_server_depth 2 " ++ -% " -cosFileTransfer ssl_client_depth 2 " ++ -% " -cosFileTransfer ssl_server_verify " ++ -% " -cosFileTransfer ssl_client_verify " ++ -% " -cosFileTransfer ssl_server_cacertfile " ++ -% " -cosFileTransfer ssl_client_cacertfile " ++ - --endif. - -install_data(Protocol, {WhichType, Host, Name}) -> - io:format("<<<<<< Starting ~p/~p VFS at ~p/~p>>>>>>~n", - [Protocol, WhichType, Host, Name]), - %% Create a Virtual File System. - VFS = ?match({_,_,_,_,_,_}, - cosFileTransferApp:create_VFS(WhichType, [], Host, ?FTP_PORT, - [{protocol, Protocol}])), - NS = corba:resolve_initial_references("NameService"), - NC1 = lname_component:set_id(lname_component:create(), Name), - N = lname:insert_component(lname:create(), 1, NC1), - 'CosNaming_NamingContext':rebind(NS, N, VFS). - -uninstall_data(Name) -> - VFS = ?match({_,_,_,_,_,_}, - corba:string_to_object("corbaname:rir:/NameService#"++Name)), - ?match(ok, corba:dispose(VFS)), - ok. - - - -%%------------------- EOF MODULE----------------------------------- diff --git a/lib/cosFileTransfer/vsn.mk b/lib/cosFileTransfer/vsn.mk deleted file mode 100644 index 561f11fbb2..0000000000 --- a/lib/cosFileTransfer/vsn.mk +++ /dev/null @@ -1 +0,0 @@ -COSFILETRANSFER_VSN = 1.2.2 diff --git a/lib/cosNotification/AUTHORS b/lib/cosNotification/AUTHORS deleted file mode 100644 index 55d8059989..0000000000 --- a/lib/cosNotification/AUTHORS +++ /dev/null @@ -1,4 +0,0 @@ -Original Authors: -Niclas Eklund - -Contributors: diff --git a/lib/cosNotification/Makefile b/lib/cosNotification/Makefile deleted file mode 100644 index 0408417a3b..0000000000 --- a/lib/cosNotification/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include vsn.mk -VSN=$(COSNOTIFICATION_VSN) - -# ---------------------------------------------------- -# Common Macros -# ---------------------------------------------------- -# SUB_DIRECTORIES = src test examples doc/src -# At the moment we don't have any example programs. -SUB_DIRECTORIES = src doc/src - -SPECIAL_TARGETS = - -# ---------------------------------------------------- -# Default Subdir Targets -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_subdir.mk diff --git a/lib/cosNotification/doc/html/.gitignore b/lib/cosNotification/doc/html/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosNotification/doc/man3/.gitignore b/lib/cosNotification/doc/man3/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosNotification/doc/man6/.gitignore b/lib/cosNotification/doc/man6/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosNotification/doc/pdf/.gitignore b/lib/cosNotification/doc/pdf/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosNotification/doc/src/CosNotification.xml b/lib/cosNotification/doc/src/CosNotification.xml deleted file mode 100644 index 6aac312d5e..0000000000 --- a/lib/cosNotification/doc/src/CosNotification.xml +++ /dev/null @@ -1,235 +0,0 @@ - - - - -
- - 2002 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotification - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 2002-02-05 - PA1 -
- CosNotification - This module export functions which return QoS and Admin Properties constants. - -

To get access to all definitions include necessary hrl files by using:

--include_lib("cosNotification/include/*.hrl").

-
- - - 'EventReliability'() -> string() - Return the EventReliability QoS identifier - -

This function returns the EventReliability QoS identifier

-
-
- - 'BestEffort'() -> short() - Return the BestEffort QoS value - -

This function returns the BestEffort QoS value.

-
-
- - 'Persistent'() -> short() - Return the Persistent QoS value - -

This function returns the Persistent QoS value.

-
-
- - 'ConnectionReliability'() -> string() - Return the ConnectionReliability QoS identifier - -

This function returns the ConnectionReliability QoS identifier.

-
-
- - 'Priority'() -> string() - Return the Priority QoS identifier - -

This function returns the Priority QoS identifier.

-
-
- - 'LowestPriority'() -> short() - Return the LowestPriority QoS value - -

This function returns the LowestPriority QoS value.

-
-
- - 'HighestPriority'() -> short() - Return the HighestPriority QoS value - -

This function returns the HighestPriority QoS value.

-
-
- - 'DefaultPriority'() -> short() - Return the DefaultPriority QoS value - -

This function returns the DefaultPriority QoS value.

-
-
- - 'StartTime'() -> string() - Return the StartTime QoS identifier - -

This function returns the StartTime QoS identifier.

-
-
- - 'StopTime'() -> string() - Return the StopTime QoS identifier - -

This function returns the StopTime QoS identifier.

-
-
- - 'Timeout'() -> string() - Return the Timeout QoS identifier - -

This function returns the Timeout QoS identifier.

-
-
- - 'OrderPolicy'() -> string() - Return the OrderPolicy QoS identifier - -

This function returns the OrderPolicy QoS identifier.

-
-
- - 'AnyOrder'() -> short() - Return the AnyOrder QoS value - -

This function returns the AnyOrder QoS value.

-
-
- - 'FifoOrder'() -> short() - Return the FifoOrder QoS value - -

This function returns the FifoOrder QoS value.

-
-
- - 'PriorityOrder'() -> short() - Return the PriorityOrder QoS value - -

This function returns the PriorityOrder QoS value.

-
-
- - 'DeadlineOrder'() -> short() - Return the DeadlineOrder QoS value - -

This function returns the DeadlineOrder QoS value.

-
-
- - 'DiscardPolicy'() -> string() - Return the DiscardPolicy QoS identifier - -

This function returns the DiscardPolicy QoS identifier.

-
-
- - 'LifoOrder'() -> short() - Return the LifoOrder QoS value - -

This function returns the LifoOrder QoS value.

-
-
- - 'RejectNewEvents'() -> short() - Return the RejectNewEvents QoS value - -

This function returns the RejectNewEvents QoS value.

-
-
- - 'MaximumBatchSize'() -> string() - Return the MaximumBatchSize QoS identifier - -

This function returns the MaximumBatchSize QoS identifier.

-
-
- - 'PacingInterval'() -> string() - Return the PacingInterval QoS identifier - -

This function returns the PacingInterval QoS identifier.

-
-
- - 'StartTimeSupported'() -> string() - Return the StartTimeSupported QoS identifier - -

This function returns the StartTimeSupported QoS identifier.

-
-
- - 'StopTimeSupported'() -> string() - Return the StopTimeSupported QoS identifier - -

This function returns the StopTimeSupported QoS identifier.

-
-
- - 'MaxEventsPerConsumer'() -> string() - Return the MaxEventsPerConsumer QoS identifier - -

This function returns the MaxEventsPerConsumer QoS identifier.

-
-
- - 'MaxQueueLength'() -> string() - Return the MaxQueueLength Admin identifier - -

This function returns the MaxQueueLength Admin identifier.

-
-
- - 'MaxConsumers'() -> string() - Return the MaxConsumers Admin identifier - -

This function returns the MaxConsumers Admin identifier.

-
-
- - 'MaxSuppliers'() -> string() - Return the MaxSuppliers Admin identifier - -

This function returns the MaxSuppliers Admin identifier.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotification_AdminPropertiesAdmin.xml b/lib/cosNotification/doc/src/CosNotification_AdminPropertiesAdmin.xml deleted file mode 100644 index 6086402f1a..0000000000 --- a/lib/cosNotification/doc/src/CosNotification_AdminPropertiesAdmin.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotification_AdminPropertiesAdmin - - - - Niclas Eklund - - 2000-02-01 - 1.0 -
- CosNotification_AdminPropertiesAdmin - This module implements the OMG CosNotification::AdminPropertiesAdmin interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

All objects, which inherit this interface, export functions described in this module.

-
- - - get_admin(Object) -> AdminProperties - Return a list of AdminPropertiesassociated with the target object - - Object = #objref - AdminProperties = [AdminProperty] - AdminProperty = #'CosNotification_Property'{name, value} - name = string() - value = #any - - -

This operation returns sequence of name-value pairs which encapsulates the - current administrative properties of the target object.

-
-
- - set_admin(Object, AdminProperties) -> Reply - Update the AdminPropertiesfor the target object - - Object = #objref - AdminProperties = [AdminProperty] - AdminProperty = #'CosNotification_Property'{name, value} - name = string() - value = #any - Reply = ok | {'EXCEPTION', CosNotification_UnsupportedAdmin} - - -

As input, this operation accepts a sequence of name-value pairs encapsulating the - desired administrative settings for the target object. If it is not possible to - set the given properties the exception UnsupportedAdmin will be raised.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotification_QoSAdmin.xml b/lib/cosNotification/doc/src/CosNotification_QoSAdmin.xml deleted file mode 100644 index 7774652e60..0000000000 --- a/lib/cosNotification/doc/src/CosNotification_QoSAdmin.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosNotification_QoSAdmin - - - - 2000-02-01 - 1.0 -
- CosNotification_QoSAdmin - This module implements the OMG CosNotification::QoSAdmin interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

All objects, which inherit this interface, export functions described in this module.

-
- - - get_qos(Object) -> Reply - Return a list of name-value pairs which encapsulates the current QoS settings for the target object - - Object = #objref - Reply = [QoSProperty] - QoSProperty = #'CosNotification_Property'{name, value} - name = string() - value = #any - - -

This operation returns a list of name-value pairs which encapsulates the current QoS settings - for the target object.

-
-
- - set_qos(Object, QoS) -> Reply - Change the QoS settings for the target object - - Object = #objref - QoS = [QoSProperty] - QoSProperty = #'CosNotification_Property'{name, value} - name = string() - value = #any - Reply = ok | {'EXCEPTION', #'CosNotification_UnsupportedQoS'{qos_err}} - qos_err = PropertyErrorSeq - PropertyErrorSeq = [PropertyError] - PropertyError = #'CosNotification_PropertyError'{code, name, available_range} - code = 'UNSUPPORTED_PROPERTY' | 'UNAVAILABLE_PROPERTY' | 'UNSUPPORTED_VALUE' | 'UNAVAILABLE_VALUE' | 'BAD_PROPERTY' | 'BAD_TYPE' | 'BAD_VALUE' - name = string() - available_range = PropertyRange - PropertyRange = #CosNotification_PropertyRange{low_val, high_val} - low_val = high_val = #any - - -

To alter the current QoS settings for the target object this function must be used. - If it is not possible to set the requested QoS the UnsupportedQoS - exception is raised, which includes a sequence of PropertyError's - describing which QoS, possible range and why is not allowed.

-
-
- - validate_qos(Object, QoS) -> Reply - Validate if the supplied QoS properties is valid for the target object - - Object = #objref - QoS = [QoSProperty] - QoSProperty = #'Property'{name, value} - name = string() - value = #any - Reply = {ok, NamedPropertyRangeSeq} | {'EXCEPTION', CosNotification_UnsupportedQoS{}} - NamedPropertyRangeSeq = [NamedPropertyRange] - NamedPropertyRange = #CosNotification_NamedPropertyRange{name, range} - name = string() - range = #CosNotification_PropertyRange{low_val, high_val} - low_val = #any - high_val = #any - - -

The purpose of this operations is to check if a QoS setting is supported - by the target object and if so, the operation returns additional properties - which could be optionally added as well.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ConsumerAdmin.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ConsumerAdmin.xml deleted file mode 100644 index cbe22ce7cd..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ConsumerAdmin.xml +++ /dev/null @@ -1,242 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_ConsumerAdmin - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_ConsumerAdmin - This module implements the OMG CosNotifyChannelAdmin::ConsumerAdmin interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotification_QoSAdmin

-
- -

CosNotifyComm_NotifySubscribe

-
- -

CosNotifyFilter_FilterAdmin

-
-
-
- - - _get_MyID(ConsumerAdmin) -> AdminID - Return the target object's Id - - ConsumerAdmin = #objref - AdminID = long() - - -

The ID returned by the creating channel is equal to the value encapsulated by - this readonly attribute.

-
-
- - _get_MyChannel(ConsumerAdmin) -> Channel - Return the ancestor channel - - ConsumerAdmin = #objref - Channel = #objref - - -

The creating channel's reference is maintained by this readonly attribute.

-
-
- - _get_MyOperator(ConsumerAdmin) -> OpType - Return the filtering schema used by the target object - - ConsumerAdmin = #objref - OpType = 'AND_OP' | 'OR_OP' - - -

When ConsumerAdmin's are created an operation type, - i.e., 'AND_OP' or 'OR_OP', is supplied, which determines - the semantics used by the target object concerning evaluation against - any associated Filter objects.

-
-
- - _get_priority_filter(ConsumerAdmin) -> MappingFilter - Return the associated priority MappingFilter - - ConsumerAdmin = MappingFilter = #objref - - -

If set, this operation returns the associated priority MappingFilter, otherwise - a NIL object reference is returned.

-
-
- - _set_priority_filter(ConsumerAdmin, MappingFilter) -> ok - Set the priority MappingFilter - - ConsumerAdmin = MappingFilter = #objref - - -

To associate a priority MappingFilter with the target object this operation - must be used.

-
-
- - _get_lifetime_filter(ConsumerAdmin) -> MappingFilter - Return the associated lifetime MappingFilter - - ConsumerAdmin = MappingFilter = #objref - - -

Unless a lifetime MappingFilter have been associated with the target object - a NIL object reference is returned by this operation.

-
-
- - _set_lifetime_filter(ConsumerAdmin, MappingFilter) -> ok - Set the lifetime MappingFilter - - ConsumerAdmin = MappingFilter = #objref - - -

This operation associate a lifetime MappingFilter with the target object.

-
-
- - _get_pull_suppliers(ConsumerAdmin) -> ProxyIDSeq - Return a list of all associated pull supplier Id:s - - ConsumerAdmin = #objref - ProxyIDSeq = [ProxyID] - ProxyID = long() - - -

This readonly attribute maintains the Id's for all PullProxies created - by the target object and still alive.

-
-
- - _get_push_suppliers(ConsumerAdmin) -> ProxyIDSeq - Return a list of all associated push supplier Id:s - - ConsumerAdmin = #objref - ProxyIDSeq = [ProxyID] - ProxyID = long() - - -

This attribute is similar to the _get_pull_suppliers attribute but maintains - the Id's for all PushProxies created by the target object and still alive.

-
-
- - get_proxy_supplier(ConsumerAdmin, ProxyID) -> Reply - Return the proxy supplier with matching Id - - ConsumerAdmin = #objref - ProxyID = long() - Reply = Proxy | {'EXCEPTION', #'CosNotifyChannelAdmin_ProxyNotFound'{}} - Proxy = #objref - - -

If a proxy with the given Id exists the reference to the object is returned, but if - the object have terminated, or an incorrect Id is supplied, an exception is raised.

-
-
- - obtain_notification_pull_supplier(ConsumerAdmin, ConsumerType) -> Reply - Create a supplier proxy - - ConsumerAdmin = #objref - ConsumerType = 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' - Reply = {Proxy, ProxyID} - Proxy = #objref - ProxyID = long() - - -

Determined by the parameter ConsumerType, a proxy which will - accept events of the defined type is created. Along with the object reference an - Id is returned.

-
-
- - obtain_pull_supplier(ConsumerAdmin) -> Proxy - Create a supplier proxy - - ConsumerAdmin = #objref - Proxy = #objref - - -

This operation creates a new proxy which accepts #any{} events.

-
-
- - obtain_notification_push_supplier(ConsumerAdmin, ConsumerType) -> Reply - Create a supplier proxy - - ConsumerAdmin = #objref - ConsumerType = 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' - Reply = {Proxy, ProxyID} - Proxy = #objref - ProxyID = long() - - -

A proxy which accepts events of the type described by the parameter ConsumerType - is created by this operation. A unique Id is returned as an out parameter.

-
-
- - obtain_push_supplier(ConsumerAdmin) -> Proxy - Create a supplier proxy - - ConsumerAdmin = #objref - Proxy = #objref - - -

The object created by this function is a proxy which accepts #any{} events.

-
-
- - destroy(ConsumerAdmin) -> ok - Terminate the target object and all its children - - ConsumerAdmin = #objref - - -

To terminate the target object this operation should be used. The associated - Channel will be notified.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_EventChannel.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_EventChannel.xml deleted file mode 100644 index 7696e6a26c..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_EventChannel.xml +++ /dev/null @@ -1,226 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosNotifyChannelAdmin_EventChannel - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_EventChannel - This module implements the OMG CosNotifyChannelAdmin::EventChannel interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotification_QoSAdmin

-
- -

CosNotification_AdminPropertiesAdmin

-
-
-
- - - _get_MyFactory(Channel) -> ChannelFactory - Return the factory object which created the target object - - Channel = #objref - ChannelFactory = #objref - - -

This readonly attribute maintains the reference of the event channel - factory that created the target channel.

-
-
- - _get_default_consumer_admin(Channel) -> ConsumerAdmin - Return the default consumer admin associated with the target object - - Channel = #objref - ConsumerAdmin = #objref - - -

This is a readonly attribute which maintains a reference to a default - ConsumerAdmin object associated with the target object.

-
-
- - _get_default_supplier_admin(Channel) -> SupplierAdmin - Return the default supplier admin associated with the target object - - Channel = #objref - SupplierAdmin = #objref - - -

This is a readonly attribute which maintains a reference to a default - SupplierAdmin object associated with the target object.

-
-
- - _get_default_filter_factory(Channel) -> FilterFactory - Return the default filter factory associated with the target object - - Channel = #objref - FilterFactory = #objref - - -

The default FilterFactory associated with the target channel - is maintained by this readonly attribute.

-
-
- - new_for_consumers(Channel, OpType) -> Return - Create a new ConsumerAdminobject - - Channel = #objref - OpType = 'AND_OP' | 'OR_OP' - Return = {ConsumerAdmin, AdminID} - ConsumerAdmin = #objref - AdminID = long() - - -

This operation creates a new instance of a ConsumerAdmin and supplies - an Id which may be used when invoking other operations exported by this module. - The returned object will inherit the Quality of Service properties of the - target channel.

-
-
- - for_consumers(Channel) -> ConsumerAdmin - Create a new ConsumerAdminobject - - Channel = #objref - ConsumerAdmin = #objref - - -

A new new instance of a ConsumerAdmin object is created but no - Id is returned. The returned object's operation type, i.e., 'AND_OP' or 'OR_OP', - will be set to the value of the configuration parameter filterOp. - The target object's Quality of Service properties will be inherited by the - returned ConsumerAdmin.

-
-
- - new_for_suppliers(Channel, OpType) -> Return - Create a new SupplierAdminobject - - Channel = #objref - OpType = 'AND_OP' | 'OR_OP' - Return = {SupplierAdmin, AdminID} - SupplierAdmin = #objref - AdminID = long() - - -

Enables us to create a new instance of a SupplierAdmin. An Id, which - may be used when invoking other operations exported by this module, is also - returned. The current Quality of Service settings associated with the target - object will be inherited by the SupplierAdmin.

-
-
- - for_suppliers(Channel) -> SupplierAdmin - Create a new SupplierAdminobject - - Channel = #objref - SupplierAdmin = #objref - - -

To create a new SupplierAdmin with the target object's current - Quality of Service settings we can use this function. The returned object's - operation type ('AND_OP' or 'OR_OP') will be determined by the - configuration variable filterOp.

-
-
- - get_consumeradmin(Channel, AdminID) -> ConsumerAdmin - Return the ConsumerAdminmatching AdminID - - Channel = #objref - AdminID = long() - ConsumerAdmin = #objref | {'EXCEPTION', #'CosNotifyChannelAdmin_AdminNotFound'{}} - - -

If the given Id is associated with a ConsumerAdmin the object reference - is returned. If such association never existed or the ConsumerAdmin - have terminated an exception is raised.

-
-
- - get_supplieradmin(Channel, AdminID) -> SupplierAdmin - Return the SupplierAdminmatching AdminID - - Channel = #objref - AdminID = long() - SupplierAdmin = #objref | {'EXCEPTION', #'CosNotifyChannelAdmin_AdminNotFound'{}} - - -

Equal to the operation get_consumeradmin/2 but a reference to - a SupplierAdmin is returned.

-
-
- - get_all_consumeradmins(Channel) -> Reply - Return a list of all ConsumerAdmins, currently active, Id:s - - Channel = #objref - Reply = [AdminID] - AdminID = long() - - -

To get access to all ConsumerAdmin Id's created by the target object, and still - alive, this operation could be invoked.

-
-
- - get_all_supplieradmins(Channel) -> Reply - Return a list of all SupplierAdmins, currently active, Id:s - - Channel = #objref - Reply = [AdminID] - AdminID = long() - - -

Equal to the operation get_all_consumeradmins/1 but returns - a list of all SupplierAdmin object ID's.

-
-
- - destroy(Channel) -> ok - Terminate the channel and all its children - - Channel = #objref - - -

The destroy operation will terminate the target channel and - all associated Admin objects.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_EventChannelFactory.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_EventChannelFactory.xml deleted file mode 100644 index 552ea182c0..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_EventChannelFactory.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosNotifyChannelAdmin_EventChannelFactory - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_EventChannelFactory - This module implements the OMG CosNotifyChannelAdmin::EventChannelFactory interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-
- - - create_channel(ChannelFactory, InitialQoS, InitialAdmin) -> Return - Create a new channel - - ChannelFactory = #objref - InitialQoS = CosNotification::QoSProperties - InitialAdmin = CosNotification::AdminProperties - Return = {EventChannel, ChannelID} - EventChannel = #objref - ChannelID = long() - - -

This operation creates a new event channel. Along with the channel - reference an id is returned which can be used when invoking other - operations exported by this module. The Quality of Service argument - supplied will be inherited by objects created by the channel. For more - information about QoS settings see the User's Guide.

-

If no QoS- and/or Admin-properties are supplied (i.e. empty list), - the default settings will be used. For more information, see the - User's Guide.

-
-
- - get_all_channels(ChannelFactory) -> ChannelIDSeq - Return all Id:s for channels, currently alive, created by the target object - - ChannelFactory = #objref - ChannelIDSeq = [long()] - - -

This operation returns a id sequence of all channel's created by this ChannelFactory.

-
-
- - get_event_channel(ChannelFactory, ChannelID) -> Return - Return the channel object associated with the given Id - - ChannelFactory = #objref - ChannelID = long() - Retrurn = EventChannel | {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}} - EventChannel = #objref - - -

This operation returns the EventChannel associated with the given id. If no channel is - associated with the id, i.e., never existed or have been terminated, an exception is raised.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyConsumer.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyConsumer.xml deleted file mode 100644 index 3d61893162..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyConsumer.xml +++ /dev/null @@ -1,128 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_ProxyConsumer - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_ProxyConsumer - This module implements the OMG CosNotifyChannelAdmin::ProxyConsumer interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
-
-
- - - _get_MyType(ProxyConsumer) -> ProxyType - Return the proxy type - - ProxyConsumer = #objref - ProxyType = 'PUSH_ANY' | 'PULL_ANY' | 'PUSH_STRUCTURED' | 'PULL_STRUCTURED' | 'PUSH_SEQUENCE' | 'PULL_SEQUENCE' - - -

This readonly attribute maintains the enumerant describing the which type the target object - is.

-
-
- - _get_MyAdmin(ProxyConsumer) -> AdminObject - return the associated Adminobject - - ProxyConsumer = AdminObject = #objref - - -

This readonly attribute maintains the admin's reference which created the target object.

-
-
- - obtain_subscription_types(ProxyConsumer, ObtainInfoMode) -> EventTypeSeq - Administer subscription types - - ProxyConsumer = #objref - ObtainInfoMode = 'ALL_NOW_UPDATES_OFF' | 'ALL_NOW_UPDATES_ON' | 'NONE_NOW_UPDATES_OFF' | 'NONE_NOW_UPDATES_ON' - EventTypeSeq = [EventType] - EventType = #'CosNotification_EventType'{domain_name, type_name} - domain_name = type_name = string() - - -

Depending on the input parameter ObtainInfoMode, this operation may return a - sequence of the EventTypes the target object is interested in receiving. - If 'ALL_NOW_UPDATES_OFF' or 'ALL_NOW_UPDATES_ON' is given a sequence will - be returned, otherwise not. If 'ALL_NOW_UPDATES_OFF' or 'NONE_NOW_UPDATES_OFF' - are issued the target object will not inform the associated NotifySubscribe object - when an update occurs. 'ALL_NOW_UPDATES_ON' or 'NONE_NOW_UPDATES_ON' will - result in that update information will be sent.

-
-
- - validate_event_qos(ProxyConsumer, QoSProperties) -> Reply - Check if certain Quality of Service properties can be added to events in the current context of the target object - - ProxyConsumer = #objref - QoSProperties = [QoSProperty] - QoSProperty = #'CosNotification_Property'{name, value} - name = string() - value = #any - Reply = {ok, NamedPropertyRangeSeq} | {'EXCEPTION', CosNotification_UnsupportedQoS{qos_err}} - NamedPropertyRangeSeq = [NamedPropertyRange] - NamedPropertyRange = #CosNotification_NamedPropertyRange{name, range} - name = string() - range = #CosNotification_PropertyRange{low_val, high_val} - low_val = #any - high_val = #any - qos_err = PropertyErrorSeq - PropertyErrorSeq = [PropertyError] - PropertyError = #'CosNotification_PropertyError'{code, name, available_range} - code = 'UNSUPPORTED_PROPERTY' | 'UNAVAILABLE_PROPERTY' | 'UNSUPPORTED_VALUE' | 'UNAVAILABLE_VALUE' | 'BAD_PROPERTY' | 'BAD_TYPE' | 'BAD_VALUE' - name = string() - available_range = PropertyRange - PropertyRange = #CosNotification_PropertyRange{low_val, high_val} - low_val = high_val = #any - - -

To check if certain Quality of Service properties can be added to events in - the current context of the target object this operation should be used. If we - cannot support the required settings an exception describing why will be raised.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPullConsumer.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPullConsumer.xml deleted file mode 100644 index caf572dee8..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPullConsumer.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_ProxyPullConsumer - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_ProxyPullConsumer - This module implements the OMG CosNotifyChannelAdmin::ProxyPullConsumer interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifyPublish

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
- -

CosNotifyChannelAdmin_ProxyConsumer

-
-
-
- - - connect_any_pull_supplier(ProxyPullConsumer, PullSupplier) -> Reply - Connect a supplier to the proxy - - ProxyPullConsumer = #objref - PullSupplier = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} | {'EXCEPTION', #'CosEventChannelAdmin_TypeError'{}} - - -

This operation connects the given PullSupplier to the target object. - If a client is already connected the AlreadyConnected exception - will be raised. The client must support the operations pull and - try_pull, otherwise the TypeError exception is raised.

-
-
- - suspend_connection(ProxyPullConsumer) -> Reply - Suspend the connection between the client and the proxy - - ProxyPullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

If we want to temporarily suspend the connection with the target object this - operation must be sued. If the connection already have been suspended or - no client have been connected an exception is raised.

-
-
- - resume_connection(ProxyPullConsumer) -> Reply - Resume a previously suspended connection with the proxy - - ProxyPullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyActive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

If The connection have been suspended earlier we can invoke this operation to - reinstate the connection. If the connection already is active or no client - have been connected to the target object an exception is raised.

-
-
- - disconnect_pull_consumer(ProxyPullConsumer) -> ok - Close the connection and terminate the proxy - - ProxyPullConsumer = #objref - - -

Invoking this operation disconnects the client from the target object which - then terminates and inform its administrative parent.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPullSupplier.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPullSupplier.xml deleted file mode 100644 index 42aaaec319..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPullSupplier.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_ProxyPullSupplier - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_ProxyPullSupplier - This module implements the OMG CosNotifyChannelAdmin::ProxyPullSupplier interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifySubscribe

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
- -

CosNotifyChannelAdmin_ProxySupplier

-
-
-
- - - connect_any_pull_consumer(ProxyPullSupplier, PullConsumer) -> Reply - Connect a consumer to the proxy - - ProxyPullSupplier = #objref - PullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} - - -

This operation connects the given PullConsumer to the target object. - If a connection already exists the AlreadyConnected exception is - raised.

-
-
- - pull(ProxyPullSupplier) -> Reply - Pull an Any event from the proxy - - ProxyPullSupplier = #objref - Reply = #any | {'EXCEPTION', #'CosEventChannelAdmin_Disconnected'{}} - - -

This operation pulls next #any{} event, and blocks, if the target object - have no events to forward, until an event can be delivered. If no client have - been connected the Disconnected exception is raised.

-
-
- - try_pull(ProxyPullSupplier) -> Reply - Try and pull an Any event from the proxy - - ProxyPullSupplier = #objref - Reply = {#any, HasEvent} | {'EXCEPTION', #'CosEventChannelAdmin_Disconnected'{}} - HasEvent = boolean() - - -

This operation pulls next event, but do not block if the target object - have no event to forward. If no client have - been connected the Disconnected exception is raised.

-
-
- - disconnect_pull_supplier(ProxyPullSupplier) -> ok - Close the connection and terminate the proxy - - ProxyPullSupplier = #objref - - -

Invoking this operation will cause the target object to close the connection and terminate.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPushConsumer.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPushConsumer.xml deleted file mode 100644 index 9808b460c7..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPushConsumer.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_ProxyPushConsumer - - - - Niclas Eklund - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_ProxyPushConsumer - This module implements the OMG CosNotifyChannelAdmin::ProxyPushConsumer interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifyPublish

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
- -

CosNotifyChannelAdmin_ProxyConsumer

-
-
-
- - - connect_any_push_supplier(ProxyPushConsumer, PushSupplier) -> Reply - Connect a supplier to the proxy - - ProxyPushConsumer = #objref - PushSupplier = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} - - -

This operation connects a PushSupplier to the target object. If - a connection already exists the AlreadyConnected exception is raised.

-
-
- - push(ProxyPushConsumer, Event) -> Reply - Push an Any event to the proxy - - ProxyPushConsumer = #objref - Event = #any - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_Disconnected'{}} - - -

This operation pushes an #any{} event to the target object. If no client - have been connected the Disconnected exception is raised.

-
-
- - disconnect_push_consumer(ProxyPushConsumer) -> ok - Close the connection and terminate the proxy - - ProxyPushConsumer = #objref - - -

Invoking this operation will cause the target object to close the connection and - terminate.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPushSupplier.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPushSupplier.xml deleted file mode 100644 index 6f85de114a..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxyPushSupplier.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_ProxyPushSupplier - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_ProxyPushSupplier - This module implements the OMG CosNotifyChannelAdmin::ProxyPushSupplier interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifySubscribe

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmi

-
- -

CosNotifyChannelAdmin_ProxySupplier

-
-
-
- - - connect_any_push_consumer(ProxyPushSupplier, PushConsumer) -> Reply - Connect a consumer to the proxy - - ProxyPushSupplier = #objref - PushConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} | {'EXCEPTION', #'CosEventChannelAdmin_TypeError'{}} - - -

This operation connects a PushConsumer to the target object. If - a connection already exists or the given client does not support - the operation push an exception, AlreadyConnected and - TypeError respectively, is raised.

-
-
- - suspend_connection(ProxyPushSupplier) -> Reply - Suspend the connection between the proxy and the client - - ProxyPushSupplier = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

This operation suspends the connection with the client object. If the connection - already is suspended or no client have been associated an exception is raised.

-
-
- - resume_connection(ProxyPushSupplier) -> Reply - Resume a previously suspended connection with the proxy - - ProxyPullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

If a connection have been suspended earlier, calling this operation will resume the connection. - If the connection already is active or no client have been connected an exception is raised.

-
-
- - disconnect_push_supplier(ProxyPushSupplier) -> ok - Close the connection and terminate the proxy - - ProxyPushSupplier = #objref - - -

This operation cause the target object to close the connection and terminate.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxySupplier.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxySupplier.xml deleted file mode 100644 index 69013fdb1e..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_ProxySupplier.xml +++ /dev/null @@ -1,175 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_ProxySupplier - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_ProxySupplier - This module implements the OMG CosNotifyChannelAdmin::ProxySupplier interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
-
-
- - - _get_MyType(ProxySupplier) -> ProxyType - Return the proxy type - - ProxySupplier = #objref - ProxyType = 'PUSH_ANY' | 'PULL_ANY' | 'PUSH_STRUCTURED' | 'PULL_STRUCTURED' | 'PUSH_SEQUENCE' | 'PULL_SEQUENCE' - - -

This readonly attribute maintains the enumerant describing the which type the target object - is.

-
-
- - _get_MyAdmin(ProxySupplier) -> AdminObject - Return the target object's associated Adminobject - - ProxySupplier = #objref - AdminObject = #objref - - -

This readonly attribute maintains the admin's reference which created the target object.

-
-
- - _get_priority_filter(ProxySupplier) -> MappingFilter - Return the target object's associated priority MappingFilter - - ProxySupplier = #objref - MappingFilter = #objref - - -

This operation returns the associated priority MappingFilter. - If no such object exist a NIL reference is returned.

-
-
- - _set_priority_filter(ProxySupplier, MappingFilter) -> ok - Set the target object's associated priority MappingFilter - - ProxySupplier = #objref - MappingFilter = #objref - - -

This operation associate a new priority MappingFilter with the target object.

-
-
- - _get_lifetime_filter(ProxySupplier) -> MappingFilter - Return the target object's associated lifetime MappingFilter - - ProxySupplier = #objref - MappingFilter = #objref - - -

This operation returns the associated lifetime MappingFilter. - If no such object exist a NIL reference is returned.

-
-
- - _set_lifetime_filter(ProxySupplier, MappingFilter) -> ok - Set the target object's associated lifetime MappingFilter - - ProxySupplier = #objref - MappingFilter = #objref - - -

This operation associate a new lifetime MappingFilter with the target object.

-
-
- - obtain_offered_types(ProxySupplier, ObtainInfoMode) -> EventTypeSeq - Administer the type of events the proxy supplies - - ProxySupplier = #objref - ObtainInfoMode = 'ALL_NOW_UPDATES_OFF' | 'ALL_NOW_UPDATES_ON' | 'NONE_NOW_UPDATES_OFF' | 'NONE_NOW_UPDATES_ON' - EventTypeSeq = [EventType] - EventType = #'CosNotification_EventType'{domain_name, type_name} - domain_name = type_name = string() - - -

Depending on the input parameter ObtainInfoMode, this operation may return a - sequence of the EventTypes the target object is interested in receiving. - If 'ALL_NOW_UPDATES_OFF' or 'ALL_NOW_UPDATES_ON' is given a sequence will - be returned, otherwise not. If 'ALL_NOW_UPDATES_OFF' or 'NONE_NOW_UPDATES_OFF' - are issued the target object will not inform the associated NotifySubscribe object - when an update occurs. 'ALL_NOW_UPDATES_ON' or 'NONE_NOW_UPDATES_ON' will - result in that update information will be sent.

-
-
- - validate_event_qos(ProxySupplier, QoSProperties) -> Reply - Check if the QoS properties can be set - - ProxySupplier = #objref - QoSProperties = [QoSProperty] - QoSProperty = #'CosNotification_Property'{name, value} - name = string() - value = #any - Reply = {ok, NamedPropertyRangeSeq} | {'EXCEPTION', CosNotification_UnsupportedQoS{qos_err}} - NamedPropertyRangeSeq = [NamedPropertyRange] - NamedPropertyRange = #CosNotification_NamedPropertyRange{name, range} - name = string() - range = #CosNotification_PropertyRange{low_val, high_val} - low_val = #any - high_val = #any - qos_err = PropertyErrorSeq - PropertyErrorSeq = [PropertyError] - PropertyError = #'CosNotification_PropertyError'{code, name, available_range} - code = 'UNSUPPORTED_PROPERTY' | 'UNAVAILABLE_PROPERTY' | 'UNSUPPORTED_VALUE' | 'UNAVAILABLE_VALUE' | 'BAD_PROPERTY' | 'BAD_TYPE' | 'BAD_VALUE' - name = string() - available_range = PropertyRange - PropertyRange = #CosNotification_PropertyRange{low_val, high_val} - low_val = high_val = #any - - -

To check if certain Quality of Service properties can be added to events in - the current context of the target object this operation should be used. If we - cannot support the required settings an exception describing why will be raised.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPullConsumer.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPullConsumer.xml deleted file mode 100644 index 043472df55..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPullConsumer.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_SequenceProxyPullConsumer - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_SequenceProxyPullConsumer - This module implements the OMG CosNotifyChannelAdmin::SequenceProxyPullConsumer interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifyPublish

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
- -

CosNotifyChannelAdmin_ProxyConsumer

-
-
-
- - - connect_sequence_pull_supplier(SequenceProxyPullConsumer, PullSupplier) -> Reply - Connect a supplier to the proxy - - SequenceProxyPullConsumer = #objref - PullSupplier = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} | {'EXCEPTION', #'CosEventChannelAdmin_TypeError'{}} - - -

This operation connects a PullSupplier to the target object. If a - connection already exists or the supplied client does not support the functions - pull_structured_events and try_pull_structured_events an exception - is raised.

-
-
- - suspend_connection(SequenceProxyPullConsumer) -> Reply - Suspend the connection with the proxy - - SequenceProxyPullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

If a connection exist, invoking this operation will suspend the connection - until instructed otherwise. Otherwise, no client have been connected or this operation - already have been invoked an exception is raised.

-
-
- - resume_connection(SequenceProxyPullConsumer) -> Reply - Resume a previously suspended connection with the proxy - - SequenceProxyPullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

If an connection have been suspended this operation must be used to resume the - connection. If the connection already is active or no client have been connected an - exception is raised.

-
-
- - disconnect_sequence_pull_consumer(SequenceProxyPullConsumer) -> ok - Close connection and terminate the proxy - - SequenceProxyPullConsumer = #objref - - -

This operation close the connection to the client and terminates the target object.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPullSupplier.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPullSupplier.xml deleted file mode 100644 index a0040a50d7..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPullSupplier.xml +++ /dev/null @@ -1,146 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_SequenceProxyPullSupplier - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_SequenceProxyPullSupplier - This module implements the OMG CosNotifyChannelAdmin::SequenceProxyPullSupplier interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifySubscribe

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
- -

CosNotifyChannelAdmin_ProxySupplier

-
-
-
- - - connect_sequence_pull_consumer(SequenceProxyPullSupplier, PullConsumer) -> Reply - Connect a consumer to the proxy - - SequenceProxyPullSupplier = #objref - PullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} - - -

This operation connects a PullConsumer to the target object. If a connection - already exists an exception is raised.

-
-
- - pull_structured_events(SequenceProxyPullSupplier, MaxEvents) -> Reply - Pull structured events from the proxy - - SequenceProxyPullSupplier = #objref - MaxEvents = long() - Reply = EventBatch | {'EXCEPTION', #'CosEventChannelAdmin_Disconnected'{}} - EventBatch = [StructuredEvent] - StructuredEvent = #'CosNotification_StructuredEvent'{header, filterable_data, remainder_of_body} - header = EventHeader - filterable_data = [#'CosNotification_Property'{name, value}] - name = string() - value = #any - remainder_of_body = #any - EventHeader = #'CosNotification_EventHeader'{fixed_header, variable_header} - fixed_header = FixedEventHeader - variable_header = OptionalHeaderFields - FixedEventHeader = #'CosNotification_FixedEventHeader'{event_type, event_name} - event_type = EventType - event_name = string() - EventType = #'CosNotification_EventType'{domain_name, type_name} - domain_name = type_name = string() - OptionalHeaderFields = [#'CosNotification_Property'{name, value}] - - -

A client use this operation to pull next event sequence of maximum length - MaxEvents. This operation is blocking and will not reply until the - requested amount of events can be delivered or the QoS property PacingInterval - is reached. For more information see the User's Guide.

-
-
- - try_pull_structured_events(SequenceProxyPullSupplier, MaxEvents) -> Reply - Try to pull structured events from the proxy - - SequenceProxyPullSupplier = #objref - MaxEvents = long() - Reply = {EventBatch, HasEvent} | {'EXCEPTION', #'CosEventChannelAdmin_Disconnected'{}} - HasEvent = boolean() - EventBatch = [StructuredEvent] - StructuredEvent = #'CosNotification_StructuredEvent'{header, filterable_data, remainder_of_body} - header = EventHeader - filterable_data = [#'CosNotification_Property'{name, value}] - name = string() - value = #any - remainder_of_body = #any - EventHeader = #'CosNotification_EventHeader'{fixed_header, variable_header} - fixed_header = FixedEventHeader - variable_header = OptionalHeaderFields - FixedEventHeader = #'CosNotification_FixedEventHeader'{event_type, event_name} - event_type = EventType - event_name = string() - EventType = #'CosNotification_EventType'{domain_name, type_name} - domain_name = type_name = string() - OptionalHeaderFields = [#'CosNotification_Property'{name, value}] - - -

This operation pulls an event sequence of the maximum length MaxEvents, - but do not block if the target object have no events to forward. The outparameter, - HasEvent is true if the sequence contain any events.

-
-
- - disconnect_sequence_pull_supplier(SequenceProxyPullSupplier) -> ok - Close the connection and terminate the proxy - - SequenceProxyPullSupplier = #objref - - -

This operation cause the target object to close the connection and terminate.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPushConsumer.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPushConsumer.xml deleted file mode 100644 index efec1f99cc..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPushConsumer.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosNotifyChannelAdmin_SequenceProxyPushConsumer - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_SequenceProxyPushConsumer - This module implements the OMG CosNotifyChannelAdmin::SequenceProxyPushConsumer interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifyPublish

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
- -

CosNotifyChannelAdmin_ProxyConsumer

-
-
-
- - - connect_sequence_push_supplier(SequenceProxyPushConsumer, PushSupplier) -> Reply - Connect a supplier to the proxy - - SequenceProxyPushConsumer = #objref - PushSupplier = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} - - -

This operation connects a PushSupplier to the target object. If a - connection already exists the AlreadyConnected exception is raised.

-
-
- - push_structured_events(SequenceProxyPushConsumer, EventBatch) -> Reply - Push a structured event to the proxy - - SequenceProxyPushConsumer = #objref - EventBatch = [StructuredEvent] - StructuredEvent = #'CosNotification_StructuredEvent'{header, filterable_data, remainder_of_body} - header = EventHeader - filterable_data = [#'CosNotification_Property'{name, value}] - name = string() - value = #any - remainder_of_body = #any - EventHeader = #'CosNotification_EventHeader'{fixed_header, variable_header} - fixed_header = FixedEventHeader - variable_header = OptionalHeaderFields - FixedEventHeader = #'CosNotification_FixedEventHeader'{event_type, event_name} - event_type = EventType - event_name = string() - EventType = #'CosNotification_EventType'{domain_name, type_name} - domain_name = type_name = string() - OptionalHeaderFields = [#'CosNotification_Property'{name, value}] - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_Disconnected'{}} - - -

A client must use this operation when it wishes to push a new sequence of events - to the target object. If no connection exists the Disconnected exception - is raised.

-
-
- - disconnect_sequence_push_consumer(SequenceProxyPushConsumer) -> ok - Close connection and terminate the proxy - - SequenceProxyPushConsumer = #objref - - -

This operation cause the target object to close the connection and terminate.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPushSupplier.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPushSupplier.xml deleted file mode 100644 index 229d3667c5..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SequenceProxyPushSupplier.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_SequenceProxyPushSupplier - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_SequenceProxyPushSupplier - This module implements the OMG CosNotifyChannelAdmin::SequenceProxyPushSupplier interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifySubscribe

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
- -

CosNotifyChannelAdmin_ProxySupplier

-
-
-
- - - connect_sequence_push_consumer(SequenceProxyPushSupplier, PushConsumer) -> Reply - Connect a consumer to the proxy - - SequenceProxyPushSupplier = #objref - PushConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} | {'EXCEPTION', #'CosEventChannelAdmin_TypeError'{}} - - -

This operation connects a PushConsumer to the target object. If a - connection already exists or the function psuh_structured_events - is not supported the exceptions AlreadyConnected or - TypeError will be raised respectively.

-
-
- - suspend_connection(SequenceProxyPushSupplier) -> Reply - Suspend the connection between the client and the target object - - SequenceProxyPushSupplier = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

This operation suspends the connection between the client and the target object. - If no connection exists or the connection is already suspended an exception is raised.

-
-
- - resume_connection(SequenceProxyPushSupplier) -> Reply - Resume a previously suspended connection with the proxy - - SequenceProxyPullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

If the connection have previously been suspended this operation must used - if we want to resume the connection. If no object have been connected or the connection - already is active an exception is raised.

-
-
- - disconnect_sequence_push_supplier(SequenceProxyPushSupplier) -> ok - Close the connection and terminate the proxy - - SequenceProxyPushSupplier = #objref - - -

This operation cause the target object to close the connection and terminate.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPullConsumer.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPullConsumer.xml deleted file mode 100644 index 5a86cb84da..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPullConsumer.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_StructuredProxyPullConsumer - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_StructuredProxyPullConsumer - This module implements the OMG CosNotifyChannelAdmin::StructuredProxyPullConsumer interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifyPublish

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
- -

CosNotifyChannelAdmin_ProxyConsumer

-
-
-
- - - connect_structured_pull_supplier(StructuredProxyPullConsumer, PullSupplier) -> Reply - Connect a supplier to the proxy - - StructuredProxyPullConsumer = #objref - PullSupplier = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} | {'EXCEPTION', #'CosEventChannelAdmin_TypeError'{}} - - -

This operation connects a PullSupplier to the target object. If a connection - already exists or the given client object does not support the functions - pull_structured_event and try_pull_structured_event an exception is raised.

-
-
- - suspend_connection(StructuredProxyPullConsumer) -> Reply - Suspend the connection between the target object and its client - - StructuredProxyPullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

This operation suspends the connection between the target object and its client. - If no connection exists or already suspended an exception is raised.

-
-
- - resume_connection(StructuredProxyPullConsumer) -> Reply - Resume a previously suspended connection with the proxy - - StructuredProxyPullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

If the connection have been suspended this operation must be used if we want - to resume the connection. If the connection already are active or no connection - have been created an exception is raised.

-
-
- - disconnect_structured_pull_consumer(StructuredProxyPullConsumer) -> ok - Close the connection and terminate the proxy - - StructuredProxyPullConsumer = #objref - - -

This operation cause the target object to close the connection and terminate.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPullSupplier.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPullSupplier.xml deleted file mode 100644 index 1ca7c2d7df..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPullSupplier.xml +++ /dev/null @@ -1,140 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_StructuredProxyPullSupplier - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_StructuredProxyPullSupplier - This module implements the OMG CosNotifyChannelAdmin::StructuredProxyPullSupplier interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifySubscribe

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
- -

CosNotifyChannelAdmin_ProxySupplier

-
-
-
- - - connect_structured_pull_consumer(StructuredProxyPullSupplier, PullConsumer) -> Reply - Connect a consumer to the proxy - - StructuredProxyPullSupplier = #objref - PullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} - - -

This operation connects a PullConsumer to the target object. If a connection - already exists the AlreadyConnected exception is raised.

-
-
- - pull_structured_event(StructuredProxyPullSupplier) -> Reply - Pull a structured event from the proxy - - StructuredProxyPullSupplier = #objref - Reply = StructuredEvent | {'EXCEPTION', #'CosEventChannelAdmin_Disconnected'{}} - StructuredEvent = #'CosNotification_StructuredEvent'{header, filterable_data, remainder_of_body} - header = EventHeader - filterable_data = [#'CosNotification_Property'{name, value}] - name = string() - value = #any - remainder_of_body = #any - EventHeader = #'CosNotification_EventHeader'{fixed_header, variable_header} - fixed_header = FixedEventHeader - variable_header = OptionalHeaderFields - FixedEventHeader = #'CosNotification_FixedEventHeader'{event_type, event_name} - event_type = EventType - event_name = string() - EventType = #'CosNotification_EventType'{domain_name, type_name} - domain_name = type_name = string() - OptionalHeaderFields = [#'CosNotification_Property'{name, value}] - - -

This operation pulls next event from the target object; if an event cannot - be delivered this function blocks until an event arrives.

-
-
- - try_pull_structured_event(StructuredProxyPullSupplier) -> Reply - Try to pull a structured event from the proxy - - StructuredProxyPullSupplier = #objref - Reply = {StructuredEvent, HasEvent} | {'EXCEPTION', #'CosEventChannelAdmin_Disconnected'{}} - HasEvent = boolean() - StructuredEvent = #'CosNotification_StructuredEvent'{header, filterable_data, remainder_of_body} - header = EventHeader - filterable_data = [#'CosNotification_Property'{name, value}] - name = string() - value = #any - remainder_of_body = #any - EventHeader = #'CosNotification_EventHeader'{fixed_header, variable_header} - fixed_header = FixedEventHeader - variable_header = OptionalHeaderFields - FixedEventHeader = #'CosNotification_FixedEventHeader'{event_type, event_name} - event_type = EventType - event_name = string() - EventType = #'CosNotification_EventType'{domain_name, type_name} - domain_name = type_name = string() - OptionalHeaderFields = [#'CosNotification_Property'{name, value}] - - -

This operation try to pull next event from the target object. If no event have arrived - an empty event is returned and the out parameter HasEvent is set to false. Otherwise, - the boolean flag is set to true and an valid event is returned.

-
-
- - disconnect_structured_pull_supplier(StructuredProxyPullSupplier) -> ok - Close connection and terminate the proxy - - StructuredProxyPullSupplier = #objref - - -

This operation cause the target object to close the connection and terminate.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPushConsumer.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPushConsumer.xml deleted file mode 100644 index 63bcdf120c..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPushConsumer.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_StructuredProxyPushConsumer - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_StructuredProxyPushConsumer - This module implements the OMG CosNotifyChannelAdmin::StructuredProxyPushConsumer interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifyPublish

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
- -

CosNotifyChannelAdmin_ProxyConsumer

-
-
-
- - - connect_structured_push_supplier(StructuredProxyPushConsumer, PushSupplier) -> Reply - Connect a supplier to the proxy - - StructuredProxyPushConsumer = #objref - PushSupplier = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} - - -

This operation connects a PushSupplier to the target object. If a connection - already exists an exception is raised.

-
-
- - push_structured_event(StructuredProxyPushConsumer, StructuredEvent) -> Reply - Push a structured event to the proxy - - StructuredProxyPushConsumer = #objref - StructuredEvent = #'CosNotification_StructuredEvent'{header, filterable_data, remainder_of_body} - header = EventHeader - filterable_data = [#'CosNotification_Property'{name, value}] - name = string() - value = #any - remainder_of_body = #any - EventHeader = #'CosNotification_EventHeader'{fixed_header, variable_header} - fixed_header = FixedEventHeader - variable_header = OptionalHeaderFields - FixedEventHeader = #'CosNotification_FixedEventHeader'{event_type, event_name} - event_type = EventType - event_name = string() - EventType = #'CosNotification_EventType'{domain_name, type_name} - domain_name = type_name = string() - OptionalHeaderFields = [#'CosNotification_Property'{name, value}] - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_Disconnected'{}} - - -

When a client want to push a new event to the target object this operation must be used.

-
-
- - disconnect_structured_push_consumer(StructuredProxyPushConsumer) -> ok - Close the connection and terminate the proxy - - StructuredProxyPushConsumer = #objref - - -

This operation cause the target object to close the connection and terminate.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPushSupplier.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPushSupplier.xml deleted file mode 100644 index 9ba5497fd8..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_StructuredProxyPushSupplier.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_StructuredProxyPushSupplier - - - - - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_StructuredProxyPushSupplier - This module implements the OMG CosNotifyChannelAdmin::StructuredProxyPushSupplier interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotifyComm_NotifySubscribe

-
- -

CosNotification_QoSAdmin

-
- -

CosNotifyFilter_FilterAdmin

-
- -

CosNotifyChannelAdmin_ProxySupplier

-
-
-
- - - connect_structured_push_consumer(StructuredProxyPushSupplier, PushConsumer) -> Reply - Connect a consumer to the proxy - - StructuredProxyPushSupplier = #objref - PushConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosEventChannelAdmin_AlreadyConnected'{}} | {'EXCEPTION', #'CosEventChannelAdmin_TypeError'{}} - - -

This operation connects a PushConsumer to the target object. If - a connection already exists or the function push_structured_event - is not supported by the client object an exception is raised.

-
-
- - suspend_connection(StructuredProxyPushSupplier) -> Reply - Suspend the connection with the target object - - StructuredProxyPushSupplier = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

This operation suspends the connection with the target object. If no connection - exists or the connection already is suspended an exception is raised.

-
-
- - resume_connection(StructuredProxyPushSupplier) -> Reply - Resume a previously suspended connection - - StructuredProxyPullConsumer = #objref - Reply = ok | {'EXCEPTION', #'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}} | {'EXCEPTION', #'CosNotifyChannelAdmin_NotConnected'{}} - - -

If the connection with the target object have been suspended this function - must be used to resume the connection. If no client have been connected or - the connection is active an exception is raised.

-
-
- - disconnect_structured_push_supplier(StructuredProxyPushSupplier) -> ok - Close the connection and terminate the target object - - StructuredProxyPushSupplier = #objref - - -

This operation cause the target object to close the connection and terminate.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SupplierAdmin.xml b/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SupplierAdmin.xml deleted file mode 100644 index 540edaff3f..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyChannelAdmin_SupplierAdmin.xml +++ /dev/null @@ -1,195 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyChannelAdmin_SupplierAdmin - - - - Niclas Eklund - - 2000-02-01 - 1.0 -
- CosNotifyChannelAdmin_SupplierAdmin - This module implements the OMG CosNotifyChannelAdmin::SupplierAdmin interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

This module also exports the functions described in:

- - -

CosNotification_QoSAdmin

-
- -

CosNotifyComm_NotifyPublish

-
- -

CosNotifyFilter_FilterAdmin

-
-
-
- - - _get_MyID(SupplierAdmin) -> AdminID - Return the objects Id - - SupplierAdmin = #objref - AdminID = long() - - -

When a SupplierAdmin object is created it is given a unique Id - by the creating channel. This readonly attribute maintains this Id.

-
-
- - _get_MyChannel(SupplierAdmin) -> Channel - Return the objects associated channel - - SupplierAdmin = #objref - Channel = #objref - - -

The creating channel's reference is maintained by this readonly attribute.

-
-
- - _get_MyOperator(SupplierAdmin) -> OpType - Return the filter scheme - - SupplierAdmin = #objref - OpType = 'AND_OP' | 'OR_OP' - - -

The Operation Type, which determines the semantics the target object will - use for any associated Filters, is maintained by this readonly attribute.

-
-
- - _get_pull_consumers(SupplierAdmin) -> ProxyIDSeq - Return all associated pull consumers Id:s - - SupplierAdmin = #objref - ProxyIDSeq = [ProxyID] - ProxyID = long() - - -

A sequence of all associated PullProxy Id's is maintained by this - readonly attribute.

-
-
- - _get_push_consumers(SupplierAdmin) -> ProxyIDSeq - Return all associated push consumers Id:s - - SupplierAdmin = #objref - ProxyIDSeq = [ProxyID] - ProxyID = long() - - -

This operation returns all PushProxy Id's created by the target - object.

-
-
- - get_proxy_consumer(SupplierAdmin, ProxyID) -> Reply - Return the Proxy which corresponds to the given Id - - SupplierAdmin = #objref - ProxyID = long() - Reply = Proxy | {'EXCEPTION', #'CosNotifyChannelAdmin_ProxyNotFound'{}} - Proxy = #objref - - -

The Proxy which corresponds to the given Id is returned by this operation.

-
-
- - obtain_notification_pull_consumer(SupplierAdmin, SupplierType) -> Reply - Create a new proxy - - SupplierAdmin = #objref - SupplierType = 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' - Reply = {Proxy, ProxyID} - Proxy = #objref - ProxyID = long() - - -

This operation creates a new proxy and returns its object reference along with its ID. - The SupplierType parameter determines the event type accepted by the proxy.

-
-
- - obtain_pull_consumer(SupplierAdmin) -> Proxy - Create a new proxy - - SupplierAdmin = #objref - Proxy = #objref - - -

A proxy which accepts #any{} events is created by this operation.

-
-
- - obtain_notification_push_consumer(SupplierAdmin, SupplierType) -> Reply - Create a new proxy - - SupplierAdmin = #objref - SupplierType = 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' - Reply = {Proxy, ProxyID} - Proxy = #objref - ProxyID = long() - - -

Determined by the SupplierType parameter a compliant proxy is created and - its object reference along with its Id is returned by this operation.

-
-
- - obtain_push_consumer(SupplierAdmin) -> Proxy - Create a new proxy - - SupplierAdmin = #objref - Proxy = #objref - - -

A proxy which accepts #any{} events is created by this operation.

-
-
- - destroy(SupplierAdmin) -> ok - Terminate the target object - - SupplierAdmin = #objref - - -

This operation terminates the SupplierAdmin object and notifies the creating channel - that the target object no longer is active.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyComm_NotifyPublish.xml b/lib/cosNotification/doc/src/CosNotifyComm_NotifyPublish.xml deleted file mode 100644 index a41319cb5c..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyComm_NotifyPublish.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyComm_NotifyPublish - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 2000-02-01 - 1.0 -
- CosNotifyComm_NotifyPublish - This module implements the OMG CosNotifyComm::NotifyPublish interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

All objects, which inherit this interface, export functions described in this module.

-
- - - offer_change(Object, Added, Removed) -> Reply - Inform the target object which type of events the supplier will deliver - - Object = #objref - Added = Removed = EventTypeSeq - EventTypeSeq = [type] - Reply = ok | {'EXCEPTION', CosNotifyComm_InvalidEventType{type}} - type = #'CosNotification_EventType'{domain_name, type_name} - domain_name = type_name = string() - - -

Objects supporting this interface can be informed by supplier objects about - which type of events that will be delivered in the future. This operation - accepts two parameters describing new and old event types respectively. - If any of the supplied event type names is syntactically incorrect an exception - is raised.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyComm_NotifySubscribe.xml b/lib/cosNotification/doc/src/CosNotifyComm_NotifySubscribe.xml deleted file mode 100644 index 277c666459..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyComm_NotifySubscribe.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyComm_NotifySubscribe - - - - - - 2000-02-01 - 1.0 -
- CosNotifyComm_NotifySubscribe - This module implements the OMG CosNotifyComm::NotifySubscribe interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

All objects, which inherit this interface, export functions described in this module.

-
- - - subscription_change(Object, Added, Removed) -> Reply - Inform the target object which event types the client will and will not accept in the future - - Object = #objref - Added = Removed = EventTypeSeq - EventTypeSeq = [type] - Reply = ok | {'EXCEPTION', CosNotifyComm_InvalidEventType{type}} - type = #'CosNotification_EventType'{domain_name, type_name} - domain_name = type_name = string() - - -

This operation takes as input two sequences of event type names - specifying events the client will and will not accept in the future - respectively.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyFilter_Filter.xml b/lib/cosNotification/doc/src/CosNotifyFilter_Filter.xml deleted file mode 100644 index a953540849..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyFilter_Filter.xml +++ /dev/null @@ -1,223 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosNotifyFilter_Filter - - - - 2000-02-01 - 1.0 -
- CosNotifyFilter_Filter - This module implements the OMG CosNotifyFilter::Filter interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-
- - - _get_constraint_grammar(Filter) -> Grammar - Return which type of Grammar the Filter uses - - Filter = #objref - Grammar = string() - - -

This operation returns which type of Grammar the Filter uses. Currently, only "EXTENDED_TCL" is supported.

-
-
- - add_constraints(Filter, ConstraintExpSeq) -> Reply - Add new constraints to the filter - - Filter = #objref - ConstraintExpSeq = [Constraint] - ConstraintExp = #'CosNotifyFilter_ConstraintExp'{event_types, constraint_expr} - event_types = #'CosNotification_EventTypeSeq'{} - constraint_expr = string() - Reply = ConstraintInfoSeq | {'EXCEPTION', #'CosNotifyFilter_InvalidConstraint'{constr}} - constr = ConstraintExp - ConstraintInfoSeq = [ConstraintInfo] - ConstraintInfo = #'CosNotifyFilter_ConstraintInfo'{constraint_expression, constraint_id} - constraint_expression = ConstraintExp - constraint_id = long() - - -

Initially, Filters do not contain any constraints, hence, all events will be forwarded. - The add_constraints/2 operation allow us to add constraints to the target object.

-
-
- - modify_constraints(Filter, ConstraintIDSeq, ConstraintInfoSeq) -> Reply - Modify existing constraints - - Filter = #objref - ConstraintIDSeq = [ConstraintID] - ConstraintID = long() - ConstraintInfoSeq = [ConstraintInfo] - ConstraintInfo = #'CosNotifyFilter_ConstraintInfo'{constraint_expression, constraint_id} - constraint_expression = ConstraintExp - constraint_id = long() - Reply = ok | {'EXCEPTION', #'CosNotifyFilter_InvalidConstraint'{constr}} | {'EXCEPTION', #'CosNotifyFilter_ConstraintNotFound'{id}} - constr = ConstraintExp - id = long() - ConstraintExp = #'CosNotifyFilter_ConstraintExp'{event_types, constraint_expr} - event_types = #'CosNotification_EventTypeSeq'{} - constraint_expr = string() - - -

This operation is invoked by a client in order to modify the constraints associated - with the target object. The constraints related to the Id's in the parameter sequence - ConstraintIDSeq will, if all values are valid, be deleted. The ConstraintInfoSeq - parameter contains of Id-Expression pairs and a constraint matching one of the unique - Id's will, if all input values are correct, be updated. If the parameters contain incorrect - data en exception will be raised.

-
-
- - get_constraints(Filter, ConstraintIDSeq) -> Reply - Return all constraints which match the supplied Ids - - Filter = #objref - ConstraintIDSeq = [ConstraintID] - ConstraintID = long() - Reply = ConstraintInfoSeq | {'EXCEPTION', #'CosNotifyFilter_ConstraintNotFound'{id}} - ConstraintInfoSeq = [ConstraintInfo] - ConstraintInfo = #'CosNotifyFilter_ConstraintInfo'{constraint_expression, constraint_id} - constraint_expression = ConstraintExp - constraint_id = id = long() - - -

This operation return a sequence of ConstraintInfo's, related to the given ConstraintID's, - associated with the target object.

-
-
- - get_all_constraints(Filter) -> ConstraintInfoSeq - Return all constraints associated with the target object - - Filter = #objref - ConstraintInfoSeq = [ConstraintInfo] - ConstraintInfo = #'CosNotifyFilter_ConstraintInfo'{constraint_expression, constraint_id} - constraint_expression = ConstraintExp - constraint_id = long() - - -

All constraints, and their unique Id, associated with the target object will be returned by this operation.

-
-
- - remove_all_constraints(Filter) -> ok - Remove all constraints associated with the target object - - Filter = #objref - - -

All constraints associated with the target object are removed by this operation and, since - the the target object no longer contain any constraints, true will always be the result of - any match operation.

-
-
- - destroy(Filter) -> ok - Terminate the target object - - Filter = #objref - - -

This operation terminates the target object.

-
-
- - match(Filter, Event) -> Reply - Match the Any event if it satisfies at least one constraint - - Filter = #objref - Event = #any - Reply = boolean() | {'EXCEPTION', #'CosNotifyFilter_UnsupportedFilterableData'{}} - - -

This operation accepts an #any{} event and returns true if it satisfies - at least one constraint. If the event contains data of the wrong type, e.g., should be - a string() but in fact i a short(), an exception is raised.

-
-
- - match_structured(Filter, Event) -> Reply - Match the structured event if it satisfies at least one constraint - - Filter = #objref - Event = #'CosNotification_StructuredEvent'{} - Reply = boolean() | {'EXCEPTION', #'CosNotifyFilter_UnsupportedFilterableData'{}} - - -

This operation is similar to the match operation but accepts structured - events instead.

-
-
- - attach_callback(Filter, NotifySubscribe) -> CallbackID - Connect NotifySubscribe object, which should be informed when the target object's constraints are updated - - Filter = #objref - NotifySubscribe = #objref - CallbackID = long() - - -

This operation connects a NotifySubscribe object, which should be informed - when the target object's constraints are updated. A unique Id is returned - which must be stored if we ever want to detach the callback object in the future.

-
-
- - detach_callback(Filter, CallbackID) -> Reply - Disconnect the NotifySubscribe object with the given Id - - Filter = #objref - CallbackID = long() - Reply = ok | {'EXCEPTION', #'CosNotifyFilter_CallbackNotFound'{}} - - -

If the target object has an associated callback that matches the supplied - Id it will be removed and longer informed of any updates. If no object - with a matching Id is found an exception is raised.

-
-
- - get_callbacks(Filter) -> CallbackIDSeq - Return all NotifySubscribe Id's associated with the target object - - Filter = #objref - CallbackIDSeq = [CallbackID] - CallbackID = long() - - -

This operation returns a sequence of all connected NotifySubscribe object Id's. - If no callbacks are associated with the target object the list will be empty.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyFilter_FilterAdmin.xml b/lib/cosNotification/doc/src/CosNotifyFilter_FilterAdmin.xml deleted file mode 100644 index 5cb56963f1..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyFilter_FilterAdmin.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyFilter_FilterAdmin - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 2000-02-01 - 1.0 -
- CosNotifyFilter_FilterAdmin - This module implements the OMG CosNotifyFilter::FilterAdmin interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

All objects, which inherit this interface, export functions described in this module.

-
- - - add_filter(Object, Filter) -> FilterID - Add a new filter to the target object - - Object = #objref - Filter = #objref - FilterID = long() - - -

This operation connects a new Filter to the target object. This Filter will, together - with other associated Filters, be used to select events to forward. A unique Id is - returned and should be used if we no longer want to consult the given Filter.

-
-
- - remove_filter(Object, FilterID) -> ok - Remove a filter associated with the target object - - Object = #objref - FilterID = long() - - -

If a certain Filter no longer should be associated with the target object - this operation must be used. Events will no longer be tested against the Filter - associated with the given Id.

-
-
- - get_filter(Object, FilterID) -> Reply - Return the filter with the given Id - - Object = #objref - FilterID = long() - Reply = Filter | {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}} - Filter = #objref - - -

If the target object is associated with a Filter matching the given Id the - reference will be returned. If no such Filter is known by the target object - an exception is raised.

-
-
- - get_all_filters(Object) -> FilterIDSeq - Return a list of all filter Id:s associated with the target object - - Object = #objref - FilterIDSeq = [FilterID] - FilterID = long() - - -

Id's for all Filter objects associated with the target object is - returned by this operation.

-
-
- - remove_all_filters(Object) -> ok - Remove all filters from the target object - - Object = #objref - - -

If we want to remove all Filters associated with the target object we can use this function.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyFilter_FilterFactory.xml b/lib/cosNotification/doc/src/CosNotifyFilter_FilterFactory.xml deleted file mode 100644 index adacbc3281..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyFilter_FilterFactory.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNotifyFilter_FilterFactory - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 2000-02-01 - 1.0 -
- CosNotifyFilter_FilterFactory - This module implements the OMG CosNotifyFilter::FilterFactory interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-
- - - create_filter(FilterFactory, Grammar) -> Reply - Create a Filterobject - - FilterFactory = #objref - Grammar = string() - Reply = Filter | {'EXCEPTION', #'CosNotifyFilter_InvalidGrammar'{}} - Filter = #objref - - -

This operation creates a new Filter object, under the condition - that Grammar given is supported. Currently, only "EXTENDED_TCL" is supported.

-
-
- - create_mapping_filter(FilterFactory, Grammar) -> Reply - Create a MappingFilterobject - - FilterFactory = #objref - Grammar = string() - Reply = MappingFilter | {'EXCEPTION', #'CosNotifyFilter_InvalidGrammar'{}} - Filter = #objref - - -

This operation creates a new MappingFilter object, under the condition - that Grammar given is supported. Currently, only "EXTENDED_TCL" is supported.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/CosNotifyFilter_MappingFilter.xml b/lib/cosNotification/doc/src/CosNotifyFilter_MappingFilter.xml deleted file mode 100644 index c0db8c1ae0..0000000000 --- a/lib/cosNotification/doc/src/CosNotifyFilter_MappingFilter.xml +++ /dev/null @@ -1,228 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosNotifyFilter_MappingFilter - - - - 2000-02-01 - 1.0 -
- CosNotifyFilter_MappingFilter - This module implements the OMG CosNotifyFilter::MappingFilter interface. - -

The main purpose of this module is to match events against associated - constraints and return the value for the first constraint that returns - true for the given event. If all constraints return false the default value - will be returned.

-

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-
- - - _get_constraint_grammar(MappingFilter) -> Grammar - Return which type of Grammar the MappingFilter uses - - MappingFilter = #objref - Grammar = string() - - -

This operation returns which type of Grammar the MappingFilter uses. - Currently, only "EXTENDED_TCL" is supported.

-
-
- - _get_value_type(MappingFilter) -> CORBA::TypeCode - Return the CORBA::TypeCodeof the default value associated with the target object - - MappingFilter = #objref - - -

This readonly attribute maintains the CORBA::TypeCode of the default value - associated with the target object.

-
-
- - _get_default_value(MappingFilter) -> #any - Return the #any{} default value associated with the target object - - MappingFilter = #objref - - -

This readonly attribute maintains the #any{} default value associated with - the target object.

-
-
- - add_mapping_constraints(MappingFilter, MappingConstraintPairSeq) -> Reply - Add new mapping constraints - - MappingFilter = #objref - MappingConstraintPairSeq = [MappingConstraintPair] - MappingConstraintPair = #'CosNotifyFilter_MappingConstraintPair'{constraint_expression, result_to_set} - constraint_expression = #'CosNotifyFilter_ConstraintExp'{event_types, constraint_expr} - event_types = #'CosNotification_EventTypeSeq'{} - constraint_expr = string() - result_to_set = #any - Reply = MappingConstraintInfoSeq | {'EXCEPTION', #'CosNotifyFilter_InvalidConstraint'{constr}} | {'EXCEPTION', #'CosNotifyFilter_InvalidValue'{constr, value}} - constr = ConstraintExp - ConstraintExp = #'CosNotifyFilter_ConstraintExp'{event_types, constraint_expr} - event_types = #'CosNotification_EventTypeSeq'{} - constraint_expr = string() - MappingConstraintInfoSeq = [MappingConstraintInfo] - MappingConstraintInfo = #'CosNotifyFilter_MappingConstraintInfo'{constraint_expression, constraint_id, value} - constraint_expression = ConstraintExp - constraint_id = long() - value = #any - - -

This operation add new mapping constraints, which will be used when trying to override - Quality of Service settings defined in the given event. If a constraint return true the - associated value will be returned, otherwise the default value.

-
-
- - modify_constraints(MappingFilter, ConstraintIDSeq, MappingConstraintInfoSeq) -> Reply - Modify the constraints associated with the target object - - MappingFilter = #objref - ConstraintIDSeq = [ConstraintID] - ConstraintID = long() - MappingConstraintInfoSeq = [MappingConstraintInfo] - MappingConstraintInfo = #'CosNotifyFilter_MappingConstraintInfo'{constraint_expression, constraint_id, value} - constraint_expression = ConstraintExp - constraint_id = long() - value = #any - ConstraintInfoSeq = [ConstraintInfo] - ConstraintInfo = #'CosNotifyFilter_ConstraintInfo'{constraint_expression, constraint_id} - constraint_expression = ConstraintExp - constraint_id = long() - Reply = ok | {'EXCEPTION', #'CosNotifyFilter_InvalidConstraint'{constr}} | {'EXCEPTION', #'CosNotifyFilter_ConstraintNotFound'{id}} | {'EXCEPTION', #'CosNotifyFilter_InvalidValue'{constr, value}} - constr = ConstraintExp - id = long() - value = #any - ConstraintExp = #'CosNotifyFilter_ConstraintExp'{event_types, constraint_expr} - event_types = #'CosNotification_EventTypeSeq'{} - constraint_expr = string() - - -

The ConstraintIDSeq supplied should relate to constraints the caller wishes to - remove. If any of the supplied Id's are not found an exception will be raised. This - operation also accepts a sequence of MappingConstraintInfo which will be added. - If the target object cannot modify the constraints as requested an exception is raised - describing which constraint, and why, could not be updated.

-
-
- - get_mapping_constraints(MappingFilter, ConstraintIDSeq) -> Reply - Return the target object's associated constraints with given ID:s - - MappingFilter = #objref - ConstraintIDSeq = [ConstraintID] - ConstraintID = long() - Reply = MappingConstraintInfoSeq | {'EXCEPTION', #'CosNotifyFilter_ConstraintNotFound'{id}} - MappingConstraintInfoSeq = [MappingConstraintInfo] - MappingConstraintInfo = #'CosNotifyFilter_MappingConstraintInfo'{constraint_expression, constraint_id, value} - constraint_expression = ConstraintExp - ConstraintExp = #'CosNotifyFilter_ConstraintExp'{event_types, constraint_expr} - event_types = #'CosNotification_EventTypeSeq'{} - constraint_expr = string() - constraint_id = id = long() - value = #any - - -

When adding a new constraint a unique Id is returned, which is accepted as input for this - operation. The associated constraint is returned, but if no such Id exists an exception is raised.

-
-
- - get_all_mapping_constraints(MappingFilter) -> MappingConstraintInfoSeq - Return the target object's all associated constraints - - MappingFilter = #objref - MappingConstraintInfoSeq = [MappingConstraintInfo] - MappingConstraintInfo = #'CosNotifyFilter_MappingConstraintInfo'{constraint_expression, constraint_id, value} - constraint_expression = ConstraintExp - ConstraintExp = #'CosNotifyFilter_ConstraintExp'{event_types, constraint_expr} - event_types = #'CosNotification_EventTypeSeq'{} - constraint_expr = string() - constraint_id = long() - value = #any - - -

This operation returns a sequence of all unique Id's associated with the target object. - If no constraint have been added the sequence will be empty.

-
-
- - remove_all_mapping_constraints(MappingFilter) -> ok - Remove all constraints associated with the target object - - MappingFilter = #objref - - -

This operation removes all constraints associated with the target object.

-
-
- - destroy(MappingFilter) -> ok - Terminate the target object - - MappingFilter = #objref - - -

This operation terminates the target object. Remember to remove - this Filter from the objects it have been associated with.

-
-
- - match(MappingFilter, Event) -> Reply - Evaluate the given Any event with the Filter's constraints - - MappingFilter = #objref - Event = #any - Reply = {boolean(), #any} | {'EXCEPTION', #'CosNotifyFilter_UnsupportedFilterableData'{}} - - -

This operation evaluates Any events with the Filter's constraints, - and returns the value to use. The value is the default value if all constraints - returns false and the value associated with the first constraint returning true.

-
-
- - match_structured(MappingFilter, Event) -> Reply - Evaluate the given structured event with the Filter's constraints - - MappingFilter = #objref - Event = #'CosNotification_StructuredEvent'{} - Reply = {boolean(), #any} | {'EXCEPTION', #'CosNotifyFilter_UnsupportedFilterableData'{}} - - -

Similar to match/2 but accepts a structured event as input.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/Makefile b/lib/cosNotification/doc/src/Makefile deleted file mode 100644 index 43ed8294c4..0000000000 --- a/lib/cosNotification/doc/src/Makefile +++ /dev/null @@ -1,167 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2000-2017. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../../vsn.mk -VSN=$(COSNOTIFICATION_VSN) -APPLICATION=cosNotification - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN) - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -XML_APPLICATION_FILES = ref_man.xml -XML_REF3_FILES = \ - cosNotificationApp.xml \ - CosNotifyChannelAdmin_EventChannelFactory.xml \ - CosNotifyChannelAdmin_EventChannel.xml \ - CosNotification.xml \ - CosNotification_QoSAdmin.xml \ - CosNotification_AdminPropertiesAdmin.xml \ - CosNotifyChannelAdmin_ConsumerAdmin.xml \ - CosNotifyChannelAdmin_SupplierAdmin.xml \ - CosNotifyComm_NotifyPublish.xml \ - CosNotifyComm_NotifySubscribe.xml \ - CosNotifyFilter_FilterAdmin.xml \ - CosNotifyFilter_FilterFactory.xml \ - CosNotifyFilter_Filter.xml \ - CosNotifyFilter_MappingFilter.xml \ - CosNotifyChannelAdmin_ProxyConsumer.xml \ - CosNotifyChannelAdmin_ProxySupplier.xml \ - CosNotifyChannelAdmin_ProxyPullConsumer.xml \ - CosNotifyChannelAdmin_ProxyPullSupplier.xml \ - CosNotifyChannelAdmin_ProxyPushConsumer.xml \ - CosNotifyChannelAdmin_ProxyPushSupplier.xml \ - CosNotifyChannelAdmin_SequenceProxyPullConsumer.xml \ - CosNotifyChannelAdmin_SequenceProxyPullSupplier.xml \ - CosNotifyChannelAdmin_SequenceProxyPushConsumer.xml \ - CosNotifyChannelAdmin_SequenceProxyPushSupplier.xml \ - CosNotifyChannelAdmin_StructuredProxyPullConsumer.xml \ - CosNotifyChannelAdmin_StructuredProxyPullSupplier.xml \ - CosNotifyChannelAdmin_StructuredProxyPushConsumer.xml \ - CosNotifyChannelAdmin_StructuredProxyPushSupplier.xml \ - - - -XML_PART_FILES = \ - part.xml -XML_CHAPTER_FILES = \ - ch_contents.xml \ - ch_introduction.xml \ - ch_install.xml \ - ch_system.xml \ - ch_BNF.xml \ - ch_QoS.xml \ - ch_example.xml \ - notes.xml - -BOOK_FILES = book.xml - -XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \ - $(XML_PART_FILES) $(XML_CHAPTER_FILES) - -TECHNICAL_DESCR_FILES = - -GIF_FILES = \ - eventstructure.gif \ - notificationFlow.gif - -PS_FILES = - -# ---------------------------------------------------- - -INTERNAL_HTML_FILES = $(TECHNICAL_DESCR_FILES:%.xml=$(HTMLDIR)/%.html) - -HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \ - $(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html) - -INFO_FILE = ../../info -EXTRA_FILES = \ - $(DEFAULT_GIF_FILES) \ - $(DEFAULT_HTML_FILES) \ - $(XML_REF3_FILES:%.xml=$(HTMLDIR)/%.html) \ - $(XML_CHAPTER_FILES:%.xml=$(HTMLDIR)/%.html) - -MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3) - -HTML_REF_MAN_FILE = $(HTMLDIR)/index.html - -TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -XML_FLAGS += -DVIPS_FLAGS += - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -$(HTMLDIR)/%.gif: %.gif - $(INSTALL_DATA) $< $@ - -docs: pdf html man - -$(TOP_PDF_FILE): $(XML_FILES) - -pdf: $(TOP_PDF_FILE) - -html: gifs $(HTML_REF_MAN_FILE) - -clean clean_docs: - rm -rf $(HTMLDIR)/* - rm -f $(MAN3DIR)/* - rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) - rm -f errs core *~ - -man: $(MAN3_FILES) - -gifs: $(GIF_FILES:%=$(HTMLDIR)/%) - -$(INDEX_TARGET): $(INDEX_SRC) - sed -e 's;%VSN%;$(VSN);' $(INDEX_SRC) > $(INDEX_TARGET) - -debug opt: - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_docs_spec: docs - $(INSTALL_DIR) "$(RELSYSDIR)/doc/pdf" - $(INSTALL_DATA) $(TOP_PDF_FILE) "$(RELSYSDIR)/doc/pdf" - $(INSTALL_DIR) "$(RELSYSDIR)/doc/html" - $(INSTALL_DATA) $(HTMLDIR)/* \ - "$(RELSYSDIR)/doc/html" - $(INSTALL_DATA) $(INFO_FILE) "$(RELSYSDIR)" - $(INSTALL_DIR) "$(RELEASE_PATH)/man/man3" - $(INSTALL_DATA) $(MAN3DIR)/* "$(RELEASE_PATH)/man/man3" - -release_spec: diff --git a/lib/cosNotification/doc/src/book.xml b/lib/cosNotification/doc/src/book.xml deleted file mode 100644 index 3151abceaa..0000000000 --- a/lib/cosNotification/doc/src/book.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosNotification - Niclas Eklund - - 2000-01-31 - 1.0 -
- - - cosNotification - - - - - - - - - - - - - - -
- diff --git a/lib/cosNotification/doc/src/ch_BNF.xml b/lib/cosNotification/doc/src/ch_BNF.xml deleted file mode 100644 index 9763c0c4ca..0000000000 --- a/lib/cosNotification/doc/src/ch_BNF.xml +++ /dev/null @@ -1,457 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Filters and the Constraint Language BNF - - - 2000-04-13 - - ch_BNF.xml -
- -
- Filters and the Constraint Language BNF -

This chapter describes, the grammar supported by - CosNotifyFilter_Filter and - CosNotifyFilter_MappingFilter, - and how to create and use filter objects. -

- -
- How to create filter objects -

To be able to filter events we must create a filter and associate - it with one, or more, of the administrative or proxy objects. In the example - below, we choose to associate the filter with a ConsumerAdmin object.

- -FilterFactory = cosNotificationApp:start_filter_factory(), -Filter = 'CosNotifyFilter_FilterFactory': - create_filter(FilterFactory,"EXTENDED_TCL"), -ConstraintInfoSeq = 'CosNotifyFilter_Filter': - add_constraints(Filter, ConstraintExpSeq), -FilterID = 'CosNotifyChannelAdmin_ConsumerAdmin': - add_filter(AdminConsumer, Filter), - -

"EXTENDED_TCL" is the only grammar supported by Orber Notification - Service.

-

Depending on which operation type the Admin object uses, i.e., - 'AND_OP' or 'OR_OP', events will be tested using the - associated filter. The operation properties are:

-

- - -

'AND_OP' - must be approved by the proxy's and its parent admin's - filters. If all filters associated with an object (Admin or Proxy) - return false the event will be discarded. In this situation it is pointless - to try and verify with the other object's associated filters since the outcome - still would be the same.

-
- -

'OR_OP' - if one of the object's (Admin or Proxy) filters return true, the event - will not be checked against any other filter associated with a proxy or its - parent admin. If a object's associated filters all return false, - the event will be forwarded to related proxies/admins, and - tested against any associated filters.

-
-
-

Initially, filters are empty and will always return true. Hence, we must - add constraints by using 'CosNotifyFilter_Filter':add_constraints/2. - As input, the second argument must be a sequence of:

- -#'CosNotifyFilter_ConstraintExp'{ - event_types = [#'CosNotification_EventType'{ - domain_name = string(), - type_name = string()}], - constraint_expr = string()} - -

The event_types describes which types of events that should be matched using - the associated constraint_expr.

-

If a constraint expression is supposed to apply for all events, then the type_name can - be set to the special event type %ALL in a constraint's event type sequence. The - domain_name should be "" or "*".

-

In the following sections we will take a closer look on how to write - constraint expressions.

-
- -
- The CosNotification Constraint Language -

The constraint language supported by the Notification Service is:

- := /* empty */ - | - - := - - := or - | - - := and - | - - := == - | != - | < - | <= - | > - | >= - | - - := in /* sequence only */ - | - | in $ /* sequence only */ - - := ~ /* string data types only */ - | - - := + - | - - | - - := * - | / - | - - := not - | - - := ( ) - | exist - | - | - | - - | - | TRUE - | FALSE - | + - | exist $ - | $ - | default $ /* discriminated unions only */ - - := /* empty */ - | . - | - | - | /* run-time variable */ - - := /* empty */ - | . - | - | - - := - | - | - | _length /* only valid for arrays or sequences */ - | _d /* discriminated unions only */ - | _type_id /* only valid if possible to obtain */ - | _repos_id /* only valid if possible to obtain */ - - := [ ] - - := ( ) - - := - - := ( ) - - := /* empty */ - | - | - - | + - | - -/* Character set issues */ - := - | \ < Leader> - - := /* */ - | - - := - | - - := - | . - | . - | . - - := - - := + - | - - - := E - | e - - := - | - - := ' ' - - := /* */ - | - - := - | - | - | - - := \\ - | \' - - := - - := - | - | _ - - is the set of alphabetic characters [A-Za-z] - is the set of digits [0-9] - is the set of ASCII characters that are not , , or - ]]> -

In the absence of parentheses, the following precedence relations hold :

- - (), exist, default, unary-sign - not - *, / - +, - - ~ - in - ==, !=, , , >, >= - and - or - -
- -
- The Constraint Language Data Types -

The Notification Service Constraint Language, defines how to write - constraint expressions, which can be used to filter events. The - representation does, however, differ slightly from ordinary Erlang terms.

-

When creating a ConstraintExp, the field constraint_expr must be - set to contain a string, e.g., . The Notification Service Constraint - Language, is designed to be able to filter structured and unstructured events - using the same constraint expression. The Constraint Language Types and Operations - can be divided into two sub-groups:

- - -

Basic - arithmetics, strings, constants, numbers etc.

-
- -

Complex - accessing members of complex data types, such as unions.

-
-
-

Some of the basic types, e.g., integer, are self explanatory. Hence, they are not described further.

- - - Type/Operation - Examples - Description - - - string - "'MyString'" - Strings are represented as a sequence of zero or more ]]>s enclosed in single quotes, e.g., 'string'. - - - ~ - "'Sring1' ~ 'String2'" - The operator ~is called the substring operator and mean "String1 is contained within String2". - - - boolean - "TRUE == (('lang' ~ 'Erlang' + 'fun' ~ 'functional') >= 2)" - Booleans may only be TRUE or FALSE, i.e., only capital letters. Expressions which evaluate to TRUE or FALSE can be summed up and matched, where TRUE equals 1 and FALSE 0. - - - sequence - "myIntegerSequence[2]" - The BNF use C/C++ notation, i.e., the example will return the thirdelement. - - - _length - "myIntegerSequence._length" - Returns the length of an sequence or array. - - - in - "'Erlang' in $.FunctionalLanguagesStringSeq" - Returns TRUEif a given element is found in the given sequence. The element must be of a simple type and the same as the sequence is defined to contain. - - - $ - "$ == 40" - Denote the current event as well as any run-time variables. If the event is unstructured and its contained value 40, the example will return TRUE. - - - . - "$.MyStructMember == 40" - The structure member operator .may be used to reference its members when the data refers to a named structure, discriminated union, or CORBA::Any data structure. - - - _type_id - "$._type_id == 'MyStruct'" - Returns the unscoped IDL type name of the component. This operation is only valid if said information can be obtained. - - - _repos_id - "$._repos_id == 'IDL:MyModule/MyStruct:1.0'" - Returns the RepositoryId of the component. This operation is only valid if said information can be obtained. - - - _d - "$.eventUnion._d" - May only be used when accessing discriminated unions and refers to the discriminator. - - - exist - "exist $.eventUnion._d and $.eventUnion._d == 10" - To avoid that a filtering of an event fails due to that, for example, we try to compare a union discriminator which does not exist, we can use this operator. - - - default - "default $.eventUnion._d" - If the _doperation is in conjunction with the defaultoperation, TRUE will be returned if the union has a default member that is active. - - - union - "$.(0) == 5"eq. "$.('zero') == 5" - When the component refers to a union, with one of the cases defined as case 0: short zero;, we use 0or 'zero'. The result of the example is TRUEif the union has a discriminator set to 0and the value 5. If more than one case is defined to be'zero', $.('zero')accepts both; $.(0)only returns TRUEif the discriminator is set to 0. Leaving out the identifier, i.e., $.(), refers to the default value. - - - name-value pairs - "$.NameValueSeq('myID') == 5"eq."$.NameValueSeq[1].name == 'myID' and $.NameValueSeq[1].value == 5" - The Notification service makes extensive use of name-value pairssequences within structured events, which allow us to via the identifier nameaccess its value, as shown in the example. - - Table 1: Type and Operator Examples -
-

In the next section we will take a closer look at how it is possible to write constraints using - different types of notation etc.

-
- -
- Accessing Data In Events -

To filter events, the supplied constraints must describe the contents of - the events and desired values. We can, for example, state that we are only - interested in receiving events which are of type CommunicationsAlarm. - To be able to achieve this, the constraint must contain information - that points out which fields to compare with. Figure one illustrates a conceptual overview of a - structured event. The exact definition is found in the CosNotification.idl file.

- - - -Figure 1: The structure of a structured event. - -

The Notification Service supports different constraint expressions - notation:

- - -

Fully scoped, e.g., "$.header.fixed_header.event_type.type_name == 'CommunicationsAlarm'"

-
- -

Short hand, e.g., "$type_name == 'CommunicationsAlarm'"

-
- -

Positional Notation, e.g., "$.0.0.0.1 == 'CommunicationsAlarm'"

-
-
- -

Which notation to use is up to the user, however, the fully scoped may - be easier to understand, but in some cases, if received from an ORB that do not populate ID:s of - named parts, the positional notation is the only option.

-
- -

If a constraint, which access fields in a structured event structure, - is supposed to handle unstructured events as well, the CORBA::Any must contain - the same type of members.

-
-

How to filter against the fixed header fields, is described in the - table below.

- - - Field - Fully Scoped Constraint - Short Hand Constraint - - - type_name - "$.header.fixed_header.event_type.type_name == 'Type'" - "$type_name == 'Type'" - - - domain_name - "$.header.fixed_header.event_type.domain_name == 'Domain'" - "$domain_name == 'Domain'" - - - event_name - "$.header.fixed_header.event_name == 'Event'" - "$event_name == 'Event'" - - Table 2: Fixed Header Constraint Examples -
-

If we are only interested in receiving events regarding 'Domain', 'Event' - and 'Type', the constraint can look like - "$domain_name == 'Domain' and $event_name == 'Event' and $type_name == 'Type'".

-

The variable event header consists of a sequence of name-value pairs. One way to filter on these are to use a constraint that looks - like "($.header.variable_header[1].name == 'priority' and $.header.variable_header[1].value > 0)". An easier way to - accomplish the same result is to use a constraint that treats the name-value - pair as an associative array, i.e., when given a name the corresponding - value is returned. Hence, instead we can use - "$.header.variable_header(priority) > 0".

-

Accessing the event body is done in the same way as for the event header - fields. The user must, however, be aware of, that if a run-time variable - ($variable) is used data in the event header may take precedence. - The order of precedence is:

- - Reserved, e.g., $curtime - A simple-typed member of $.header.fixed_header. - Properties in $.header.variable_header. - Properties in $.filterable_data. - If no match is found it is translated to $.variable. - -
- -
- Mapping Filters -

Mapping Filters may only be associated with Consumer Administrators or Proxy - Suppliers. The purpose of a Mapping Filter is to override Quality of Service - settings.

-

Initially, Mapping Filters are empty and will always return true. Hence, we must - add constraints by using 'CosNotifyFilter_MappingFilter':add_mapping_constraints/2. - If a constraint matches, the associated value will be used instead of the - related Quality of Service system settings.

-

As input, the second argument must be a sequence of:

- -#'CosNotifyFilter_MappingConstraintPair'{ - constraint_expression = #'CosNotifyFilter_ConstraintExp'{ - event_types = [#'CosNotification_EventType'{ - domain_name = string(), - type_name = string()}], - constraint_expr = string()}, - result_to_set = any()} - -
-
-
- diff --git a/lib/cosNotification/doc/src/ch_QoS.xml b/lib/cosNotification/doc/src/ch_QoS.xml deleted file mode 100644 index 7f7a26f69a..0000000000 --- a/lib/cosNotification/doc/src/ch_QoS.xml +++ /dev/null @@ -1,252 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Quality Of Service and Admin Properties - - - 2000-05-29 - - ch_QoS.xml -
- -
- Quality Of Service and Admin Properties -

This chapter explains the allowed properties for - CosNotification_QoSAdmin and - CosNotification_AdminPropertiesAdmin. -

- -
- Quality Of Service -

The cosNotification application supports the following QoS settings:

- - - QoS - Range - Default - - - EventReliability - BestEffort/Persistent - BestEffort - - - ConnectionReliability - BestEffort/Persistent - BestEffort - - - Priority - +/-32767 - 0 - - - OrderPolicy - Any-, Fifo-, Priority- and Deadline-Order - PriorityOrder - - - DiscardPolicy - RejectNewEvents, Any-, Fifo-, Lifo-, Priority- and Deadline-Order - RejectNewEvents - - - MaximumBatchSize - long() > 0 - 1 - - - PacingInterval - TimeBase::TimeT (see cosTime) - 0 - - - StartTimeSupported - boolean - false - - - StopTimeSupported - boolean - false - - - MaxEventsPerConsumer - long() > 0 - 100 - - - Timeout - TimeBase::TimeT (see cosTime) - No timeout - - Table 1: Supported QoS Settings -
-

-

-

-

-

Comments on the table 'Supported QoS Settings':

- - EventReliability - To allow full Persistent EventReliability, every event must - be stored in a stable storage which would create a relatively - huge overhead. Hence, only lightweight version of the Persistent - QoS is supported. The configuration parameters max_events, - interval_events and timeout_events determine - the behavior of this setting. - ConnectionReliability - If this QoS is set to BestEffort and a client object returns anything - other than ok to its associated Proxy, the Proxy will discard - all events and terminate. Using Persistent and anything other than ok - is returned, events will be dropped but the proxy will retry later when - next delivery is due. A child may not have Persistent while its parent - has BestEffort QoS set, e.g., Proxy vs. Admin. If OBJECT_NOT_EXIST, - NO_PERMISSION or CosEventComm_Disconnected is thrown, - the associated object will terminate even if this parameter is - set to Persistent. - Priority - This QoS will treat all events as if they have the Priority equal to - current value, unless the event itself contains a Priority setting, - this event will be treated accordingly. Note: for this property to - have any effect, the DiscardPolicy and/or OrderPolicy must be set - to PriorityOrder. - OrderPolicy - If set to PriorityOrder, events with the highest Priority will be - delivered first. Deadline order will forward events with shortest - expiry time first. If two events have the same priority, they will be - delivered in FIFO-order. - DiscardPolicy - If set to PriorityOrder and MaxEventsPerConsumer limit is - reached, events - with the lowest Priority will be discarded first. Deadline order will - discard events with shortest expiry time first. - MaximumBatchSize - Only valid if the object is supposed to handle a sequence of structured - events and determines the largest amount of events that may be passed - each time. - PacingInterval - Determines how long an object will wait before forwarding a structured - event sequence of length equal to, or less than MaximumBatchSize. - If set to 0, which is the default behavior, no timeout is used and - the events are forwarded when the MaximumBatchSize is reached. - StartTimeSupported - If set to true events which contains the QoS Property StartTime - (TimeBase::UtcT - absolute time) will not be delivered until the - StartTime value have been exceeded. See also the cosTime application. - StopTimeSupported - If set to true, events which contain the QoS Properties StopTime - (TimeBase::UtcT - absolute time) or Timeout (TimeBase::TimeT - - relative time) will be discarded if the object has not been able to - deliver the event in time. See also the cosTime application. - MaxEventsPerConsumer - The maximum number of events the associated object may store before discarding - events in the way described by the DiscardPolicy. - Timeout - If this QoS property is not included in the event, and the Property - StopTimeSupported equals true, this setting will be applied - if events cannot be delivered within its time limit. - - -

Several of the above QoS Properties can be changed during run-time but we strongly advice - not to since, if a relatively large amount of events are waiting for delivery, some of the - QoS settings would require a total reorder of the events. The QoS property ConnectioReliability - may never be updated during run-time since it may cause deadlock. Run-time, in this case, - means activating the Channel by sending the first event.

-
-
- -
- Setting Quality Of Service -

Assume we have a Consumer Admin object which we want to change - the current Quality of Service. Typical usage:

- -QoSPersistent = - [#'CosNotification_Property' - {name='CosNotification':'ConnectionReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'Persistent'())}], -'CosNotification_QoSAdmin':set_qos(Ch, QoSPersistent), - -

If it is not possible to set the requested QoS the UnsupportedQoS - exception is raised, which includes a sequence of PropertyError's - describing which QoS, possible range and why is not allowed. The error - codes are:

- - UNSUPPORTED_PROPERTY - QoS not supported for this type of target object. - UNAVAILABLE_PROPERTY - due to current QoS settings the given property - is not allowed. - UNSUPPORTED_VALUE - property value out of range; valid range is returned. - UNAVAILABLE_VALUE - due to current QoS settings the given value is - not allowed; valid range is returned. - BAD_PROPERTY - unrecognized property. - BAD_TYPE - type of supplied property is incorrect. - BAD_VALUE - illegal value. - -

The CosNotification_QoSAdmin interface also supports an operation - called validate_qos/2. The purpose of this operations is to check - if a QoS setting is supported by the target object and if so, the operation - returns additional properties which could be optionally added as well.

-
- -
- Admin Properties -

The cosNotification application supports the following Admin Properties:

- - - Property - Range - Default - - - MaxQueueLength - 0 - 0 - - - MaxConsumers - long() >= 0 - 0 - - - MaxSuppliers - long() >= 0 - 0 - - Table 2: Supported Admin Properties -
-

According to the OMG specification the default values for Admin Properties - is supposed to be 0, which means that no limit applies to these - properties.

- -

Admin Properties can only be set on a Channel Object level, i.e., - they will not have an impact on any Admin or Proxy Objects. Currently, - setting the Admin Property MaxQueueLength have no effect since - we cannot discard events accordingly to the Quality of Service Property - DiscardPolicy.

-
-
-
-
- diff --git a/lib/cosNotification/doc/src/ch_contents.xml b/lib/cosNotification/doc/src/ch_contents.xml deleted file mode 100644 index 11014f693b..0000000000 --- a/lib/cosNotification/doc/src/ch_contents.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - The cosNotification Application - Niclas Eklund - - 2000-01-31 - 1.0 - ch-contents.xml -
- -
- Content Overview -

The cosNotification documentation is divided into three sections: -

- - -

PART ONE - The User's Guide -

-Description of the cosNotification Application including - services and a small tutorial demonstrating - the development of a simple service.

-
- -

PART TWO - Release Notes -

-A concise history of cosNotification.

-
- -

PART THREE - The Reference Manual -

- A quick reference guide, including a - brief description, to all the functions available in cosNotification.

-
-
-
- -
- Brief Description of the User's Guide -

The User's Guide contains the following parts:

- - -

cosNotification overview

-
- -

cosNotification installation

-
- -

A tutorial example

-
-
-
-
- diff --git a/lib/cosNotification/doc/src/ch_example.xml b/lib/cosNotification/doc/src/ch_example.xml deleted file mode 100644 index a86aaccc82..0000000000 --- a/lib/cosNotification/doc/src/ch_example.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosNotification Examples - Niclas Eklund - - 2000-01-31 - A - ch_example.xml -
- -
- A Tutorial on How to Create a Simple Service - -
- Interface Design -

To use the cosNotification application clients must be implemented. - There are twelve types of clients:

- - Structured Push Consumer - Sequence Push Consumer - Any Push Consumer - Structured Pull Consumer - Sequence Pull Consumer - Any Pull Consumer - Structured Push Supplier - Sequence Push Supplier - Any Push Supplier - Structured Pull Supplier - Sequence Pull Supplier - Any Pull Supplier - -

The interfaces for these participants are defined in CosNotification.idl - and CosNotifyComm.idl.

-
- -
- Generating a Client Interface -

We start by creating an interface which inherits from the correct interface, e.g., CosNotifyComm::SequencePushConsumer. Hence, - we must also implement all operations defined in the SequencePushConsumer interface. The IDL-file could look like:

- -#include - -module myClientImpl { - - interface ownInterface:CosNotifyComm::SequencePushConsumer { - - void ownFunctions(in any NeededArguments) - raises(Systemexceptions,OwnExceptions); - - }; -}; - -#endif - ]]> -

Run the IDL compiler on this file by calling the ic:gen/1 function. - This will produce the API named myClientImpl_ownInterface.erl. - After generating the API stubs and the server skeletons it is time to - implement the servers and if no special options are sent - to the IDl compiler the file name is myClientImpl_ownInterface_impl.erl.

-

The callback module must contain the necessary functions inherited from - CosNotification.idl and CosNotifyComm.idl.

-
- -
- How to Run Everything -

Below is a short transcript on how to run cosNotification.

- - -%% Start Mnesia and Orber -mnesia:delete_schema([node()]), -mnesia:create_schema([node()]), -orber:install([node()]), -mnesia:start(), -orber:start(), - -%% If cosEvent not installed before it is necessary to do it now. -cosEventApp:install(), - -%% Install cosNotification in the IFR. -cosNotificationApp:install(30), - -%% Register the application specific Client implementations -%% in the IFR. -'oe_myClientImpl':'oe_register'(), - -%% Start the cosNotification application. -cosNotificationApp:start(), - -%% Start a factory using the default configuration -ChFac = cosNotificationApp:start_factory(), -%% ... or use configuration parameters. -ChFac = cosNotificationApp:start_factory([]), - -%% Create a new event channel. Note, if no QoS- anr/or Admin-properties -%% are supplied (i.e. empty list) the default settings are used. -{Ch, ChID} = 'CosNotifyChannelAdmin_EventChannelFactory': - create_channel(ChFac, DefaultQoS, DefaultAdmin), - -%% Retrieve a SupplierAdmin and a Consumer Admin. -{AdminSupplier, ASID}= - 'CosNotifyChannelAdmin_EventChannel':new_for_suppliers(Ch, 'OR_OP'), -{AdminConsumer, ACID}= - 'CosNotifyChannelAdmin_EventChannel':new_for_consumers(Ch,'OR_OP'), - -%% Use the corresponding Admin object to get access to wanted Proxies - -%% Create a Push Consumer Proxie, i.e., the Client Push Supplier will -%% push events to this Proxy. -{StructuredProxyPushConsumer,ID11}= 'CosNotifyChannelAdmin_SupplierAdmin': - obtain_notification_push_consumer(AdminSupplier, 'STRUCTURED_EVENT')), - -%% Create Push Suppliers Proxies, i.e., the Proxy will push events to the -%% registered Push Consumers. -{ProxyPushSupplier,I4D}='CosNotifyChannelAdmin_ConsumerAdmin': - obtain_notification_push_supplier(AdminConsumer, 'ANY_EVENT'), -{StructuredProxyPushSupplier,ID5}='CosNotifyChannelAdmin_ConsumerAdmin': - obtain_notification_push_supplier(AdminConsumer, 'STRUCTURED_EVENT'), -{SequenceProxyPushSupplier,ID6}='CosNotifyChannelAdmin_ConsumerAdmin': - obtain_notification_push_supplier(AdminConsumer, 'SEQUENCE_EVENT'), - -%% Create application Clients. We can, for example, start the Clients -%% our selves or look them up in the naming service. This is application -%% specific. -SupplierClient = ... -ConsumerClient1 = ... -ConsumerClient2 = ... -ConsumerClient3 = ... - -%% Connect each Client to corresponding Proxy. -'CosNotifyChannelAdmin_StructuredProxyPushConsumer': - connect_structured_push_supplier(StructuredProxyPushConsumer, SupplierClient), -'CosNotifyChannelAdmin_ProxyPushSupplier': - connect_any_push_consumer(ProxyPushSupplier, ConsumerClient1), -'CosNotifyChannelAdmin_StructuredProxyPushSupplier': - connect_structured_push_consumer(StructuredProxyPushSupplier, ConsumerClient2), -'CosNotifyChannelAdmin_SequenceProxyPushSupplier': - connect_sequence_push_consumer(SequenceProxyPushSupplier, ConsumerClient3), - -

The example above, exemplifies a notification system where the SupplierClient - in some way generates event and pushes them to the proxy. The push supplier - proxies will eventually push the events to each ConsumerClient.

-
-
-
- diff --git a/lib/cosNotification/doc/src/ch_install.xml b/lib/cosNotification/doc/src/ch_install.xml deleted file mode 100644 index c76c68cb42..0000000000 --- a/lib/cosNotification/doc/src/ch_install.xml +++ /dev/null @@ -1,147 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Installing cosNotification - Niclas Eklund - - 2000-01-31 - - ch-install.xml -
- -
- Installation Process -

This chapter describes how to install cosNotificationApp - in an Erlang Environment. -

- -
- Preparation -

Before starting the installation process for cosNotification, - the application Orber must be running.

-
- -
- Configuration -

When using the Notification Service the cosNotification application - first must be installed using cosNotificationApp:install() or - cosNotificationApp:install(Seconds), followed by cosNotificationApp:start().

-

Then the Event Channel Factory - must be started:

- - cosNotificationApp:start_global_factory() - starts and returns a reference to a factory using default configuration parameters. - This operation should be used for a multi-node Orber. - cosNotificationApp:start_global_factory(Options) - starts and returns a reference to a factory using given configuration parameters. - This operation should be used for a multi-node Orber. - cosNotificationApp:start_factory() - starts and returns a reference to a factory using default configuration parameters. - cosNotificationApp:start_factory(Options) - starts and returns a reference to a factory using given configuration parameters. - -

The following options exist:

- - {pullInterval, Seconds} - determine how often Proxy Pull - Consumers will check for new events with the client application. The - default value is 20 seconds. - {filterOp, OperationType} - determine which type of Administrator - objects should be started, i.e., 'OR_OP' or 'AND_OP'. - The default value is 'OR_OP'. - {timeService, TimeServiceObj | 'undefined'} - to be able to use - Start and/or Stop QoS this option must be used. See the function start_time_service/2 - in the cosTime application. The default value is 'undefined'. - {filterOp, OperationType} - determine which type of Administrator - objects should be started, i.e., 'OR_OP' or 'AND_OP'. - The default value is 'OR_OP'. - {gcTime, Seconds} - this option determines how often, for example, proxies - will garbage collect expired events. The default value is 60. - {gcLimit, Amount} - determines how many events will be stored before, for - example, proxies will garbage collect expired events. The default value is 50. This - option is tightly coupled with the QoS property MaxEventsPerConsumer, i.e., - the gcLimit should be less than MaxEventsPerConsumer and greater than 0. - -

It is possible to define a set of global configuration parameters:

- - - Key - Range - Default - - - type_check - true | false - true - - - notify - atom() | false - false - - - max_events - integer() > 0 - 50 - - - interval_events - integer() > 0 - 10000 milliseconds - - - timeout_events - integer() > interval_events - 3000000 milliseconds - - Global Configuration Parameters -
-

Comments on the table 'Global Configuration Parameters':

- - type_check - Determine if supplied IOR:s shall be type checked, i.e. invoking - corba_object:is_a/2, or not. - notify - The given value shall point to an existing module exporting - a function (arity 1) called terminated. This operation - is invoked when a proxy terminates and the argument is a list - containing {proxy, IOR}, {client, IOR} and - {reason, term()}. The return value is ignored. - max_events - If a supplier proxy has not been able to push events to a - consumer and the queue exceeds this limit, then the proxy will - terminate. For this option to have any effect, the - EventReliability and ConnectionReliability QoS - parameters must be set to Persistent. For more information, - see also the QoS chapter. - interval_events - The same requirements as for max_events. When a supplier - proxy detects problems when trying to push events, this parameter - determines how often it should try to call the consumer. - timeout_events - The same requirements as for max_events. If the - proxy has not been able to contact the consumer and this - time-limit is reached, then the proxy will terminate. - -

The Factory is now ready to use. For a more detailed description see - Examples.

-
-
-
- diff --git a/lib/cosNotification/doc/src/ch_introduction.xml b/lib/cosNotification/doc/src/ch_introduction.xml deleted file mode 100644 index 39cd12f1e6..0000000000 --- a/lib/cosNotification/doc/src/ch_introduction.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Introduction to cosNotification - Niclas Eklund - - 2000-01-31 - - ch_introduction.xml -
- -
- Overview -

The cosNotification application is a Notification Service compliant with the OMG - Notification Service CosNotification. -

- -
- Purpose and Dependencies -

cosNotification is dependent on Orber-3.1.7 or later, - which provides CORBA functionality in an Erlang environment, - cosTime-1.0.1 or later and IDL-files to be compiled using IC-4.0.4 or later.

-
- -
- Prerequisites -

To fully understand the concepts presented in the - documentation, it is recommended that the user is familiar - with distributed programming, CORBA and the Orber application. -

-

Recommended reading includes books recommended by the OMG - and Open Telecom Platform Documentation Set. It is also - helpful to have read Concurrent Programming in Erlang.

-
-
-
- diff --git a/lib/cosNotification/doc/src/ch_system.xml b/lib/cosNotification/doc/src/ch_system.xml deleted file mode 100644 index 91375088a0..0000000000 --- a/lib/cosNotification/doc/src/ch_system.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - The Notification Service Components - Niclas Eklund - - 2000-04-13 - - ch_system.xml -
- -
- The Notification Service Components -

This chapter describes the Notification Service Components and how they - interact.

- -
- Components -

There are seven components in the OMG Notification Service architecture. - These are described below:

- - - -Figure 1: The Notification Service Components. - - - Event Channel: acts as a factory for Administrator objects. - Allows clients to set Administrative Properties. - Supplier Administrators: acts as a factory for Proxy Consumers. - Administrators are started as 'AND_OP'- or 'OR_OP'-type, - which determines if events must be validated using both the Administrators - associated Filter and/or its Proxy children Filters. - Consumer Administrators: acts in the same way as Supplier Administrators - but handle Proxy Suppliers. - Consumer Proxy: is connected to a client application. Can be - started as Pull or Push object. If the proxy is Push style - the client application must push events to the Proxy, otherwise the Proxy is - supposed to Pull events. The CosNotification::AdminProperties is - used to set the pacing interval. - Supplier Proxy: Acts in a similar way as the Consumer Proxy, but - if started as a Push proxy it will push events to the client - application. - Filters: used to filter events. May be associated with Proxies - and Administrators. - Mapping Filters: used to override events Quality of Service - settings. Can only be associated with Consumer Administrators and - Proxy Suppliers. - -

When a Proxy is started it is set to accept CORBA::Any, - CosNotification::StructuredEvent or CosNotification::EventBatch - (a sequence of structured events).

-

If a Proxy is supposed to deliver structured events to a client application - and receives an CORBA::Any event, the event is converted to a - structured event with type_name set to "%ANY" and the - event is stored in remainder_of_body.

-

If a Proxy is supposed to deliver CORBA::Any events to a client application - and receives a structured event, the event is stored in an Any type. The - Any Type Code will be equal to the CosNotification::StructuredEvent - Type Code.

-
-
-
- diff --git a/lib/cosNotification/doc/src/cosNotificationApp.xml b/lib/cosNotification/doc/src/cosNotificationApp.xml deleted file mode 100644 index 4f662a5dc4..0000000000 --- a/lib/cosNotification/doc/src/cosNotificationApp.xml +++ /dev/null @@ -1,309 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosNotificationApp - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 2000-01-31 - PA1 -
- cosNotificationApp - The main module of the cosNotification application. - -

To get access to the record definitions for the structures use:

--include_lib("cosNotification/include/*.hrl").

-

This module contains the functions for starting and stopping the application.

-
- - - install() -> Return - Install the cosNotification application - - Return = ok | {'EXCEPTION', E} - - -

This operation installs the cosNotification application.

-
-
- - install(Seconds) -> Return - Install the cosNotification application - - Return = ok | {'EXCEPTION', E} - - -

This operation installs the cosNotification application using Seconds - delay between each block, currently 6, of IFR-registrations. This approach - spreads the IFR database access over a period of time to allow other - applications to run smother.

-
-
- - install_event() -> Return - Install the necessary cosEvent interfaces - - Return = ok | {'EXCEPTION', E} - - -

This operation, which may only be used if it is impossible to - upgrade to cosEvent-2.0 or later, installs the necessary - cosEvent interfaces. If cosEvent-2.0 is available, use - cosEventApp:install() instead.

-
-
- - install_event(Seconds) -> Return - Install the necessary cosEvent interfaces - - Return = ok | {'EXCEPTION', E} - - -

This operation, which may only be used if it is impossible to - upgrade to cosEvent-2.0 or later, installs the necessary cosEvent - interfaces using Seconds delay between each block of - IFR-registrations. If cosEvent-2.0 is available, use - cosEventApp:install() instead.

-
-
- - uninstall() -> Return - Uninstall the cosNotification application - - Return = ok | {'EXCEPTION', E} - - -

This operation uninstalls the cosNotification application.

-
-
- - uninstall(Seconds) -> Return - Uninstall the cosNotification application - - Return = ok | {'EXCEPTION', E} - - -

This operation uninstalls the cosNotification application using Seconds - delay between each block, currently 6, of IFR-unregistrations. This approach - spreads the IFR database access over a period of time to allow other - applications to run smother.

-
-
- - uninstall_event() -> Return - Uninstall the inherited cosEvent interfaces - - Return = ok | {'EXCEPTION', E} - - -

This operation uninstalls the inherited cosEvent interfaces. If cosEvent - is in use this function may not be used. This function may only be used if - cosNotificationApp:install_event/1/2 was used. If not, use - cosEventApp:uninstall() instead.

-
-
- - uninstall_event(Seconds) -> Return - Uninstall the inherited cosEvent interfaces - - Return = ok | {'EXCEPTION', E} - - -

This operation uninstalls the inherited cosEvent interfaces, using Seconds - delay between each block of IFR-unregistrations. If cosEvent - is in use this function may not be used. This function may only be used if - cosNotificationApp:install_event/1/2 was used. If not, use - cosEventApp:uninstall() instead.

-
-
- - start() -> Return - Start the cosNotification application - - Return = ok | {error, Reason} - - -

This operation starts the cosNotification application.

-
-
- - stop() -> Return - Stop the cosNotification application - - Return = ok | {error, Reason} - - -

This operation stops the cosNotification application.

-
-
- - start_global_factory() -> ChannelFactory - Start a global channel factory as default - - ChannelFactory = #objref - - -

This operation creates a - Event Channel Factory - should be used for a multi-node Orber. - The Factory is used to create a new - channel.

-
-
- - start_global_factory(Options) -> ChannelFactory - Start a global channel factory with options - - Options = [Option] - Option = {pullInterval, Seconds} | {filterOp, Op} | {gcTime, Seconds} | {gcLimit, Anount} | {timeService, #objref} - ChannelFactory = #objref - - -

This operation creates a - Event Channel Factory and - should be used for a multi-node Orber. - The Factory is used to create a new - channel.

-

- - {pullInterval, Seconds} - determine how often Proxy Pull - Consumers will check for new events with the client application. The - default value is 20 seconds. - {filterOp, OperationType} - determine which type of Administrator - objects should be started, i.e., 'OR_OP' or 'AND_OP'. - The default value is 'OR_OP'. - {timeService, TimeServiceObj | 'undefined'} - to be able to use - Start and/or Stop QoS this option must be used. See the function start_time_service/2 - in the cosTime application. The default value is 'undefined'. - {filterOp, OperationType} - determine which type of Administrator - objects should be started, i.e., 'OR_OP' or 'AND_OP'. - The default value is 'OR_OP'. - {gcTime, Seconds} - this option determines how often, for example, proxies - will garbage collect expired events. The default value is 60. - {gcLimit, Amount} - determines how many events will be stored before, for - example, proxies will garbage collect expired events. The default value is 50. This - option is tightly coupled with the QoS property MaxEventsPerConsumer, i.e., - the gcLimit should be less than MaxEventsPerConsumer and greater than 0. - -
-
- - start_factory() -> ChannelFactory - Start a channel factory as default - - ChannelFactory = #objref - - -

This operation creates a - Event Channel Factory. - The Factory is used to create a new - channel.

-
-
- - start_factory(Options) -> ChannelFactory - Start a channel factory with options - - Options = [Option] - Option = {pullInterval, Seconds} | {filterOp, Op} | {gcTime, Seconds} | {gcLimit, Amount} | {timeService, #objref} - ChannelFactory = #objref - - -

This operation creates a - Event Channel Factory. - The Factory is used to create a new - channel.

-
-
- - stop_factory(ChannelFactory) -> Reply - Terminate the target object - - ChannelFactory = #objref - Reply = ok | {'EXCEPTION', E} - - -

This operation stop the target channel factory.

-
-
- - start_filter_factory() -> FilterFactory - Start a filter factory - - FilterFactory = #objref - - -

This operation creates a - Filter Factory. - The Factory is used to create a new - Filter's and - MappingFilter's.

-
-
- - stop_filter_factory(FilterFactory) -> Reply - Terminate the target object - - FilterFactory = #objref - Reply = ok | {'EXCEPTION', E} - - -

This operation stop the target filter factory.

-
-
- - create_structured_event(Domain, Type, Event, VariableHeader, FilterableBody, BodyRemainder) -> Reply - Create a structured event - - Domain = string() - Type = string() - Event = string() - VariableHeader = [CosNotification::Property] - FilterableBody = [CosNotification::Property] - BodyRemainder = #any data-type - Reply = CosNotification::StructuredEvent | {'EXCEPTION', E} - - -

An easy way to create a structured event is to use this function. - Simple typechecks are performed and if one of the arguments is not - correct a 'BAD_PARAM' exception is thrown.

-
-
- - type_check() -> Reply - Return the value of the configuration parameter type_check - - Reply = true | false - - -

This operation returns the value of the configuration parameter - type_check.

-
-
-
- -
- diff --git a/lib/cosNotification/doc/src/eventstructure.gif b/lib/cosNotification/doc/src/eventstructure.gif deleted file mode 100644 index 879c96f980..0000000000 Binary files a/lib/cosNotification/doc/src/eventstructure.gif and /dev/null differ diff --git a/lib/cosNotification/doc/src/notes.xml b/lib/cosNotification/doc/src/notes.xml deleted file mode 100644 index bf0fc73548..0000000000 --- a/lib/cosNotification/doc/src/notes.xml +++ /dev/null @@ -1,632 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosNotification Release Notes - - - - - 2000-01-31 - A - notes.xml -
- -
cosNotification 1.2.3 - -
Fixed Bugs and Malfunctions - - -

Removed all old unused files in the documentation. -

-

- Own Id: OTP-14475 Aux Id: ERL-409, PR-1493

-
-
-
- -
- -
cosNotification 1.2.2 - -
Improvements and New Features - - -

- Internal changes

-

- Own Id: OTP-13551

-
-
-
- -
- -
cosNotification 1.2.1 - -
Improvements and New Features - - -

Suppress Dialyzer warnings.

-

- Own Id: OTP-12862

-
-
-
- -
- -
cosNotification 1.2 - -
Improvements and New Features - - -

Remove the usage of erlang:now() from all Corba - applications and use the new rand module instead of - random.

-

- Own Id: OTP-12687

-
-
-
- -
- -
cosNotification 1.1.21 - -
Improvements and New Features - - -

The default encoding of Erlang files has been changed - from ISO-8859-1 to UTF-8.

The encoding of XML - files has also been changed to UTF-8.

-

- Own Id: OTP-10907

-
-
-
- -
- -
cosNotification 1.1.20 - -
Improvements and New Features - - -

Postscript files no longer needed for the generation - of PDF files have been removed.

-

- Own Id: OTP-11016

-
-
-
- -
- -
cosNotification 1.1.19 - -
Improvements and New Features - - -

- Misc build updates

-

- Own Id: OTP-10784

-
-
-
- -
- -
cosNotification 1.1.18 - -
Improvements and New Features - - -

Erlang/OTP can now be built using parallel make if you - limit the number of jobs, for instance using 'make - -j6' or 'make -j10'. 'make -j' does not - work at the moment because of some missing - dependencies.

-

- Own Id: OTP-9451

-
-
-
- -
- -
cosNotification 1.1.17 - -
Improvements and New Features - - -

- Removed superfluous usage of shy in the documentation since it can cause problem if - a buggy tool is used.

-

- Own Id: OTP-9319 Aux Id:

-
-
-
-
- -
cosNotification 1.1.16 - -
Improvements and New Features - - -

- Eliminated Dialyzer warnings when using exit or throw.

-

- Own Id: OTP-9050

-
-
-
-
- -
cosNotification 1.1.15 - -
Improvements and New Features - - -

- Switched from using the deprecated regexp to re instead.

-

- Own Id: OTP-8846

-
-
-
- -
- -
- cosNotification 1.1.14 -
- Improvements and New Features - - -

- Test suites published.

-

- Own Id: OTP-8543 Aux Id:

-
-
-
- -
- Fixed Bugs and Malfunctions - - -

Added missing trailing bracket to define in hrl-file.

-

Own Id: OTP-8489 Aux Id:

-
-
-
-
- -
- cosNotification 1.1.14 -
- Improvements and New Features - - -

- Test suites published.

-

- Own Id: OTP-8543 Aux Id:

-
-
-
- -
- Fixed Bugs and Malfunctions - - -

Added missing trailing bracket to define in hrl-file.

-

Own id: OTP-8489 Aux Id:

-
-
-
-
- -
- cosNotification 1.1.13 - -
- Fixed Bugs and Malfunctions - - -

Removed superfluous VT in the documentation.

-

Own Id: OTP-8353 Aux Id:

-
- -

Removed superfluous backslash in the documentation.

-

Own Id: OTP-8354 Aux Id:

-
- -

The documentation EIX file was not generated.

-

Own Id: OTP-8355 Aux Id:

-
-
-
-
- -
- cosNotification 1.1.12 - -
- Improvements and New Features - - -

- The documentation is now built with open source tools (xsltproc and fop) - that exists on most platforms. One visible change is that the frames are removed.

-

- Own Id: OTP-8201 Aux Id:

-
-
-
-
- -
- cosNotification 1.1.11 - -
- Improvements and New Features - - -

Obsolete guards, e.g. record vs is_record, has been changed - to avoid compiler warnings.

-

Own Id: OTP-7987

-
-
-
-
- -
- cosNotification 1.1.10 - -
- Fixed Bugs and Malfunctions - - -

Updated file headers.

-

Own Id: OTP-7837 Aux Id:

-
-
-
-
- -
- cosNotification 1.1.9 - -
- Fixed Bugs and Malfunctions - - -

Documentation source included in open source releases.

-

Own Id: OTP-7595 Aux Id:

-
-
-
-
- -
- cosNotification 1.1.8 - -
- Fixed Bugs and Malfunctions - - -

The CosNotification proxy objects ignored the gcLimit option, instead - the gcTime value was used.

-

Own Id: OTP-7553 Aux Id:

-
-
-
-
- -
- cosNotification 1.1.7 - -
- Improvements and New Features - - -

Updated file headers.

-

Own Id: OTP-7011

-
-
-
-
- -
- cosNotification 1.1.6 - -
- Improvements and New Features - - -

The documentation source has been converted from SGML to XML.

-

Own Id: OTP-6754

-
-
-
-
- -
- cosNotification 1.1.5 - -
- Improvements and New Features - - -

Minor Makefile changes.

-

Own Id: OTP-6701

-
-
-
-
- -
- cosNotification 1.1.4 - -
- Improvements and New Features - - -

Removed some unused code.

-

Own Id: OTP-6527

-
-
-
-
- -
- cosNotification 1.1.3 - -
- Improvements and New Features - - -

A user can now define the QoS EventReliability to be - Persistent. Note, this is only a lightweight version - and events will be lost if a proxy is terminated.

-

Own Id: OTP-5923

-
-
-
-
- -
- cosNotification 1.1.2 - -
- Improvements and New Features - - -

Possible to configure cosNotification not to type check, - by invoking corba_object:is_a/2, supplied IOR:s. When - a type check fails, the feedback has been improved.

-

Own Id: OTP-5823 Aux Id: seq10143

-
-
-
-
- -
- cosNotification 1.1.1 - -
- Fixed Bugs and Malfunctions - - -

The app-file contained duplicated modules.

-

Own Id: OTP-4976

-
-
-
-
- -
- cosNotification 1.1 - -
- Improvements and New Features - - -

The stub/skeleton-files generated by IC have been improved, - i.e., depending on the IDL-files, reduced the size of the - erl- and beam-files and decreased dependencies off Orber's - Interface Repository. It is necessary to re-compile all IDL-files - and use COS-applications, including Orber, compiled with - IC-4.2.

-

Own Id: OTP-4576

-
-
-
-
- -
- cosNotification 1.0.6 - -
- Fixed Bugs and Malfunctions - - -

The exception CosNotifyFilter::InvalidValue, raised by the operation - CosNotifyFilter::MappingFilter::add_mapping_constraints, did not contain - correct data in the body. Hence, it was not possible to pass this - exception to another ORB.

-

Own Id: OTP-4412

-
- -

It was not possible to set the QoS property PacingInterval to zero and - the default value was not compliant with the OMG specification. The - default value for MaximumBatchSize have also been changed du to the - same reason.

-

Own Id: OTP-4413, OTP-4414

-
-
-
- -
- Incompatibilities - - -

The default value, for the QoS properties PacingInterval and MaximumBatchSize, - have been changed to zero (i.e. no timeout) and 1 respectively, which is - compliant with the OMG specification.

-

Own Id: OTP-4413, OTP-4414

-
-
-
-
- -
- cosNotification 1.0.5 - -
- Fixed Bugs and Malfunctions - - -

If one tries to set an unavailable/incorrect property or property value, an - exception is thrown. In some cases the exception was not correct, which - would cause problems if communicating via IIOP.

-

Own Id: OTP-4340

-
- -

When using Filter's, with the QoS OrderPolicy set to FifoOrder, - and passing a sequence of structured events, they could be - delivered in the wrong order.

-

Own Id: OTP-4272

-
- -

If Filter's where attached to Supplier proxies it could cause - the Proxy to terminate.

-

Own Id: OTP-4272

-
-
-
-
- -
- cosNotification 1.0.4 - -
- Fixed Bugs and Malfunctions - - -

When passing event sequences, the PushSuppliers and PullSuppliers - could crash if the objects had Filter objects associated and - only a subset of the sequences where approved.

-

Own Id: OTP-4099

-
- -

SupplierAdmin's did not filter any events, even though Filter objects - had been attached to the SupplierAdmin.

-

Own Id: OTP-4098

-
- -

If one used the '_get_default_supplier_admin'/1, exported by the - CosNotifyChannelAdmin_EventChannel-module, it resulted in a loop - which overloaded the channel. This is no longer the case.

-

Own Id: OTP-4086

-
- -

If one used the '_get_default_filter_factory'/1, exported by the - CosNotifyChannelAdmin_EventChannel-module, a new instance was created - each time. Now fixed.

-

Own Id: OTP-4092

-
-
-
- -
- Incompatibilities - - -

The include paths for CosNotification.idl have been changed. - Hence, if you include this file in your own IDL-files you must - update your paths to also point to where the cosEvent IDL-files are - stored.

-

Own Id: OTP-4093

-
-
-
-
- -
- cosNotification 1.0.3 - -
- Improvements and New Features - - -

It is now possible to start global channel factories.

-

Own Id: OTP-4078

-
- -

The Orber, version 3.2.5 or later, configuration parameter - orber_debug_level can now be used to generate reports when abnormal - situations occurs. For more information consult the Orber User's Guide. - Note, it is not recommended to use this option for delivered systems - since some of the reports is not to be considered as errors. - The value of orber_debug_level must be 3, or higher, for reports to - be generated.

-

Own Id: OTP-4077, OTP-3962

-
-
-
- -
- Fixed Bugs and Malfunctions - - -

When using the cosEvent API accessing a cosNotification admins - the objects returned by the functions obtain_push_supplier, - obtain_pull_supplier, obtain_push_consumer and obtain_pull_consumer - was not of the correct type. Due to the interface change - it is not possible to upgrade during runtime.

-

Own Id: OTP-4079

-
-
-
-
- -
- cosNotification 1.0.2 - -
- Improvements and New Features - - -

First release of the cosNotification application.

-

Own Id: -

-
-
-
-
-
- diff --git a/lib/cosNotification/doc/src/notificationFlow.gif b/lib/cosNotification/doc/src/notificationFlow.gif deleted file mode 100644 index 31d6ee97fb..0000000000 Binary files a/lib/cosNotification/doc/src/notificationFlow.gif and /dev/null differ diff --git a/lib/cosNotification/doc/src/part.xml b/lib/cosNotification/doc/src/part.xml deleted file mode 100644 index 9cc5a8a95a..0000000000 --- a/lib/cosNotification/doc/src/part.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosNotification User's Guide - Niclas Eklund - - 2000-01-31 - 1.0 -
- -

The cosNotification application is an Erlang implementation - of the OMG CORBA Notification Service.

-
- - - - - - - -
- diff --git a/lib/cosNotification/doc/src/ref_man.xml b/lib/cosNotification/doc/src/ref_man.xml deleted file mode 100644 index 58fb4febd2..0000000000 --- a/lib/cosNotification/doc/src/ref_man.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosNotification Reference Manual - Niclas Eklund - - 2000-01-31 - 1.0 -
- -

The cosNotification application is an Erlang implementation - of the OMG CORBA Notification Service.

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- diff --git a/lib/cosNotification/ebin/.gitignore b/lib/cosNotification/ebin/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosNotification/examples/.gitignore b/lib/cosNotification/examples/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosNotification/include/.gitignore b/lib/cosNotification/include/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosNotification/info b/lib/cosNotification/info deleted file mode 100644 index 1b634eb124..0000000000 --- a/lib/cosNotification/info +++ /dev/null @@ -1,3 +0,0 @@ -group: orb -short: Orber OMG Notification Service - diff --git a/lib/cosNotification/priv/.gitignore b/lib/cosNotification/priv/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosNotification/src/CosEvent.cfg b/lib/cosNotification/src/CosEvent.cfg deleted file mode 100644 index e3399139a4..0000000000 --- a/lib/cosNotification/src/CosEvent.cfg +++ /dev/null @@ -1,20 +0,0 @@ -{this, "CosEventChannelAdmin::EventChannel"}. -{{handle_info, "CosEventChannelAdmin::EventChannel"}, true}. -{this, "CosEventChannelAdmin::EventChannelFactory"}. -{{handle_info, "CosEventChannelAdmin::EventChannelFactory"}, true}. -{this, "CosEventChannelAdmin::SupplierAdmin"}. -{{handle_info, "CosEventChannelAdmin::SupplierAdmin"}, true}. -{this, "CosEventChannelAdmin::ConsumerAdmin"}. -{{handle_info, "CosEventChannelAdmin::ConsumerAdmin"}, true}. -{this, "CosEventChannelAdmin::ProxyPushSupplier"}. -{{handle_info, "CosEventChannelAdmin::ProxyPushSupplier"}, true}. -{{impl, "CosEventChannelAdmin::ProxyPushSupplier"}, "PusherSupplier_impl"}. -{this, "CosEventChannelAdmin::ProxyPullSupplier"}. -{{handle_info, "CosEventChannelAdmin::ProxyPullSupplier"}, true}. -{{impl, "CosEventChannelAdmin::ProxyPullSupplier"}, "PullerSupplier_impl"}. -{this, "CosEventChannelAdmin::ProxyPushConsumer"}. -{{handle_info, "CosEventChannelAdmin::ProxyPushConsumer"}, true}. -{{impl, "CosEventChannelAdmin::ProxyPushConsumer"}, "PusherConsumer_impl"}. -{this, "CosEventChannelAdmin::ProxyPullConsumer"}. -{{handle_info, "CosEventChannelAdmin::ProxyPullConsumer"}, true}. -{{impl, "CosEventChannelAdmin::ProxyPullConsumer"}, "PullerConsumer_impl"}. diff --git a/lib/cosNotification/src/CosNotification.cfg b/lib/cosNotification/src/CosNotification.cfg deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosNotification/src/CosNotification.idl b/lib/cosNotification/src/CosNotification.idl deleted file mode 100644 index e080b44b0c..0000000000 --- a/lib/cosNotification/src/CosNotification.idl +++ /dev/null @@ -1,146 +0,0 @@ -#ifndef _COS_NOTIFICATION_IDL_ -#define _COS_NOTIFICATION_IDL_ - -#pragma prefix "omg.org" - -#include"CosEventChannelAdmin.idl" -#include"CosEventComm.idl" - -module CosNotification { - typedef string Istring; - typedef Istring PropertyName; - typedef any PropertyValue; - struct Property { - PropertyName name; - PropertyValue value; - }; - typedef sequence PropertySeq; - // The following are the same, but serve different purposes. - typedef PropertySeq OptionalHeaderFields; - typedef PropertySeq FilterableEventBody; - typedef PropertySeq QoSProperties; - typedef PropertySeq AdminProperties; - struct EventType { - string domain_name; - string type_name; - }; - typedef sequence EventTypeSeq; - struct PropertyRange { - PropertyValue low_val; - PropertyValue high_val; - }; - struct NamedPropertyRange { - PropertyName name; - PropertyRange range; - }; - - typedef sequence NamedPropertyRangeSeq; - - enum QoSError_code { - UNSUPPORTED_PROPERTY, - UNAVAILABLE_PROPERTY, - UNSUPPORTED_VALUE, - UNAVAILABLE_VALUE, - BAD_PROPERTY, - BAD_TYPE, - BAD_VALUE - }; - - struct PropertyError { - QoSError_code code; - PropertyName name; - PropertyRange available_range; - }; - - typedef sequence PropertyErrorSeq; - exception UnsupportedQoS { PropertyErrorSeq qos_err; }; - exception UnsupportedAdmin { PropertyErrorSeq admin_err; }; - - // Define the Structured Event structure - struct FixedEventHeader { - EventType event_type; - string event_name; - }; - struct EventHeader { - FixedEventHeader fixed_header; - OptionalHeaderFields variable_header; - }; - - struct StructuredEvent { - EventHeader header; - FilterableEventBody filterable_data; - any remainder_of_body; - }; // StructuredEvent - - typedef sequence EventBatch; - - // The following constant declarations define the standard - // QoS property names and the associated values each property - // can take on. The name/value pairs for each standard property - // are grouped, beginning with a string constant defined for the - // property name, followed by the values the property can take on. - const string EventReliability = "EventReliability"; - const short BestEffort = 0; - const short Persistent = 1; - const string ConnectionReliability = "ConnectionReliability"; - - // Can take on the same values as EventReliability - const string Priority = "Priority"; - const short LowestPriority = -32767; - const short HighestPriority = 32767; - const short DefaultPriority = 0; - const string StartTime = "StartTime"; - - // StartTime takes a value of type TimeBase::UtcT. - const string StopTime = "StopTime"; - // StopTime takes a value of type TimeBase::UtcT. - const string Timeout = "Timeout"; - // Timeout takes on a value of type TimeBase::TimeT - const string OrderPolicy = "OrderPolicy"; - const short AnyOrder = 0; - const short FifoOrder = 1; - const short PriorityOrder = 2; - const short DeadlineOrder = 3; - const string DiscardPolicy = "DiscardPolicy"; - // DiscardPolicy takes on the same values as OrderPolicy, plus - const short LifoOrder = 4; - const short RejectNewEvents = 5; - const string MaximumBatchSize = "MaximumBatchSize"; - // MaximumBatchSize takes on a value of type long - const string PacingInterval = "PacingInterval"; - // PacingInterval takes on a value of type TimeBase::TimeT - const string StartTimeSupported = "StartTimeSupported"; - // StartTimeSupported takes on a boolean value - const string StopTimeSupported = "StopTimeSupported"; - // StopTimeSupported takes on a boolean value - const string MaxEventsPerConsumer = "MaxEventsPerConsumer"; - // MaxEventsPerConsumer takes on a value of type long - - interface QoSAdmin { - QoSProperties get_qos(); - void set_qos ( in QoSProperties qos) - raises ( UnsupportedQoS ); - void validate_qos (in QoSProperties required_qos, - out NamedPropertyRangeSeq available_qos ) - raises ( UnsupportedQoS ); - }; // QosAdmin - - // Admin properties are defined in similar manner as QoS - // properties. The only difference is that these properties - // are related to channel administration policies, as opposed - // message quality of service - const string MaxQueueLength = "MaxQueueLength"; - // MaxQueueLength takes on a value of type long - const string MaxConsumers = "MaxConsumers"; - // MaxConsumers takes on a value of type long - const string MaxSuppliers = "MaxSuppliers"; - // MaxSuppliers takes on a value of type long - interface AdminPropertiesAdmin { - AdminProperties get_admin(); - void set_admin (in AdminProperties admin) - raises ( UnsupportedAdmin); - };// AdminPropertiesAdmin -}; // CosNotification - -#endif /* ifndef _COS_NOTIFICATION_IDL_ */ - diff --git a/lib/cosNotification/src/CosNotification_Common.erl b/lib/cosNotification/src/CosNotification_Common.erl deleted file mode 100644 index 530641b7a5..0000000000 --- a/lib/cosNotification/src/CosNotification_Common.erl +++ /dev/null @@ -1,1240 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%-------------------------------------------------------------------- -%% File : CosNotification_Common.erl -%% Purpose : -%%-------------------------------------------------------------------- - --module('CosNotification_Common'). - - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). - --include("CosNotification_Definitions.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%% External MISC --export([get_option/3, - create_name/0, - create_name/1, - create_name/2, - create_id/0, - create_id/1, - is_debug_compiled/0, - type_check/2, - send_stubborn/5, - create_link/3, - disconnect/3, - do_disconnect/3, - notify/1]). - -%% Internal AdminProperties --export([init_adm/1, - set_adm/2, - 'MaxQueueLength'/6, - 'MaxConsumers'/6, - 'MaxSuppliers'/6]). -%% Internal QoS --export([init_qos/1, - set_qos/5, - validate_qos/5, - validate_event_qos/2, - 'EventReliability'/6, - 'ConnectionReliability'/6, - 'Priority'/6, - 'StartTimeSupported'/6, - 'StopTimeSupported'/6, - 'Timeout'/6, - 'OrderPolicy'/6, - 'DiscardPolicy'/6, - 'MaximumBatchSize'/6, - 'PacingInterval'/6, - 'MaxEventsPerConsumer'/6]). - -%%--------------- DEFINITIONS OF CONSTANTS ------------------- -%%--------------- EXTERNAL MISC FUNCTIONS -------------------- -%%------------------------------------------------------------ -%% function : create_link -%% Arguments: Module - which Module to call -%% Env/ArgList - ordinary oe_create arguments. -%% Returns : -%% Exception: -%% Effect : Necessary since we want the supervisor to be a -%% 'simple_one_for_one'. Otherwise, using for example, -%% 'one_for_one', we have to call supervisor:delete_child -%% to remove the childs startspecification from the -%% supervisors internal state. -%%------------------------------------------------------------ -create_link(Module, Env, ArgList) -> - Module:oe_create_link(Env, ArgList). - -%%-----------------------------------------------------------% -%% function : get_option -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -get_option(Key, OptionList, DefaultList) -> - case lists:keysearch(Key, 1, OptionList) of - {value,{Key,Value}} -> - Value; - _ -> - case lists:keysearch(Key, 1, DefaultList) of - {value,{Key,Value}} -> - Value; - _-> - {error, "Invalid option"} - end - end. - -%%------------------------------------------------------------ -%% function : create_name -%% Arguments: -%% Returns : -%% Effect : Create a unique name to use when, for eaxmple, starting -%% a new server. -%%------------------------------------------------------------ -create_name() -> - Time = erlang:system_time(), - Unique = erlang:unique_integer([positive]), - lists:concat(['oe_',node(),'_',Time,'_',Unique]). - - -%%-----------------------------------------------------------% -%% function : create_name/1 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -create_name(Type) -> - Time = erlang:system_time(), - Unique = erlang:unique_integer([positive]), - lists:concat(['oe_',node(),'_',Type,'_',Time,'_',Unique]). - -%%-----------------------------------------------------------% -%% function : create_name/2 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -create_name(Name,Type) -> - Time = erlang:system_time(), - Unique = erlang:unique_integer([positive]), - lists:concat(['oe_',node(),'_',Type,'_',Name,'_',Time,'_',Unique]). - -%%------------------------------------------------------------ -%% function : create_id/0 -%% Arguments: - -%% Returns : id (long) =/= 0 -%% Both default Admin:s have the unique id 0 (OMG spec, 98-11-01, -%% Notification p 148), hence, we may not return 0. -%% Exception: -%% Purpose : Throughout the CosNotification service we use, -%% according to the OMG specification, id:s (long), -%% which must be "unique", to retrieve object references. -%% For example: CosNotifyChannelAdmin::ChannelId/AdminID. -%%------------------------------------------------------------ -create_id(-1) -> - 1; -create_id(2147483647) -> - -2147483648; -create_id(OldID) -> - OldID+1. - -create_id() -> - {_A,_B,C}=erlang:timestamp(), - C. - -%%------------------------------------------------------------ -%% function : type_check -%% Arguments: Obj - objectrefernce to test. -%% Mod - Module which contains typeID/0. -%% Returns : 'ok' or raises exception. -%% Effect : -%%------------------------------------------------------------ -type_check(Obj, Mod) -> - case cosNotificationApp:type_check() of - false -> - ok; - _ -> - case catch corba_object:is_a(Obj,Mod:typeID()) of - true -> - ok; - false -> - orber:dbg("[~p] CosNotification_Common:type_check(~p);~n" - "The supplied Object is not or does not inherrit from: ~p", - [?LINE, Obj, Mod], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}); - {'EXCEPTION', E} -> - orber:dbg("[~p] CosNotification_Common:type_check(~p, ~p);~n" - "Failed due to: ~p", - [?LINE, Obj, Mod, E], ?DEBUG_LEVEL), - corba:raise(E); - What -> - orber:dbg("[~p] CosNotification_Common:type_check(~p, ~p);~n" - "Failed due to: ~p", - [?LINE, Obj, Mod, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end - end. - - -%%-----------------------------------------------------------% -%% function : notify -%% Arguments: Items - [Item] -%% Item - {proxy, IOR} | {client, IOR} | {reason, term()} -%% Returns : 'ok' or raises exception. -%% Effect : -%%------------------------------------------------------------ -notify(Items) -> - case cosNotificationApp:notify() of - false -> - ok; - Module -> - catch Module:terminated(Items), - ok - end. - - -%%------------------------------------------------------------ -%% function : send_stubborn -%% Arguments: M - module -%% F - function -%% A - arguments -%% MaxR - Maximum no retries -%% Wait - sleep Wait seconds before next try. -%% Returns : see effect -%% Exception: -%% Effect : Retries repeatidly untill anything else besides -%% 'EXIT', 'COMM_FAILURE' or 'OBJECT_NOT_EXIST' -%%------------------------------------------------------------ - -send_stubborn(M, F, A, MaxR, Wait) when is_list(A) -> - send_stubborn(M, F, A, MaxR, Wait, 0); -send_stubborn(M, F, A, MaxR, Wait) -> - send_stubborn(M, F, [A], MaxR, Wait, 0). -send_stubborn(M, F, A, MaxR, _Wait, MaxR) -> - orber:dbg("[~p] CosNotification_Common:send_stubborn( ~p ~p ~p ~p).~n" - "Failed to deliver the event.~n", [?LINE, M,F,A,MaxR], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}); -send_stubborn(M, F, A, MaxR, Wait, Times) -> - ?debug_print("~p:~p(~p) # of retries: ~p~n", [M,F,A, Times]), - case catch apply(M,F,A) of - {'EXCEPTION', E} when is_record(E, 'COMM_FAILURE')-> - NewTimes = Times +1, - timer:sleep(Wait), - send_stubborn(M, F, A, MaxR, Wait, NewTimes); - {'EXIT', _} -> - NewTimes = Times +1, - timer:sleep(Wait), - send_stubborn(M, F, A, MaxR, Wait, NewTimes); - Other -> - Other - end. - - -%%-----------------------------------------------------------% -%% function : disconnect -%% Arguments: Module - one of the interfaces defined in CosEventComm. -%% Function - the appropriate disconnect function. -%% Object - the client object reference. -%% Returns : ok -%% Exception: -%% Effect : If the process would try to diconnect itself it could -%% result in a deadlock. Hence, we spawn a new process to do it. -%%------------------------------------------------------------ -disconnect(Module, Function, Object) -> - spawn(?MODULE, do_disconnect, [Module, Function, Object]), - ok. - -do_disconnect(Module, Function, Object) -> - catch Module:Function(Object), - ?DBG("Disconnect ~p:~p(..).~n", [Module, Function]), - ok. - - - -%%------------------------------------------------------------ -%% function : is_debug_compiled -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ - --ifdef(debug). - is_debug_compiled() -> true. --else. - is_debug_compiled() -> false. --endif. - - -%%------------------------------------------------------------ -%%--------------- AdminPropertiesAdmin ----------------------- -%%------------------------------------------------------------ -%%------------------------------------------------------------ -%% function : init_adm -%% Arguments: Wanted - requested Admins to be set. -%% Returns : #'CosNotification_UnsupportedAdmin'{} | -%% {NewAdmProperties, [MaxQ, MaxC, MaxS]} -%% Effect : may only be used when creating a channel!!!!!!!! -%%------------------------------------------------------------ -init_adm(Wanted) -> - {NewA,_} = set_properties(Wanted, ?not_DEFAULT_ADMINPROPERTIES, channelAdm, - ?not_SUPPORTED_ADMINPROPERTIES, [], [], - false, false, false), - {NewA, [extract_value(NewA, ?not_MaxQueueLength), - extract_value(NewA, ?not_MaxConsumers), - extract_value(NewA, ?not_MaxSuppliers)]}. - -set_adm(Wanted, Current) -> - {NewA,_} = set_properties(Wanted, Current, channelAdm, - ?not_SUPPORTED_ADMINPROPERTIES, - [], [], false, false, false), - {NewA, [extract_value(NewA, ?not_MaxQueueLength), - extract_value(NewA, ?not_MaxConsumers), - extract_value(NewA, ?not_MaxSuppliers)]}. - -'MaxQueueLength'(Req,channelAdm,_, _, _, _) -> admin_ok(Req). -'MaxConsumers'(Req,channelAdm,_, _, _, _)-> admin_ok(Req). -'MaxSuppliers'(Req,channelAdm,_, _, _, _)-> admin_ok(Req). - -admin_ok(Req) -> - case any:get_value(Req#'CosNotification_Property'.value) of - Val when is_integer(Val) andalso Val >= 0 -> - {ok, Req}; - _ -> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_TYPE', - name = Req#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - } - end. - - -%%------------------------------------------------------------ -%%--------------- QOS FUNCTIONS ------------------------------ -%%------------------------------------------------------------ -%%------------------------------------------------------------ -%% function : init_qos -%% Arguments: Wanted - requested QoS to be set. -%% Returns : see set_properties/9 -%% Effect : may only be used when creating a channel!!!!!!!! -%%------------------------------------------------------------ -init_qos(Wanted) -> - LQS = set_local_qos(?not_DEFAULT_QOS, ?not_CreateInitQoS()), - set_properties(Wanted, ?not_DEFAULT_QOS, channel, ?not_SUPPORTED_QOS, - [], [], false, [], LQS). - -%%------------------------------------------------------------ -%% function : set_qos/5 -%% Arguments: Wanted - requested QoS to be set. -%% Current - current QoS OMG style -%% LQS - local representation of QoS. -%% Type - channel | admin | proxy -%% Parent - Factory if Channel, Channel if Admin etc -%% Childs - Admins if Channel etc -%% Returns : see set_properties/9 -%%------------------------------------------------------------ -set_qos(Wanted, {Current, LQS}, proxy, Parent, _) -> - set_properties(Wanted, Current, proxy, ?not_SUPPORTED_QOS, [], [], Parent, false,LQS); -set_qos(Wanted, {Current, LQS}, admin, Parent, Childs) -> - set_properties(Wanted, Current, admin, ?not_SUPPORTED_QOS, [], [], Parent, Childs,LQS); -set_qos(Wanted, {Current, LQS}, channel, _, Childs) -> - set_properties(Wanted, Current, channel, ?not_SUPPORTED_QOS, [], [], false, Childs,LQS). - -%%------------------------------------------------------------ -%% function : -%% Arguments: Req - Requested QoS, #'CosNotification_Property'{} -%% Type - Requestee, channel | admin | proxy -%% Curr - Current QoS, #'CosNotification_Property'{} -%% Parent - false | ObjRef -%% Childs - false | [ObjRef1, .., ObjRefN] -%% LQS - #qos{} defined in CosNotification_Definitions.hrl -%% Returns : ok - if requested equal to current value. -%% {ok, Req, LQS} - if new and allowed QoS -%% {unsupported,#'CosNotification_PropertyError'{}} otherwise. -%% Effect : -%%------------------------------------------------------------ -'EventReliability'(Req,channel, _Curr, _Parent, _Childs, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetConnectionReliability(LQS), ?not_BestEffort, ?not_Persistent} of - {Val, Val, _, _} -> - %% Is the value requested. - ok; - {Val, _, Val, _} -> - {ok, Req, LQS}; - {Val, _, _, Val} -> - {ok, Req, LQS}; - _-> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_TYPE', - name = Req#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - } - end; -'EventReliability'(Req,_,_,_,_,_) -> - %% only valid to set this QoS for channels (or per-event). - {unsupported, - #'CosNotification_PropertyError'{ - code = 'UNAVAILABLE_PROPERTY', - name = Req#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - }. - -%%------------------------------------------------------------ -%% function : 'ConnectionReliability'/6 -%% Arguments: Req - Requested QoS, #'CosNotification_Property'{} -%% Type - Requestee, channel | admin | proxy -%% Curr - Current QoS, #'CosNotification_Property'{} -%% Parent - false | ObjRef -%% Childs - false | [ObjRef1, .., ObjRefN] -%% LQS - #qos{} defined in CosNotification_Definitions.hrl -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -%% The most complex QoS to set is ConnectionReliability, and the reason for this -%% is that we cannot set the Channel to offer best effort while its children -%% offer persistent. A child may only offer Persistent if its parent do, which -%% is why we must check the following: -%% -%% # Persistent Change to Best Effort -%% _____ -%% | | (1) -> Check if children BE -%% |Chann| (2) ok <- -%% ----- -%% | -%% _____ -%% | | (3) -> Check if children BE -%% |Admin| (4) Check if parent Pers. <- -%% ----- -%% | -%% _____ -%% | | (5) -> ok -%% |Proxy| (6) Check if parent Pers. <- -%% ----- -%% NOTE: a parent always exists but we may change the QoS before creating any -%% childrens. The cases (2) and (5) is always ok, i.e., no need to confirm -%% with parent or children. -%%------------------------------------------------------------ -'ConnectionReliability'(Req, channel, _Curr, _Parent, Childs, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetConnectionReliability(LQS), ?not_BestEffort, ?not_Persistent} of - {Val, Val, _, _} -> - %% Is the value requested. - ok; - {Val, P, Val, P} -> - %% Requested is BestEffort, Current Persistent => (1) - check_with_relatives(Childs, Req, LQS); - {Val, B, B, Val} -> - %% Requested is Persistent, Current BestEffort => (2) - {ok, Req, LQS}; - _-> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_TYPE', - name = Req#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - } - end; -'ConnectionReliability'(Req, admin, _Curr, Parent, Childs, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetConnectionReliability(LQS), ?not_BestEffort, ?not_Persistent} of - {Val, Val, _, _} -> - %% Is the value requested. - ok; - {Val, P, Val, P} -> - %% Requested is BestEffort, Current Persistent => (3) - check_with_relatives(Childs, Req, LQS); - {Val, B, B, Val} -> - %% Requested is Persistent, Current BestEffort => (4) - check_with_relatives([Parent], Req, LQS); - _-> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_TYPE', - name = Req#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - } - end; -'ConnectionReliability'(Req, proxy, _Curr, Parent, _Childs, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetConnectionReliability(LQS), ?not_BestEffort, ?not_Persistent} of - {Val, Val, _, _} -> - %% Is the value requested. - ok; - {Val, P, Val, P} -> - %% Requested is BestEffort, Current Persistent => (5) - {ok, Req, LQS}; - {Val, B, B, Val} -> - %% Requested is Persistent, Current BestEffort => (6) - check_with_relatives([Parent], Req, LQS); - _-> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_TYPE', - name = Req#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - } - end. - -%%------------------------------------------------------------ -%% function : 'Priority'/6 -%% Arguments: Req - Requested QoS, #'CosNotification_Property'{} -%% Type - Requestee, channel | admin | proxy -%% Curr - Current QoS, #'CosNotification_Property'{} -%% Parent - false | ObjRef -%% Childs - false | [ObjRef1, .., ObjRefN] -%% LQS - #qos{} defined in CosNotification_Definitions.hrl -%% Returns : -%% Effect : -%%------------------------------------------------------------ -'Priority'(Req, _Type, _Curr, _Parent, _Childs, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetPriority(LQS), ?not_HighestPriority, ?not_LowestPriority} of - {Val, Val, _, _} -> - ok; - {Val, _, H, L} when Val =< H, Val >= L -> - {ok, Req, LQS}; - {_, _, H, L} -> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_VALUE', - name = Req#'CosNotification_Property'.name, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:short(), L), - high_val=any:create(orber_tc:short(), H) - } - } - } - end. - -%%------------------------------------------------------------ -%% function : 'StartTimeSupported'/6 -%% Arguments: Req - Requested QoS, #'CosNotification_Property'{} -%% Type - Requestee, channel | admin | proxy -%% Curr - Current QoS, #'CosNotification_Property'{} -%% Parent - false | ObjRef -%% Childs - false | [ObjRef1, .., ObjRefN] -%% LQS - #qos{} defined in CosNotification_Definitions.hrl -%% Returns : -%% Effect : -%%------------------------------------------------------------ -'StartTimeSupported'(Req, _Type, _Curr, _, _, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetStartTimeSupported(LQS)} of - {Val, Val} -> - ok; - {Val, _} when Val =/= true, Val =/= false -> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_VALUE', - name = Req#'CosNotification_Property'.name, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:boolean(), false), - high_val=any:create(orber_tc:boolean(), true) - } - } - }; - _-> - {ok, Req, LQS} - end. - -%%------------------------------------------------------------ -%% function : 'StopTimeSupported'/6 -%% Arguments: Req - Requested QoS, #'CosNotification_Property'{} -%% Type - Requestee, channel | admin | proxy -%% Curr - Current QoS, #'CosNotification_Property'{} -%% Parent - false | ObjRef -%% Childs - false | [ObjRef1, .., ObjRefN] -%% LQS - #qos{} defined in CosNotification_Definitions.hrl -%% Returns : -%% Effect : -%%------------------------------------------------------------ -'StopTimeSupported'(Req, _Type, _Curr, _, _, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetStopTimeSupported(LQS)} of - {Val, Val} -> - ok; - {Val, _} when Val =/= true, Val =/= false -> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_VALUE', - name = Req#'CosNotification_Property'.name, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:boolean(), false), - high_val=any:create(orber_tc:boolean(), true) - } - } - }; - _-> - {ok, Req, LQS} - end. - -%%------------------------------------------------------------ -%% function : 'Timeout'/6 -%% Arguments: Req - Requested QoS, #'CosNotification_Property'{} -%% Type - Requestee, channel | admin | proxy -%% Curr - Current QoS, #'CosNotification_Property'{} -%% Parent - false | ObjRef -%% Childs - false | [ObjRef1, .., ObjRefN] -%% LQS - #qos{} defined in CosNotification_Definitions.hrl -%% Returns : -%% Effect : -%%------------------------------------------------------------ -'Timeout'(Req, _Type, _Curr, _Parent, _Childs, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetTimeout(LQS)} of - {Val, Val} -> - ok; - {Val, _} when Val >= ?not_MinTimeout, Val =< ?not_MaxTimeout -> - {ok, Req, LQS}; - {Val, _} when is_integer(Val) -> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_VALUE', - name = Req#'CosNotification_Property'.name, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:unsigned_long_long(), ?not_MinTimeout), - high_val=any:create(orber_tc:unsigned_long_long(), ?not_MaxTimeout) - } - } - }; - _-> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_TYPE', - name = Req#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - } - end. - -%%------------------------------------------------------------ -%% function : 'OrderPolicy'/6 -%% Arguments: Req - Requested QoS, #'CosNotification_Property'{} -%% Type - Requestee, channel | admin | proxy -%% Curr - Current QoS, #'CosNotification_Property'{} -%% Parent - false | ObjRef -%% Childs - false | [ObjRef1, .., ObjRefN] -%% LQS - #qos{} defined in CosNotification_Definitions.hrl -%% Returns : -%% Effect : -%%------------------------------------------------------------ -'OrderPolicy'(Req, _Type, _Curr, _Parent, _Childs, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetOrderPolicy(LQS), 'CosNotification':'AnyOrder'(), - 'CosNotification':'PriorityOrder'()} of - {Val, Val,_,_} -> - ok; - {Val, _, L, H} when Val >= L, Val =< H -> - {ok, Req, LQS}; - {Val, _, L, H} when is_integer(Val) -> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_VALUE', - name = Req#'CosNotification_Property'.name, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:short(), L), - high_val=any:create(orber_tc:short(), H) - } - } - }; - _-> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_TYPE', - name = Req#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - } - end. - - -%%------------------------------------------------------------ -%% function : 'DiscardPolicy'/6 -%% Arguments: Req - Requested QoS, #'CosNotification_Property'{} -%% Type - Requestee, channel | admin | proxy -%% Curr - Current QoS, #'CosNotification_Property'{} -%% Parent - false | ObjRef -%% Childs - false | [ObjRef1, .., ObjRefN] -%% LQS - #qos{} defined in CosNotification_Definitions.hrl -%% Returns : -%% Effect : -%%------------------------------------------------------------ -'DiscardPolicy'(Req, _Type, _Curr, _Parent, _Childs, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetDiscardPolicy(LQS), ?not_AnyOrder, ?not_PriorityOrder} of - {Val, Val,_,_} -> - ok; - {Val, _, L, H} when Val >= L, Val =< H -> - {ok, Req, LQS}; - {Val, _, L, H} when is_integer(Val) -> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_VALUE', - name = Req#'CosNotification_Property'.name, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:short(), L), - high_val=any:create(orber_tc:short(), H) - } - } - }; - _-> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_TYPE', - name = Req#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - } - end. - -%%------------------------------------------------------------ -%% function : 'DiscardPolicy'/6 -%% Arguments: Req - Requested QoS, #'CosNotification_Property'{} -%% Type - Requestee, channel | admin | proxy -%% Curr - Current QoS, #'CosNotification_Property'{} -%% Parent - false | ObjRef -%% Childs - false | [ObjRef1, .., ObjRefN] -%% LQS - #qos{} defined in CosNotification_Definitions.hrl -%% Returns : -%% Effect : -%%------------------------------------------------------------ -'MaximumBatchSize'(Req, _Type, _Curr, _Parent, _Childs, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetMaximumBatchSize(LQS)} of - {Val, Val} -> - ok; - {Val, _} when Val >= ?not_MinBatchSize, Val =< ?not_MaxBatchSize -> - {ok, Req, LQS}; - {Val, _} when is_integer(Val) -> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_VALUE', - name = Req#'CosNotification_Property'.name, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:unsigned_long_long(), ?not_MinBatchSize), - high_val=any:create(orber_tc:unsigned_long_long(), ?not_MaxBatchSize) - } - } - }; - _-> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'UNSUPPORTED_VALUE', - name = Req#'CosNotification_Property'.name, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:long(), ?not_MinBatchSize), - high_val=any:create(orber_tc:long(), ?not_MaxBatchSize) - } - } - } - end. - -%%------------------------------------------------------------ -%% function : 'PacingInterval'/6 -%% Arguments: Req - Requested QoS, #'CosNotification_Property'{} -%% Type - Requestee, channel | admin | proxy -%% Curr - Current QoS, #'CosNotification_Property'{} -%% Parent - false | ObjRef -%% Childs - false | [ObjRef1, .., ObjRefN] -%% LQS - #qos{} defined in CosNotification_Definitions.hrl -%% Returns : -%% Comment : PacingInterval is defined to be: -%% * TimeBase::UtcT (p 57, 2.5.5, OMG TC Document telecom/98-11-01) -%% * TimeBase::TimeT (p 189, appendix B, OMG TC Document telecom/98-11-01) -%% This implementation use TimeBase::TimeT, especially since -%% TimeBase::UtcT contains information which are of no importance. -%% When writing this, the OMG homepage contained no information -%% regarding this. -%%------------------------------------------------------------ -'PacingInterval'(Req, _Type, _Curr, _Parent, _Childs, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetPacingInterval(LQS)} of - {Val, Val} -> - ok; - {Val, _} when Val >= ?not_MinPacing, Val =< ?not_MaxPacing -> - {ok, Req, LQS}; - {Val, _} when is_integer(Val) -> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_VALUE', - name = Req#'CosNotification_Property'.name, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:unsigned_long_long(), ?not_MinPacing), - high_val=any:create(orber_tc:unsigned_long_long(), ?not_MaxPacing) - } - } - }; - _-> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_TYPE', - name = Req#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - } - end. - -%%------------------------------------------------------------ -%% function : 'MaxEventsPerConsumer'/6 -%% Arguments: Req - Requested QoS, #'CosNotification_Property'{} -%% Type - Requestee, channel | admin | proxy -%% Curr - Current QoS, #'CosNotification_Property'{} -%% Parent - false | ObjRef -%% Childs - false | [ObjRef1, .., ObjRefN] -%% LQS - #qos{} defined in CosNotification_Definitions.hrl -%% Returns : -%% Effect : -%%------------------------------------------------------------ -'MaxEventsPerConsumer'(Req, _Type, _Curr, _Parent, _Childs, LQS) -> - case {any:get_value(Req#'CosNotification_Property'.value), - ?not_GetMaxEventsPerConsumer(LQS)} of - {Val, Val} -> - ok; - {Val, _} when is_integer(Val) andalso - Val >= ?not_MinConsumerEvents andalso - Val =< ?not_MaxConsumerEvents -> - {ok, Req, LQS}; - {Val, _} when is_integer(Val) -> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_VALUE', - name = Req#'CosNotification_Property'.name, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:unsigned_long_long(), ?not_MinConsumerEvents), - high_val=any:create(orber_tc:unsigned_long_long(), ?not_MaxConsumerEvents) - } - } - }; - _-> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'UNSUPPORTED_VALUE', - name = Req#'CosNotification_Property'.name, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:long(), ?not_MinConsumerEvents), - high_val=any:create(orber_tc:long(), ?not_MaxConsumerEvents) - } - } - } - end. - -%%------------------------------------------------------------ -%% function : validate_qos/5 -%% Arguments: Wanted - requested QoS to be set. -%% Curr - current QoS OMG style and LQS, local -%% representation of QoS, grouped as {OMGQ, LQS} -%% Type - channel | admin | proxy -%% Parent - Factory if Channel, Channel if Admin etc -%% Childs - Admins if Channel etc -%% Returns : NamedPropertySeq | #'CosNotification_UnsupportedQoS'{} -%% case 1 if all supported, case 2 if at least 1 QoS not -%% supported. -%% See also p59, 2.5.6.4, OMG TC Document telecom/98-11-01. Quote: -%% "If the supplied QoS is supported, it returns additional QoS -%% properties which could be optionally added as well." -%%------------------------------------------------------------ -validate_qos(Wanted, Curr, Type, Parent, Childs) -> - %% If not supported this function will raise an exception, which we should - %% not catch, but all we need to is to raise the exception as it is. - {_, LQS}=set_qos(Wanted, Curr, Type, Parent, Childs), - NewNPR = check_limits(LQS, ?not_QOS_LIMITS), - remove_qos(Wanted, LQS, NewNPR). - -remove_qos([], _, NPR) -> - NPR; -remove_qos([H|T], LQS, NPR) -> - NewNPR=remove(NPR, H#'CosNotification_Property'.name), - remove_qos(T, LQS, NewNPR). - -check_limits(LQS, NPR) -> - case {?not_GetEventReliability(LQS), ?not_GetConnectionReliability(LQS), - ?not_Persistent, ?not_BestEffort} of - {P,P,P,_B} -> - New = #'CosNotification_NamedPropertyRange' - {name=?not_EventReliability, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:short(), ?not_BestEffort), - high_val=any:create(orber_tc:short(), ?not_BestEffort) - }}, - NewNPR=change(NPR, ?not_EventReliability, New), - remove(NewNPR, ?not_ConnectionReliability); - {_,B,_P,B} -> - remove(NPR, ?not_EventReliability); - {B,P,P,B} -> - New = #'CosNotification_NamedPropertyRange' - {name=?not_ConnectionReliability, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:short(), ?not_BestEffort), - high_val=any:create(orber_tc:short(), ?not_BestEffort) - }}, - change(NPR, ?not_ConnectionReliability, New) - end. - -%%------------------------------------------------------------ -%% function : validate_event_qos/2 -%% Arguments: Wanted - requested QoS to be set. -%% Curr - LQS, local representation of QoS -%% Returns : NamedPropertySeq | #'CosNotification_UnsupportedQoS'{} -%% case 1 if all supported, case 2 if at least 1 QoS not -%% supported. -%%------------------------------------------------------------ -validate_event_qos(Wanted, Curr) -> - case v_e_q_helper(Wanted, Curr, []) of - ok -> - []; - {error, Unsupp} -> - corba:raise(#'CosNotification_UnsupportedQoS'{qos_err = Unsupp}) - end. - -v_e_q_helper([], _Curr, []) -> - %% Parsed all and found no conflicts. - ok; -v_e_q_helper([], _Curr, Unsupp) -> - %% Not possible to use these requested QoS. - {error, Unsupp}; - -%%--- EventReliability ---%% -v_e_q_helper([#'CosNotification_Property'{name=?not_EventReliability, - value=#any{value=?not_BestEffort}}|T], Curr, Unsupp) -> - %% Always ok. - v_e_q_helper(T, Curr, Unsupp); -v_e_q_helper([#'CosNotification_Property'{name=?not_EventReliability, - value=#any{value=?not_Persistent}}|T], Curr, Unsupp) - when ?not_GetConnectionReliability(Curr) =/= ?not_BestEffort, - ?not_GetEventReliability(Curr) =/= ?not_BestEffort, - ?not_GetStopTimeSupported(Curr) =/= true -> - v_e_q_helper(T, Curr, Unsupp); -v_e_q_helper([#'CosNotification_Property'{name=?not_EventReliability}|T], - Curr, Unsupp) -> - %% Impossible to set to Persistent if the connection reliability is best effort. - v_e_q_helper(T, Curr, [#'CosNotification_PropertyError' - {code = 'UNAVAILABLE_VALUE', name = ?not_EventReliability, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null)}}|Unsupp]); - -%%--- Priority ---%% -v_e_q_helper([#'CosNotification_Property'{name=?not_Priority, value=#any{value=V}}|T], Curr, - Unsupp) -> - if - ?not_GetOrderPolicy(Curr) =/= ?not_AnyOrder, - ?not_GetOrderPolicy(Curr) =/= ?not_Priority, - ?not_GetDiscardPolicy(Curr) =/= ?not_Priority -> - %% No use setting Priority since it's not currently used. - v_e_q_helper(T, Curr, [#'CosNotification_PropertyError' - {code = 'UNAVAILABLE_VALUE', name = ?not_Priority, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - }}|Unsupp]); - V =< ?not_HighestPriority, V >= ?not_LowestPriority -> - v_e_q_helper(T, Curr, Unsupp); - true -> - v_e_q_helper(T, Curr, [#'CosNotification_PropertyError' - {code = 'BAD_VALUE', name = ?not_Priority, - available_range = - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:short(), - ?not_LowestPriority), - high_val=any:create(orber_tc:short(), - ?not_HighestPriority)}}|Unsupp]) - end; - -%%--- StartTime ---%% -v_e_q_helper([#'CosNotification_Property'{name=?not_StartTime}|T], Curr, Unsupp) - when ?not_GetStartTimeSupported(Curr) =/= false, - ?not_GetEventReliability(Curr) =/= ?not_Persistent -> - v_e_q_helper(T, Curr, Unsupp); -v_e_q_helper([#'CosNotification_Property'{name=?not_StartTime}|T], Curr, Unsupp) -> - v_e_q_helper(T, Curr, [#'CosNotification_PropertyError' - {code = 'UNAVAILABLE_VALUE', name = ?not_StartTime, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - }}|Unsupp]); - -%%--- StopTime ---%% -v_e_q_helper([#'CosNotification_Property'{name=?not_StopTime}|T], Curr, Unsupp) - when ?not_GetStopTimeSupported(Curr) =/= false, - ?not_GetEventReliability(Curr) =/= ?not_Persistent -> - v_e_q_helper(T, Curr, Unsupp); -v_e_q_helper([#'CosNotification_Property'{name=?not_StopTime}|T], Curr, Unsupp) -> - v_e_q_helper(T, Curr, [#'CosNotification_PropertyError' - {code = 'UNAVAILABLE_VALUE', name = ?not_StopTime, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - }}|Unsupp]); - -%%--- Timeout ---%% -v_e_q_helper([#'CosNotification_Property'{name=?not_Timeout}|T], Curr, Unsupp) - when ?not_GetStopTimeSupported(Curr) =/= false, - ?not_GetEventReliability(Curr) =/= ?not_Persistent -> - v_e_q_helper(T, Curr, Unsupp); -v_e_q_helper([#'CosNotification_Property'{name=?not_Timeout}|T], Curr, Unsupp) -> - v_e_q_helper(T, Curr, [#'CosNotification_PropertyError' - {code = 'UNAVAILABLE_VALUE', name = ?not_Timeout, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - }}|Unsupp]); - -%%--- Unknown Event QoS ---%% -v_e_q_helper([#'CosNotification_Property'{name=Name}|T], Curr, Unsupp) -> - %% Unsupported property. - v_e_q_helper(T, Curr, [#'CosNotification_PropertyError' - {code = 'BAD_PROPERTY', name = Name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - }}|Unsupp]); -v_e_q_helper(What, _, _) -> - %% Not a Property struct. - orber:dbg("[~p] CosNotification_Common:v_e_q_helper(~p);~n" - "Not a CosNotification_Property struct.", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%-------------- QOS HELP FUNCTIONS -------------------------- -%%------------------------------------------------------------ -%% function : set_properties/9 -%% Arguments: Wanted - requested QoS to be set. -%% Current - current QoS OMG style -%% Type - channel | admin | proxy -%% Supported - List of supported QoS -%% Unsupp - acc -%% NewQoS - acc -%% Parent - Factory if Channel, Channel if Admin etc -%% Childs - Admins if Channel etc -%% LQS - local representation of QoS. -%% Returns : {NewOMGStyleQoS, NewLocalQoS} | #'CosNotification_UnsupportedQoS'{} -%%------------------------------------------------------------ -set_properties(Wanted, Current, Type, Supported, Unsupp, NewQoS, Parent, Childs, LQS) -> - case do_set_properties(Wanted, Current, Type, Supported, Unsupp, NewQoS, Parent, Childs, LQS) of - {error, Exc} -> - corba:raise(Exc); - Result -> - Result - end. - -do_set_properties([], Curr, channelAdm, _, [], NewQoS,_,_,LAS) -> - merge_properties(NewQoS, Curr, LAS); -do_set_properties([], Curr, _, _, [], NewQoS,_,_,LQS) -> - %% set_local_qos and merge_properties are help functions found at the end of QoS - %% functions. - NewLQS = set_local_qos(NewQoS, LQS), - merge_properties(NewQoS, Curr, NewLQS); -do_set_properties([], _, channelAdm, _, Unsupp, _,_,_,_) -> - {error, #'CosNotification_UnsupportedAdmin'{admin_err = Unsupp}}; -do_set_properties([], _, _, _, Unsupp, _,_,_,_) -> - {error, #'CosNotification_UnsupportedQoS'{qos_err = Unsupp}}; - -do_set_properties([Req|Tail], Curr, Type, Supported, Unsupp, NewQoS, Parent, Childs,LQS) -> - %% set_values and is_supported are help functions found at the end of QoS - %% functions. - case set_values(is_supported(Supported, Req), Req, Type, Curr, Parent, Childs,LQS) of - {unsupported, U} -> - do_set_properties(Tail, Curr, Type, Supported, [U|Unsupp], NewQoS, Parent, Childs,LQS); - {ok, S, NewLQS} -> - do_set_properties(Tail, Curr, Type, Supported, Unsupp, [S|NewQoS], Parent, Childs,NewLQS); - {ok, S} -> - do_set_properties(Tail, Curr, Type, Supported, Unsupp, [S|NewQoS], Parent, Childs,LQS); - ok -> - do_set_properties(Tail, Curr, Type, Supported, Unsupp, NewQoS, Parent, Childs,LQS) - end. - - -set_values(unsupported,Req,_,_,_,_,_) -> - {unsupported, - #'CosNotification_PropertyError'{ - code = 'BAD_PROPERTY', - name = Req#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - }; -set_values({ok, Func}, Req, Type, Curr, Parent, Childs, LQS) -> - ?MODULE:Func(Req, Type, Curr, Parent, Childs, LQS). - -%% Update OMG style QoS list with new values. -merge_properties([], NewCurrQoS, LQS) -> - {NewCurrQoS, LQS}; -merge_properties([H|T], Curr, LQS) -> - merge_properties(T, lists:keyreplace(H#'CosNotification_Property'.name, %% get key. - #'CosNotification_Property'.name, %% get index. - Curr, H), LQS). - -%% Is the Property S among our supported QoS? -is_supported([], _) -> - unsupported; -is_supported([{Name, Func}|_], #'CosNotification_Property'{name=Name}) -> - {ok, Func}; -is_supported([_|T], S) -> - is_supported(T, S). - -%% Find matching S-Property from a list of OMG style QoS -extract([], _) -> unsupported; -extract([H|_T], S) when H#'CosNotification_Property'.name== - S#'CosNotification_Property'.name -> - {ok, H}; -extract([_|T], S) -> extract(T,S). - -%% Find matching Property name from a list of OMG style QoS -extract_value([], _) -> unsupported; -extract_value([H|_T], Key) when H#'CosNotification_Property'.name== Key -> - {ok, any:get_value(H#'CosNotification_Property'.value)}; -extract_value([_|T], Key) -> extract(T,Key). - -%% Remove matching S-QoS from a list of OMG style QoS -remove(List, Key) -> - lists:keydelete(Key, - #'CosNotification_NamedPropertyRange'.name, %% get index. - List). - -change(List, Key, New) -> - lists:keyreplace(Key, - #'CosNotification_NamedPropertyRange'.name, %% get index. - List, New). -%% Get QoS from supplied objects and check if it's the same as S. -check_with_relatives([], S, LQS) -> - {ok, S, LQS}; -check_with_relatives([undefined|T], S, LQS) -> - check_with_relatives(T, S, LQS); -check_with_relatives([H|T], S, LQS) -> - case catch extract('CosNotification_QoSAdmin':get_qos(H), S) of - {ok, S} -> - check_with_relatives(T, S, LQS); - _-> - %% Varioues reasons for this case (Object not responding, not supported) - {unsupported, - #'CosNotification_PropertyError'{ - code = 'UNAVAILABLE_PROPERTY', - name = S#'CosNotification_Property'.name, - available_range = #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:null(), null), - high_val=any:create(orber_tc:null(), null) - } - } - } - end. - -%% Set new values to locally defined representation of QoS. Using this approach is -%% necessary since we must state the record-field at compile-time. -set_local_qos([], LQS) -> LQS; -set_local_qos([#'CosNotification_Property'{name=N,value=V}|T], LQS) -> - NewLQS = - case N of - "EventReliability" -> - ?not_SetEventReliability(LQS, any:get_value(V)); - "ConnectionReliability" -> - ?not_SetConnectionReliability(LQS, any:get_value(V)); - "Priority" -> - ?not_SetPriority(LQS, any:get_value(V)); - "Timeout" -> - ?not_SetTimeout(LQS, any:get_value(V)); - "OrderPolicy" -> - ?not_SetOrderPolicy(LQS, any:get_value(V)); - "DiscardPolicy" -> - ?not_SetDiscardPolicy(LQS, any:get_value(V)); - "MaximumBatchSize" -> - ?not_SetMaximumBatchSize(LQS, any:get_value(V)); - "PacingInterval" -> - ?not_SetPacingInterval(LQS, any:get_value(V)); - "StartTimeSupported" -> - ?not_SetStartTimeSupported(LQS, any:get_value(V)); - "StopTimeSupported" -> - ?not_SetStopTimeSupported(LQS, any:get_value(V)); - "MaxEventsPerConsumer" -> - ?not_SetMaxEventsPerConsumer(LQS, any:get_value(V)) - end, - set_local_qos(T, NewLQS). - -%%%%%%%%%%%%%%%%% END QOS FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%% - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/CosNotification_Definitions.hrl b/lib/cosNotification/src/CosNotification_Definitions.hrl deleted file mode 100644 index 5d85c77a22..0000000000 --- a/lib/cosNotification/src/CosNotification_Definitions.hrl +++ /dev/null @@ -1,343 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosNotification_Definitions.hrl -%% Purpose : -%%---------------------------------------------------------------------- - --ifndef(COSNOTIFICATION_DEFINITIONS_HRL). --define(COSNOTIFICATION_DEFINITIONS_HRL, true). - -%% ---------------- General comment ------------------------------------ -%% ******* README ******** -%% The prefix 'not' is short for notification, and is used to separate locally -%% defined macros from the global ones, i.e., do NOT confuse this with a negation!! -%% -%% In this file you find globally used data structures, constants etc. -%% - -%%--------------- INCLUDES --------------------------------------------- - -%%-------- Constants ------------------------------------------------- --define(not_SupportedGrammars, ["EXTENDED_TCL"]). - -%% !!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!! -%% -%% If OMG redefines the values for the constants the definitions -%% below must be redefined!! -%% -%% !!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!! --define(not_BestEffort, 0). --define(not_Persistent, 1). --define(not_EventReliability, "EventReliability"). --define(not_ConnectionReliability, "ConnectionReliability"). --define(not_Priority, "Priority"). --define(not_LowestPriority, -32767). --define(not_HighestPriority, 32767). --define(not_DefaultPriority, 0). --define(not_StartTime, "StartTime"). --define(not_StopTime, "StopTime"). --define(not_Timeout, "Timeout"). --define(not_OrderPolicy, "OrderPolicy"). --define(not_AnyOrder, 0). --define(not_FifoOrder, 1). --define(not_PriorityOrder, 2). --define(not_DeadlineOrder, 3). --define(not_DiscardPolicy, "DiscardPolicy"). --define(not_LifoOrder, 4). --define(not_RejectNewEvents, 5). --define(not_MaximumBatchSize, "MaximumBatchSize"). --define(not_PacingInterval, "PacingInterval"). --define(not_StartTimeSupported, "StartTimeSupported"). --define(not_StopTimeSupported, "StopTimeSupported"). --define(not_MaxEventsPerConsumer, "MaxEventsPerConsumer"). --define(not_MaxQueueLength, "MaxQueueLength"). --define(not_MaxConsumers, "MaxConsumers"). --define(not_MaxSuppliers, "MaxSuppliers"). - -%%--------------- QOS DEFINITIONS ---------------------------- -%% Limits for QoS. These are our own limits. --define(not_MaxBatchSize, 10000). --define(not_MinBatchSize, 1). --define(not_MinTimeout, 0). --define(not_MaxTimeout, 100000000000). --define(not_MinPacing, 0). --define(not_MaxPacing, 100000000000). --define(not_MinConsumerEvents, 1). --define(not_MaxConsumerEvents, 10000). - --define(not_QOS_LIMITS, -[#'CosNotification_NamedPropertyRange' - {name=?not_EventReliability, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:short(), ?not_BestEffort), - high_val=any:create(orber_tc:short(), ?not_Persistent) - }}, - #'CosNotification_NamedPropertyRange' - {name=?not_ConnectionReliability, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:short(), ?not_BestEffort), - high_val=any:create(orber_tc:short(), ?not_Persistent) - }}, - #'CosNotification_NamedPropertyRange' - {name=?not_Priority, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:short(), ?not_LowestPriority), - high_val=any:create(orber_tc:short(), ?not_HighestPriority) - }}, - #'CosNotification_NamedPropertyRange' - {name=?not_StartTimeSupported, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:boolean(), false), - high_val=any:create(orber_tc:boolean(), true) - }}, - #'CosNotification_NamedPropertyRange' - {name=?not_StopTimeSupported, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:boolean(), false), - high_val=any:create(orber_tc:boolean(), true) - }}, - #'CosNotification_NamedPropertyRange' - {name=?not_Timeout, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:unsigned_long_long(), ?not_MinTimeout), - high_val=any:create(orber_tc:unsigned_long_long(), ?not_MaxTimeout) - }}, - #'CosNotification_NamedPropertyRange' - {name=?not_OrderPolicy, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:short(), ?not_AnyOrder), - high_val=any:create(orber_tc:short(), ?not_PriorityOrder) - }}, - #'CosNotification_NamedPropertyRange' - {name=?not_DiscardPolicy, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:short(), ?not_AnyOrder), - high_val=any:create(orber_tc:short(), ?not_PriorityOrder) - }}, - #'CosNotification_NamedPropertyRange' - {name=?not_MaximumBatchSize, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:long(), ?not_MinBatchSize), - high_val=any:create(orber_tc:long(), ?not_MaxBatchSize) - }}, - #'CosNotification_NamedPropertyRange' - {name=?not_PacingInterval, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:unsigned_long_long(), ?not_MinPacing), - high_val=any:create(orber_tc:unsigned_long_long(), ?not_MaxPacing) - }}, - #'CosNotification_NamedPropertyRange' - {name=?not_MaxEventsPerConsumer, - range= - #'CosNotification_PropertyRange'{ - low_val=any:create(orber_tc:long(), ?not_MinConsumerEvents), - high_val=any:create(orber_tc:long(), ?not_MaxConsumerEvents) - }} -]). - - - -%% Local record used internally, and the reason for this is we get faster -%% access to QoS settings. --record(qos, {'EventReliability', - 'ConnectionReliability', - 'Priority', - 'StartTimeSupported', - 'StopTimeSupported', - 'Timeout', - 'OrderPolicy', - 'DiscardPolicy', - 'MaximumBatchSize', - 'PacingInterval', - 'MaxEventsPerConsumer'}). - -%% Global (OMG) representation of QoS. --define(not_DEFAULT_QOS, -[#'CosNotification_Property'{name=?not_MaximumBatchSize, - value=any:create(orber_tc:long(), 1)}, - #'CosNotification_Property'{name=?not_PacingInterval, - value=any:create(orber_tc:unsigned_long_long(), 0)}, - #'CosNotification_Property'{name=?not_Timeout, - value=any:create(orber_tc:unsigned_long_long(), 0)}, - #'CosNotification_Property'{name=?not_MaxEventsPerConsumer, - value=any:create(orber_tc:long(), 100)}, - #'CosNotification_Property'{name=?not_OrderPolicy, - value=any:create(orber_tc:short(), - ?not_PriorityOrder)}, - #'CosNotification_Property'{name=?not_EventReliability, - value=any:create(orber_tc:short(), - ?not_BestEffort)}, - #'CosNotification_Property'{name=?not_ConnectionReliability, - value=any:create(orber_tc:short(), - ?not_BestEffort)}, - #'CosNotification_Property'{name=?not_DiscardPolicy, - value=any:create(orber_tc:short(), - ?not_RejectNewEvents)}, - #'CosNotification_Property'{name=?not_StartTimeSupported, - value=any:create(orber_tc:boolean(), false)}, - #'CosNotification_Property'{name=?not_StopTimeSupported, - value=any:create(orber_tc:boolean(), false)}, - #'CosNotification_Property'{name=?not_Priority, - value=any:create(orber_tc:short(), ?not_DefaultPriority)}]). - -%%--------------- QOS CREATORS ------------------------------- --define(not_CreateInitQoS(), #qos{}). - -%%--------------- QOS DESTRUCTORS ---------------------------- --define(not_DestroyQoS(Q), ok). - -%%--------------- QOS SELECTORS ------------------------------ --define(not_GetEventReliability(Q), Q#qos.'EventReliability'). --define(not_GetConnectionReliability(Q), Q#qos.'ConnectionReliability'). --define(not_GetPriority(Q), Q#qos.'Priority'). --define(not_GetStartTimeSupported(Q), Q#qos.'StartTimeSupported'). --define(not_GetStopTimeSupported(Q), Q#qos.'StopTimeSupported'). --define(not_GetTimeout(Q), Q#qos.'Timeout'). --define(not_GetOrderPolicy(Q), Q#qos.'OrderPolicy'). --define(not_GetDiscardPolicy(Q), Q#qos.'DiscardPolicy'). --define(not_GetMaximumBatchSize(Q), Q#qos.'MaximumBatchSize'). --define(not_GetPacingInterval(Q), Q#qos.'PacingInterval'). --define(not_GetMaxEventsPerConsumer(Q), Q#qos.'MaxEventsPerConsumer'). - -%%--------------- QOS MODIFIERS ------------------------------ --define(not_SetEventReliability(Q,D), Q#qos{'EventReliability'=D}). --define(not_SetConnectionReliability(Q,D), Q#qos{'ConnectionReliability'=D}). --define(not_SetPriority(Q,D), Q#qos{'Priority'=D}). --define(not_SetStartTimeSupported(Q,D), Q#qos{'StartTimeSupported'=D}). --define(not_SetStopTimeSupported(Q,D), Q#qos{'StopTimeSupported'=D}). --define(not_SetTimeout(Q,D), Q#qos{'Timeout'=D}). --define(not_SetOrderPolicy(Q,D), Q#qos{'OrderPolicy'=D}). --define(not_SetDiscardPolicy(Q,D), Q#qos{'DiscardPolicy'=D}). --define(not_SetMaximumBatchSize(Q,D), Q#qos{'MaximumBatchSize'=D}). --define(not_SetPacingInterval(Q,D), Q#qos{'PacingInterval'=D}). --define(not_SetMaxEventsPerConsumer(Q,D), Q#qos{'MaxEventsPerConsumer'=D}). - -%%--------------- StructuredEvent CREATORS ------------------- --define(not_CreateSE(StrD,StrT,StrE,PSeqV,PSeqF,AnyR), -#'CosNotification_StructuredEvent'{header = - #'CosNotification_EventHeader'{fixed_header = - #'CosNotification_FixedEventHeader'{event_type = - #'CosNotification_EventType'{domain_name=StrD, - type_name=StrT}, - event_name = StrE}, - variable_header = PSeqV}, - filterable_data = PSeqF, - remainder_of_body = AnyR}). -%% Can be used in guards. --define(not_isConvertedAny(E), - (((E#'CosNotification_StructuredEvent'.header) - #'CosNotification_EventHeader'.fixed_header) - #'CosNotification_FixedEventHeader'.event_type) - #'CosNotification_EventType'.type_name == "%ANY"). -%% Can NOT be used in guards!!!!! --define(not_isConvertedStructured(E), - any:get_typecode(E) == 'CosNotification_StructuredEvent':tc()). - -%%--------------- StructuredEvent DESTRUCTORS ---------------- --define(not_DestroySE(E), ok). - -%%--------------- StructuredEvent SELECTORS ------------------ --define(not_GetSEHeader(E), E#'StructuredEvent'.header). --define(not_GetSEFixedHeader(E), E#'StructuredEvent'.header). - -%%--------------- StructuredEvent MODIFIERS ------------------ - -%%-------- QoS support ----------------------------------------------- --define(not_SUPPORTED_QOS, -[{?not_EventReliability, 'EventReliability'}, - {?not_ConnectionReliability, 'ConnectionReliability'}, - {?not_Priority, 'Priority'}, - {?not_StartTimeSupported, 'StartTimeSupported'}, - {?not_StopTimeSupported, 'StopTimeSupported'}, - {?not_Timeout, 'Timeout'}, - {?not_OrderPolicy, 'OrderPolicy'}, - {?not_DiscardPolicy, 'DiscardPolicy'}, - {?not_MaximumBatchSize, 'MaximumBatchSize'}, - {?not_PacingInterval, 'PacingInterval'}, - {?not_MaxEventsPerConsumer, 'MaxEventsPerConsumer'}]). - -%%-------- ADMINPROPERTIESADMIN -------------------------------------- - -%% According to the OMG TC Document telecom/98-11-01, p 63 (section 2.5.7), the -%% default-value for these 3 admin properties is zero, which means that no limit -%% applies to that property. --define(not_DEFAULT_ADMINPROPERTIES, -[#'CosNotification_Property'{name=?not_MaxQueueLength, - value=any:create(orber_tc:long(), 0)}, - #'CosNotification_Property'{name=?not_MaxConsumers, - value=any:create(orber_tc:long(), 0)}, - #'CosNotification_Property'{name=?not_MaxSuppliers, - value=any:create(orber_tc:long(), 0)}]). - --define(not_SUPPORTED_ADMINPROPERTIES, -[{?not_MaxQueueLength, 'MaxQueueLength'}, - {?not_MaxConsumers, 'MaxConsumers'}, - {?not_MaxSuppliers, 'MaxSuppliers'}]). - - -%%-------- MISC -------------------------------------------------------- - --define(not_DEFAULT_SETTINGS, [{pullInterval, 20}, - {filterOp, 'OR_OP'}, - {gcTime, 60}, - {gcLimit, 50}, - {timeService, undefined}, - {typecheck, true}, - {tty, false}, - {logfile, false}, - {server_options, []}]). --define(not_CreateDBKey, term_to_binary({{erlang:system_time(), - erlang:unique_integer()}, - node()})). - --define(DEBUG_LEVEL, 3). - --ifdef(debug). - --define(debug_print(F,A), io:format("[~p(~p)] "++F,[?MODULE, ?LINE]++A)). --define(DBG(F,A), io:format("[~p(~p)] "++F,[?MODULE, ?LINE]++A)). --define(not_TypeCheck(O,I), ok). -%-define(not_TypeCheck(O,M), 'CosNotification_Common':type_check(O,M)). - --else. - --define(debug_print(F,A), ok). --define(DBG(F,A), ok). --define(not_TypeCheck(O,I), ok). - --endif. - - - --endif. -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/CosNotifyChannelAdmin.cfg b/lib/cosNotification/src/CosNotifyChannelAdmin.cfg deleted file mode 100644 index 8647b281a2..0000000000 --- a/lib/cosNotification/src/CosNotifyChannelAdmin.cfg +++ /dev/null @@ -1,60 +0,0 @@ -{this, "CosNotifyChannelAdmin::EventChannel"}. -{from, "CosNotifyChannelAdmin::EventChannel"}. -{{handle_info, "CosNotifyChannelAdmin::EventChannel"}, true}. -{this, "CosNotifyChannelAdmin::EventChannelFactory"}. -{from, "CosNotifyChannelAdmin::EventChannelFactory"}. -{{handle_info, "CosNotifyChannelAdmin::EventChannelFactory"}, true}. -{this, "CosNotifyChannelAdmin::SupplierAdmin"}. -{from, "CosNotifyChannelAdmin::SupplierAdmin"}. -{{handle_info, "CosNotifyChannelAdmin::SupplierAdmin"}, true}. -{this, "CosNotifyChannelAdmin::ConsumerAdmin"}. -{from, "CosNotifyChannelAdmin::ConsumerAdmin"}. -{{handle_info, "CosNotifyChannelAdmin::ConsumerAdmin"}, true}. -{this, "CosNotifyChannelAdmin::StructuredProxyPushSupplier"}. -{from, "CosNotifyChannelAdmin::StructuredProxyPushSupplier"}. -{{handle_info, "CosNotifyChannelAdmin::StructuredProxyPushSupplier"}, true}. -{{impl, "CosNotifyChannelAdmin::StructuredProxyPushSupplier"}, "PusherSupplier_impl"}. -{this, "CosNotifyChannelAdmin::StructuredProxyPullSupplier"}. -{from, "CosNotifyChannelAdmin::StructuredProxyPullSupplier"}. -{{handle_info, "CosNotifyChannelAdmin::StructuredProxyPullSupplier"}, true}. -{{impl, "CosNotifyChannelAdmin::StructuredProxyPullSupplier"}, "PullerSupplier_impl"}. -{this, "CosNotifyChannelAdmin::ProxyPushSupplier"}. -{from, "CosNotifyChannelAdmin::ProxyPushSupplier"}. -{{handle_info, "CosNotifyChannelAdmin::ProxyPushSupplier"}, true}. -{{impl, "CosNotifyChannelAdmin::ProxyPushSupplier"}, "PusherSupplier_impl"}. -{this, "CosNotifyChannelAdmin::ProxyPullSupplier"}. -{from, "CosNotifyChannelAdmin::ProxyPullSupplier"}. -{{handle_info, "CosNotifyChannelAdmin::ProxyPullSupplier"}, true}. -{{impl, "CosNotifyChannelAdmin::ProxyPullSupplier"}, "PullerSupplier_impl"}. -{this, "CosNotifyChannelAdmin::SequenceProxyPushSupplier"}. -{from, "CosNotifyChannelAdmin::SequenceProxyPushSupplier"}. -{{handle_info, "CosNotifyChannelAdmin::SequenceProxyPushSupplier"}, true}. -{{impl, "CosNotifyChannelAdmin::SequenceProxyPushSupplier"}, "PusherSupplier_impl"}. -{this, "CosNotifyChannelAdmin::SequenceProxyPullSupplier"}. -{from, "CosNotifyChannelAdmin::SequenceProxyPullSupplier"}. -{{handle_info, "CosNotifyChannelAdmin::SequenceProxyPullSupplier"}, true}. -{{impl, "CosNotifyChannelAdmin::SequenceProxyPullSupplier"}, "PullerSupplier_impl"}. -{this, "CosNotifyChannelAdmin::StructuredProxyPushConsumer"}. -{from, "CosNotifyChannelAdmin::StructuredProxyPushConsumer"}. -{{handle_info, "CosNotifyChannelAdmin::StructuredProxyPushConsumer"}, true}. -{{impl, "CosNotifyChannelAdmin::StructuredProxyPushConsumer"}, "PusherConsumer_impl"}. -{this, "CosNotifyChannelAdmin::StructuredProxyPullConsumer"}. -{from, "CosNotifyChannelAdmin::StructuredProxyPullConsumer"}. -{{handle_info, "CosNotifyChannelAdmin::StructuredProxyPullConsumer"}, true}. -{{impl, "CosNotifyChannelAdmin::StructuredProxyPullConsumer"}, "PullerConsumer_impl"}. -{this, "CosNotifyChannelAdmin::ProxyPushConsumer"}. -{from, "CosNotifyChannelAdmin::ProxyPushConsumer"}. -{{handle_info, "CosNotifyChannelAdmin::ProxyPushConsumer"}, true}. -{{impl, "CosNotifyChannelAdmin::ProxyPushConsumer"}, "PusherConsumer_impl"}. -{this, "CosNotifyChannelAdmin::ProxyPullConsumer"}. -{from, "CosNotifyChannelAdmin::ProxyPullConsumer"}. -{{handle_info, "CosNotifyChannelAdmin::ProxyPullConsumer"}, true}. -{{impl, "CosNotifyChannelAdmin::ProxyPullConsumer"}, "PullerConsumer_impl"}. -{this, "CosNotifyChannelAdmin::SequenceProxyPushConsumer"}. -{from, "CosNotifyChannelAdmin::SequenceProxyPushConsumer"}. -{{handle_info, "CosNotifyChannelAdmin::SequenceProxyPushConsumer"}, true}. -{{impl, "CosNotifyChannelAdmin::SequenceProxyPushConsumer"}, "PusherConsumer_impl"}. -{this, "CosNotifyChannelAdmin::SequenceProxyPullConsumer"}. -{from, "CosNotifyChannelAdmin::SequenceProxyPullConsumer"}. -{{handle_info, "CosNotifyChannelAdmin::SequenceProxyPullConsumer"}, true}. -{{impl, "CosNotifyChannelAdmin::SequenceProxyPullConsumer"}, "PullerConsumer_impl"}. diff --git a/lib/cosNotification/src/CosNotifyChannelAdmin.idl b/lib/cosNotification/src/CosNotifyChannelAdmin.idl deleted file mode 100644 index b345ff5423..0000000000 --- a/lib/cosNotification/src/CosNotifyChannelAdmin.idl +++ /dev/null @@ -1,275 +0,0 @@ -#ifndef _COS_NOTIFYCHANNELADMIN_IDL_ -#define _COS_NOTIFYCHANNELADMIN_IDL_ - -#pragma prefix "omg.org" - -#include -#include -#include -#include - -module CosNotifyChannelAdmin { - exception ConnectionAlreadyActive {}; - exception ConnectionAlreadyInactive {}; - exception NotConnected {}; - // Forward declarations - interface ConsumerAdmin; - interface SupplierAdmin; - interface EventChannel; - interface EventChannelFactory; - - enum ProxyType { - PUSH_ANY, - PULL_ANY, - PUSH_STRUCTURED, - PULL_STRUCTURED, - PUSH_SEQUENCE, - PULL_SEQUENCE}; - - enum ObtainInfoMode { - ALL_NOW_UPDATES_OFF, - ALL_NOW_UPDATES_ON, - NONE_NOW_UPDATES_OFF, - NONE_NOW_UPDATES_ON}; - - interface ProxyConsumer : CosNotification::QoSAdmin, CosNotifyFilter::FilterAdmin { - readonly attribute ProxyType MyType; - readonly attribute SupplierAdmin MyAdmin; - - CosNotification::EventTypeSeq obtain_subscription_types(in ObtainInfoMode mode); - - void validate_event_qos (in CosNotification::QoSProperties required_qos, - out CosNotification::NamedPropertyRangeSeq available_qos) - raises (CosNotification::UnsupportedQoS); - }; // ProxyConsumer - - interface ProxySupplier : CosNotification::QoSAdmin, CosNotifyFilter::FilterAdmin { - readonly attribute ProxyType MyType; - readonly attribute ConsumerAdmin MyAdmin; - attribute CosNotifyFilter::MappingFilter priority_filter; - attribute CosNotifyFilter::MappingFilter lifetime_filter; - - CosNotification::EventTypeSeq obtain_offered_types(in ObtainInfoMode mode); - - void validate_event_qos (in CosNotification::QoSProperties required_qos, - out CosNotification::NamedPropertyRangeSeq available_qos) - raises (CosNotification::UnsupportedQoS); - }; // ProxySupplier - - interface ProxyPushConsumer : ProxyConsumer, CosNotifyComm::PushConsumer, - CosEventChannelAdmin::ProxyPushConsumer { - void connect_any_push_supplier (in CosEventComm::PushSupplier push_supplier) - raises(CosEventChannelAdmin::AlreadyConnected); - }; // ProxyPushConsumer - - interface StructuredProxyPushConsumer : ProxyConsumer, CosNotifyComm::StructuredPushConsumer { - void connect_structured_push_supplier (in CosNotifyComm::StructuredPushSupplier push_supplier) - raises(CosEventChannelAdmin::AlreadyConnected); - }; // StructuredProxyPushConsumer - - interface SequenceProxyPushConsumer : ProxyConsumer, CosNotifyComm::SequencePushConsumer { - void connect_sequence_push_supplier (in CosNotifyComm::SequencePushSupplier push_supplier) - raises(CosEventChannelAdmin::AlreadyConnected); - }; // SequenceProxyPushConsumer - - interface ProxyPullSupplier : ProxySupplier, CosNotifyComm::PullSupplier, - CosEventChannelAdmin::ProxyPullSupplier, oe_CosNotificationComm::Event { - void connect_any_pull_consumer (in CosEventComm::PullConsumer pull_consumer) - raises(CosEventChannelAdmin::AlreadyConnected); - }; // ProxyPullSupplier - - interface StructuredProxyPullSupplier : ProxySupplier, CosNotifyComm::StructuredPullSupplier, - oe_CosNotificationComm::Event { - void connect_structured_pull_consumer (in CosNotifyComm::StructuredPullConsumer pull_consumer) - raises(CosEventChannelAdmin::AlreadyConnected); - }; // StructuredProxyPullSupplier - - interface SequenceProxyPullSupplier : ProxySupplier, CosNotifyComm::SequencePullSupplier, - oe_CosNotificationComm::Event { - void connect_sequence_pull_consumer (in CosNotifyComm::SequencePullConsumer pull_consumer) - raises(CosEventChannelAdmin::AlreadyConnected); - }; // SequenceProxyPullSupplier - - interface ProxyPullConsumer : ProxyConsumer, CosNotifyComm::PullConsumer, - CosEventChannelAdmin::ProxyPullConsumer { - void connect_any_pull_supplier (in CosEventComm::PullSupplier pull_supplier) - raises(CosEventChannelAdmin::AlreadyConnected, CosEventChannelAdmin::TypeError); - - void suspend_connection() - raises(ConnectionAlreadyInactive, NotConnected); - - void resume_connection() - raises(ConnectionAlreadyActive, NotConnected); - }; // ProxyPullConsumer - - interface StructuredProxyPullConsumer : ProxyConsumer, CosNotifyComm::StructuredPullConsumer { - void connect_structured_pull_supplier (in CosNotifyComm::StructuredPullSupplier pull_supplier) - raises(CosEventChannelAdmin::AlreadyConnected, CosEventChannelAdmin::TypeError); - - void suspend_connection() - raises(ConnectionAlreadyInactive, NotConnected); - - void resume_connection() - raises(ConnectionAlreadyActive, NotConnected); - }; // StructuredProxyPullConsumer - - interface SequenceProxyPullConsumer : ProxyConsumer, CosNotifyComm::SequencePullConsumer { - void connect_sequence_pull_supplier (in CosNotifyComm::SequencePullSupplier pull_supplier) - raises(CosEventChannelAdmin::AlreadyConnected, CosEventChannelAdmin::TypeError); - - void suspend_connection() - raises(ConnectionAlreadyInactive, NotConnected); - - void resume_connection() - raises(ConnectionAlreadyActive, NotConnected); - }; // SequenceProxyPullConsumer - - interface ProxyPushSupplier : ProxySupplier, CosNotifyComm::PushSupplier, - CosEventChannelAdmin::ProxyPushSupplier, oe_CosNotificationComm::Event { - void connect_any_push_consumer (in CosEventComm::PushConsumer push_consumer) - raises(CosEventChannelAdmin::AlreadyConnected, CosEventChannelAdmin::TypeError); - - void suspend_connection() - raises(ConnectionAlreadyInactive, NotConnected); - - void resume_connection() - raises(ConnectionAlreadyActive, NotConnected); - }; // ProxyPushSupplier - - interface StructuredProxyPushSupplier : ProxySupplier, CosNotifyComm::StructuredPushSupplier, - oe_CosNotificationComm::Event { - void connect_structured_push_consumer (in CosNotifyComm::StructuredPushConsumer push_consumer) - raises(CosEventChannelAdmin::AlreadyConnected, CosEventChannelAdmin::TypeError); - - void suspend_connection() - raises(ConnectionAlreadyInactive, NotConnected); - - void resume_connection() - raises(ConnectionAlreadyActive, NotConnected); - }; // StructuredProxyPushSupplier - - interface SequenceProxyPushSupplier : ProxySupplier, CosNotifyComm::SequencePushSupplier, - oe_CosNotificationComm::Event { - void connect_sequence_push_consumer (in CosNotifyComm::SequencePushConsumer push_consumer) - raises(CosEventChannelAdmin::AlreadyConnected, CosEventChannelAdmin::TypeError); - - void suspend_connection() - raises(ConnectionAlreadyInactive, NotConnected); - - void resume_connection() - raises(ConnectionAlreadyActive, NotConnected); - }; // SequenceProxyPushSupplier - - - typedef long ProxyID; - typedef sequence ProxyIDSeq; - - enum ClientType { - ANY_EVENT, - STRUCTURED_EVENT, - SEQUENCE_EVENT}; - - enum InterFilterGroupOperator { - AND_OP, - OR_OP }; - - typedef long AdminID; - typedef sequence AdminIDSeq; - - exception AdminNotFound {}; - exception ProxyNotFound {}; - - struct AdminLimit { - CosNotification::PropertyName name; - CosNotification::PropertyValue value; - }; - - exception AdminLimitExceeded { AdminLimit admin_property_err; }; - - interface ConsumerAdmin : CosNotification::QoSAdmin, CosNotifyComm::NotifySubscribe, - CosNotifyFilter::FilterAdmin, CosEventChannelAdmin::ConsumerAdmin, - oe_CosNotificationComm::Event { - readonly attribute AdminID MyID; - readonly attribute EventChannel MyChannel; - readonly attribute InterFilterGroupOperator MyOperator; - attribute CosNotifyFilter::MappingFilter priority_filter; - attribute CosNotifyFilter::MappingFilter lifetime_filter; - readonly attribute ProxyIDSeq pull_suppliers; - readonly attribute ProxyIDSeq push_suppliers; - - ProxySupplier get_proxy_supplier (in ProxyID proxy_id) - raises (ProxyNotFound); - - ProxySupplier obtain_notification_pull_supplier (in ClientType ctype, out ProxyID proxy_id) - raises (AdminLimitExceeded); - - ProxySupplier obtain_notification_push_supplier (in ClientType ctype, out ProxyID proxy_id) - raises (AdminLimitExceeded); - - void destroy(); - }; // ConsumerAdmin - - interface SupplierAdmin : CosNotification::QoSAdmin, CosNotifyComm::NotifyPublish, - CosNotifyFilter::FilterAdmin, CosEventChannelAdmin::SupplierAdmin , - oe_CosNotificationComm::Event { - readonly attribute AdminID MyID; - readonly attribute EventChannel MyChannel; - readonly attribute InterFilterGroupOperator MyOperator; - readonly attribute ProxyIDSeq pull_consumers; - readonly attribute ProxyIDSeq push_consumers; - - ProxyConsumer get_proxy_consumer (in ProxyID proxy_id) - raises (ProxyNotFound); - - ProxyConsumer obtain_notification_pull_consumer (in ClientType ctype, out ProxyID proxy_id) - raises (AdminLimitExceeded); - - ProxyConsumer obtain_notification_push_consumer (in ClientType ctype, out ProxyID proxy_id) - raises (AdminLimitExceeded); - - void destroy(); - }; // SupplierAdmin - - interface EventChannel : CosNotification::QoSAdmin, CosNotification::AdminPropertiesAdmin, - CosEventChannelAdmin::EventChannel, - oe_CosNotificationComm::Event { - readonly attribute EventChannelFactory MyFactory; - readonly attribute ConsumerAdmin default_consumer_admin; - readonly attribute SupplierAdmin default_supplier_admin; - readonly attribute CosNotifyFilter::FilterFactory default_filter_factory; - - ConsumerAdmin new_for_consumers(in InterFilterGroupOperator op, out AdminID id); - - SupplierAdmin new_for_suppliers(in InterFilterGroupOperator op, out AdminID id); - - ConsumerAdmin get_consumeradmin (in AdminID id) - raises (AdminNotFound); - - SupplierAdmin get_supplieradmin (in AdminID id) - raises (AdminNotFound); - - AdminIDSeq get_all_consumeradmins(); - - AdminIDSeq get_all_supplieradmins(); - }; // EventChannel - - typedef long ChannelID; - typedef sequence ChannelIDSeq; - exception ChannelNotFound {}; - - interface EventChannelFactory { - EventChannel create_channel (in CosNotification::QoSProperties initial_qos, - in CosNotification::AdminProperties initial_admin, - out ChannelID id) - raises(CosNotification::UnsupportedQoS, CosNotification::UnsupportedAdmin); - - ChannelIDSeq get_all_channels(); - - EventChannel get_event_channel (in ChannelID id) - raises (ChannelNotFound); - }; // EventChannelFactory -}; // CosNotifyChannelAdmin - - -#endif /* ifndef _COS_NOTIFYCHANNELADMIN_IDL_ */ - diff --git a/lib/cosNotification/src/CosNotifyChannelAdmin_ConsumerAdmin_impl.erl b/lib/cosNotification/src/CosNotifyChannelAdmin_ConsumerAdmin_impl.erl deleted file mode 100644 index e7a6a35ea7..0000000000 --- a/lib/cosNotification/src/CosNotifyChannelAdmin_ConsumerAdmin_impl.erl +++ /dev/null @@ -1,671 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%------------------------------------------------------------------- -%% File : CosNotifyChannelAdmin_ConsumerAdmin_impl.erl -%% Purpose : -%%------------------------------------------------------------------- - --module('CosNotifyChannelAdmin_ConsumerAdmin_impl'). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). --include("CosNotification_Definitions.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%%--------------- External ----------------------------------- -%%----- CosNotifyChannelAdmin::ConsumerAdmin ----------------- --export([get_proxy_supplier/4, - obtain_notification_pull_supplier/4, - obtain_notification_push_supplier/4, - destroy/3]). - -%%----- Inherit from CosNotification::QoSAdmin --------------- --export([get_qos/3, - set_qos/4, - validate_qos/4]). - -%%----- Inherit from CosNotifyComm::NotifySubscribe ---------- --export([subscription_change/5]). - -%%----- Inherit from CosNotifyFilter::FilterAdmin ------------ --export([add_filter/4, - remove_filter/4, - get_filter/4, - get_all_filters/3, - remove_all_filters/3]). - -%%----- Inherit from CosEventChannelAdmin::ConsumerAdmin ----- --export([obtain_push_supplier/3, - obtain_pull_supplier/3]). - -%% Attributes (external) --export(['_get_MyID'/3, - '_get_MyChannel'/3, - '_get_MyOperator'/3, - '_get_priority_filter'/3, - '_set_priority_filter'/4, - '_get_lifetime_filter'/3, - '_set_lifetime_filter'/4, - '_get_pull_suppliers'/3, - '_get_push_suppliers'/3]). - -%%--------------- Internal ----------------------------------- -%%----- Inherit from cosNotificationComm --------------------- --export([callAny/5, - callSeq/5]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - -%%--------------- LOCAL DEFINITIONS -------------------------- -%% Data structures --record(state, {myId, - myChannel, - myChannelPid, - myOperator, - myFilters = [], - mySuppliers = [], - idCounter = 0, - priorityFilter, - lifetimeFilter, - etsR, - qosGlobal, - qosLocal, - options}). - -%% Data structures constructors --define(get_InitState(_MyID, _MyCh, _MyChP, _MyOp, _PFil, _LFil, _QoS, _LQS, _O), - #state{myId = _MyID, - myChannel = _MyCh, - myChannelPid = _MyChP, - myOperator = _MyOp, - priorityFilter = _PFil, - lifetimeFilter = _LFil, - qosGlobal = _QoS, - qosLocal = _LQS, - options = _O, - etsR = ets:new(oe_ets, [set, protected])}). - -%% Data structures selectors --define(get_PushSupplierIDs(S), find_ids(S#state.mySuppliers, pusher)). --define(get_PullSupplierIDs(S), find_ids(S#state.mySuppliers, puller)). --define(get_AllSuppliers(S), S#state.mySuppliers). --define(get_AllSupplierRefs(S), find_refs(S#state.mySuppliers)). --define(get_Supplier(S, I), find_obj(lists:keysearch(I,1,S#state.mySuppliers), - supplier)). - --define(get_MyID(S), S#state.myId). --define(get_MyChannel(S), S#state.myChannel). --define(get_MyChannelPid(S), S#state.myChannelPid). --define(get_MyOperator(S), S#state.myOperator). --define(get_PrioFilter(S), S#state.priorityFilter). --define(get_LifeFilter(S), S#state.lifetimeFilter). --define(get_GlobalQoS(S), S#state.qosGlobal). --define(get_LocalQoS(S), S#state.qosLocal). --define(get_BothQoS(S), {S#state.qosGlobal, S#state.qosLocal}). --define(get_Filter(S, I), find_obj(lists:keysearch(I, 1, S#state.myFilters), - filter)). --define(get_AllFilter(S), S#state.myFilters). --define(get_AllFilterID(S), find_ids(S#state.myFilters)). --define(get_Options(S), S#state.options). --define(get_IdCounter(S), S#state.idCounter). - -%% Data structures modifiers --define(set_PrioFilter(S,D), S#state{priorityFilter=D}). --define(set_LifeFilter(S,D), S#state{lifetimeFilter=D}). --define(set_LocalQoS(S,D), S#state{qosLocal=D}). --define(set_GlobalQoS(S,D), S#state{qosGlobal=D}). --define(set_BothQoS(S,GD,LD), S#state{qosGlobal=GD, qosLocal=LD}). --define(add_PushSupplier(S,I,R,P),S#state{mySuppliers=[{I,R,P,pusher}|S#state.mySuppliers]}). --define(add_PullSupplier(S,I,R,P),S#state{mySuppliers=[{I,R,P,puller}|S#state.mySuppliers]}). --define(del_Supplier(S,I), S#state{mySuppliers= - lists:keydelete(I, 1, - S#state.mySuppliers)}). --define(del_SupplierRef(S,O), S#state{mySuppliers= - lists:keydelete(O, 2, - S#state.mySuppliers)}). --define(del_SupplierPid(S,P), S#state{mySuppliers= - lists:keydelete(P, 3, - S#state.mySuppliers)}). --define(add_Filter(S,I,O), S#state{myFilters=[{I,O}|S#state.myFilters]}). --define(del_Filter(S,I), S#state{myFilters= - delete_filter(lists:keydelete(I, 1, - S#state.myFilters), - S#state.myFilters)}). --define(del_AllFilter(S), S#state{myFilters=[]}). --define(set_IdCounter(S,V), S#state{idCounter=V}). --define(new_Id(S), 'CosNotification_Common':create_id( - S#state.idCounter)). - -%% MISC --define(is_PersistentConnection(S), - ?not_GetConnectionReliability((S#state.qosLocal)) == ?not_Persistent). --define(is_PersistentEvent(S), - ?not_GetEventReliability((S#state.qosLocal)) == ?not_Persistent). --define(is_ANDOP(S), S#state.myOperator == 'AND_OP'). - -%%----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the gen_server module. -%%----------------------------------------------------------- - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(Info, State) -> - case Info of - {'EXIT', Pid, Reason} when ?get_MyChannelPid(State) == Pid -> - ?DBG("PARENT CHANNEL: ~p TERMINATED.~n",[Reason]), - {stop, Reason, State}; - {'EXIT', Pid, normal} -> - {noreply, ?del_SupplierPid(State, Pid)}; - _Other -> - {noreply, State} - end. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init([MyId, MyChannel, MyChannelPid, MyOperator, InitQoS, LQS, Options]) -> - process_flag(trap_exit, true), - PriorityFilter = corba:create_nil_objref(), - LifeTimeFilter = corba:create_nil_objref(), - {ok, ?get_InitState(MyId, MyChannel, MyChannelPid, MyOperator, - PriorityFilter, LifeTimeFilter, InitQoS, LQS, Options)}. - -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------- -%%----- CosNotifyChannelAdmin_ConsumerAdmin attributes ------ -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Attribute: '_get_MyID' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyID'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyID(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_MyChannel' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyChannel'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyChannel(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_MyOperator' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyOperator'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyOperator(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_priority_filter' -%% Type : read and write -%% Returns : -%%----------------------------------------------------------- -'_get_priority_filter'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_PrioFilter(State), State}. - -'_set_priority_filter'(_OE_THIS, _OE_FROM, State, PrioFilter) -> - {reply, ok, ?set_PrioFilter(State, PrioFilter)}. - -%%----------------------------------------------------------% -%% Attribute: '_get_lifetime_filter' -%% Type : read and write -%% Returns : -%%----------------------------------------------------------- -'_get_lifetime_filter'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_LifeFilter(State), State}. -'_set_lifetime_filter'(_OE_THIS, _OE_FROM, State, LifeFilter) -> - {reply, ok, ?set_LifeFilter(State, LifeFilter)}. - -%%----------------------------------------------------------% -%% Attribute: '_get_pull_suppliers' -%% Type : readonly -%% Returns : ProxyIDSeq -%%----------------------------------------------------------- -'_get_pull_suppliers'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_PullSupplierIDs(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_push_suppliers' -%% Type : readonly -%% Returns : ProxyIDSeq -%%----------------------------------------------------------- -'_get_push_suppliers'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_PushSupplierIDs(State), State}. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% function : get_proxy_supplier -%% Arguments: ProxyID - unique identifier (long) -%% Returns : ObjRef | {'EXCEPTION', #'ProxyNotFound'{}} -%%----------------------------------------------------------- -get_proxy_supplier(_OE_THIS, _OE_FROM, State, Proxy_id) -> - {reply, ?get_Supplier(State, Proxy_id), State}. - -%%----------------------------------------------------------% -%% function : obtain_notification_pull_supplier -%% Arguments: Ctype - 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' -%% Returns : A Proxy of the requested type. -%%----------------------------------------------------------- -obtain_notification_pull_supplier(OE_THIS, _OE_FROM, State, Ctype) -> - %% Choose which module to use. - {Mod, Type} = - case Ctype of - 'ANY_EVENT' -> - {'CosNotifyChannelAdmin_ProxyPullSupplier', 'PULL_ANY'}; - 'STRUCTURED_EVENT' -> - {'CosNotifyChannelAdmin_StructuredProxyPullSupplier', 'PULL_STRUCTURED'}; - 'SEQUENCE_EVENT' -> - {'CosNotifyChannelAdmin_SequenceProxyPullSupplier', 'PULL_SEQUENCE'}; - _ -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:" - "obtain_notification_pull_supplier(~p);~n" - "Incorrect enumerant", - [?LINE, Ctype], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end, - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case Mod:oe_create_link([Type, OE_THIS, self(), ?get_GlobalQoS(State), - ?get_LocalQoS(State), ?get_MyChannel(State), - ?get_Options(State), ?get_MyOperator(State)], - [{sup_child, true}|SO]) of - {ok, Pid, PrRef} -> - ProxyID = ?new_Id(State), - NewState = ?add_PullSupplier(State, ProxyID, PrRef, Pid), - {reply, {PrRef, ProxyID}, ?set_IdCounter(NewState, ProxyID)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:" - "obtain_notification_pull_supplier();~n" - "Unable to create: ~p/~p~n" - "Reason: ~p", [?LINE, Mod, Type, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%----------------------------------------------------------% -%% function : obtain_notification_push_supplier -%% Arguments: Ctype - 'ANY_EVENT' | 'STRUCTURED_EVENT' | 'SEQUENCE_EVENT' -%% Returns : A Proxy of the requested type. -%%----------------------------------------------------------- -obtain_notification_push_supplier(OE_THIS, _OE_FROM, State, Ctype) -> - %% Choose which module to use. - {Mod, Type} = - case Ctype of - 'ANY_EVENT' -> - {'CosNotifyChannelAdmin_ProxyPushSupplier', 'PUSH_ANY'}; - 'STRUCTURED_EVENT' -> - {'CosNotifyChannelAdmin_StructuredProxyPushSupplier', 'PUSH_STRUCTURED'}; - 'SEQUENCE_EVENT' -> - {'CosNotifyChannelAdmin_SequenceProxyPushSupplier', 'PUSH_SEQUENCE'}; - _ -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:" - "obtain_notification_push_supplier(~p);~n" - "Incorrect enumerant", [?LINE, Ctype], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end, - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case Mod:oe_create_link([Type, OE_THIS, self(), ?get_GlobalQoS(State), - ?get_LocalQoS(State), ?get_MyChannel(State), - ?get_Options(State), ?get_MyOperator(State)], - [{sup_child, true}|SO]) of - {ok, Pid, PrRef} -> - ProxyID = ?new_Id(State), - NewState = ?add_PushSupplier(State, ProxyID, PrRef, Pid), - {reply, {PrRef, ProxyID}, ?set_IdCounter(NewState, ProxyID)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:obtain_notification_push_supplier();~n" - "Unable to create: ~p/~p~n" - "Reason: ~p", - [?LINE, Mod, Type, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - - -%%----------------------------------------------------------% -%% function : destroy -%% Arguments: - -%% Returns : ok -%%------------------------------------------------------------ -destroy(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, State}. - -%%----- Inherit from CosNotification::QoSAdmin -------------- -%%----------------------------------------------------------% -%% function : get_qos -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -get_qos(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_GlobalQoS(State), State}. - -%%----------------------------------------------------------% -%% function : set_qos -%% Arguments: QoS - CosNotification::QoSProperties, i.e., -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : ok | {'EXCEPTION', CosNotification::UnsupportedQoS} -%%----------------------------------------------------------- -set_qos(_OE_THIS, _OE_FROM, State, QoS) -> - {NewQoS, LQS} = 'CosNotification_Common':set_qos(QoS, ?get_BothQoS(State), - admin, ?get_MyChannel(State), - ?get_AllSupplierRefs(State)), - {reply, ok, ?set_BothQoS(State, NewQoS, LQS)}. - -%%----------------------------------------------------------% -%% function : validate_qos -%% Arguments: Required_qos - CosNotification::QoSProperties -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : {'EXCEPTION', CosNotification::UnsupportedQoS} -%%----------------------------------------------------------- -validate_qos(_OE_THIS, _OE_FROM, State, Required_qos) -> - QoS = 'CosNotification_Common':validate_qos(Required_qos, ?get_BothQoS(State), - admin, ?get_MyChannel(State), - ?get_AllSupplierRefs(State)), - {reply, {ok, QoS}, State}. - -%%----- Inherit from CosNotifyComm::NotifySubscribe --------- -%%----------------------------------------------------------* -%% function : subscription_change -%% Arguments: -%% Returns : ok | -%% {'EXCEPTION', #'CosNotifyComm_InvalidEventType'{type}} -%%----------------------------------------------------------- -subscription_change(_OE_THIS, _OE_FROM, State, _Added, _Removed) -> - ?DBG("CALLBACK INFORMED: ~p ~p~n",[_Added, _Removed]), - {reply, ok, State}. - -%%----- Inherit from CosNotifyFilter::FilterAdmin ----------- -%%----------------------------------------------------------% -%% function : add_filter -%% Arguments: Filter - CosNotifyFilter::Filter -%% Returns : FilterID - long -%%----------------------------------------------------------- -add_filter(_OE_THIS, _OE_FROM, State, Filter) -> - 'CosNotification_Common':type_check(Filter, 'CosNotifyFilter_Filter'), - FilterID = ?new_Id(State), - NewState = ?set_IdCounter(State, FilterID), - {reply, FilterID, ?add_Filter(NewState, FilterID, Filter)}. - -%%----------------------------------------------------------% -%% function : remove_filter -%% Arguments: FilterID - long -%% Returns : ok -%%----------------------------------------------------------- -remove_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ok, ?del_Filter(State, FilterID)}; -remove_filter(_,_,_,_) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_filter -%% Arguments: FilterID - long -%% Returns : Filter - CosNotifyFilter::Filter | -%% {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}} -%%----------------------------------------------------------- -get_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ?get_Filter(State, FilterID), State}; -get_filter(_,_,_,_) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_all_filters -%% Arguments: - -%% Returns : Filter - CosNotifyFilter::FilterIDSeq -%%----------------------------------------------------------- -get_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_AllFilterID(State), State}. - -%%----------------------------------------------------------% -%% function : remove_all_filters -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -remove_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ok, ?del_AllFilter(State)}. - -%%----- Inherit from CosEventChannelAdmin::ConsumerAdmin ---- -%%----------------------------------------------------------% -%% function : obtain_push_supplier -%% Arguments: - -%% Returns : ProxyPushSupplier -%%----------------------------------------------------------- -obtain_push_supplier(OE_THIS, _OE_FROM, State) -> - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_create_link(['PUSH_ANY', OE_THIS, - self(), - ?get_GlobalQoS(State), - ?get_LocalQoS(State), - ?get_MyChannel(State), - ?get_Options(State), - ?get_MyOperator(State)], - [{sup_child, true}|SO]) of - {ok, Pid, PrRef} -> - ProxyID = ?new_Id(State), - NewState = ?add_PushSupplier(State, ProxyID, PrRef, Pid), - {reply, PrRef, ?set_IdCounter(NewState, ProxyID)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:obtain_push_supplier();~n" - "Unable to create: CosNotifyChannelAdmin_ProxyPushSupplier~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%----------------------------------------------------------% -%% function : obtain_pull_supplier -%% Arguments: - -%% Returns : ProxyPullSupplier -%%----------------------------------------------------------- -obtain_pull_supplier(OE_THIS, _OE_FROM, State) -> - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_create_link(['PULL_ANY', OE_THIS, - self(), - ?get_GlobalQoS(State), - ?get_LocalQoS(State), - ?get_MyChannel(State), - ?get_Options(State), - ?get_MyOperator(State)], - [{sup_child, true}|SO]) of - {ok, Pid, PrRef} -> - ProxyID = ?new_Id(State), - NewState = ?add_PullSupplier(State, ProxyID, PrRef, Pid), - {reply, PrRef, ?set_IdCounter(NewState, ProxyID)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:obtain_pull_supplier();~n" - "Unable to create: CosNotifyChannelAdmin_ProxyPullSupplier~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%--------------- LOCAL FUNCTIONS ---------------------------- -%% To match suppliers -find_obj({value, {_,Obj,_,_}},_) -> Obj; -%% To match filters -find_obj({value, {_,Obj}},_) -> Obj; -find_obj(_, supplier) -> {'EXCEPTION', #'CosNotifyChannelAdmin_ProxyNotFound'{}}; -find_obj(_, filter) -> {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}}. - -find_ids(List) -> - find_ids(List, [], false). -find_ids(List, Type) -> - find_ids(List, [], Type). - -find_ids([], Acc, _) -> - Acc; -find_ids([{I,_}|T], Acc, Type) -> - find_ids(T, [I|Acc], Type); -find_ids([{I,_,_,Type}|T], Acc, Type) -> - find_ids(T, [I|Acc], Type); -find_ids([{_I,_,_,_}|T], Acc, Type) -> - find_ids(T, Acc, Type); -find_ids(What, _, _) -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:find_ids();~n" - "Id corrupt: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). - -find_refs(List) -> - find_refs(List, []). - -find_refs([], Acc) -> - Acc; -find_refs([{_,R,_,_}|T], Acc) -> - find_refs(T, [R|Acc]); -find_refs(What, _) -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:find_refs();~n" - "Reference corrupt: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). - -%% Delete a single filter. -%% The list do not differ, i.e., no filter removed, raise exception. -delete_filter(List,List) -> corba:raise(#'CosNotifyFilter_FilterNotFound'{}); -delete_filter(List, _) -> List. - - -%%----------------------------------------------------------- -%% function : callSeq -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -callSeq(_OE_THIS, OE_FROM, State, Events, _Status) -> - corba:reply(OE_FROM, ok), - case cosNotification_eventDB:filter_events(Events, ?get_AllFilter(State)) of - {[], _} when ?is_ANDOP(State) -> - %% Since AND it doesn't matter what the proxies 'think'. Done. - {noreply, State}; - {[], Failed} -> - %% Is OR but the Proxy may allow the events; pass on. - forward(seq, State, Failed, 'MATCH'); - {Passed, _} when ?is_ANDOP(State) -> - %% Since AND we only forward those who passed this objects filters. - forward(seq, State, Passed, 'MATCH'); - {Passed, []} -> - %% Since OR we forward and tell the proxy to do no filtering. - forward(seq, State, Passed, 'MATCHED'); - {Passed, Failed} -> - %% Since OR we forward both and instruct the proxy to check only - %% the ones that failed. - forward(seq, State, Passed, 'MATCHED'), - forward(seq, State, Failed, 'MATCH') - end. - - -%%----------------------------------------------------------- -%% function : callAny -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -callAny(_OE_THIS, OE_FROM, State, Event, _Status) -> - corba:reply(OE_FROM, ok), - case cosNotification_eventDB:filter_events([Event], ?get_AllFilter(State)) of - {[], _} when ?is_ANDOP(State) -> - %% Since AND it doesn't matter what the proxies 'think'. Done. - {noreply, State}; - {[], [Failed]} -> - %% Is OR but the Proxy may allow the event; pass on. - forward(any, State, Failed, 'MATCH'); - {[Passed], _} when ?is_ANDOP(State) -> - %% Since AND we only forward those who passed this objects filters. - forward(any, State, Passed, 'MATCH'); - {[Passed], _} -> - %% Since OR we forward and instruct the proxy to do no checks. - forward(any, State, Passed, 'MATCHED') - end. - - - -%% Forward events -forward(Type, State, Event, Status) -> - forward(Type, ?get_AllSuppliers(State), State, Event, Status). -forward(_, [], State, _, _) -> - {noreply, State}; -forward(any, [{_,H,_,_}|T], State, Event, Status) -> - case catch oe_CosNotificationComm_Event:callAny(H, Event, Status) of - ok -> - ?DBG("CONSUMERADM FORWARD ANY: ~p~n",[Event]), - forward(any, T, State, Event, Status); - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:forward();~n" - "Proxy no longer exists; dropping it: ~p", - [?LINE, H], ?DEBUG_LEVEL), - NewState = ?del_SupplierRef(State,H), - forward(any, T, NewState, Event, Status); - R when ?is_PersistentConnection(State) -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:forward();~n" - "Proxy behaves badly: ~p/~p", - [?LINE, R, H], ?DEBUG_LEVEL), - forward(any, T, State, Event, Status); - R -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:forward();~n" - "Proxy behaves badly: ~p~n" - "Dropping it: ~p", [?LINE, R, H], ?DEBUG_LEVEL), - NewState = ?del_SupplierRef(State, H), - forward(any, T, NewState, Event, Status) - end; -forward(seq, [{_,H,_,_}|T], State, Event, Status) -> - case catch oe_CosNotificationComm_Event:callSeq(H, Event, Status) of - ok -> - ?DBG("CONSUMERADM FORWARD SEQUENCE: ~p~n",[Event]), - forward(seq, T, State, Event, Status); - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:forward();~n" - "Proxy no longer exists; dropping it: ~p", - [?LINE, H], ?DEBUG_LEVEL), - NewState = ?del_SupplierRef(State,H), - forward(seq, T, NewState, Event, Status); - R when ?is_PersistentConnection(State) -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:forward();~n" - "Proxy behaves badly: ~p/~p", [?LINE, R, H], ?DEBUG_LEVEL), - forward(seq, T, State, Event, Status); - R -> - orber:dbg("[~p] CosNotifyChannelAdmin_ConsumerAdmin:forward();~n" - "Proxy behaves badly: ~p~n" - "Dropping it: ~p", [?LINE, R, H], ?DEBUG_LEVEL), - NewState = ?del_SupplierRef(State, H), - forward(seq, T, NewState, Event, Status) - end. - - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/CosNotifyChannelAdmin_EventChannelFactory_impl.erl b/lib/cosNotification/src/CosNotifyChannelAdmin_EventChannelFactory_impl.erl deleted file mode 100644 index eb3fb4a6a3..0000000000 --- a/lib/cosNotification/src/CosNotifyChannelAdmin_EventChannelFactory_impl.erl +++ /dev/null @@ -1,143 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%------------------------------------------------------------------- -%% File : CosNotifyChannelAdmin_EventChannelFactory_impl.erl -%% Purpose : -%%------------------------------------------------------------------- - --module('CosNotifyChannelAdmin_EventChannelFactory_impl'). - -%%--------------- INCLUDES ----------------------------------- -%% Application files --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). --include("CosNotification_Definitions.hrl"). - -%%--------------- IMPORTS ------------------------------------ - -%%--------------- EXPORTS ------------------------------------ -%% External --export([create_channel/5, - get_all_channels/3, - get_event_channel/4]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - -%%--------------- LOCAL DEFINITIONS -------------------------- -%% Data structures --record(state, {adminProp, - idCounter = 0, - options, - etsR, - server_options}). - -%%-----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: See gen_server documentation. -%% Effect : Functions demanded by the gen_server module. -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(Info, State) -> - ?debug_print("INFO: ~p~n", [Info]), - case Info of - {'EXIT', Pid, normal} -> - ets:match_delete(State#state.etsR, {'_','_',Pid}), - {noreply, State}; - _Other -> - ?debug_print("TERMINATED: ~p~n",[_Other]), - {noreply, State} - end. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init(Options) -> - process_flag(trap_exit, true), - SO = 'CosNotification_Common':get_option(server_options, Options, ?not_DEFAULT_SETTINGS), - {ok, #state{options = Options, - etsR = ets:new(oe_ets, [set, protected]), - server_options = SO}}. - -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% function : create_channel -%% Arguments: InitQoS -%% InitAdmin -%% Returns : Ch - Channel obj ref -%% Id - Channel Id (out-type) -%%----------------------------------------------------------- -create_channel(OE_THIS, _OE_FROM, State, InitQoS, InitAdmin) -> - {QoS, LQoS} = 'CosNotification_Common':init_qos(InitQoS), - {IAdm, LAdm} = 'CosNotification_Common':init_adm(InitAdmin), - Id = 'CosNotification_Common':create_id(State#state.idCounter), - case 'CosNotifyChannelAdmin_EventChannel':oe_create_link([OE_THIS, QoS, IAdm, - LQoS, LAdm, - State#state.options], - [{sup_child, true}|State#state.server_options]) of - {ok, Pid, Ch} -> - ets:insert(State#state.etsR, {Id,Ch,Pid}), - {reply, {Ch, Id}, State#state{idCounter=Id}}; - _ -> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%----------------------------------------------------------% -%% function : get_all_channels -%% Arguments: - -%% Returns : ChannelIDSeq - List of alive channels created -%% by this factory. -%%----------------------------------------------------------- -get_all_channels(_OE_THIS, _OE_FROM, State) -> - {reply, lists:flatten(ets:match(State#state.etsR, {'$1','_','_'})), State}. - -%%----------------------------------------------------------% -%% function : get_event_channel -%% Arguments: ChannelId -%% Returns : ChannelRef | 'CosNotifyChannelAdmin_ChannelNotFound' -%%----------------------------------------------------------- -get_event_channel(_OE_THIS, _OE_FROM, State, Id) -> - {reply, find_obj(ets:lookup(State#state.etsR, Id)), State}. - -%%--------------- LOCAL FUNCTIONS ---------------------------- -find_obj([]) -> {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}; -find_obj([{_, Obj,_}]) -> Obj; -find_obj(_) -> {'EXCEPTION', #'CosNotifyChannelAdmin_ChannelNotFound'{}}. - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/CosNotifyChannelAdmin_EventChannel_impl.erl b/lib/cosNotification/src/CosNotifyChannelAdmin_EventChannel_impl.erl deleted file mode 100644 index 485c9aeef4..0000000000 --- a/lib/cosNotification/src/CosNotifyChannelAdmin_EventChannel_impl.erl +++ /dev/null @@ -1,722 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%------------------------------------------------------------------- -%% File : CosNotifyChannelAdmin_EventChannel_impl.erl -%% Purpose : -%% Created : 28 Sep 1999 -%%------------------------------------------------------------------- - --module('CosNotifyChannelAdmin_EventChannel_impl'). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). --include("CosNotification_Definitions.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%%--------------- External ----------------------------------- -%%----- CosNotifyChannelAdmin::EventChannel ------------------ --export([new_for_consumers/4, - new_for_suppliers/4, - get_consumeradmin/4, - get_supplieradmin/4, - get_all_consumeradmins/3, - get_all_supplieradmins/3]). - -%% Attributes (external) --export(['_get_MyFactory'/3, - '_get_default_consumer_admin'/3, - '_get_default_supplier_admin'/3, - '_get_default_filter_factory'/3]). - -%%----- Inherit from CosNotification::QoSAdmin --------------- --export([get_qos/3, - set_qos/4, - validate_qos/4]). - -%%----- Inherit from CosNotification::AdminPropertiesAdmin --- --export([get_admin/3, - set_admin/4]). - -%%----- Inherit from CosEventChannelAdmin::EventChannel ------ --export([for_consumers/3, - for_suppliers/3, - destroy/3]). -%%--------------- Internal ----------------------------------- -%%----- Inherit from cosNotificationComm --------------------- --export([callAny/5, - callSeq/5]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - -%% Data structures --record(state, {myFac, - myConsumers = [], - defConsumerAdmin, - defSupplierAdmin, - defConsumerAdminPid, - defSupplierAdminPid, - defFilterFac, - defFilterFacPid, - etsR, - qosLocal, - qosGlobal, - admGlobal, - options, - idCounter = 0, - 'MaxQueueLength', - 'MaxConsumers', - 'MaxSuppliers'}). -%% Data structures constructors --define(get_InitState(My, Fil, FilPid, QoS, LQoS, GA, MQ, MC, MS, O), - #state{myFac = My, - defFilterFac = Fil, - defFilterFacPid = FilPid, - etsR = ets:new(oe_ets, [set, protected]), - qosLocal = LQoS, - qosGlobal = QoS, - admGlobal = GA, - options = O, - 'MaxQueueLength' = MQ, - 'MaxConsumers' = MC, - 'MaxSuppliers' = MS}). - -%% NOTE!!! -%% When forwarding events, the objects we will contact is ONLY ConsumerAdmins!! -%% Hence, we will store SupplierAdmins and ConsumerAdmins differently. SupplierAdmins -%% we store in our ets-table while the ConsumerAdmins will be stored on the local -%% State. - -%% Data structures selectors --define(get_supplierAdmins(S), [S#state.defSupplierAdmin| - lists:flatten(ets:match(S#state.etsR, - {'_','$1','_'}))]). --define(get_consumerAdmins(S), [{0, S#state.defConsumerAdmin,S#state.defConsumerAdminPid} - |S#state.myConsumers]). --define(get_allAdmins(S), [S#state.defSupplierAdmin, - S#state.defConsumerAdmin| - lists:flatten(ets:match(S#state.etsR, - {'_','$1','_'}))++ - find_field(S#state.myConsumers, 2)]). --define(get_consumerAdmIDs(S), [0|find_field(S#state.myConsumers, 1)]). --define(get_supplierAdmIDs(S), [0|lists:flatten(ets:match(S#state.etsR, - {'$1','_','_'}))]). - --define(get_supplierAdmin(S, I), find_obj(ets:lookup(S#state.etsR, I))). --define(get_consumerAdmin(S, I), find_obj(lists:keysearch(I,1,S#state.myConsumers))). --define(get_supplierAmount(S), ets:info(S#state.etsR, size)). --define(get_consumerAmount(S), length(S#state.myConsumers)). - --define(get_MyFactory(S), S#state.myFac). --define(get_defConsumerAdm(S), S#state.defConsumerAdmin). --define(get_defSupplierAdm(S), S#state.defSupplierAdmin). --define(get_defConsumerAdmPid(S), S#state.defConsumerAdminPid). --define(get_defSupplierAdmPid(S), S#state.defSupplierAdminPid). --define(get_defFilterFac(S), S#state.defFilterFac). --define(get_defFilterFacPid(S), S#state.defFilterFacPid). --define(get_GlobalQoS(S), S#state.qosGlobal). --define(get_LocalQoS(S), S#state.qosLocal). --define(get_BothQoS(S), {S#state.qosGlobal, S#state.qosLocal}). --define(get_GlobalAdm(S), S#state.admGlobal). --define(get_Options(S), S#state.options). --define(get_MaxQueueLength(S), S#state.'MaxQueueLength'). --define(get_MaxConsumers(S), S#state.'MaxConsumers'). --define(get_MaxSuppliers(S), S#state.'MaxSuppliers'). --define(get_IdCounter(S), S#state.idCounter). - -%% Data structures modifiers --define(set_GlobalQoS(S,D), S#state{qosGlobal=D}). --define(set_BothQoS(S,GD,LD), S#state{qosGlobal=GD, qosLocal=LD}). --define(set_GlobalAdm(S,D), S#state{admGlobal=D}). --define(set_AllAdminP(S,GD, MQ, MC, MS), - S#state{admGlobal=GD,'MaxQueueLength'=MQ, - 'MaxConsumers'=MC, 'MaxSuppliers'=MS}). --define(set_MaxQueueLength(S,D), S#state{'MaxQueueLength'=D}). --define(set_MaxConsumers(S,D), S#state{'MaxConsumers'=D}). --define(set_MaxSuppliers(S,D), S#state{'MaxSuppliers'=D}). --define(set_defConsumerAdm(S,D,P), S#state{defConsumerAdmin=D, defConsumerAdminPid=P}). --define(set_defSupplierAdm(S,D,P), S#state{defSupplierAdmin=D, defSupplierAdminPid=P}). --define(set_defFilterFac(S,D,P), S#state{defFilterFac=D, defFilterFacPid=P}). --define(add_supplierAdmin(S,I,O,P), ets:insert(S#state.etsR, {I,O,P})). --define(add_consumerAdmin(S,I,O,P), S#state{myConsumers= [{I,O,P}|S#state.myConsumers]}). --define(del_supplierAdmin(S,I), ets:delete(S#state.etsR, I)). --define(del_consumerAdmin(S,I), S#state{myConsumers= - lists:keydelete(I, 1, - S#state.myConsumers)}). --define(del_consumerAdminRef(S,O), S#state{myConsumers= - lists:keydelete(O, 2, - S#state.myConsumers)}). --define(del_AdminPid(S,P), delete_obj(S, P)). --define(set_IdCounter(S,V), S#state{idCounter=V}). --define(new_Id(S), 'CosNotification_Common':create_id(S#state.idCounter)). -%% MISC --define(is_UndefDefConsAdm(S), S#state.defConsumerAdmin == undefined). --define(is_UndefDefSuppAdm(S), S#state.defSupplierAdmin == undefined). --define(is_UndefDefFilterFac(S), S#state.defFilterFac == undefined). --define(is_PersistentConnection(S), - ?not_GetConnectionReliability((S#state.qosLocal)) == ?not_Persistent). --define(is_PersistentEvent(S), - ?not_GetEventReliability((S#state.qosLocal)) == ?not_Persistent). - -%%-----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the gen_server module. -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(Info, State) -> - ?DBG("INFO: ~p~n", [Info]), - case Info of - {'EXIT', Pid, _Reason} when ?get_defConsumerAdmPid(State) == Pid -> - {noreply, ?set_defConsumerAdm(State, undefined, undefined)}; - {'EXIT', Pid, _Reason} when ?get_defSupplierAdmPid(State) == Pid -> - {noreply, ?set_defSupplierAdm(State, undefined, undefined)}; - {'EXIT', Pid, _Reason} when ?get_defFilterFacPid(State) == Pid -> - {noreply, ?set_defFilterFac(State, undefined, undefined)}; - {'EXIT', Pid, normal} -> - {noreply, ?del_AdminPid(State, Pid)}; - _Other -> - ?DBG("TERMINATED: ~p~n",[_Other]), - {noreply, State} - end. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init([MyFac, InitQoS, InitAdmin, LocalQoS, [MaxQ, MaxC, MaxS|_], Options]) -> - process_flag(trap_exit, true), - SO = 'CosNotification_Common':get_option(server_options, Options, - ?not_DEFAULT_SETTINGS), - - ?DBG("CHANNEL INIT STATE:~n~p~n~p~n~p ~p ~p ~p~n~p~n", - [InitQoS, InitAdmin, LocalQoS,MaxQ, MaxC, MaxS, Options]), - - %% Both default Admin:s have the unique id 0 (OMG spec, 98-11-01, - %% Notification p 148), hence, no need to create a unique id. - %% We don't have acces to OE_THIS in this stage so we cannot create the objects - %% now, even though the specification states that. - %% DefConAdm = 'CosNotifyChannelAdmin_ConsumerAdmin':oe_create_link([0],[]), - %% DefSupAdm = 'CosNotifyChannelAdmin_SupplierAdmin':oe_create_link([0],[]), - - case 'CosNotifyFilter_FilterFactory':oe_create_link([], [{sup_child, true}|SO]) of - {ok, Pid, DefFiFac} -> - {ok, ?get_InitState(MyFac, DefFiFac, Pid, InitQoS, LocalQoS, - InitAdmin, MaxQ, MaxC, MaxS, Options)}; - Reason -> - {stop, Reason} - end. - -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------- -%%----- CosNotifyChannelAdmin_EventChannel attributes ------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Attribute: '_get_MyFactory' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyFactory'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyFactory(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_default_consumer_admin' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_default_consumer_admin'(OE_THIS, _OE_FROM, State) - when ?is_UndefDefConsAdm(State) -> - Op = 'CosNotification_Common':get_option(filterOp, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch 'CosNotifyChannelAdmin_ConsumerAdmin':oe_create_link([0, OE_THIS, - self(), Op, - ?get_GlobalQoS(State), - ?get_LocalQoS(State), - ?get_Options(State)], - [{sup_child, true}|SO]) of - {ok, Pid, DefConAdm} -> - {reply, DefConAdm, ?set_defConsumerAdm(State, DefConAdm, Pid)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:_get_default_consumer_admin();~n" - "Unable to create: CosNotifyChannelAdmin_ConsumerAdmin.~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; -'_get_default_consumer_admin'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_defConsumerAdm(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_default_supplier_admin' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_default_supplier_admin'(OE_THIS, _OE_FROM, State) - when ?is_UndefDefSuppAdm(State) -> - Op = 'CosNotification_Common':get_option(filterOp, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch 'CosNotifyChannelAdmin_SupplierAdmin':oe_create_link([0, OE_THIS, - self(), Op, - ?get_GlobalQoS(State), - ?get_LocalQoS(State), - ?get_Options(State)], - [{sup_child, true}|SO]) of - {ok, Pid, DefSupAdm} -> - {reply, DefSupAdm, ?set_defSupplierAdm(State, DefSupAdm, Pid)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:_get_default_supplier_admin();~n" - "Unable to create: CosNotifyChannelAdmin_SupplierAdmin.~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; -'_get_default_supplier_admin'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_defSupplierAdm(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_default_filter_factory' -%% Type : readonly -%% Returns : -%%---------------------------------------------------------- -'_get_default_filter_factory'(_OE_THIS, _OE_FROM, State) - when ?is_UndefDefFilterFac(State) -> - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch 'CosNotifyFilter_FilterFactory':oe_create_link([], [{sup_child, true}|SO]) of - {ok, Pid, DefFiFac} -> - {reply, DefFiFac, ?set_defFilterFac(State, DefFiFac, Pid)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:_get_default_filter_factory();~n" - "Unable to create: CosNotifyChannelAdmin_FilterFactory.~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; -'_get_default_filter_factory'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_defFilterFac(State), State}. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% function : new_for_consumers -%% Arguments: Op - InterFilterGroupOperator: 'AND_OP' | 'OR_OP' -%% Determines if the Admin:s proxy-children will -%% use AND or OR when checking Filters. -%% Returns : ConsAdm -%% AdminId (out) -%%----------------------------------------------------------- -new_for_consumers(OE_THIS, _OE_FROM, State, Op) -> - is_admin_limit_reached(?get_MaxConsumers(State), ?get_consumerAmount(State)), - AdminId = ?new_Id(State), - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch 'CosNotifyChannelAdmin_ConsumerAdmin':oe_create_link([AdminId, OE_THIS, - self(), Op, - ?get_GlobalQoS(State), - ?get_LocalQoS(State), - ?get_Options(State)], - [{sup_child, true}|SO]) of - {ok, Pid, AdminCo} -> - %% Due to different storage, adding a new consumer is NOT done in the - %% same way as for suppliers. - NewState = ?add_consumerAdmin(State, AdminId, AdminCo, Pid), - {reply, {AdminCo, AdminId}, ?set_IdCounter(NewState, AdminId)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:nef_for_consumers();~n" - "Unable to create: CosNotifyChannelAdmin_ConsumerAdmin.~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%----------------------------------------------------------% -%% function : new_for_suppliers -%% Arguments: Op - InterFilterGroupOperator: 'AND_OP' | 'OR_OP' -%% Determines if the Admin:s proxy-children will -%% use AND or OR when checking Filters. -%% Returns : SuppAdm -%% AdminId (out) -%%----------------------------------------------------------- -new_for_suppliers(OE_THIS, _OE_FROM, State, Op) -> - is_admin_limit_reached(?get_MaxSuppliers(State), ?get_supplierAmount(State)), - AdminId = ?new_Id(State), - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch 'CosNotifyChannelAdmin_SupplierAdmin':oe_create_link([AdminId, OE_THIS, - self(), Op, - ?get_GlobalQoS(State), - ?get_LocalQoS(State), - ?get_Options(State)], - [{sup_child, true}|SO]) of - {ok, Pid, AdminSu} -> - %% Due to different storage, adding a new supplier is NOT done in the - %% same way as for consumers. - ?add_supplierAdmin(State, AdminId, AdminSu, Pid), - {reply, {AdminSu, AdminId}, ?set_IdCounter(State, AdminId)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:new_for_suppliers();~n" - "Unable to create: CosNotifyChannelAdmin_SupplierAdmin.~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%----------------------------------------------------------% -%% function : get_consumeradmin -%% Arguments: AdminId -%% Returns : ConsAdmin -%%----------------------------------------------------------- -get_consumeradmin(OE_THIS, _OE_FROM, State, 0) when ?is_UndefDefConsAdm(State) -> - Op = 'CosNotification_Common':get_option(filterOp, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch 'CosNotifyChannelAdmin_ConsumerAdmin':oe_create_link([0, OE_THIS, - self(), Op, - ?get_GlobalQoS(State), - ?get_LocalQoS(State), - ?get_Options(State)], - [{sup_child, true}|SO]) of - {ok, Pid, DefConAdm} -> - {reply, DefConAdm, ?set_defConsumerAdm(State, DefConAdm, Pid)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:get_consumer_admin();~n" - "Unable to create: CosNotifyChannelAdmin_ConsumerAdmin.~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; -get_consumeradmin(_OE_THIS, _OE_FROM, State, 0) -> - {reply, ?get_defConsumerAdm(State), State}; -get_consumeradmin(_OE_THIS, _OE_FROM, State, AdminId) when is_integer(AdminId) -> - {reply, ?get_consumerAdmin(State, AdminId), State}; -get_consumeradmin(_, _, _, What) -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:get_consumeradmin(~p);~n" - "Not an integer", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_supplieradmin -%% Arguments: AdminId -%% Returns : -%%----------------------------------------------------------- -get_supplieradmin(OE_THIS, _OE_FROM, State, 0) when ?is_UndefDefSuppAdm(State) -> - Op = 'CosNotification_Common':get_option(filterOp, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch 'CosNotifyChannelAdmin_SupplierAdmin':oe_create_link([0, OE_THIS, - self(), Op, - ?get_GlobalQoS(State), - ?get_LocalQoS(State), - ?get_Options(State)], - [{sup_child, true}|SO]) of - {ok, Pid, DefSupAdm} -> - {reply, DefSupAdm, ?set_defSupplierAdm(State, DefSupAdm, Pid)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:get_supplieradmin();~n" - "Unable to create: CosNotifyChannelAdmin_SupplierAdmin.~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; -get_supplieradmin(_OE_THIS, _OE_FROM, State, 0) -> - {reply, ?get_defSupplierAdm(State), State}; -get_supplieradmin(_OE_THIS, _OE_FROM, State, AdminId) when is_integer(AdminId) -> - {reply, ?get_supplierAdmin(State, AdminId), State}; -get_supplieradmin(_, _, _, What) -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:get_supplieradmin(~p);~n" - "Not an integer", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_all_consumeradmins -%% Arguments: - -%% Returns : AdminIDSeq - a list of all unique ID:s. -%%----------------------------------------------------------- -get_all_consumeradmins(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_consumerAdmIDs(State), State}. - -%%----------------------------------------------------------% -%% function : get_all_supplieradmins -%% Arguments: - -%% Returns : AdminIDSeq - a list of all unique ID:s. -%%----------------------------------------------------------- -get_all_supplieradmins(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_supplierAdmIDs(State), State}. - - -%%----- Inherit from CosNotification::QoSAdmin -------------- -%%----------------------------------------------------------% -%% function : get_qos -%% Arguments: - -%% Returns : CosNotification::QoSProperties -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%%----------------------------------------------------------- -get_qos(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_GlobalQoS(State), State}. - -%%----------------------------------------------------------% -%% function : set_qos -%% Arguments: QoS - CosNotification::QoSProperties, i.e., -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : ok | {'EXCEPTION', CosNotification::UnsupportedQoS} -%%----------------------------------------------------------- -set_qos(_OE_THIS, _OE_FROM, State, QoS) -> - {GQoS,LQoS} = 'CosNotification_Common':set_qos(QoS, ?get_BothQoS(State), - channel, false, - ?get_allAdmins(State)), - {reply, ok, ?set_BothQoS(State, GQoS,LQoS)}. - -%%----------------------------------------------------------% -%% function : validate_qos -%% Arguments: Required_qos - CosNotification::QoSProperties -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : {'EXCEPTION', CosNotification::UnsupportedQoS} | -%% {ok, CosNotification::NamedPropertyRangeSeq} -%%----------------------------------------------------------- -validate_qos(_OE_THIS, _OE_FROM, State, Required_qos) -> - QoS = 'CosNotification_Common':validate_qos(Required_qos, ?get_BothQoS(State), - channel, false, - ?get_allAdmins(State)), - {reply, {ok, QoS}, State}. - -%%----- Inherit from CosNotification::AdminPropertiesAdmin -- -%%-----------------------------------------------------------% -%% function : get_admin -%% Arguments: - -%% Returns : AdminProperties -%%----------------------------------------------------------- -get_admin(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_GlobalAdm(State), State}. - -%%----------------------------------------------------------% -%% function : set_admin -%% Arguments: Admin -%% Returns : -%%----------------------------------------------------------- -set_admin(_OE_THIS, _OE_FROM, State, Admin) -> - {GAdm,[MaxQ, MaxC, MaxS|_]} = - 'CosNotification_Common':set_adm(Admin, ?get_GlobalAdm(State)), - {reply, ok, ?set_AllAdminP(State, GAdm, MaxQ, MaxC, MaxS)}. - -%%----- Inherit from CosEventChannelAdmin::EventChannel ----- -%%----------------------------------------------------------% -%% function : for_consumers -%% Arguments: - -%% Returns : ConsAdm -%%----------------------------------------------------------- -for_consumers(OE_THIS, _OE_FROM, State) -> - is_admin_limit_reached(?get_MaxConsumers(State), ?get_consumerAmount(State)), - AdminId = ?new_Id(State), - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch 'CosNotifyChannelAdmin_ConsumerAdmin':oe_create_link([AdminId, OE_THIS, - self(), 'AND_OP', - ?get_GlobalQoS(State), - ?get_LocalQoS(State), - ?get_Options(State)], - [{sup_child, true}|SO]) of - {ok, Pid, AdminCo} -> - %% Due to different storage, adding a new consumer is NOT done in the - %% same way as for suppliers. - NewState = ?add_consumerAdmin(State, AdminId, AdminCo, Pid), - {reply, AdminCo, ?set_IdCounter(NewState, AdminId)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:for_consumers();~n" - "Unable to create: CosNotifyChannelAdmin_ConsumerAdmin.~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%----------------------------------------------------------% -%% function : for_suppliers -%% Arguments: - -%% Returns : SuppAdm -%%----------------------------------------------------------- -for_suppliers(OE_THIS, _OE_FROM, State) -> - is_admin_limit_reached(?get_MaxSuppliers(State), ?get_supplierAmount(State)), - AdminId = ?new_Id(State), - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch 'CosNotifyChannelAdmin_SupplierAdmin':oe_create_link([AdminId, OE_THIS, - self(), 'AND_OP', - ?get_GlobalQoS(State), - ?get_LocalQoS(State), - ?get_Options(State)], - [{sup_child, true}|SO]) of - {ok, Pid, AdminSu} -> - %% Due to different storage, adding a new supplier is NOT done in the - %% same way as for consumers. - ?add_supplierAdmin(State, AdminId, AdminSu, Pid), - {reply, AdminSu, ?set_IdCounter(State, AdminId)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:for_suppliers();~n" - "Unable to create: CosNotifyChannelAdmin_SupplierAdmin.~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%-----------------------------------------------------------% -%% function : destroy -%% Arguments: - -%% Returns : ok -%%------------------------------------------------------------ -destroy(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, State}. - -%%--------------- LOCAL FUNCTIONS ---------------------------- -find_obj([]) -> {'EXCEPTION', #'CosNotifyChannelAdmin_AdminNotFound'{}}; -find_obj([{_, Obj,_}]) -> Obj; -find_obj({value, {_, Obj,_}}) -> Obj; -find_obj(_) -> {'EXCEPTION', #'CosNotifyChannelAdmin_AdminNotFound'{}}. - - -find_field(List, Field) -> - find_field(List, Field, []). - -find_field([], _, Acc) -> - Acc; -find_field([{I,_,_}|T], 1, Acc) -> - find_field(T, 1, [I|Acc]); -find_field([{_,O,_}|T], 2, Acc) -> - find_field(T, 2, [O|Acc]); -% Left out for now to avoid dialyzer warning. -%find_field([{_,_,P}|T], 3, Acc) -> -% find_field(T, 3, [P|Acc]); -find_field(What, _, _) -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:find_field();~n" - "Data corrupt: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). - -delete_obj(State, Pid) -> - case ets:match_object(State#state.etsR, {'_', '_', Pid}) of - [] -> - State#state{myConsumers=lists:keydelete(Pid, 3, State#state.myConsumers)}; - [{Id,_Obj,Pid}] -> - ets:delete(State#state.etsR, Id), - State - end. - -%% Test if we have reached limit for Admin objects. -is_admin_limit_reached(0, _) -> - %% When set to zero it means that there is no limit. - ok; -is_admin_limit_reached(Max, Current) when Current >= Max -> - %% The Current value do not include the default Admin objects, hence - %% we use >= instead of >. - corba:raise(#'IMP_LIMIT'{completion_status=?COMPLETED_NO}); -is_admin_limit_reached(_, _) -> - ok. - -%%----------------------------------------------------------- -%% function : callSeq -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -callSeq(_OE_THIS, OE_FROM, State, Event, Status) -> - corba:reply(OE_FROM, ok), - forward(seq, State, Event, Status). - -%%----------------------------------------------------------- -%% function : callAny -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -callAny(_OE_THIS, OE_FROM, State, Event, Status) -> - corba:reply(OE_FROM, ok), - forward(any, State, Event, Status). - -%% Forward events -forward(Type, State, Event, Status) -> - forward(Type, ?get_consumerAdmins(State), State, Event, Status). - -forward(_, [], State, _, _) -> - {noreply, State}; -forward(Type, [{_,undefined,_}|T], State, Event, Status) -> - %% Match if no default objects associated. - forward(Type, T, State, Event, Status); -forward(any, [{_,H,_}|T], State, Event, Status) -> - case catch oe_CosNotificationComm_Event:callAny(H, Event, Status) of - ok -> - ?DBG("CHANNEL FORWARD ANY: ~p~n",[Event]), - forward(any, T, State, Event, Status); - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:forward();~n" - "Admin no longer exists; dropping it: ~p", - [?LINE, H], ?DEBUG_LEVEL), - NewState = ?del_consumerAdminRef(State,H), - forward(any, T, NewState, Event, Status); - R when ?is_PersistentConnection(State) -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:forward();~n" - "Admin behaves badly: ~p/~p", - [?LINE, R, H], ?DEBUG_LEVEL), - forward(any, T, State, Event, Status); - R -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:forward();~n" - "Admin behaves badly: ~p~n" - "Dropping it: ~p", [?LINE, R, H], ?DEBUG_LEVEL), - NewState = ?del_consumerAdminRef(State, H), - forward(any, T, NewState, Event, Status) - end; -forward(seq, [{_,H,_}|T], State, Event, Status) -> - case catch oe_CosNotificationComm_Event:callSeq(H, Event, Status) of - ok -> - ?DBG("CHANNEL FORWARD SEQUENCE: ~p~n",[Event]), - forward(seq, T, State, Event, Status); - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:forward();~n" - "Admin no longer exists; dropping it: ~p", - [?LINE, H], ?DEBUG_LEVEL), - NewState = ?del_consumerAdminRef(State,H), - forward(seq, T, NewState, Event, Status); - R when ?is_PersistentConnection(State) -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:forward();~n" - "Admin behaves badly: ~p/~p", - [?LINE, R, H], ?DEBUG_LEVEL), - forward(seq, T, State, Event, Status); - R -> - orber:dbg("[~p] CosNotifyChannelAdmin_EventChannel:forward();~n" - "Admin behaves badly: ~p~n" - "Dropping it: ~p", [?LINE, R, H], ?DEBUG_LEVEL), - NewState = ?del_consumerAdminRef(State,H), - forward(seq, T, NewState, Event, Status) - end. - - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/CosNotifyChannelAdmin_SupplierAdmin_impl.erl b/lib/cosNotification/src/CosNotifyChannelAdmin_SupplierAdmin_impl.erl deleted file mode 100644 index 2810bef93d..0000000000 --- a/lib/cosNotification/src/CosNotifyChannelAdmin_SupplierAdmin_impl.erl +++ /dev/null @@ -1,580 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%------------------------------------------------------------------- -%% File : CosNotifyChannelAdmin_SupplierAdmin_impl.erl -%% Purpose : -%%------------------------------------------------------------------- - --module('CosNotifyChannelAdmin_SupplierAdmin_impl'). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). --include("CosNotification_Definitions.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%%--------------- External ----------------------------------- -%%----- CosNotifyChannelAdmin::SupplierAdmin ----------------- --export([get_proxy_consumer/4, - obtain_notification_pull_consumer/4, - obtain_notification_push_consumer/4, - destroy/3]). - -%%----- Inherit from CosNotification::QoSAdmin --------------- --export([get_qos/3, - set_qos/4, - validate_qos/4]). - -%%----- Inherit from CosNotifyComm::NotifyPublish ------------ --export([offer_change/5]). - -%%----- Inherit from CosNotifyFilter::FilterAdmin ------------ --export([add_filter/4, - remove_filter/4, - get_filter/4, - get_all_filters/3, - remove_all_filters/3]). - -%%----- Inherit from CosEventChannelAdmin::SupplierAdmin ----- --export([obtain_push_consumer/3, - obtain_pull_consumer/3]). - -%% Attributes (external) --export(['_get_MyID'/3, - '_get_MyChannel'/3, - '_get_MyOperator'/3, - '_get_pull_consumers'/3, - '_get_push_consumers'/3]). - -%%--------------- Internal ----------------------------------- -%%----- Inherit from cosNotificationComm --------------------- --export([callAny/5, - callSeq/5]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - -%%--------------- LOCAL DEFINITIONS -------------------------- -%% Data structures --record(state, {myId, - myChannel, - myChannelPid, - myOperator, - myFilters = [], - idCounter = 0, - etsR, - qosGlobal, - qosLocal, - options}). - -%% Data structures constructors --define(get_InitState(_MyID, _MyCh, _MyChP, _MyOp, _QoS, _LQS, _O), - #state{myId = _MyID, - myChannel = _MyCh, - myChannelPid = _MyChP, - myOperator = _MyOp, - qosGlobal = _QoS, - qosLocal = _LQS, - options = _O, - etsR = ets:new(oe_ets, [set, protected])}). - -%% Data structures selectors --define(get_PushConsumers(S), lists:flatten(ets:match(S#state.etsR, - {'_','$1','_',pusher}))). --define(get_PullConsumers(S), lists:flatten(ets:match(S#state.etsR, - {'_','$1','_',puller}))). --define(get_AllConsumers(S), lists:flatten(ets:match(S#state.etsR, - {'_','$1','_','_'}))). --define(get_PushConsumerIDs(S), lists:flatten(ets:match(S#state.etsR, - {'$1','_','_',pusher}))). --define(get_PullConsumerIDs(S), lists:flatten(ets:match(S#state.etsR, - {'$1','_','_',puller}))). - --define(get_Consumer(S, I), find_obj(ets:lookup(S#state.etsR, I), consumer)). - --define(get_MyID(S), S#state.myId). --define(get_MyChannel(S), S#state.myChannel). --define(get_MyChannelPid(S), S#state.myChannelPid). --define(get_MyOperator(S), S#state.myOperator). --define(get_GlobalQoS(S), S#state.qosGlobal). --define(get_LocalQoS(S), S#state.qosLocal). --define(get_BothQoS(S), {S#state.qosGlobal, S#state.qosLocal}). --define(get_Filter(S, I), find_obj(lists:keysearch(I, 1, S#state.myFilters), - filter)). --define(get_AllFilter(S), S#state.myFilters). --define(get_AllFilterID(S), find_ids(S#state.myFilters)). --define(get_Options(S), S#state.options). --define(get_IdCounter(S), S#state.idCounter). - -%% Data structures modifiers --define(set_LocalQoS(S,D), S#state{qosLocal=D}). --define(set_GlobalQoS(S,D), S#state{qosGlobal=D}). --define(set_BothQoS(S,GD,LD), S#state{qosGlobal=GD, qosLocal=LD}). --define(add_PushConsumer(S,I,R,P),ets:insert(State#state.etsR, {I,R,P,pusher})). --define(add_PullConsumer(S,I,R,P),ets:insert(State#state.etsR, {I,R,P,puller})). --define(del_Consumer(S,I), ets:delete(S#state.etsR, I)). --define(del_ConsumerPid(S,P), ets:match_delete(S#state.etsR, {'_','_',P,'_'})). --define(add_Filter(S,I,O), S#state{myFilters=[{I,O}|S#state.myFilters]}). --define(del_Filter(S,I), S#state{myFilters= - delete_filter(lists:keydelete(I, 1, - S#state.myFilters), - S#state.myFilters)}). --define(del_AllFilter(S), S#state{myFilters=[]}). --define(set_IdCounter(S,V), S#state{idCounter=V}). --define(new_Id(S), 'CosNotification_Common':create_id(S#state.idCounter)). - -%% MISC --define(is_PersistentEvent(S), - ?not_GetEventReliability((S#state.qosLocal)) == ?not_Persistent). --define(is_PersistentConnection(S), - ?not_GetConnectionReliability((S#state.qosLocal)) == ?not_Persistent). - -%%----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the gen_server module. -%%----------------------------------------------------------- - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(Info, State) -> - case Info of - {'EXIT', Pid, Reason} when ?get_MyChannelPid(State) == Pid -> - ?DBG("PARENT CHANNEL: ~p TERMINATED.~n",[Reason]), - {stop, Reason, State}; - {'EXIT', Pid, normal} -> - ?del_ConsumerPid(State, Pid), - {noreply, State}; - _Other -> - {noreply, State} - end. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init([MyId, MyChannel, MyChannelPid, MyOperator, InitQoS, LQS, Options]) -> - process_flag(trap_exit, true), - {ok, ?get_InitState(MyId, MyChannel, MyChannelPid, MyOperator, InitQoS, LQS, Options)}. - -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------- -%%----- CosNotifyChannelAdmin_ConsumerAdmin attributes ------ -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Attribute: '_get_MyID' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyID'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyID(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_MyChannel' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyChannel'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyChannel(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_MyOperator' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyOperator'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyOperator(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_pull_consumers' -%% Type : readonly -%% Returns : ProxyIDSeq -%%----------------------------------------------------------- -'_get_pull_consumers'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_PullConsumerIDs(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_push_consumers' -%% Type : readonly -%% Returns : ProxyIDSeq -%%----------------------------------------------------------- -'_get_push_consumers'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_PushConsumerIDs(State), State}. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% function : get_proxy_consumer -%% Arguments: ProxyId - unique identifier (long) -%% Returns : ObjRef | {'EXCEPTION', #'ProxyNotFound'{}} -%%----------------------------------------------------------- -get_proxy_consumer(_OE_THIS, _OE_FROM, State, ProxyId) -> - {reply, ?get_Consumer(State, ProxyId), State}. - -%%----------------------------------------------------------% -%% function : obtain_notification_pull_consumer -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -obtain_notification_pull_consumer(OE_THIS, _OE_FROM, State, Ctype) -> - %% Choose which module to use. - {Mod, Type} = - case Ctype of - 'ANY_EVENT' -> - {'CosNotifyChannelAdmin_ProxyPullConsumer', 'PULL_ANY'}; - 'STRUCTURED_EVENT' -> - {'CosNotifyChannelAdmin_StructuredProxyPullConsumer', 'PULL_STRUCTURED'}; - 'SEQUENCE_EVENT' -> - {'CosNotifyChannelAdmin_SequenceProxyPullConsumer', 'PULL_SEQUENCE'}; - _ -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:" - "obtain_notification_pull_consumer(~p);~n" - "Incorrect enumerant", - [?LINE, Ctype], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end, - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch Mod:oe_create_link([Type, OE_THIS, self(), ?get_GlobalQoS(State), - ?get_LocalQoS(State), ?get_MyChannel(State), - ?get_Options(State), ?get_MyOperator(State)], - [{sup_child, true}|SO]) of - {ok, Pid, Proxy} -> - ProxyID = ?new_Id(State), - ?add_PullConsumer(State, ProxyID, Proxy, Pid), - {reply, {Proxy, ProxyID}, ?set_IdCounter(State, ProxyID)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:" - "obtain_notification_pull_consumer();~n" - "Unable to create: ~p/~p~n" - "Reason: ~p", [?LINE, Mod, Type, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%----------------------------------------------------------% -%% function : obtain_notification_push_supplier -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -obtain_notification_push_consumer(OE_THIS, _OE_FROM, State, Ctype) -> - %% Choose which module to use. - {Mod, Type} = - case Ctype of - 'ANY_EVENT' -> - {'CosNotifyChannelAdmin_ProxyPushConsumer', 'PUSH_ANY'}; - 'STRUCTURED_EVENT' -> - {'CosNotifyChannelAdmin_StructuredProxyPushConsumer', 'PUSH_STRUCTURED'}; - 'SEQUENCE_EVENT' -> - {'CosNotifyChannelAdmin_SequenceProxyPushConsumer', 'PUSH_SEQUENCE'}; - _ -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:" - "obtain_notification_push_consumer(~p);~n" - "Incorrect enumerant", [?LINE, Ctype], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end, - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch Mod:oe_create_link([Type, OE_THIS, self(), ?get_GlobalQoS(State), - ?get_LocalQoS(State), ?get_MyChannel(State), - ?get_Options(State), ?get_MyOperator(State)], - [{sup_child, true}|SO]) of - {ok, Pid, Proxy} -> - ProxyID = ?new_Id(State), - ?add_PushConsumer(State, ProxyID, Proxy, Pid), - {reply, {Proxy, ProxyID}, ?set_IdCounter(State, ProxyID)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:" - "obtain_notification_push_consumer();~n" - "Unable to create: ~p/~p~n" - "Reason: ~p", [?LINE, Mod, Type, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%----------------------------------------------------------% -%% function : destroy -%% Arguments: - -%% Returns : ok -%%------------------------------------------------------------ -destroy(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, State}. - -%%----- Inherit from CosNotification::QoSAdmin -------------- -%%----------------------------------------------------------% -%% function : get_qos -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -get_qos(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_GlobalQoS(State), State}. - -%%----------------------------------------------------------% -%% function : set_qos -%% Arguments: QoS - CosNotification::QoSProperties, i.e., -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : ok | {'EXCEPTION', CosNotification::UnsupportedQoS} -%%----------------------------------------------------------- -set_qos(_OE_THIS, _OE_FROM, State, QoS) -> - {NewQoS, LQS} = 'CosNotification_Common':set_qos(QoS, ?get_BothQoS(State), - admin, ?get_MyChannel(State), - ?get_AllConsumers(State)), - {reply, ok, ?set_BothQoS(State, NewQoS, LQS)}. - -%%----------------------------------------------------------% -%% function : validate_qos -%% Arguments: Required_qos - CosNotification::QoSProperties -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : {'EXCEPTION', CosNotification::UnsupportedQoS} -%% {ok, CosNotification::NamedPropertyRangeSeq} -%%----------------------------------------------------------- -validate_qos(_OE_THIS, _OE_FROM, State, Required_qos) -> - QoS = 'CosNotification_Common':validate_qos(Required_qos, ?get_BothQoS(State), - admin, ?get_MyChannel(State), - ?get_AllConsumers(State)), - {reply, {ok, QoS}, State}. - -%%----- Inherit from CosNotifyComm::NotifyPublish ----------- -%%----------------------------------------------------------* -%% function : offer_change -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -offer_change(_OE_THIS, _OE_FROM, State, _Added, _Removed) -> - {reply, ok, State}. - -%%----- Inherit from CosNotifyFilter::FilterAdmin ----------- -%%----------------------------------------------------------% -%% function : add_filter -%% Arguments: Filter - CosNotifyFilter::Filter -%% Returns : FilterID - long -%%----------------------------------------------------------- -add_filter(_OE_THIS, _OE_FROM, State, Filter) -> - 'CosNotification_Common':type_check(Filter, 'CosNotifyFilter_Filter'), - FilterID = ?new_Id(State), - NewState = ?set_IdCounter(State, FilterID), - {reply, FilterID, ?add_Filter(NewState, FilterID, Filter)}. - -%%----------------------------------------------------------% -%% function : remove_filter -%% Arguments: FilterID - long -%% Returns : ok -%%----------------------------------------------------------- -remove_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ok, ?del_Filter(State, FilterID)}; -remove_filter(_,_,_,What) -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:remove_filter(~p);~n" - "Not an integer", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_filter -%% Arguments: FilterID - long -%% Returns : Filter - CosNotifyFilter::Filter | -%% {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}} -%%----------------------------------------------------------- -get_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ?get_Filter(State, FilterID), State}; -get_filter(_,_,_,What) -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:get_filter(~p);~n" - "Not an integer", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_all_filters -%% Arguments: - -%% Returns : Filter - CosNotifyFilter::FilterIDSeq -%%----------------------------------------------------------- -get_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_AllFilterID(State), State}. - -%%----------------------------------------------------------% -%% function : remove_all_filters -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -remove_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ok, ?del_AllFilter(State)}. - -%%----- Inherit from CosEventChannelAdmin::SupplierAdmin ---- -%%----------------------------------------------------------% -%% function : obtain_push_consumer -%% Arguments: - -%% Returns : ProxyPushConsumer -%%----------------------------------------------------------- -obtain_push_consumer(OE_THIS, _OE_FROM, State) -> - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch 'CosNotifyChannelAdmin_ProxyPushConsumer': - oe_create_link(['PUSH_ANY', OE_THIS, self(), ?get_GlobalQoS(State), - ?get_LocalQoS(State), ?get_MyChannel(State), - ?get_Options(State), ?get_MyOperator(State)], - [{sup_child, true}|SO]) of - {ok, Pid, Proxy} -> - ProxyID = ?new_Id(State), - ?add_PushConsumer(State, ProxyID, Proxy, Pid), - {reply, Proxy, ?set_IdCounter(State, ProxyID)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:obtain_push_consumer();~n" - "Unable to create: CosNotifyChannelAdmin_ProxyPushConsumer~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%----------------------------------------------------------% -%% function : obtain_pull_consumer -%% Arguments: - -%% Returns : ProxyPullConsumer -%%----------------------------------------------------------- -obtain_pull_consumer(OE_THIS, _OE_FROM, State) -> - SO = 'CosNotification_Common':get_option(server_options, ?get_Options(State), - ?not_DEFAULT_SETTINGS), - case catch 'CosNotifyChannelAdmin_ProxyPullConsumer': - oe_create_link(['PULL_ANY', OE_THIS, self(), ?get_GlobalQoS(State), - ?get_LocalQoS(State), ?get_MyChannel(State), - ?get_Options(State), ?get_MyOperator(State)], - [{sup_child, true}|SO]) of - {ok, Pid, Proxy} -> - ProxyID = ?new_Id(State), - ?add_PullConsumer(State, ProxyID, Proxy, Pid), - {reply, Proxy, ?set_IdCounter(State, ProxyID)}; - What -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:obtain_push_consumer();~n" - "Unable to create: CosNotifyChannelAdmin_ProxyPullConsumer~n" - "Reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%--------------- LOCAL FUNCTIONS ---------------------------- -find_obj([], consumer) -> {'EXCEPTION', #'CosNotifyChannelAdmin_ProxyNotFound'{}}; -find_obj([], filter) -> {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}}; -%% To match consumers -find_obj([{_,Obj,_,_}],_) -> Obj; -%% To match filters -find_obj({value, {_,Obj}},_) -> Obj; -find_obj(_,consumer) -> {'EXCEPTION', #'CosNotifyChannelAdmin_ProxyNotFound'{}}; -find_obj(_,filter) -> {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}}. - -find_ids(List) -> find_ids(List, []). -find_ids([], Acc) -> Acc; -find_ids([{I,_}|T], Acc) -> find_ids(T, [I|Acc]); -find_ids(What, _) -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:find_ids();~n" - "Id corrupt: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). - -%% Delete a single filter. -%% The list do not differ, i.e., no filter removed, raise exception. -delete_filter(List,List) -> corba:raise(#'CosNotifyFilter_FilterNotFound'{}); -delete_filter(List, _) -> List. - -%%----------------------------------------------------------- -%% function : callSeq -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -callSeq(_OE_THIS, OE_FROM, State, Events, _Status) -> - corba:reply(OE_FROM, ok), - case cosNotification_eventDB:filter_events(Events, ?get_AllFilter(State)) of - {[], _} -> - {noreply, State}; - {Passed, _} -> - forward(seq, State, Passed, 'MATCHED') - end. - -%%----------------------------------------------------------- -%% function : callAny -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -callAny(_OE_THIS, OE_FROM, State, Event, _Status) -> - corba:reply(OE_FROM, ok), - case cosNotification_eventDB:filter_events([Event], ?get_AllFilter(State)) of - {[], _} -> - {noreply, State}; - {[Passed], _} -> - forward(any, State, Passed, 'MATCHED') - end. - -%% Forward events -forward(any, State, Event, Status) -> - case catch oe_CosNotificationComm_Event:callAny(?get_MyChannel(State), - Event, Status) of - ok -> - ?DBG("SUPPLIERADM FORWARD ANY: ~p~n",[Event]), - {noreply, State}; - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:forward();~n" - "Channel no longer exists; terminating and dropping: ~p", - [?LINE, Event], ?DEBUG_LEVEL), - {stop, normal, State}; - R when ?is_PersistentConnection(State) -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:forward();~n" - "Channel respond incorrect: ~p~n" - "Dropping: ~p", [?LINE, R, Event], ?DEBUG_LEVEL), - {noreply, State}; - R -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:forward();~n" - "Channel respond incorrect: ~p~n" - "Terminating and dropping: ~p", - [?LINE, R, Event], ?DEBUG_LEVEL), - {stop, normal, State} - end; -forward(seq, State, Event, Status) -> - case catch oe_CosNotificationComm_Event:callSeq(?get_MyChannel(State), - Event, Status) of - ok -> - ?DBG("SUPPLIERADM FORWARD SEQUENCE: ~p~n",[Event]), - {noreply, State}; - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:forward();~n" - "Channel no longer exists; terminating and dropping: ~p", - [?LINE, Event], ?DEBUG_LEVEL), - {stop, normal, State}; - R when ?is_PersistentConnection(State) -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:forward();~n" - "Channel respond incorrect: ~p~n" - "Dropping: ~p", [?LINE, R, Event], ?DEBUG_LEVEL), - {noreply, State}; - R -> - orber:dbg("[~p] CosNotifyChannelAdmin_SupplierAdmin:forward();~n" - "Channel respond incorrect: ~p~n" - "Terminating and dropping: ~p", - [?LINE, R, Event], ?DEBUG_LEVEL), - {stop, normal, State} - end. - - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/CosNotifyComm.cfg b/lib/cosNotification/src/CosNotifyComm.cfg deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosNotification/src/CosNotifyComm.idl b/lib/cosNotification/src/CosNotifyComm.idl deleted file mode 100644 index f0386f0982..0000000000 --- a/lib/cosNotification/src/CosNotifyComm.idl +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef _COS_NOTIFYCOMM_IDL_ -#define _COS_NOTIFYCOMM_IDL_ - -#pragma prefix "omg.org" - - -#include - -module CosNotifyComm { - exception InvalidEventType { CosNotification::EventType type; }; - - interface NotifyPublish { - void offer_change (in CosNotification::EventTypeSeq added, - in CosNotification::EventTypeSeq removed) - raises (InvalidEventType); - }; // NotifyPublish - - interface NotifySubscribe { - void subscription_change(in CosNotification::EventTypeSeq added, - in CosNotification::EventTypeSeq removed) - raises (InvalidEventType); - }; // NotifySubscribe - - interface PushConsumer : NotifyPublish, CosEventComm::PushConsumer { }; // PushConsumer - - interface PullConsumer : NotifyPublish, CosEventComm::PullConsumer { }; // PullConsumer - - interface PullSupplier : NotifySubscribe, CosEventComm::PullSupplier { }; // PullSupplier - - interface PushSupplier : NotifySubscribe, CosEventComm::PushSupplier { }; - - interface StructuredPushConsumer : NotifyPublish { - void push_structured_event(in CosNotification::StructuredEvent notification) - raises(CosEventComm::Disconnected); - - void disconnect_structured_push_consumer(); - }; // StructuredPushConsumer - - interface StructuredPullConsumer : NotifyPublish { - void disconnect_structured_pull_consumer(); - }; // StructuredPullConsumer - - interface StructuredPullSupplier : NotifySubscribe { - CosNotification::StructuredEvent pull_structured_event() - raises(CosEventComm::Disconnected); - - CosNotification::StructuredEvent try_pull_structured_event(out boolean has_event) - raises(CosEventComm::Disconnected); - - void disconnect_structured_pull_supplier(); - }; // StructuredPullSupplier - - interface StructuredPushSupplier : NotifySubscribe { - void disconnect_structured_push_supplier(); - }; // StructuredPushSupplier - - interface SequencePushConsumer : NotifyPublish { - void push_structured_events(in CosNotification::EventBatch notifications) - raises(CosEventComm::Disconnected); - - void disconnect_sequence_push_consumer(); - }; // SequencePushConsumer - - interface SequencePullConsumer : NotifyPublish { - void disconnect_sequence_pull_consumer(); - }; // SequencePullConsumer - - interface SequencePullSupplier : NotifySubscribe { - CosNotification::EventBatch pull_structured_events(in long max_number) - raises(CosEventComm::Disconnected); - CosNotification::EventBatch try_pull_structured_events(in long max_number, out boolean has_event) - raises(CosEventComm::Disconnected); - - void disconnect_sequence_pull_supplier(); - }; // SequencePullSupplier - - interface SequencePushSupplier : NotifySubscribe { - void disconnect_sequence_push_supplier(); - }; // SequencePushSupplier -}; // CosNotifyComm - -#endif /* ifndef _COS_NOTIFYCOMM_IDL_ */ - diff --git a/lib/cosNotification/src/CosNotifyFilter.cfg b/lib/cosNotification/src/CosNotifyFilter.cfg deleted file mode 100644 index 167550e0f5..0000000000 --- a/lib/cosNotification/src/CosNotifyFilter.cfg +++ /dev/null @@ -1,6 +0,0 @@ -{this, "CosNotifyFilter::Filter"}. -{{handle_info, "CosNotifyFilter::Filter"}, true}. -{this, "CosNotifyFilter::MappingFilter"}. -{{handle_info, "CosNotifyFilter::MappingFilter"}, true}. -{this, "CosNotifyFilter::FilterFactory"}. -{{handle_info, "CosNotifyFilter::FilterFactory"}, true}. diff --git a/lib/cosNotification/src/CosNotifyFilter.idl b/lib/cosNotification/src/CosNotifyFilter.idl deleted file mode 100644 index c6498ddcd0..0000000000 --- a/lib/cosNotification/src/CosNotifyFilter.idl +++ /dev/null @@ -1,140 +0,0 @@ -#ifndef _COS_NOTIFYFILTER_IDL_ -#define _COS_NOTIFYFILTER_IDL_ - -#pragma prefix "omg.org" - -#include -#include - -module CosNotifyFilter { - typedef long ConstraintID; - struct ConstraintExp { - CosNotification::EventTypeSeq event_types; - string constraint_expr; - }; - - typedef sequence ConstraintIDSeq; - typedef sequence ConstraintExpSeq; - struct ConstraintInfo { - ConstraintExp constraint_expression; - ConstraintID constraint_id; - }; - typedef sequence ConstraintInfoSeq; - struct MappingConstraintPair { - ConstraintExp constraint_expression; - any result_to_set; - }; - typedef sequence MappingConstraintPairSeq; - struct MappingConstraintInfo { - ConstraintExp constraint_expression; - ConstraintID constraint_id; - any value; - }; - typedef sequence MappingConstraintInfoSeq; - typedef long CallbackID; - typedef sequence CallbackIDSeq; - exception UnsupportedFilterableData {}; - exception InvalidGrammar {}; - exception InvalidConstraint {ConstraintExp constr;}; - exception DuplicateConstraintID {ConstraintID id;}; - exception ConstraintNotFound {ConstraintID id;}; - exception CallbackNotFound {}; - exception InvalidValue {ConstraintExp constr; any value;}; - interface Filter { - readonly attribute string constraint_grammar; - ConstraintInfoSeq add_constraints (in ConstraintExpSeq constraint_list) - raises (InvalidConstraint); - - void modify_constraints (in ConstraintIDSeq del_list, - in ConstraintInfoSeq modify_list) - raises (InvalidConstraint, ConstraintNotFound); - - ConstraintInfoSeq get_constraints(in ConstraintIDSeq id_list) - raises (ConstraintNotFound); - - ConstraintInfoSeq get_all_constraints(); - - void remove_all_constraints(); - void destroy(); - boolean match (in any filterable_data) - raises (UnsupportedFilterableData); - - boolean match_structured (in CosNotification::StructuredEvent filterable_data) - raises (UnsupportedFilterableData); - - boolean match_typed (in CosNotification::PropertySeq filterable_data) - raises (UnsupportedFilterableData); - - CallbackID attach_callback (in CosNotifyComm::NotifySubscribe callback); - - void detach_callback (in CallbackID callback) - raises ( CallbackNotFound ); - - CallbackIDSeq get_callbacks(); - }; // Filter - - interface MappingFilter { - readonly attribute string constraint_grammar; - - readonly attribute CORBA::TypeCode value_type; - - readonly attribute any default_value; - - MappingConstraintInfoSeq add_mapping_constraints (in MappingConstraintPairSeq pair_list) - raises (InvalidConstraint, InvalidValue); - - void modify_mapping_constraints (in ConstraintIDSeq del_list, - in MappingConstraintInfoSeq modify_list) - raises (InvalidConstraint, InvalidValue, ConstraintNotFound); - - MappingConstraintInfoSeq get_mapping_constraints (in ConstraintIDSeq id_list) - raises (ConstraintNotFound); - - MappingConstraintInfoSeq get_all_mapping_constraints(); - - void remove_all_mapping_constraints(); - - void destroy(); - - boolean match (in any filterable_data, out any result_to_set) - raises (UnsupportedFilterableData); - - boolean match_structured (in CosNotification::StructuredEvent filterable_data, out any result_to_set) - raises (UnsupportedFilterableData); - - boolean match_typed (in CosNotification::PropertySeq filterable_data, out any result_to_set) - raises (UnsupportedFilterableData); - }; // MappingFilter - - - interface FilterFactory { - - Filter create_filter (in string constraint_grammar) - raises (InvalidGrammar); - - MappingFilter create_mapping_filter (in string constraint_grammar, in any default_value) - raises(InvalidGrammar); - }; // FilterFactory - - typedef long FilterID; - typedef sequence FilterIDSeq; - exception FilterNotFound {}; - - interface FilterAdmin { - FilterID add_filter (in Filter new_filter); - - void remove_filter (in FilterID filter) - raises (FilterNotFound); - - Filter get_filter (in FilterID filter) - raises (FilterNotFound); - - FilterIDSeq get_all_filters(); - - void remove_all_filters(); - }; // FilterAdmin -}; // CosNotifyFilter - - -#endif /* ifndef _COS_NOTIFYFILTER_IDL_ */ - diff --git a/lib/cosNotification/src/CosNotifyFilter_FilterFactory_impl.erl b/lib/cosNotification/src/CosNotifyFilter_FilterFactory_impl.erl deleted file mode 100644 index 760dcf40b8..0000000000 --- a/lib/cosNotification/src/CosNotifyFilter_FilterFactory_impl.erl +++ /dev/null @@ -1,126 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosNotifyFilter_FilterFactory_impl.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module('CosNotifyFilter_FilterFactory_impl'). - - -%%--------------- INCLUDES ----------------------------------- -%% Application files --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). --include("CosNotification_Definitions.hrl"). - -%%--------------- IMPORTS ------------------------------------ - -%%--------------- EXPORTS ------------------------------------ -%% External --export([create_filter/3, - create_mapping_filter/4]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - -%%--------------- LOCAL DEFINITIONS -------------------------- -%% Data structures --record(state, {adminProp, - etsR, - options}). - -%%-----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: See gen_server documentation. -%% Effect : Functions demanded by the gen_server module. -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(_Info, State) -> - ?debug_print("INFO: ~p DATA: ~p~n", [State, _Info]), - {noreply, State}. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init(Options) -> - process_flag(trap_exit, true), - {ok, #state{options = Options}}. - -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% function : create_filter -%% Arguments: InitGrammar - string() -%% Returns : CosNotifyFilter::Filter | -%% {'EXCEPTION', InvalidGrammar} -%%----------------------------------------------------------- -create_filter(OE_THIS, State, InitGrammar) -> - case lists:member(InitGrammar, ?not_SupportedGrammars) of - true -> - SO = 'CosNotification_Common':get_option(server_options, State#state.options, - ?not_DEFAULT_SETTINGS), - Fi='CosNotifyFilter_Filter':oe_create_link([OE_THIS, self(), - InitGrammar], - SO), - {reply, Fi, State}; - _ -> - corba:raise(#'CosNotifyFilter_InvalidGrammar'{}) - end. - -%%----------------------------------------------------------% -%% function : create_mapping_filter -%% Arguments: InitGrammar - string() -%% Returns : CosNotifyFilter::Filter | -%% {'EXCEPTION', InvalidGrammar} -%%----------------------------------------------------------- -create_mapping_filter(OE_THIS, State, InitGrammar, DefVal) -> - case lists:member(InitGrammar, ?not_SupportedGrammars) of - true -> - SO = 'CosNotification_Common':get_option(server_options, State#state.options, - ?not_DEFAULT_SETTINGS), - Fi='CosNotifyFilter_MappingFilter':oe_create_link([OE_THIS, self(), - InitGrammar, DefVal], - SO), - {reply, Fi, State}; - _ -> - corba:raise(#'CosNotifyFilter_InvalidGrammar'{}) - end. - -%%--------------- LOCAL FUNCTIONS ---------------------------- -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/CosNotifyFilter_Filter_impl.erl b/lib/cosNotification/src/CosNotifyFilter_Filter_impl.erl deleted file mode 100644 index 0f997049e0..0000000000 --- a/lib/cosNotification/src/CosNotifyFilter_Filter_impl.erl +++ /dev/null @@ -1,672 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosNotifyFilter_Filter_impl.erl -%% Purpose : -%% Note : For an event to be forwarded it's sufficient that at least -%% one of the constraints return 'true'. -%% ALL functions in this module are internal. May NOT be used -%% externally in ANY WAY; only CosNotification system modules. -%%---------------------------------------------------------------------- - --module('CosNotifyFilter_Filter_impl'). - -%%--------------- INCLUDES ----------------------------------- -%% Application files --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). --include("CosNotification_Definitions.hrl"). - -%%--------------- IMPORTS ------------------------------------ - -%%--------------- EXPORTS ------------------------------------ -%% External Attributes --export(['_get_constraint_grammar'/2]). -%% External Functions --export([add_constraints/3, - modify_constraints/4, - get_constraints/3, - get_all_constraints/2, - remove_all_constraints/2, - destroy/2, - match/3, - match_structured/3, - match_typed/3, - attach_callback/3, - detach_callback/3, - get_callbacks/2]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - -%%--------------- LOCAL DEFINITIONS -------------------------- -%%######### MISC ########## --define(create_ConstraintInfo(_Types, _Con, _ID), - #'CosNotifyFilter_ConstraintInfo'{ - constraint_expression = - #'CosNotifyFilter_ConstraintExp'{ - event_types = _Types, - constraint_expr = _Con}, - constraint_id = _ID - }). - -%%#### Data structures #### --record(state, {constraint_grammar, - constraints = [], - filters = [], - callbacks = [], - idCounter = 0, - filterFactory, - factoryPid, - etsR}). - -%% Data structures constructors --define(get_InitState(Fac, Pid, Gr), - #state{constraint_grammar=Gr, - filterFactory=Fac, - factoryPid=Pid, - etsR = ets:new(oe_ets, [bag, protected])}). - -%%------------------- Data structures selectors ------------------- -%% Grammar --define(get_Grammar(S), S#state.constraint_grammar). -%% Callbacks -% Left out for now to avoid dialyzer warning. -%-define(get_Callback(S,I), find_obj(lists:keysearch(I, 1, S#state.callbacks), -% callback)). --define(get_AllCallback(S), lists:map(fun({_V, C}) -> C end, - S#state.callbacks)). --define(get_AllCallbackID(S), lists:map(fun({V, _C}) -> V end, - S#state.callbacks)). -%% ID:s --define(get_IdCounter(S), S#state.idCounter). - -%% Constraints --define(get_Constraint(S,I), find_obj(lists:keysearch(I, 1, S#state.constraints), - constraint)). --define(get_AllConstraints(S), lists:map(fun({I, C, _W, _WC, _K, T}) -> - ?create_ConstraintInfo(T, C, I) - end, - S#state.constraints)). --define(get_ConstraintAllData(S), S#state.constraints). --define(get_ConstraintData(S,I), lists:keysearch(I, 1, S#state.constraints)). --define(match_Type(S,I,ET), ets:lookup(S#state.etsR, {I, ET})). -%% Parse Tree --define(get_ParseTree(S,K), find_obj(ets:lookup(S#state.etsR, K), tree)). - -%%------------------- Data structures modifiers ------------------- -%% Callbacks --define(del_Callback(S,I), S#state{callbacks = - delete_obj(lists:keydelete(I,1, - S#state.callbacks), - S#state.callbacks, callback)}). --define(del_AllCallbacks(S), S#state{callbacks=[]}). --define(add_Callback(S,V,C), S#state{idCounter=V, - callbacks = [{V,C}|S#state.callbacks]}). -%% ID:s --define(set_IdCounter(S,V), S#state{idCounter=V}). --define(new_Id(S), 'CosNotification_Common':create_id(S#state.idCounter)). - -%% Constraints --define(del_Constraint(S, I), match_delete(S, S#state.constraints, I)). --define(del_AllConstraints(S), clear_DB(S)). --define(add_Constraint(S,I,C,W,_WC,K,T), S#state{constraints = - [{I, C, W, _WC, K, T}|S#state.constraints]}). --define(set_Constraints(S,C), S#state{constraints = C}). - --define(del_AllTypes(S), ets:match_delete(S#state.etsR, {'_','_',types})). --define(del_Type(S,I), ets:match_delete(S#state.etsR, {{I, '_'}, '_', types})). --define(add_Type(S,I,ET,K), ets:insert(S#state.etsR, {{I, ET}, K, types})). - -%% Parse Tree --define(add_ParseTree(S,K,T), ets:insert(S#state.etsR, {K, T, tree})). --define(del_ParseTree(S,K), ets:delete(S#state.etsR, K)). --define(del_AllParseTress(S), ets:match_delete(S#state.etsR, {'_','_',tree})). - -%%------------------- MISC ---------------------------------------- --define(is_EmptyFilter(S), S#state.constraints==[]). - --define(InfoSeq2EventTypeSeq(L), lists:flatten( - lists:map(fun(#'CosNotifyFilter_ConstraintInfo' - {constraint_expression= - #'CosNotifyFilter_ConstraintExp' - {event_types = ET}}) -> - ET - end, - L))). - -%%-----------------------------------------------------------% -%% Function : handle_info, code_change -%% Arguments: See gen_server documentation. -%% Effect : Functions demanded by the gen_server module. -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(Info, State) -> - ?debug_print("INFO: ~p DATA: ~p~n", [State, Info]), - case Info of - {'EXIT', _Pid, _Reason} -> - {noreply, State}; - _ -> - {noreply, State} - end. - -%%----------------------------------------------------------% -%% Function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init([FiFac, FacPid, ConstraintGr]) -> - process_flag(trap_exit, true), - {ok, ?get_InitState(FiFac, FacPid, ConstraintGr)}. - -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------- -%%------- Exported external attributes ---------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Function : '_get_constraint_grammar'/2 -%% Type : readonly -%% Returns : Grammar - string() -%%----------------------------------------------------------- -'_get_constraint_grammar'(_OE_THIS, State) -> - {reply, ?get_Grammar(State), State}. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Function : add_constraints/3 -%% Arguments: CL - CosNotifyFilter::ConstraintExpSeq -%% Returns : CosNotifyFilter::ConstraintInfoSeq | -%% {'EXCEPTION', CosNotifyFilter::InvalidConstraint} -%%----------------------------------------------------------- -add_constraints(_OE_THIS, State, CL) -> - {NewState, Filters, Info, EventTSeq} = try_create_filters(State, CL), - NewState2=store_filters(NewState, Filters), - inform_callbacks(?get_AllCallback(NewState2), EventTSeq, []), - {reply, Info, NewState2}. - -%%----------------------------------------------------------% -%% Function : modify_constraints/4 -%% Arguments: IDs - CosNotifyFilter::ConstraintIDSeq -%% AddConstraintInfoSeq - CosNotifyFilter::ConstraintInfoSeq -%% Returns : ok | -%% {'EXCEPTION', CosNotifyFilter::InvalidConstraint} | -%% {'EXCEPTION', CosNotifyFilter::ConstraintNotFound} -%%----------------------------------------------------------- -%% The OMG specification (TC Document telecom/98-11-01, chapter -%% 3.2.1.3) states (concerning IDs): -%% -%% "If all input values supplied within a particular invocation -%% of this operation are valid, then the specific constraints -%% identified by the values contained in the first input parameter -%% will be deleted from the list of those encapsulated by the target -%% filter object." -%% -%% Hence, first we must check if all ID's exists before deleting. -modify_constraints(_OE_THIS, State, IDs, AddConstraintInfoSeq) -> - %% The following functions are 'safe', i.e., they do not alter any data. - RemoveConstraintInfoSeq = lookup_constraints(IDs, State), - lookup_constraints(AddConstraintInfoSeq, State), - {NewState, Filters, _Info, AddedEventTSeq} = - try_create_filters(State, AddConstraintInfoSeq), - RemovedEventTSeq = ?InfoSeq2EventTypeSeq(RemoveConstraintInfoSeq), - - %% We cannot change anything before our checks (see above). Hence, - %% do NOT move the following lines above this point. - NewState2 = delete_constraints(IDs, NewState), - -%% The OMG specification (TC Document telecom/98-11-01, chapter -%% 3.2.1.3) states (concerning AddConstraintInfoSeq): -%% -%% "If all input values supplied within a particular invocation of this -%% operation are valid, then the constraint expression associated with the -%% already encapsulated constraint identified by the numeric value contained -%% within each element of the input sequence will be modified to the new -%% constraint expression that is contained within the same sequence element." -%% -%% This, our interpretation, implies that ALL previous data related -%% to each unique ID should be removed and replaced by the new data. - - NewState3 = delete_constraints(AddConstraintInfoSeq, NewState2), - NewState4 = store_filters(NewState3, Filters), - inform_callbacks(?get_AllCallback(NewState4), - AddedEventTSeq, RemovedEventTSeq), - {reply, ok, NewState4}. - -%%----------------------------------------------------------% -%% Function : get_constraints/3 -%% Arguments: IDs - CosNotifyFilter::ConstraintIDSeq -%% Returns : CosNotifyFilter::ConstraintInfoSeq | -%% {'EXCEPTION', CosNotifyFilter::ConstraintNotFound} -%%----------------------------------------------------------- -get_constraints(_OE_THIS, State, IDs) -> - {reply, lookup_constraints(IDs, State), State}. - -%%----------------------------------------------------------% -%% Function : get_all_constraints/2 -%% Arguments: - -%% Returns : CosNotifyFilter::ConstraintInfoSeq -%%----------------------------------------------------------- -get_all_constraints(_OE_THIS, State) -> - {reply, ?get_AllConstraints(State), State}. - -%%----------------------------------------------------------% -%% Function : remove_all_constraints/2 -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -remove_all_constraints(_OE_THIS, State) -> - {reply, ok, ?del_AllConstraints(State)}. - -%%----------------------------------------------------------% -%% Function : destroy/2 -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -destroy(_OE_THIS, State) -> - {stop, normal, ok, State}. - -%%----------------------------------------------------------% -%% Function : match/3 -%% Arguments: Event - #any{} -%% Returns : boolean() | -%% {'EXCEPTION', CosNotifyFilter::UnsupportedFilterableData} -%%----------------------------------------------------------- - -match(_OE_THIS, State, Event) when is_record(Event,'any'), ?is_EmptyFilter(State) -> - {reply, true, State}; -match(_OE_THIS, State, Event) when is_record(Event,'any') -> - match_any_event(State, Event, ?get_ConstraintAllData(State)); -match(_,_,What) -> - orber:dbg("[~p] CosNotifyFilter_Filter:match(~p);~n" - "Not an CORBA::Any", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% Function : match_structured/3 -%% Arguments: Event - CosNotification::StructuredEvent -%% Returns : boolean() | -%% {'EXCEPTION', CosNotifyFilter::UnsupportedFilterableData} -%%----------------------------------------------------------- -match_structured(_OE_THIS, State, Event) when - is_record(Event,'CosNotification_StructuredEvent') andalso ?is_EmptyFilter(State) -> - {reply, true, State}; -match_structured(_OE_THIS, State, Event) when - is_record(Event,'CosNotification_StructuredEvent') -> - match_str_event(State, Event, ?get_ConstraintAllData(State)); -match_structured(_,_,What) -> - orber:dbg("[~p] CosNotifyFilter_Filter:match_structured(~p);~n" - "Not a StructuredEvent", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------* -%% Function : match_typed/3 -%% Arguments: Data - CosNotification::PropertySeq -%% Returns : boolean() | -%% {'EXCEPTION', CosNotifyFilter::UnsupportedFilterableData} -%%----------------------------------------------------------- --spec match_typed(_, _, _) -> no_return(). -match_typed(_OE_THIS, _State, _Data) -> - corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% Function : attach_callback/3 -%% Arguments: CB - CosNotifyComm::NotifySubscribe -%% Returns : ID - CosNotifyFilter::CallbackID -%%----------------------------------------------------------- -attach_callback(_OE_THIS, State, CB) -> - 'CosNotification_Common':type_check(CB, 'CosNotifyComm_NotifySubscribe'), - CBID = ?new_Id(State), - {reply, CBID, ?add_Callback(State, CBID, CB)}. - -%%----------------------------------------------------------% -%% Function : detach_callback/3 -%% Arguments: ID - CosNotifyFilter::CallbackID -%% Returns : ok | {'EXCEPTION', CosNotifyFilter::CallbackNotFound} -%%----------------------------------------------------------- -detach_callback(_OE_THIS, State, ID) when is_integer(ID) -> - {reply, ok, ?del_Callback(State, ID)}; -detach_callback(_,_,What) -> - orber:dbg("[~p] CosNotifyFilter_Filter:detach_callback(~p);~n" - "Not an integer", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% Function : get_callbacks/2 -%% Arguments: - -%% Returns : CosNotifyFilter::CallbackIDSeq -%%----------------------------------------------------------- -get_callbacks(_OE_THIS, State) -> - {reply, ?get_AllCallbackID(State), State}. - -%%--------------- LOCAL FUNCTIONS ---------------------------- -%% To match callbacks -find_obj({value, {_, Obj}},_) -> Obj; -%% To match constraints -find_obj({value, {Id, Con, _, _, _, Types}}, _) -> - ?create_ConstraintInfo(Types, Con, Id); -find_obj([{_, Tree, tree}|_], tree) -> Tree; -% Left out for now to avoid dialyzer warning. -%find_obj(_,callback) -> {'EXCEPTION', #'CosNotifyFilter_CallbackNotFound'{}}; -find_obj(_,tree) -> undefined; -find_obj(_,constraint) -> error. - -%% Delete a single object. -delete_obj(List,List,callback) -> corba:raise(#'CosNotifyFilter_CallbackNotFound'{}); -delete_obj(List,_,_) -> List. - -%% Delete given object from list and all related objects in DB (parse tree and types). -match_delete(State, Constraints, ID) -> - match_delete(State, Constraints, ID, []). -match_delete(_, [], _, _) -> - error; -match_delete(State, [{ID, _Con, _Which, _WC, Key, _Types}|T], ID, Acc) -> - ?del_Type(State, ID), - ?del_ParseTree(State, Key), - {ok, ?set_Constraints(State, Acc++T)}; -match_delete(State, [H|T], ID, Acc) -> - match_delete(State, T, ID, [H|Acc]). - -%% Remove all data related with constraints; for now, since no other data -%% stored in DB, we do in a rather brutal way. -clear_DB(State) -> - catch ets:delete(State#state.etsR), - State#state{etsR = ets:new(oe_ets, [bag, protected]), constraints=[]}. - -%% Given a list of Constrain IDs we want to find the related constraints. -%% !!!!!! This function may not alter any data in DB in any way !!!!!!!!!! -lookup_constraints(IDs, State) -> - lookup_constraints(IDs, State, []). -lookup_constraints([], _State, Accum) -> - Accum; -lookup_constraints([H|T], State, Accum) - when is_record(H, 'CosNotifyFilter_ConstraintInfo') -> - case ?get_Constraint(State, H#'CosNotifyFilter_ConstraintInfo'.constraint_id) of - error -> - corba:raise(#'CosNotifyFilter_ConstraintNotFound' - {id = H#'CosNotifyFilter_ConstraintInfo'.constraint_id}); - _Con -> - %% We don't need to collect the result since the input already is of - %% the correct type, i.e., ConstraintInfoSeq - lookup_constraints(T, State, Accum) - end; -lookup_constraints([H|T], State, Accum) when is_integer(H) -> - case ?get_Constraint(State,H) of - error -> - corba:raise(#'CosNotifyFilter_ConstraintNotFound'{id=H}); - Con -> - lookup_constraints(T, State, [Con|Accum]) - end; -lookup_constraints(_, _, _) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%% Given a list of Constrain IDs we want to delet the related constraints. -%% We need also to return the ConstraintInfoSeq described related to the -%% given ID's. -delete_constraints([], State) -> - State; -delete_constraints([H|T], State) - when is_record(H, 'CosNotifyFilter_ConstraintInfo') -> - case catch ?del_Constraint(State, - H#'CosNotifyFilter_ConstraintInfo'.constraint_id) of - {ok, NewState} -> - delete_constraints(T, NewState); - Reason -> - orber:dbg("[~p] 'CosNotifyFilter_Filter':modify_constraints().~n" - "Unable to remove: ~p~n" - "Reason: ~p~n", - [?LINE, H, Reason], ?DEBUG_LEVEL), - delete_constraints(T, State) - end; -delete_constraints([H|T], State) -> - case catch ?del_Constraint(State,H) of - {ok, NewState} -> - delete_constraints(T, NewState); - Reason -> - orber:dbg("[~p] 'CosNotifyFilter_Filter':modify_constraints().~n" - "Unable to remove: ~p~n" - "Reason: ~p~n", - [?LINE, H, Reason], ?DEBUG_LEVEL), - delete_constraints(T, State) - end. - -%% Inform all registered callbacks that the constraints have changed. -%% Added and Removed must be a CosNotification::EventTypeSeq -inform_callbacks([],_,_) -> - ok; -inform_callbacks([H|T], Added, Removed) -> - case catch 'CosNotifyComm_NotifySubscribe':subscription_change(H, Added, Removed) of - ok -> - ?debug_print("INFORMED CALLBACK: ~p ADDED: ~p REMOVED: ~p", - [H, Added, Removed]), - inform_callbacks(T, Added, Removed); - Other -> - orber:dbg("[~p] 'CosNotifyComm_NotifySubscribe':subscription_change().~n" - "Unable to inform callback: ~p~n" - "Reason: ~p~n", - [?LINE, H, Other], ?DEBUG_LEVEL), - inform_callbacks(T, Added, Removed) - end. - -%%----------------------------------------------------------- -%% Function : try_create_filters/2 -%% Arguments: CL - #'CosNotifyFilter_ConstraintExp'{ -%% event_types = [#'CosNotification_EventType'{ -%% domain_name = Str, type_name = Str}] -%% constraint_expr = Str} -%% Returns : {State, AccumList} -%%----------------------------------------------------------- -%% !!!!!! This function may not alter any data in DB in any way !!!!!!!!!! -try_create_filters(State, CL) -> - try_create_filters(State, CL, [], [], []). -try_create_filters(State, [], Accum, InfoSeq, EventTSeq) -> - {State, Accum, InfoSeq, EventTSeq}; -try_create_filters(State, [#'CosNotifyFilter_ConstraintExp'{event_types = Types, - constraint_expr = Con}|T], - Accum, InfoSeq, EventTSeq) -> - case catch cosNotification_Filter:create_filter(Con) of - {ok, Tree} -> - case catch cosNotification_Filter:check_types(Types) of - true -> - ID = ?new_Id(State), - Key = ?not_CreateDBKey, - NewETSeq = Types ++ EventTSeq, - try_create_filters(?set_IdCounter(State, ID), T, - [{ID, true, [], Key, Types, Con, Tree}|Accum], - [?create_ConstraintInfo(Types, Con, ID)|InfoSeq], - NewETSeq); - {ok, Which, WC} -> - ID = ?new_Id(State), - Key = ?not_CreateDBKey, - NewETSeq = Types ++ EventTSeq, - try_create_filters(?set_IdCounter(State, ID), T, - [{ID, Which, WC, Key, Types, Con, Tree}|Accum], - [?create_ConstraintInfo(Types, Con, ID)|InfoSeq], - NewETSeq); - _ -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end; - _ -> - corba:raise(#'CosNotifyFilter_InvalidConstraint' - {constr = #'CosNotifyFilter_ConstraintExp' - {event_types = Types, constraint_expr = Con}}) - end; -try_create_filters(State, [#'CosNotifyFilter_ConstraintInfo' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = Types, constraint_expr = Con}, - constraint_id=ID}|T], Accum, InfoSeq, EventTSeq) -> - case catch cosNotification_Filter:create_filter(Con) of - {ok, Tree} -> - case catch cosNotification_Filter:check_types(Types) of - true -> - Key = ?not_CreateDBKey, - NewETSeq = Types ++ EventTSeq, - try_create_filters(State, T, - [{ID, true, [], Key, Types, Con, Tree}|Accum], - [?create_ConstraintInfo(Types, Con, ID)|InfoSeq], - NewETSeq); - {ok, Which, WC} -> - Key = ?not_CreateDBKey, - NewETSeq = Types ++ EventTSeq, - try_create_filters(State, T, - [{ID, Which, WC, Key, Types, Con, Tree}|Accum], - [?create_ConstraintInfo(Types, Con, ID)|InfoSeq], - NewETSeq); - _ -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end; - _ -> - corba:raise(#'CosNotifyFilter_InvalidConstraint' - {constr = #'CosNotifyFilter_ConstraintExp' - {event_types = Types, constraint_expr = Con}}) - end; -try_create_filters(_,_,_,_,_) -> - %% The list contained something else but ConstraintExp. - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------- -%% Function : store_filters/4 -%% Arguments: Filters - a list of filters. -%% Returns : -%%----------------------------------------------------------- - -store_filters(State, []) -> - State; -store_filters(State, [{ID, Which, WC, Key, Types, Con, Tree}|T]) -> - ?add_ParseTree(State, Key, Tree), - write_types(State, Types, ID, Key), - store_filters(?add_Constraint(State, ID, Con, Which, WC, Key, Types), T). - - -write_types(_State, [],_, _) -> - ok; -write_types(State, [EventType|T], ID, Key) -> - ?add_Type(State, ID, EventType, Key), - ?debug_print("FILTER: ~p ~p ~p~n", [ID, Key, EventType]), - write_types(State, T, ID, Key). - -%%----------------------------------------------------------- -%% Function : match_any_event -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -match_any_event(State, _Event, []) -> - ?debug_print("FILTER REJECTED: ~p~n", [_Event]), - {reply, false, State}; -match_any_event(State, Event, [{_, _, _, _, Key, _}|T]) -> - case catch cosNotification_Filter:eval(?get_ParseTree(State,Key), Event) of - true -> - ?debug_print("FILTER APPROVED (WC): ~p~n", [Event]), - {reply, true, State}; - _ -> - match_any_event(State, Event, T) - end. - - -%%----------------------------------------------------------- -%% Function : match_str_event -%% Arguments: -%% Returns : -%%----------------------------------------------------------- - -match_str_event(State, _Event, []) -> - ?debug_print("FILTER REJECTED: ~p~n", [_Event]), - {reply, false, State}; -match_str_event(State, Event, [{ID, _Con, Which, WC, Key, _Types}|T]) -> - ET = ((Event#'CosNotification_StructuredEvent'.header) - #'CosNotification_EventHeader'.fixed_header) - #'CosNotification_FixedEventHeader'.event_type, - CheckList = - case Which of - both -> - [ET]; - domain -> - [ET, - ET#'CosNotification_EventType'{type_name=""}, - ET#'CosNotification_EventType'{type_name="*"}]; - type -> - [ET, - ET#'CosNotification_EventType'{domain_name=""}, - ET#'CosNotification_EventType'{domain_name="*"}]; - _ -> - [ET, - ET#'CosNotification_EventType'{type_name=""}, - ET#'CosNotification_EventType'{type_name="*"}, - ET#'CosNotification_EventType'{domain_name=""}, - ET#'CosNotification_EventType'{domain_name="*"}] - end, - case check_DB(State, ID, CheckList) of - false -> - %% No match, may have used wildcards, e.g., "dom*". - case catch cosNotification_Filter:match_types( - ET#'CosNotification_EventType'.domain_name, - ET#'CosNotification_EventType'.type_name, - WC) of - true -> - case catch cosNotification_Filter:eval(?get_ParseTree(State,Key), - Event) of - true -> - ?debug_print("FILTER APPROVED (WC): ~p~n", [Event]), - {reply, true, State}; - _ -> - match_str_event(State, Event, T) - end; - _-> - match_str_event(State, Event, T) - end; - Key -> - case catch cosNotification_Filter:eval(?get_ParseTree(State,Key), - Event) of - true -> - ?debug_print("FILTER APPROVED: ~p~n", [Event]), - {reply, true, State}; - _ -> - match_str_event(State, Event, T) - end - end. - -check_DB(_, _, []) -> - false; -check_DB(State, ID, [H|T]) -> - case ?match_Type(State, ID, H) of - [] -> - check_DB(State, ID, T); - [{_, K, types}|_] -> - K - end. - - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ - diff --git a/lib/cosNotification/src/CosNotifyFilter_MappingFilter_impl.erl b/lib/cosNotification/src/CosNotifyFilter_MappingFilter_impl.erl deleted file mode 100644 index 03c0e03be6..0000000000 --- a/lib/cosNotification/src/CosNotifyFilter_MappingFilter_impl.erl +++ /dev/null @@ -1,580 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosNotifyFilter_MappingFilter_impl.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module('CosNotifyFilter_MappingFilter_impl'). - -%%--------------- INCLUDES ----------------------------------- -%% Application files --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). --include("CosNotification_Definitions.hrl"). - -%%--------------- IMPORTS ------------------------------------ - -%%--------------- EXPORTS ------------------------------------ -%% External Attributes --export(['_get_constraint_grammar'/2, - '_get_value_type'/2, - '_get_default_value'/2]). -%% External Functions --export([add_mapping_constraints/3, - modify_mapping_constraints/4, - get_mapping_constraints/3, - get_all_mapping_constraints/2, - remove_all_mapping_constraints/2, - destroy/2, - match/3, - match_structured/3, - match_typed/3]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - -%%--------------- LOCAL DEFINITIONS -------------------------- -%%######### MISC ########## --define(create_MappingInfo(_Types, _Con, _ID, _A), - #'CosNotifyFilter_MappingConstraintInfo'{ - constraint_expression = - #'CosNotifyFilter_ConstraintExp'{ - event_types = _Types, - constraint_expr = _Con}, - constraint_id = _ID, - value = _A - }). -%%#### Data structures #### --record(state, {constraint_grammar, - value, - typeC, - constraints = [], - filters = [], - idCounter = 0, - filterFactory, - factoryPid, - etsR}). - -%% Data structures constructors --define(get_InitState(Gr, DVal, FF, FP), - #state{constraint_grammar=Gr, - value = DVal, - typeC = any:get_typecode(DVal), - filterFactory = FF, - factoryPid = FP, - etsR = ets:new(oe_ets, [bag, protected])}). - -%%------------------- Data structures selectors ------------------- -%% Attributes --define(get_Grammar(S), S#state.constraint_grammar). --define(get_DefVal(S), S#state.value). --define(get_DefTC(S), S#state.typeC). --define(get_DefAny(S), S#state.value). - -%% ID:s --define(get_IdCounter(S), S#state.idCounter). - -%% Constraints --define(get_Constraint(S,I), find_obj(lists:keysearch(I, 1, S#state.constraints), - constraint)). --define(get_AllConstraints(S), lists:map(fun({I, C, _W, _WC, _K, T, A}) -> - ?create_MappingInfo(T, C, I, A) - end, - S#state.constraints)). --define(get_ConstraintAllData(S), S#state.constraints). --define(get_ConstraintData(S,I), lists:keysearch(I, 1, S#state.constraints)). --define(match_Type(S,I,ET), ets:lookup(S#state.etsR, {I, ET})). -%% Parse Tree --define(get_ParseTree(S,K), find_obj(ets:lookup(S#state.etsR, K), tree)). - -%%------------------- Data structures modifiers ------------------- -%% ID:s --define(set_IdCounter(S,V), S#state{idCounter=V}). --define(new_Id(S), 'CosNotification_Common':create_id(S#state.idCounter)). - -%% Constraints --define(del_Constraint(S, I), match_delete(S, S#state.constraints, I)). --define(del_AllConstraints(S), clear_DB(S)). --define(add_Constraint(S,I,C,W,_WC,K,T,A), S#state{constraints = - [{I, C, W, _WC, K, T, A}|S#state.constraints]}). --define(set_Constraints(S,C), S#state{constraints = C}). - --define(del_AllTypes(S), ets:match_delete(S#state.etsR, {'_','_',types})). --define(del_Type(S,I), ets:match_delete(S#state.etsR, {{I, '_'}, '_', types})). --define(add_Type(S,I,ET,K), ets:insert(S#state.etsR, {{I, ET}, K, types})). - -%% Parse Tree --define(add_ParseTree(S,K,T), ets:insert(S#state.etsR, {K, T, tree})). --define(del_ParseTree(S,K), ets:delete(S#state.etsR, K)). --define(del_AllParseTress(S), ets:match_delete(S#state.etsR, {'_','_',tree})). - -%%------------------- MISC ---------------------------------------- --define(is_EmptyFilter(S), S#state.constraints==[]). --define(is_EqualType(S,T), S#state.typeC==any:get_typecode(T)). - -%%-----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: See gen_server documentation. -%% Effect : Functions demanded by the gen_server module. -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(Info, State) -> - ?debug_print("INFO: ~p DATA: ~p~n", [State, Info]), - case Info of - {'EXIT', _Pid, _Reason} -> - {noreply, State}; - _ -> - {noreply, State} - end. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init([FiFac, FacPid, InitGr, DefVal]) -> - process_flag(trap_exit, true), - {ok, ?get_InitState(InitGr, DefVal, FiFac, FacPid)}. - -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------- -%%------- Exported external attributes ---------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Function : '_get_constraint_grammar'/2 -%% Type : readonly -%% Returns : string() -%%----------------------------------------------------------- -'_get_constraint_grammar'(_OE_THIS, State) -> - {reply, ?get_Grammar(State), State}. -%%----------------------------------------------------------% -%% Function : '_get_value_type'/2 -%% Type : readonly -%% Returns : CORBA::TypeCode -%%----------------------------------------------------------- -'_get_value_type'(_OE_THIS, State) -> - {reply, ?get_DefTC(State), State}. -%%----------------------------------------------------------% -%% Function : '_get_default_value'/2 -%% Type : readonly -%% Returns : #any{} -%%----------------------------------------------------------- -'_get_default_value'(_OE_THIS, State) -> - {reply, ?get_DefVal(State), State}. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Function : add_mapping_constraints/3 -%% Arguments: Pairs - CosNotifyFilter::MappingConstraintPairSeq -%% Returns : CosNotifyFilter::MappingConstraintInfoSeq | -%% {'EXCEPTION', CosNotifyFilter::InvalidConstraint} | -%% {'EXCEPTION', CosNotifyFilter::InvalidValue} -%%----------------------------------------------------------- -add_mapping_constraints(_OE_THIS, State, Pairs) -> - {NewState, Filters, Info} = try_create_filters(State, Pairs), - NewState2=store_filters(NewState, Filters), - {reply, Info, NewState2}. - -%%----------------------------------------------------------% -%% Function : modify_mapping_constraints/4 -%% Arguments: IDs - CosNotifyFilter::ConstraintIDSeq -%% Info - CosNotifyFilter::MappingConstraintInfoSeq -%% Returns : ok | -%% {'EXCEPTION', CosNotifyFilter::InvalidConstraint} | -%% {'EXCEPTION', CosNotifyFilter::InvalidValue} | -%% {'EXCEPTION', CosNotifyFilter::ConstraintNotFound} -%%----------------------------------------------------------- -modify_mapping_constraints(_OE_THIS, State, IDs, InfoSeq) -> - lookup_constraints(IDs, State), - lookup_constraints(InfoSeq, State), - {NewState, Filters, _Info} = try_create_filters(State, InfoSeq), - - %% We cannot change anything before our checks (see above). Hence, - %% do NOT move the following lines above this point. - - NewState2 = delete_constraints(IDs, NewState), - NewState3 = delete_constraints(InfoSeq, NewState2), - NewState4 = store_filters(NewState3, Filters), - {reply, ok, NewState4}. - -%%----------------------------------------------------------% -%% Function : get_mapping_constraints/3 -%% Arguments: IDs - CosNotifyFilter::ConstraintIDSeq -%% Returns : CosNotifyFilter::MappingConstraintInfoSeq | -%% {'EXCEPTION', CosNotifyFilter::ConstraintNotFound} -%%----------------------------------------------------------- -get_mapping_constraints(_OE_THIS, State, IDs) -> - {reply, lookup_constraints(IDs, State), State}. - -%%----------------------------------------------------------% -%% Function : get_all_mapping_constraints/2 -%% Arguments: - -%% Returns : CosNotifyFilter::MappingConstraintInfoSeq -%%----------------------------------------------------------- -get_all_mapping_constraints(_OE_THIS, State) -> - {reply, ?get_AllConstraints(State), State}. - -%%----------------------------------------------------------% -%% Function : remove_all_mapping_constraints/2 -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -remove_all_mapping_constraints(_OE_THIS, State) -> - {reply, ok, ?del_AllConstraints(State)}. - -%%----------------------------------------------------------% -%% Function : destroy/2 -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -destroy(_OE_THIS, State) -> - {stop, normal, ok, State}. - -%%----------------------------------------------------------% -%% Function : match/3 -%% Arguments: Event - #any{} -%% Returns : boolean(), #any{} (out-type) | -%% {'EXCEPTION', CosNotifyFilter::UnsupportedFilterableData} -%%----------------------------------------------------------- -match(_OE_THIS, State, Event) when is_record(Event,'any') andalso ?is_EmptyFilter(State) -> - {reply, {false, ?get_DefAny(State)}, State}; -match(_OE_THIS, State, Event) when is_record(Event,'any') -> - match_any_event(State, Event, ?get_ConstraintAllData(State)); -match(_,_,_) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - - -%%----------------------------------------------------------% -%% Function : match_structured/3 -%% Arguments: Event - CosNotification::StructuredEvent -%% Returns : boolean(), #any{} (out-type) | -%% {'EXCEPTION', CosNotifyFilter::UnsupportedFilterableData} -%%----------------------------------------------------------- -match_structured(_OE_THIS, State, Event) when - is_record(Event,'CosNotification_StructuredEvent') andalso ?is_EmptyFilter(State) -> - {reply, {false, ?get_DefAny(State)}, State}; -match_structured(_OE_THIS, State, Event) when - is_record(Event,'CosNotification_StructuredEvent') -> - match_str_event(State, Event, ?get_ConstraintAllData(State)); -match_structured(_,_,_) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------* -%% Function : match_typed/3 -%% Arguments: Data - CosNotification::PropertySeq -%% Returns : boolean() , #any{} (out-type) | -%% {'EXCEPTION', CosNotifyFilter::UnsupportedFilterableData} -%%----------------------------------------------------------- --spec match_typed(_, _, _) -> no_return(). -match_typed(_OE_THIS, _State, _Data) -> - corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}). - -%%--------------- LOCAL FUNCTIONS ---------------------------- -%% To match constraints -find_obj({value, {Id, Con, _, _, _, Types, Any}}, _) -> - ?create_MappingInfo(Types, Con, Id, Any); -find_obj([{_, Tree, tree}|_], tree) -> Tree; -find_obj(_,tree) -> undefined; -find_obj(_,constraint) -> error. - -%% Delete given object from list and all related objects in DB (parse tree and types). -match_delete(State, Constraints, ID) -> - match_delete(State, Constraints, ID, []). -match_delete(_, [], _, _) -> - error; -match_delete(State, [{ID, _Con, _Which, _WC, Key, _Types, _Any}|T], ID, Acc) -> - ?del_Type(State, ID), - ?del_ParseTree(State, Key), - {ok, ?set_Constraints(State, Acc++T)}; -match_delete(State, [H|T], ID, Acc) -> - match_delete(State, T, ID, [H|Acc]). - -%% Remove all data related with constraints; for now, since no other data -%% stored in DB, we do in a rather brutal way. -clear_DB(State) -> - catch ets:delete(State#state.etsR), - State#state{etsR = ets:new(oe_ets, [bag, protected]), constraints=[]}. - -%% Given a list of Constrain IDs we want to find the related constraints. -%% !!!!!! This function may not alter any data in DB in any way !!!!!!!!!! -lookup_constraints(IDs, State) -> - lookup_constraints(IDs, State, []). -lookup_constraints([], _State, Accum) -> - Accum; -lookup_constraints([H|T], State, Accum) - when is_record(H, 'CosNotifyFilter_MappingConstraintInfo') -> - case ?get_Constraint(State, H#'CosNotifyFilter_MappingConstraintInfo'.constraint_id) of - error -> - corba:raise(#'CosNotifyFilter_ConstraintNotFound' - {id = H#'CosNotifyFilter_MappingConstraintInfo'.constraint_id}); - _Con -> - %% We don't need to collect the result since the input already is of - %% the correct type, i.e., ConstraintInfoSeq - lookup_constraints(T, State, Accum) - end; -lookup_constraints([H|T], State, Accum) when is_integer(H) -> - case ?get_Constraint(State,H) of - error -> - corba:raise(#'CosNotifyFilter_ConstraintNotFound'{id=H}); - Con -> - lookup_constraints(T, State, [Con|Accum]) - end; -lookup_constraints(_, _, _) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%% Given a list of Constrain IDs we want to delet the related constraints. -%% We need also to return the ConstraintInfoSeq described related to the -%% given ID's. -delete_constraints([], State) -> - State; -delete_constraints([H|T], State) - when is_record(H, 'CosNotifyFilter_MappingConstraintInfo') -> - case catch ?del_Constraint(State, - H#'CosNotifyFilter_MappingConstraintInfo'.constraint_id) of - {ok, NewState} -> - delete_constraints(T, NewState); - Reason -> - orber:dbg("[~p] 'CosNotifyFilter_MappingFilter':modify_mapping_constraints().~n" - "Unable to remove: ~p~n" - "Reason: ~p~n", - [?LINE, H, Reason], ?DEBUG_LEVEL), - delete_constraints(T, State) - end; -delete_constraints([H|T], State) -> - case catch ?del_Constraint(State,H) of - {ok, NewState} -> - delete_constraints(T, NewState); - Reason -> - orber:dbg("[~p] 'CosNotifyFilter_MappingFilter':modify_mapping_constraints().~n" - "Unable to remove: ~p~n" - "Reason: ~p~n", - [?LINE, H, Reason], ?DEBUG_LEVEL), - delete_constraints(T, State) - end. - -%%----------------------------------------------------------- -%% Function : try_create_filters/2 -%% Arguments: CL - #'CosNotifyFilter_MappingConstraintPair{ -%% constraint_expression = -%% #'CosNotifyFilter_ConstraintExp'{ -%% event_types = -%% [#'CosNotification_EventType'{ -%% domain_name = Str, type_name = Str}] -%% constraint_expr = Str}, -%% result_to_set = Any} -%% Returns : {State, AccumList} -%%----------------------------------------------------------- -%% !!!!!! This function may not alter any data in DB in any way !!!!!!!!!! -try_create_filters(State, CL) -> - try_create_filters(State, CL, [], []). -try_create_filters(State, [], Accum, InfoSeq) -> - {State, Accum, InfoSeq}; -try_create_filters(State, [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = - #'CosNotifyFilter_ConstraintExp'{event_types = Types, - constraint_expr = Con}, - result_to_set=Any}|T], Accum, InfoSeq) -> - case catch {?is_EqualType(State,Any), cosNotification_Filter:create_filter(Con)} of - {false, _} -> - corba:raise(#'CosNotifyFilter_InvalidValue' - {constr = #'CosNotifyFilter_ConstraintExp' - {event_types = Types, constraint_expr = Con}, - value=Any}); - {_, {ok, Tree}} -> - case catch cosNotification_Filter:check_types(Types) of - true -> - ID = ?new_Id(State), - Key = ?not_CreateDBKey, - try_create_filters(?set_IdCounter(State, ID), T, - [{ID, true, [], Key, Types, Con, Tree, Any}|Accum], - [?create_MappingInfo(Types, Con, ID, Any)|InfoSeq]); - {ok, Which, WC} -> - ID = ?new_Id(State), - Key = ?not_CreateDBKey, - try_create_filters(?set_IdCounter(State, ID), T, - [{ID, Which, WC, Key, Types, Con, Tree, Any}|Accum], - [?create_MappingInfo(Types, Con, ID, Any)|InfoSeq]); - _ -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end; - _ -> - corba:raise(#'CosNotifyFilter_InvalidConstraint' - {constr = #'CosNotifyFilter_ConstraintExp' - {event_types = Types, constraint_expr = Con}}) - end; -try_create_filters(State, [#'CosNotifyFilter_MappingConstraintInfo' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = Types, constraint_expr = Con}, - constraint_id=ID, - value=Any}|T], Accum, InfoSeq) -> - case catch cosNotification_Filter:create_filter(Con) of - {ok, Tree} -> - case catch cosNotification_Filter:check_types(Types) of - true -> - Key = ?not_CreateDBKey, - try_create_filters(State, T, - [{ID, true, [], Key, Types, Con, Tree, Any}|Accum], - [?create_MappingInfo(Types, Con, ID, Any)|InfoSeq]); - {ok, Which, WC} -> - Key = ?not_CreateDBKey, - try_create_filters(State, T, - [{ID, Which, WC, Key, Types, Con, Tree, Any}|Accum], - [?create_MappingInfo(Types, Con, ID, Any)|InfoSeq]); - _ -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end; - _ -> - corba:raise(#'CosNotifyFilter_InvalidConstraint' - {constr = #'CosNotifyFilter_ConstraintExp' - {event_types = Types, constraint_expr = Con}}) - end; -try_create_filters(_,_,_,_) -> - %% The list contained something else but ConstraintExp. - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------- -%% Function : store_filters/4 -%% Arguments: Filters - a list of filters. -%% Returns : -%%----------------------------------------------------------- - -store_filters(State, []) -> - State; -store_filters(State, [{ID, Which, WC, Key, Types, Con, Tree, Any}|T]) -> - ?add_ParseTree(State, Key, Tree), - write_types(State, Types, ID, Key), - store_filters(?add_Constraint(State, ID, Con, Which, WC, Key, Types, Any), T). - - -write_types(_State, [],_, _) -> - ok; -write_types(State, [EventType|T], ID, Key) -> - ?add_Type(State, ID, EventType, Key), - ?debug_print("FILTER: ~p ~p ~p~n", [ID, Key, EventType]), - write_types(State, T, ID, Key). - -%%----------------------------------------------------------- -%% Function : match_any_event -%% Arguments: Event - #any{} -%% Returns : -%%----------------------------------------------------------- -match_any_event(State, _Event, []) -> - ?debug_print("FILTER REJECTED: ~p~n", [_Event]), - {reply, {false, ?get_DefAny(State)}, State}; -match_any_event(State, Event, [{_, _, _, _, Key, Any}|T]) -> - case catch cosNotification_Filter:eval(?get_ParseTree(State,Key), Event) of - true -> - ?debug_print("FILTER APPROVED (WC): ~p~n", [Event]), - {reply, {true, Any}, State}; - _ -> - match_any_event(State, Event, T) - end. - - -%%----------------------------------------------------------- -%% Function : match_str_event -%% Arguments: -%% Returns : -%%----------------------------------------------------------- - -match_str_event(State, _Event, []) -> - ?debug_print("FILTER REJECTED: ~p~n", [_Event]), - {reply, {false, ?get_DefAny(State)}, State}; -match_str_event(State, Event, [{ID, _Con, Which, WC, Key, _Types, Any}|T]) -> - ET = ((Event#'CosNotification_StructuredEvent'.header) - #'CosNotification_EventHeader'.fixed_header) - #'CosNotification_FixedEventHeader'.event_type, - CheckList = - case Which of - both -> - [ET]; - domain -> - [ET, - ET#'CosNotification_EventType'{type_name=""}, - ET#'CosNotification_EventType'{type_name="*"}]; - type -> - [ET, - ET#'CosNotification_EventType'{domain_name=""}, - ET#'CosNotification_EventType'{domain_name="*"}]; - _ -> - [ET, - ET#'CosNotification_EventType'{type_name=""}, - ET#'CosNotification_EventType'{type_name="*"}, - ET#'CosNotification_EventType'{domain_name=""}, - ET#'CosNotification_EventType'{domain_name="*"}] - end, - case check_DB(State, ID, CheckList) of - false -> - %% No match, may have used wildcards, e.g., "dom*". - case catch cosNotification_Filter:match_types( - ET#'CosNotification_EventType'.domain_name, - ET#'CosNotification_EventType'.type_name, - WC) of - true -> - case catch cosNotification_Filter:eval(?get_ParseTree(State,Key), - Event) of - true -> - ?debug_print("FILTER APPROVED (WC): ~p~n", [Event]), - {reply, {true, Any}, State}; - _ -> - match_str_event(State, Event, T) - end; - _-> - match_str_event(State, Event, T) - end; - Key -> - case catch cosNotification_Filter:eval(?get_ParseTree(State,Key), - Event) of - true -> - ?debug_print("FILTER APPROVED: ~p~n", [Event]), - {reply, {true, Any}, State}; - _ -> - match_str_event(State, Event, T) - end - end. - -check_DB(_, _, []) -> - false; -check_DB(State, ID, [H|T]) -> - case ?match_Type(State, ID, H) of - [] -> - check_DB(State, ID, T); - [{_, K, types}|_] -> - K - end. -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ - diff --git a/lib/cosNotification/src/CosTypedEvent.idl b/lib/cosNotification/src/CosTypedEvent.idl deleted file mode 100644 index d77c37731a..0000000000 --- a/lib/cosNotification/src/CosTypedEvent.idl +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef _COS_TYPED_EVENT_IDL_ -#define _COS_TYPED_EVENT_IDL_ - -#pragma prefix "omg.org" - -#include - -module CosTypedEventComm { - - interface TypedPushConsumer : CosEventComm::PushConsumer { - Object get_typed_consumer(); - }; - - interface TypedPullSupplier : CosEventComm::PullSupplier { - Object get_typed_supplier(); - }; -}; - -module CosTypedEventChannelAdmin { - - exception InterfaceNotSupported {}; - exception NoSuchImplementation {}; - typedef string Key; - - - interface TypedProxyPushConsumer : - CosEventChannelAdmin::ProxyPushConsumer, - CosTypedEventComm::TypedPushConsumer { }; - - interface TypedProxyPullSupplier : - CosEventChannelAdmin::ProxyPullSupplier, - CosTypedEventComm::TypedPullSupplier { }; - - interface TypedSupplierAdmin : - CosEventChannelAdmin::SupplierAdmin { - TypedProxyPushConsumer obtain_typed_push_consumer(in Key supported_interface) - raises(InterfaceNotSupported); - CosEventChannelAdmin::ProxyPullConsumer obtain_typed_pull_consumer (in Key uses_interface) - raises(NoSuchImplementation); - }; - - interface TypedConsumerAdmin : - CosEventChannelAdmin::ConsumerAdmin { - TypedProxyPullSupplier obtain_typed_pull_supplier(in Key supported_interface) - raises (InterfaceNotSupported); - CosEventChannelAdmin::ProxyPushSupplier obtain_typed_push_supplier(in Key uses_interface) - raises(NoSuchImplementation); - }; - - interface TypedEventChannel { - TypedConsumerAdmin for_consumers(); - TypedSupplierAdmin for_suppliers(); - void destroy (); - }; -}; - -#endif /* ifndef _COS_TYPED_EVENT_IDL_ */ diff --git a/lib/cosNotification/src/CosTypedNotification.idl b/lib/cosNotification/src/CosTypedNotification.idl deleted file mode 100644 index 882cde16e0..0000000000 --- a/lib/cosNotification/src/CosTypedNotification.idl +++ /dev/null @@ -1,109 +0,0 @@ -#ifndef _COS_TYPED_NOTIFICATION_IDL_ -#define _COS_TYPED_NOTIFICATION_IDL_ - -#pragma prefix "omg.org" - -#include -#include -#include - -module CosTypedNotifyComm { - interface TypedPushConsumer : CosTypedEventComm::TypedPushConsumer, CosNotifyComm::NotifyPublish { }; // TypedPushConsumer - - interface TypedPullSupplier : CosTypedEventComm::TypedPullSupplier, CosNotifyComm::NotifySubscribe { }; // TypedPullSupplier -}; // CosTypedNotifyComm - - -module CosTypedNotifyChannelAdmin { - // Forward declaration - interface TypedEventChannelFactory; - typedef string Key; - interface TypedProxyPushConsumer : CosNotifyChannelAdmin::ProxyConsumer, CosTypedNotifyComm::TypedPushConsumer { - void connect_typed_push_supplier (in CosEventComm::PushSupplier push_supplier) - raises (CosEventChannelAdmin::AlreadyConnected); - }; // TypedProxyPushConsumer - - interface TypedProxyPullSupplier : CosNotifyChannelAdmin::ProxySupplier, CosTypedNotifyComm::TypedPullSupplier { - void connect_typed_pull_consumer (in CosEventComm::PullConsumer pull_consumer) - raises (CosEventChannelAdmin::AlreadyConnected); - }; // TypedProxyPullSupplier - - interface TypedProxyPullConsumer : CosNotifyChannelAdmin::ProxyConsumer, CosNotifyComm::PullConsumer { - void connect_typed_pull_supplier (in CosTypedEventComm::TypedPullSupplier pull_supplier) - raises (CosEventChannelAdmin::AlreadyConnected, CosEventChannelAdmin::TypeError); - - void suspend_connection() - raises (CosNotifyChannelAdmin::ConnectionAlreadyInactive, CosNotifyChannelAdmin::NotConnected); - - void resume_connection() - raises (CosNotifyChannelAdmin::ConnectionAlreadyActive, CosNotifyChannelAdmin::NotConnected); - }; // TypedProxyPullConsumer - - interface TypedProxyPushSupplier : CosNotifyChannelAdmin::ProxySupplier, CosNotifyComm::PushSupplier { - void connect_typed_push_consumer (in CosTypedEventComm::TypedPushConsumer push_consumer) - raises (CosEventChannelAdmin::AlreadyConnected, CosEventChannelAdmin::TypeError); - - void suspend_connection() - raises (CosNotifyChannelAdmin::ConnectionAlreadyInactive, CosNotifyChannelAdmin::NotConnected); - - void resume_connection() - raises (CosNotifyChannelAdmin::ConnectionAlreadyActive, CosNotifyChannelAdmin::NotConnected); - }; // TypedProxyPushSupplier - - interface TypedConsumerAdmin : CosNotifyChannelAdmin::ConsumerAdmin, CosTypedEventChannelAdmin::TypedConsumerAdmin { - TypedProxyPullSupplier obtain_typed_notification_pull_supplier(in Key supported_interface, - out CosNotifyChannelAdmin::ProxyID proxy_id) - raises( CosTypedEventChannelAdmin::InterfaceNotSupported, CosNotifyChannelAdmin::AdminLimitExceeded ); - - TypedProxyPushSupplier obtain_typed_notification_push_supplier(in Key uses_interface, - out CosNotifyChannelAdmin::ProxyID proxy_id) - raises(CosTypedEventChannelAdmin::NoSuchImplementation, CosNotifyChannelAdmin::AdminLimitExceeded); - }; // TypedConsumerAdmin - - interface TypedSupplierAdmin : CosNotifyChannelAdmin::SupplierAdmin, CosTypedEventChannelAdmin::TypedSupplierAdmin { - TypedProxyPushConsumer obtain_typed_notification_push_consumer(in Key supported_interface, - out CosNotifyChannelAdmin::ProxyID proxy_id) - raises( CosTypedEventChannelAdmin::InterfaceNotSupported, CosNotifyChannelAdmin::AdminLimitExceeded); - TypedProxyPullConsumer obtain_typed_notification_pull_consumer(in Key uses_interface, - out CosNotifyChannelAdmin::ProxyID proxy_id ) - raises(CosTypedEventChannelAdmin::NoSuchImplementation, CosNotifyChannelAdmin::AdminLimitExceeded); - }; // TypedSupplierAdmin - - interface TypedEventChannel : CosNotification::QoSAdmin, CosNotification::AdminPropertiesAdmin, - CosTypedEventChannelAdmin::TypedEventChannel { - readonly attribute TypedEventChannelFactory MyFactory; - readonly attribute TypedConsumerAdmin default_consumer_admin; - readonly attribute TypedSupplierAdmin default_supplier_admin; - readonly attribute CosNotifyFilter::FilterFactory default_filter_factory; - - TypedConsumerAdmin new_for_typed_notification_consumers(in CosNotifyChannelAdmin::InterFilterGroupOperator op, - out CosNotifyChannelAdmin::AdminID id); - - TypedSupplierAdmin new_for_typed_notification_suppliers(in CosNotifyChannelAdmin::InterFilterGroupOperator op, - out CosNotifyChannelAdmin::AdminID id); - - TypedConsumerAdmin get_consumeradmin (in CosNotifyChannelAdmin::AdminID id ) - raises (CosNotifyChannelAdmin::AdminNotFound); - - TypedSupplierAdmin get_supplieradmin (in CosNotifyChannelAdmin::AdminID id) - raises (CosNotifyChannelAdmin::AdminNotFound); - - CosNotifyChannelAdmin::AdminIDSeq get_all_consumeradmins(); - - CosNotifyChannelAdmin::AdminIDSeq get_all_supplieradmins(); - }; // TypedEventChannel - - interface TypedEventChannelFactory { - TypedEventChannel create_typed_channel (in CosNotification::QoSProperties initial_QoS, - in CosNotification::AdminProperties initial_admin, - out CosNotifyChannelAdmin::ChannelID id) - raises( CosNotification::UnsupportedQoS, CosNotification::UnsupportedAdmin); - - CosNotifyChannelAdmin::ChannelIDSeq get_all_typed_channels(); - - TypedEventChannel get_typed_event_channel (in CosNotifyChannelAdmin::ChannelID id) - raises (CosNotifyChannelAdmin::ChannelNotFound); - }; // TypedEventChannelFactory -}; // CosTypedNotifyChannelAdmin - -#endif /* ifndef _COS_TYPED_NOTIFICATION_IDL_ */ diff --git a/lib/cosNotification/src/Makefile b/lib/cosNotification/src/Makefile deleted file mode 100644 index 009c6be4a5..0000000000 --- a/lib/cosNotification/src/Makefile +++ /dev/null @@ -1,379 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk - -ifeq ($(TYPE),debug) -ERL_COMPILE_FLAGS += -Ddebug -W -endif - -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSNOTIFICATION_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/cosNotification-$(VSN) - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- - -MODULES = \ - CosNotification_Common \ - CosNotifyChannelAdmin_ConsumerAdmin_impl \ - CosNotifyChannelAdmin_EventChannelFactory_impl \ - CosNotifyChannelAdmin_EventChannel_impl \ - CosNotifyChannelAdmin_SupplierAdmin_impl \ - CosNotifyFilter_Filter_impl \ - CosNotifyFilter_MappingFilter_impl \ - CosNotifyFilter_FilterFactory_impl \ - PullerConsumer_impl \ - PullerSupplier_impl \ - PusherConsumer_impl \ - PusherSupplier_impl \ - cosNotificationApp \ - cosNotification_Scanner \ - cosNotification_Filter \ - cosNotification_eventDB - -ERL_FILES = $(MODULES:%=%.erl) -HRL_FILES = \ - CosNotification_Definitions.hrl - -YECC_FILES = cosNotification_Grammar.yrl - -GEN_YECC_ERL_FILES = cosNotification_Grammar.erl - -GEN_YECC_HRL_FILES = - -GEN_NOTIFICATION_ERL_FILES = \ - oe_CosNotification.erl \ - CosNotification.erl \ - CosNotification_AdminPropertiesAdmin.erl \ - CosNotification_EventHeader.erl \ - CosNotification_EventType.erl \ - CosNotification_FixedEventHeader.erl \ - CosNotification_NamedPropertyRange.erl \ - CosNotification_Property.erl \ - CosNotification_PropertyError.erl \ - CosNotification_PropertyRange.erl \ - CosNotification_QoSAdmin.erl \ - CosNotification_StructuredEvent.erl \ - CosNotification_UnsupportedAdmin.erl \ - CosNotification_UnsupportedQoS.erl \ - CosNotification_EventBatch.erl \ - CosNotification_EventTypeSeq.erl \ - CosNotification_NamedPropertyRangeSeq.erl \ - CosNotification_PropertyErrorSeq.erl \ - CosNotification_PropertySeq.erl - -GEN_CHANNELADMIN_ERL_FILES = \ - oe_CosNotifyChannelAdmin.erl \ - CosNotifyChannelAdmin_AdminLimit.erl \ - CosNotifyChannelAdmin_AdminLimitExceeded.erl \ - CosNotifyChannelAdmin_AdminNotFound.erl \ - CosNotifyChannelAdmin_ChannelNotFound.erl \ - CosNotifyChannelAdmin_ConnectionAlreadyActive.erl \ - CosNotifyChannelAdmin_ConnectionAlreadyInactive.erl \ - CosNotifyChannelAdmin_ConsumerAdmin.erl \ - CosNotifyChannelAdmin_EventChannel.erl \ - CosNotifyChannelAdmin_EventChannelFactory.erl \ - CosNotifyChannelAdmin_NotConnected.erl \ - CosNotifyChannelAdmin_ProxyConsumer.erl \ - CosNotifyChannelAdmin_ProxyNotFound.erl \ - CosNotifyChannelAdmin_ProxyPullConsumer.erl \ - CosNotifyChannelAdmin_ProxyPullSupplier.erl \ - CosNotifyChannelAdmin_ProxyPushConsumer.erl \ - CosNotifyChannelAdmin_ProxyPushSupplier.erl \ - CosNotifyChannelAdmin_ProxySupplier.erl \ - CosNotifyChannelAdmin_SequenceProxyPullConsumer.erl \ - CosNotifyChannelAdmin_SequenceProxyPullSupplier.erl \ - CosNotifyChannelAdmin_SequenceProxyPushConsumer.erl \ - CosNotifyChannelAdmin_SequenceProxyPushSupplier.erl \ - CosNotifyChannelAdmin_StructuredProxyPullConsumer.erl \ - CosNotifyChannelAdmin_StructuredProxyPullSupplier.erl \ - CosNotifyChannelAdmin_StructuredProxyPushConsumer.erl \ - CosNotifyChannelAdmin_StructuredProxyPushSupplier.erl \ - CosNotifyChannelAdmin_SupplierAdmin.erl \ - CosNotifyChannelAdmin_AdminIDSeq.erl \ - CosNotifyChannelAdmin_ChannelIDSeq.erl \ - CosNotifyChannelAdmin_ProxyIDSeq.erl - -GEN_NOTIFYFILTER_ERL_FILES = \ - oe_CosNotifyFilter.erl \ - CosNotifyFilter_CallbackNotFound.erl \ - CosNotifyFilter_ConstraintExp.erl \ - CosNotifyFilter_ConstraintInfo.erl \ - CosNotifyFilter_ConstraintNotFound.erl \ - CosNotifyFilter_DuplicateConstraintID.erl \ - CosNotifyFilter_Filter.erl \ - CosNotifyFilter_FilterAdmin.erl \ - CosNotifyFilter_FilterFactory.erl \ - CosNotifyFilter_FilterNotFound.erl \ - CosNotifyFilter_InvalidConstraint.erl \ - CosNotifyFilter_InvalidGrammar.erl \ - CosNotifyFilter_InvalidValue.erl \ - CosNotifyFilter_MappingConstraintInfo.erl \ - CosNotifyFilter_MappingConstraintPair.erl \ - CosNotifyFilter_MappingFilter.erl \ - CosNotifyFilter_UnsupportedFilterableData.erl \ - CosNotifyFilter_CallbackIDSeq.erl \ - CosNotifyFilter_ConstraintExpSeq.erl \ - CosNotifyFilter_ConstraintIDSeq.erl \ - CosNotifyFilter_ConstraintInfoSeq.erl \ - CosNotifyFilter_FilterIDSeq.erl \ - CosNotifyFilter_MappingConstraintInfoSeq.erl \ - CosNotifyFilter_MappingConstraintPairSeq.erl - -GEN_NOTIFYCOMM_ERL_FILES = \ - oe_CosNotifyComm.erl \ - CosNotifyComm_InvalidEventType.erl \ - CosNotifyComm_NotifyPublish.erl \ - CosNotifyComm_NotifySubscribe.erl \ - CosNotifyComm_PullConsumer.erl \ - CosNotifyComm_PullSupplier.erl \ - CosNotifyComm_PushConsumer.erl \ - CosNotifyComm_PushSupplier.erl \ - CosNotifyComm_SequencePullConsumer.erl \ - CosNotifyComm_SequencePullSupplier.erl \ - CosNotifyComm_SequencePushConsumer.erl \ - CosNotifyComm_SequencePushSupplier.erl \ - CosNotifyComm_StructuredPullConsumer.erl \ - CosNotifyComm_StructuredPullSupplier.erl \ - CosNotifyComm_StructuredPushConsumer.erl \ - CosNotifyComm_StructuredPushSupplier.erl \ - -GEN_OE_EVENTCOMM_ERL_FILES = \ - oe_cosNotificationAppComm.erl \ - oe_CosNotificationComm_Event.erl - -EXTERNAL_INC_PATH = ../include - -GEN_NOTIFICATION_HRL_FILES = \ - oe_CosNotification.hrl \ - CosNotification.hrl \ - CosNotification_AdminPropertiesAdmin.hrl \ - CosNotification_QoSAdmin.hrl \ - -EXTERNAL_GEN_NOTIFICATION_HRL_FILES = \ - $(GEN_NOTIFICATION_HRL_FILES:%=$(EXTERNAL_INC_PATH)/%) - -GEN_CHANNELADMIN_HRL_FILES = \ - oe_CosNotifyChannelAdmin.hrl \ - CosNotifyChannelAdmin.hrl \ - CosNotifyChannelAdmin_ConsumerAdmin.hrl \ - CosNotifyChannelAdmin_EventChannel.hrl \ - CosNotifyChannelAdmin_EventChannelFactory.hrl \ - CosNotifyChannelAdmin_ProxyConsumer.hrl \ - CosNotifyChannelAdmin_ProxyPullConsumer.hrl \ - CosNotifyChannelAdmin_ProxyPullSupplier.hrl \ - CosNotifyChannelAdmin_ProxyPushConsumer.hrl \ - CosNotifyChannelAdmin_ProxyPushSupplier.hrl \ - CosNotifyChannelAdmin_ProxySupplier.hrl \ - CosNotifyChannelAdmin_SequenceProxyPullConsumer.hrl \ - CosNotifyChannelAdmin_SequenceProxyPullSupplier.hrl \ - CosNotifyChannelAdmin_SequenceProxyPushConsumer.hrl \ - CosNotifyChannelAdmin_SequenceProxyPushSupplier.hrl \ - CosNotifyChannelAdmin_StructuredProxyPullConsumer.hrl \ - CosNotifyChannelAdmin_StructuredProxyPullSupplier.hrl \ - CosNotifyChannelAdmin_StructuredProxyPushConsumer.hrl \ - CosNotifyChannelAdmin_StructuredProxyPushSupplier.hrl \ - CosNotifyChannelAdmin_SupplierAdmin.hrl \ - -EXTERNAL_GEN_CHANNELADMIN_HRL_FILES = \ - $(GEN_CHANNELADMIN_HRL_FILES:%=$(EXTERNAL_INC_PATH)/%) - -GEN_NOTIFYFILTER_HRL_FILES = \ - oe_CosNotifyFilter.hrl \ - CosNotifyFilter.hrl \ - CosNotifyFilter_Filter.hrl \ - CosNotifyFilter_FilterAdmin.hrl \ - CosNotifyFilter_FilterFactory.hrl \ - CosNotifyFilter_MappingFilter.hrl - -EXTERNAL_GEN_NOTIFYFILTER_HRL_FILES = \ - $(GEN_NOTIFYFILTER_HRL_FILES:%=$(EXTERNAL_INC_PATH)/%) - -GEN_NOTIFYCOMM_HRL_FILES = \ - oe_CosNotifyComm.hrl \ - CosNotifyComm.hrl \ - CosNotifyComm_NotifyPublish.hrl \ - CosNotifyComm_NotifySubscribe.hrl \ - CosNotifyComm_PullConsumer.hrl \ - CosNotifyComm_PullSupplier.hrl \ - CosNotifyComm_PushConsumer.hrl \ - CosNotifyComm_PushSupplier.hrl \ - CosNotifyComm_SequencePullConsumer.hrl \ - CosNotifyComm_SequencePullSupplier.hrl \ - CosNotifyComm_SequencePushConsumer.hrl \ - CosNotifyComm_SequencePushSupplier.hrl \ - CosNotifyComm_StructuredPullConsumer.hrl \ - CosNotifyComm_StructuredPullSupplier.hrl \ - CosNotifyComm_StructuredPushConsumer.hrl \ - CosNotifyComm_StructuredPushSupplier.hrl \ - -EXTERNAL_GEN_NOTIFYCOMM_HRL_FILES = \ - $(GEN_NOTIFYCOMM_HRL_FILES:%=$(EXTERNAL_INC_PATH)/%) - -GEN_OE_EVENTCOMM_HRL_FILES = \ - oe_cosNotificationAppComm.hrl \ - oe_CosNotificationComm.hrl \ - oe_CosNotificationComm_Event.hrl - -IDL_GEN_ERL_FILES = \ - $(GEN_NOTIFICATION_ERL_FILES) \ - $(GEN_OE_EVENTCOMM_ERL_FILES) \ - $(GEN_NOTIFYCOMM_ERL_FILES) \ - $(GEN_NOTIFYFILTER_ERL_FILES) \ - $(GEN_CHANNELADMIN_ERL_FILES) - -IDL_GEN_HRL_FILES = \ - $(EXTERNAL_GEN_NOTIFICATION_HRL_FILES) \ - $(GEN_OE_EVENTCOMM_HRL_FILES) \ - $(EXTERNAL_GEN_NOTIFYCOMM_HRL_FILES) \ - $(EXTERNAL_GEN_NOTIFYFILTER_HRL_FILES) \ - $(EXTERNAL_GEN_CHANNELADMIN_HRL_FILES) - -GEN_ERL_FILES = \ - $(IDL_GEN_ERL_FILES) \ - $(GEN_YECC_ERL_FILES) - -GEN_HRL_FILES = \ - $(IDL_GEN_HRL_FILES) \ - $(GEN_YECC_HRL_FILES) - - -GEN_FILES = \ - $(GEN_HRL_FILES) \ - $(GEN_ERL_FILES) - -TARGET_FILES = \ - $(GEN_ERL_FILES:%.erl=$(EBIN)/%.$(EMULATOR)) \ - $(MODULES:%=$(EBIN)/%.$(EMULATOR)) - -IDL_FILES = \ - CosNotification.idl \ - CosNotifyChannelAdmin.idl \ - CosNotifyFilter.idl \ - CosNotifyComm.idl \ - cosNotificationAppComm.idl - -APPUP_FILE = cosNotification.appup -APPUP_SRC = $(APPUP_FILE).src -APPUP_TARGET = $(EBIN)/$(APPUP_FILE) - -APP_FILE = cosNotification.app -APP_SRC = $(APP_FILE).src -APP_TARGET = $(EBIN)/$(APP_FILE) - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/cosNotification/ebin \ - -pa $(ERL_TOP)/lib/ic/ebin\ - -pa $(ERL_TOP)/lib/orber/ebin \ - -pa $(ERL_TOP)/lib/cosEvent/ebin \ - -pa $(ERL_TOP)/lib/cosTime/ebin \ - -I$(ERL_TOP)/lib/cosEvent/src - -# The -pa option is just used temporary until erlc can handle -# includes from other directories than ../include . -ERL_COMPILE_FLAGS += \ - $(ERL_IDL_FLAGS) \ - -pa $(ERL_TOP)/lib/orber/include \ - -pa $(ERL_TOP)/lib/cosNotification/include \ - -pa $(ERL_TOP)/lib/cosEvent/include \ - -pa $(ERL_TOP)/lib/cosTime/include \ - -I$(ERL_TOP)/lib/orber/include \ - -I$(ERL_TOP)/lib/cosNotification/include \ - -I$(ERL_TOP)/lib/cosEvent/include \ - -I$(ERL_TOP)/lib/cosTime/include \ - +'{parse_transform,sys_pre_attributes}' \ - +'{attribute,insert,app_vsn,"cosNotification_$(COSNOTIFICATION_VSN)"}' - -YECC_COMPILE_FLAGS = - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) - -debug: - @${MAKE} TYPE=debug - -cleanb: - rm -f $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) - rm -f errs core *~ - -clean: - rm -f $(TARGET_FILES) $(GEN_FILES) $(APP_TARGET) $(APPUP_TARGET) IDL-GENERATED - rm -f errs core *~ - -$(APP_TARGET): $(APP_SRC) - $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ - -$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ - -docs: - -# ---------------------------------------------------- -# Special Build Targets -# ---------------------------------------------------- -IDL-GENERATED: CosNotification.idl CosNotifyChannelAdmin.idl \ - CosNotifyFilter.idl cosNotificationAppComm.idl CosNotifyComm.idl - $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotification.cfg"}' CosNotification.idl - $(V_at)mv $(GEN_NOTIFICATION_HRL_FILES) $(EXTERNAL_INC_PATH) - $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotifyChannelAdmin.cfg"}' CosNotifyChannelAdmin.idl - $(V_at)mv $(GEN_CHANNELADMIN_HRL_FILES) $(EXTERNAL_INC_PATH) - $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotifyFilter.cfg"}' CosNotifyFilter.idl - $(V_at)mv $(GEN_NOTIFYFILTER_HRL_FILES) $(EXTERNAL_INC_PATH) - $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"cosNotificationComm.cfg"}' cosNotificationAppComm.idl - $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotifyComm.cfg"}' CosNotifyComm.idl - $(V_at)mv $(GEN_NOTIFYCOMM_HRL_FILES) $(EXTERNAL_INC_PATH) - $(V_at)>IDL-GENERATED - -$(IDL_GEN_ERL_FILES) $(IDL_GEN_HRL_FILES): IDL-GENERATED - -$(TARGET_FILES): IDL-GENERATED - -$(GEN_YECC_ERL_FILES) $(GEN_YECC_HRL_FILES): cosNotification_Grammar.yrl - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)/ebin" - $(INSTALL_DATA) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) "$(RELSYSDIR)/ebin" - $(INSTALL_DIR) "$(RELSYSDIR)/src" - $(INSTALL_DATA) $(GEN_FILES) $(IDL_FILES) $(YECC_FILES) "$(RELSYSDIR)/src" - $(INSTALL_DATA) $(ERL_FILES) $(HRL_FILES) $(IDL_FILES) $(YECC_FILES) "$(RELSYSDIR)/src" - $(INSTALL_DIR) "$(RELSYSDIR)/include" - $(INSTALL_DATA) $(GEN_HRL_FILES) "$(RELSYSDIR)/include" - -release_docs_spec: diff --git a/lib/cosNotification/src/PullerConsumer_impl.erl b/lib/cosNotification/src/PullerConsumer_impl.erl deleted file mode 100644 index 52bd13918f..0000000000 --- a/lib/cosNotification/src/PullerConsumer_impl.erl +++ /dev/null @@ -1,774 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : PullerConsumer_impl.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module('PullerConsumer_impl'). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% cosEvent files. --include_lib("cosEvent/include/CosEventChannelAdmin.hrl"). --include_lib("cosEvent/include/CosEventComm.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). --include("CosNotification_Definitions.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%%--------------- External ----------------------------------- -%%----- CosNotifyChannelAdmin::ProxyPullConsumer ------------- --export([connect_any_pull_supplier/4]). - -%%----- CosNotifyChannelAdmin::SequenceProxyPullConsumer ----- --export([connect_sequence_pull_supplier/4]). - -%%----- CosNotifyChannelAdmin::StructuredProxyPullConsumer --- --export([connect_structured_pull_supplier/4]). - -%%----- CosNotifyChannelAdmin::*ProxyPullConsumer ------------ --export([suspend_connection/3, - resume_connection/3]). - -%%----- Inherit from CosNotifyChannelAdmin::ProxyConsumer ---- --export([obtain_subscription_types/4, - validate_event_qos/4]). - -%%----- Inherit from CosNotification::QoSAdmin --------------- --export([get_qos/3, - set_qos/4, - validate_qos/4]). - -%%----- Inherit from CosNotifyComm::NotifyPublish ------------ --export([offer_change/5]). - -%%----- Inherit from CosNotifyFilter::FilterAdmin ------------ --export([add_filter/4, - remove_filter/4, - get_filter/4, - get_all_filters/3, - remove_all_filters/3]). - -%%----- Inherit from CosEventComm::PullConsumer ------------- --export([disconnect_pull_consumer/3]). - -%%----- Inherit from CosNotifyComm::SequencePullConsumer ---- --export([disconnect_sequence_pull_consumer/3]). - -%%----- Inherit from CosNotifyComm::StructuredPullConsumer -- --export([disconnect_structured_pull_consumer/3]). - -%%----- Inherit from CosEventChannelAdmin::ProxyPullConsumer --export([connect_pull_supplier/4]). - - -%% Attributes (external) CosNotifyChannelAdmin::ProxySupplier --export(['_get_MyType'/3, - '_get_MyAdmin'/3]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - -%%--------------- LOCAL DEFINITIONS -------------------------- -%% Data structures --record(state, {myType, - myAdmin, - myAdminPid, - myChannel, - myFilters = [], - myOperator, - idCounter = 0, - client, - qosGlobal, - qosLocal, - suspended = false, - pullTimer, - pullInterval, - publishType = false, - etsR, - eventCounter = 0, - eventDB, - this}). - -%% Data structures constructors --define(get_InitState(_MyT, _MyA, _MyAP, _QS, _LQS, _Ch, _PI, _MyOP, _GT, _GL, _TR), - #state{myType = _MyT, - myAdmin = _MyA, - myAdminPid = _MyAP, - myChannel = _Ch, - myOperator = _MyOP, - qosGlobal = _QS, - qosLocal = _LQS, - pullInterval = _PI, - etsR = ets:new(oe_ets, [set, protected]), - eventDB = cosNotification_eventDB:create_db(_LQS, _GT, _GL, _TR)}). - -%%-------------- Data structures selectors ----------------- -%% Attributes --define(get_MyType(S), S#state.myType). --define(get_MyAdmin(S), S#state.myAdmin). --define(get_MyAdminPid(S), S#state.myAdminPid). --define(get_MyChannel(S), S#state.myChannel). --define(get_MyOperator(S), S#state.myOperator). -%% Client Object --define(get_Client(S), S#state.client). -%% QoS --define(get_GlobalQoS(S), S#state.qosGlobal). --define(get_LocalQoS(S), S#state.qosLocal). --define(get_BothQoS(S), {S#state.qosGlobal, S#state.qosLocal}). -%% Filters --define(get_Filter(S, I), find_obj(lists:keysearch(I, 1, S#state.myFilters))). --define(get_AllFilter(S), S#state.myFilters). --define(get_AllFilterID(S), find_ids(S#state.myFilters)). -%% Admin --define(get_PullInterval(S), S#state.pullInterval). --define(get_PullTimer(S), S#state.pullTimer). --define(get_PacingInterval(S), round(?not_GetPacingInterval((S#state.qosLocal))/10000000)). --define(get_BatchLimit(S), ?not_GetMaximumBatchSize((S#state.qosLocal))). -%% Publish --define(get_AllPublish(S), lists:flatten(ets:match(S#state.etsR, - {'$1',publish}))). --define(get_PublishType(S), S#state.publishType). -%% ID --define(get_IdCounter(S), S#state.idCounter). -%% Event --define(get_Event(S), cosNotification_eventDB:get_event(S#state.eventDB)). --define(get_Events(S,M), cosNotification_eventDB:get_events(S#state.eventDB, M)). --define(get_EventCounter(S), S#state.eventCounter). - -%%-------------- Data structures modifiers ----------------- -%% Client Object --define(set_Client(S,D), S#state{client=D}). --define(del_Client(S), S#state{client=undefined}). --define(set_Suspended(S), S#state{client=true}). --define(set_NotSuspended(S), S#state{client=false}). --define(set_Unconnected(S), S#state{client=undefined}). -%% QoS --define(set_LocalQoS(S,D), S#state{qosLocal=D}). --define(set_GlobalQoS(S,D), S#state{qosGlobal=D}). --define(set_BothQoS(S,GD,LD), S#state{qosGlobal=GD, qosLocal=LD}). -%% Filters --define(add_Filter(S,I,O), S#state{myFilters=[{I,O}|S#state.myFilters]}). --define(del_Filter(S,I), S#state{myFilters= - delete_obj(lists:keydelete(I, 1, S#state.myFilters), - S#state.myFilters)}). --define(del_AllFilter(S), S#state{myFilters=[]}). -%% Admin --define(set_PullInterval(S,V), S#state{pullInterval=V}). --define(set_PullTimer(S,T), S#state{pullTimer=T}). -%% Publish --define(add_Publish(S,E), ets:insert(S#state.etsR, {E, publish})). --define(del_Publish(S,E), ets:delete(S#state.etsR, E)). --define(set_PublishType(S,T), S#state{publishType=T}). -%% ID --define(set_IdCounter(S,V), S#state{idCounter=V}). --define(new_Id(S), 'CosNotification_Common':create_id(S#state.idCounter)). -%% Event --define(add_Event(S,E), cosNotification_eventDB:add_event(S#state.eventDB, E)). --define(update_EventDB(S,Q), S#state{eventDB= - cosNotification_eventDB:update(S#state.eventDB, Q)}). - --define(set_EventCounter(S,V), S#state{eventCounter=V}). --define(add_to_EventCounter(S,V),S#state{eventCounter=S#state.eventCounter+V}). --define(reset_EventCounter(S), S#state{eventCounter=0}). --define(increase_EventCounter(S),S#state{eventCounter=(S#state.eventCounter+1)}). --define(decrease_EventCounter(S),S#state{eventCounter=S#state.eventCounter-1}). --define(add_ToEventCounter(S,A), S#state{eventCounter=(S#state.eventCounter+A)}). --define(sub_FromEventCounter(S,_A), S#state{eventCounter=(S#state.eventCounter-_A)}). --define(set_EventCounterTo(S,V), S#state{eventCounter=V}). - -%%-------------- MISC ---------------------------------------- --define(is_ANY(S), S#state.myType == 'PULL_ANY'). --define(is_STRUCTURED(S), S#state.myType == 'PULL_STRUCTURED'). --define(is_SEQUENCE(S), S#state.myType == 'PULL_SEQUENCE'). --define(is_ANDOP(S), S#state.myOperator == 'AND_OP'). --define(is_UnConnected(S), S#state.client == undefined). --define(is_Connected(S), S#state.client =/= undefined). --define(is_Suspended(S), S#state.suspended == true). --define(is_NotSuspended(S), S#state.suspended == false). --define(is_PersistentConnection(S), - ?not_GetConnectionReliability((S#state.qosLocal)) == ?not_Persistent). --define(is_PersistentEvent(S), - ?not_GetEventReliability((S#state.qosLocal)) == ?not_Persistent). - -%%-----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the gen_server module. -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(Info, State) -> - ?DBG("INFO: ~p~n", [Info]), - case Info of - {'EXIT', Pid, Reason} when ?get_MyAdminPid(State) == Pid-> - ?DBG("PARENT ADMIN: ~p TERMINATED.~n",[Reason]), - {stop, Reason, State}; - {'EXIT', _Pid, _Reason} -> - ?DBG("PROXYPUSHSUPPLIER: ~p TERMINATED.~n",[_Reason]), - {noreply, State}; - pull -> - try_pull_events(State); - _ -> - {noreply, State} - end. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init([MyType, MyAdmin, MyAdminPid, InitQoS, LQS, MyChannel, Options, Operator]) -> - process_flag(trap_exit, true), - Secs = timer:seconds('CosNotification_Common':get_option(pullInterval, - Options, - ?not_DEFAULT_SETTINGS)), - GCTime = 'CosNotification_Common':get_option(gcTime, Options, - ?not_DEFAULT_SETTINGS), - GCLimit = 'CosNotification_Common':get_option(gcLimit, Options, - ?not_DEFAULT_SETTINGS), - TimeRef = 'CosNotification_Common':get_option(timeService, Options, - ?not_DEFAULT_SETTINGS), - timer:start(), - {ok, ?get_InitState(MyType, MyAdmin, MyAdminPid, InitQoS, - LQS, MyChannel, Secs, Operator, GCTime, - GCLimit, TimeRef)}. - -terminate(_Reason, State) when ?is_UnConnected(State) -> - %% We are currently not connected to a client. Hence, no need for sending - %% a disconnect request. - stop_timer(State), - ok; -terminate(_Reason, State) when ?is_ANY(State) -> - stop_timer(State), - 'CosNotification_Common':disconnect('CosEventComm_PullSupplier', - disconnect_pull_supplier, - ?get_Client(State)); -terminate(_Reason, State) when ?is_SEQUENCE(State) -> - stop_timer(State), - 'CosNotification_Common':disconnect('CosNotifyComm_SequencePullSupplier', - disconnect_sequence_pull_supplier, - ?get_Client(State)); -terminate(_Reason, State) when ?is_STRUCTURED(State) -> - stop_timer(State), - 'CosNotification_Common':disconnect('CosNotifyComm_StructuredPullSupplier', - disconnect_structured_pull_supplier, - ?get_Client(State)). - -%%----------------------------------------------------------- -%%----- CosNotifyChannelAdmin_ProxyConsumer attributes ------ -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Attribute: '_get_MyType' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyType'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyType(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_MyAdmin' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyAdmin'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyAdmin(State), State}. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----- CosEventChannelAdmin::ProxyPullConsumer ------------- -%%----------------------------------------------------------% -%% function : connect_pull_supplier -%% Arguments: Client - CosEventComm::PullSupplier -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} | -%% {'EXCEPTION', #'BAD_OPERATION'{}} -%% Both exceptions from CosEventChannelAdmin!!! -%%----------------------------------------------------------- -connect_pull_supplier(OE_THIS, OE_FROM, State, Client) -> - connect_any_pull_supplier(OE_THIS, OE_FROM, State, Client). - -%%----- CosNotifyChannelAdmin::ProxyPullConsumer ------------ -%%----------------------------------------------------------% -%% function : connect_any_pull_supplier -%% Arguments: Client - CosEventComm::PullSupplier -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} | -%% {'EXCEPTION', #'BAD_OPERATION'{}} -%% Both exceptions from CosEventChannelAdmin!!! -%%----------------------------------------------------------- -connect_any_pull_supplier(OE_THIS, _OE_FROM, State, Client) when ?is_ANY(State) -> - 'CosNotification_Common':type_check(Client, 'CosEventComm_PullSupplier'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - NewState = start_timer(State), - {reply, ok, NewState#state{client = Client, this = OE_THIS}} - end; -connect_any_pull_supplier(_, _, _,_) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- CosNotifyChannelAdmin::SequenceProxyPullConsumer ---- -%%----------------------------------------------------------% -%% function : connect_sequence_pull_supplier -%% Arguments: Client - CosNotifyComm::SequencePullSupplier -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} | -%% {'EXCEPTION', #'BAD_OPERATION'{}} -%%----------------------------------------------------------- -connect_sequence_pull_supplier(OE_THIS, _OE_FROM, State, Client) when ?is_SEQUENCE(State) -> - 'CosNotification_Common':type_check(Client, 'CosNotifyComm_SequencePullSupplier'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - NewState = start_timer(State), - {reply, ok, NewState#state{client = Client, this = OE_THIS}} - end; -connect_sequence_pull_supplier(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- CosNotifyChannelAdmin::StructuredProxyPullConsumer -- -%%----------------------------------------------------------% -%% function : connect_structured_pull_supplier -%% Arguments: Client - CosNotifyComm::StructuredPullSupplier -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} | -%% {'EXCEPTION', #'BAD_OPERATION'{}} -%%----------------------------------------------------------- -connect_structured_pull_supplier(OE_THIS, _OE_FROM, State, Client) when ?is_STRUCTURED(State) -> - 'CosNotification_Common':type_check(Client, 'CosNotifyComm_StructuredPullSupplier'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - NewState = start_timer(State), - {reply, ok, NewState#state{client = Client, this = OE_THIS}} - end; -connect_structured_pull_supplier(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- CosNotifyChannelAdmin::*ProxyPullConsumer ----------- -%%----------------------------------------------------------% -%% function : suspend_connection -%% Arguments: -%% Returns : ok | {'EXCEPTION', #'ConnectionAlreadyInactive'{}} | -%% {'EXCEPTION', #'NotConneced'{}} -%%----------------------------------------------------------- -suspend_connection(_OE_THIS, _OE_FROM, State) when ?is_Connected(State) -> - if - ?is_Suspended(State) -> - corba:raise(#'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}); - true -> - stop_timer(State), - {reply, ok, ?set_Suspended(State)} - end; -suspend_connection(_, _, _) -> - corba:raise(#'CosNotifyChannelAdmin_NotConnected'{}). - -%%----------------------------------------------------------% -%% function : resume_connection -%% Arguments: -%% Returns : ok | {'EXCEPTION', #'ConnectionAlreadyActive'{}} | -%% {'EXCEPTION', #'NotConneced'{}} -%%----------------------------------------------------------- -resume_connection(_OE_THIS, _OE_FROM, State) when ?is_Connected(State) -> - if - ?is_NotSuspended(State) -> - corba:raise(#'CosNotifyChannelAdmin_ConnectionAlreadyActive'{}); - true -> - NewState = start_timer(State), - {reply, ok, ?set_NotSuspended(NewState)} - end; -resume_connection(_, _, _) -> - corba:raise(#'CosNotifyChannelAdmin_NotConnected'{}). - -%%----- Inherit from CosNotifyChannelAdmin::ProxyConsumer --- -%%----------------------------------------------------------% -%% function : obtain_subscription_types -%% Arguments: Mode - enum 'ObtainInfoMode' (CosNotifyChannelAdmin) -%% Returns : CosNotification::EventTypeSeq -%%----------------------------------------------------------- -obtain_subscription_types(_OE_THIS, _OE_FROM, State, 'ALL_NOW_UPDATES_OFF') -> - {reply, ?get_AllPublish(State), ?set_PublishType(State, false)}; -obtain_subscription_types(_OE_THIS, _OE_FROM, State, 'ALL_NOW_UPDATES_ON') -> - {reply, ?get_AllPublish(State), ?set_PublishType(State, true)}; -obtain_subscription_types(_OE_THIS, _OE_FROM, State, 'NONE_NOW_UPDATES_OFF') -> - {reply, [], ?set_PublishType(State, false)}; -obtain_subscription_types(_OE_THIS, _OE_FROM, State, 'NONE_NOW_UPDATES_ON') -> - {reply, [], ?set_PublishType(State, true)}; -obtain_subscription_types(_,_,_,What) -> - orber:dbg("[~p] PullerConsumer:obtain_subscription_types(~p);~n" - "Incorrect enumerant", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : validate_event_qos -%% Arguments: RequiredQoS - CosNotification::QoSProperties -%% Returns : ok | {'EXCEPTION', #'UnsupportedQoS'{}} -%% AvilableQoS - CosNotification::NamedPropertyRangeSeq (out) -%%----------------------------------------------------------- -validate_event_qos(_OE_THIS, _OE_FROM, State, RequiredQoS) -> - AvilableQoS = 'CosNotification_Common':validate_event_qos(RequiredQoS, - ?get_LocalQoS(State)), - {reply, {ok, AvilableQoS}, State}. - -%%----- Inherit from CosNotification::QoSAdmin -------------- -%%----------------------------------------------------------% -%% function : get_qos -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -get_qos(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_GlobalQoS(State), State}. - -%%----------------------------------------------------------% -%% function : set_qos -%% Arguments: QoS - CosNotification::QoSProperties, i.e., -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : ok | {'EXCEPTION', CosNotification::UnsupportedQoS} -%%----------------------------------------------------------- -set_qos(_OE_THIS, _OE_FROM, State, QoS) -> - {NewQoS, LQS} = 'CosNotification_Common':set_qos(QoS, ?get_BothQoS(State), - proxy, ?get_MyAdmin(State), - false), - NewState = ?update_EventDB(State, LQS), - {reply, ok, ?set_BothQoS(NewState, NewQoS, LQS)}. - -%%----------------------------------------------------------% -%% function : validate_qos -%% Arguments: Required_qos - CosNotification::QoSProperties -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : {'EXCEPTION', CosNotification::UnsupportedQoS} -%% {ok, CosNotification::NamedPropertyRangeSeq} -%%----------------------------------------------------------- -validate_qos(_OE_THIS, _OE_FROM, State, Required_qos) -> - QoS = 'CosNotification_Common':validate_qos(Required_qos, ?get_BothQoS(State), - proxy, ?get_MyAdmin(State), - false), - {reply, {ok, QoS}, State}. - -%%----- Inherit from CosNotifyComm::NotifyPublish ----------- -%%----------------------------------------------------------% -%% function : offer_change -%% Arguments: Added - #'CosNotification_EventType'{} -%% Removed - #'CosNotification_EventType'{} -%% Returns : ok | -%% {'EXCEPTION', #'CosNotifyComm_InvalidEventType'{}} -%%----------------------------------------------------------- -offer_change(_OE_THIS, _OE_FROM, State, Added, Removed) -> - cosNotification_Filter:validate_types(Added), - cosNotification_Filter:validate_types(Removed), - %% On this "side" we don't really care about which - %% type of events the client will supply. - %% Perhaps, later on, if we want to check this against Filters - %% associated with this object we may change this approach, i.e., if - %% the filter will not allow passing certain event types. But the - %% user should see to that that situation never occurs. It would add - %% extra overhead. Also see PusherSupplier- and PullerSuppler- - %% 'subscription_change'. - update_publish(add, State, Added), - update_publish(remove, State, Removed), - case ?get_PublishType(State) of - true -> - %% Perhaps we should handle exception here?! - %% Probably not. Better to stay "on-line". - catch 'CosNotifyComm_NotifySubscribe': - subscription_change(?get_Client(State), Added, Removed), - ok; - _-> - ok - end, - {reply, ok, State}. - -update_publish(_, _, [])-> - ok; -update_publish(add, State, [H|T]) -> - ?add_Publish(State, H), - update_publish(add, State, T); -update_publish(remove, State, [H|T]) -> - ?del_Publish(State, H), - update_publish(remove, State, T). - -%%----- Inherit from CosNotifyFilter::FilterAdmin ----------- -%%----------------------------------------------------------% -%% function : add_filter -%% Arguments: Filter - CosNotifyFilter::Filter -%% Returns : FilterID - long -%%----------------------------------------------------------- -add_filter(_OE_THIS, _OE_FROM, State, Filter) -> - 'CosNotification_Common':type_check(Filter, 'CosNotifyFilter_Filter'), - FilterID = ?new_Id(State), - NewState = ?set_IdCounter(State, FilterID), - {reply, FilterID, ?add_Filter(NewState, FilterID, Filter)}. - -%%----------------------------------------------------------% -%% function : remove_filter -%% Arguments: FilterID - long -%% Returns : ok -%%----------------------------------------------------------- -remove_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ok, ?del_Filter(State, FilterID)}; -remove_filter(_,_,_,What) -> - orber:dbg("[~p] PullerConsumer:remove_filter(~p); Not an integer", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_filter -%% Arguments: FilterID - long -%% Returns : Filter - CosNotifyFilter::Filter | -%% {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}} -%%----------------------------------------------------------- -get_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ?get_Filter(State, FilterID), State}; -get_filter(_,_,_,What) -> - orber:dbg("[~p] PullerConsumer:get_filter(~p); Not an integer", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_all_filters -%% Arguments: - -%% Returns : Filter - CosNotifyFilter::FilterIDSeq -%%----------------------------------------------------------- -get_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_AllFilterID(State), State}. - -%%----------------------------------------------------------% -%% function : remove_all_filters -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -remove_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ok, ?del_AllFilter(State)}. - -%%----- Inherit from CosEventComm::PullConsumer ------------- -%%----------------------------------------------------------% -%% function : disconnect_pull_consumer -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_pull_consumer(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%----- Inherit from CosNotifyComm::SequencePullConsumer ---- -%%----------------------------------------------------------% -%% function : disconnect_sequence_pull_consumer -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_sequence_pull_consumer(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%----- Inherit from CosNotifyComm::StructuredPullConsumer ---- -%%----------------------------------------------------------% -%% function : disconnect_structured_pull_consumer -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_structured_pull_consumer(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%--------------- LOCAL FUNCTIONS ---------------------------- -find_obj({value, {_, Obj}}) -> Obj; -find_obj(_) -> {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}}. - -find_ids(List) -> find_ids(List, []). -find_ids([], Acc) -> Acc; -find_ids([{I,_}|T], Acc) -> find_ids(T, [I|Acc]); -find_ids(What, _) -> - orber:dbg("[~p] PullerConsumer:find_ids();~n" - "Id corrupt: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). - -%% Delete a single object. -%% The list don not differ, i.e., no filter removed, raise exception. -delete_obj(List,List) -> corba:raise(#'CosNotifyFilter_FilterNotFound'{}); -delete_obj(List,_) -> List. - -%% Start timer which send a message each time we should pull for new events. -start_timer(State) -> - case catch timer:send_interval(?get_PullInterval(State), pull) of - {ok,PullTRef} -> - ?DBG("PULL CONSUMER STARTED PULL TIMER ~p~n", - [?get_PullInterval(State)]), - ?set_PullTimer(State, PullTRef); - What -> - orber:dbg("[~p] PullerConsumer:start_timer();~n" - "Unable to invoke timer:send_interval/2: ~p", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. -stop_timer(State) -> - ?DBG("PULL CONSUMER STOPPED TIMER~n",[]), - timer:cancel(?get_PullTimer(State)). - -%% Try pull event(s); which method is determined by which type this proxy is. -try_pull_events(State) when ?is_ANY(State) -> - case catch 'CosEventComm_PullSupplier':try_pull(?get_Client(State)) of - {_,false} -> - {noreply, State}; - {Event, true} -> - case ?not_isConvertedStructured(Event) of - true -> - forward(seq, State, - cosNotification_eventDB:filter_events([any:get_value(Event)], - ?get_AllFilter(State))); - _ -> - forward(any, State, - cosNotification_eventDB:filter_events([Event], - ?get_AllFilter(State))) - end; - _-> - {noreply, State} - end; -try_pull_events(State) when ?is_SEQUENCE(State) -> - case catch 'CosNotifyComm_SequencePullSupplier': - try_pull_structured_events(?get_Client(State), ?get_BatchLimit(State)) of - {_,false} -> - {noreply, State}; - {EventSeq, true} -> - %% We cannot convert parts of the sequence to any, event though they - %% are converted from any to structured. Would be 'impossible' to send. - forward(seq, State, - cosNotification_eventDB:filter_events(EventSeq, - ?get_AllFilter(State))); - _-> - {noreply, State} - end; -try_pull_events(State) when ?is_STRUCTURED(State) -> - case catch 'CosNotifyComm_StructuredPullSupplier': - try_pull_structured_event(?get_Client(State)) of - {_,false} -> - {noreply, State}; - {Event, true} when ?not_isConvertedAny(Event) -> - forward(any, State, - cosNotification_eventDB:filter_events([Event#'CosNotification_StructuredEvent'.remainder_of_body], - ?get_AllFilter(State))); - {Event, true} -> - forward(seq, State, - cosNotification_eventDB:filter_events([Event], - ?get_AllFilter(State))); - _-> - {noreply, State} - end. - - - -%% Forward events -forward(_, State, {[], _}) when ?is_ANDOP(State) -> - %% Did not pass filtering. Since AND no need to pass on. - {noreply, State}; -forward(Type, State, {[], Failed}) -> - %% Did not pass filtering, but since OR it may pass Admin filters, hence, pass - %% on to Admin - forward(Type, State, Failed, ?get_MyAdmin(State), 'MATCH'); -forward(Type, State, {Passed, _}) when ?is_ANDOP(State) -> - %% Did pass filtering, but since AND we must pass it to Admin to check against - %% its Filters. Just ignore the ones that failed. - forward(Type, State, Passed, ?get_MyAdmin(State), 'MATCH'); -forward(Type, State, {Passed, []}) -> - %% Did pass filtering, and since OR we can pass it to the Channel directly. - forward(Type, State, Passed, ?get_MyChannel(State), 'MATCHED'); -forward(Type, State, {Passed, Failed}) -> - %% Some passed filtering, and since OR we can pass the ones that passed directly - %% to the channel and the other ones via the admin. - forward(Type, State, Passed, ?get_MyChannel(State), 'MATCHED'), - forward(Type, State, Failed, ?get_MyAdmin(State), 'MATCH'). - -forward(any, State, [Event], SendTo, Status) -> - case catch oe_CosNotificationComm_Event:callAny(SendTo, Event, Status) of - ok -> - ?DBG("PROXY FORWARD ANY: ~p~n",[Event]), - {noreply, State}; - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') orelse - is_record(E, 'NO_PERMISSION') orelse - is_record(E, 'CosEventComm_Disconnected') -> - orber:dbg("[~p] PullerConsumer:forward();~n" - "Admin/Channel no longer exists; terminating and dropping: ~p", - [?LINE, Event], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, {'EXCEPTION', E}}]), - {stop, normal, State}; - R when ?is_PersistentConnection(State) -> - orber:dbg("[~p] PullerConsumer:forward();~n" - "Admin/Channel respond incorrect: ~p~n" - "Dropping: ~p", [?LINE, R, Event], ?DEBUG_LEVEL), - {noreply, State}; - R -> - orber:dbg("[~p] PullerConsumer:forward();~n" - "Admin/Channel respond incorrect: ~p~n" - "Terminating and dropping: ~p", - [?LINE, R, Event], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, R}]), - {stop, normal, State} - end; -forward(seq, State, Event, SendTo, Status) -> - case catch oe_CosNotificationComm_Event:callSeq(SendTo, Event, Status) of - ok -> - ?DBG("PROXY FORWARD SEQUENCE: ~p~n",[Event]), - {noreply, State}; - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') orelse - is_record(E, 'NO_PERMISSION') orelse - is_record(E, 'CosEventComm_Disconnected') -> - orber:dbg("[~p] PullerConsumer:forward();~n" - "Admin/Channel no longer exists; terminating and dropping: ~p", - [?LINE, Event], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, {'EXCEPTION', E}}]), - {stop, normal, State}; - R when ?is_PersistentConnection(State) -> - orber:dbg("[~p] PullerConsumer:forward();~n" - "Admin/Channel respond incorrect: ~p~n" - "Dropping: ~p", [?LINE, R, Event], ?DEBUG_LEVEL), - {noreply, State}; - R -> - orber:dbg("[~p] PullerConsumer:forward();~n" - "Admin/Channel respond incorrect: ~p~n" - "Terminating and dropping: ~p", - [?LINE, R, Event], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, R}]), - {stop, normal, State} - end. - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/PullerSupplier_impl.erl b/lib/cosNotification/src/PullerSupplier_impl.erl deleted file mode 100644 index e1956cff28..0000000000 --- a/lib/cosNotification/src/PullerSupplier_impl.erl +++ /dev/null @@ -1,915 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : PullerSupplier_impl.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module('PullerSupplier_impl'). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% cosEvent files. --include_lib("cosEvent/include/CosEventChannelAdmin.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). - --include("CosNotification_Definitions.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%%--------------- External ----------------------------------- -%%----- CosNotifyChannelAdmin::ProxyPullSupplier ------------- --export([connect_any_pull_consumer/4]). - -%%----- CosNotifyChannelAdmin::SequenceProxyPullSupplier ----- --export([connect_sequence_pull_consumer/4]). - -%%----- CosNotifyChannelAdmin::StructuredProxyPullSupplier --- --export([connect_structured_pull_consumer/4]). - -%%----- Inherit from CosNotifyChannelAdmin::ProxySupplier ---- --export([obtain_offered_types/4, - validate_event_qos/4]). - -%%----- Inherit from CosNotification::QoSAdmin --------------- --export([get_qos/3, - set_qos/4, - validate_qos/4]). - -%%----- Inherit from CosNotifyComm::NotifySubscribe ---------- --export([subscription_change/5]). - -%%----- Inherit from CosNotifyFilter::FilterAdmin ------------ --export([add_filter/4, - remove_filter/4, - get_filter/4, - get_all_filters/3, - remove_all_filters/3]). - -%%----- Inherit from CosEventComm::PullSupplier ------------- --export([pull/3, - try_pull/3, - disconnect_pull_supplier/3]). - -%%----- Inherit from CosNotifyComm::SequencePullSupplier -- --export([pull_structured_events/4, - try_pull_structured_events/4, - disconnect_sequence_pull_supplier/3]). - -%%----- Inherit from CosNotifyComm::StructuredPullSupplier -- --export([pull_structured_event/3, - try_pull_structured_event/3, - disconnect_structured_pull_supplier/3]). - -%%----- Inherit from CosEventChannelAdmin::ProxyPullSupplier --export([connect_pull_consumer/4]). - -%% Attributes (external) CosNotifyChannelAdmin::ProxySupplier --export(['_get_MyType'/3, - '_get_MyAdmin'/3, - '_get_priority_filter'/3, - '_set_priority_filter'/4, - '_get_lifetime_filter'/3, - '_set_lifetime_filter'/4]). - -%%--------------- Internal ----------------------------------- -%%----- Inherit from cosNotificationComm -------------------- --export([callAny/5, - callSeq/5]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - -%%--------------- LOCAL DEFINITIONS -------------------------- -%% Data structures --record(state, {myType, - myAdmin, - myAdminPid, - myChannel, - myFilters = [], - myOperator, - idCounter = 0, - prioFil, - lifetFil, - client, - qosGlobal, - qosLocal, - pacingTimer, - respondTo, - subscribeType = false, - subscribeData = true, - etsR, - eventDB}). - -%% Data structures constructors --define(get_InitState(_MyT, _MyA, _MyAP, _QS, _LQS, _Ch, _MyOp, _GT, _GL, _TR), - #state{myType = _MyT, - myAdmin = _MyA, - myAdminPid= _MyAP, - myChannel = _Ch, - myOperator= _MyOp, - qosGlobal = _QS, - qosLocal = _LQS, - etsR = ets:new(oe_ets, [set, protected]), - eventDB = cosNotification_eventDB:create_db(_LQS, _GT, _GL, _TR)}). - - -%% Data structures selectors -%% Attributes --define(get_MyType(S), S#state.myType). --define(get_MyAdmin(S), S#state.myAdmin). --define(get_MyAdminPid(S), S#state.myAdmin). --define(get_MyChannel(S), S#state.myChannel). --define(get_MyOperator(S), S#state.myOperator). --define(get_PrioFil(S), S#state.prioFil). --define(get_LifeTFil(S), S#state.lifetFil). -%% Client Object --define(get_Client(S), S#state.client). -%% QoS --define(get_GlobalQoS(S), S#state.qosGlobal). --define(get_LocalQoS(S), S#state.qosLocal). --define(get_BothQoS(S), {S#state.qosGlobal, S#state.qosLocal}). -%% Filters --define(get_Filter(S, I), find_obj(lists:keysearch(I, 1, S#state.myFilters))). --define(get_AllFilter(S), S#state.myFilters). --define(get_AllFilterID(S), find_ids(S#state.myFilters)). -%% Event --define(get_Event(S), cosNotification_eventDB:get_event(S#state.eventDB)). --define(get_Events(S,M), cosNotification_eventDB:get_events(S#state.eventDB, M)). --define(get_RespondTo(S), S#state.respondTo). -%% Amin --define(get_PacingTimer(S), S#state.pacingTimer). --define(get_PacingInterval(S), round(?not_GetPacingInterval((S#state.qosLocal))/10000000)). --define(get_BatchLimit(S), ?not_GetMaximumBatchSize((S#state.qosLocal))). -%% Subscribe --define(get_AllSubscribe(S), lists:flatten(ets:match(S#state.etsR, - {'$1',subscribe}))). --define(get_SubscribeType(S), S#state.subscribeType). --define(get_SubscribeData(S), S#state.subscribeData). -%% ID --define(get_IdCounter(S), S#state.idCounter). --define(get_SubscribeDB(S), S#state.etsR). - -%% Data structures modifiers -%% Attributes --define(set_PrioFil(S,D), S#state{prioFil=D}). --define(set_LifeTFil(S,D), S#state{lifetFil=D}). -%% Client Object --define(set_Client(S,D), S#state{client=D}). --define(del_Client(S), S#state{client=undefined}). -%% QoS --define(set_LocalQoS(S,D), S#state{qosLocal=D}). --define(set_GlobalQoS(S,D), S#state{qosGlobal=D}). --define(set_BothQoS(S,GD,LD), S#state{qosGlobal=GD, qosLocal=LD}). --define(update_EventDB(S,Q), S#state{eventDB= - cosNotification_eventDB:update(S#state.eventDB, Q)}). -%% Filters --define(add_Filter(S,I,O), S#state{myFilters=[{I,O}|S#state.myFilters]}). --define(del_Filter(S,I), S#state{myFilters= - delete_obj(lists:keydelete(I, 1, S#state.myFilters), - S#state.myFilters)}). --define(del_AllFilter(S), S#state{myFilters=[]}). --define(set_Unconnected(S), S#state{client=undefined}). --define(reset_RespondTo(S), S#state{respondTo=undefined}). --define(set_RespondTo(S,F), S#state{respondTo=F}). -%% Event --define(add_Event(S,E), catch cosNotification_eventDB: - add_event(S#state.eventDB, E, S#state.lifetFil, S#state.prioFil)). --define(addAndGet_Event(S,E), catch cosNotification_eventDB: - add_and_get_event(S#state.eventDB, E, S#state.lifetFil, S#state.prioFil)). -%% Admin --define(set_PacingTimer(S,T), S#state{pacingTimer=T}). -%% Subscribe --define(add_Subscribe(S,E), ets:insert(S#state.etsR, {E, subscribe})). --define(del_Subscribe(S,E), ets:delete(S#state.etsR, E)). --define(set_SubscribeType(S,T), S#state{subscribeType=T}). --define(set_SubscribeData(S,D), S#state{subscribeData=D}). -%% ID --define(set_IdCounter(S,V), S#state{idCounter=V}). --define(new_Id(S), 'CosNotification_Common':create_id(S#state.idCounter)). - -%% MISC --define(is_ANY(S), S#state.myType == 'PULL_ANY'). --define(is_STRUCTURED(S), S#state.myType == 'PULL_STRUCTURED'). --define(is_SEQUENCE(S), S#state.myType == 'PULL_SEQUENCE'). --define(is_ANDOP(S), S#state.myOperator == 'AND_OP'). --define(is_UnConnected(S), S#state.client == undefined). --define(is_Connected(S), S#state.client =/= undefined). --define(is_Waiting(S), S#state.respondTo =/= undefined). --define(is_SubscribedFor(S,K), ets:lookup(S#state.etsR, K) =/= []). --define(is_BatchLimitReached(S,M), cosNotification_eventDB: - status(S#state.eventDB, {batchLimit, - ?not_GetMaximumBatchSize((S#state.qosLocal)), M})). - -%%----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the gen_server module. -%%----------------------------------------------------------- - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(Info, State) -> - ?DBG("INFO: ~p~n", [Info]), - case Info of - {'EXIT', Pid, Reason} when ?get_MyAdminPid(State)==Pid-> - ?DBG("PARENT ADMIN: ~p TERMINATED.~n",[Reason]), - {stop, Reason, State}; - {'EXIT', _Pid, _Reason} -> - ?DBG("PROXYPUSHSUPPLIER: ~p TERMINATED.~n",[_Reason]), - {noreply, State}; - {pacing, TS} when ?is_Waiting(State) -> - case ?get_PacingTimer(State) of - {_, TS} -> - ?DBG("PULL SUPPLIER PACING LIMIT REACHED~n",[]), - {RespondTo, Max} = ?get_RespondTo(State), - {EventSeq, _} = ?get_Events(State, Max), - corba:reply(RespondTo, EventSeq), - {noreply, ?reset_RespondTo(State)}; - _ -> - %% Must have been an old timer event, i.e., we reached the - %% Batch Limit before Pace limit and we were not able - %% to stop the timer before it triggered an event. - ?DBG("PULL SUPPLIER OLD PACING LIMIT REACHED~n",[]), - {noreply, State} - end; - {pacing, _} -> - ?DBG("PULL SUPPLIER PACING LIMIT REACHED BUT NO CLIENT; IMPOSSIBLE!!!~n",[]), - {noreply, State}; - _ -> - {noreply, State} - end. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init([MyType, MyAdmin, MyAdminPid, InitQoS, LQS, MyChannel, Options, Operator]) -> - process_flag(trap_exit, true), - GCTime = 'CosNotification_Common':get_option(gcTime, Options, - ?not_DEFAULT_SETTINGS), - GCLimit = 'CosNotification_Common':get_option(gcLimit, Options, - ?not_DEFAULT_SETTINGS), - TimeRef = 'CosNotification_Common':get_option(timeService, Options, - ?not_DEFAULT_SETTINGS), - {ok, ?get_InitState(MyType, MyAdmin, MyAdminPid, InitQoS, LQS, MyChannel, - Operator, GCTime, GCLimit, TimeRef)}. - -terminate(_Reason, State) when ?is_UnConnected(State) -> - ok; -terminate(_Reason, State) -> - Client = ?get_Client(State), - case catch corba_object:is_nil(Client) of - false when ?is_ANY(State) -> - 'CosNotification_Common':disconnect('CosEventComm_PullConsumer', - disconnect_pull_consumer, - Client); - false when ?is_SEQUENCE(State) -> - 'CosNotification_Common':disconnect('CosNotifyComm_SequencePullConsumer', - disconnect_sequence_pull_consumer, - Client); - false when ?is_STRUCTURED(State) -> - 'CosNotification_Common':disconnect('CosNotifyComm_StructuredPullConsumer', - disconnect_structured_pull_consumer, - Client); - _ -> - ok - end. - -%%----------------------------------------------------------- -%%----- CosNotifyChannelAdmin_ProxySupplier attributes ------ -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Attribute: '_get_MyType' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyType'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyType(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_MyAdmin' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyAdmin'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyAdmin(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_*et_priority_filter' -%% Type : read/write -%% Returns : -%%----------------------------------------------------------- -'_get_priority_filter'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_PrioFil(State), State}. -'_set_priority_filter'(_OE_THIS, _OE_FROM, State, PrioF) -> - {reply, ok, ?set_PrioFil(State, PrioF)}. - - -%%----------------------------------------------------------% -%% Attribute: '_*et_lifetime_filter' -%% Type : read/write -%% Returns : -%%----------------------------------------------------------- -'_get_lifetime_filter'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_LifeTFil(State), State}. -'_set_lifetime_filter'(_OE_THIS, _OE_FROM, State, LifeTF) -> - {reply, ok, ?set_LifeTFil(State, LifeTF)}. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----- CosEventChannelAdmin::ProxyPullSupplier ------------- -%%----------------------------------------------------------% -%% function : connect_pull_consumer -%% Arguments: Client - CosEventComm::PullConsumer -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} | -%% {'EXCEPTION', #'BAD_OPERATION'{}} -%% Both exceptions from CosEventChannelAdmin!!! -%%----------------------------------------------------------- -connect_pull_consumer(OE_THIS, OE_FROM, State, Client) -> - connect_any_pull_consumer(OE_THIS, OE_FROM, State, Client). - -%%----- CosNotifyChannelAdmin::ProxyPullSupplier ------------ -%%----------------------------------------------------------% -%% function : connect_any_pull_consumer -%% Arguments: Client - CosEventComm::PullConsumer -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} | -%% {'EXCEPTION', #'BAD_OPERATION'{}} -%% Both exceptions from CosEventChannelAdmin!!! -%%----------------------------------------------------------- -connect_any_pull_consumer(_OE_THIS, _OE_FROM, State, Client) when ?is_ANY(State) -> - ?not_TypeCheck(Client, 'CosEventComm_PullConsumer'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - {reply, ok, ?set_Client(State, Client)} - end; -connect_any_pull_consumer(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- CosNotifyChannelAdmin::SequenceProxyPullSupplier ---- -%%----------------------------------------------------------% -%% function : connect_sequence_pull_consumer -%% Arguments: Client - CosNotifyComm::SequencePullConsumer -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} | -%% {'EXCEPTION', #'BAD_OPERATION'{}} -%%----------------------------------------------------------- -connect_sequence_pull_consumer(_OE_THIS, _OE_FROM, State, Client) when ?is_SEQUENCE(State) -> - ?not_TypeCheck(Client, 'CosNotifyComm_SequencePullConsumer'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - {reply, ok, ?set_Client(State, Client)} - end; -connect_sequence_pull_consumer(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- CosNotifyChannelAdmin::StructuredProxyPullSupplier -- -%%----------------------------------------------------------% -%% function : connect_structured_pull_consumer -%% Arguments: Client - CosNotifyComm::StructuredPullConsumer -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} | -%% {'EXCEPTION', #'BAD_OPERATION'{}} -%%----------------------------------------------------------- -connect_structured_pull_consumer(_OE_THIS, _OE_FROM, State, Client) when ?is_STRUCTURED(State) -> - ?not_TypeCheck(Client, 'CosNotifyComm_StructuredPullConsumer'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - {reply, ok, ?set_Client(State, Client)} - end; -connect_structured_pull_consumer(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- Inherit from CosNotifyChannelAdmin::ProxySupplier --- -%%----------------------------------------------------------% -%% function : obtain_offered_types -%% Arguments: Mode - enum 'ObtainInfoMode' (CosNotifyChannelAdmin) -%% Returns : CosNotification::EventTypeSeq -%%----------------------------------------------------------- -obtain_offered_types(_OE_THIS, _OE_FROM, State, 'ALL_NOW_UPDATES_OFF') -> - {reply, ?get_AllSubscribe(State), ?set_SubscribeType(State, false)}; -obtain_offered_types(_OE_THIS, _OE_FROM, State, 'ALL_NOW_UPDATES_ON') -> - {reply, ?get_AllSubscribe(State), ?set_SubscribeType(State, true)}; -obtain_offered_types(_OE_THIS, _OE_FROM, State, 'NONE_NOW_UPDATES_OFF') -> - {reply, [], ?set_SubscribeType(State, false)}; -obtain_offered_types(_OE_THIS, _OE_FROM, State, 'NONE_NOW_UPDATES_ON') -> - {reply, [], ?set_SubscribeType(State, true)}; -obtain_offered_types(_,_,_,What) -> - orber:dbg("[~p] PullerSupplier:obtain_offered_types(~p);~n" - "Incorrect enumerant", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : validate_event_qos -%% Arguments: RequiredQoS - CosNotification::QoSProperties -%% Returns : ok | {'EXCEPTION', #'UnsupportedQoS'{}} -%% AvilableQoS - CosNotification::NamedPropertyRangeSeq (out) -%%----------------------------------------------------------- -validate_event_qos(_OE_THIS, _OE_FROM, State, RequiredQoS) -> - AvilableQoS = 'CosNotification_Common':validate_event_qos(RequiredQoS, - ?get_LocalQoS(State)), - {reply, {ok, AvilableQoS}, State}. - -%%----- Inherit from CosNotification::QoSAdmin -------------- -%%----------------------------------------------------------% -%% function : get_qos -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -get_qos(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_GlobalQoS(State), State}. - -%%----------------------------------------------------------% -%% function : set_qos -%% Arguments: QoS - CosNotification::QoSProperties, i.e., -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : ok | {'EXCEPTION', CosNotification::UnsupportedQoS} -%%----------------------------------------------------------- -set_qos(_OE_THIS, _OE_FROM, State, QoS) -> - {NewQoS, LQS} = 'CosNotification_Common':set_qos(QoS, ?get_BothQoS(State), - proxy, ?get_MyAdmin(State), - false), - NewState = ?update_EventDB(State, LQS), - {reply, ok, ?set_BothQoS(NewState, NewQoS, LQS)}. - -%%----------------------------------------------------------% -%% function : validate_qos -%% Arguments: Required_qos - CosNotification::QoSProperties -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : {'EXCEPTION', CosNotification::UnsupportedQoS} -%% {ok, CosNotification::NamedPropertyRangeSeq} -%%----------------------------------------------------------- -validate_qos(_OE_THIS, _OE_FROM, State, Required_qos) -> - QoS = 'CosNotification_Common':validate_qos(Required_qos, ?get_BothQoS(State), - proxy, ?get_MyAdmin(State), - false), - {reply, {ok, QoS}, State}. - -%%----- Inherit from CosNotifyComm::NotifySubscribe --------- -%%----------------------------------------------------------% -%% function : subscription_change -%% Arguments: Added - Removed - CosNotification::EventTypeSeq -%% Returns : ok -%%----------------------------------------------------------- -subscription_change(_OE_THIS, _OE_FROM, State, Added, Removed) -> - cosNotification_Filter:validate_types(Added), - cosNotification_Filter:validate_types(Removed), - %% On this "side", we care about which type of events the client - %% will require, since the client (or an agent) clearly stated - %% that it's only interested in these types of events. - %% Also see PusherConsumer- and PullerConsumer-'offer_change'. - update_subscribe(remove, State, Removed), - CurrentSub = ?get_AllSubscribe(State), - NewState = - case cosNotification_Filter:check_types(Added++CurrentSub) of - true -> - %% Types supplied does in some way cause all events to be valid. - %% Smart? Would have been better to not supply any at all. - ?set_SubscribeData(State, true); - {ok, Which, WC} -> - ?set_SubscribeData(State, {Which, WC}) - end, - update_subscribe(add, NewState, Added), - case ?get_SubscribeType(NewState) of - true -> - %% Perhaps we should handle exception here?! - %% Probably not. Better to stay "on-line". - catch 'CosNotifyComm_NotifyPublish': - offer_change(?get_Client(NewState), Added, Removed), - ok; - _-> - ok - end, - {reply, ok, NewState}. - -update_subscribe(_, _, [])-> - ok; -update_subscribe(add, State, [H|T]) -> - ?add_Subscribe(State, H), - update_subscribe(add, State, T); -update_subscribe(remove, State, [H|T]) -> - ?del_Subscribe(State, H), - update_subscribe(remove, State, T). - -%%----- Inherit from CosNotifyFilter::FilterAdmin ----------- -%%----------------------------------------------------------% -%% function : add_filter -%% Arguments: Filter - CosNotifyFilter::Filter -%% Returns : FilterID - long -%%----------------------------------------------------------- -add_filter(_OE_THIS, _OE_FROM, State, Filter) -> - 'CosNotification_Common':type_check(Filter, 'CosNotifyFilter_Filter'), - FilterID = ?new_Id(State), - NewState = ?set_IdCounter(State, FilterID), - {reply, FilterID, ?add_Filter(NewState, FilterID, Filter)}. - -%%----------------------------------------------------------% -%% function : remove_filter -%% Arguments: FilterID - long -%% Returns : ok -%%----------------------------------------------------------- -remove_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ok, ?del_Filter(State, FilterID)}; -remove_filter(_,_,_,What) -> - orber:dbg("[~p] PullerSupplier:remove_filter(~p); Not an integer", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_filter -%% Arguments: FilterID - long -%% Returns : Filter - CosNotifyFilter::Filter | -%% {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}} -%%----------------------------------------------------------- -get_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ?get_Filter(State, FilterID), State}; -get_filter(_,_,_,What) -> - orber:dbg("[~p] PullerSupplier:get_filter(~p); Not an integer", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_all_filters -%% Arguments: - -%% Returns : Filter - CosNotifyFilter::FilterIDSeq -%%----------------------------------------------------------- -get_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_AllFilterID(State), State}. - -%%----------------------------------------------------------% -%% function : remove_all_filters -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -remove_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ok, ?del_AllFilter(State)}. - -%%----- Inherit from CosEventComm::PullSupplier ------------- -%%----------------------------------------------------------% -%% function : disconnect_pull_supplier -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_pull_supplier(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%----------------------------------------------------------% -%% function : pull -%% Arguments: - -%% Returns : any - CORBA::ANY -%%----------------------------------------------------------- -pull(_OE_THIS, OE_FROM, State) when ?is_ANY(State) -> - case ?get_Event(State) of - {[], _} -> - {noreply, ?set_RespondTo(State, OE_FROM)}; - {Event,_} -> - {reply, Event, State} - end; -pull(_,_,_) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : try_pull -%% Arguments: - -%% Returns : any - CORBA::ANY -%% HasEvent - boolean (out-type) -%%----------------------------------------------------------- -try_pull(_OE_THIS, _OE_FROM, State) when ?is_ANY(State) -> - case ?get_Event(State) of - {[], _} -> - {reply, {any:create(orber_tc:null(), null), false}, State}; - {Event, Bool} -> - {reply, {Event, Bool}, State} - end; -try_pull(_,_,_) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- Inherit from CosNotifyComm::SequencePullSupplier ---- -%%----------------------------------------------------------% -%% function : disconnect_sequence_pull_supplier -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_sequence_pull_supplier(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%----------------------------------------------------------% -%% function : pull_structured_events -%% Arguments: Max - long() -%% Returns : [StructuredEvent, ..] -%%----------------------------------------------------------- -pull_structured_events(_OE_THIS, OE_FROM, State, Max) when ?is_SEQUENCE(State) -> - case ?is_BatchLimitReached(State, Max) of - true -> - %% This test is not fool-proof; if Events have been stored - %% using StartTime they will still be there but we cannot - %% deliver them anyway. To solve this "problem" would cost! - %% Hence, since it works fine otherwise it will do. - case ?get_Events(State, Max) of - {[], false} -> - NewState = start_timer(State), - {noreply, ?set_RespondTo(NewState, {OE_FROM, Max})}; - {Event,_} -> - {reply, Event, State} - end; - _-> - NewState = start_timer(State), - {noreply, ?set_RespondTo(NewState, {OE_FROM, Max})} - end; -pull_structured_events(_,_,_,_) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : try_pull_structured_events -%% Arguments: Max - long() -%% Returns : [StructuredEvent, ..] -%% HasEvent - Boolean() -%%----------------------------------------------------------- -try_pull_structured_events(_OE_THIS, _OE_FROM, State, Max) when ?is_SEQUENCE(State) -> - {reply, ?get_Events(State, Max), State}; -try_pull_structured_events(_,_,_,_) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- Inherit from CosNotifyComm::StructuredPullSupplier -- -%%----------------------------------------------------------% -%% function : disconnect_structured_pull_supplier -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_structured_pull_supplier(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%----------------------------------------------------------% -%% function : pull_structured_event -%% Arguments: - -%% Returns : -%%----------------------------------------------------------- -pull_structured_event(_OE_THIS, OE_FROM, State) when ?is_STRUCTURED(State) -> - case ?get_Event(State) of - {[], _} -> - {noreply, ?set_RespondTo(State, OE_FROM)}; - {Event,_} -> - {reply, Event, State} - end; -pull_structured_event(_,_,_) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : try_pull_structured_event -%% Arguments: - -%% Returns : -%%----------------------------------------------------------- -try_pull_structured_event(_OE_THIS, _OE_FROM, State) when ?is_STRUCTURED(State) -> - case ?get_Event(State) of - {[], _} -> - {reply, - {?not_CreateSE("","","",[],[],any:create(orber_tc:null(), null)), false}, - State}; - {Event, Bool} -> - {reply, {Event, Bool}, State} - end; -try_pull_structured_event(_,_,_) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - - -%%--------------- LOCAL FUNCTIONS ---------------------------- -find_obj({value, {_, Obj}}) -> Obj; -find_obj(_) -> {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}}. - -find_ids(List) -> find_ids(List, []). -find_ids([], Acc) -> Acc; -find_ids([{I,_}|T], Acc) -> find_ids(T, [I|Acc]); -find_ids(_, _) -> corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). - -%% Delete a single object. -%% The list do not differ, i.e., no filter removed, raise exception. -delete_obj(List,List) -> corba:raise(#'CosNotifyFilter_FilterNotFound'{}); -delete_obj(List,_) -> List. - - -%%----------------------------------------------------------- -%% function : callSeq -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -callSeq(_OE_THIS, OE_FROM, State, EventsIn, Status) -> - %% We should do something here, i.e., see what QoS this Object offers and - %% act accordingly. - corba:reply(OE_FROM, ok), - case cosNotification_eventDB:validate_event(?get_SubscribeData(State), EventsIn, - ?get_AllFilter(State), - ?get_SubscribeDB(State), - Status) of - {[], _} -> - ?DBG("PROXY NOSUBSCRIPTION SEQUENCE/STRUCTURED: ~p~n",[EventsIn]), - {noreply, State}; - %% Just one event and we got a client waiting => there is no need to store - %% the event, just transform it and pass it on. - {[Event], _} when ?is_ANY(State), ?is_Waiting(State) -> - ?DBG("PROXY RECEIVED SEQUENCE[1]==>ANY: ~p~n",[Event]), - AnyEvent = any:create('CosNotification_StructuredEvent':tc(),Event), - case ?addAndGet_Event(State, AnyEvent) of - {[], _} -> - ?DBG("PROXY RECEIVED UNDELIVERABLE SEQUENCE[1]: ~p~n", - [Event]), - %% Cannot deliver the event at the moment; perhaps Starttime - %% set or Deadline passed. - {noreply, State}; - {PossiblyOtherEvent, _} -> - ?DBG("PROXY RECEIVED SEQUENCE[1] ~p; DELIVER: ~p~n", - [Event, PossiblyOtherEvent]), - corba:reply(?get_RespondTo(State), PossiblyOtherEvent), - {noreply, ?reset_RespondTo(State)} - end; - {[Event],_} when ?is_STRUCTURED(State), ?is_Waiting(State) -> - case ?addAndGet_Event(State, Event) of - {[], _} -> - ?DBG("PROXY RECEIVED UNDELIVERABLE SEQUENCE[1]: ~p~n", - [Event]), - %% Cannot deliver the event at the moment; perhaps Starttime - %% set or Deadline passed. - {noreply, State}; - {PossiblyOtherEvent, _} -> - ?DBG("PROXY RECEIVED SEQUENCE[1] ~p; DELIVER: ~p~n", - [Event, PossiblyOtherEvent]), - corba:reply(?get_RespondTo(State), PossiblyOtherEvent), - {noreply, ?reset_RespondTo(State)} - end; - %% A sequence of events => store them and extract the first (according to QoS) - %% event and forward it. - {Events,_} when ?is_ANY(State), ?is_Waiting(State) -> - ?DBG("PROXY RECEIVED SEQUENCE==>ANY: ~p~n",[Events]), - store_events(State, Events), - case ?get_Event(State) of - {[], _} -> - {noreply, State}; - {AnyEvent, _} -> - corba:reply(?get_RespondTo(State), AnyEvent), - {noreply, ?reset_RespondTo(State)} - end; - {Events, _} when ?is_STRUCTURED(State), ?is_Waiting(State) -> - ?DBG("PROXY RECEIVED SEQUENCE: ~p~n",[Events]), - store_events(State, Events), - case ?get_Event(State) of - {[], _} -> - {noreply, State}; - {_StrEvent, _} -> - corba:reply(?get_RespondTo(State), Events), - {noreply, ?reset_RespondTo(State)} - end; - {Events, _} when ?is_SEQUENCE(State), ?is_Waiting(State) -> - ?DBG("PROXY RECEIVED SEQUENCE: ~p~n",[Events]), - %% Store them first and extract Max events in QoS order. - store_events(State, Events), - {RespondTo, Max} = ?get_RespondTo(State), - case ?is_BatchLimitReached(State, Max) of - true -> - {EventSeq, _} = ?get_Events(State, Max), - corba:reply(RespondTo, EventSeq), - stop_timer(State), - {noreply, ?reset_RespondTo(State)}; - _-> - {noreply, State} - end; - %% No client waiting. Store the event(s). - {Events, _} -> - ?DBG("PROXY RECEIVED SEQUENCE: ~p~n",[Events]), - store_events(State, Events), - {noreply, State} - end. - -store_events(_State, []) -> - ok; -store_events(State, [Event|Rest]) when ?is_ANY(State) -> - AnyEvent = any:create('CosNotification_StructuredEvent':tc(),Event), - ?add_Event(State,AnyEvent), - store_events(State, Rest); -store_events(State, [Event|Rest]) -> - ?add_Event(State,Event), - store_events(State, Rest). - -%%----------------------------------------------------------- -%% function : callAny -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -callAny(_OE_THIS, OE_FROM, State, EventIn, Status) -> - corba:reply(OE_FROM, ok), - case cosNotification_eventDB:validate_event(?get_SubscribeData(State), EventIn, - ?get_AllFilter(State), - ?get_SubscribeDB(State), - Status) of - {[],_} -> - ?DBG("PROXY NOSUBSCRIPTION ANY: ~p~n",[EventIn]), - {noreply, State}; - {Event,_} when ?is_ANY(State), ?is_Waiting(State) -> - ?DBG("PROXY RECEIVED ANY: ~p~n",[Event]), - case ?addAndGet_Event(State, Event) of - {[],_} -> - %% Unable to deliver the event (Starttime, Deadline etc). - {noreply, State}; - {MaybeOtherEvent , _} -> - corba:reply(?get_RespondTo(State), MaybeOtherEvent), - {noreply, ?reset_RespondTo(State)} - end; - {Event,_} when ?is_ANY(State) -> - ?DBG("PROXY RECEIVED ANY: ~p~n",[Event]), - ?add_Event(State,Event), - {noreply, State}; - {Event,_} when ?is_STRUCTURED(State), ?is_Waiting(State) -> - ?DBG("PROXY RECEIVED ANY==>STRUCTURED: ~p~n",[Event]), - case ?addAndGet_Event(State, ?not_CreateSE("","%ANY","",[],[],Event)) of - {[],_} -> - %% Unable to deliver the event (Starttime, Deadline etc). - {noreply, State}; - {MaybeOtherEvent , _} -> - corba:reply(?get_RespondTo(State), MaybeOtherEvent), - {noreply, ?reset_RespondTo(State)} - end; - {Event,_} when ?is_SEQUENCE(State), ?is_Waiting(State) -> - ?DBG("PROXY RECEIVED ANY==>SEQUENCE[1]: ~p~n",[Event]), - ?add_Event(State,?not_CreateSE("","%ANY","",[],[],Event)), - {RespondTo, Max} = ?get_RespondTo(State), - case ?is_BatchLimitReached(State, Max) of - true -> - {EventSeq, _} = ?get_Events(State, Max), - corba:reply(RespondTo, EventSeq), - stop_timer(State), - {noreply, ?reset_RespondTo(State)}; - _ -> - {noreply, State} - end; - {Event,_} -> - ?DBG("PROXY RECEIVED ANY==>STRUCTURED/SEQUENCE: ~p~n",[Event]), - ?add_Event(State,?not_CreateSE("","%ANY","",[],[],Event)), - {noreply, State} - end. - - - -%% Start timers which send a message each time we should push events. Only used -%% when this objects is defined to supply sequences. -start_timer(State) -> - TS = erlang:timestamp(), - case catch timer:send_after(timer:seconds(?get_PacingInterval(State)), - {pacing, TS}) of - {ok,PacTRef} -> - ?DBG("PULL SUPPLIER STARTED TIMER, BATCH LIMIT: ~p~n", - [?get_BatchLimit(State)]), - ?set_PacingTimer(State, {PacTRef, TS}); - What -> - orber:dbg("[~p] PullerSupplier:start_timer();~n" - "Unable to invoke timer:send_interval/2: ~p", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -stop_timer(State) -> - case ?get_PacingTimer(State) of - undefined -> - ok; - {Timer, _} -> - ?DBG("PULL SUPPLIER STOPPED TIMER~n",[]), - timer:cancel(Timer) - end. - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/PusherConsumer_impl.erl b/lib/cosNotification/src/PusherConsumer_impl.erl deleted file mode 100644 index f82f9d8bbd..0000000000 --- a/lib/cosNotification/src/PusherConsumer_impl.erl +++ /dev/null @@ -1,730 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : PusherConsumer_impl.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module('PusherConsumer_impl'). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% cosEvent files. --include_lib("cosEvent/include/CosEventChannelAdmin.hrl"). --include_lib("cosEvent/include/CosEventComm.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). - --include("CosNotification_Definitions.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%%--------------- External ----------------------------------- -%%----- CosNotifyChannelAdmin::ProxyPushConsumer ------------- --export([connect_any_push_supplier/4]). - -%%----- CosNotifyChannelAdmin::SequenceProxyPushConsumer ----- --export([connect_sequence_push_supplier/4]). - -%%----- CosNotifyChannelAdmin::StructuredProxyPushConsumer --- --export([connect_structured_push_supplier/4]). - -%%----- Inherit from CosNotifyChannelAdmin::ProxyConsumer ---- --export([obtain_subscription_types/4, - validate_event_qos/4]). - -%%----- Inherit from CosNotification::QoSAdmin --------------- --export([get_qos/3, - set_qos/4, - validate_qos/4]). - -%%----- Inherit from CosNotifyComm::NotifyPublish ------------ --export([offer_change/5]). - -%%----- Inherit from CosNotifyFilter::FilterAdmin ------------ --export([add_filter/4, - remove_filter/4, - get_filter/4, - get_all_filters/3, - remove_all_filters/3]). - -%%----- Inherit from CosEventComm::PushConsumer ------------- --export([push/4, - disconnect_push_consumer/3]). - -%%----- Inherit from CosNotifyComm::SequencePushConsumer ---- --export([push_structured_events/4, - disconnect_sequence_push_consumer/3]). - -%%----- Inherit from CosNotifyComm::StructuredPushConsumer -- --export([push_structured_event/4, - disconnect_structured_push_consumer/3]). - -%%----- Inherit from CosEventChannelAdmin::ProxyPushConsumer --export([connect_push_supplier/4]). - -%% Attributes (external) CosNotifyChannelAdmin::ProxySupplier --export(['_get_MyType'/3, - '_get_MyAdmin'/3]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - -%%--------------- LOCAL DEFINITIONS -------------------------- -%% Data structures --record(state, {myType, - myAdmin, - myAdminPid, - myChannel, - myFilters = [], - myOperator, - idCounter = 0, - client, - qosGlobal, - qosLocal, - publishType = false, - etsR, - eventDB}). - -%% Data structures constructors --define(get_InitState(_MyT, _MyA, _MyAP, _QS, _LQS, _Ch, _EDB, _MyOP), - #state{myType = _MyT, - myAdmin = _MyA, - myAdminPid= _MyAP, - myChannel = _Ch, - myOperator= _MyOP, - qosGlobal = _QS, - qosLocal = _LQS, - etsR = ets:new(oe_ets, [set, protected]), - eventDB = _EDB}). - -%%-------------- Data structures selectors ----------------- -%% Attributes --define(get_MyType(S), S#state.myType). --define(get_MyAdmin(S), S#state.myAdmin). --define(get_MyAdminPid(S), S#state.myAdminPid). --define(get_MyChannel(S), S#state.myChannel). --define(get_MyOperator(S), S#state.myOperator). -%% Client Object --define(get_Client(S), S#state.client). -%% QoS --define(get_GlobalQoS(S), S#state.qosGlobal). --define(get_LocalQoS(S), S#state.qosLocal). --define(get_BothQoS(S), {S#state.qosGlobal, S#state.qosLocal}). -%% Filters --define(get_Filter(S, I), find_obj(lists:keysearch(I, 1, S#state.myFilters))). --define(get_AllFilter(S), S#state.myFilters). --define(get_AllFilterID(S), find_ids(S#state.myFilters)). -%% Publish --define(get_AllPublish(S), lists:flatten(ets:match(S#state.etsR, - {'$1',publish}))). --define(get_PublishType(S), S#state.publishType). -%% ID --define(get_IdCounter(S), S#state.idCounter). -%% Event --define(get_Event(S), cosNotification_eventDB:get_event(S#state.eventDB)). --define(get_Events(S,M), cosNotification_eventDB:get_events(S#state.eventDB, M)). - --define(get_EventCounter(S), S#state.eventCounter). -%% Admin --define(get_BatchLimit(S), ?not_GetMaximumBatchSize((S#state.qosLocal))). - -%%-------------- Data structures modifiers ----------------- -%% Client Object --define(set_Client(S,D), S#state{client=D}). --define(del_Client(S), S#state{client=undefined}). --define(set_Unconnected(S), S#state{client=undefined}). -%% QoS --define(set_LocalQoS(S,D), S#state{qosLocal=D}). --define(set_GlobalQoS(S,D), S#state{qosGlobal=D}). --define(set_BothQoS(S,GD,LD), S#state{qosGlobal=GD, qosLocal=LD}). -%% Filters --define(add_Filter(S,I,O), S#state{myFilters=[{I,O}|S#state.myFilters]}). --define(del_Filter(S,I), S#state{myFilters= - delete_obj(lists:keydelete(I, 1, S#state.myFilters), - S#state.myFilters)}). --define(del_AllFilter(S), S#state{myFilters=[]}). -%% Publish --define(add_Publish(S,E), ets:insert(S#state.etsR, {E, publish})). --define(del_Publish(S,E), ets:delete(S#state.etsR, E)). --define(set_PublishType(S,T), S#state{publishType=T}). -%% ID --define(set_IdCounter(S,V), S#state{idCounter=V}). --define(new_Id(S), 'CosNotification_Common':create_id(S#state.idCounter)). -%% Event --define(add_Event(S,E), cosNotification_eventDB:add_event(S#state.eventDB, E)). --define(update_EventDB(S,Q), S#state{eventDB= - cosNotification_eventDB:update(S#state.eventDB, Q)}). - --define(set_EventCounter(S,V), S#state{eventCounter=V}). --define(add_to_EventCounter(S,V),S#state{eventCounter=S#state.eventCounter+V}). --define(reset_EventCounter(S), S#state{eventCounter=0}). --define(increase_EventCounter(S),S#state{eventCounter=(S#state.eventCounter+1)}). --define(decrease_EventCounter(S),S#state{eventCounter=S#state.eventCounter-1}). --define(add_ToEventCounter(S,A), S#state{eventCounter=(S#state.eventCounter+A)}). --define(sub_FromEventCounter(S,_A), S#state{eventCounter=(S#state.eventCounter-_A)}). --define(set_EventCounterTo(S,V), S#state{eventCounter=V}). - -%% MISC --define(is_ANY(S), S#state.myType == 'PUSH_ANY'). --define(is_STRUCTURED(S), S#state.myType == 'PUSH_STRUCTURED'). --define(is_SEQUENCE(S), S#state.myType == 'PUSH_SEQUENCE'). --define(is_ANDOP(S), S#state.myOperator == 'AND_OP'). --define(is_UnConnected(S), S#state.client == undefined). --define(is_Connected(S), S#state.client =/= undefined). --define(is_PersistentConnection(S), - ?not_GetConnectionReliability((S#state.qosLocal)) == ?not_Persistent). --define(is_PersistentEvent(S), - ?not_GetEventReliability((S#state.qosLocal)) == ?not_Persistent). --define(is_BatchLimitReached(S), S#state.eventCounter >= - ?not_GetMaximumBatchSize((S#state.qosLocal))). - - -%%----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the gen_server module. -%%----------------------------------------------------------- - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(Info, State) -> - ?DBG("INFO: ~p~n", [Info]), - case Info of - {'EXIT', Pid, Reason} when ?get_MyAdminPid(State)==Pid-> - ?DBG("PARENT ADMIN: ~p TERMINATED.~n",[Reason]), - {stop, Reason, State}; - {'EXIT', _Pid, _Reason} -> - ?DBG("PROXYPUSHCONSUMER: ~p TERMINATED.~n",[_Reason]), - {noreply, State}; - _ -> - {noreply, State} - end. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init(['PUSH_SEQUENCE', MyAdmin, MyAdminPid, InitQoS, LQS, - MyChannel, Options, Operator]) -> - process_flag(trap_exit, true), - %% Only if MyType is 'PUSH_SEQUENCE' we need an ets to store events in. - %% Otherwise we'll forward them at once. Why? We don't know when the next event - %% is due. - GCTime = 'CosNotification_Common':get_option(gcTime, Options, - ?not_DEFAULT_SETTINGS), - GCLimit = 'CosNotification_Common':get_option(gcLimit, Options, - ?not_DEFAULT_SETTINGS), - TimeRef = 'CosNotification_Common':get_option(timeService, Options, - ?not_DEFAULT_SETTINGS), - {ok, ?get_InitState('PUSH_SEQUENCE', MyAdmin, MyAdminPid, InitQoS, LQS, MyChannel, - cosNotification_eventDB:create_db(LQS, GCTime, GCLimit, TimeRef), - Operator)}; -init([MyType, MyAdmin, MyAdminPid, InitQoS, LQS, MyChannel, _Options, Operator]) -> - process_flag(trap_exit, true), - {ok, ?get_InitState(MyType, MyAdmin, MyAdminPid, InitQoS, LQS, MyChannel, - undefined, Operator)}. - -terminate(_Reason, State) when ?is_UnConnected(State) -> - ok; -terminate(_Reason, State) -> - Client = ?get_Client(State), - case catch corba_object:is_nil(Client) of - false when ?is_ANY(State) -> - 'CosNotification_Common':disconnect('CosEventComm_PushSupplier', - disconnect_push_supplier, - Client); - false when ?is_SEQUENCE(State) -> - 'CosNotification_Common':disconnect('CosNotifyComm_SequencePushSupplier', - disconnect_sequence_push_supplier, - Client); - false when ?is_STRUCTURED(State) -> - 'CosNotification_Common':disconnect('CosNotifyComm_StructuredPushSupplier', - disconnect_structured_push_supplier, - Client); - _ -> - ok - end. - -%%----------------------------------------------------------- -%%----- CosNotifyChannelAdmin_ProxyConsumer attributes ------ -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Attribute: '_get_MyType' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyType'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyType(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_MyAdmin' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyAdmin'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyAdmin(State), State}. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----- CosEventChannelAdmin::ProxyPushConsumer ------------- -%%----------------------------------------------------------% -%% function : connect_push_supplier -%% Arguments: Client - CosEventComm::PushSupplier -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} -%% Both exceptions from CosEventChannelAdmin!!! -%%----------------------------------------------------------- -connect_push_supplier(OE_THIS, OE_FROM, State, Client) -> - connect_any_push_supplier(OE_THIS, OE_FROM, State, Client). - -%%----- CosNotifyChannelAdmin::ProxyPushConsumer ------------ -%%----------------------------------------------------------% -%% function : connect_any_push_supplier -%% Arguments: Client - CosEventComm::PushSupplier -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} -%% Both exceptions from CosEventChannelAdmin!!! -%%----------------------------------------------------------- -connect_any_push_supplier(_OE_THIS, _OE_FROM, State, Client) when ?is_ANY(State) -> - ?not_TypeCheck(Client, 'CosEventComm_PushSupplier'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - {reply, ok, ?set_Client(State, Client)} - end; -connect_any_push_supplier(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- CosNotifyChannelAdmin::SequenceProxyPushConsumer ---- -%%----------------------------------------------------------% -%% function : connect_sequence_push_supplier -%% Arguments: Client - CosNotifyComm::SequencePushSupplier -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} -%%----------------------------------------------------------- -connect_sequence_push_supplier(_OE_THIS, _OE_FROM, State, Client) when ?is_SEQUENCE(State) -> - ?not_TypeCheck(Client, 'CosNotifyComm_SequencePushSupplier'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - {reply, ok, ?set_Client(State, Client)} - end; -connect_sequence_push_supplier(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- CosNotifyChannelAdmin::StructuredProxyPushConsumer -- -%%----------------------------------------------------------% -%% function : connect_structured_push_supplier -%% Arguments: Client - CosNotifyComm::StructuredPushSupplier -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} -%%----------------------------------------------------------- -connect_structured_push_supplier(_OE_THIS, _OE_FROM, State, Client) when ?is_STRUCTURED(State) -> - ?not_TypeCheck(Client, 'CosNotifyComm_StructuredPushSupplier'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - {reply, ok, ?set_Client(State, Client)} - end; -connect_structured_push_supplier(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- Inherit from CosNotifyChannelAdmin::ProxyConsumer --- -%%----------------------------------------------------------% -%% function : obtain_subscription_types -%% Arguments: Mode - enum 'ObtainInfoMode' (CosNotifyChannelAdmin) -%% Returns : CosNotification::EventTypeSeq -%%----------------------------------------------------------- -obtain_subscription_types(_OE_THIS, _OE_FROM, State, 'ALL_NOW_UPDATES_OFF') -> - {reply, ?get_AllPublish(State), ?set_PublishType(State, false)}; -obtain_subscription_types(_OE_THIS, _OE_FROM, State, 'ALL_NOW_UPDATES_ON') -> - {reply, ?get_AllPublish(State), ?set_PublishType(State, true)}; -obtain_subscription_types(_OE_THIS, _OE_FROM, State, 'NONE_NOW_UPDATES_OFF') -> - {reply, [], ?set_PublishType(State, false)}; -obtain_subscription_types(_OE_THIS, _OE_FROM, State, 'NONE_NOW_UPDATES_ON') -> - {reply, [], ?set_PublishType(State, true)}; -obtain_subscription_types(_,_,_,What) -> - orber:dbg("[~p] PusherConsumer:obtain_subscription_types(~p);~n" - "Incorrect enumerant", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : validate_event_qos -%% Arguments: RequiredQoS - CosNotification::QoSProperties -%% Returns : ok | {'EXCEPTION', #'UnsupportedQoS'{}} -%% AvilableQoS - CosNotification::NamedPropertyRangeSeq (out) -%%----------------------------------------------------------- -validate_event_qos(_OE_THIS, _OE_FROM, State, RequiredQoS) -> - AvilableQoS = 'CosNotification_Common':validate_event_qos(RequiredQoS, - ?get_LocalQoS(State)), - {reply, {ok, AvilableQoS}, State}. - -%%----- Inherit from CosNotification::QoSAdmin -------------- -%%----------------------------------------------------------% -%% function : get_qos -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -get_qos(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_GlobalQoS(State), State}. - -%%----------------------------------------------------------% -%% function : set_qos -%% Arguments: QoS - CosNotification::QoSProperties, i.e., -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : ok | {'EXCEPTION', CosNotification::UnsupportedQoS} -%%----------------------------------------------------------- -set_qos(_OE_THIS, _OE_FROM, State, QoS) -> - {NewQoS, LQS} = 'CosNotification_Common':set_qos(QoS, ?get_BothQoS(State), - proxy, ?get_MyAdmin(State), - false), - NewState = ?update_EventDB(State, LQS), - {reply, ok, ?set_BothQoS(NewState, NewQoS, LQS)}. - -%%----------------------------------------------------------% -%% function : validate_qos -%% Arguments: Required_qos - CosNotification::QoSProperties -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : {'EXCEPTION', CosNotification::UnsupportedQoS} -%% {ok, CosNotification::NamedPropertyRangeSeq} -%%----------------------------------------------------------- -validate_qos(_OE_THIS, _OE_FROM, State, Required_qos) -> - QoS = 'CosNotification_Common':validate_qos(Required_qos, ?get_BothQoS(State), - proxy, ?get_MyAdmin(State), - false), - {reply, {ok, QoS}, State}. - -%%----- Inherit from CosNotifyComm::NotifyPublish ----------- -%%----------------------------------------------------------% -%% function : offer_change -%% Arguments: Added - #'CosNotification_EventType'{} -%% Removed - #'CosNotification_EventType'{} -%% Returns : ok | -%% {'EXCEPTION', #'CosNotifyComm_InvalidEventType'{}} -%%----------------------------------------------------------- -offer_change(_OE_THIS, _OE_FROM, State, Added, Removed) -> - cosNotification_Filter:validate_types(Added), - cosNotification_Filter:validate_types(Removed), - %% On this "side" we don't really care about which - %% type of events the client will supply. - %% Perhaps, later on, if we want to check this against Filters - %% associated with this object we may change this approach, i.e., if - %% the filter will not allow passing certain event types. But the - %% user should see to that that situation never occurs. It would add - %% extra overhead. Also see PusherSupplier- and PullerSuppler- - %% 'subscription_change'. - update_publish(add, State, Added), - update_publish(remove, State, Removed), - case ?get_PublishType(State) of - true -> - %% Perhaps we should handle exception here?! - %% Probably not. Better to stay "on-line". - catch 'CosNotifyComm_NotifySubscribe': - subscription_change(?get_Client(State), Added, Removed), - ok; - _-> - ok - end, - {reply, ok, State}. - -update_publish(_, _, [])-> - ok; -update_publish(add, State, [H|T]) -> - ?add_Publish(State, H), - update_publish(add, State, T); -update_publish(remove, State, [H|T]) -> - ?del_Publish(State, H), - update_publish(remove, State, T). - -%%----- Inherit from CosNotifyFilter::FilterAdmin ----------- -%%----------------------------------------------------------% -%% function : add_filter -%% Arguments: Filter - CosNotifyFilter::Filter -%% Returns : FilterID - long -%%----------------------------------------------------------- -add_filter(_OE_THIS, _OE_FROM, State, Filter) -> - 'CosNotification_Common':type_check(Filter, 'CosNotifyFilter_Filter'), - FilterID = ?new_Id(State), - NewState = ?set_IdCounter(State, FilterID), - {reply, FilterID, ?add_Filter(NewState, FilterID, Filter)}. - -%%----------------------------------------------------------% -%% function : remove_filter -%% Arguments: FilterID - long -%% Returns : ok -%%----------------------------------------------------------- -remove_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ok, ?del_Filter(State, FilterID)}; -remove_filter(_,_,_,What) -> - orber:dbg("[~p] PusherConsumer:remove_filter(~p); Not an integer", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_filter -%% Arguments: FilterID - long -%% Returns : Filter - CosNotifyFilter::Filter | -%% {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}} -%%----------------------------------------------------------- -get_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ?get_Filter(State, FilterID), State}; -get_filter(_,_,_,What) -> - orber:dbg("[~p] PusherConsumer:get_filter(~p); Not an integer", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_all_filters -%% Arguments: - -%% Returns : Filter - CosNotifyFilter::FilterIDSeq -%%----------------------------------------------------------- -get_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_AllFilterID(State), State}. - -%%----------------------------------------------------------% -%% function : remove_all_filters -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -remove_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ok, ?del_AllFilter(State)}. - -%%----- Inherit from CosEventComm::PushConsumer ------------- -%%----------------------------------------------------------% -%% function : disconnect_push_consumer -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_push_consumer(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%----------------------------------------------------------% -%% function : push -%% Arguments: AnyEvent -%% Returns : ok | -%%----------------------------------------------------------- -push(OE_THIS, OE_FROM, State, Event) when ?is_ANY(State) -> - corba:reply(OE_FROM, ok), - case {?not_isConvertedStructured(Event), - cosNotification_eventDB:filter_events([Event], ?get_AllFilter(State))} of - {_, {[],_}} when ?is_ANDOP(State) -> - {noreply, State}; - {true, {[],[_]}} -> - %% Is OR and converted, change back and forward to Admin - forward(seq, ?get_MyAdmin(State), State, [any:get_value(Event)], - 'MATCH', OE_THIS); - {_, {[],[_]}} -> - %% Is OR and not converted, forward to Admin - forward(any, ?get_MyAdmin(State), State, Event, 'MATCH', OE_THIS); - {true, {[_],_}} when ?is_ANDOP(State) -> - %% Is AND and converted, change back and forward to Admin - forward(seq, ?get_MyAdmin(State), State, [any:get_value(Event)], - 'MATCH', OE_THIS); - {true, {[_],_}} -> - %% Is OR and converted, change back and forward to Channel - forward(seq, ?get_MyChannel(State), State, [any:get_value(Event)], - 'MATCHED', OE_THIS); - {_, {[_],_}} when ?is_ANDOP(State) -> - %% Is AND and not converted, forward to Admin - forward(any, ?get_MyAdmin(State), State, Event, 'MATCH', OE_THIS); - _ -> - %% Is OR and not converted, forward to Channel - forward(any, ?get_MyChannel(State), State, Event, 'MATCHED', OE_THIS) - end; -push(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- Inherit from CosNotifyComm::SequencePushConsumer ---- -%%----------------------------------------------------------% -%% function : disconnect_sequence_push_consumer -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_sequence_push_consumer(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%----------------------------------------------------------% -%% function : push_structured_events -%% Arguments: CosNotification::EventBatch -%% Returns : ok | -%%----------------------------------------------------------- -push_structured_events(OE_THIS, OE_FROM, State, Events) when ?is_SEQUENCE(State) -> - corba:reply(OE_FROM, ok), - %% We cannot convert parts of the sequence to any, event though they - %% are converted from any to structured. Would be 'impossible' to send. - case cosNotification_eventDB:filter_events(Events, ?get_AllFilter(State)) of - {[],_} when ?is_ANDOP(State) -> - {noreply, State}; - {[],Failed} -> - forward(seq, ?get_MyAdmin(State), State, Failed, 'MATCH', OE_THIS); - {Passed, _} when ?is_ANDOP(State) -> - forward(seq, ?get_MyAdmin(State), State, Passed, 'MATCH', OE_THIS); - {Passed, []} -> - forward(seq, ?get_MyChannel(State), State, Passed, 'MATCHED', OE_THIS); - {Passed, Failed} -> - %% Is OR, send Passed to channel and Failed to Admin. - forward(seq, ?get_MyChannel(State), State, Passed, 'MATCHED', OE_THIS), - forward(seq, ?get_MyAdmin(State), State, Failed, 'MATCH', OE_THIS) - end; -push_structured_events(_,_,_,_) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- Inherit from CosNotifyComm::StructuredPushConsumer -- -%%----------------------------------------------------------% -%% function : disconnect_structured_push_consumer -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_structured_push_consumer(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%----------------------------------------------------------% -%% function : push_structured_event -%% Arguments: CosNotification::StructuredEvent -%% Returns : ok | -%%----------------------------------------------------------- -push_structured_event(OE_THIS, OE_FROM, State, Event) when ?is_STRUCTURED(State) -> - corba:reply(OE_FROM, ok), - case {?not_isConvertedAny(Event), - cosNotification_eventDB:filter_events([Event], ?get_AllFilter(State))} of - {_, {[],_}} when ?is_ANDOP(State) -> - {noreply, State}; - {true, {[],[_]}} -> - %% Is OR and converted, change back and forward to Admin - forward(any, ?get_MyAdmin(State), State, - Event#'CosNotification_StructuredEvent'.remainder_of_body, - 'MATCH', OE_THIS); - {_, {[],[_]}} -> - %% Is OR and not converted, forward to Admin - forward(seq, ?get_MyAdmin(State), State, [Event], 'MATCH', OE_THIS); - {true, {[_],_}} when ?is_ANDOP(State) -> - %% Is AND and converted, change back and forward to Admin - forward(any, ?get_MyAdmin(State), State, - Event#'CosNotification_StructuredEvent'.remainder_of_body, - 'MATCH', OE_THIS); - {true, {[_],_}} -> - %% Is OR and converted, change back and forward to Channel - forward(any, ?get_MyChannel(State), State, - Event#'CosNotification_StructuredEvent'.remainder_of_body, - 'MATCHED', OE_THIS); - {_, {[_],_}} when ?is_ANDOP(State) -> - %% Is AND and not converted, forward to Admin - forward(seq, ?get_MyAdmin(State), State, [Event], 'MATCH', OE_THIS); - _ -> - %% Is OR and not converted, forward to Channel - forward(seq, ?get_MyChannel(State), State, [Event], 'MATCHED', OE_THIS) - end; -push_structured_event(_,_,_,_) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%--------------- LOCAL FUNCTIONS ---------------------------- -find_obj({value, {_, Obj}}) -> Obj; -find_obj(_) -> {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}}. - -find_ids(List) -> find_ids(List, []). -find_ids([], Acc) -> Acc; -find_ids([{I,_}|T], Acc) -> find_ids(T, [I|Acc]); -find_ids(What, _) -> - orber:dbg("[~p] PusherConsumer:find_ids();~n" - "Id corrupt: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). - -%% Delete a single object. -%% The list don not differ, i.e., no filter removed, raise exception. -delete_obj(List,List) -> corba:raise(#'CosNotifyFilter_FilterNotFound'{}); -delete_obj(List,_) -> List. - -%% Forward events -forward(any, SendTo, State, Event, Status, OE_THIS) -> - case catch oe_CosNotificationComm_Event:callAny(SendTo, Event, Status) of - ok -> - ?DBG("PROXY FORWARD ANY: ~p~n",[Event]), - {noreply, State}; - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') orelse - is_record(E, 'NO_PERMISSION') orelse - is_record(E, 'CosEventComm_Disconnected') -> - orber:dbg("[~p] PusherConsumer:forward();~n" - "Admin/Channel no longer exists; terminating and dropping: ~p", - [?LINE, Event], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, OE_THIS}, - {client, ?get_Client(State)}, - {reason, {'EXCEPTION', E}}]), - {stop, normal, State}; - R when ?is_PersistentConnection(State) -> - orber:dbg("[~p] PusherConsumer:forward();~n" - "Admin/Channel respond incorrect: ~p~n" - "Dropping: ~p", [?LINE, R, Event], ?DEBUG_LEVEL), - {noreply, State}; - R -> - orber:dbg("[~p] PusherConsumer:forward();~n" - "Admin/Channel respond incorrect: ~p~n" - "Terminating and dropping: ~p", - [?LINE, R, Event], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, OE_THIS}, - {client, ?get_Client(State)}, - {reason, R}]), - {stop, normal, State} - end; -forward(seq, SendTo, State, Event, Status, OE_THIS) -> - case catch oe_CosNotificationComm_Event:callSeq(SendTo, Event, Status) of - ok -> - {noreply, State}; - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') orelse - is_record(E, 'NO_PERMISSION') orelse - is_record(E, 'CosEventComm_Disconnected') -> - ?DBG("ADMIN NO LONGER EXIST; DROPPING: ~p~n", [Event]), - 'CosNotification_Common':notify([{proxy, OE_THIS}, - {client, ?get_Client(State)}, - {reason, {'EXCEPTION', E}}]), - {stop, normal, State}; - R when ?is_PersistentConnection(State) -> - orber:dbg("[~p] PusherConsumer:forward();~n" - "Admin/Channel respond incorrect: ~p~n" - "Dropping: ~p", [?LINE, R, Event], ?DEBUG_LEVEL), - {noreply, State}; - R -> - orber:dbg("[~p] PusherConsumer:forward();~n" - "Admin/Channel respond incorrect: ~p~n" - "Terminating and dropping: ~p", - [?LINE, R, Event], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, OE_THIS}, - {client, ?get_Client(State)}, - {reason, R}]), - {stop, normal, State} - end. - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/PusherSupplier_impl.erl b/lib/cosNotification/src/PusherSupplier_impl.erl deleted file mode 100644 index d3e44f3ef9..0000000000 --- a/lib/cosNotification/src/PusherSupplier_impl.erl +++ /dev/null @@ -1,1053 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : PusherSupplier_impl.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module('PusherSupplier_impl'). - - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% cosEvent files. --include_lib("cosEvent/include/CosEventChannelAdmin.hrl"). --include_lib("cosEvent/include/CosEventComm.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). - --include("CosNotification_Definitions.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%%--------------- External ----------------------------------- -%%----- CosNotifyChannelAdmin::ProxyPushSupplier ------------- --export([connect_any_push_consumer/4]). - -%%----- CosNotifyChannelAdmin::StructuredProxyPushSupplier --- --export([connect_structured_push_consumer/4]). - -%%----- CosNotifyChannelAdmin::SequenceProxyPushSupplier ----- --export([connect_sequence_push_consumer/4]). - -%%----- CosNotifyChannelAdmin::*ProxyPushSupplier ------------ --export([suspend_connection/3, - resume_connection/3]). - -%%----- Inherit from CosNotifyChannelAdmin::ProxySupplier ---- --export([obtain_offered_types/4, - validate_event_qos/4]). - -%%----- Inherit from CosNotification::QoSAdmin --------------- --export([get_qos/3, - set_qos/4, - validate_qos/4]). - -%%----- Inherit from CosNotifyComm::NotifySubscribe ---------- --export([subscription_change/5]). - -%%----- Inherit from CosNotifyFilter::FilterAdmin ------------ --export([add_filter/4, - remove_filter/4, - get_filter/4, - get_all_filters/3, - remove_all_filters/3]). - -%%----- Inherit from CosEventComm::PushSupplier ------------- --export([disconnect_push_supplier/3]). - -%%----- Inherit from CosNotifyComm::StructuredPushSupplier -- --export([disconnect_structured_push_supplier/3]). - -%%----- Inherit from CosNotifyComm::SequencePushSupplier ---- --export([disconnect_sequence_push_supplier/3]). - -%%----- Inherit from CosEventChannelAdmin::ProxyPushSupplier --export([connect_push_consumer/4]). - -%% Attributes (external) CosNotifyChannelAdmin::ProxySupplier --export(['_get_MyType'/3, - '_get_MyAdmin'/3, - '_get_priority_filter'/3, - '_set_priority_filter'/4, - '_get_lifetime_filter'/3, - '_set_lifetime_filter'/4]). - -%%--------------- Internal ----------------------------------- -%%----- Inherit from cosNotificationComm --------------------- --export([callAny/5, - callSeq/5]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - -%%--------------- LOCAL DEFINITIONS -------------------------- -%% Data structures --record(state, {myType, - myAdmin, - myAdminPid, - myChannel, - myFilters = [], - myOperator, - idCounter = 0, - prioFil, - lifetFil, - client, - qosGlobal, - qosLocal, - suspended = false, - pacingTimer, - subscribeType = false, - subscribeData = true, - etsR, - eventDB, - this, - maxCache, - cacheTimeout, - cacheInterval}). - -%% Data structures constructors --define(get_InitState(_MyT, _MyA, _MyAP, _QS, _LQS, _Ch, _MyOp, _GT, _GL, _TR), - #state{myType = _MyT, - myAdmin = _MyA, - myAdminPid= _MyAP, - qosGlobal = _QS, - qosLocal = _LQS, - myChannel = _Ch, - myOperator=_MyOp, - etsR = ets:new(oe_ets, [set, protected]), - eventDB = cosNotification_eventDB:create_db(_LQS, _GT, _GL, _TR), - maxCache = cosNotificationApp:max_events()}). - -%% Data structures selectors -%%-------------- Data structures selectors ----------------- -%% Attributes --define(get_MyType(S), S#state.myType). --define(get_MyAdmin(S), S#state.myAdmin). --define(get_MyAdminPid(S), S#state.myAdminPid). --define(get_MyChannel(S), S#state.myChannel). --define(get_MyOperator(S), S#state.myOperator). --define(get_PrioFil(S), S#state.prioFil). --define(get_LifeTFil(S), S#state.lifetFil). -%% Client Object --define(get_Client(S), S#state.client). -%% QoS --define(get_GlobalQoS(S), S#state.qosGlobal). --define(get_LocalQoS(S), S#state.qosLocal). --define(get_BothQoS(S), {S#state.qosGlobal, S#state.qosLocal}). -%% Filters --define(get_Filter(S, I), find_obj(lists:keysearch(I, 1, S#state.myFilters))). --define(get_AllFilter(S), S#state.myFilters). --define(get_AllFilterID(S), find_ids(S#state.myFilters)). -%% Amin --define(get_PacingTimer(S), S#state.pacingTimer). --define(get_PacingInterval(S), round(?not_GetPacingInterval((S#state.qosLocal))/10000000)). --define(get_BatchLimit(S), ?not_GetMaximumBatchSize((S#state.qosLocal))). -%% Subscribe --define(get_AllSubscribe(S), lists:flatten(ets:match(S#state.etsR, - {'$1',subscribe}))). --define(get_SubscribeType(S), S#state.subscribeType). --define(get_SubscribeData(S), S#state.subscribeData). -%% ID --define(get_IdCounter(S), S#state.idCounter). --define(get_SubscribeDB(S), S#state.etsR). -%% Event --define(is_PersistentConnection(S), - (?not_GetConnectionReliability((S#state.qosLocal)) == ?not_Persistent)). --define(is_PersistentEvent(S), - (?not_GetEventReliability((S#state.qosLocal)) == ?not_Persistent)). - --define(get_Event(S), cosNotification_eventDB:get_event(S#state.eventDB, - false)). -% (not ?is_PersistentEvent(S)))). --define(get_Events(S,M), cosNotification_eventDB:get_events(S#state.eventDB, M, false)). -% (not ?is_PersistentEvent(S)))). - -%%-------------- Data structures modifiers ----------------- -%% Attributes --define(set_PrioFil(S,D), S#state{prioFil=D}). --define(set_LifeTFil(S,D), S#state{lifetFil=D}). -%% Client Object --define(set_Client(S,D), S#state{client=D}). --define(del_Client(S), S#state{client=undefined}). --define(set_Unconnected(S), S#state{client=undefined}). --define(set_Suspended(S), S#state{suspended=true}). --define(set_NotSuspended(S), S#state{suspended=false}). -%% QoS --define(set_LocalQoS(S,D), S#state{qosLocal=D}). --define(set_GlobalQoS(S,D), S#state{qosGlobal=D}). --define(set_BothQoS(S,GD,LD), S#state{qosGlobal=GD, qosLocal=LD}). -%% Filters --define(add_Filter(S,I,O), S#state{myFilters=[{I,O}|S#state.myFilters]}). --define(del_Filter(S,I), S#state{myFilters= - delete_obj(lists:keydelete(I, 1, S#state.myFilters), - S#state.myFilters)}). --define(del_AllFilter(S), S#state{myFilters=[]}). -%% Admin --define(set_PacingTimer(S,T), S#state{pacingTimer=T}). -%% Publish -%% Subscribe --define(add_Subscribe(S,E), ets:insert(S#state.etsR, {E, subscribe})). --define(del_Subscribe(S,E), ets:delete(S#state.etsR, E)). --define(set_SubscribeType(S,T), S#state{subscribeType=T}). --define(set_SubscribeData(S,D), S#state{subscribeData=D}). -%% ID --define(set_IdCounter(S,V), S#state{idCounter=V}). --define(new_Id(S), 'CosNotification_Common':create_id(S#state.idCounter)). -%% Events --define(add_Event(S,E), catch cosNotification_eventDB: - add_event(S#state.eventDB, E, S#state.lifetFil, S#state.prioFil)). --define(addAndGet_Event(S,E), catch cosNotification_eventDB: - add_and_get_event(S#state.eventDB, E, S#state.lifetFil, S#state.prioFil, - false)). -% ?is_PersistentEvent(S))). --define(update_EventDB(S,Q), S#state{eventDB= - cosNotification_eventDB:update(S#state.eventDB, Q)}). - - -%%-------------- MISC ---------------------------------------- --define(is_ANY(S), S#state.myType == 'PUSH_ANY'). --define(is_STRUCTURED(S), S#state.myType == 'PUSH_STRUCTURED'). --define(is_SEQUENCE(S), S#state.myType == 'PUSH_SEQUENCE'). --define(is_ANDOP(S), S#state.myOperator == 'AND_OP'). --define(is_UnConnected(S), S#state.client == undefined). --define(is_Connected(S), S#state.client =/= undefined). --define(is_Suspended(S), S#state.suspended == true). --define(is_NotSuspended(S), S#state.suspended == false). --define(is_BatchLimitReached(S), cosNotification_eventDB:status(S#state.eventDB, - {batchLimit, - ?not_GetMaximumBatchSize((S#state.qosLocal))})). --define(has_Filters(S), S#state.myFilters =/= []). - -%%----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the gen_server module. -%%----------------------------------------------------------- - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(Info, #state{cacheTimeout = Timeout, - cacheInterval = Interval} = State) -> - ?DBG("INFO: ~p~n", [Info]), - case Info of - {'EXIT', Pid, Reason} when ?get_MyAdminPid(State)==Pid -> - ?DBG("PARENT ADMIN: ~p TERMINATED.~n",[Reason]), - {stop, Reason, State}; - {'EXIT', _Pid, _Reason} -> - ?DBG("PROXYPUSHSUPPLIER: ~p TERMINATED.~n",[_Reason]), - {noreply, State}; - pacing -> - lookup_and_push(State, true); - cacheInterval -> - lookup_and_push(State, true); - cacheTimeout when Timeout == undefined, Interval == undefined -> - %% Late message, do not terminate - {noreply, State}; - cacheTimeout -> - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, State#state.client}, - {reason, - {timer, "Reached upper limit"}}]), - {stop, normal, State}; - _ -> - {noreply, State} - end. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init([MyType, MyAdmin, MyAdminPid, InitQoS, LQS, MyChannel, Options, Operator]) -> - process_flag(trap_exit, true), - GCTime = 'CosNotification_Common':get_option(gcTime, Options, - ?not_DEFAULT_SETTINGS), - GCLimit = 'CosNotification_Common':get_option(gcLimit, Options, - ?not_DEFAULT_SETTINGS), - TimeRef = 'CosNotification_Common':get_option(timeService, Options, - ?not_DEFAULT_SETTINGS), - timer:start(), - {ok, ?get_InitState(MyType, MyAdmin, MyAdminPid, - InitQoS, LQS, MyChannel, Operator, GCTime, GCLimit, TimeRef)}. - -terminate(_Reason, State) when ?is_UnConnected(State) -> - stop_timer(State#state.cacheTimeout), - stop_timer(State#state.cacheInterval), - stop_timer(State#state.pacingTimer), - %% We are not connected to a Client. Hence, no need to invoke disconnect. - ok; -terminate(_Reason, State) when ?is_ANY(State) -> - stop_timer(State#state.cacheTimeout), - stop_timer(State#state.cacheInterval), - stop_timer(State#state.pacingTimer), - 'CosNotification_Common':disconnect('CosEventComm_PushConsumer', - disconnect_push_consumer, - ?get_Client(State)); -terminate(_Reason, State) when ?is_SEQUENCE(State) -> - stop_timer(State#state.cacheTimeout), - stop_timer(State#state.cacheInterval), - stop_timer(State#state.pacingTimer), - 'CosNotification_Common':disconnect('CosNotifyComm_SequencePushConsumer', - disconnect_sequence_push_consumer, - ?get_Client(State)); -terminate(_Reason, State) when ?is_STRUCTURED(State) -> - stop_timer(State#state.cacheTimeout), - stop_timer(State#state.cacheInterval), - stop_timer(State#state.pacingTimer), - 'CosNotification_Common':disconnect('CosNotifyComm_StructuredPushConsumer', - disconnect_structured_push_consumer, - ?get_Client(State)). - -%%----------------------------------------------------------- -%%----- CosNotifyChannelAdmin_ProxySupplier attributes ------ -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Attribute: '_get_MyType' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyType'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyType(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_MyAdmin' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_MyAdmin'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_MyAdmin(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_*et_priority_filter' -%% Type : read/write -%% Returns : -%%----------------------------------------------------------- -'_get_priority_filter'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_PrioFil(State), State}. -'_set_priority_filter'(_OE_THIS, _OE_FROM, State, PrioF) -> - {reply, ok, ?set_PrioFil(State, PrioF)}. - -%%----------------------------------------------------------% -%% Attribute: '_*et_lifetime_filter' -%% Type : read/write -%% Returns : -%%----------------------------------------------------------- -'_get_lifetime_filter'(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_LifeTFil(State), State}. -'_set_lifetime_filter'(_OE_THIS, _OE_FROM, State, LifeTF) -> - {reply, ok, ?set_LifeTFil(State, LifeTF)}. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----- CosEventChannelAdmin::ProxyPushSupplier ------------- -%%----------------------------------------------------------% -%% function : connect_push_consumer -%% Arguments: Client - CosEventComm::PushConsumer -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} -%% Both exceptions from CosEventChannelAdmin!!!! -%%----------------------------------------------------------- -connect_push_consumer(OE_THIS, OE_FROM, State, Client) -> - connect_any_push_consumer(OE_THIS, OE_FROM, State, Client). - -%%----- CosNotifyChannelAdmin::ProxyPushSupplier ------------ -%%----------------------------------------------------------% -%% function : connect_any_push_consumer -%% Arguments: Client - CosEventComm::PushConsumer -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} -%% Both exceptions from CosEventChannelAdmin!!!! -%%----------------------------------------------------------- -connect_any_push_consumer(OE_THIS, _OE_FROM, State, Client) when ?is_ANY(State) -> - 'CosNotification_Common':type_check(Client, 'CosEventComm_PushConsumer'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - {reply, ok, State#state{client = Client, this = OE_THIS}} - end; -connect_any_push_consumer(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- CosNotifyChannelAdmin::SequenceProxyPushSupplier ---- -%%----------------------------------------------------------% -%% function : connect_sequence_push_consumer -%% Arguments: Client - CosNotifyComm::SequencePushConsumer -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} -%%----------------------------------------------------------- -connect_sequence_push_consumer(OE_THIS, _OE_FROM, State, Client) when ?is_SEQUENCE(State) -> - 'CosNotification_Common':type_check(Client, - 'CosNotifyComm_SequencePushConsumer'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - NewState = start_timer(State), - {reply, ok, NewState#state{client = Client, this = OE_THIS}} - end; -connect_sequence_push_consumer(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- CosNotifyChannelAdmin::StructuredProxyPushSupplier --- -%%----------------------------------------------------------% -%% function : connect_structured_push_consumer -%% Arguments: Client - CosNotifyComm::StructuredPushConsumer -%% Returns : ok | {'EXCEPTION', #'AlreadyConnected'{}} | -%% {'EXCEPTION', #'TypeError'{}} -%%----------------------------------------------------------- -connect_structured_push_consumer(OE_THIS, _OE_FROM, State, Client) when ?is_STRUCTURED(State) -> - 'CosNotification_Common':type_check(Client, - 'CosNotifyComm_StructuredPushConsumer'), - if - ?is_Connected(State) -> - corba:raise(#'CosEventChannelAdmin_AlreadyConnected'{}); - true -> - {reply, ok, State#state{client = Client, this = OE_THIS}} - end; -connect_structured_push_consumer(_, _, _, _) -> - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----- CosNotifyChannelAdmin::*ProxyPushSupplier ----------- -%%----------------------------------------------------------% -%% function : suspend_connection -%% Arguments: -%% Returns : ok | {'EXCEPTION', #'ConnectionAlreadyInactive'{}} | -%% {'EXCEPTION', #'NotConneced'{}} -%%----------------------------------------------------------- -suspend_connection(_OE_THIS, _OE_FROM, State) when ?is_Connected(State) -> - if - ?is_Suspended(State) -> - corba:raise(#'CosNotifyChannelAdmin_ConnectionAlreadyInactive'{}); - true -> - stop_timer(State#state.pacingTimer), - {reply, ok, State#state{pacingTimer = undefined, - suspended=true}} - end; -suspend_connection(_,_,_)-> - corba:raise(#'CosNotifyChannelAdmin_NotConnected'{}). - -%%----------------------------------------------------------% -%% function : resume_connection -%% Arguments: -%% Returns : ok | {'EXCEPTION', #'ConnectionAlreadyActive'{}} | -%% {'EXCEPTION', #'NotConneced'{}} -%%----------------------------------------------------------- -resume_connection(_OE_THIS, OE_FROM, State) when ?is_Connected(State) -> - if - ?is_NotSuspended(State) -> - corba:raise(#'CosNotifyChannelAdmin_ConnectionAlreadyActive'{}); - true -> - corba:reply(OE_FROM, ok), - if - ?is_SEQUENCE(State) -> - start_timer(State); - true -> - ok - end, - lookup_and_push(?set_NotSuspended(State)) - end; -resume_connection(_,_,_) -> - corba:raise(#'CosNotifyChannelAdmin_NotConnected'{}). - -%%----- Inherit from CosNotifyChannelAdmin::ProxySupplier --- -%%----------------------------------------------------------% -%% function : obtain_offered_types -%% Arguments: Mode - enum 'ObtainInfoMode' (CosNotifyChannelAdmin) -%% Returns : CosNotification::EventTypeSeq -%%----------------------------------------------------------- -obtain_offered_types(_OE_THIS, _OE_FROM, State, 'ALL_NOW_UPDATES_OFF') -> - {reply, ?get_AllSubscribe(State), ?set_SubscribeType(State, false)}; -obtain_offered_types(_OE_THIS, _OE_FROM, State, 'ALL_NOW_UPDATES_ON') -> - {reply, ?get_AllSubscribe(State), ?set_SubscribeType(State, true)}; -obtain_offered_types(_OE_THIS, _OE_FROM, State, 'NONE_NOW_UPDATES_OFF') -> - {reply, [], ?set_SubscribeType(State, false)}; -obtain_offered_types(_OE_THIS, _OE_FROM, State, 'NONE_NOW_UPDATES_ON') -> - {reply, [], ?set_SubscribeType(State, true)}; -obtain_offered_types(_,_,_,What) -> - orber:dbg("[~p] PusherSupplier:obtain_offered_types(~p);~n" - "Bad enumerant", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_OPERATION'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : validate_event_qos -%% Arguments: RequiredQoS - CosNotification::QoSProperties -%% Returns : ok | {'EXCEPTION', #'UnsupportedQoS'{}} -%% AvilableQoS - CosNotification::NamedPropertyRangeSeq (out) -%%----------------------------------------------------------- -validate_event_qos(_OE_THIS, _OE_FROM, State, RequiredQoS) -> - AvilableQoS = 'CosNotification_Common':validate_event_qos(RequiredQoS, - ?get_LocalQoS(State)), - {reply, {ok, AvilableQoS}, State}. - -%%----- Inherit from CosNotification::QoSAdmin -------------- -%%----------------------------------------------------------% -%% function : get_qos -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -get_qos(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_GlobalQoS(State), State}. - -%%----------------------------------------------------------% -%% function : set_qos -%% Arguments: QoS - CosNotification::QoSProperties, i.e., -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : ok | {'EXCEPTION', CosNotification::UnsupportedQoS} -%%----------------------------------------------------------- -set_qos(_OE_THIS, _OE_FROM, State, QoS) -> - {NewQoS, LQS} = 'CosNotification_Common':set_qos(QoS, ?get_BothQoS(State), - proxy, ?get_MyAdmin(State), - false), - NewState = ?update_EventDB(State, LQS), - {reply, ok, ?set_BothQoS(NewState, NewQoS, LQS)}. - -%%----------------------------------------------------------% -%% function : validate_qos -%% Arguments: Required_qos - CosNotification::QoSProperties -%% [#'Property'{name, value}, ...] where name eq. string() -%% and value eq. any(). -%% Returns : {'EXCEPTION', CosNotification::UnsupportedQoS} -%% {ok, CosNotification::NamedPropertyRangeSeq} -%%----------------------------------------------------------- -validate_qos(_OE_THIS, _OE_FROM, State, Required_qos) -> - QoS = 'CosNotification_Common':validate_qos(Required_qos, ?get_BothQoS(State), - proxy, ?get_MyAdmin(State), - false), - {reply, {ok, QoS}, State}. - -%%----- Inherit from CosNotifyComm::NotifySubscribe --------- -%%----------------------------------------------------------% -%% function : subscription_change -%% Arguments: Added - #'CosNotification_EventType'{} -%% Removed - #'CosNotification_EventType'{} -%% Returns : ok | -%% {'EXCEPTION', #'CosNotifyComm_InvalidEventType'{}} -%%----------------------------------------------------------- -subscription_change(_OE_THIS, _OE_FROM, State, Added, Removed) -> - cosNotification_Filter:validate_types(Added), - cosNotification_Filter:validate_types(Removed), - %% On this "side", we care about which type of events the client - %% will require, since the client (or an agent) clearly stated - %% that it's only interested in these types of events. - %% Also see PusherConsumer- and PullerConsumer-'offer_change'. - update_subscribe(remove, State, Removed), - CurrentSub = ?get_AllSubscribe(State), - NewState = - case cosNotification_Filter:check_types(Added++CurrentSub) of - true -> - %% Types supplied does in some way cause all events to be valid. - %% Smart? Would have been better to not supply any at all. - ?set_SubscribeData(State, true); - {ok, Which, WC} -> - ?set_SubscribeData(State, {Which, WC}) - end, - update_subscribe(add, NewState, Added), - case ?get_SubscribeType(NewState) of - true -> - %% Perhaps we should handle exception here?! - %% Probably not. Better to stay "on-line". - catch 'CosNotifyComm_NotifyPublish': - offer_change(?get_Client(NewState), Added, Removed), - ok; - _-> - ok - end, - {reply, ok, NewState}. - -update_subscribe(_, _, [])-> - ok; -update_subscribe(add, State, [H|T]) -> - ?add_Subscribe(State, H), - update_subscribe(add, State, T); -update_subscribe(remove, State, [H|T]) -> - ?del_Subscribe(State, H), - update_subscribe(remove, State, T). - -%%----- Inherit from CosNotifyFilter::FilterAdmin ----------- -%%----------------------------------------------------------% -%% function : add_filter -%% Arguments: Filter - CosNotifyFilter::Filter -%% Returns : FilterID - long -%%----------------------------------------------------------- -add_filter(_OE_THIS, _OE_FROM, State, Filter) -> - 'CosNotification_Common':type_check(Filter, 'CosNotifyFilter_Filter'), - FilterID = ?new_Id(State), - NewState = ?set_IdCounter(State, FilterID), - {reply, FilterID, ?add_Filter(NewState, FilterID, Filter)}. - -%%----------------------------------------------------------% -%% function : remove_filter -%% Arguments: FilterID - long -%% Returns : ok -%%----------------------------------------------------------- -remove_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ok, ?del_Filter(State, FilterID)}; -remove_filter(_,_,_,What) -> - orber:dbg("[~p] PusherSupplier:remove_filter(~p); Not an integer", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_filter -%% Arguments: FilterID - long -%% Returns : Filter - CosNotifyFilter::Filter | -%% {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}} -%%----------------------------------------------------------- -get_filter(_OE_THIS, _OE_FROM, State, FilterID) when is_integer(FilterID) -> - {reply, ?get_Filter(State, FilterID), State}; -get_filter(_,_,_,What) -> - orber:dbg("[~p] PusherSupplier:get_filter(~p); Not an integer", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : get_all_filters -%% Arguments: - -%% Returns : Filter - CosNotifyFilter::FilterIDSeq -%%----------------------------------------------------------- -get_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ?get_AllFilterID(State), State}. - -%%----------------------------------------------------------% -%% function : remove_all_filters -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -remove_all_filters(_OE_THIS, _OE_FROM, State) -> - {reply, ok, ?del_AllFilter(State)}. - - -%%----- Inherit from CosEventComm::PushSupplier ------------- -%%----------------------------------------------------------% -%% function : disconnect_push_supplier -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_push_supplier(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%----- Inherit from CosNotifyComm::StructuredPushSupplier -- -%%----------------------------------------------------------% -%% function : disconnect_structured_push_supplier -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_structured_push_supplier(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%----- Inherit from CosNotifyComm::SequencePushSupplier ---- -%%----------------------------------------------------------% -%% function : disconnect_sequence_push_supplier -%% Arguments: - -%% Returns : ok -%%----------------------------------------------------------- -disconnect_sequence_push_supplier(_OE_THIS, _OE_FROM, State) -> - {stop, normal, ok, ?set_Unconnected(State)}. - -%%--------------- LOCAL FUNCTIONS ---------------------------- -find_obj({value, {_, Obj}}) -> Obj; -find_obj(_) -> {'EXCEPTION', #'CosNotifyFilter_FilterNotFound'{}}. - -find_ids(List) -> find_ids(List, []). -find_ids([], Acc) -> Acc; -find_ids([{I,_}|T], Acc) -> find_ids(T, [I|Acc]); -find_ids(What, _) -> - orber:dbg("[~p] PusherSupplier:find_ids();~n" - "Id corrupt: ~p", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). - -%% Delete a single object. -%% The list do not differ, i.e., no filter removed, raise exception. -delete_obj(List,List) -> corba:raise(#'CosNotifyFilter_FilterNotFound'{}); -delete_obj(List,_) -> List. - -%%----------------------------------------------------------- -%% function : callSeq -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -callSeq(_OE_THIS, OE_FROM, State, EventsIn, Status) -> - corba:reply(OE_FROM, ok), - case cosNotification_eventDB:validate_event(?get_SubscribeData(State), EventsIn, - ?get_AllFilter(State), - ?get_SubscribeDB(State), - Status) of - {[],_} -> - ?DBG("PROXY NOSUBSCRIPTION SEQUENCE/STRUCTURED: ~p~n",[EventsIn]), - {noreply, State}; - {Events,_} when ?is_Suspended(State) -> - store_events(State, Events), - {noreply, State}; - {Events,_} when ?is_UnConnected(State) -> - orber:dbg("[~p] PusherSupplier:callAny();~n" - "Not connected, dropping event(s): ~p", - [?LINE, Events], ?DEBUG_LEVEL), - {noreply, State}; - {[Event],_} when ?is_STRUCTURED(State) -> - ?DBG("PROXY RECEIVED SEQUENCE: ~p~n",[Event]), - empty_db(State, ?addAndGet_Event(State, Event)); - {[Event],_} when ?is_ANY(State) -> - ?DBG("PROXY RECEIVED SEQUENCE: ~p~n",[Event]), - AnyEvent = any:create('CosNotification_StructuredEvent':tc(),Event), - empty_db(State, ?addAndGet_Event(State, AnyEvent)); - {Events,_} -> - ?DBG("PROXY RECEIVED SEQUENCE: ~p~n",[Events]), - store_events(State, Events), - lookup_and_push(State) - end. - -%%----------------------------------------------------------- -%% function : callAny -%% Arguments: -%% Returns : -%%----------------------------------------------------------- -callAny(_OE_THIS, OE_FROM, State, EventIn, Status) -> - corba:reply(OE_FROM, ok), - case cosNotification_eventDB:validate_event(?get_SubscribeData(State), EventIn, - ?get_AllFilter(State), - ?get_SubscribeDB(State), - Status) of - {[],_} -> - ?DBG("PROXY NOSUBSCRIPTION ANY: ~p~n",[EventIn]), - %% To be on the safe side, test if there are any events that not - %% have been forwarded (should only be possible if StartTime is used). - lookup_and_push(State); - {Event,_} when ?is_Suspended(State), ?is_ANY(State) -> - ?add_Event(State, Event), - {noreply, State}; - {Event,_} when ?is_Suspended(State) -> - ?add_Event(State, ?not_CreateSE("","%ANY","",[],[],Event)), - {noreply, State}; - {Event,_} when ?is_UnConnected(State) -> - orber:dbg("[~p] PusherSupplier:callAny();~n" - "Not connected, dropping event: ~p", - [?LINE, Event], ?DEBUG_LEVEL), - {noreply, State}; - {Event,_} when ?is_ANY(State) -> - ?DBG("PROXY RECEIVED ANY: ~p~n",[Event]), - %% We must store the event since there may be other events that should - %% be delivered first, e.g., higher priority. - empty_db(State, ?addAndGet_Event(State, Event)); - {Event,_} when ?is_SEQUENCE(State) -> - ?DBG("PROXY RECEIVED ANY==>SEQUENCE: ~p~n",[Event]), - StrEvent = ?not_CreateSE("","%ANY","",[],[],Event), - ?add_Event(State, StrEvent), - lookup_and_push(State); - {Event,_} -> - ?DBG("PROXY RECEIVED ANY==>STRUCTURED: ~p~n",[Event]), - StrEvent = ?not_CreateSE("","%ANY","",[],[],Event), - empty_db(State, ?addAndGet_Event(State, StrEvent)) - end. - -%% Lookup and push "the correct" amount of events. -lookup_and_push(State) -> - %% The boolean indicates, if false, that we will only push events if we have - %% passed the BatchLimit. If true we will ignore this limit and push events - %% anyway (typcially invoked when pacing limit passed). - lookup_and_push(State, false). -lookup_and_push(State, false) when ?is_SEQUENCE(State) -> - case ?is_BatchLimitReached(State) of - true -> - case ?get_Events(State, ?get_BatchLimit(State)) of - {[], _, _} -> - ?DBG("BATCHLIMIT (~p) REACHED BUT NO EVENTS FOUND~n", - [?get_BatchLimit(State)]), - {noreply, State}; - {Events, _, Keys} -> - ?DBG("BATCHLIMIT (~p) REACHED, EVENTS FOUND: ~p~n", - [?get_BatchLimit(State), Events]), - case catch 'CosNotifyComm_SequencePushConsumer': - push_structured_events(?get_Client(State), Events) of - ok -> - cosNotification_eventDB:delete_events(Keys), - lookup_and_push(reset_cache(State), false); - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') orelse - is_record(E, 'NO_PERMISSION') orelse - is_record(E, 'CosEventComm_Disconnected') -> - ?DBG("PUSH SUPPLIER CLIENT NO LONGER EXIST~n", []), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, {'EXCEPTION', E}}]), - {stop, normal, State}; - What when ?is_PersistentEvent(State), - ?is_PersistentConnection(State) -> - orber:dbg("[~p] PusherSupplier:lookup_and_push();~n" - "Client respond incorrect: ~p", - [?LINE, What], ?DEBUG_LEVEL), - check_cache(State); - What when ?is_PersistentConnection(State) -> - %% Here we should do something when we want to handle - %% Persistent EventReliability. - orber:dbg("[~p] PusherSupplier:lookup_and_push();~n" - "Client respond incorrect: ~p~n" - "Dropping events: ~p", - [?LINE, What, Events], ?DEBUG_LEVEL), - cosNotification_eventDB:delete_events(Keys), - {noreply, State}; - WhatII -> - orber:dbg("[~p] PusherSupplier:lookup_and_push();~n" - "Client respond incorrect: ~p~n" - "Terminating and dropping events: ~p", - [?LINE, WhatII, Events], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, WhatII}]), - {stop, normal, State} - end - end; - _ -> - ?DBG("BATCHLIMIT (~p) NOT REACHED~n",[?get_BatchLimit(State)]), - {noreply, State} - end; -lookup_and_push(State, true) when ?is_SEQUENCE(State) -> - case ?get_Events(State, ?get_BatchLimit(State)) of - {[], _, _} -> - ?DBG("PACELIMIT REACHED BUT NO EVENTS FOUND~n", []), - {noreply, State}; - {Events, _, Keys} -> - ?DBG("PACELIMIT REACHED, EVENTS FOUND: ~p~n", [Events]), - case catch 'CosNotifyComm_SequencePushConsumer': - push_structured_events(?get_Client(State), Events) of - ok -> - cosNotification_eventDB:delete_events(Keys), - lookup_and_push(reset_cache(State), false); - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') orelse - is_record(E, 'NO_PERMISSION') orelse - is_record(E, 'CosEventComm_Disconnected') -> - orber:dbg("[~p] PusherSupplier:lookup_and_push();~n" - "Client no longer exists; terminating and dropping events: ~p", - [?LINE, Events], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, {'EXCEPTION', E}}]), - {stop, normal, State}; - What when ?is_PersistentEvent(State), - ?is_PersistentConnection(State) -> - orber:dbg("[~p] PusherSupplier:lookup_and_push();~n" - "Client respond incorrect: ~p", - [?LINE, What], ?DEBUG_LEVEL), - check_cache(State); - What when ?is_PersistentConnection(State) -> - %% Here we should do something when we want to handle - %% Persistent EventReliability. - orber:dbg("[~p] PusherSupplier:lookup_and_push();~n" - "Client respond incorrect: ~p~n" - "Dropping events: ~p", - [?LINE, What, Events], ?DEBUG_LEVEL), - cosNotification_eventDB:delete_events(Keys), - {noreply, State}; - WhatII -> - orber:dbg("[~p] PusherSupplier:lookup_and_push();~n" - "Client respond incorrect: ~p~n" - "Terminating and dropping events: ~p", - [?LINE, WhatII, Events], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, WhatII}]), - {stop, normal, State} - end - end; -lookup_and_push(State, _) -> - empty_db(State, ?get_Event(State)). - - -%% Push all events stored while not connected or received in sequence. -empty_db(State, {[], _, _}) -> - {noreply, State}; -empty_db(State, {Event, _, Keys}) when ?is_STRUCTURED(State) -> - case catch 'CosNotifyComm_StructuredPushConsumer': - push_structured_event(?get_Client(State), Event) of - ok -> - cosNotification_eventDB:delete_events(Keys), - NewState = reset_cache(State), - empty_db(NewState, ?get_Event(NewState)); - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') orelse - is_record(E, 'NO_PERMISSION') orelse - is_record(E, 'CosEventComm_Disconnected') -> - orber:dbg("[~p] PusherSupplier:empty_db();~n" - "Client no longer exists; terminating and dropping: ~p", - [?LINE, Event], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, {'EXCEPTION', E}}]), - {stop, normal, State}; - What when ?is_PersistentEvent(State), - ?is_PersistentConnection(State) -> - orber:dbg("[~p] PusherSupplier:lookup_and_push();~n" - "Client respond incorrect: ~p", - [?LINE, What], ?DEBUG_LEVEL), - check_cache(State); - What when ?is_PersistentConnection(State) -> - %% Here we should do something when we want to handle - %% Persistent EventReliability. - orber:dbg("[~p] PusherSupplier:empty_db();~n" - "Client respond incorrect: ~p~n" - "Dropping event: ~p", - [?LINE, What, Event], ?DEBUG_LEVEL), - cosNotification_eventDB:delete_events(Keys), - {noreply, State}; - WhatII -> - orber:dbg("[~p] PusherSupplier:empty_db();~n" - "Client respond incorrect: ~p~n" - "Terminating and dropping: ~p", - [?LINE, WhatII, Event], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, WhatII}]), - {stop, normal, State} - end; -empty_db(State, {Event, _, Keys}) when ?is_ANY(State) -> - case catch 'CosEventComm_PushConsumer':push(?get_Client(State), Event) of - ok -> - cosNotification_eventDB:delete_events(Keys), - NewState = reset_cache(State), - empty_db(NewState, ?get_Event(NewState)); - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') orelse - is_record(E, 'NO_PERMISSION') orelse - is_record(E, 'CosEventComm_Disconnected') -> - orber:dbg("[~p] PusherSupplier:empty_db();~n" - "Client no longer exists; terminating and dropping: ~p", - [?LINE, Event], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, {'EXCEPTION', E}}]), - {stop, normal, State}; - What when ?is_PersistentEvent(State), - ?is_PersistentConnection(State) -> - orber:dbg("[~p] PusherSupplier:lookup_and_push();~n" - "Client respond incorrect: ~p", - [?LINE, What], ?DEBUG_LEVEL), - check_cache(State); - What when ?is_PersistentConnection(State) -> - %% Here we should do something when we want to handle - %% Persistent EventReliability. - orber:dbg("[~p] PusherSupplier:empty_db();~n" - "Client respond incorrect: ~p~n" - "Dropping Event: ~p", - [?LINE, What, Event], ?DEBUG_LEVEL), - cosNotification_eventDB:delete_events(Keys), - {noreply, State}; - WhatII -> - orber:dbg("[~p] PusherSupplier:empty_db();~n" - "Client respond incorrect: ~p~n" - "Terminating and dropping: ~p", - [?LINE, WhatII, Event], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, ?get_Client(State)}, - {reason, WhatII}]), - {stop, normal, State} - end. - -reset_cache(#state{cacheTimeout = undefined, - cacheInterval = undefined} = State) -> - State; -reset_cache(State) -> - stop_timer(State#state.cacheTimeout), - stop_timer(State#state.cacheInterval), - State#state{cacheTimeout = undefined, - cacheInterval = undefined}. - -check_cache(#state{maxCache = Max, cacheTimeout = Timeout, - cacheInterval = Interval} = State) -> - case cosNotification_eventDB:status(State#state.eventDB, eventCounter) of - Count when Count > Max -> - %% Reached the upper limit, terminate. - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, State#state.client}, - {reason, {max_events, Max}}]), - {stop, normal, State}; - _ when Timeout == undefined, Interval == undefined -> - case {timer:send_interval(cosNotificationApp:interval_events(), - cacheInterval), - timer:send_after(cosNotificationApp:timeout_events(), - cacheTimeout)} of - {{ok, IntervalRef}, {ok, TimeoutRef}} -> - {noreply, State#state{cacheTimeout = TimeoutRef, - cacheInterval = IntervalRef}}; - Error -> - orber:dbg("[~p] PusherSupplier:check_cache();~n" - "Unable to start timers: ~p", - [?LINE, Error], ?DEBUG_LEVEL), - 'CosNotification_Common':notify([{proxy, State#state.this}, - {client, State#state.client}, - {reason, {timer, Error}}]), - {stop, normal, State} - end; - _ -> - %% Timers already started. - {noreply, State} - end. - -store_events(_State, []) -> - ok; -store_events(State, [Event|Rest]) when ?is_ANY(State) -> - AnyEvent = any:create('CosNotification_StructuredEvent':tc(),Event), - ?add_Event(State, AnyEvent), - store_events(State, Rest); -store_events(State, [Event|Rest]) -> - ?add_Event(State, Event), - store_events(State, Rest). - -%% Start timers which send a message each time we should push events. Only used -%% when this objects is defined to supply sequences. -start_timer(State) -> - case ?get_PacingInterval(State) of - 0 -> - ?DBG("PUSH SUPPLIER STARTED NO TIMER (0), BATCH LIMIT: ~p~n", - [?get_BatchLimit(State)]), - - State; - PacInt -> - case catch timer:send_interval(timer:seconds(PacInt), pacing) of - {ok,PacTRef} -> - ?DBG("PUSH SUPPLIER STARTED TIMER, BATCH LIMIT: ~p~n", - [?get_BatchLimit(State)]), - ?set_PacingTimer(State, PacTRef); - What -> - orber:dbg("[~p] PusherSupplier:start_timer();~n" - "Unable to invoke timer:send_interval/2: ~p", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end - end. - -stop_timer(undefined) -> - ?DBG("PUSH SUPPLIER HAVE NO TIMER TO STOP~n",[]), - ok; -stop_timer(Timer) -> - ?DBG("PUSH SUPPLIER STOPPED TIMER~n",[]), - timer:cancel(Timer), - ok. - - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/cosNotification.app.src b/lib/cosNotification/src/cosNotification.app.src deleted file mode 100644 index 52ce164d46..0000000000 --- a/lib/cosNotification/src/cosNotification.app.src +++ /dev/null @@ -1,122 +0,0 @@ -{application, cosNotification, - [{description, "The Erlang CosNotification application"}, - {vsn, "%VSN%"}, - {modules, - [ - 'CosNotification_Common', - 'CosNotifyChannelAdmin_ConsumerAdmin_impl', - 'CosNotifyChannelAdmin_EventChannelFactory_impl', - 'CosNotifyChannelAdmin_EventChannel_impl', - 'CosNotifyChannelAdmin_SupplierAdmin_impl', - 'PullerConsumer_impl', - 'PullerSupplier_impl', - 'PusherConsumer_impl', - 'PusherSupplier_impl', - 'cosNotificationApp', - 'CosNotifyFilter_Filter_impl', - 'CosNotifyFilter_MappingFilter_impl', - 'CosNotifyFilter_FilterFactory_impl', - 'cosNotification_Scanner', - 'cosNotification_Grammar', - 'cosNotification_Filter', - 'cosNotification_eventDB', - 'oe_CosNotification', - 'oe_cosNotificationAppComm', - 'oe_CosNotificationComm_Event', - 'CosNotification', - 'CosNotification_AdminPropertiesAdmin', - 'CosNotification_EventHeader', - 'CosNotification_EventType', - 'CosNotification_FixedEventHeader', - 'CosNotification_NamedPropertyRange', - 'CosNotification_Property', - 'CosNotification_PropertyError', - 'CosNotification_PropertyRange', - 'CosNotification_QoSAdmin', - 'CosNotification_StructuredEvent', - 'CosNotification_UnsupportedAdmin', - 'CosNotification_UnsupportedQoS', - 'CosNotification_EventBatch', - 'CosNotification_EventTypeSeq', - 'CosNotification_NamedPropertyRangeSeq', - 'CosNotification_PropertyErrorSeq', - 'CosNotification_PropertySeq', - 'oe_CosNotifyChannelAdmin', - 'CosNotifyChannelAdmin_AdminLimit', - 'CosNotifyChannelAdmin_AdminLimitExceeded', - 'CosNotifyChannelAdmin_AdminNotFound', - 'CosNotifyChannelAdmin_ChannelNotFound', - 'CosNotifyChannelAdmin_ConnectionAlreadyActive', - 'CosNotifyChannelAdmin_ConnectionAlreadyInactive', - 'CosNotifyChannelAdmin_ConsumerAdmin', - 'CosNotifyChannelAdmin_EventChannel', - 'CosNotifyChannelAdmin_EventChannelFactory', - 'CosNotifyChannelAdmin_NotConnected', - 'CosNotifyChannelAdmin_ProxyConsumer', - 'CosNotifyChannelAdmin_ProxyNotFound', - 'CosNotifyChannelAdmin_ProxyPullConsumer', - 'CosNotifyChannelAdmin_ProxyPullSupplier', - 'CosNotifyChannelAdmin_ProxyPushConsumer', - 'CosNotifyChannelAdmin_ProxyPushSupplier', - 'CosNotifyChannelAdmin_ProxySupplier', - 'CosNotifyChannelAdmin_SequenceProxyPullConsumer', - 'CosNotifyChannelAdmin_SequenceProxyPullSupplier', - 'CosNotifyChannelAdmin_SequenceProxyPushConsumer', - 'CosNotifyChannelAdmin_SequenceProxyPushSupplier', - 'CosNotifyChannelAdmin_StructuredProxyPullConsumer', - 'CosNotifyChannelAdmin_StructuredProxyPullSupplier', - 'CosNotifyChannelAdmin_StructuredProxyPushConsumer', - 'CosNotifyChannelAdmin_StructuredProxyPushSupplier', - 'CosNotifyChannelAdmin_SupplierAdmin', - 'CosNotifyChannelAdmin_AdminIDSeq', - 'CosNotifyChannelAdmin_ChannelIDSeq', - 'CosNotifyChannelAdmin_ProxyIDSeq', - 'oe_CosNotifyComm', - 'CosNotifyComm_InvalidEventType', - 'CosNotifyComm_NotifyPublish', - 'CosNotifyComm_NotifySubscribe', - 'CosNotifyComm_PullConsumer', - 'CosNotifyComm_PullSupplier', - 'CosNotifyComm_PushConsumer', - 'CosNotifyComm_PushSupplier', - 'CosNotifyComm_SequencePullConsumer', - 'CosNotifyComm_SequencePullSupplier', - 'CosNotifyComm_SequencePushConsumer', - 'CosNotifyComm_SequencePushSupplier', - 'CosNotifyComm_StructuredPullConsumer', - 'CosNotifyComm_StructuredPullSupplier', - 'CosNotifyComm_StructuredPushConsumer', - 'CosNotifyComm_StructuredPushSupplier', - 'oe_CosNotifyFilter', - 'CosNotifyFilter_CallbackNotFound', - 'CosNotifyFilter_ConstraintExp', - 'CosNotifyFilter_ConstraintInfo', - 'CosNotifyFilter_ConstraintNotFound', - 'CosNotifyFilter_DuplicateConstraintID', - 'CosNotifyFilter_Filter', - 'CosNotifyFilter_FilterAdmin', - 'CosNotifyFilter_FilterFactory', - 'CosNotifyFilter_FilterNotFound', - 'CosNotifyFilter_InvalidConstraint', - 'CosNotifyFilter_InvalidGrammar', - 'CosNotifyFilter_InvalidValue', - 'CosNotifyFilter_MappingConstraintInfo', - 'CosNotifyFilter_MappingConstraintPair', - 'CosNotifyFilter_MappingFilter', - 'CosNotifyFilter_UnsupportedFilterableData', - 'CosNotifyFilter_CallbackIDSeq', - 'CosNotifyFilter_ConstraintExpSeq', - 'CosNotifyFilter_ConstraintIDSeq', - 'CosNotifyFilter_ConstraintInfoSeq', - 'CosNotifyFilter_FilterIDSeq', - 'CosNotifyFilter_MappingConstraintInfoSeq', - 'CosNotifyFilter_MappingConstraintPairSeq' - ] - }, - {registered, [cosNotificationSup, oe_cosNotificationFactory]}, - {applications, [orber, stdlib, kernel]}, - {env, []}, - {mod, {cosNotificationApp, []}}, - {runtime_dependencies, ["stdlib-2.5","orber-3.6.27","kernel-3.0","erts-7.0", - "cosTime-1.1.14","cosEvent-2.1.15"]} -]}. diff --git a/lib/cosNotification/src/cosNotification.appup.src b/lib/cosNotification/src/cosNotification.appup.src deleted file mode 100644 index 6c3b2833b7..0000000000 --- a/lib/cosNotification/src/cosNotification.appup.src +++ /dev/null @@ -1,7 +0,0 @@ -{"%VSN%", - [ - ], - [ - ] -}. - diff --git a/lib/cosNotification/src/cosNotificationApp.erl b/lib/cosNotification/src/cosNotificationApp.erl deleted file mode 100644 index f6231ed47e..0000000000 --- a/lib/cosNotification/src/cosNotificationApp.erl +++ /dev/null @@ -1,436 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : cosNotificationApp.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module(cosNotificationApp). - -%%--------------- INCLUDES ----------------------------------- -%% Local --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). - --include("CosNotification_Definitions.hrl"). -%%--------------- EXPORTS------------------------------------- -%% cosNotification API external --export([start/0, stop/0, - start_factory/1, start_factory/0, stop_factory/1, - start_global_factory/0, start_global_factory/1, - start_filter_factory/1, start_filter_factory/0, stop_filter_factory/1, - install/0, install/1, uninstall/0, uninstall/1, - install_event/0, install_event/1, uninstall_event/0, uninstall_event/1, - install_typed/0, install_typed/1, uninstall_typed/0, uninstall_typed/1, - create_structured_event/6, type_check/0, notify/0, max_events/0, - timeout_events/0, interval_events/0]). - -%% Application callbacks --export([start/2, init/1, stop/1]). - -%%--------------- DEFINES ------------------------------------ --define(IDL_MODULES, ['oe_CosNotification', - 'oe_cosNotificationAppComm', - 'oe_CosNotifyComm', - 'oe_CosNotifyFilter', - 'oe_CosNotifyChannelAdmin']). --define(EVENT_IDL_MODULES, ['oe_CosEventComm', - 'oe_CosEventChannelAdmin']). --define(TYPED_IDL_MODULES, ['oe_CosTypedEvent', - 'oe_CosTypedNotification']). - --define(FACTORY_NAME, oe_cosNotificationFactory). --define(SUPERVISOR_NAME, cosNotificationSup). - - -%%------------------------------------------------------------ -%% function : install/X -%% Arguments: - | Time (seconds) -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Install necessary data in the IFR DB -%%------------------------------------------------------------ - -install() -> - install(0). - -install(Time) when is_integer(Time) -> - install_loop(?IDL_MODULES, timer:seconds(Time)); -install(_Time) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%------------------------------------------------------------ -%% function : install_event/X -%% Arguments: - | Time (seconds) -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Install necessary data in the IFR DB -%%------------------------------------------------------------ - -install_event() -> - install_event(0). - -install_event(Time) when is_integer(Time) -> - install_loop(?EVENT_IDL_MODULES, timer:seconds(Time)); -install_event(_Time) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%------------------------------------------------------------ -%% function : install_typed/X -%% Arguments: - | Time (seconds) -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Install necessary data in the IFR DB -%%------------------------------------------------------------ - -install_typed() -> - install_typed(0). - -install_typed(Time) when is_integer(Time) -> - install_loop(?TYPED_IDL_MODULES, timer:seconds(Time)); -install_typed(_Time) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -install_loop([], _) -> - ok; -install_loop([H|T], Time) -> - H:'oe_register'(), - timer:sleep(Time), - install_loop(T, Time). - -%%------------------------------------------------------------ -%% function : uninstall/X -%% Arguments: - | Time (seconds) -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Remove data related to cosNotificationin from the IFR DB -%%------------------------------------------------------------ - -uninstall() -> - uninstall(0). - -uninstall(Time) when is_integer(Time) -> - uninstall_loop(lists:reverse(?IDL_MODULES), timer:seconds(Time)); -uninstall(_Time) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%------------------------------------------------------------ -%% function : uninstall_event/X -%% Arguments: - | Time (seconds) -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Remove data related to cosNotificationin from the IFR DB -%%------------------------------------------------------------ - -uninstall_event() -> - uninstall_event(0). - -uninstall_event(Time) when is_integer(Time) -> - uninstall_loop(lists:reverse(?EVENT_IDL_MODULES), timer:seconds(Time)); -uninstall_event(_Time) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%------------------------------------------------------------ -%% function : uninstall_typed/X -%% Arguments: - | Time (seconds) -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Remove data related to cosNotificationin from the IFR DB -%%------------------------------------------------------------ - -uninstall_typed() -> - uninstall_typed(0). - -uninstall_typed(Time) when is_integer(Time) -> - uninstall_loop(lists:reverse(?TYPED_IDL_MODULES), timer:seconds(Time)); -uninstall_typed(_Time) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -uninstall_loop([], _) -> - ok; -uninstall_loop([H|T], Time) -> - H:'oe_unregister'(), - timer:sleep(Time), - uninstall_loop(T, Time). - - -%%------------------------------------------------------------ -%% function : start/stop -%% Arguments: -%% Returns : -%% Effect : Starts or stops the cosTRansaction application. -%%------------------------------------------------------------ - -start() -> - application:start(cosNotification). -stop() -> - application:stop(cosNotification). - -%%------------------------------------------------------------ -%% function : start_factory -%% Arguments: none or an argumentlist whith default values. -%% Returns : ObjectRef | {'EXCEPTION', _} | {'EXIT', Reason} -%% Effect : Starts a CosNotifyChannelAdmin_EventChannelFactory -%%------------------------------------------------------------ -start_factory() -> - start_factory(?not_DEFAULT_SETTINGS). - -start_factory(Args) when is_list(Args) -> - SO = 'CosNotification_Common':get_option(server_options, Args, ?not_DEFAULT_SETTINGS), - SPEC = ['CosNotifyChannelAdmin_EventChannelFactory',Args, - [{sup_child, true}, - {regname, {local, oe_cosNotificationFactory}}|SO]], - case supervisor:start_child(?SUPERVISOR_NAME, SPEC) of - {ok, Pid, Obj} when is_pid(Pid) -> - Obj; - Other-> - orber:dbg("[~p] cosNotificationApp:start_factory( ~p ).~n" - "Reason: ~p~n", [?LINE, Args, Other], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end; -start_factory(Args) -> - orber:dbg("[~p] cosNotificationApp:start_factory( ~p ).~n" - "Bad parameters~n", [?LINE, Args], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%------------------------------------------------------------ -%% function : start_global_factory -%% Arguments: none or an argumentlist whith default values. -%% Returns : ObjectRef | {'EXCEPTION', _} | {'EXIT', Reason} -%% Effect : Starts a CosNotifyChannelAdmin_EventChannelFactory -%%------------------------------------------------------------ -start_global_factory() -> - start_global_factory(?not_DEFAULT_SETTINGS). - -start_global_factory(Args) when is_list(Args) -> - SO = 'CosNotification_Common':get_option(server_options, Args, ?not_DEFAULT_SETTINGS), - Name = 'CosNotification_Common':create_name(), - SPEC = ['CosNotifyChannelAdmin_EventChannelFactory',Args, - [{sup_child, true}, - {regname, {global, Name}}|SO]], - case supervisor:start_child(?SUPERVISOR_NAME, SPEC) of - {ok, Pid, Obj} when is_pid(Pid) -> - Obj; - Other-> - orber:dbg("[~p] cosNotificationApp:start_global_factory( ~p ).~n" - "Reason: ~p~n", [?LINE, Args, Other], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end; -start_global_factory(Args) -> - orber:dbg("[~p] cosNotificationApp:start_global_factory( ~p ).~n" - "Bad parameters~n", [?LINE, Args], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - - -%%------------------------------------------------------------ -%% function : stop_factory -%% Arguments: Factory Object Reference -%% Returns : ok | {'EXCEPTION', _} -%% Effect : -%%------------------------------------------------------------ - -stop_factory(Fac)-> - corba:dispose(Fac). - -%%------------------------------------------------------------ -%% function : start_filter_factory -%% Arguments: none or an argumentlist which by default is defined -%% in CosNotification_Definitions.hrl, i.e., '?not_FILTERFAC_DEF' -%% Returns : ObjectRef | {'EXCEPTION', _} | {'EXIT', Reason} -%% Effect : Starts a CosNotifyChannelAdmin_EventChannelFactory -%%------------------------------------------------------------ -start_filter_factory() -> - start_filter_factory([{typecheck, true}, - {tty, false}, - {logfile, false}, - {server_options, []}]). -start_filter_factory(Args) when is_list(Args) -> - SO = 'CosNotification_Common':get_option(server_options, Args, - ?not_DEFAULT_SETTINGS), - SPEC = ['CosNotifyFilter_FilterFactory',Args, [{sup_child, true}|SO]], - case supervisor:start_child(?SUPERVISOR_NAME, SPEC) of - {ok, Pid, Obj} when is_pid(Pid) -> - Obj; - Other-> - orber:dbg("[~p] cosNotificationApp:start_filter_factory( ~p ).~n" - "Reason: ~p~n", [?LINE, Args, Other], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end; -start_filter_factory(Args) -> - orber:dbg("[~p] cosNotificationApp:start_filter_factory( ~p ).~n" - "Bad parameters~n", [?LINE, Args], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - - -%%------------------------------------------------------------ -%% function : stop_filter_factory -%% Arguments: FilterFactory Object Reference -%% Returns : ok | {'EXCEPTION', _} -%% Effect : -%%------------------------------------------------------------ - -stop_filter_factory(Fac)-> - corba:dispose(Fac). - - -%%------------------------------------------------------------ -%% function : create_structured_event -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ -create_structured_event(StrD,StrT,StrE,PSeqV,PSeqF,AnyR) - when is_list(StrD) andalso is_list(StrT) andalso is_list(StrE) - andalso is_list(PSeqV) andalso is_list(PSeqF) andalso - is_record(AnyR, any) -> -#'CosNotification_StructuredEvent'{header = - #'CosNotification_EventHeader'{fixed_header = - #'CosNotification_FixedEventHeader'{event_type = - #'CosNotification_EventType'{domain_name=StrD, - type_name=StrT}, - event_name = StrE}, - variable_header = PSeqV}, - filterable_data = PSeqF, - remainder_of_body = AnyR}; -create_structured_event(_StrD,_StrT,_StrE,_PSeqV,_PSeqF,_AnyR) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - - -%%------------------------------------------------------------ -%% function : type_check -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ -type_check() -> - case application:get_env(cosNotification, type_check) of - {ok, Boolean} when is_atom(Boolean) -> - Boolean; - _ -> - true - end. - -%%------------------------------------------------------------ -%% function : notify -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ -notify() -> - case application:get_env(cosNotification, notify) of - {ok, Module} when is_atom(Module) -> - Module; - _ -> - false - end. - -%%------------------------------------------------------------ -%% function : max_events -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ -max_events() -> - case application:get_env(cosNotification, max_events) of - {ok, Max} when is_integer(Max) -> - Max; - _ -> - 50 - end. - -%%------------------------------------------------------------ -%% function : timeout_events -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ -timeout_events() -> - case application:get_env(cosNotification, timeout_events) of - {ok, Max} when is_integer(Max) -> - Max; - _ -> - 3000000 %% 5 minutes - end. - - -%%------------------------------------------------------------ -%% function : interval_events -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ -interval_events() -> - case application:get_env(cosNotification, interval_events) of - {ok, Max} when is_integer(Max) -> - Max; - _ -> - 10000 %% 10 seconds - end. - - -%%------------------------------------------------------------ -%% function : start -%% Arguments: Type - see module application -%% Arg - see module application -%% Returns : -%% Effect : Module callback for application -%%------------------------------------------------------------ - -start(_, _) -> - supervisor:start_link({local, ?SUPERVISOR_NAME}, cosNotificationApp, app_init). - - -%%------------------------------------------------------------ -%% function : stop -%% Arguments: Arg - see module application -%% Returns : -%% Effect : Module callback for application -%%------------------------------------------------------------ - -stop(_) -> - ok. - -%%------------------------------------------------------------ -%% function : init -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ - -%% Starting using create_factory/X -init(own_init) -> - {ok,{{simple_one_for_one,50,10}, - [{"oe_NotChild", - {'CosNotification_Common',create_link, []}, - transient,100000,worker, - ['CosNotifyChannelAdmin_EventChannel', - 'CosNotifyChannelAdmin_EventChannel_impl']}]}}; -%% When starting as an application. -init(app_init) -> - {ok,{{simple_one_for_one,50,10}, - [{"oe_NotChild", - {'CosNotification_Common',create_link, []}, - transient,100000,worker, - ['CosNotifyChannelAdmin_EventChannel', - 'CosNotifyChannelAdmin_EventChannel_impl']}]}}. - - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/cosNotificationAppComm.idl b/lib/cosNotification/src/cosNotificationAppComm.idl deleted file mode 100644 index 09e0af2568..0000000000 --- a/lib/cosNotification/src/cosNotificationAppComm.idl +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef _OE_COSNOTIFICATIONCOMM_IDL_ -#define _OE_COSNOTIFICATIONCOMM_IDL_ - -#include - -module oe_CosNotificationComm { - - interface Event { - - enum status {MATCH, MATCHED}; - void callSeq(in CosNotification::EventBatch events, in status stat); - void callAny(in any event, in status stat); - }; - -}; -#endif /* ifndef _OE_COSNOTIFICATIONCOMM_IDL_ */ - diff --git a/lib/cosNotification/src/cosNotificationComm.cfg b/lib/cosNotification/src/cosNotificationComm.cfg deleted file mode 100644 index 89d207528d..0000000000 --- a/lib/cosNotification/src/cosNotificationComm.cfg +++ /dev/null @@ -1,3 +0,0 @@ -{this, "oe_CosNotificationComm::Event"}. -{from, "oe_CosNotificationComm::Event"}. -{{handle_info, "oe_CosNotificationComm::Event"}, true}. diff --git a/lib/cosNotification/src/cosNotification_Filter.erl b/lib/cosNotification/src/cosNotification_Filter.erl deleted file mode 100644 index a92c9b8d41..0000000000 --- a/lib/cosNotification/src/cosNotification_Filter.erl +++ /dev/null @@ -1,965 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : cosNotification_Filter.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module(cosNotification_Filter). - - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). - --include("CosNotification_Definitions.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%% Internal Filter Functions --export([eval/1, - eval/2, - create_filter/1, - check_types/1, - match_types/3, - validate_types/1]). - -%%--------------- DEFINES ------------------------------------ --define(EVENT_PATH, [{dotid,"header"}, {dotid,"fixed_header"}, - {dotid,"event_name"}]). --define(DOMAIN_PATH, [{dotid,"header"}, {dotid,"fixed_header"}, - {dotid,"event_type"}, {dotid,"domain_name"}]). --define(TYPE_PATH, [{dotid,"header"}, {dotid,"fixed_header"}, - {dotid,"event_type"}, {dotid,"type_name"}]). --define(VARIABLE_PATH(I), [{dotid,"header"}, {dotid,"variable_header"}, {dotid,I}]). --define(FILTERABLE_PATH(I), [{dotid,"filterable_data"}, {dotid,I}]). - - -%%------------------------------------------------------------ -%%--------------- FILTER FUNCTIONS --------------------------- -%%------------------------------------------------------------ -%%------------------------------------------------------------ -%% function : create_filter/1 -%% Arguments: String - Filter grammar -%% Returns : -%% Effect : -%%------------------------------------------------------------ -create_filter(Str) -> - {ok, Tokens} = cosNotification_Scanner:scan(Str), - case cosNotification_Grammar:parse(Tokens) of - {ok, Filter} -> - {ok, Filter}; - _-> - corba:raise(#'CosNotifyFilter_InvalidConstraint'{constr = Str}) - end. - -%%------------------------------------------------------------ -%% function : eval -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ - -eval('$empty') -> true; -eval(Tree) -> eval(Tree, []). - - -%% Leaf expressions (literals and idents). -eval('$empty', _) -> true; -eval(Lit, _Env) when is_number(Lit) -> Lit; -eval(Lit, _Env) when is_list(Lit) -> Lit; %list == string -eval(Lit, _Env) when is_atom(Lit) -> Lit; %atom == bool -eval({component, V}, []) -> - %% Cannot evaluate variables at this stage. - throw({error, {unbound_variable, V}}); -eval({component, V}, Env) -> - case catch lookup(V, Env, undefined) of - {ok, Val} -> - Val; - _X -> - {error, {unbound_variable, V}} - end; - -%% CORBA2.3-15/26 states: -%% "The name parameters in tk_objref, tk_struct, tk_union, tk_enum, tk_alias, -%% tk_value, tk_value_box, tk_abstract_interface, tk_native and tk_except TypeCodes -%% and the member name parameters in tk_struct, tk_union, tk_enum, tk_value and -%% tk_except TypeCodes are not specified by (or significant in) GIOP. Agents should -%% not make assumptions about type equivalence based on these name values; only the -%% structural information (including RepositoryId values, if provided) is -%% significant. If provided, the strings should be the simple, unscoped names -%% supplied in the OMG IDL definition text. If omitted, they are encoded as empty -%% strings." -%% Makes it rather hard to follow the grammar 100 %. -eval({default_component, V}, Env) -> - case catch lookup(V, Env, default_component) of - {ok, false} -> - false; - {ok, true} -> - true; - _X -> - {error, {unbound_variable, V}} - end; -eval({exist_component, V}, Env) -> - case catch lookup(V, Env, exist_component) of - {ok, false} -> - false; - {ok, _} -> - true; - {error, _} -> - false; - _X -> - {error, {unbound_variable, V}} - end; -%% Arithmetic expressions. -eval({'*', X, Y}, Env) -> - eval_arith({fun(_X, _Y) -> _X*_Y end, X, Y}, Env); -eval({'/', X, Y}, Env) -> - eval_arith({fun(_X, _Y) -> _X/_Y end, X, Y}, Env); -eval({'+', X, Y}, Env) -> - eval_arith({fun(_X, _Y) -> _X+_Y end, X, Y}, Env); -eval({'-', X, Y}, Env) -> - eval_arith({fun(_X, _Y) -> _X-_Y end, X, Y}, Env); -eval({'u-', X}, Env) -> - eval_arith({fun(_X) -> -_X end, X}, Env); -%% Relational expressions. -eval({'==', X, Y}, Env) -> - eval_rel({fun(_X, _Y) -> _X == _Y end, X, Y}, Env); -eval({'!=', X, Y}, Env) -> - eval_rel({fun(_X, _Y) -> _X /= _Y end, X, Y}, Env); -eval({'<', X, Y}, Env) -> - eval_rel({fun(_X, _Y) -> _X < _Y end, X, Y}, Env); -eval({'<=', X, Y}, Env) -> - eval_rel({fun(_X, _Y) -> _X =< _Y end, X, Y}, Env); -eval({'>', X, Y}, Env) -> - eval_rel({fun(_X, _Y) -> _X > _Y end, X, Y}, Env); -eval({'>=', X, Y}, Env) -> - eval_rel({fun(_X, _Y) -> _X >= _Y end, X, Y}, Env); -eval({'~', Needle, Haystack}, Env) -> %substring match - N = eval(Needle, Env), - H = eval(Haystack, Env), - if - is_list(N) andalso is_list(H) -> - string:str(H, N) /= 0; - true -> - throw({error, {bad_type, Needle, Haystack}}) - end; -eval({'in', Needle, Haystack}, Env) -> %set membership - N = eval(Needle, Env), - H = eval(Haystack, Env), - if - is_list(H) -> - lists:member(N, H); - true -> - throw({error, {bad_type, Needle, Haystack}}) - end; -%% Boolean expressions. -eval({'and', false, _Y}, _Env) -> - false; -eval({'and', _X, false}, _Env) -> - false; -eval({'and', X, Y}, Env) -> - eval_and_bool({fun(_X, _Y) -> _X and _Y end, X, Y}, Env); - -eval({'or', true, _Y}, _Env) -> - true; -eval({'or', _X, true}, _Env) -> - true; -eval({'or', X, Y}, Env) -> - eval_or_bool({fun(_X, _Y) -> _X or _Y end, X, Y}, Env); -eval({'not', X}, Env) -> - eval_bool({fun(_X) -> not _X end, X}, Env); -%% Catch-all -eval(_T, _Env) -> - throw({error, internal}). - -eval_bool({Fun, X}, Env) -> - Xe = eval(X, Env), - if - is_atom(Xe) -> - Fun(Xe); - true -> - throw({error, {bad_type, X}}) - end. -eval_and_bool({Fun, X, Y}, Env) -> - case eval(X, Env) of - false -> - %% No need for evaluating the other expression. - false; - Xe -> - Ye = eval(Y, Env), - if - is_atom(Xe) andalso is_atom(Ye) -> - Fun(Xe, Ye); - true -> - throw({error, {bad_type, X, Y}}) - end - end. -eval_or_bool({Fun, X, Y}, Env) -> - case eval(X, Env) of - true -> - %% No need for evaluating the other expression. - true; - Xe -> - Ye = eval(Y, Env), - if - is_atom(Xe) andalso is_atom(Ye) -> - Fun(Xe, Ye); - true -> - throw({error, {bad_type, X, Y}}) - end - end. - - -%% According to issue 2203, OMG stated that arithmetic operations involving booleans -%% is allowed. TRUE equals 1 and FALSE 0. They refer to: - -%% "We at NEC like this feature, and feel it is both required and -%% standard with the way CORBA treats boolean values. We feel it's -%% required because it allows the constraint grammar to handle -%% expressions that combine the results of boolean comparisons, -%% which we feel is typically expected of a constraint grammar -%% (e.g., ($.fruit == apples) + ($.color == red) + ($.kind == macintosh) > 2) -%% Furthermore, while we have no fundamental opposition to explicitly -%% stating that TRUE=1 and FALSE=0, we don't necessarily feel it's -%% necessary because section 12.3.1 of CORBA alread states that -%% "Boolean values are encoded as single octets, where TRUE is the -%% value 1, and FALSE is 0." Essentially, we feel CORBA already -%% defines TRUE to be 1 and FALSE to be 0, however we are not -%% opposed to adding such a statement into Notification if folks -%% feel it's necessary." -%% If still valid, see: ftp://ftp.omg.org/pub/docs/telecom/99-07-06.txt - -%% The section they refer to (CORBA-2.0) merely states that TRUE and FALSE are -%% encoded as 1 and 0 in GIOP. Does not imply that booleans may be used as numeric. -%% But, they have stated that this should be the case so..... - -remap_bool(Num) when is_number(Num) -> Num; -remap_bool(true) -> 1; -remap_bool(false) -> 0; -remap_bool(X) -> throw({error, {bad_type, X}}). - -eval_arith({Fun, X}, Env) -> - Xe = remap_bool(eval(X, Env)), - Fun(Xe); -eval_arith({Fun, X, Y}, Env) -> - Xe = remap_bool(eval(X, Env)), - Ye = remap_bool(eval(Y, Env)), - Fun(Xe, Ye). - -eval_rel({Fun, X, Y}, Env) -> - Xe = eval(X, Env), - Ye = eval(Y, Env), - if - is_number(Xe) andalso is_number(Ye) -> - Fun(Xe, Ye); - is_list(Xe) andalso is_list(Ye) -> - Fun(Xe, Ye); - is_atom(Xe) andalso is_atom(Ye) -> - Fun(Xe, Ye); - true -> - throw({error, {bad_type, X, Y}}) - end. - -%%------------------------------------------------------------ -%% function : get_variable -%% Arguments: A sequence of CosNotification::Property{}, i.e., -%% name-value pairs. -%% ID - name in the Property -%% Any - remainder of body -%% Returns : Value in the Property | false -%% Comment : When searching for a variable we must start with -%% 'variable_header' followed by 'filterable_body'. -%% If not found we will then look in the 'remainder_of_body' -%%------------------------------------------------------------ - -get_variable([], ID, Any) when is_record(Any, any) -> - case {any:get_value(Any), any:get_typecode(Any)} of - {#'CosNotification_Property'{name=ID, value=A}, _} -> - any:get_value(A); - {_, TC} when is_atom(TC) -> - %% Since TC atom it must be a simple type, which don't have members. - throw({error, {bad_id, ID}}); - {Value, {tk_alias,_,ID,_}} when is_record(Value, any) -> - %% {tk_alias, IFRId, ID, TypeCode} - any:get_value(Value); - {Value, {tk_alias,_,ID,_}} -> - %% {tk_alias, IFRId, ID, TypeCode} - Value; - {Value, _TC} -> - get_variable([],ID, Value) - end; -get_variable([], ID, #'CosNotification_Property'{name=ID, value=Any}) -> - any:get_value(Any); -get_variable([], ID, [#'CosNotification_Property'{name=ID, value=Any}|_]) -> - any:get_value(Any); -get_variable([], ID, [H|T]) when is_record(H, 'CosNotification_Property') -> - get_variable([], ID, T); -get_variable([], ID, false) -> - throw({error, {bad_id, ID}}); -get_variable([], ID, Value) -> - M = element(1, Value), - case catch M:tc() of - {tk_struct,_,_,SList} -> - %% {tk_struct, Id, Name, ElementList}. - Field = get_field(ID, SList), - element(Field, Value); - {tk_union,_,_,_, DefNo, UList} -> - %% {tk_union, Id, Name, DiscrTC, Default, ElementList} - case id2switch(UList, ID) of - [default] when DefNo >= 0 -> - element(3, Value); - [default] -> - throw({error, {bad_id, "Bad Union ID supplied"}}); - Found -> - case catch lists:member(element(2, Value), Found) of - true -> - element(3, Value); - _ -> - throw({error, {bad_id, "Bad Union ID supplied"}}) - end - end; - _-> - throw({error, {bad_id, ID}}) - end; -get_variable([#'CosNotification_Property'{name=ID, value=A}|_], ID, _) -> - any:get_value(A); -get_variable([_|T], ID, Any) -> - get_variable(T, ID, Any). - -%%------------------------------------------------------------ -%% function : lookup -%% Arguments: T - A parse tree representing the grammar. -%% S - The event we want to extract data from -%% Op - which type of lookup should be done on this -%% component, e.g., 'default' or 'exist'. -%% Returns : {ok, boolean()} | -%% {error, _} -%% Comment : WARNING!!!! -%% This function uses some Orber core information to -%% extract data, e.g., TypeCode representation. Why? -%% We don't want to see the performance take a plunge -%% due to that users write constraints which they -%% can/may not know is slow. The alternative would be -%% to use the IFR. However, these shortcuts aren't -%% that frequent and we can easily update the code. -%% To update, investigate: -%% * lookup/3 cases related to '_type_id' -%% * lookup/3 cases related to unions -%% * get_variable/3 -%% * id2switch/2 -%% * switch2alias/2 -%%------------------------------------------------------------ -%% Done parsing, return the result. -lookup([],S,_) -> {ok, S}; -lookup('$empty', #'CosNotification_StructuredEvent'{remainder_of_body = Any},_) -> - {ok, any:get_value(Any)}; -lookup('$empty',S,_) when is_record(S, any) -> - {ok, any:get_value(S)}; - -%%------- varid -------- -%% CosNotification-revision-98-11-01/46 states: -%% "The following rules govern translation of a run-time variable, $variable , -%% into a specific event field. If the run-time variable is reserved -%% (e.g., $curtime) this translation takes precedence. Next, the first matching -%% translation is chosen respectively from: -%% * a simple-typed member of $.header.fixed_header, -%% * properties in $.header.variable_header, -%% and properties in $.header.filterable_data. -%% If no match is found, the translation defaults to $.variable. -%% Given these rules, an unstructured event with a $.priority member and a -%% structured event using $.header.variable_header(priority) can be specified -%% in a generic constraint using the run-time variable $priority . -%% Alternatively, a constraint can be written specifically for a structured or -%% unstructured event by avoiding the use of run-time variables." - -%% The above contains one error; $.header.filterable_data is not a part of the -%% header, but contained in the event body. - -%% For any events we must first verify that a path exist, e.g., -%% "header"->"fixed_header"->"event_type"->"domain_name", otherwise we will -%% use {dotid, "xxx"}. -lookup([{varid, "type_name"}|T], - #'CosNotification_StructuredEvent' - {header = #'CosNotification_EventHeader' - {fixed_header = #'CosNotification_FixedEventHeader' - {event_type = #'CosNotification_EventType'{type_name=TN}}}}, Op) -> - lookup(T, TN, Op); -lookup([{varid, "type_name"}|T], Any, Op) when is_record(Any, any) -> - case locate_var([?TYPE_PATH, ?VARIABLE_PATH("type_name"), - ?FILTERABLE_PATH("type_name")], Any, Op) of - {ok, Val} -> - lookup(T, Val, Op); - _ -> - lookup(T, get_variable([], "type_name", Any), Op) - end; -lookup([{varid, "domain_name"}|T], - #'CosNotification_StructuredEvent' - {header = #'CosNotification_EventHeader' - {fixed_header = #'CosNotification_FixedEventHeader' - {event_type = #'CosNotification_EventType'{domain_name=DN}}}}, Op) -> - lookup(T, DN, Op); -lookup([{varid, "domain_name"}|T], Any, Op) when is_record(Any, any) -> - case locate_var([?DOMAIN_PATH, ?VARIABLE_PATH("domain_name"), - ?FILTERABLE_PATH("domain_name")], Any, Op) of - {ok, Val} -> - lookup(T, Val, Op); - _ -> - lookup(T, get_variable([], "domain_name", Any), Op) - end; -lookup([{varid, "event_name"}|T], - #'CosNotification_StructuredEvent' - {header = #'CosNotification_EventHeader' - {fixed_header = #'CosNotification_FixedEventHeader' - {event_name = EN}}}, Op) -> - lookup(T, EN, Op); -lookup([{varid, "event_name"}|T], Any, Op) when is_record(Any, any) -> - case locate_var([?EVENT_PATH, ?VARIABLE_PATH("event_name"), - ?FILTERABLE_PATH("event_name")], Any, Op) of - {ok, Val} -> - lookup(T, Val, Op); - _ -> - lookup(T, get_variable([], "event_name", Any), Op) - end; - -lookup([{varid, ID}|T], - #'CosNotification_StructuredEvent'{header = - #'CosNotification_EventHeader'{variable_header = VS}, - filterable_data = FS, - remainder_of_body = Any}, Op) -> - lookup(T, get_variable(VS++FS, ID, Any), Op); -lookup([{varid, ID}|T], Any, Op) -> - case locate_var([?VARIABLE_PATH(ID), ?FILTERABLE_PATH(ID)], Any, Op) of - {ok, Val} -> - lookup(T, Val, Op); - _ -> - lookup(T, get_variable([], ID, Any), Op) - end; - -%%------- dotid -------- -%% First level -lookup([{dotid, "header"}|T], - #'CosNotification_StructuredEvent'{header = S}, Op) -> - lookup(T, S, Op); -lookup([{dotid, "filterable_data"}|T], - #'CosNotification_StructuredEvent'{filterable_data = S}, Op) -> - lookup(T, S, Op); - -lookup([{dotid, remainder_of_body}|T], - #'CosNotification_StructuredEvent'{remainder_of_body = S}, Op) -> - lookup(T, S, Op); -%% Second level. Previous token must have been header -lookup([{dotid, "fixed_header"}|T], - #'CosNotification_EventHeader'{fixed_header = S}, Op) -> - lookup(T, S, Op); -lookup([{dotid, "variable_header"}|T], - #'CosNotification_EventHeader'{variable_header = S}, Op) -> - lookup(T, S, Op); -%% Third level. Previous token must have been fixed_header. -lookup([{dotid, "event_type"}|T], - #'CosNotification_FixedEventHeader'{event_type = S}, Op) -> - lookup(T, S, Op); -lookup([{dotid, "event_name"}|T], - #'CosNotification_FixedEventHeader'{event_name = S}, Op) -> - lookup(T, S, Op); -%% Fourth level. Previous token must have been event_type -lookup([{dotid, "domain_name"}|T], #'CosNotification_EventType'{domain_name = S}, Op) -> - lookup(T, S, Op); -lookup([{dotid, "type_name"}|T], #'CosNotification_EventType'{type_name = S}, Op) -> - lookup(T, S, Op); - -%% Leaf expressions -lookup([{dotid, "name"}|T], #'CosNotification_Property'{name=S}, Op) -> - lookup(T, S, Op); -lookup([{dotid, "value"}|T], #'CosNotification_Property'{value=S}, Op) -> - lookup(T, S, Op); - -lookup([{dotid, ID}|T], - #'CosNotification_StructuredEvent'{remainder_of_body = Any}, Op) -> - lookup(T, get_variable([], ID, Any), Op); -lookup([{dotid, ID}|T], Any, Op) -> - lookup(T, get_variable([], ID, Any), Op); - -lookup([{associd, ID}|T], S, Op) when is_list(S) -> - %% Refers to an associative array, i.e., a list of - %% #'CosNotification_Property'{name=ID, value=A} - lookup(T, get_variable(S, ID, false), Op); - -lookup([{dotint, Position}|T], S, Op) when is_record(S, any) -> - lookup(T, element(Position+2, any:get_value(S)), Op); -lookup([{dotint, Position}|T], S, Op) -> - lookup(T, element(Position+2, S), Op); - -lookup([{uint, ID}|T], S, Op) when is_record(S, any) -> - lookup([{uint, ID}|T], any:get_value(S), Op); -lookup([{uint, ID} |T], S, Op) when is_tuple(S) -> - case catch element(2, S) of - ID -> - %% The supplied union do contain the requested discriminator. - lookup(T, element(3, S), Op); - _Other when Op == exist_component -> - throw({error, {bad_id, "Bad Union ID"}}); - Other -> - %% Check if default is allowed. - M = element(1, S), - case catch M:tc() of - {tk_union,_,_,_,DefNo, UList} -> - %% {tk_union, Id, Name, DiscrTC, Default, ElementList} - case switch2alias(UList, ID) of - {ok, [], _} -> - throw({error, {bad_id, "Bad Union ID"}}); - {ok, default, _} when DefNo >= 0 -> - lookup(T, element(3, S), Op); - {ok, List, _} -> - case lists:member(Other, List) of - true -> - lookup(T, element(3, S), Op); - _-> - throw({error, {bad_id, "Bad Union ID"}}) - end - end - end - end; -lookup([{ustr, ID}|T], S, Op) when is_record(S, any) -> - lookup([{ustr, ID}|T], any:get_value(S), Op); -lookup([{ustr, ID}|T], S, Op) when is_tuple(S) -> - M = element(1, S), - case catch M:tc() of - {tk_union,_,_,_,DefNo, UList} -> - case id2switch(UList, ID) of - [default] when DefNo >= 0 -> - lookup(T, element(3, S), Op); - [default] -> - throw({error, {bad_id, "Bad Union ID supplied"}}); - Found -> - case catch lists:member(element(2, S), Found) of - true -> - lookup(T, element(3, S), Op); - _ -> - throw({error, {bad_id, "Bad Union ID supplied"}}) - end - end - end; -lookup([default|T], S, Op) when is_record(S, any) -> - lookup([default|T], any:get_value(S), Op); -lookup([default|T], S, Op) when is_tuple(S) -> - M = element(1, S), - case catch M:tc() of - {tk_union,_,_,_,DefNo, _UList} when DefNo < 0 -> - %% {tk_union, Id, Name, DiscrTC, Default, ElementList} - throw({error, {bad_id, "No default discriminator"}}); - {tk_union,_,_,_,_DefNo, UList} -> - %% {tk_union, Id, Name, DiscrTC, Default, ElementList} - %% Check if the label really is default. - case lists:keymember(element(2, S), 1, UList) of - false -> - lookup(T, element(3, S), Op); - _-> - throw({error, {bad_id, "Bad Union"}}) - end; - _-> - throw({error, {bad_id, "Bad Union"}}) - end; - -lookup([{arrindex, Index}|T], S, Op) when is_tuple(S) -> - %% The OMG uses c/c++ index. We must add one. - lookup(T, element(Index+1,S), Op); - -%%%%%%%%%%%%%%%%%%%%%%% LEAF EXPRESSIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% got '$._length', which maps to the 'remainder_of_body' -lookup(['_length'], - #'CosNotification_StructuredEvent'{remainder_of_body = Any}, _Op) -> - {ok, length(any:get_value(Any))}; -lookup(['_length'], S, _Op) when is_record(S, any) -> - {ok, length(any:get_value(S))}; -lookup(['_length'], S, _Op) when is_list(S) -> - {ok, length(S)}; -lookup(['_length'], S, _Op) when is_tuple(S) -> - {ok, length(tuple_to_list(S))}; - -%% got '$._d', which maps to the 'remainder_of_body' -%% The discriminator may, accordiong to the CORBA specification, be (2.3/p3-37): -%% * integer_type -%% * char_type -%% * boolean_type -%% * enum_type -%% * scoped_name -lookup(['_d'], - #'CosNotification_StructuredEvent'{remainder_of_body = Any}, - default_component) -> - lookup(['_d'], any:get_value(Any), default_component); -lookup(['_d'], S, default_component) when is_record(S, any) -> - lookup(['_d'], any:get_value(S), default_component); -lookup(['_d'], S, default_component) -> - M = element(1, S), - case catch M:tc() of - {tk_union,_,_,_,DefNo,_} when DefNo < 0 -> - %% '-1' indicates that no default value may exist. - {ok, false}; - {tk_union,_,_,_,_,UList} -> - %% May be using the default setting; check if the Value is in the list. - {ok, not lists:keymember(element(2, S), 1, UList)}; - _ -> - {ok, false} - end; -lookup(['_d'], - #'CosNotification_StructuredEvent'{remainder_of_body = Any}, _Op) -> - {ok, element(2, any:get_value(Any))}; -lookup(['_d'], S, _Op) when is_record(S, any) -> - {ok, element(2, any:get_value(S))}; -lookup(['_d'], S, _Op) -> - {ok, element(2, S)}; - - -lookup(['_type_id'], S, _Op) when is_record(S,'CosNotification_StructuredEvent') -> - {ok, "StructuredEvent"}; -lookup(['_type_id'], S, _Op) when is_record(S,'CosNotification_EventHeader') -> - {ok, "EventHeader"}; -lookup(['_type_id'], S, _Op) when is_record(S,'CosNotification_FixedEventHeader') -> - {ok, "FixedEventHeader"}; -lookup(['_type_id'], S, _Op) when is_record(S,'CosNotification_EventType') -> - {ok, "EventType"}; -lookup(['_type_id'], S, _Op) when is_record(S,'CosNotification_Property') -> - {ok, "Property"}; -lookup(['_type_id'], S, _Op) when is_tuple(S) -> - M=element(1, S), - Name = case catch M:tc() of - {tk_union,_,ID,_,_,_} -> - ID; - {tk_enum, _, ID, _} -> - ID; - {tk_exception, _, ID, _} -> - ID; - {tk_alias, _, ID, _} -> - ID; - {tk_struct,_,ID,_} -> - ID - end, - {ok, Name}; - -lookup(['_repos_id'], S, _Op) when is_record(S,'CosNotification_StructuredEvent') -> - {ok, 'CosNotification_StructuredEvent':id()}; -lookup(['_repos_id'], S, _Op) when is_record(S,'CosNotification_EventHeader') -> - {ok, 'CosNotification_EventHeader':id()}; -lookup(['_repos_id'], S, _Op) when is_record(S,'CosNotification_FixedEventHeader') -> - {ok, 'CosNotification_FixedEventHeader':id()}; -lookup(['_repos_id'], S, _Op) when is_record(S,'CosNotification_EventType') -> - {ok, 'CosNotification_EventType':id()}; -lookup(['_repos_id'], S, _Op) when is_record(S,'CosNotification_Property') -> - {ok, 'CosNotification_Property':id()}; -lookup(['_repos_id'], S, _Op) when is_tuple(S) -> - M = element(1, S), - {ok, M:id()}; - -lookup(_, _, _) -> - error. - - -%%------------------------------------------------------------ -%% function : locate_var -%% Arguments: Paths - A list of path-lists which tells us where -%% to search for runtime variables and in which -%% order. -%% S - Data -%% Op - se lookup/3 -%% Returns : {error, _} | -%% {ok, Val} -%%------------------------------------------------------------ -locate_var([], _S, _) -> - {error, "not found"}; -locate_var([H|T], S, Op) -> - case catch lookup(H, S, Op) of - {ok, Val} -> - {ok,Val}; - _ -> - locate_var(T, S, Op) - end. - -%%------------------------------------------------------------ -%% function : id2switch -%% Arguments: UList - The list of elements contained in the -%% Union TypeCode. -%% ID - string() eq name of element. -%% Returns : Acc - A list of switches related to given ID. -%%------------------------------------------------------------ -id2switch(UList, ID) -> - id2switch(UList, ID, [], false). -id2switch([], _, Acc, _) -> - Acc; -id2switch([{Sw, ID, _}|T], ID, Acc, _) -> - id2switch(T, ID, [Sw|Acc], true); -id2switch([_|_T], _ID, Acc, true) -> - Acc; -id2switch([_|T], ID, Acc, Found) -> - id2switch(T, ID, Acc, Found). - -%%------------------------------------------------------------ -%% function : switch2alias -%% Arguments: UList - The list of elements contained in the -%% Union TypeCode. -%% Switch - the union discriminator. -%% Returns : Acc - A list of switches that are defined with the same -%% ID - The switches common ID. -%% Comment : A union IDL code can look like: -%% union Union switch(long) { -%% case 1: -%% case 2: long ID; }; -%% In this case supplying Switch == 1 (or) the result -%% should be {ok, [1,2], "ID"} -%%------------------------------------------------------------ -switch2alias([], _Switch) -> - %% Is it really possible to define an empty union?? - {ok, [], undefined}; -switch2alias([{Sw, ID, TC}|UList], Switch) -> - switch2alias([{Sw, ID, TC}|UList], Switch, [], ID, false). - - -switch2alias([{default, ID, _}], _, _, _, false) -> - {ok, default, ID}; -switch2alias([], _, _Acc, _, false) -> - {ok, [], undefined}; -switch2alias([], _, Acc, PreviousID, _) -> - {ok, Acc, PreviousID}; - -%% Seen the ID before but just found the correct switch, e.g., -%% [... {0,"K",{tk_string,0}}, {2,"K",{tk_string,0}}...] and switch eq '2' -switch2alias([{Switch, PreviousID, _}|T], Switch, Acc, PreviousID, _Found) -> - switch2alias(T, Switch, [Switch|Acc], PreviousID, true); - -%% First time for this ID and found the correct switch -switch2alias([{Switch, ID, _}|T], Switch, _Acc, _PreviousID, false) -> - switch2alias(T, Switch, [Switch], ID, true); - -%% Seen this ID and found the correct switch before. -switch2alias([{Sw, PreviousID, _}|T], Switch, Acc, PreviousID, true) -> - switch2alias(T, Switch, [Sw|Acc], PreviousID, true); - -%% Seen this ID but not found the correct switch. -switch2alias([{Sw, PreviousID, _}|T], Switch, Acc, PreviousID, false) -> - switch2alias(T, Switch, [Sw|Acc], PreviousID, false); - -%% No more of the correct ID/Switch. Done. -switch2alias([{_, _ID, _}|_], _, Acc, PreviousID, true) -> - {ok, Acc, PreviousID}; -%% Not found correct switch and ID is updated. -switch2alias([{Sw, ID, _}|T], Switch, _Acc, _PreviousID, Found) -> - switch2alias(T, Switch, [Sw], ID, Found). - - -%%------------------------------------------------------------ -%% function : get_field -%% Arguments: ID - element name -%% List - The list of elements contained in the -%% TypeCode. -%% Returns : false | -%% offset -%%------------------------------------------------------------ -get_field(ID, List) -> - get_field(ID, List, 2). -get_field(_ID, [], _) -> - false; -get_field(ID, [ID|_], I) -> - %% Memberlists in enum. - I; -get_field(ID, [{ID,_}|_], I) -> - %% Memberlists in structs. - I; -get_field(ID, [_|T], I) -> - get_field(ID, T, I+1). - -%%------------------------------------------------------------ -%% function : check_types -%% Arguments: A sequence of CosNotification::EventType{}, i.e., -%% name-value pairs. -%% Returns : {ok, WhichType, WC} -%% WhichType - type/domain/both -%% WC - [Types using wildcard] -%%------------------------------------------------------------ -%% With check_types we try to determin if one or more EventTypes force us to check -%% all events against this constraint. For example: -%% EventType A1 has domain_name="car",type_name = "*" -%% EventType A2 has domain_name="*",type_name = "DodgeViper" -%% Since A1 says that we must test against any type_name and A2 -%% against any domain_name, we must test all events using these permutations. -%% It's better to do these test now instead of when we are up and running. But -%% if a client change the constraints VERY often it's up to them and they have -%% to accept the delay. -%%------------------------------------------------------------ - -%% If types is an empty list it means that this constraint must be used -%% for all events. -check_types([]) -> true; -check_types(Types) -> check_types(Types, both, []). -check_types([], Which, WildCard) -> {ok, Which, WildCard}; -%% The following cases means that all events matches. -check_types([#'CosNotification_EventType'{domain_name="",type_name = ""}|_T],_,_) -> - true; -check_types([#'CosNotification_EventType'{domain_name="",type_name = "*"}|_T],_,_) -> - true; -check_types([#'CosNotification_EventType'{domain_name="*",type_name = ""}|_T],_,_) -> - true; -check_types([#'CosNotification_EventType'{domain_name="*",type_name = "*"}|_T],_,_) -> - true; -%% The following cases means that all events must be tested using this constraint. -check_types([#'CosNotification_EventType'{domain_name="",type_name = Ty}|T], domain,WC) when is_list(Ty) -> - check_wildcard(T, all, WC, "", Ty); -check_types([#'CosNotification_EventType'{domain_name="*",type_name = Ty}|T], domain, WC) when is_list(Ty) -> - check_wildcard(T, all, WC, "", Ty); -check_types([#'CosNotification_EventType'{domain_name=Do,type_name = ""}|T], type,WC) when is_list(Do) -> - check_wildcard(T, all, WC, Do, ""); -check_types([#'CosNotification_EventType'{domain_name=Do,type_name = "*"}|T], type,WC) when is_list(Do) -> - check_wildcard(T, all, WC, Do, ""); -%% The following cases is used to prevent other cases from converting, -%% for example, all->type. -check_types([#'CosNotification_EventType'{domain_name="",type_name = Ty}|T], all,WC) when is_list(Ty) -> - check_wildcard(T, all, WC, "", Ty); -check_types([#'CosNotification_EventType'{domain_name="*",type_name = Ty}|T], all,WC) when is_list(Ty) -> - check_wildcard(T, all, WC, "", Ty); -check_types([#'CosNotification_EventType'{domain_name=Do,type_name = ""}|T], all,WC) when is_list(Do) -> - check_wildcard(T, all, WC, Do, ""); -check_types([#'CosNotification_EventType'{domain_name=Do,type_name = "*"}|T], all,WC) when is_list(Do) -> - check_wildcard(T, all, WC, Do, ""); -%% The following cases means that all events with matching Type must be -%% tested using this constraint. -check_types([#'CosNotification_EventType'{domain_name="",type_name = Ty}|T], _W,WC) when is_list(Ty) -> - check_wildcard(T, type, WC, "", Ty); -check_types([#'CosNotification_EventType'{domain_name="*",type_name = Ty}|T], _W,WC) when is_list(Ty) -> - check_wildcard(T, type, WC, "", Ty); -%% The following cases means that all events with matching Domain must be -%% tested using this constraint. -check_types([#'CosNotification_EventType'{domain_name=Do,type_name = ""}|T], _W,WC) when is_list(Do) -> - check_wildcard(T, domain, WC, Do, ""); -check_types([#'CosNotification_EventType'{domain_name=Do,type_name = "*"}|T], _W,WC) when is_list(Do) -> - check_wildcard(T, domain, WC, Do, ""); -%% Sorry, no shortcuts. -check_types([#'CosNotification_EventType'{domain_name=Do,type_name=Ty}|T], W,WC) when is_list(Do) andalso is_list(Ty) -> - check_wildcard(T, W, WC, Do, Ty); -check_types([H|_], _,_) when is_record(H, 'CosNotification_EventType') -> - %% Not valid. - corba:raise(#'CosNotifyComm_InvalidEventType'{type=H}); -check_types(_,_,_) -> - %% Wasn't even a correct input. - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -check_wildcard(Types, Which, WC, Domain, Type) -> - NewWC = - case {string:chr(Domain, $*), string:chr(Type, $*)} of - {0, 0} -> - WC; - {0, _}-> - [{type, Domain, convert_wildcard(Type, [])}|WC]; - {_, 0}-> - [{domain, convert_wildcard(Domain, []), Type}|WC]; - _-> - [{both, convert_wildcard(Domain, []), convert_wildcard(Type, [])}|WC] - end, - check_types(Types, Which, NewWC). - -%% Change '*' to '.*', see re:compile/1 documentation. -convert_wildcard([], Acc) -> - case re:compile(lists:reverse(Acc)) of - {ok, Expr} -> - Expr; - _ -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end; -convert_wildcard([$*|T], Acc) -> - convert_wildcard(T, [$*, $.|Acc]); -convert_wildcard([H|T], Acc) -> - convert_wildcard(T, [H|Acc]). - -%%------------------------------------------------------------ -%% function : match_types -%% Arguments: A sequence of {Which, Domain, Type}, i.e., the same as -%% returned from cosNotification_Filter:check_types/3 -%% Returns : bolean() -%%------------------------------------------------------------ -match_types(_, _, []) -> - false; -match_types(Domain, Type, [{domain, WCDomain, Type}|T]) -> - L=length(Domain), - case catch re:run(Domain, WCDomain) of - nomatch -> - match_types(Domain, Type, T); - {match, [{0, L}]} -> - true; - _-> - match_types(Domain, Type, T) - end; -match_types(Domain, Type, [{type, Domain, WCType}|T]) -> - L=length(Type), - case catch re:run(Type, WCType) of - nomatch -> - match_types(Domain, Type, T); - {match, [{0, L}]} -> - true; - _-> - match_types(Domain, Type, T) - end; -match_types(Domain, Type, [{both, WCDomain, WCType}|T]) -> - L1=length(Domain), - case catch re:run(Domain, WCDomain) of - nomatch -> - match_types(Domain, Type, T); - {match, [{0, L1}]} -> - L2=length(Type), - case catch re:run(Type, WCType) of - nomatch -> - match_types(Domain, Type, T); - {match, [{0, L2}]} -> - true; - _ -> - match_types(Domain, Type, T) - end; - _-> - match_types(Domain, Type, T) - end; -match_types(Domain, Type, [_|T]) -> - match_types(Domain, Type, T). - -%%------------------------------------------------------------ -%% function : validate_types -%% Arguments: A sequence of CosNotification::EventType{}, i.e., -%% name-value pairs. -%% Returns : ok | -%% {'EXCEPTION', #'CosNotifyComm_InvalidEventType'{}} -%%------------------------------------------------------------ - -validate_types([]) -> - ok; -validate_types([#'CosNotification_EventType'{domain_name=Do,type_name=Ty}|T]) - when is_list(Do) andalso is_list(Ty) -> - validate_types(T); -validate_types([H|_]) - when is_record(H, 'CosNotification_EventType') -> - %% Not valid. - corba:raise(#'CosNotifyComm_InvalidEventType'{type=H}); -validate_types(_) -> - %% Wasn't even a correct input. - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/src/cosNotification_Grammar.yrl b/lib/cosNotification/src/cosNotification_Grammar.yrl deleted file mode 100644 index f4a42d022e..0000000000 --- a/lib/cosNotification/src/cosNotification_Grammar.yrl +++ /dev/null @@ -1,168 +0,0 @@ -%%-------------------------------------------------------------------- -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%%-------------------------------------------------------------------- -%% File : cosNotification_Grammar.yrl -%% Purpose : Implement the constraint grammar for CosNotification filters. -%%-------------------------------------------------------------------- - -Nonterminals - '' '' '' '' '' '' - '' '' '' '' '' - '' '' '' '' '' ''. - -Terminals -% 'dbslsh' 'bslshd' - 'bslsh' 'ident' 'string' - '_length' '_d''_type_id' '_repos_id' - 'not' 'or' 'and' 'num' - 'in' '~' '.' 'dollar' - 'ADDOP' 'RELOP' 'MULOP' 'default' 'exist' - 'TRUE' 'FALSE' - '(' ')' '[' ']' 'int'. - -Left 100 'or'. -Left 200 'and'. -%Nonassoc 300 'RELOP'. % '==', '!=', '<', '>', '<=', '=>' -Left 300 'RELOP'. -%Nonassoc 400 'in'. -Left 400 'in'. -%Nonassoc 500 '~'. -Left 500 '~'. -Left 600 'ADDOP'. % '+', '-' -Left 700 'MULOP'. % '*', '/' -Unary 800 'not'. -Unary 900 'exist'. -Unary 900 'default'. -%Unary 900 'u-'. % unary minus - -Rootsymbol ''. -Endsymbol '$end'. - -'' -> '$empty' : '$empty'. -'' -> '' : '$1'. - -'' -> '' : '$1'. - -'' -> '' : '$1'. - -'' -> '' 'or' '' : {'or', '$1', '$3'}. -'' -> '' : '$1'. - -'' -> '' 'and' '' : {'and', '$1', '$3'}. -'' -> '' : '$1'. - -'' -> '' 'RELOP' '' : {element(2, '$2'), '$1', '$3'}. -'' -> '' : '$1'. - -'' -> '' : '$1'. -'' -> '' 'in' '' : {'in', '$1', '$3'}. -'' -> '' 'in' 'dollar' '' : {'in', '$1', examin_comp({'component', '$4'})}. - -'' -> '' : '$1'. -'' -> '' '~' '' : {'~', '$1', '$3'}. - -'' -> '' : '$1'. -'' -> '' 'ADDOP' '' : {element(2, '$2'), '$1', '$3'}. - -'' -> '' : '$1'. -'' -> '' 'MULOP' '' : {element(2, '$2'), '$1', '$3'}. - -'' -> '' : '$1'. -'' -> 'not' '' : {'not', '$2'}. - -'' -> '(' '' ')' : '$2'. -'' -> 'num' : element(2, '$1'). -'' -> 'int' : element(2, '$1'). -'' -> 'string' : element(2, '$1'). -'' -> 'TRUE' : 'true'. -'' -> 'FALSE' : 'false'. -'' -> 'ADDOP' 'num' : create_unary(element(2, '$1'), element(2, '$2')). -'' -> 'ADDOP' 'int' : create_unary(element(2, '$1'), element(2, '$2')). -'' -> '' : list_to_atom('$1'). -'' -> 'dollar' '' : examin_comp({component, '$2'}). -'' -> 'default' 'dollar' '' : examin_comp({'default_component', '$3'}). -'' -> 'exist' 'dollar' '' : examin_comp({'exist_component', '$3'}). - -%% The following rules are used to create Components. The format used is: -%% [...] -'' -> '.' '' : '$2'. -'' -> '[' 'int' ']' '' : [{'arrindex', element(2, '$2')} | '$4']. %% CompArray -'' -> '(' '' ')' '' : [{'associd', '$2'} | '$4']. %%CompAssoc -'' -> '' '' : [{'varid', '$1'} | '$2']. %% run-time variable -'' -> '$empty' : []. - -'' -> '.' '' : '$2'. -'' -> '[' 'int' ']' '' : [{'arrindex', element(2, '$2')} | '$4']. %% CompArray -'' -> '(' '' ')' '' : [{'associd', '$2'} | '$4']. %%CompAssoc -'' -> '$empty' : []. - -'' -> '' '' : [{'dotid', '$1'} | '$2']. -'' -> 'int' '' : [{'dotint', element(2, '$1')} | '$2']. %% ComPos -'' -> '(' '' ')' '' : ['$2' | '$4']. %% UnionPos -'' -> '_length' : ['_length']. %% arrays or sequences ONLY -'' -> '_d' : ['_d']. %% discriminated unions ONLY -'' -> '_type_id' : ['_type_id']. %% ok if info can be obtained -'' -> '_repos_id' : ['_repos_id']. %% ok if info can be obtained - -'' -> 'ident' : element(2, '$1'). -'' -> 'bslsh' 'ident' : element(2, '$2'). - -'' -> 'int' : {'uint', element(2, '$1')}. -'' -> 'ADDOP' 'int' : {'uint', create_unary(element(2, '$1'), element(2, '$2'))}. -'' -> 'string' : {'ustr', element(2, '$1')}. -'' -> '$empty': 'default'. - -Erlang code. -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2009. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%%---------------------------------------------------------------------- -%% File : cosNotification_Grammar.erl -%% Purpose : THIS FILE HAS BEEN GENERATED. DO NOT EDIT!!!! -%%---------------------------------------------------------------------- - --include("CosNotification_Definitions.hrl"). - -create_unary('+', Val) when is_number(Val) -> Val; -create_unary('-', Val) when is_number(Val) -> -Val; -create_unary(_, _) -> return_error(0, "syntax error"). - -examin_comp({T, []}) -> - {T, '$empty'}; -examin_comp(V) -> - V. - diff --git a/lib/cosNotification/src/cosNotification_Scanner.erl b/lib/cosNotification/src/cosNotification_Scanner.erl deleted file mode 100644 index 31f27a8d78..0000000000 --- a/lib/cosNotification/src/cosNotification_Scanner.erl +++ /dev/null @@ -1,269 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : cosNotification_Scanner.erl -%% Purpose : Scan and pre-process a grammar. -%%---------------------------------------------------------------------- - --module('cosNotification_Scanner'). - --export([scan/1]). - -scan(Str) -> - RSL = scan(Str, 1, [], any), - {ok, lists:reverse(RSL)}. - - -%% Guard macros used at top scan functions only --define(is_number(X), X >= $0, X =< $9). --define(is_upper(X), X >= $A, X =< $Z). --define(is_lower(X), X >= $a, X =< $z). - -%%---------------------------------------------------------------------- -%% scan -%% -%% A-Z -scan([X|Str], Line, Out, Type) when ?is_upper(X) -> - scan_name(Str, [X], Line, Out, Type); -%% a-z -scan([X|Str], Line, Out, Type) when ?is_lower(X) -> - scan_name(Str, [X], Line, Out, Type); -%% 0-9 -scan([X|Str], Line, Out, Type) when ?is_number(X) -> - scan_number(Str, [X], Line, Out, Type); - -%% RELOP:s == != <= >= > < -scan([$=,$= | Str], Line, Out, _Type) -> - scan(Str, Line, [{'RELOP', '=='} | Out], any); -scan([$!,$= | Str], Line, Out, _Type) -> - scan(Str, Line, [{'RELOP', '!='} | Out], any); -scan([$<,$= | Str], Line, Out, _Type) -> - scan(Str, Line, [{'RELOP', '<='} | Out], any); -scan([$>,$= | Str], Line, Out, _Type) -> - scan(Str, Line, [{'RELOP', '>='} | Out], any); -scan([$> | Str], Line, Out, _Type) -> - scan(Str, Line, [{'RELOP', '>'} | Out], any); -scan([$< | Str], Line, Out, _Type) -> - scan(Str, Line, [{'RELOP', '<'} | Out], any); - -%% ADDOP:s + - -scan([$+ | Str], Line, Out, Type) -> - scan(Str, Line, [{'ADDOP', '+'} | Out], Type); -scan([$- | Str], Line, Out, Type) -> - scan(Str, Line, [{'ADDOP', '-'} | Out], Type); - -%% MULOP:s * / -scan([$* | Str], Line, Out, _Type) -> - scan(Str, Line, [{'MULOP', '*'} | Out], any); -scan([$/ | Str], Line, Out, _Type) -> - scan(Str, Line, [{'MULOP', '/'} | Out], any); - -%% TAB -scan([9| T], Line, Out, Type) -> scan(T, Line, Out, Type); -%% SP -scan([32| T], Line, Out, Type) -> scan(T, Line, Out, Type); -%% CR -scan([$\r|Str], Line, Out, Type) -> - scan(Str, Line, Out, Type); -%% LF -scan([$\n|Str], Line, Out, Type) -> - scan(Str, Line+1, Out, Type); -%% \\ -scan([92, 92 | Str], Line, Out, Type) -> - scan(Str, Line, [{'dbslsh', Line} | Out], Type); -%% \' -scan([92, 39 | Str], Line, Out, Type) -> - scan(Str, Line, [{'bslshd', Line} | Out], Type); -%% '\' -scan([92 | Str], Line, Out, Type) -> - scan(Str, Line, [{'bslsh', Line} | Out], Type); -%% '_' -scan([$_ | Str], Line, Out, dollar) -> - scan_name(Str, [$_], Line, Out, dollar); -%% '$' -scan([$$, 92 | Str], Line, Out, _Type) -> - scan(Str, Line, [{'bslsh', Line}, {'dollar', Line} | Out], dollar); -scan([$$ | Str], Line, Out, _Type) -> - scan(Str, Line, [{'dollar', Line} | Out], dollar); -scan([$"|Str], Line, Out, Type) -> - scan_const(char, Str, [], Line, Out, Type); -scan([$'|Str], Line, Out, Type) -> - scan_const(string, Str, [], Line, Out, Type); - -%% Writing '+.' is not allowed ('+' or '-' are only allowed -%% as unary for (within a component) which must be en integer). -scan([$. | Str], Line, [{'ADDOP', Op}|Out], _) -> - scan_frac(Str, [$.], Line, [{'ADDOP', Op}|Out], any); -%% Must be a -scan([$. | Str], Line, Out, dollar) -> - scan(Str, Line, [{'.',Line} | Out], dollar); -%% Number -scan([$. | Str], Line, Out, Type) -> - scan_frac(Str, [$.], Line, Out, Type); -scan([C|Str], Line, Out, Type) -> - scan(Str, Line, [{list_to_atom([C]), Line} | Out], Type); - -scan([], _Line, Out, _Type) -> - Out. - -%%---------------------------------------------------------------------- -%% scan_name -%% - -scan_number([X|Str], Accum, Line, Out, Type) when ?is_number(X) -> - scan_number(Str, [X|Accum], Line, Out, Type); -scan_number([X|Str], Accum, Line, Out, dollar) when X==$. -> - scan(Str, Line, [{'.', Line}, - {'int', list_to_integer(lists:reverse(Accum))} | Out], dollar); -scan_number([X|Str], Accum, Line, Out, Type) when X==$. -> - scan_frac(Str, [X|Accum], Line, Out, Type); -scan_number([X|Str], Accum, Line, Out, Type) when X==$e -> - scan_exp(Str, [X|Accum], Line, Out, Type); -scan_number([X|Str], Accum, Line, Out, Type) when X==$E -> - scan_exp(Str, [X|Accum], Line, Out, Type); -scan_number(Str, Accum, Line, Out, Type) -> - scan(Str, Line, [{'int', list_to_integer(lists:reverse(Accum))} | Out], Type). - - -%% Floating point number scan. -%% -%% Non trivial scan. A float consists of an integral part, a -%% decimal point, a fraction part, an e or E and a signed integer -%% exponent. Either the integer part or the fraction part but not -%% both may be missing, and either the decimal point or the -%% exponent part but not both may be missing. The exponent part -%% must consist of an e or E and a possibly signed exponent. -%% -%% Analysis shows that "1." ".7" "1e2" ".5e-3" "1.7e2" "1.7e-2" -%% is allowed and "1" ".e9" is not. The sign is only allowed just -%% after an e or E. The scanner reads a number as an integer -%% until it encounters a "." so the integer part only error case -%% will not be caught in the scanner (but rather in expression -%% evaluation) - -scan_frac([$e | _Str], [$.], _Line, _Out, _Type) -> - {error, "illegal_float"}; -scan_frac([$E | _Str], [$.], _Line, _Out, _Type) -> - {error, "illegal_float"}; -scan_frac(Str, Accum, Line, Out, Type) -> - scan_frac2(Str, Accum, Line, Out, Type). - -scan_frac2([X|Str], Accum, Line, Out, Type) when ?is_number(X) -> - scan_frac2(Str, [X|Accum], Line, Out, Type); -scan_frac2([X|Str], Accum, Line, Out, Type) when X==$e -> - scan_exp(Str, [X|Accum], Line, Out, Type); -scan_frac2([X|Str], Accum, Line, Out, Type) when X==$E -> - scan_exp(Str, [X|Accum], Line, Out, Type); -%% Since '.2' is allowed, we add '0' in front to be sure (erlang do not allow -%% list_to_float(".2") and list_to_float("0.2") eq. list_to_float("00.2")). -scan_frac2(Str, Accum, Line, Out, Type) -> - scan(Str, Line, [{'num', list_to_float([$0|lists:reverse(Accum)])} | Out], Type). - -scan_exp([X|Str], Accum, Line, Out, Type) when X==$- -> - scan_exp2(Str, [X|Accum], Line, Out, Type); -scan_exp(Str, Accum, Line, Out, Type) -> - scan_exp2(Str, Accum, Line, Out, Type). - -scan_exp2([X|Str], Accum, Line, Out, Type) when ?is_number(X) -> - scan_exp2(Str, [X|Accum], Line, Out, Type); -%% Since '.2' is allowed, we add '0' in front to be sure (erlang do not allow -%% list_to_float(".2")). -scan_exp2(Str, Accum, Line, Out, Type) -> - scan(Str, Line, [{'num', list_to_float([$0|lists:reverse(Accum)])} | Out], Type). - - -scan_name([X|Str], Accum, Line, Out, Type) when ?is_upper(X) -> - scan_name(Str, [X|Accum], Line, Out, Type); -scan_name([X|Str], Accum, Line, Out, Type) when ?is_lower(X) -> - scan_name(Str, [X|Accum], Line, Out, Type); -scan_name([X|Str], Accum, Line, Out, Type) when ?is_number(X) -> - scan_name(Str, [X|Accum], Line, Out, Type); -scan_name([$_|Str], Accum, Line, Out, dollar) -> - scan_name(Str, [$_|Accum], Line, Out, dollar); -scan_name(S, Accum, Line, [{bslsh,LL} | Out], Type) -> - %% An escaped identifier. - L = lists:reverse(Accum), - scan(S, Line, [{'ident', L}, {bslsh,LL} | Out], Type); -scan_name(S, Accum, Line, Out, Type) -> - L = lists:reverse(Accum), - {X, NewType} = case check_name(L) of - false -> - {{'ident', L}, Type}; - _ -> - {{list_to_atom(L), Line}, any} - end, - scan(S, Line, [X | Out], NewType). - -%% Shall scan a constant -scan_const(char, [$" | Rest], Accum, Line, Out, Type) -> - scan(Rest, Line, - [{'ident', list_to_atom(lists:reverse(Accum))} | Out], Type); -scan_const(char, [], _Accum, _Line, Out, _Type) -> %% Bad string -% {error, "bad_string"}; - Out; -scan_const(string, [$' | Rest], Accum, Line, Out, Type) -> - scan(Rest, Line, - [{'string', lists:reverse(Accum)} | Out], Type); -scan_const(Mode, [$\\, C | Rest], Accum, Line, Out, Type) -> - case escaped_char(C) of - error -> - %% Bad escape character - %% {error, "bad_escape_character"}; - scan_const(Mode, Rest, [C | Accum], Line, Out, Type); - EC -> - scan_const(Mode, Rest, [EC | Accum], Line, Out, Type) - end; -scan_const(Mode, [C | Rest], Accum, Line, Out, Type) -> - scan_const(Mode, Rest, [C | Accum], Line, Out, Type). - -%% Escaped character. Escaped chars are repr as two characters in the -%% input list of letters and this is translated into one char. -escaped_char($n) -> $\n; -escaped_char($t) -> $\t; -escaped_char($v) -> $\v; -escaped_char($b) -> $\b; -escaped_char($r) -> $ ; -escaped_char($f) -> $\f; -escaped_char($a) -> $\a; -escaped_char($\\) -> $\\; -escaped_char($?) -> $?; -escaped_char($') -> $'; -escaped_char($") -> $"; -%% Error -escaped_char(_Other) -> error. - - -check_name("exist") -> true; -check_name("default") -> true; -check_name("_length") -> true; -check_name("_d") -> true; -check_name("_type_id") -> true; -check_name("_repos_id") -> true; -check_name("not") -> true; -check_name("or") -> true; -check_name("and") -> true; -check_name("FALSE") -> true; -check_name("TRUE") -> true; -check_name("in") -> true; -check_name(_) -> false. - - diff --git a/lib/cosNotification/src/cosNotification_eventDB.erl b/lib/cosNotification/src/cosNotification_eventDB.erl deleted file mode 100644 index cd3c74d617..0000000000 --- a/lib/cosNotification/src/cosNotification_eventDB.erl +++ /dev/null @@ -1,1351 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : cosNotification_eventDB.erl -%% Purpose : -%% Purpose : This module is supposed to centralize Event storage. -%% Comments: -%% * Setting Order Policy to AnyOrder eq. Priority order -%% -%% * Setting Discard Policy to AnyOrder eq. RejectNewEvents. -%% -%% * DB ordering: Since the deliver- and discard-order may differ we need -%% two ets-tables, both of type 'ordered_set'. They contain: -%% - table 1 (T1): deliver order key and the associated event. -%% - table 2 (T2): discard order key. -%% -%% When adding a new event we add, if necessary, related keys in T2. -%% For example, if we should discard events in FIFO order, the delivery -%% order may be set to Priority order. If the Max Event limit is reached -%% we first look in T2 to find out which event to discard by using and -%% reorder the key elements. T2 gives {TimeStamp, Priority}, which is used -%% to lookup in T1 as {Priority, TimeStamp}. -%% A TimeStamp is always included in the DB keys, even if FIFO or LIFO -%% is used, since lots of events probably will have the same prioity and -%% with a little bit of bad luck some events will never be delivered. -%% -%% Note: deliver order AnyOrder and PriorityOrder is equal since the later -%% is defined as default. -%% discard order AnyOrder and RejectNewEvents is equal since the later -%% is defined as default. -%% The keys used is ('-' indicates T2 is not needed and, thus, not instantiated): -%% -%% T1 policy T1 Key T2 Policy T2 Key -%% ------------------------------------------------------------------ -%% DeadlineOrder {DL, Key, Prio} PriorityOrder {Prio, Key, DL} -%% DeadlineOrder {DL, Key} FifoOrder {Key, DL} -%% DeadlineOrder {DL, Key} LifoOrder {Key, DL} -%% DeadlineOrder {DL, Key} RejectNewEvents - -%% DeadlineOrder {DL, Key} DeadlineOrder - -%% FifoOrder {Key, DL} DeadlineOrder {DL, Key} -%% FifoOrder {Key, Prio} PriorityOrder {Prio, Key} -%% FifoOrder Key RejectNewEvents - -%% FifoOrder Key Fifo - -%% FifoOrder Key Lifo - -%% PriorityOrder {Prio, Key, DL} DeadlineOrder {DL, Key, Prio} -%% PriorityOrder {Prio, Key} Fifo {Key, Prio} -%% PriorityOrder {Prio, Key} Lifo {Key, Prio} -%% PriorityOrder {Prio, Key} RejectNewEvents - -%% ------------------------------------------------------------------ -%% DL == Deadline, Key == TimeStamp, Prio == Priority -%% -%% NOTE: If defined, the Discard DB Keys are the same as in Event DB, except -%% that the first and last Key change place. {K1,K2}<->{K2,K1} and -%% {K1,K2,K3}<->{K3,K2,K1}. -%%---------------------------------------------------------------------- --module(cosNotification_eventDB). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). --include_lib("cosTime/include/TimeBase.hrl"). - -%% Application files --include("CosNotification.hrl"). --include("CosNotifyChannelAdmin.hrl"). --include("CosNotifyComm.hrl"). --include("CosNotifyFilter.hrl"). - --include("CosNotification_Definitions.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%% Internal Filter Functions --export([validate_event/5, - create_db/4, - destroy_db/1, - get_event/1, - get_event/2, - get_events/2, - get_events/3, - delete_events/1, - update/2, - update/4, - add_event/2, - add_event/4, - add_and_get_event/2, - add_and_get_event/3, - add_and_get_event/4, - add_and_get_event/5, - gc_events/2, - gc_events_local/4, - gc_start/2, - filter_events/2, - filter_events/3, - status/2]). - -%%--------------- DATA STRUCTURES ---------------------------- --record(dbRef, {orderRef, discardRef, orderPolicy, discardPolicy, - defPriority, maxEvents, defStopT, startTsupport, - stopTsupport, gcTime, gcLimit, timeRef}). - - - -%%--------------- DEFINES ------------------------------------ - --define(CreateRef(OR, DR, O, D, DP, ME, DS, StaT, StoT, GT, GL, TR), - #dbRef{orderRef=OR, discardRef=DR, orderPolicy=O, discardPolicy=D, - defPriority=DP, maxEvents=ME, defStopT=DS, startTsupport=StaT, - stopTsupport=StoT, gcTime=GT, gcLimit=round(ME*GL/100), - timeRef=TR}). - - --define(get_OrderP(DR), DR#dbRef.orderPolicy). --define(get_DiscardP(DR), DR#dbRef.discardPolicy). --define(get_OrderRef(DR), DR#dbRef.orderRef). --define(get_DiscardRef(DR), DR#dbRef.orderRef). --define(get_DefPriority(DR), DR#dbRef.defPriority). --define(get_MaxEvents(DR), DR#dbRef.maxEvents). --define(get_DefStopT(DR), DR#dbRef.defStopT). --define(get_StartTsupport(DR), DR#dbRef.startTsupport). --define(get_StopTsupport(DR), DR#dbRef.stopTsupport). --define(get_GCTime(DR), DR#dbRef.gcTime). --define(get_GCLimit(DR), DR#dbRef.gcLimit). --define(get_TimeRef(DR), DR#dbRef.timeRef). - --define(set_OrderP(DR, O), DR#dbRef{orderPolicy = O}). --define(set_DiscardP(DR, D), DR#dbRef{discardPolicy = D}). --define(set_OrderRef(DR, E), DR#dbRef{orderRef = E}). --define(set_DiscardRef(DR, E), DR#dbRef{orderRef = E}). --define(set_DefPriority(DR, DP), DR#dbRef{defPriority = DP}). --define(set_MaxEvents(DR, ME), DR#dbRef{maxEvents = ME}). --define(set_DefStopT(DR, DS), DR#dbRef{defStopT = DS}). --define(set_StartTsupport(DR, B), DR#dbRef{startTsupport = B}). --define(set_StopTsupport(DR, B), DR#dbRef{stopTsupport = B}). - --define(is_StartTNotSupported(DR), DR#dbRef.startTsupport == false). --define(is_StopTNotSupported(DR), DR#dbRef.stopTsupport == false). --define(is_TimeoutNotUsed(DR), DR#dbRef.defStopT == 0). - - -%%------------------------------------------------------------ -%% function : status -%% Arguments: DBRef -%% Key - which information we want. -%% Returns : Data related to the Key. -%%------------------------------------------------------------ -status(DBRef, eventCounter) -> - ets:info(?get_OrderRef(DBRef), size); -status(DBRef, {batchLimit, Limit}) -> - case ets:info(?get_OrderRef(DBRef), size) of - Current when is_integer(Current) andalso Current >= Limit -> - ?debug_print("BATCH LIMIT (~p) REACHED, CONTAINS: ~p~n", [Limit, Current]), - true; - _Other -> - ?debug_print("BATCH LIMIT (~p) NOT REACHED, CONTAINS: ~p~n", - [Limit, _Other]), - false - end; -status(DBRef, {batchLimit, Limit, TemporaryMax}) -> - case ets:info(?get_OrderRef(DBRef), size) of - Current when is_integer(Current) andalso Current >= TemporaryMax -> - ?debug_print("MAX LIMIT (~p) REACHED, CONTAINS: ~p~n", - [TemporaryMax, Current]), - true; - Current when is_integer(Current) andalso Current >= Limit -> - ?debug_print("BATCH LIMIT (~p) REACHED, CONTAINS: ~p~n", [Limit, Current]), - true; - _Other -> - ?debug_print("BATCH LIMIT (~p) NOT REACHED, CONTAINS: ~p~n", - [Limit, _Other]), - false - end; -status(_, _) -> - error. - - -%%------------------------------------------------------------ -%% function : gc_events_local -%% Arguments: DBRef -%% Returns : -%% Comment : This function is intended for "emergency" GC, i.e., -%% when the DB must discard events we should first try -%% to remove events with expired deadlines. -%%------------------------------------------------------------ -gc_events_local(_, _, false, _) -> - ok; -gc_events_local(_, _, _, 0) -> - ok; -gc_events_local(ORef, DRef, _, _) -> - gc_loop(ets:first(ORef), ORef, DRef). - -%%------------------------------------------------------------ -%% function : gc_events -%% Arguments: DBRef -%% Priority - 'low', 'medium' or 'high'; will determine -%% how important a fast gc is. -%% Returns : -%% Comment : This function is intended for background GC. -%%------------------------------------------------------------ -gc_events(DBRef, _Priority) when ?is_TimeoutNotUsed(DBRef) -> - ok; -gc_events(DBRef, _Priority) when ?is_StopTNotSupported(DBRef) -> - ok; -gc_events(DBRef, Priority) -> - TS = erlang:monotonic_time(), - {resolution, TR} = lists:keyfind(resolution, 1, erlang:system_info(os_monotonic_time_source)), - case get(oe_GC_timestamp) of - Num when TS > Num -> - put(oe_GC_timestamp, TS + ?get_GCTime(DBRef) * TR), - spawn_link(?MODULE, gc_start, [DBRef, Priority]); - _-> - ok - end. - -%%------------------------------------------------------------ -%% function : gc_start -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -gc_start(#dbRef{orderRef = ORef, discardRef = DRef}, Priority) -> - process_flag(priority, Priority), - gc_loop(ets:first(ORef), ORef, DRef). - -gc_loop('$end_of_table', _, _) -> - ok; -gc_loop(Key, ORef, DRef) -> - [{Keys,DL,_,_,_}]=ets:lookup(ORef, Key), - case check_deadline(DL) of - true when DRef == undefined -> - ets:delete(ORef, Key); - true -> - ets:delete(ORef, Key), - gc_discard_DB(Keys, DRef); - _ -> - ok - end, - gc_loop(ets:next(ORef, Key), ORef, DRef). - -gc_discard_DB({Key1, Key2}, DRef) -> - ets:delete(DRef, {Key2, Key1}); -gc_discard_DB({Key1, Key2, Key3}, DRef) -> - ets:delete(DRef, {Key3, Key2, Key1}). - -%%------------------------------------------------------------ -%% function : create_FIFO_Key -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -create_FIFO_Key() -> - {M, S, U} = erlang:timestamp(), - -M*1000000000000 - S*1000000 - U. - -%%------------------------------------------------------------ -%% function : convert_FIFO_Key -%% Arguments: -%% Returns : A timestamp tuple -%% Comment : Used when we must reuse a timestamp, i.e., only -%% when we must reorder the DB. -%%------------------------------------------------------------ -convert_FIFO_Key(Key) -> - K = abs(Key), - Secs = trunc(K/1000000), - M = trunc(K/1000000000000), - S = Secs-M*1000000, - U = K - S*1000000-M*1000000000000, - {M, S, U}. - -%%------------------------------------------------------------ -%% function : extract_priority -%% Arguments: Event -%% Defalt Value -%% Mapping Filter Value -%% - false value not needed (depends on QoS type) -%% - undefined value needed but no filter associated. -%% Returns : -%%------------------------------------------------------------ -extract_priority(_, _, false) -> - false; -extract_priority(#'CosNotification_StructuredEvent' - {header = #'CosNotification_EventHeader' - {variable_header = VH}}, DefPriority, undefined) -> - extract_value(VH, ?not_Priority, DefPriority); -%% Maybe a unstructured event. -extract_priority(_, DefPriority, undefined) -> - DefPriority; -extract_priority(_, _, PriorityOverride) -> - %% Must have an associated MappingFilter for Priority. - PriorityOverride. - -%%------------------------------------------------------------ -%% function : extract_start_time -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -extract_start_time(_, false, _) -> - false; -extract_start_time(#'CosNotification_StructuredEvent' - {header = #'CosNotification_EventHeader' - {variable_header = VH}}, _, TRef) -> - ST = case extract_value(VH, ?not_StartTime, undefined) of - UTC when is_record(UTC, 'TimeBase_UtcT') -> - UTC; - _ -> - false - end, - convert_time(ST, TRef, erlang:timestamp()); -extract_start_time(_, _, _) -> - false. - -%%------------------------------------------------------------ -%% function : extract_deadline -%% Arguments: Structured Event -%% Default Timeout Value - TimeT or UtcT (see cosTime). -%% StopTSupported - boolean(). -%% TRef - reference to TimeService -%% Mapping Filter Value -%% - false eq. value not needed (depends on QoS type) -%% - undefined eq. value needed but no filter associated. -%% Now - used when we want to reuse old TimeStamp which -%% must be done when changing QoS. -%% Returns : A modified return from erlang:timestamp(). -%%------------------------------------------------------------ -extract_deadline(_, _, _, _, false) -> - false; -extract_deadline(Event, DefaultT, StopTSupported, TRef, MappingVal) -> - extract_deadline(Event, DefaultT, StopTSupported, TRef, MappingVal, erlang:timestamp()). - -extract_deadline(_, _, _, _, false, _) -> - false; -extract_deadline(#'CosNotification_StructuredEvent' - {header = #'CosNotification_EventHeader' - {variable_header = VH}}, DefaultT, StopTSupported, - TRef, undefined, Now) -> - DL = case extract_value(VH, ?not_Timeout, undefined) of - undefined when StopTSupported == true, TRef =/= undefined -> - case extract_value(VH, ?not_StopTime, undefined) of - undefined -> - DefaultT; - DefinedTime -> - DefinedTime - end; - undefined -> - DefaultT; - DefinedTime -> - DefinedTime - end, - convert_time(DL, TRef, Now); -%% Maybe a unstructured event. -extract_deadline(_, Time, _, TRef, undefined, Now) -> - convert_time(Time, TRef, Now); -extract_deadline(_, _, _, TRef, DOverride, Now) -> - %% Must have an associated MappingFilter defining a Deadline. - convert_time(DOverride, TRef, Now). - -convert_time(0, _, _) -> - false; -convert_time(UTC, TRef, {M,S,U}) when is_record(UTC, 'TimeBase_UtcT') -> - case catch get_time_diff(UTC, TRef) of - {'EXCEPTION', _} -> - false; - {'EXIT', _} -> - false; - DL -> - MicroSecs = round(DL/10), - Secs = round(MicroSecs/1000000), - MegaSecs = round(Secs/1000000), - {-M-MegaSecs, -S-Secs+MegaSecs, -U-MicroSecs+Secs} - end; -convert_time(DL, _, {M,S,U}) when is_integer(DL) -> - MicroSecs = round(DL/10), - Secs = round(MicroSecs/1000000), - MegaSecs = round(Secs/1000000), - {-M-MegaSecs, -S-Secs+MegaSecs, -U-MicroSecs+Secs}; -convert_time(_, _, _) -> - false. - - -get_time_diff(UTC, TRef) -> - UTO = 'CosTime_TimeService':universal_time(TRef), - UTO2 = 'CosTime_TimeService':uto_from_utc(TRef, UTC), - TIO = 'CosTime_UTO':time_to_interval(UTO, UTO2), - #'TimeBase_IntervalT'{lower_bound=LB, upper_bound = UB} = - 'CosTime_TIO':'_get_time_interval'(TIO), - UB-LB. - -check_deadline(DL) when is_tuple(DL) -> - {M,S,U} = erlang:timestamp(), - DL >= {-M,-S,-U}; -check_deadline(_DL) -> - %% This case will cover if no timeout is set. - false. - -check_start_time(ST) when is_tuple(ST) -> - {M,S,U} = erlang:timestamp(), - ST >= {-M,-S,-U}; -check_start_time(_ST) -> - %% This case will cover if no earliest delivery time is set. - true. - -%%------------------------------------------------------------ -%% function : extract_value -%% Arguments: A Property Sequence -%% ID - wanted property string() -%% Other - default-value. -%% Returns : Value associated with given ID or default value. -%%------------------------------------------------------------ -extract_value([], _, Other) -> - Other; -extract_value([#'CosNotification_Property'{name=ID, value=V}|_], ID, _) -> - any:get_value(V); -extract_value([_H|T], ID, Other) -> - extract_value(T, ID, Other). - -%%------------------------------------------------------------ -%% function : get_event -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -get_event(DBRef) -> - get_event(DBRef, true). -get_event(DBRef, Delete) -> - case get_events(DBRef, 1, Delete) of - {[], false} -> - {[], false}; - {[], false, Keys} -> - {[], false, Keys}; - {[Event], Bool} -> - {Event, Bool}; - {[Event], Bool, Keys} -> - {Event, Bool, Keys} - end. - -%%------------------------------------------------------------ -%% function : get_events -%% Arguments: -%% Returns : A list of events (possibly empty) and a boolean -%% indicating if event found. -%% Comments : Try to extract Max events from the database. -%%------------------------------------------------------------ -get_events(#dbRef{orderRef = ORef, discardRef = DRef}, Max) -> - event_loop(ets:last(ORef), ORef, DRef, Max, [], [], true). - -get_events(#dbRef{orderRef = ORef, discardRef = DRef}, Max, Delete) -> - event_loop(ets:last(ORef), ORef, DRef, Max, [], [], Delete). - -event_loop('$end_of_table', _, _, _, [], _, true) -> - {[], false}; -event_loop('$end_of_table', _, _, _, [], [], _) -> - {[], false, []}; -event_loop('$end_of_table', _ORef, _, _, Accum, _Keys, true) -> - {lists:reverse(Accum), true}; -event_loop('$end_of_table', _ORef, _, _, Accum, Keys, _) -> - {lists:reverse(Accum), true, Keys}; -event_loop(_, _ORef, _, 0, [], _Keys, true) -> - %% Only possible if some tries to pull a sequence of 0 events. - %% Should we really test for this case? - {[], false}; -event_loop(_, _ORef, _, 0, [], Keys, _) -> - {[], false, Keys}; -event_loop(_, _ORef, _, 0, Accum, _Keys, true) -> - {lists:reverse(Accum), true}; -event_loop(_, _ORef, _, 0, Accum, Keys, _) -> - {lists:reverse(Accum), true, Keys}; -event_loop(Key, ORef, undefined, Left, Accum, Keys, Delete) -> - [{_,DL,ST,_PO,Event}]=ets:lookup(ORef, Key), - case check_deadline(DL) of - true -> - ets:delete(ORef, Key), - event_loop(ets:prev(ORef, Key), ORef, undefined, - Left, Accum, Keys, Delete); - false -> - case check_start_time(ST) of - true when Delete == true -> - ets:delete(ORef, Key), - event_loop(ets:prev(ORef, Key), ORef, undefined, - Left-1, [Event|Accum], Keys, Delete); - true -> - event_loop(ets:prev(ORef, Key), ORef, undefined, - Left-1, [Event|Accum], [{ORef, Key}|Keys], Delete); - false -> - event_loop(ets:prev(ORef, Key), ORef, undefined, - Left, Accum, Keys, Delete) - end - end; -event_loop({Key1, Key2}, ORef, DRef, Left, Accum, Keys, Delete) -> - [{_,DL,ST,_PO,Event}]=ets:lookup(ORef, {Key1, Key2}), - case check_deadline(DL) of - true -> - ets:delete(ORef, {Key1, Key2}), - ets:delete(DRef, {Key2, Key1}), - event_loop(ets:prev(ORef, {Key1, Key2}), ORef, DRef, - Left, Accum, Keys, Delete); - false -> - case check_start_time(ST) of - true when Delete == true -> - ets:delete(ORef, {Key1, Key2}), - ets:delete(DRef, {Key2, Key1}), - event_loop(ets:prev(ORef, {Key1, Key2}), ORef, DRef, - Left-1, [Event|Accum], Keys, Delete); - true -> - event_loop(ets:prev(ORef, {Key1, Key2}), ORef, DRef, - Left-1, [Event|Accum], - [{ORef, {Key1, Key2}}, {DRef, {Key2, Key1}}|Keys], - Delete); - false -> - event_loop(ets:prev(ORef, {Key1, Key2}), ORef, DRef, - Left, Accum, Keys, Delete) - end - end; -event_loop({Key1, Key2, Key3}, ORef, DRef, Left, Accum, Keys, Delete) -> - [{_,DL,ST,_PO,Event}]=ets:lookup(ORef, {Key1, Key2, Key3}), - case check_deadline(DL) of - true -> - ets:delete(ORef, {Key1, Key2, Key3}), - ets:delete(DRef, {Key3, Key2, Key1}), - event_loop(ets:prev(ORef, {Key1, Key2, Key3}), ORef, DRef, - Left, Accum, Keys, Delete); - false -> - case check_start_time(ST) of - true when Delete == true -> - ets:delete(ORef, {Key1, Key2, Key3}), - ets:delete(DRef, {Key3, Key2, Key1}), - event_loop(ets:prev(ORef, {Key1, Key2, Key3}), ORef, DRef, - Left-1, [Event|Accum], Keys, Delete); - true -> - event_loop(ets:prev(ORef, {Key1, Key2, Key3}), ORef, DRef, - Left-1, [Event|Accum], - [{ORef, {Key1, Key2, Key3}}, - {DRef, {Key3, Key2, Key1}}|Keys], Delete); - false -> - event_loop(ets:prev(ORef, {Key1, Key2, Key3}), ORef, DRef, - Left, Accum, Keys, Delete) - end - end. - -%%------------------------------------------------------------ -%% function : delete_events -%% Arguments: EventList - what's returned by get_event, get_events -%% and add_and_get_event. -%% Returns : -%% Comment : Shall be invoked when it's safe to premanently remove -%% the events found in the EventList. -%% -%%------------------------------------------------------------ -delete_events([]) -> - ok; -delete_events([{DB, Key}|T]) -> - ets:delete(DB, Key), - delete_events(T). - -%%------------------------------------------------------------ -%% function : update -%% Arguments: -%% Returns : -%% Comment : As default we shall deliver Events in Priority order. -%% Hence, if AnyOrder set we will still deliver in -%% Priority order. -%%------------------------------------------------------------ -update(undefined, _QoS) -> - ok; -update(DBRef, QoS) -> - update(DBRef, QoS, undefined, undefined). - -update(DBRef, QoS, LifeFilter, PrioFilter) -> - case updated_order(DBRef, ?not_GetOrderPolicy(QoS)) of - false -> - case updated_discard(DBRef, ?not_GetDiscardPolicy(QoS)) of - false -> - DBR2 = ?set_DefPriority(DBRef, ?not_GetPriority(QoS)), - DBR3 = ?set_MaxEvents(DBR2, ?not_GetMaxEventsPerConsumer(QoS)), - DBR4 = ?set_DefStopT(DBR3, ?not_GetTimeout(QoS)), - DBR5 = ?set_StartTsupport(DBR4, ?not_GetStartTimeSupported(QoS)), - DBR6 = ?set_StopTsupport(DBR5, ?not_GetStopTimeSupported(QoS)), - case ets:info(?get_OrderRef(DBR6), size) of - N when N =< ?get_MaxEvents(DBR6) -> - %% Even if the QoS MaxEvents have been changed - %% we don't reach the limit. - DBR6; - N -> - %% The QoS MaxEvents must have been decreased. - discard_events(DBR6, N-?get_MaxEvents(DBR6)), - DBR6 - end; - true -> - destroy_discard_db(DBRef), - NewDBRef = create_db(QoS, ?get_GCTime(DBRef), ?get_GCLimit(DBRef), - ?get_TimeRef(DBRef)), - move_events(DBRef, NewDBRef, ets:first(?get_OrderRef(DBRef)), - LifeFilter, PrioFilter) - end; - true -> - destroy_discard_db(DBRef), - NewDBRef = create_db(QoS, ?get_GCTime(DBRef), ?get_GCLimit(DBRef), - ?get_TimeRef(DBRef)), - move_events(DBRef, NewDBRef, ets:first(?get_OrderRef(DBRef)), - LifeFilter, PrioFilter) - end. - -updated_order(#dbRef{orderPolicy = Equal}, Equal) -> false; -updated_order(#dbRef{orderPolicy = ?not_PriorityOrder}, ?not_AnyOrder) -> false; -updated_order(#dbRef{orderPolicy = ?not_AnyOrder}, ?not_PriorityOrder) -> false; -updated_order(_, _) -> true. - -updated_discard(#dbRef{discardPolicy = Equal}, Equal) -> false; -updated_discard(#dbRef{discardPolicy = ?not_RejectNewEvents}, ?not_AnyOrder) -> false; -updated_discard(#dbRef{discardPolicy = ?not_AnyOrder}, ?not_RejectNewEvents) -> false; -updated_discard(_, _) -> true. - -move_events(DBRef, NewDBRef, '$end_of_table', _, _) -> - destroy_order_db(DBRef), - case ets:info(?get_OrderRef(NewDBRef), size) of - N when N =< ?get_MaxEvents(NewDBRef) -> - %% Even if the QoS MaxEvents have been changed - %% we don't reach the limit. - NewDBRef; - N -> - %% The QoS MaxEvents must have been decreased. - discard_events(DBRef, N-?get_MaxEvents(NewDBRef)), - NewDBRef - end; -move_events(DBRef, NewDBRef, Key, LifeFilter, PrioFilter) -> - [{Keys, DeadLine, StartTime, PriorityOverride, Event}] = - ets:lookup(?get_OrderRef(DBRef), Key), - case check_deadline(DeadLine) of - true -> - ok; - _-> - write_event(?get_OrderP(DBRef), - {Keys, DeadLine, StartTime, PriorityOverride, Event}, - DBRef, NewDBRef, Key, LifeFilter, PrioFilter) - end, - ets:delete(?get_OrderRef(DBRef), Key), - move_events(DBRef, NewDBRef, ets:next(?get_OrderRef(DBRef), Key), - LifeFilter, PrioFilter). - -%% We cannot use do_add_event directly since we MUST lookup the timestamp (TS). -write_event(?not_DeadlineOrder, {{_, TS, _Prio}, DL, ST, PO, Event}, _DBRef, NewDBRef, - _Key, _LifeFilter, _PrioFilter) -> - StartT = update_starttime(NewDBRef, Event, ST), - %% Deadline and Priority previously extracted. - do_add_event(NewDBRef, Event, TS, DL, StartT, PO); -write_event(?not_DeadlineOrder, {{_, TS}, DL, _ST, PO, Event}, _DBRef, NewDBRef, - _Key, _LifeFilter, PrioFilter) -> - %% Priority not previously extracted. - POverride = update_priority(NewDBRef, PrioFilter, Event, PO), - StartT = extract_start_time(Event, ?get_StartTsupport(NewDBRef), - ?get_TimeRef(NewDBRef)), - do_add_event(NewDBRef, Event, TS, DL, StartT, POverride); -write_event(?not_FifoOrder, {{TS, _PorD}, DL, ST, PO, Event}, _DBRef, NewDBRef, - _Key, LifeFilter, PrioFilter) -> - %% Priority or Deadline have been extracted before but we cannot tell which. - POverride = update_priority(NewDBRef, PrioFilter, Event, PO), - DeadL = update_deadline(NewDBRef, LifeFilter, Event, TS, DL), - StartT = update_starttime(NewDBRef, Event, ST), - do_add_event(NewDBRef, Event, TS, DeadL, StartT, POverride); -write_event(?not_FifoOrder, {TS, DL, ST, PO, Event}, _DBRef, NewDBRef, - _Key, LifeFilter, PrioFilter) -> - %% Priority and Deadline not extracetd before. Do it now. - POverride = update_priority(NewDBRef, PrioFilter, Event, PO), - DeadL = update_deadline(NewDBRef, LifeFilter, Event, TS, DL), - StartT = update_starttime(NewDBRef, Event, ST), - do_add_event(NewDBRef, Event, TS, DeadL, StartT, POverride); -%% Order Policy must be AnyOrder or PriorityOrder. -write_event(_, {{_Prio, TS}, DL, ST, PO, Event}, _DBRef, NewDBRef, - _Key, LifeFilter, _PrioFilter) -> - DeadL = update_deadline(NewDBRef, LifeFilter, Event, TS, DL), - StartT = update_starttime(NewDBRef, Event, ST), - do_add_event(NewDBRef, Event, TS, DeadL, StartT, PO); -write_event(_, {{_Prio, TS, DL}, DL, ST, PO, Event}, _DBRef, NewDBRef, _Key, _, _) -> - %% Both Deadline and Priority have been extracetd before. - StartT = update_starttime(NewDBRef, Event, ST), - do_add_event(NewDBRef, Event, TS, DL, StartT, PO). - - -%%------------------------------------------------------------ -%% function : update_priority -%% Arguments: -%% Returns : -%% Comment : The purpose with this function is to avoid -%% calling MappingFilter priority again, especially -%% deadline again (we especially want to avoid calling -%% since it may require intra-ORB communication. -%% Use only when doing an update. -%%------------------------------------------------------------ -update_priority(DBRef, PrioFilter, Event, OldPrio) when is_atom(OldPrio) -> - get_prio_mapping_value(DBRef, PrioFilter, Event); -update_priority(_DBRef, _PrioFilter, _Event, OldPrio) -> - OldPrio. - -%%------------------------------------------------------------ -%% function : update_deadline -%% Arguments: -%% Returns : -%% Comment : The purpose with this function is to avoid -%% calling MappingFilter or parsing the events for -%% deadline again (we especially want to avoid calling -%% the MappingFilter since it may require intra-ORB -%% communication. Use only when doing an update. -%%------------------------------------------------------------ -update_deadline(DBRef, _LifeFilter, _Event, _TS, _OldDeadL) when - ?get_DiscardP(DBRef) =/= ?not_DeadlineOrder, - ?get_OrderP(DBRef) =/= ?not_DeadlineOrder, - ?is_StopTNotSupported(DBRef) -> - %% We do not need to extract the Deadline since it will not be used. - false; -update_deadline(DBRef, LifeFilter, Event, TS, OldDeadL) when is_atom(OldDeadL) -> - %% We need the Deadline and it have not been extracetd before. - DOverride = get_life_mapping_value(DBRef, LifeFilter, Event), - %% We must find out when the event was delivered; setting a deadline using - %% a new timestamp would not be accurate since we cannot tell for how long - %% the event have been waiting. - OldNow = convert_FIFO_Key(TS), - extract_deadline(Event, ?get_DefStopT(DBRef), ?get_StopTsupport(DBRef), - ?get_TimeRef(DBRef), DOverride, OldNow); -update_deadline(_DBRef, _LifeFilter, _Event, _TS, OldDeadL) -> - %% We need the Deadline and it have been extracetd before. - OldDeadL. - -%%------------------------------------------------------------ -%% function : update_starttime -%% Arguments: -%% Returns : -%% Comment : The purpose with this function is to avoid -%% parsing the events for starttime again. -%% Use only when doing an update. -%%------------------------------------------------------------ -update_starttime(DBRef, Event, OldStartT) when is_atom(OldStartT) -> - %% Probably not previously extracted; try to get it. - extract_start_time(Event, ?get_StartTsupport(DBRef), ?get_TimeRef(DBRef)); -update_starttime(_DBRef, _Event, OldStartT) -> - %% Previously extracted. - OldStartT. - -%%------------------------------------------------------------ -%% function : discard_events -%% Arguments: DBRef -%% N - number of events we must discard. -%% Returns : -%% Comment : As default we shall Reject New Events when the limit -%% is reached. Any discard order will do the same. -%% -%% This function can only be used for the discard policies -%% Fifo, Priority and Deadline. Any or RejectNewEvents -%% will not allow events to be stored at all, i.e., no events -%% to discard. Lifo will not be stored either since when -%% trying to add an event it is definitely the last event in. -%%------------------------------------------------------------ -%% Since no Discard DB must the same Order policy. -discard_events(#dbRef{orderRef = ORef, discardRef = undefined, - discardPolicy = ?not_DeadlineOrder}, N) -> - ?debug_print("Discarding ~p events Deadline Order.",[N]), - index_loop_backward(ets:last(ORef), undefined, ORef, N); -discard_events(#dbRef{orderRef = ORef, discardRef = DRef, - discardPolicy = ?not_DeadlineOrder}, N) -> - ?debug_print("Discarding ~p events Deadline Order.",[N]), - index_loop_backward(ets:last(DRef), DRef, ORef, N); -%% Fifo. -discard_events(#dbRef{orderRef = ORef, discardRef = undefined, - discardPolicy = ?not_FifoOrder}, N) -> - ?debug_print("Discarding ~p events Fifo Order.",[N]), - index_loop_backward(ets:last(ORef), undefined, ORef, N); -discard_events(#dbRef{orderRef = ORef, discardRef = DRef, - discardPolicy = ?not_FifoOrder}, N) -> - ?debug_print("Discarding ~p events Fifo Order.",[N]), - index_loop_backward(ets:last(DRef), DRef, ORef, N); -%% Lifo- or Priority-Order -discard_events(#dbRef{orderRef = ORef, discardRef = undefined}, N) -> - ?debug_print("Discarding ~p events Lifo- or Priority-Order.",[N]), - index_loop_forward(ets:first(ORef), undefined, ORef, N); -discard_events(#dbRef{orderRef = ORef, discardRef = DRef}, N) -> - ?debug_print("Discarding ~p events Lifo- or Priority-Order.",[N]), - index_loop_forward(ets:first(DRef), DRef, ORef, N). - - -index_loop_forward('$end_of_table', _, _, _Left) -> - ok; -index_loop_forward(_, _, _, 0) -> - ok; -index_loop_forward(Key, undefined, ORef, Left) -> - ets:delete(ORef, Key), - NewKey=ets:next(ORef, Key), - index_loop_forward(NewKey, undefined, ORef, Left-1); - -index_loop_forward({Key1, Key2, Key3}, DRef, ORef, Left) -> - ets:delete(DRef, {Key1, Key2, Key3}), - ets:delete(ORef, {Key3, Key2, Key1}), - NewKey=ets:next(DRef, {Key1, Key2, Key3}), - index_loop_forward(NewKey, DRef, ORef, Left-1); - -index_loop_forward({Key1, Key2}, DRef, ORef, Left) -> - ets:delete(DRef, {Key1, Key2}), - ets:delete(ORef, {Key2, Key1}), - NewKey=ets:next(DRef, {Key1, Key2}), - index_loop_forward(NewKey, DRef, ORef, Left-1). - -index_loop_backward('$end_of_table', _, _, _) -> - ok; -index_loop_backward(_, _, _, 0) -> - ok; -index_loop_backward(Key, undefined, ORef, Left) -> - ets:delete(ORef, Key), - NewKey=ets:prev(ORef, Key), - index_loop_backward(NewKey, undefined, ORef, Left-1); -index_loop_backward({Key1, Key2}, DRef, ORef, Left) -> - ets:delete(DRef, {Key1, Key2}), - ets:delete(ORef, {Key2, Key1}), - NewKey=ets:prev(DRef, {Key1, Key2}), - index_loop_backward(NewKey, DRef, ORef, Left-1); -index_loop_backward({Key1, Key2, Key3}, DRef, ORef, Left) -> - ets:delete(DRef, {Key1, Key2, Key3}), - ets:delete(ORef, {Key3, Key2, Key1}), - NewKey=ets:prev(DRef, {Key1, Key2, Key3}), - index_loop_backward(NewKey, DRef, ORef, Left-1). - -%%------------------------------------------------------------ -%% function : add_and_get_event -%% Arguments: DBRef and Event -%% Returns : {[], bool()} | {Event, bool()} -%% Comment : This function is a mixture of ad anf get events. -%% The intended use to avoid storing an event when -%% not necessary. -%%------------------------------------------------------------ -add_and_get_event(DBRef, Event) -> - add_and_get_event(DBRef, Event, undefined, undefined, true). - -add_and_get_event(DBRef, Event, Delete) -> - add_and_get_event(DBRef, Event, undefined, undefined, Delete). - -add_and_get_event(DBRef, Event, LifeFilter, PrioFilter) -> - add_and_get_event(DBRef, Event, LifeFilter, PrioFilter, true). - -add_and_get_event(DBRef, Event, LifeFilter, PrioFilter, Delete) -> - case ets:info(?get_OrderRef(DBRef), size) of - 0 when ?is_StartTNotSupported(DBRef), ?is_StopTNotSupported(DBRef), - Delete == true -> - %% No stored events and no timeouts used; just return the event. - {Event, false}; - 0 when ?is_StartTNotSupported(DBRef), ?is_StopTNotSupported(DBRef) -> - %% No stored events and no timeouts used; just return the event. - {Event, false, []}; - 0 when ?is_StartTNotSupported(DBRef) -> - %% Only deadline supported, lookup values and cehck if ok. - DOverride = get_life_mapping_value(DBRef, LifeFilter, Event), - DL = extract_deadline(Event, ?get_DefStopT(DBRef), - ?get_StopTsupport(DBRef), ?get_TimeRef(DBRef), - DOverride), - case check_deadline(DL) of - true when Delete == true -> - %% Expired, just discard the event. - {[], false}; - true -> - {[], false, []}; - _ when Delete == true -> - %% Not expired, we can safely return the event. - {Event, false}; - _ -> - %% Not expired, we can safely return the event. - {Event, false, []} - end; - 0 when ?is_StopTNotSupported(DBRef) -> - %% Only starttime allowed, test if we can deliver the event now. - ST = extract_start_time(Event, ?get_StartTsupport(DBRef), - ?get_TimeRef(DBRef)), - case check_start_time(ST) of - false when Delete == true -> - DOverride = get_life_mapping_value(DBRef, LifeFilter, Event), - POverride = get_prio_mapping_value(DBRef, PrioFilter, Event), - DL = extract_deadline(Event, ?get_DefStopT(DBRef), - ?get_StopTsupport(DBRef), - ?get_TimeRef(DBRef), DOverride), - do_add_event(DBRef, Event, create_FIFO_Key(), DL, ST, POverride), - {[], true}; - false -> - DOverride = get_life_mapping_value(DBRef, LifeFilter, Event), - POverride = get_prio_mapping_value(DBRef, PrioFilter, Event), - DL = extract_deadline(Event, ?get_DefStopT(DBRef), - ?get_StopTsupport(DBRef), - ?get_TimeRef(DBRef), DOverride), - do_add_event(DBRef, Event, create_FIFO_Key(), DL, ST, POverride), - {[], true, []}; - _ when Delete == true -> - %% Starttime ok, just return the event. - {Event, false}; - _ -> - %% Starttime ok, just return the event. - {Event, false, []} - end; - _-> - %% Event already stored, just have to accept the overhead. - ST = extract_start_time(Event, ?get_StartTsupport(DBRef), - ?get_TimeRef(DBRef)), - DOverride = get_life_mapping_value(DBRef, LifeFilter, Event), - POverride = get_prio_mapping_value(DBRef, PrioFilter, Event), - DL = extract_deadline(Event, ?get_DefStopT(DBRef), - ?get_StopTsupport(DBRef), - ?get_TimeRef(DBRef), DOverride), - do_add_event(DBRef, Event, create_FIFO_Key(), DL, ST, POverride), - get_event(DBRef, Delete) - end. - -%%------------------------------------------------------------ -%% function : add_event -%% Arguments: DBRef and Event -%% Returns : true (or whatever 'ets:insert' returns) | -%% {'EXCEPTION', #'IMP_LIMIT'{}} -%% Comment : As default we shall deliver Events in Priority order. -%% Hence, if AnyOrder set we will still deliver in -%% Priority order. But we cannot use only the Priority -%% value since if "all" events have the same priority -%% there is a risk that some never will be delivered if -%% the EventDB always contain events. -%% -%% When discard and order policy is equal we only use one -%% DB since all we have to do is to "read from the other -%% end" to discard the correct event(s). -%% -%% In the discard DB we must also store keys necessary to -%% lookup the event in the order DB. -%% -%% If event limit reached 'IMPL_LIMIT' is raised if -%% the discard policy is RejectNewEvents or AnyOrder. -%% Theses two policies we currently define to be equal. -%%------------------------------------------------------------ - -add_event(DBRef, Event) -> - %% Save overhead by first checking if we really need to extract - %% Deadline and/or Priority. - Deadline = get_life_mapping_value(DBRef, undefined, Event), - Priority = get_prio_mapping_value(DBRef, undefined, Event), - add_event_helper(DBRef, Event, Deadline, Priority). - -add_event(DBRef, Event, LifeFilter, PrioFilter) -> - %% Save overhead by first checking if we really need to extract - %% Deadline and/or Priority. - Deadline = get_life_mapping_value(DBRef, LifeFilter, Event), - Priority = get_prio_mapping_value(DBRef, PrioFilter, Event), - add_event_helper(DBRef, Event, Deadline, Priority). - -add_event_helper(DBRef, Event, DOverride, POverride) -> - case ets:info(?get_OrderRef(DBRef), size) of - N when N < ?get_MaxEvents(DBRef), N > ?get_GCLimit(DBRef) -> - gc_events(DBRef, low), - DL = extract_deadline(Event, ?get_DefStopT(DBRef), - ?get_StopTsupport(DBRef), ?get_TimeRef(DBRef), - DOverride), - case check_deadline(DL) of - true -> - true; - _ -> - ST = extract_start_time(Event, ?get_StartTsupport(DBRef), - ?get_TimeRef(DBRef)), - do_add_event(DBRef, Event, create_FIFO_Key(), DL, ST, POverride) - end; - N when N < ?get_MaxEvents(DBRef) -> - DL = extract_deadline(Event, ?get_DefStopT(DBRef), - ?get_StopTsupport(DBRef), ?get_TimeRef(DBRef), - DOverride), - case check_deadline(DL) of - true -> - true; - _ -> - ST = extract_start_time(Event, ?get_StartTsupport(DBRef), - ?get_TimeRef(DBRef)), - do_add_event(DBRef, Event, create_FIFO_Key(), DL, ST, POverride) - end; - _N when ?get_DiscardP(DBRef) == ?not_RejectNewEvents -> - gc_events(DBRef, low), - corba:raise(#'IMP_LIMIT'{completion_status=?COMPLETED_NO}); - _N when ?get_DiscardP(DBRef) == ?not_AnyOrder -> - gc_events(DBRef, low), - corba:raise(#'IMP_LIMIT'{completion_status=?COMPLETED_NO}); - _N when ?get_DiscardP(DBRef) == ?not_LifoOrder -> - gc_events(DBRef, low), - corba:raise(#'IMP_LIMIT'{completion_status=?COMPLETED_NO}); - _N -> - gc_events(DBRef, low), - %% Other discard policy; we must first store the event - %% and the look up in the Discard DB which event we - %% should remove. - DL = extract_deadline(Event, ?get_DefStopT(DBRef), - ?get_StopTsupport(DBRef), ?get_TimeRef(DBRef), - DOverride), - case check_deadline(DL) of - true -> - true; - _ -> - ST = extract_start_time(Event, ?get_StartTsupport(DBRef), - ?get_TimeRef(DBRef)), - do_add_event(DBRef, Event, create_FIFO_Key(), DL, ST, POverride), - discard_events(DBRef, 1) - end - end. - - -do_add_event(#dbRef{orderRef = ORef, orderPolicy = ?not_DeadlineOrder, - discardRef = DRef, discardPolicy = ?not_PriorityOrder, - defPriority = DefPrio, defStopT = _DefStopT}, Event, Key, DL, ST, PO) -> - Prio = extract_priority(Event, DefPrio, PO), - ets:insert(ORef, {{DL, Key, Prio}, DL, ST, PO, Event}), - ets:insert(DRef, {{Prio, Key, DL}}); -do_add_event(#dbRef{orderRef = ORef, orderPolicy = ?not_DeadlineOrder, - discardRef = DRef, discardPolicy = ?not_FifoOrder, - defStopT = _DefStopT}, Event, Key, DL, ST, PO) -> - ets:insert(ORef, {{DL, Key}, DL, ST, PO, Event}), - ets:insert(DRef, {{Key, DL}}); -do_add_event(#dbRef{orderRef = ORef, orderPolicy = ?not_DeadlineOrder, - discardRef = DRef, discardPolicy = ?not_LifoOrder, - defStopT = _DefStopT}, Event, Key, DL, ST, PO) -> - ets:insert(ORef, {{DL, Key}, DL, ST, PO, Event}), - ets:insert(DRef, {{Key, DL}}); -%% Either the same (DeadlineOrder), RejectNewEvents or AnyOrder. No need -%% to store anything in the discard policy, i.e., if the same we'll just -%% read "from the other end" and AnyOrder and RejectNewEvents is equal. -do_add_event(#dbRef{orderRef = ORef, orderPolicy = ?not_DeadlineOrder, - defStopT = _DefStopT}, Event, Key, DL, ST, PO) -> - ets:insert(ORef, {{DL, Key}, DL, ST, PO, Event}); - - -do_add_event(#dbRef{orderRef = ORef, orderPolicy = ?not_FifoOrder, - discardRef = DRef, discardPolicy = ?not_DeadlineOrder, - defStopT = _DefStopT}, Event, Key, DL, ST, PO) -> - ets:insert(ORef, {{Key, DL}, DL, ST, PO, Event}), - ets:insert(DRef, {{DL, Key}}); -do_add_event(#dbRef{orderRef = ORef, orderPolicy = ?not_FifoOrder, - discardRef = DRef, discardPolicy = ?not_PriorityOrder, - defPriority = DefPrio}, Event, Key, DL, ST, PO) -> - Prio = extract_priority(Event, DefPrio, PO), - ets:insert(ORef, {{Key, Prio}, DL, ST, PO, Event}), - ets:insert(DRef, {{Prio, Key}}); -%% The discard policy must RejectNewEvents, AnyOrder, Fifo or Lifo order. -do_add_event(#dbRef{orderRef = ORef, orderPolicy = ?not_FifoOrder, - discardRef = _DRef}, Event, Key, DL, ST, PO) -> - ets:insert(ORef, {Key, DL, ST, PO, Event}); - -%% Order Policy must be AnyOrder or PriorityOrder. -do_add_event(#dbRef{orderRef = ORef, - discardRef = DRef, discardPolicy = ?not_DeadlineOrder, - defPriority = DefPrio, defStopT = _DefStopT}, Event, Key, DL, ST, PO) -> - Prio = extract_priority(Event, DefPrio, PO), - ets:insert(ORef, {{Prio, Key, DL}, DL, ST, PO, Event}), - ets:insert(DRef, {{DL, Key, Prio}}); -do_add_event(#dbRef{orderRef = ORef, - discardRef = DRef, discardPolicy = ?not_FifoOrder, - defPriority = DefPrio}, Event, Key, DL, ST, PO) -> - Prio = extract_priority(Event, DefPrio, PO), - ets:insert(ORef, {{Prio, Key}, DL, ST, PO, Event}), - ets:insert(DRef, {{Key, Prio}}); - -do_add_event(#dbRef{orderRef = ORef, - discardRef = DRef, discardPolicy = ?not_LifoOrder, - defPriority = DefPrio}, Event, Key, DL, ST, PO) -> - Prio = extract_priority(Event, DefPrio, PO), - ets:insert(ORef, {{Prio, Key}, DL, ST, PO, Event}), - ets:insert(DRef, {{Key, Prio}}); - -%% Order Policy must be AnyOrder or PriorityOrder and Discard Policy must be -%% AnyOrder or RejectNewEvents -do_add_event(#dbRef{orderRef = ORef, defPriority = DefPrio}, Event, Key, DL, ST, PO) -> - Prio = extract_priority(Event, DefPrio, PO), - ets:insert(ORef, {{Prio, Key}, DL, ST, PO, Event}). - -%%------------------------------------------------------------ -%% function : destroy_db -%% Arguments: A DB reference -%% Returns : -%%------------------------------------------------------------ -destroy_db(#dbRef{orderRef = ORef, discardRef = undefined}) -> - ets:delete(ORef); -destroy_db(#dbRef{orderRef = ORef, discardRef = DRef}) -> - ets:delete(ORef), - ets:delete(DRef). - -%%------------------------------------------------------------ -%% function : destroy_discard_db -%% Arguments: A DB reference -%% Returns : -%%------------------------------------------------------------ -destroy_discard_db(#dbRef{discardRef = undefined}) -> - ok; -destroy_discard_db(#dbRef{discardRef = DRef}) -> - ets:delete(DRef). - -%%------------------------------------------------------------ -%% function : destroy_order_db -%% Arguments: A DB reference -%% Returns : -%%------------------------------------------------------------ -destroy_order_db(#dbRef{orderRef = ORef}) -> - ets:delete(ORef). - -%%------------------------------------------------------------ -%% function : create_db -%% Arguments: QoS (local representation). -%% Returns : A DB reference -%%------------------------------------------------------------ -create_db(QoS, GCTime, GCLimit, TimeRef) -> - DiscardRef = - case {?not_GetDiscardPolicy(QoS), ?not_GetOrderPolicy(QoS)} of - {Equal, Equal} -> - undefined; - {?not_PriorityOrder, ?not_AnyOrder} -> - %% NOTE: Any- and Priority-Order delivery policy is equal. - undefined; - {?not_RejectNewEvents, _} -> - undefined; - {?not_AnyOrder, _} -> - undefined; - {?not_LifoOrder, ?not_FifoOrder} -> - undefined; - _ -> - ets:new(oe_ets, [set, public, ordered_set]) - end, - DBRef = ?CreateRef(ets:new(oe_ets, [set, public, ordered_set]), - DiscardRef, - ?not_GetOrderPolicy(QoS), ?not_GetDiscardPolicy(QoS), - ?not_GetPriority(QoS), ?not_GetMaxEventsPerConsumer(QoS), - ?not_GetTimeout(QoS), ?not_GetStartTimeSupported(QoS), - ?not_GetStopTimeSupported(QoS), GCTime, GCLimit, TimeRef), - if - ?is_TimeoutNotUsed(DBRef), ?is_StopTNotSupported(DBRef) -> - ok; - true -> - TS = erlang:monotonic_time(), - {resolution, TR} = lists:keyfind(resolution, 1, - erlang:system_info(os_monotonic_time_source)), - put(oe_GC_timestamp, TS+GCTime*TR) - end, - DBRef. - -%%------------------------------------------------------------ -%% function : get_prio_mapping_value -%% Arguments: A MappingFilter reference | undefined -%% Event (Any or Structured) -%% Returns : undefined | Data -%%------------------------------------------------------------ -get_prio_mapping_value(DBRef, _, _) when ?get_DiscardP(DBRef) =/= ?not_PriorityOrder, - ?get_OrderP(DBRef) =/= ?not_AnyOrder, - ?get_OrderP(DBRef) =/= ?not_PriorityOrder -> - false; -get_prio_mapping_value(_, undefined, _) -> - undefined; -get_prio_mapping_value(_, MFilter, Event) when is_record(Event, 'any') -> - case catch 'CosNotifyFilter_MappingFilter':match(MFilter, Event) of - {false, DefVal} when is_record(DefVal, 'any') -> - any:get_value(DefVal); - {true, Matched} when is_record(Matched, 'any') -> - any:get_value(Matched); - _ -> - undefined - end; -get_prio_mapping_value(_, MFilter, Event) -> - case catch 'CosNotifyFilter_MappingFilter':match_structured(MFilter, Event) of - {false, DefVal} when is_record(DefVal, 'any') -> - any:get_value(DefVal); - {true, Matched} when is_record(Matched, 'any') -> - any:get_value(Matched); - _ -> - undefined - end. - -%%------------------------------------------------------------ -%% function : get_life_mapping_value -%% Arguments: A MappingFilter reference | undefined -%% Event (Any or Structured) -%% Returns : undefined | Data -%%------------------------------------------------------------ -get_life_mapping_value(DBRef, _, _) when ?get_DiscardP(DBRef) =/= ?not_DeadlineOrder, - ?get_OrderP(DBRef) =/= ?not_DeadlineOrder, - ?is_StopTNotSupported(DBRef) -> - false; -get_life_mapping_value(_, undefined, _) -> - undefined; -get_life_mapping_value(_, MFilter, Event) when is_record(Event, 'any') -> - case catch 'CosNotifyFilter_MappingFilter':match(MFilter, Event) of - {false, DefVal} when is_record(DefVal, 'any') -> - any:get_value(DefVal); - {true, Matched} when is_record(Matched, 'any') -> - any:get_value(Matched); - _ -> - undefined - end; -get_life_mapping_value(_, MFilter, Event) -> - case catch 'CosNotifyFilter_MappingFilter':match_structured(MFilter, Event) of - {false, DefVal} when is_record(DefVal, 'any') -> - any:get_value(DefVal); - {true, Matched} when is_record(Matched, 'any') -> - any:get_value(Matched); - _ -> - undefined - end. - -%%------------------------------------------------------------ -%% function : validate_event -%% Arguments: Subscribe data -%% A sequence of Events, 'structured' or an 'any' record -%% A list of filter references -%% Status, i.e., do we have to filter the events or just check subscr. -%% Returns : A tuple of two lists; list1 the events that passed -%% and list2 the events that didn't pass. -%%------------------------------------------------------------ -validate_event(true, Events, Filters, _, 'MATCH') -> - filter_events(Events, Filters, false); -validate_event(true, Events, _Filters, _, _) -> - {Events, []}; -validate_event({_Which, _WC}, Event, Filters, _, 'MATCH') when is_record(Event, any) -> - filter_events(Event, Filters, false); -validate_event({_Which, _WC}, Event, _Filters, _, _) when is_record(Event, any) -> - {Event, []}; -validate_event({Which, WC}, Events, Filters, DBRef, 'MATCH') -> - Passed=validate_event2(DBRef, Events, Which, WC, []), - filter_events(Passed, Filters, true); -validate_event({Which, WC}, Events, _Filters, DBRef, _) -> - Passed=validate_event2(DBRef, Events, Which, WC, []), - {lists:reverse(Passed), []}. - -validate_event2(_, [], _, _, []) -> - []; -validate_event2(_, [], _, _, Acc) -> - Acc; -validate_event2(DBRef, [Event|T], Which, WC, Acc) -> - ET = ((Event#'CosNotification_StructuredEvent'.header) - #'CosNotification_EventHeader'.fixed_header) - #'CosNotification_FixedEventHeader'.event_type, - CheckList = - case Which of - both -> - [ET]; - domain -> - [ET, - ET#'CosNotification_EventType'{type_name=""}, - ET#'CosNotification_EventType'{type_name="*"}]; - type -> - [ET, - ET#'CosNotification_EventType'{domain_name=""}, - ET#'CosNotification_EventType'{domain_name="*"}]; - _ -> - [ET, - ET#'CosNotification_EventType'{type_name=""}, - ET#'CosNotification_EventType'{type_name="*"}, - ET#'CosNotification_EventType'{domain_name=""}, - ET#'CosNotification_EventType'{domain_name="*"}] - end, - case check_subscription(DBRef, CheckList) of - true -> - validate_event2(DBRef, T, Which, WC, [Event|Acc]); - _-> - case catch cosNotification_Filter:match_types( - ET#'CosNotification_EventType'.domain_name, - ET#'CosNotification_EventType'.type_name, - WC) of - true -> - validate_event2(DBRef, T, Which, WC, [Event|Acc]); - _-> - validate_event2(DBRef, T, Which, WC, Acc) - end - end. - -check_subscription(_, []) -> - false; -check_subscription(DBRef, [H|T]) -> - case ets:lookup(DBRef, H) of - [] -> - check_subscription(DBRef, T); - _ -> - true - end. - - -%%------------------------------------------------------------ -%% function : filter_events -%% Arguments: A sequence of structured Events or #any -%% Returns : A tuple of two lists; list1 the events that passed -%% and list2 the events that didn't pass. -%%------------------------------------------------------------ - -filter_events(Events, []) -> - {Events, []}; -filter_events(Events, Filters) -> - filter_events(Events, Filters, [], [], false). - -filter_events(Events, [], false) -> - {Events, []}; -filter_events(Events, [], _) -> - {lists:reverse(Events), []}; -filter_events(Events, Filters, Reversed) -> - filter_events(Events, Filters, [], [], Reversed). - -filter_events([], _, AccPassed, AccFailed, false) -> - {lists:reverse(AccPassed), lists:reverse(AccFailed)}; -filter_events([], _, AccPassed, AccFailed, _) -> - {AccPassed, AccFailed}; -filter_events([H|T], Filters, AccPassed, AccFailed, Reversed) -> - case call_filters(Filters, H) of - true -> - filter_events(T, Filters, [H|AccPassed], AccFailed, Reversed); - _ -> - filter_events(T, Filters, AccPassed, [H|AccFailed], Reversed) - end; -filter_events(Any, Filters, _AccPassed, _AccFailed, _Reversed) -> - case call_filters(Filters, Any) of - true -> - {Any, []}; - _ -> - {[], Any} - end. - -call_filters([], _) -> - false; -call_filters([{_,H}|T], Event) when is_record(Event, any) -> - case catch 'CosNotifyFilter_Filter':match(H, Event) of - true -> - true; - _-> - call_filters(T, Event) - end; -call_filters([{_,H}|T], Event) when ?not_isConvertedAny(Event) -> - case catch 'CosNotifyFilter_Filter':match(H, - Event#'CosNotification_StructuredEvent'.remainder_of_body) of - true -> - true; - _-> - call_filters(T, Event) - end; -call_filters([{_,H}|T], Event) -> - case catch 'CosNotifyFilter_Filter':match_structured(H, Event) of - true -> - true; - _-> - call_filters(T, Event) - end. - - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosNotification/test/Makefile b/lib/cosNotification/test/Makefile deleted file mode 100644 index 583cca1f42..0000000000 --- a/lib/cosNotification/test/Makefile +++ /dev/null @@ -1,192 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSNOTIFICATION_VSN) -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/cosNotification_test - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -TEST_SPEC_FILE = cosNotification.spec -COVER_FILE = cosNotification.cover - - -IDL_FILES = - -IDLOUTDIR = idl_output - -MODULES = \ - notification_SUITE \ - grammar_SUITE \ - eventDB_SUITE \ - generated_SUITE \ - notify_test_impl - -GEN_MODULES = \ - oe_notify_test_server \ - notify_test_data \ - notify_test_computer \ - notify_test_studies \ - notify_test_ShortArray \ - notify_test_uni1 \ - notify_test_uni2 \ - notify_test_X \ - notify_test_K \ - notify_test_SeqPushC \ - notify_test_StrPushC \ - notify_test_AnyPushC \ - notify_test_SeqPullC \ - notify_test_StrPullC \ - notify_test_AnyPullC \ - notify_test_SeqPushS \ - notify_test_StrPushS \ - notify_test_AnyPushS \ - notify_test_SeqPullS \ - notify_test_StrPullS \ - notify_test_AnyPullS \ - notify_test_funcs - -GEN_HRL_FILES = \ - oe_notify_test_server.hrl \ - notify_test_SeqPushC.hrl \ - notify_test_StrPushC.hrl \ - notify_test_AnyPushC.hrl \ - notify_test_SeqPullC.hrl \ - notify_test_StrPullC.hrl \ - notify_test_AnyPullC.hrl \ - notify_test_SeqPushS.hrl \ - notify_test_StrPushS.hrl \ - notify_test_AnyPushS.hrl \ - notify_test_SeqPullS.hrl \ - notify_test_StrPullS.hrl \ - notify_test_AnyPullS.hrl \ - notify_test.hrl \ - notify_test_funcs.hrl - -ERL_FILES = $(MODULES:%=%.erl) - -HRL_FILES = - -GEN_FILES = \ - $(GEN_HRL_FILES:%=$(IDLOUTDIR)/%) \ - $(GEN_MODULES:%=$(IDLOUTDIR)/%.erl) - -GEN_TARGET_FILES = $(GEN_MODULES:%=$(IDLOUTDIR)/%.$(EMULATOR)) - -SUITE_TARGET_FILES = $(MODULES:%=%.$(EMULATOR)) - -TARGET_FILES = \ - $(GEN_TARGET_FILES) \ - $(SUITE_TARGET_FILES) - - -# ---------------------------------------------------- -# PROGRAMS -# ---------------------------------------------------- -LOCAL_CLASSPATH = $(ERL_TOP)lib/cosNotification/priv:$(ERL_TOP)lib/cosNotification/test -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += \ - -pa $(ERL_TOP)/lib/cosNotification/ebin \ - -pa $(ERL_TOP)/lib/cosNotification/src \ - -pa $(ERL_TOP)/lib/cosTime/ebin \ - -pa $(ERL_TOP)/lib/cosTime/include \ - -pa $(ERL_TOP)/lib/orber/ebin \ - -pa $(ERL_TOP)/lib/ic/ebin \ - -pa $(ERL_TOP)/lib/cosNotification/include \ - -I$(ERL_TOP)/lib/cosEvent/src \ - -I$(ERL_TOP)/lib/cosNotification/include \ - -ERL_COMPILE_FLAGS += \ - $(ERL_IDL_FLAGS) \ - -pa $(ERL_TOP)/lib/orber/include \ - -pa $(ERL_TOP)/lib/cosEvent/ebin \ - -pa $(ERL_TOP)/lib/cosNotification/ebin \ - -pa $(ERL_TOP)/lib/cosNotification/test/idl_output \ - -pa $(ERL_TOP)/lib/cosTime/ebin \ - -pa $(ERL_TOP)/lib/cosTime/include \ - -pa $(ERL_TOP)/lib/cosNotification/include \ - -pa $(ERL_TOP)/lib/ic/ebin \ - -I$(ERL_TOP)/lib/cosTime/ebin \ - -I$(ERL_TOP)/lib/cosTime/include \ - -I$(ERL_TOP)/lib/orber/include \ - -I$(ERL_TOP)/lib/cosNotification/src \ - -I$(ERL_TOP)/lib/cosNotification/include \ - -I$(ERL_TOP)/lib/cosNotification \ - -I$(ERL_TOP)/lib/cosNotification/test/$(IDLOUTDIR) - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- - - -tests debug opt: $(TARGET_FILES) - -clean: - rm -f idl_output/* - rm -f $(TARGET_FILES) - rm -f errs core *~ - -docs: - -# ---------------------------------------------------- -# Special Targets -# ---------------------------------------------------- - -IDL-GENERATED: notify_test_server.idl - erlc $(ERL_COMPILE_FLAGS) -o$(IDLOUTDIR) \ - +'{cfgfile,"notify_test_server.cfg"}' notify_test_server.idl - >IDL-GENERATED - -$(GEN_FILES): IDL-GENERATED - -$(TARGET_FILES): IDL-GENERATED - -# ---------------------------------------------------- -# Release Targets -# ---------------------------------------------------- -# We don't copy generated intermediate erlang and hrl files - -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: - -release_docs_spec: - -release_tests_spec: tests - $(INSTALL_DIR) "$(RELSYSDIR)" - $(INSTALL_DATA) $(IDL_FILES) $(TEST_SPEC_FILE) \ - $(COVER_FILE) $(ERL_FILES) "$(RELSYSDIR)" - $(INSTALL_DIR) "$(RELSYSDIR)/$(IDLOUTDIR)" - $(INSTALL_DATA) $(GEN_TARGET_FILES) $(GEN_FILES) \ - "$(RELSYSDIR)/$(IDLOUTDIR)" - $(INSTALL_DATA) $(SUITE_TARGET_FILES) "$(RELSYSDIR)" - diff --git a/lib/cosNotification/test/cosNotification.cover b/lib/cosNotification/test/cosNotification.cover deleted file mode 100644 index 604f313521..0000000000 --- a/lib/cosNotification/test/cosNotification.cover +++ /dev/null @@ -1,2 +0,0 @@ -{incl_app,cosNotification,details}. - diff --git a/lib/cosNotification/test/cosNotification.spec b/lib/cosNotification/test/cosNotification.spec deleted file mode 100644 index 8ec1baca33..0000000000 --- a/lib/cosNotification/test/cosNotification.spec +++ /dev/null @@ -1 +0,0 @@ -{suites,"../cosNotification_test",all}. diff --git a/lib/cosNotification/test/eventDB_SUITE.erl b/lib/cosNotification/test/eventDB_SUITE.erl deleted file mode 100644 index a0c47ad4c7..0000000000 --- a/lib/cosNotification/test/eventDB_SUITE.erl +++ /dev/null @@ -1,896 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%-------------------------------------------------------------------- -%% File : eventDB_SUITE.erl -%% Purpose : -%%-------------------------------------------------------------------- - --module(eventDB_SUITE). -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% cosEvent files. --include_lib("cosEvent/include/CosEventChannelAdmin.hrl"). -%% cosTime files. --include_lib("cosTime/include/TimeBase.hrl"). -%% Application files --include_lib("cosNotification/include/CosNotification.hrl"). --include_lib("cosNotification/include/CosNotifyChannelAdmin.hrl"). --include_lib("cosNotification/include/CosNotifyComm.hrl"). --include_lib("cosNotification/include/CosNotifyFilter.hrl"). - --include_lib("cosNotification/src/CosNotification_Definitions.hrl"). - --include("idl_output/notify_test.hrl"). - --include_lib("common_test/include/ct.hrl"). - -%%--------------- DEFINES ------------------------------------ --define(default_timeout, test_server:minutes(20)). --define(match(ExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - io:format("------ CORRECT RESULT ------~n~p~n", - [AcTuAlReS]), - AcTuAlReS; - _ -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS) - end - end()). - - --define(EVENT1, ?not_CreateSE("","event1","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), 0)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=900000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=900000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="Timeout", - value=any:create(orber_tc:unsigned_long_long(), 900000000)}], - [], any:create(orber_tc:null(), null))). --define(EVENT2, ?not_CreateSE("","event2","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), 0)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=800000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=800000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="Timeout", - value=any:create(orber_tc:unsigned_long_long(), 800000000)}], - [], any:create(orber_tc:null(), null))). --define(EVENT3, ?not_CreateSE("","event3","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), 0)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=700000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=700000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="Timeout", - value=any:create(orber_tc:unsigned_long_long(), 700000000)}], - [], any:create(orber_tc:null(), null))). --define(EVENT4, ?not_CreateSE("","event4","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), 2)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=300000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=300000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="Timeout", - value=any:create(orber_tc:unsigned_long_long(), 300000000)}], - [], any:create(orber_tc:null(), null))). --define(EVENT5, ?not_CreateSE("","event5","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), 2)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=200000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=200000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="Timeout", - value=any:create(orber_tc:unsigned_long_long(), 200000000)}], - [], any:create(orber_tc:null(), null))). --define(EVENT6, ?not_CreateSE("","event6","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), 0)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=500000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=500000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="Timeout", - value=any:create(orber_tc:unsigned_long_long(), 500000000)}], - [], any:create(orber_tc:null(), null))). --define(EVENT7, ?not_CreateSE("","event7","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), -1)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=400000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=400000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="Timeout", - value=any:create(orber_tc:unsigned_long_long(), 400000000)}], - [], any:create(orber_tc:null(), null))). --define(EVENT8, ?not_CreateSE("","event8","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), -1)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=600000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=600000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="Timeout", - value=any:create(orber_tc:unsigned_long_long(), 600000000)}], - [], any:create(orber_tc:null(), null))). --define(EVENT9, ?not_CreateSE("","event9","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), 0)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=100000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), - #'TimeBase_UtcT' - {time=100000000, - inacclo=0, inacchi=0, tdf=2})}, - #'CosNotification_Property' - {name="Timeout", - value=any:create(orber_tc:unsigned_long_long(), 100000000)}], - [], any:create(orber_tc:null(), null))). - --define(EVENTS, [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT4, ?EVENT5, ?EVENT6, ?EVENT7, - ?EVENT8, ?EVENT9]). - - --define(PRIOORDER, [?EVENT4, ?EVENT5, ?EVENT1, ?EVENT2, ?EVENT3, ?EVENT6, ?EVENT9, - ?EVENT7, ?EVENT8]). - --define(FIFOORDER, ?EVENTS). - --define(DEADLINEORDER, [?EVENT9, ?EVENT5, ?EVENT4, ?EVENT7, ?EVENT6, ?EVENT8, ?EVENT3, - ?EVENT2, ?EVENT1]). - --define(NO_OF_EVENTS, 9). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, - cases/0, init_per_suite/1, end_per_suite/1, reorder_api/1, - lookup_api/1, - discard_api/1, max_events_api/1, gc_api/1, auto_gc_api/1, - start_stop_time_api/1, mapping_filter_api/1, persisten_event_api/1, - init_per_testcase/2, end_per_testcase/2]). - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - cases(). - -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -cases() -> - [persisten_event_api, start_stop_time_api, - mapping_filter_api, max_events_api, discard_api, - reorder_api, lookup_api, gc_api, auto_gc_api]. - - - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- -init_per_testcase(_Case, Config) -> - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - - -end_per_testcase(_Case, Config) -> - Dog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -init_per_suite(Config) -> - Path = code:which(?MODULE), - code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), - orber:jump_start(), - cosTime:install_time(), - cosTime:start(), - if - is_list(Config) -> - Config; - true -> - exit("Config not a list") - end. - -end_per_suite(Config) -> - Path = code:which(?MODULE), - code:del_path(filename:join(filename:dirname(Path), "idl_output")), - cosTime:stop(), - cosTime:uninstall_time(), - orber:jump_stop(), - Config. - - -%%----------------------------------------------------------------- -%% cosNotification_eventDB lookup API tests -%%----------------------------------------------------------------- -%% The event DB is used to store events which cannot be -%% delivered at once. This case is supposed to test -%% that the events are delivered in the correct order -%% if a MappingFilter have benn associated. -mapping_filter_api(_Config) -> - InitQoS = ?not_CreateInitQoS(), - InitQoS2 = ?not_SetMaxEventsPerConsumer(InitQoS,100), - InitQoS3 = ?not_SetStartTimeSupported(InitQoS2, false), - InitQoS4 = ?not_SetStopTimeSupported(InitQoS3, true), - QoS = ?not_SetDiscardPolicy(InitQoS4, ?not_AnyOrder), - - PriorityQoS = ?not_SetOrderPolicy(QoS, ?not_PriorityOrder), - DeadlineQoS = ?not_SetOrderPolicy(QoS, ?not_DeadlineOrder), - - %% "Calculate" data once: - %% NOTE! Even though the an Event do not match any of the constarints the - %% default value will be used. Hence, the events will not be stored in the - %% way described in the definitions above. For example, when using deadline order - %% all the events will be stored in FIFO order since the usag of a MappingFilter - %% all evnts will have the same deadline (except event6). - Events = ?EVENTS, - PrioOrder = [?EVENT6, ?EVENT1, ?EVENT2, ?EVENT3, ?EVENT4, ?EVENT5, ?EVENT7, - ?EVENT8, ?EVENT9], - DeadlineOrder = [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT4, ?EVENT5, ?EVENT7, ?EVENT8, - ?EVENT9], - - - FiFac = 'CosNotifyFilter_FilterFactory':oe_create(), - ?match({_,key,_,_,_,_}, FiFac), - - PrioFilter = 'CosNotifyFilter_FilterFactory': - create_mapping_filter(FiFac, "EXTENDED_TCL", any:create(orber_tc:short(), 0)), - DLFilter = 'CosNotifyFilter_FilterFactory': - create_mapping_filter(FiFac, "EXTENDED_TCL", any:create(orber_tc:unsigned_long_long(), 1000000000)), - - ?match([_], - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(PrioFilter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "", - type_name = "event6"}], - constraint_expr = "2==2"}, - result_to_set = any:create(orber_tc:short(), 10)}])), - ?match([_], - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(DLFilter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "", - type_name = "event6"}], - constraint_expr = "2==2"}, - result_to_set = any:create(orber_tc:unsigned_long_long(), 200000000)}])), - - - do_lookup(PriorityQoS, Events, PrioOrder, "Priority Order", undefined, PrioFilter, 0), - do_lookup(DeadlineQoS, Events, DeadlineOrder, "Deadline Order", DLFilter, undefined, 23000), - ok. - -do_lookup(QoS, Events, Return, Txt, DLFilter, PrioFilter, Timeout) -> - io:format("#################### ~s ###################~n", [Txt]), - Ref = cosNotification_eventDB:create_db(QoS, 60, 50, undefined), - create_loop(Events, Ref, DLFilter, PrioFilter), - timer:sleep(Timeout), - ?match({Return,_}, cosNotification_eventDB:get_events(Ref, ?NO_OF_EVENTS)), - cosNotification_eventDB:destroy_db(Ref). - -%%----------------------------------------------------------------- -%% cosNotification_eventDB discard API tests -%%----------------------------------------------------------------- -%% The event DB is used to store events which cannot be -%% delivered at once. If MaxEvents limit is reached there -%% different ways we can discard the. This case will test -%% all permutations of order and discard policies. -discard_api(_Config) -> - InitQoS1 = ?not_CreateInitQoS(), - InitQoS2 = ?not_SetPriority(InitQoS1, 10), - InitQoS3 = ?not_SetStartTimeSupported(InitQoS2, false), - QoS = ?not_SetMaxEventsPerConsumer(InitQoS3, 5), - %% The different order policies. To each order we must apply every possible - %% discard policy to each order policy setting. We also have to test and - %% change the policies for each setting. - AnyQoS = ?not_SetOrderPolicy(QoS, ?not_AnyOrder), - PriorityQoS = ?not_SetOrderPolicy(QoS, ?not_PriorityOrder), - FifoQoS = ?not_SetOrderPolicy(QoS, ?not_FifoOrder), - DeadlineQoS = ?not_SetOrderPolicy(QoS, ?not_DeadlineOrder), - - Events = ?EVENTS, - - %% Test using Any discard policy - do_discard(Events, ?not_SetDiscardPolicy(AnyQoS, ?not_AnyOrder), - [?EVENT4, ?EVENT5, ?EVENT1, ?EVENT2, ?EVENT3], - "Discard and Order eq. Any"), - do_discard(Events, ?not_SetDiscardPolicy(PriorityQoS, ?not_AnyOrder), - [?EVENT4, ?EVENT5, ?EVENT1, ?EVENT2, ?EVENT3], - "Discard Any and Order Priority"), - do_discard(Events, ?not_SetDiscardPolicy(FifoQoS, ?not_AnyOrder), - [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT4, ?EVENT5], - "Discard Any and Order Fifo"), - do_discard(Events, ?not_SetDiscardPolicy(DeadlineQoS, ?not_AnyOrder), - [?EVENT5, ?EVENT4, ?EVENT3, ?EVENT2, ?EVENT1], - "Discard Any and Order Deadline"), - - %% Test using RejectNewEvents discard policy - do_discard(Events, ?not_SetDiscardPolicy(AnyQoS, ?not_RejectNewEvents), - [?EVENT4, ?EVENT5, ?EVENT1, ?EVENT2, ?EVENT3], - "Discard RejectNewEvents and Order Any"), - do_discard(Events, ?not_SetDiscardPolicy(PriorityQoS, ?not_RejectNewEvents), - [?EVENT4, ?EVENT5, ?EVENT1, ?EVENT2, ?EVENT3], - "Discard RejectNewEvents and Order Priority"), - do_discard(Events, ?not_SetDiscardPolicy(FifoQoS, ?not_RejectNewEvents), - [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT4, ?EVENT5], - "Discard RejectNewEvents and Order Fifo"), - do_discard(Events, ?not_SetDiscardPolicy(DeadlineQoS, ?not_RejectNewEvents), - [?EVENT5, ?EVENT4, ?EVENT3, ?EVENT2, ?EVENT1], - "Discard RejectNewEvents and Order Deadline"), - - %% Test using Lifo discard policy - do_discard(Events, ?not_SetDiscardPolicy(AnyQoS, ?not_LifoOrder), - [?EVENT4, ?EVENT5, ?EVENT1, ?EVENT2, ?EVENT3], - "Discard Lifo and Order Any"), - do_discard(Events, ?not_SetDiscardPolicy(PriorityQoS, ?not_LifoOrder), - [?EVENT4, ?EVENT5, ?EVENT1, ?EVENT2, ?EVENT3], - "Discard Lifo and Order Priority"), - do_discard(Events, ?not_SetDiscardPolicy(FifoQoS, ?not_LifoOrder), - [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT4, ?EVENT5], - "Discard Lifo and Order Fifo"), - do_discard(Events, ?not_SetDiscardPolicy(DeadlineQoS, ?not_LifoOrder), - [?EVENT5, ?EVENT4, ?EVENT3, ?EVENT2, ?EVENT1], - "Discard Lifo and Order Deadline"), - - %% Test using Fifo discard policy - do_discard(Events, ?not_SetDiscardPolicy(AnyQoS, ?not_FifoOrder), - [?EVENT5, ?EVENT6, ?EVENT9, ?EVENT7, ?EVENT8], - "Discard Fifo and Order Any"), - do_discard(Events, ?not_SetDiscardPolicy(PriorityQoS, ?not_FifoOrder), - [?EVENT5, ?EVENT6, ?EVENT9, ?EVENT7, ?EVENT8], - "Discard Fifo and Order Priority"), - do_discard(Events, ?not_SetDiscardPolicy(FifoQoS, ?not_FifoOrder), - [?EVENT5, ?EVENT6, ?EVENT7, ?EVENT8, ?EVENT9], - "Discard Fifo and Order Fifo"), - do_discard(Events, ?not_SetDiscardPolicy(DeadlineQoS, ?not_FifoOrder), - [?EVENT9, ?EVENT5, ?EVENT7, ?EVENT6, ?EVENT8], - "Discard Fifo and Order Deadline"), - - %% Test using Priority discard policy - do_discard(Events, ?not_SetDiscardPolicy(AnyQoS, ?not_PriorityOrder), - [?EVENT4, ?EVENT5, ?EVENT1, ?EVENT2, ?EVENT3], - "Discard Priority and Order Any"), - do_discard(Events, ?not_SetDiscardPolicy(PriorityQoS, ?not_PriorityOrder), - [?EVENT4, ?EVENT5, ?EVENT1, ?EVENT2, ?EVENT3], - "Discard Priority and Order Priority"), - do_discard(Events, ?not_SetDiscardPolicy(FifoQoS, ?not_PriorityOrder), - [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT4, ?EVENT5], - "Discard Priority and Order Fifo"), - do_discard(Events, ?not_SetDiscardPolicy(DeadlineQoS, ?not_PriorityOrder), - [?EVENT5, ?EVENT4, ?EVENT3, ?EVENT2, ?EVENT1], - "Discard Priority and Order Deadline"), - - %% Test using Deadline discard policy - do_discard(Events, ?not_SetDiscardPolicy(AnyQoS, ?not_DeadlineOrder), - [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT6, ?EVENT8], - "Discard Deadline and Order Any"), - do_discard(Events, ?not_SetDiscardPolicy(PriorityQoS, ?not_DeadlineOrder), - [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT6, ?EVENT8], - "Discard Deadline and Order Priority"), - do_discard(Events, ?not_SetDiscardPolicy(FifoQoS, ?not_DeadlineOrder), - [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT6, ?EVENT8], - "Discard Deadline and Order Fifo"), - do_discard(Events, ?not_SetDiscardPolicy(DeadlineQoS, ?not_DeadlineOrder), - [?EVENT6, ?EVENT8, ?EVENT3, ?EVENT2, ?EVENT1], - "Discard Deadline and Order Deadline"), - - ok. - -do_discard(Events, QoS, Reply, Txt) -> - io:format("################# ~s #################~n", [Txt]), - Ref = cosNotification_eventDB:create_db(QoS, 60, 50, undefined), - create_loop(Events, Ref), - ?match({Reply,_}, cosNotification_eventDB:get_events(Ref, ?NO_OF_EVENTS)), - cosNotification_eventDB:destroy_db(Ref). - - -%%----------------------------------------------------------------- -%% cosNotification_eventDB lookup API tests -%%----------------------------------------------------------------- -%% The event DB is used to store events which cannot be -%% delivered at once. This case is supposed to test -%% that the events are delivered in the correct order. -lookup_api(_Config) -> - InitQoS = ?not_CreateInitQoS(), - InitQoS2 = ?not_SetMaxEventsPerConsumer(InitQoS,100), - InitQoS3 = ?not_SetStartTimeSupported(InitQoS2, false), - QoS = ?not_SetDiscardPolicy(InitQoS3, ?not_AnyOrder), - - AnyQoS = ?not_SetOrderPolicy(QoS, ?not_AnyOrder), - PriorityQoS = ?not_SetOrderPolicy(QoS, ?not_PriorityOrder), - FifoQoS = ?not_SetOrderPolicy(QoS, ?not_FifoOrder), - DeadlineQoS = ?not_SetOrderPolicy(QoS, ?not_DeadlineOrder), - - %% "Calculate" data once: - Events = ?EVENTS, - PrioOrder = ?PRIOORDER, - FifoOrder = ?FIFOORDER, - DeadlineOrder = ?DEADLINEORDER, - - do_lookup(PriorityQoS, Events, PrioOrder, "Priority Order"), - do_lookup(FifoQoS, Events, FifoOrder, "Fifo Order"), - do_lookup(DeadlineQoS, Events, DeadlineOrder, "Deadline Order"), - do_lookup(AnyQoS, Events, PrioOrder, "Any Order"), - ok. - -do_lookup(QoS, Events, Return, Txt) -> - io:format("#################### ~s ###################~n", [Txt]), - Ref = cosNotification_eventDB:create_db(QoS, 60, 50, undefined), - create_loop(Events, Ref), - ?match({Return,_}, cosNotification_eventDB:get_events(Ref, ?NO_OF_EVENTS)), - cosNotification_eventDB:destroy_db(Ref). - - -%%----------------------------------------------------------------- -%% cosNotification_eventDB max events API tests -%%----------------------------------------------------------------- -%% The event DB is used to store events which cannot be -%% delivered at once. If the MaxEvents QoS is updated we must be -%% able to reduce the amount of stored events. -max_events_api(_Config) -> - - QoS1 = ?not_CreateInitQoS(), - QoS2 = ?not_SetOrderPolicy(QoS1, ?not_FifoOrder), - QoS3 = ?not_SetDiscardPolicy(QoS2, ?not_RejectNewEvents), - QoS4 = ?not_SetStartTimeSupported(QoS3, false), - QoS_NO_OF_EVENTS = ?not_SetMaxEventsPerConsumer(QoS4, ?NO_OF_EVENTS), - QoS_5_EVENTS = ?not_SetMaxEventsPerConsumer(QoS4, 5), - - Events = ?EVENTS, - Events5 = [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT4, ?EVENT5], - - %% Initiate DB and 'NO_OF_EVENTS' events. - Ref1 = cosNotification_eventDB:create_db(QoS_NO_OF_EVENTS, 60, 50, undefined), - create_loop(Events, Ref1), - - %% Reduce the limit to 5 and extract all and see if it's ok. - Ref2 = cosNotification_eventDB:update(Ref1, QoS_5_EVENTS), - ?match({Events5, true}, cosNotification_eventDB:get_events(Ref2, ?NO_OF_EVENTS)), - - %% Add 'NO_OF_EVENTS' events. Since the only allow 5 events the DB will only - %% contain 5 events. - create_loop(Events, Ref2), - Ref3 = cosNotification_eventDB:update(Ref2, QoS_NO_OF_EVENTS), - - ?match({Events5, true}, cosNotification_eventDB:get_events(Ref3, ?NO_OF_EVENTS)), - create_loop(Events, Ref3), - ?match({Events, true}, cosNotification_eventDB:get_events(Ref3, ?NO_OF_EVENTS)), - cosNotification_eventDB:destroy_db(Ref3), - ok. - - -%%----------------------------------------------------------------- -%% cosNotification_eventDB persisten events API tests -%%----------------------------------------------------------------- -%% The event DB is used to store events which cannot be -%% delivered at once. -persisten_event_api(_Config) -> - - QoS1 = ?not_CreateInitQoS(), - QoS2 = ?not_SetOrderPolicy(QoS1, ?not_FifoOrder), - QoS3 = ?not_SetDiscardPolicy(QoS2, ?not_RejectNewEvents), - QoS4 = ?not_SetStartTimeSupported(QoS3, false), - QoS = ?not_SetMaxEventsPerConsumer(QoS4, ?NO_OF_EVENTS), - - Event1 = ?EVENT1, - - Ref = cosNotification_eventDB:create_db(QoS, 60, 50, undefined), - %% Clean DB, should be empty - ?match(0, cosNotification_eventDB:status(Ref, eventCounter)), - cosNotification_eventDB:add_event(Ref, Event1), - ?match(1, cosNotification_eventDB:status(Ref, eventCounter)), - %% Get event without removing it. Should still be one event stored - ?match({[Event1], _, _}, cosNotification_eventDB:get_events(Ref, 2, false)), - ?match(1, cosNotification_eventDB:status(Ref, eventCounter)), - {_, _, Keys} = - ?match({Event1, _, _}, cosNotification_eventDB:get_event(Ref, false)), - ?match(1, cosNotification_eventDB:status(Ref, eventCounter)), - %% Clear the events and check that the DB is empty. - cosNotification_eventDB:delete_events(Keys), - ?match(0, cosNotification_eventDB:status(Ref, eventCounter)), - ?match({[], _, []}, cosNotification_eventDB:get_event(Ref, false)), - ?match({[], _, []}, cosNotification_eventDB:get_events(Ref, 2, false)), - - cosNotification_eventDB:destroy_db(Ref), - ok. - -%%----------------------------------------------------------------- -%% cosNotification_eventDB gc API tests -%%----------------------------------------------------------------- -%% The event DB is used to store events which cannot be -%% delivered at once. If Deadline defined the events that -%% are older must be discarded. -gc_api(_Config) -> - - QoS1 = ?not_CreateInitQoS(), - QoS2 = ?not_SetOrderPolicy(QoS1, ?not_FifoOrder), - QoS3 = ?not_SetDiscardPolicy(QoS2, ?not_RejectNewEvents), - QoS4 = ?not_SetStartTimeSupported(QoS3, false), - QoS_NO_OF_EVENTS = ?not_SetMaxEventsPerConsumer(QoS4, ?NO_OF_EVENTS), - - Events = ?EVENTS, - Events6 = [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT4, ?EVENT6, ?EVENT7, ?EVENT8], - %% Initiate DB and 'NO_OF_EVENTS' events. - Ref = cosNotification_eventDB:create_db(QoS_NO_OF_EVENTS, 60, 50, undefined), - create_loop(Events, Ref), - - %% Sleep so some events will get 'old'. - timer:sleep(23000), - - %% Reduce the limit to 5 and extract all and see if it's ok. - cosNotification_eventDB:gc_events(Ref, high), - - %% Since gc is done by another process we must wait so it will have a chance - %% to complete the job. - timer:sleep(2000), - - ?match({Events6, true}, cosNotification_eventDB:get_events(Ref, ?NO_OF_EVENTS)), - - create_loop(Events, Ref), - timer:sleep(23000), - ?match({Events6, true}, cosNotification_eventDB:get_events(Ref, ?NO_OF_EVENTS)), - cosNotification_eventDB:destroy_db(Ref), - ok. - - -%%----------------------------------------------------------------- -%% cosNotification_eventDB gc API tests -%%----------------------------------------------------------------- -%% The event DB is used to store events which cannot be -%% delivered at once. If Deadline defined the events that -%% are older must be discarded. -auto_gc_api(_Config) -> - - QoS1 = ?not_CreateInitQoS(), - QoS2 = ?not_SetOrderPolicy(QoS1, ?not_FifoOrder), - QoS3 = ?not_SetDiscardPolicy(QoS2, ?not_RejectNewEvents), - QoS4 = ?not_SetStopTimeSupported(QoS3, true), - QoS5 = ?not_SetStartTimeSupported(QoS4, false), - QoS_NO_OF_EVENTS = ?not_SetMaxEventsPerConsumer(QoS5, ?NO_OF_EVENTS), - - Events6 = [?EVENT1, ?EVENT2, ?EVENT3, ?EVENT7, ?EVENT8, ?EVENT9], - %% Initiate DB - Ref = cosNotification_eventDB:create_db(QoS_NO_OF_EVENTS, 50, 50, undefined), - create_loop([?EVENT1, ?EVENT2, ?EVENT3, ?EVENT4, ?EVENT6], Ref), - - %% Sleep so some events will get 'old'. - timer:sleep(60000), - create_loop([?EVENT7, ?EVENT8, ?EVENT9], Ref), - - %% Since gc is done by another process we must wait so it will have a chance - %% to complete the job. - timer:sleep(2000), - - ?match({Events6, true}, cosNotification_eventDB:get_events(Ref, ?NO_OF_EVENTS)), - - cosNotification_eventDB:destroy_db(Ref), - - ok. - - -%%----------------------------------------------------------------- -%% cosNotification_eventDB start- and stop-time API tests -%%----------------------------------------------------------------- -%% The event DB is used to store events which cannot be -%% delivered at once. If Deadline defined the events that -%% are older must be discarded. -start_stop_time_api(_Config) -> - - QoS1 = ?not_CreateInitQoS(), - QoS2 = ?not_SetOrderPolicy(QoS1, ?not_FifoOrder), - QoS3 = ?not_SetDiscardPolicy(QoS2, ?not_RejectNewEvents), - QoS4 = ?not_SetStopTimeSupported(QoS3, true), - QoS5 = ?not_SetStartTimeSupported(QoS4, true), - QoS_NO_OF_EVENTS = ?not_SetMaxEventsPerConsumer(QoS5, ?NO_OF_EVENTS), - - %% Initiate DB - TimeService = cosTime:start_time_service(2, 0), - Ref = cosNotification_eventDB:create_db(QoS_NO_OF_EVENTS, 50, 50, TimeService), - - T1 = 'CosTime_UTO':'_get_utc_time'('CosTime_UTO': - absolute_time('CosTime_TimeService': - new_universal_time(TimeService, - 100000000, 0, 2))), - T2 = 'CosTime_UTO':'_get_utc_time'('CosTime_UTO': - absolute_time('CosTime_TimeService': - new_universal_time(TimeService, - 200000000, 0, 2))), - T3 = 'CosTime_UTO':'_get_utc_time'('CosTime_UTO': - absolute_time('CosTime_TimeService': - new_universal_time(TimeService, - 300000000, 0, 2))), - T4 = 'CosTime_UTO':'_get_utc_time'('CosTime_UTO': - absolute_time('CosTime_TimeService': - new_universal_time(TimeService, - 400000000, 0, 2))), - %% Delivered after 10 seconds discarded after 20. - EVENT1 = ?not_CreateSE("","event1","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), 1)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), T1)}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), T2)}], - [], any:create(orber_tc:null(), null)), - - %% Delivered after 30 seconds discarded after 10, i.e., always discarded. - EVENT2 = ?not_CreateSE("","event2","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), 3)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), T3)}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), T1)}], - [], any:create(orber_tc:null(), null)), - - %% Delivered after 20 seconds discarded after 40 - EVENT3 = ?not_CreateSE("","event3","", - [#'CosNotification_Property' - {name="Priority", - value=any:create(orber_tc:short(), 2)}, - #'CosNotification_Property' - {name="StartTime", - value=any:create('TimeBase_UtcT':tc(), T2)}, - #'CosNotification_Property' - {name="StopTime", - value=any:create('TimeBase_UtcT':tc(), T4)}], - [], any:create(orber_tc:null(), null)), - - - - - create_loop([EVENT1, EVENT2, EVENT3], Ref), - - ?match({[], false}, cosNotification_eventDB:get_events(Ref, ?NO_OF_EVENTS)), - - %% Sleep so some events will get 'old'. - timer:sleep(12000), - - ?match({[EVENT1], true}, cosNotification_eventDB:get_events(Ref, ?NO_OF_EVENTS)), - - ?match({[], false}, cosNotification_eventDB:get_events(Ref, ?NO_OF_EVENTS)), - - timer:sleep(10000), - - ?match({[EVENT3], true}, cosNotification_eventDB:get_events(Ref, ?NO_OF_EVENTS)), - - timer:sleep(20000), - - %% See if EVENT2 really have been discarded. - ?match({[], false}, cosNotification_eventDB:get_events(Ref, ?NO_OF_EVENTS)), - - cosNotification_eventDB:destroy_db(Ref), - - cosTime:stop_time_service(TimeService), - - ok. - - -%%----------------------------------------------------------------- -%% cosNotification_eventDB order API tests -%%----------------------------------------------------------------- -%% The event DB is used to store events which cannot be -%% delivered at once. If the QoS is updated we must be -%% able to change the ordering of events as the discard -%% and order policies tells us. -reorder_api(_Config) -> - %% We need to test switching between: - %% * Priority -> Fifo - %% * Priority -> Deadline - %% * Fifo -> Priority - %% * Fifo -> Deadline - %% * Deadline -> Priority - %% * Deadline -> Fifo - QoS = ?not_CreateInitQoS(), - QoS2 = ?not_SetMaxEventsPerConsumer(QoS,100), - QoS3 = ?not_SetPriority(QoS2, 10), - QoS4 = ?not_SetStartTimeSupported(QoS3, false), - QoS5 = ?not_SetOrderPolicy(QoS4, ?not_AnyOrder), - - - %% Test all order policies using Any order discard policy. - reorder_helper(?not_SetDiscardPolicy(QoS5, ?not_AnyOrder), "Discard Any"), - reorder_helper(?not_SetDiscardPolicy(QoS5, ?not_PriorityOrder), "Discard Priority"), - reorder_helper(?not_SetDiscardPolicy(QoS5, ?not_DeadlineOrder), "Discard Deadline"), - reorder_helper(?not_SetDiscardPolicy(QoS5, ?not_FifoOrder), "Discard Fifo"), - reorder_helper(?not_SetDiscardPolicy(QoS5, ?not_LifoOrder), "Discard Lifo"), - reorder_helper(?not_SetDiscardPolicy(QoS5, ?not_RejectNewEvents), "Reject New Events"), - - ok. - - -reorder_helper(QoS, Txt) -> - io:format("$$$$$$$$$$$$$$$$$$$$ ~s $$$$$$$$$$$$$$$$$$$~n", [Txt]), - %% Create a DB with the above settings. - Ref = cosNotification_eventDB:create_db(QoS, 60, 50, undefined), - - Events = ?EVENTS, - PrioOrder = ?PRIOORDER, - FifoOrder = ?FIFOORDER, - DeadlineOrder = ?DEADLINEORDER, - - %% Test all order policies using Any order discard policy. - Ref2 = do_reorder(Ref, Events, ?not_SetOrderPolicy(QoS, ?not_FifoOrder), - FifoOrder, "Priority -> Fifo"), - Ref3 = do_reorder(Ref2, Events, ?not_SetOrderPolicy(QoS, ?not_PriorityOrder), - PrioOrder, "Fifo -> Priority"), - Ref4 = do_reorder(Ref3, Events, ?not_SetOrderPolicy(QoS, ?not_DeadlineOrder), - DeadlineOrder, "Priority -> Deadline"), - - Ref5 = do_reorder(Ref4, Events, ?not_SetOrderPolicy(QoS, ?not_PriorityOrder), - PrioOrder, "Deadline -> Priority"), - - Ref6 = do_reorder(Ref5, Events, ?not_SetOrderPolicy(QoS, ?not_FifoOrder), - FifoOrder, "Priority -> Fifo"), - - Ref7 = do_reorder(Ref6, Events, ?not_SetOrderPolicy(QoS, ?not_DeadlineOrder), - DeadlineOrder, "Fifo -> Deadline"), - - Ref8 = do_reorder(Ref7, Events, ?not_SetOrderPolicy(QoS, ?not_FifoOrder), - FifoOrder, "Deadline -> Fifo"), - cosNotification_eventDB:destroy_db(Ref8), - ok. - - - -do_reorder(Ref, Events, QoS, Reply, Txt) -> - create_loop(Events, Ref), - io:format("################# ~s #################~n", [Txt]), - NewRef = cosNotification_eventDB:update(Ref, QoS), - ?match({Reply,_}, cosNotification_eventDB:get_events(NewRef, ?NO_OF_EVENTS)), - NewRef. - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- -%% This functions takes as argument a list of structured events. -create_loop([], _Ref) -> - ok; -create_loop([H|T], Ref) -> - catch cosNotification_eventDB:add_event(Ref, H), - create_loop(T, Ref). - -create_loop([], _Ref, _Life, _Prio) -> - ok; -create_loop([H|T], Ref, Life, Prio) -> - catch cosNotification_eventDB:add_event(Ref, H, Life, Prio), - create_loop(T, Ref, Life, Prio). - -%%-------------------- End of Module ------------------------------ diff --git a/lib/cosNotification/test/generated_SUITE.erl b/lib/cosNotification/test/generated_SUITE.erl deleted file mode 100644 index 8e3ccbd90e..0000000000 --- a/lib/cosNotification/test/generated_SUITE.erl +++ /dev/null @@ -1,1928 +0,0 @@ -%%----------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File : generated_SUITE.erl -%% Purpose : -%%----------------------------------------------------------------- - --module(generated_SUITE). - --include_lib("common_test/include/ct.hrl"). --include_lib("orber/include/corba.hrl"). - --define(default_timeout, test_server:minutes(3)). - --define(match(ExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - AcTuAlReS; - _ -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS) - end - end()). - --define(nomatch(Not, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - Not -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS); - _ -> - AcTuAlReS - end - end()). - - --define(checktc(_Op), - fun(TC) -> - case orber_tc:check_tc(TC) of - false -> - io:format("###### ERROR ERROR ######~n~p - ~p~n", [Op, TC]), - exit(TC); - true -> - true - end - end). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --compile(export_all). - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - ['CosNotification', - 'CosNotification_AdminPropertiesAdmin', - 'CosNotification_EventHeader', - 'CosNotification_EventType', - 'CosNotification_FixedEventHeader', - 'CosNotification_NamedPropertyRange', - 'CosNotification_Property', - 'CosNotification_PropertyError', - 'CosNotification_PropertyRange', - 'CosNotification_QoSAdmin', - 'CosNotification_StructuredEvent', - 'CosNotification_UnsupportedAdmin', - 'CosNotification_UnsupportedQoS', - 'CosNotification_EventBatch', - 'CosNotification_EventTypeSeq', - 'CosNotification_NamedPropertyRangeSeq', - 'CosNotification_PropertyErrorSeq', - 'CosNotifyChannelAdmin_AdminLimit', - 'CosNotifyChannelAdmin_AdminNotFound', - 'CosNotifyChannelAdmin_ChannelNotFound', - 'CosNotifyChannelAdmin_ConnectionAlreadyActive', - 'CosNotifyChannelAdmin_ConnectionAlreadyInactive', - 'CosNotifyChannelAdmin_NotConnected', - 'CosNotifyChannelAdmin_AdminIDSeq', - 'CosNotifyChannelAdmin_ChannelIDSeq', - 'CosNotifyChannelAdmin_ProxyIDSeq', - 'CosNotifyFilter_CallbackNotFound', - 'CosNotifyFilter_ConstraintExp', - 'CosNotifyFilter_ConstraintInfo', - 'CosNotifyFilter_ConstraintNotFound', - 'CosNotifyFilter_DuplicateConstraintID', - 'CosNotifyFilter_FilterNotFound', - 'CosNotifyFilter_InvalidConstraint', - 'CosNotifyFilter_InvalidGrammar', - 'CosNotifyFilter_InvalidValue', - 'CosNotifyFilter_MappingConstraintInfo', - 'CosNotifyFilter_MappingConstraintPair', - 'CosNotifyFilter_UnsupportedFilterableData', - 'CosNotifyFilter_CallbackIDSeq', - 'CosNotifyFilter_ConstraintExpSeq', - 'CosNotifyFilter_ConstraintIDSeq', - 'CosNotifyFilter_ConstraintInfoSeq', - 'CosNotifyFilter_FilterIDSeq', - 'CosNotifyFilter_MappingConstraintInfoSeq', - 'CosNotifyFilter_MappingConstraintPairSeq', - 'CosNotifyComm_InvalidEventType', - 'CosNotifyChannelAdmin_ConsumerAdmin', - 'CosNotifyChannelAdmin_EventChannel', - 'CosNotifyChannelAdmin_EventChannelFactory', - 'CosNotifyChannelAdmin_ProxyConsumer', - 'CosNotifyChannelAdmin_ProxyNotFound', - 'CosNotifyChannelAdmin_ProxyPullConsumer', - 'CosNotifyChannelAdmin_ProxyPullSupplier', - 'CosNotifyChannelAdmin_ProxyPushConsumer', - 'CosNotifyChannelAdmin_ProxyPushSupplier', - 'CosNotifyChannelAdmin_ProxySupplier', - 'CosNotifyChannelAdmin_SequenceProxyPullConsumer', - 'CosNotifyChannelAdmin_SequenceProxyPullSupplier', - 'CosNotifyChannelAdmin_SequenceProxyPushConsumer', - 'CosNotifyChannelAdmin_SequenceProxyPushSupplier', - 'CosNotifyChannelAdmin_StructuredProxyPullConsumer', - 'CosNotifyChannelAdmin_StructuredProxyPullSupplier', - 'CosNotifyChannelAdmin_StructuredProxyPushConsumer', - 'CosNotifyChannelAdmin_StructuredProxyPushSupplier', - 'CosNotifyChannelAdmin_SupplierAdmin', - 'CosNotifyFilter_Filter', 'CosNotifyFilter_FilterAdmin', - 'CosNotifyFilter_FilterFactory', - 'CosNotifyFilter_MappingFilter', - 'CosNotifyComm_NotifyPublish', - 'CosNotifyComm_NotifySubscribe', - 'CosNotifyComm_PullConsumer', - 'CosNotifyComm_PullSupplier', - 'CosNotifyComm_PushConsumer', - 'CosNotifyComm_PushSupplier', - 'CosNotifyComm_SequencePullConsumer', - 'CosNotifyComm_SequencePullSupplier', - 'CosNotifyComm_SequencePushConsumer', - 'CosNotifyComm_SequencePushSupplier', - 'CosNotifyComm_StructuredPullConsumer', - 'CosNotifyComm_StructuredPullSupplier', - 'CosNotifyComm_StructuredPushConsumer', - 'CosNotifyComm_StructuredPushSupplier', - oe_CosNotificationComm_Event, - 'CosNotification_PropertySeq']. - -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- -init_per_testcase(_Case, Config) -> - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - - -end_per_testcase(_Case, Config) -> - Dog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification' -%% Description: -%%----------------------------------------------------------------- -'CosNotification'(_) -> - ?match("EventReliability", 'CosNotification':'EventReliability'()), - ?match(0, 'CosNotification':'BestEffort'()), - ?match(1, 'CosNotification':'Persistent'()), - ?match("ConnectionReliability", 'CosNotification':'ConnectionReliability'()), - ?match("Priority", 'CosNotification':'Priority'()), - ?match(-32767, 'CosNotification':'LowestPriority'()), - ?match(32767, 'CosNotification':'HighestPriority'()), - ?match(0, 'CosNotification':'DefaultPriority'()), - ?match("StartTime", 'CosNotification':'StartTime'()), - ?match("StopTime", 'CosNotification':'StopTime'()), - ?match("Timeout", 'CosNotification':'Timeout'()), - ?match("OrderPolicy", 'CosNotification':'OrderPolicy'()), - ?match(0, 'CosNotification':'AnyOrder'()), - ?match(1, 'CosNotification':'FifoOrder'()), - ?match(2, 'CosNotification':'PriorityOrder'()), - ?match(3, 'CosNotification':'DeadlineOrder'()), - ?match("DiscardPolicy", 'CosNotification':'DiscardPolicy'()), - ?match(4, 'CosNotification':'LifoOrder'()), - ?match(5, 'CosNotification':'RejectNewEvents'()), - ?match("MaximumBatchSize", 'CosNotification':'MaximumBatchSize'()), - ?match("PacingInterval", 'CosNotification':'PacingInterval'()), - ?match("StartTimeSupported", 'CosNotification':'StartTimeSupported'()), - ?match("StopTimeSupported", 'CosNotification':'StopTimeSupported'()), - ?match("MaxEventsPerConsumer", 'CosNotification':'MaxEventsPerConsumer'()), - ?match("MaxQueueLength", 'CosNotification':'MaxQueueLength'()), - ?match("MaxConsumers", 'CosNotification':'MaxConsumers'()), - ?match("MaxSuppliers", 'CosNotification':'MaxSuppliers'()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_EventHeader' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_EventHeader'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_EventHeader':tc())), - ?match("IDL:omg.org/CosNotification/EventHeader:1.0", - 'CosNotification_EventHeader':id()), - ?match("CosNotification_EventHeader", - 'CosNotification_EventHeader':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_EventType' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_EventType'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_EventType':tc())), - ?match("IDL:omg.org/CosNotification/EventType:1.0", - 'CosNotification_EventType':id()), - ?match("CosNotification_EventType", - 'CosNotification_EventType':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_FixedEventHeader' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_FixedEventHeader'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_FixedEventHeader':tc())), - ?match("IDL:omg.org/CosNotification/FixedEventHeader:1.0", - 'CosNotification_FixedEventHeader':id()), - ?match("CosNotification_FixedEventHeader", - 'CosNotification_FixedEventHeader':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_NamedPropertyRange' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_NamedPropertyRange'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_NamedPropertyRange':tc())), - ?match("IDL:omg.org/CosNotification/NamedPropertyRange:1.0", - 'CosNotification_NamedPropertyRange':id()), - ?match("CosNotification_NamedPropertyRange", - 'CosNotification_NamedPropertyRange':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_Property' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_Property'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_Property':tc())), - ?match("IDL:omg.org/CosNotification/Property:1.0", - 'CosNotification_Property':id()), - ?match("CosNotification_Property", - 'CosNotification_Property':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_PropertyError' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_PropertyError'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_PropertyError':tc())), - ?match("IDL:omg.org/CosNotification/PropertyError:1.0", - 'CosNotification_PropertyError':id()), - ?match("CosNotification_PropertyError", - 'CosNotification_PropertyError':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_PropertyRange' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_PropertyRange'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_PropertyRange':tc())), - ?match("IDL:omg.org/CosNotification/PropertyRange:1.0", - 'CosNotification_PropertyRange':id()), - ?match("CosNotification_PropertyRange", - 'CosNotification_PropertyRange':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_StructuredEvent' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_StructuredEvent'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_StructuredEvent':tc())), - ?match("IDL:omg.org/CosNotification/StructuredEvent:1.0", - 'CosNotification_StructuredEvent':id()), - ?match("CosNotification_StructuredEvent", - 'CosNotification_StructuredEvent':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_UnsupportedAdmin' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_UnsupportedAdmin'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_UnsupportedAdmin':tc())), - ?match("IDL:omg.org/CosNotification/UnsupportedAdmin:1.0", - 'CosNotification_UnsupportedAdmin':id()), - ?match("CosNotification_UnsupportedAdmin", - 'CosNotification_UnsupportedAdmin':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_UnsupportedQoS' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_UnsupportedQoS'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_UnsupportedQoS':tc())), - ?match("IDL:omg.org/CosNotification/UnsupportedQoS:1.0", - 'CosNotification_UnsupportedQoS':id()), - ?match("CosNotification_UnsupportedQoS", - 'CosNotification_UnsupportedQoS':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_EventBatch' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_EventBatch'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_EventBatch':tc())), - ?match("IDL:omg.org/CosNotification/EventBatch:1.0", - 'CosNotification_EventBatch':id()), - ?match("CosNotification_EventBatch", - 'CosNotification_EventBatch':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_EventTypeSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_EventTypeSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_EventTypeSeq':tc())), - ?match("IDL:omg.org/CosNotification/EventTypeSeq:1.0", - 'CosNotification_EventTypeSeq':id()), - ?match("CosNotification_EventTypeSeq", - 'CosNotification_EventTypeSeq':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_NamedPropertyRangeSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_NamedPropertyRangeSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_NamedPropertyRangeSeq':tc())), - ?match("IDL:omg.org/CosNotification/NamedPropertyRangeSeq:1.0", - 'CosNotification_NamedPropertyRangeSeq':id()), - ?match("CosNotification_NamedPropertyRangeSeq", - 'CosNotification_NamedPropertyRangeSeq':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_PropertyErrorSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_PropertyErrorSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_PropertyErrorSeq':tc())), - ?match("IDL:omg.org/CosNotification/PropertyErrorSeq:1.0", - 'CosNotification_PropertyErrorSeq':id()), - ?match("CosNotification_PropertyErrorSeq", - 'CosNotification_PropertyErrorSeq':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_PropertySeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_PropertySeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotification_PropertySeq':tc())), - ?match("IDL:omg.org/CosNotification/PropertySeq:1.0", - 'CosNotification_PropertySeq':id()), - ?match("CosNotification_PropertySeq", - 'CosNotification_PropertySeq':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_AdminLimit' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_AdminLimit'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyChannelAdmin_AdminLimit':tc())), - ?match("IDL:omg.org/CosNotifyChannelAdmin/AdminLimit:1.0", - 'CosNotifyChannelAdmin_AdminLimit':id()), - ?match("CosNotifyChannelAdmin_AdminLimit", - 'CosNotifyChannelAdmin_AdminLimit':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_AdminLimitExceeded' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_AdminLimitExceeded'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyChannelAdmin_AdminLimitExceeded':tc())), - ?match("IDL:omg.org/CosNotifyChannelAdmin/AdminLimitExceeded:1.0", - 'CosNotifyChannelAdmin_AdminLimitExceeded':id()), - ?match("CosNotifyChannelAdmin_AdminLimitExceeded", - 'CosNotifyChannelAdmin_AdminLimitExceeded':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_AdminNotFound' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_AdminNotFound'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyChannelAdmin_AdminNotFound':tc())), - ?match("IDL:omg.org/CosNotifyChannelAdmin/AdminNotFound:1.0", - 'CosNotifyChannelAdmin_AdminNotFound':id()), - ?match("CosNotifyChannelAdmin_AdminNotFound", - 'CosNotifyChannelAdmin_AdminNotFound':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ChannelNotFound' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ChannelNotFound'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyChannelAdmin_ChannelNotFound':tc())), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ChannelNotFound:1.0", - 'CosNotifyChannelAdmin_ChannelNotFound':id()), - ?match("CosNotifyChannelAdmin_ChannelNotFound", - 'CosNotifyChannelAdmin_ChannelNotFound':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ConnectionAlreadyActive' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ConnectionAlreadyActive'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyChannelAdmin_ConnectionAlreadyActive':tc())), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ConnectionAlreadyActive:1.0", - 'CosNotifyChannelAdmin_ConnectionAlreadyActive':id()), - ?match("CosNotifyChannelAdmin_ConnectionAlreadyActive", - 'CosNotifyChannelAdmin_ConnectionAlreadyActive':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ConnectionAlreadyInactive' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ConnectionAlreadyInactive'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyChannelAdmin_ConnectionAlreadyInactive':tc())), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ConnectionAlreadyInactive:1.0", - 'CosNotifyChannelAdmin_ConnectionAlreadyInactive':id()), - ?match("CosNotifyChannelAdmin_ConnectionAlreadyInactive", - 'CosNotifyChannelAdmin_ConnectionAlreadyInactive':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_NotConnected' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_NotConnected'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyChannelAdmin_NotConnected':tc())), - ?match("IDL:omg.org/CosNotifyChannelAdmin/NotConnected:1.0", - 'CosNotifyChannelAdmin_NotConnected':id()), - ?match("CosNotifyChannelAdmin_NotConnected", - 'CosNotifyChannelAdmin_NotConnected':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_AdminIDSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_AdminIDSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyChannelAdmin_AdminIDSeq':tc())), - ?match("IDL:omg.org/CosNotifyChannelAdmin/AdminIDSeq:1.0", - 'CosNotifyChannelAdmin_AdminIDSeq':id()), - ?match("CosNotifyChannelAdmin_AdminIDSeq", - 'CosNotifyChannelAdmin_AdminIDSeq':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ChannelIDSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ChannelIDSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyChannelAdmin_ChannelIDSeq':tc())), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ChannelIDSeq:1.0", - 'CosNotifyChannelAdmin_ChannelIDSeq':id()), - ?match("CosNotifyChannelAdmin_ChannelIDSeq", - 'CosNotifyChannelAdmin_ChannelIDSeq':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ProxyIDSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ProxyIDSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyChannelAdmin_ProxyIDSeq':tc())), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ProxyIDSeq:1.0", - 'CosNotifyChannelAdmin_ProxyIDSeq':id()), - ?match("CosNotifyChannelAdmin_ProxyIDSeq", - 'CosNotifyChannelAdmin_ProxyIDSeq':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_CallbackNotFound' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_CallbackNotFound'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_CallbackNotFound':tc())), - ?match("IDL:omg.org/CosNotifyFilter/CallbackNotFound:1.0", - 'CosNotifyFilter_CallbackNotFound':id()), - ?match("CosNotifyFilter_CallbackNotFound", - 'CosNotifyFilter_CallbackNotFound':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_ConstraintExp' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_ConstraintExp'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_ConstraintExp':tc())), - ?match("IDL:omg.org/CosNotifyFilter/ConstraintExp:1.0", - 'CosNotifyFilter_ConstraintExp':id()), - ?match("CosNotifyFilter_ConstraintExp", - 'CosNotifyFilter_ConstraintExp':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_ConstraintInfo' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_ConstraintInfo'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_ConstraintInfo':tc())), - ?match("IDL:omg.org/CosNotifyFilter/ConstraintInfo:1.0", - 'CosNotifyFilter_ConstraintInfo':id()), - ?match("CosNotifyFilter_ConstraintInfo", - 'CosNotifyFilter_ConstraintInfo':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_ConstraintNotFound' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_ConstraintNotFound'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_ConstraintNotFound':tc())), - ?match("IDL:omg.org/CosNotifyFilter/ConstraintNotFound:1.0", - 'CosNotifyFilter_ConstraintNotFound':id()), - ?match("CosNotifyFilter_ConstraintNotFound", - 'CosNotifyFilter_ConstraintNotFound':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_DuplicateConstraintID' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_DuplicateConstraintID'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_DuplicateConstraintID':tc())), - ?match("IDL:omg.org/CosNotifyFilter/DuplicateConstraintID:1.0", - 'CosNotifyFilter_DuplicateConstraintID':id()), - ?match("CosNotifyFilter_DuplicateConstraintID", - 'CosNotifyFilter_DuplicateConstraintID':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_FilterNotFound' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_FilterNotFound'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_FilterNotFound':tc())), - ?match("IDL:omg.org/CosNotifyFilter/FilterNotFound:1.0", - 'CosNotifyFilter_FilterNotFound':id()), - ?match("CosNotifyFilter_FilterNotFound", - 'CosNotifyFilter_FilterNotFound':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_InvalidConstraint' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_InvalidConstraint'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_InvalidConstraint':tc())), - ?match("IDL:omg.org/CosNotifyFilter/InvalidConstraint:1.0", - 'CosNotifyFilter_InvalidConstraint':id()), - ?match("CosNotifyFilter_InvalidConstraint", - 'CosNotifyFilter_InvalidConstraint':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_InvalidGrammar' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_InvalidGrammar'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_InvalidGrammar':tc())), - ?match("IDL:omg.org/CosNotifyFilter/InvalidGrammar:1.0", - 'CosNotifyFilter_InvalidGrammar':id()), - ?match("CosNotifyFilter_InvalidGrammar", - 'CosNotifyFilter_InvalidGrammar':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_InvalidValue' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_InvalidValue'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_InvalidValue':tc())), - ?match("IDL:omg.org/CosNotifyFilter/InvalidValue:1.0", - 'CosNotifyFilter_InvalidValue':id()), - ?match("CosNotifyFilter_InvalidValue", - 'CosNotifyFilter_InvalidValue':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_MappingConstraintInfo' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_MappingConstraintInfo'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_MappingConstraintInfo':tc())), - ?match("IDL:omg.org/CosNotifyFilter/MappingConstraintInfo:1.0", - 'CosNotifyFilter_MappingConstraintInfo':id()), - ?match("CosNotifyFilter_MappingConstraintInfo", - 'CosNotifyFilter_MappingConstraintInfo':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_MappingConstraintPair' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_MappingConstraintPair'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_MappingConstraintPair':tc())), - ?match("IDL:omg.org/CosNotifyFilter/MappingConstraintPair:1.0", - 'CosNotifyFilter_MappingConstraintPair':id()), - ?match("CosNotifyFilter_MappingConstraintPair", - 'CosNotifyFilter_MappingConstraintPair':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_UnsupportedFilterableData' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_UnsupportedFilterableData'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_UnsupportedFilterableData':tc())), - ?match("IDL:omg.org/CosNotifyFilter/UnsupportedFilterableData:1.0", - 'CosNotifyFilter_UnsupportedFilterableData':id()), - ?match("CosNotifyFilter_UnsupportedFilterableData", - 'CosNotifyFilter_UnsupportedFilterableData':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_CallbackIDSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_CallbackIDSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_CallbackIDSeq':tc())), - ?match("IDL:omg.org/CosNotifyFilter/CallbackIDSeq:1.0", - 'CosNotifyFilter_CallbackIDSeq':id()), - ?match("CosNotifyFilter_CallbackIDSeq", - 'CosNotifyFilter_CallbackIDSeq':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_ConstraintExpSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_ConstraintExpSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_ConstraintExpSeq':tc())), - ?match("IDL:omg.org/CosNotifyFilter/ConstraintExpSeq:1.0", - 'CosNotifyFilter_ConstraintExpSeq':id()), - ?match("CosNotifyFilter_ConstraintExpSeq", - 'CosNotifyFilter_ConstraintExpSeq':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_ConstraintIDSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_ConstraintIDSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_ConstraintIDSeq':tc())), - ?match("IDL:omg.org/CosNotifyFilter/ConstraintIDSeq:1.0", - 'CosNotifyFilter_ConstraintIDSeq':id()), - ?match("CosNotifyFilter_ConstraintIDSeq", - 'CosNotifyFilter_ConstraintIDSeq':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_ConstraintInfoSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_ConstraintInfoSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_ConstraintInfoSeq':tc())), - ?match("IDL:omg.org/CosNotifyFilter/ConstraintInfoSeq:1.0", - 'CosNotifyFilter_ConstraintInfoSeq':id()), - ?match("CosNotifyFilter_ConstraintInfoSeq", - 'CosNotifyFilter_ConstraintInfoSeq':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_FilterIDSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_FilterIDSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_FilterIDSeq':tc())), - ?match("IDL:omg.org/CosNotifyFilter/FilterIDSeq:1.0", - 'CosNotifyFilter_FilterIDSeq':id()), - ?match("CosNotifyFilter_FilterIDSeq", - 'CosNotifyFilter_FilterIDSeq':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_MappingConstraintInfoSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_MappingConstraintInfoSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_MappingConstraintInfoSeq':tc())), - ?match("IDL:omg.org/CosNotifyFilter/MappingConstraintInfoSeq:1.0", - 'CosNotifyFilter_MappingConstraintInfoSeq':id()), - ?match("CosNotifyFilter_MappingConstraintInfoSeq", - 'CosNotifyFilter_MappingConstraintInfoSeq':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_MappingConstraintPairSeq' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_MappingConstraintPairSeq'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyFilter_MappingConstraintPairSeq':tc())), - ?match("IDL:omg.org/CosNotifyFilter/MappingConstraintPairSeq:1.0", - 'CosNotifyFilter_MappingConstraintPairSeq':id()), - ?match("CosNotifyFilter_MappingConstraintPairSeq", - 'CosNotifyFilter_MappingConstraintPairSeq':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_InvalidEventType' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_InvalidEventType'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyComm_InvalidEventType':tc())), - ?match("IDL:omg.org/CosNotifyComm/InvalidEventType:1.0", - 'CosNotifyComm_InvalidEventType':id()), - ?match("CosNotifyComm_InvalidEventType", - 'CosNotifyComm_InvalidEventType':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ProxyNotFound' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ProxyNotFound'(_) -> - ?match(true, orber_tc:check_tc('CosNotifyChannelAdmin_ProxyNotFound':tc())), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ProxyNotFound:1.0", - 'CosNotifyChannelAdmin_ProxyNotFound':id()), - ?match("CosNotifyChannelAdmin_ProxyNotFound", - 'CosNotifyChannelAdmin_ProxyNotFound':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_AdminPropertiesAdmin' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_AdminPropertiesAdmin'(_) -> - ?nomatch(undefined, 'CosNotification_AdminPropertiesAdmin':oe_tc(get_admin)), - ?nomatch(undefined, 'CosNotification_AdminPropertiesAdmin':oe_tc(set_admin)), - ?match(undefined, 'CosNotification_AdminPropertiesAdmin':oe_tc(undefined)), - ?match([_|_], 'CosNotification_AdminPropertiesAdmin':oe_get_interface()), - ?match("IDL:omg.org/CosNotification/AdminPropertiesAdmin:1.0", - 'CosNotification_AdminPropertiesAdmin':typeID()), - check_tc('CosNotification_AdminPropertiesAdmin':oe_get_interface()), - ?match(true, 'CosNotification_AdminPropertiesAdmin':oe_is_a('CosNotification_AdminPropertiesAdmin':typeID())), - ?match(false, 'CosNotification_AdminPropertiesAdmin':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotification_QoSAdmin' -%% Description: -%%----------------------------------------------------------------- -'CosNotification_QoSAdmin'(_) -> - ?nomatch(undefined, 'CosNotification_QoSAdmin':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotification_QoSAdmin':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotification_QoSAdmin':oe_tc(validate_qos)), - ?match(undefined, 'CosNotification_QoSAdmin':oe_tc(undefined)), - ?match([_|_], 'CosNotification_QoSAdmin':oe_get_interface()), - ?match("IDL:omg.org/CosNotification/QoSAdmin:1.0", - 'CosNotification_QoSAdmin':typeID()), - check_tc('CosNotification_QoSAdmin':oe_get_interface()), - ?match(true, 'CosNotification_QoSAdmin':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(false, 'CosNotification_QoSAdmin':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ConsumerAdmin' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ConsumerAdmin'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc('_get_MyID')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc('_get_MyChannel')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc('_get_MyOperator')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc('_get_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc('_set_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc('_get_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc('_set_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc('_get_pull_suppliers')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc('_get_push_suppliers')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(get_proxy_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(obtain_notification_pull_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(obtain_notification_push_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(destroy)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(subscription_change)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(obtain_push_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(obtain_pull_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(callSeq)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(callAny)), - ?match(undefined, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_ConsumerAdmin':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ConsumerAdmin:1.0", - 'CosNotifyChannelAdmin_ConsumerAdmin':typeID()), - check_tc('CosNotifyChannelAdmin_ConsumerAdmin':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_is_a('CosNotifyChannelAdmin_ConsumerAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_is_a('CosEventChannelAdmin_ConsumerAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_is_a('oe_CosNotificationComm_Event':typeID())), - ?match(false, 'CosNotifyChannelAdmin_ConsumerAdmin':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_EventChannel' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_EventChannel'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc('_get_MyFactory')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc('_get_default_consumer_admin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc('_get_default_supplier_admin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc('_get_default_filter_factory')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(new_for_consumers)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(new_for_suppliers)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(get_consumeradmin)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(get_supplieradmin)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(get_all_consumeradmins)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(get_all_supplieradmins)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(get_admin)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(set_admin)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(for_consumers)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(for_suppliers)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(destroy)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(callSeq)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(callAny)), - ?match(undefined, 'CosNotifyChannelAdmin_EventChannel':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_EventChannel':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/EventChannel:1.0", - 'CosNotifyChannelAdmin_EventChannel':typeID()), - check_tc('CosNotifyChannelAdmin_EventChannel':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_EventChannel':oe_is_a('CosNotifyChannelAdmin_EventChannel':typeID())), - ?match(true, 'CosNotifyChannelAdmin_EventChannel':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_EventChannel':oe_is_a('CosNotification_AdminPropertiesAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_EventChannel':oe_is_a('CosEventChannelAdmin_EventChannel':typeID())), - ?match(true, 'CosNotifyChannelAdmin_EventChannel':oe_is_a('oe_CosNotificationComm_Event':typeID())), - ?match(false, 'CosNotifyChannelAdmin_EventChannel':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_EventChannelFactory' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_EventChannelFactory'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannelFactory':oe_tc(create_channel)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannelFactory':oe_tc(get_all_channels)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_EventChannelFactory':oe_tc(get_event_channel)), - ?match(undefined, 'CosNotifyChannelAdmin_EventChannelFactory':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_EventChannelFactory':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/EventChannelFactory:1.0", - 'CosNotifyChannelAdmin_EventChannelFactory':typeID()), - check_tc('CosNotifyChannelAdmin_EventChannelFactory':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_EventChannelFactory':oe_is_a('CosNotifyChannelAdmin_EventChannelFactory':typeID())), - ?match(false, 'CosNotifyChannelAdmin_EventChannelFactory':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ProxyConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ProxyConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc(obtain_subscription_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc(remove_all_filters)), - ?match(undefined, 'CosNotifyChannelAdmin_ProxyConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_ProxyConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ProxyConsumer:1.0", - 'CosNotifyChannelAdmin_ProxyConsumer':typeID()), - check_tc('CosNotifyChannelAdmin_ProxyConsumer':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_ProxyConsumer':oe_is_a('CosNotifyChannelAdmin_ProxyConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyConsumer':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyConsumer':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(false, 'CosNotifyChannelAdmin_ProxyConsumer':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ProxyPullConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ProxyPullConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(connect_any_pull_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(suspend_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(resume_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(obtain_subscription_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(offer_change)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(disconnect_pull_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(connect_pull_supplier)), - ?match(undefined, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ProxyPullConsumer:1.0", - 'CosNotifyChannelAdmin_ProxyPullConsumer':typeID()), - check_tc('CosNotifyChannelAdmin_ProxyPullConsumer':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_is_a('CosNotifyChannelAdmin_ProxyPullConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_is_a('CosNotifyChannelAdmin_ProxyConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_is_a('CosNotifyComm_PullConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_is_a('CosEventComm_PullConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_is_a('CosEventChannelAdmin_ProxyPullConsumer':typeID())), - ?match(false, 'CosNotifyChannelAdmin_ProxyPullConsumer':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ProxyPullSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ProxyPullSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc('_get_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc('_set_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc('_get_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc('_set_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(obtain_offered_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(subscription_change)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(pull)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(try_pull)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(disconnect_pull_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(connect_pull_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(callSeq)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(callAny)), - ?match(undefined, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ProxyPullSupplier:1.0", - 'CosNotifyChannelAdmin_ProxyPullSupplier':typeID()), - check_tc('CosNotifyChannelAdmin_ProxyPullSupplier':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_is_a('CosNotifyChannelAdmin_ProxyPullSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_is_a('CosNotifyChannelAdmin_ProxySupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_is_a('CosNotifyComm_PullSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_is_a('CosEventComm_PullSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_is_a('CosEventChannelAdmin_ProxyPullSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_is_a('oe_CosNotificationComm_Event':typeID())), - ?match(false, 'CosNotifyChannelAdmin_ProxyPullSupplier':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ProxyPushConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ProxyPushConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(connect_any_push_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(obtain_subscription_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(offer_change)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(push)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(disconnect_push_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(connect_push_supplier)), - ?match(undefined, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ProxyPushConsumer:1.0", - 'CosNotifyChannelAdmin_ProxyPushConsumer':typeID()), - check_tc('CosNotifyChannelAdmin_ProxyPushConsumer':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_is_a('CosNotifyChannelAdmin_ProxyPushConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_is_a('CosNotifyChannelAdmin_ProxyConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_is_a('CosNotifyComm_PushConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_is_a('CosEventComm_PushConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_is_a('CosEventChannelAdmin_ProxyPushConsumer':typeID())), - ?match(false, 'CosNotifyChannelAdmin_ProxyPushConsumer':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ProxyPushSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ProxyPushSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(connect_any_push_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(suspend_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(resume_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc('_get_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc('_set_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc('_get_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc('_set_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(obtain_offered_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(subscription_change)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(disconnect_push_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(connect_push_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(callSeq)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(callAny)), - ?match(undefined, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ProxyPushSupplier:1.0", - 'CosNotifyChannelAdmin_ProxyPushSupplier':typeID()), - check_tc('CosNotifyChannelAdmin_ProxyPushSupplier':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_is_a('CosNotifyChannelAdmin_ProxyPushSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_is_a('CosNotifyChannelAdmin_ProxySupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_is_a('CosNotifyComm_PushSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_is_a('CosEventComm_PushSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_is_a('CosEventChannelAdmin_ProxyPushSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_is_a('oe_CosNotificationComm_Event':typeID())), - ?match(false, 'CosNotifyChannelAdmin_ProxyPushSupplier':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_ProxySupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_ProxySupplier'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc('_get_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc('_set_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc('_get_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc('_set_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc(obtain_offered_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc(remove_all_filters)), - ?match(undefined, 'CosNotifyChannelAdmin_ProxySupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_ProxySupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/ProxySupplier:1.0", - 'CosNotifyChannelAdmin_ProxySupplier':typeID()), - check_tc('CosNotifyChannelAdmin_ProxySupplier':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_ProxySupplier':oe_is_a('CosNotifyChannelAdmin_ProxySupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxySupplier':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_ProxySupplier':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(false, 'CosNotifyChannelAdmin_ProxySupplier':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_SequenceProxyPullConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_SequenceProxyPullConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(connect_sequence_pull_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(suspend_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(resume_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(obtain_subscription_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(disconnect_sequence_pull_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(offer_change)), - ?match(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/SequenceProxyPullConsumer:1.0", - 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':typeID()), - check_tc('CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_is_a('CosNotifyChannelAdmin_SequenceProxyPullConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_is_a('CosNotifyChannelAdmin_ProxyConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_is_a('CosNotifyComm_SequencePullConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(false, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_SequenceProxyPullSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_SequenceProxyPullSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(connect_sequence_pull_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc('_get_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc('_set_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc('_get_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc('_set_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(obtain_offered_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(pull_structured_events)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(try_pull_structured_events)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(disconnect_sequence_pull_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(subscription_change)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(callSeq)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(callAny)), - ?match(undefined, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/SequenceProxyPullSupplier:1.0", - 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':typeID()), - check_tc('CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_is_a('CosNotifyChannelAdmin_SequenceProxyPullSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_is_a('CosNotifyChannelAdmin_ProxySupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_is_a('CosNotifyComm_SequencePullSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_is_a('oe_CosNotificationComm_Event':typeID())), - ?match(false, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_SequenceProxyPushConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_SequenceProxyPushConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(connect_sequence_push_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(obtain_subscription_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(push_structured_events)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(disconnect_sequence_push_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(offer_change)), - ?match(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/SequenceProxyPushConsumer:1.0", - 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':typeID()), - check_tc('CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_is_a('CosNotifyChannelAdmin_SequenceProxyPushConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_is_a('CosNotifyChannelAdmin_ProxyConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_is_a('CosNotifyComm_SequencePushConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(false, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_SequenceProxyPushSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_SequenceProxyPushSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(connect_sequence_push_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(suspend_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(resume_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc('_get_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc('_set_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc('_get_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc('_set_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(obtain_offered_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(disconnect_sequence_push_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(subscription_change)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(callSeq)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(callAny)), - ?match(undefined, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/SequenceProxyPushSupplier:1.0", - 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':typeID()), - check_tc('CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_is_a('CosNotifyChannelAdmin_SequenceProxyPushSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_is_a('CosNotifyChannelAdmin_ProxySupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_is_a('CosNotifyComm_SequencePushSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_is_a('oe_CosNotificationComm_Event':typeID())), - ?match(false, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_StructuredProxyPullConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_StructuredProxyPullConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(connect_structured_pull_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(suspend_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(resume_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(obtain_subscription_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(disconnect_structured_pull_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(offer_change)), - ?match(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/StructuredProxyPullConsumer:1.0", - 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':typeID()), - check_tc('CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_is_a('CosNotifyChannelAdmin_StructuredProxyPullConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_is_a('CosNotifyChannelAdmin_ProxyConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_is_a('CosNotifyComm_StructuredPullConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(false, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_StructuredProxyPullSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_StructuredProxyPullSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(connect_structured_pull_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc('_get_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc('_set_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc('_get_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc('_set_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(obtain_offered_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(pull_structured_event)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(try_pull_structured_event)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(disconnect_structured_pull_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(subscription_change)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(callSeq)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(callAny)), - ?match(undefined, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/StructuredProxyPullSupplier:1.0", - 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':typeID()), - check_tc('CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_is_a('CosNotifyChannelAdmin_StructuredProxyPullSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_is_a('CosNotifyChannelAdmin_ProxySupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_is_a('CosNotifyComm_StructuredPullSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_is_a('oe_CosNotificationComm_Event':typeID())), - ?match(false, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_StructuredProxyPushConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_StructuredProxyPushConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(connect_structured_push_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(obtain_subscription_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(push_structured_event)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(disconnect_structured_push_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(offer_change)), - ?match(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/StructuredProxyPushConsumer:1.0", - 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':typeID()), - check_tc('CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_is_a('CosNotifyChannelAdmin_StructuredProxyPushConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_is_a('CosNotifyChannelAdmin_ProxyConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_is_a('CosNotifyComm_StructuredPushConsumer':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(false, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_StructuredProxyPushSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_StructuredProxyPushSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(connect_structured_push_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(suspend_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(resume_connection)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc('_get_MyType')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc('_get_MyAdmin')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc('_get_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc('_set_priority_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc('_get_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc('_set_lifetime_filter')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(obtain_offered_types)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(validate_event_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(disconnect_structured_push_supplier)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(subscription_change)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(callSeq)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(callAny)), - ?match(undefined, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/StructuredProxyPushSupplier:1.0", - 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':typeID()), - check_tc('CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_is_a('CosNotifyChannelAdmin_StructuredProxyPushSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_is_a('CosNotifyChannelAdmin_ProxySupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_is_a('CosNotifyComm_StructuredPushSupplier':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(true, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_is_a('oe_CosNotificationComm_Event':typeID())), - ?match(false, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyChannelAdmin_SupplierAdmin' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyChannelAdmin_SupplierAdmin'(_) -> - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc('_get_MyID')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc('_get_MyChannel')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc('_get_MyOperator')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc('_get_pull_consumers')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc('_get_push_consumers')), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(get_proxy_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(obtain_notification_pull_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(obtain_notification_push_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(destroy)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(get_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(set_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(validate_qos)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(offer_change)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(remove_all_filters)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(obtain_push_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(obtain_pull_consumer)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(callSeq)), - ?nomatch(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(callAny)), - ?match(undefined, 'CosNotifyChannelAdmin_SupplierAdmin':oe_tc(undefined)), - ?match([_|_], 'CosNotifyChannelAdmin_SupplierAdmin':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyChannelAdmin/SupplierAdmin:1.0", - 'CosNotifyChannelAdmin_SupplierAdmin':typeID()), - check_tc('CosNotifyChannelAdmin_SupplierAdmin':oe_get_interface()), - ?match(true, 'CosNotifyChannelAdmin_SupplierAdmin':oe_is_a('CosNotifyChannelAdmin_SupplierAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SupplierAdmin':oe_is_a('CosNotification_QoSAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SupplierAdmin':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SupplierAdmin':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SupplierAdmin':oe_is_a('CosEventChannelAdmin_SupplierAdmin':typeID())), - ?match(true, 'CosNotifyChannelAdmin_SupplierAdmin':oe_is_a('oe_CosNotificationComm_Event':typeID())), - ?match(false, 'CosNotifyChannelAdmin_SupplierAdmin':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_Filter' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_Filter'(_) -> - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc('_get_constraint_grammar')), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(add_constraints)), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(modify_constraints)), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(get_constraints)), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(get_all_constraints)), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(remove_all_constraints)), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(destroy)), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(match)), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(match_structured)), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(match_typed)), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(attach_callback)), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(detach_callback)), - ?nomatch(undefined, 'CosNotifyFilter_Filter':oe_tc(get_callbacks)), - ?match(undefined, 'CosNotifyFilter_Filter':oe_tc(undefined)), - ?match([_|_], 'CosNotifyFilter_Filter':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyFilter/Filter:1.0", - 'CosNotifyFilter_Filter':typeID()), - check_tc('CosNotifyFilter_Filter':oe_get_interface()), - ?match(true, 'CosNotifyFilter_Filter':oe_is_a('CosNotifyFilter_Filter':typeID())), - ?match(false, 'CosNotifyFilter_Filter':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_FilterAdmin' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_FilterAdmin'(_) -> - ?nomatch(undefined, 'CosNotifyFilter_FilterAdmin':oe_tc(add_filter)), - ?nomatch(undefined, 'CosNotifyFilter_FilterAdmin':oe_tc(remove_filter)), - ?nomatch(undefined, 'CosNotifyFilter_FilterAdmin':oe_tc(get_filter)), - ?nomatch(undefined, 'CosNotifyFilter_FilterAdmin':oe_tc(get_all_filters)), - ?nomatch(undefined, 'CosNotifyFilter_FilterAdmin':oe_tc(remove_all_filters)), - ?match(undefined, 'CosNotifyFilter_FilterAdmin':oe_tc(undefined)), - ?match([_|_], 'CosNotifyFilter_FilterAdmin':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyFilter/FilterAdmin:1.0", - 'CosNotifyFilter_FilterAdmin':typeID()), - check_tc('CosNotifyFilter_FilterAdmin':oe_get_interface()), - ?match(true, 'CosNotifyFilter_FilterAdmin':oe_is_a('CosNotifyFilter_FilterAdmin':typeID())), - ?match(false, 'CosNotifyFilter_FilterAdmin':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_FilterFactory' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_FilterFactory'(_) -> - ?nomatch(undefined, 'CosNotifyFilter_FilterFactory':oe_tc(create_filter)), - ?nomatch(undefined, 'CosNotifyFilter_FilterFactory':oe_tc(create_mapping_filter)), - ?match(undefined, 'CosNotifyFilter_FilterFactory':oe_tc(undefined)), - ?match([_|_], 'CosNotifyFilter_FilterFactory':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyFilter/FilterFactory:1.0", - 'CosNotifyFilter_FilterFactory':typeID()), - check_tc('CosNotifyFilter_FilterFactory':oe_get_interface()), - ?match(true, 'CosNotifyFilter_FilterFactory':oe_is_a('CosNotifyFilter_FilterFactory':typeID())), - ?match(false, 'CosNotifyFilter_FilterFactory':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyFilter_MappingFilter' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyFilter_MappingFilter'(_) -> - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc('_get_constraint_grammar')), - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc('_get_value_type')), - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc('_get_default_value')), - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc(add_mapping_constraints)), - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc(modify_mapping_constraints)), - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc(get_mapping_constraints)), - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc(get_all_mapping_constraints)), - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc(remove_all_mapping_constraints)), - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc(destroy)), - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc(match)), - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc(match_structured)), - ?nomatch(undefined, 'CosNotifyFilter_MappingFilter':oe_tc(match_typed)), - ?match(undefined, 'CosNotifyFilter_MappingFilter':oe_tc(undefined)), - ?match([_|_], 'CosNotifyFilter_MappingFilter':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyFilter/MappingFilter:1.0", - 'CosNotifyFilter_MappingFilter':typeID()), - check_tc('CosNotifyFilter_MappingFilter':oe_get_interface()), - ?match(true, 'CosNotifyFilter_MappingFilter':oe_is_a('CosNotifyFilter_MappingFilter':typeID())), - ?match(false, 'CosNotifyFilter_MappingFilter':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_NotifyPublish' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_NotifyPublish'(_) -> - ?nomatch(undefined, 'CosNotifyComm_NotifyPublish':oe_tc(offer_change)), - ?match(undefined, 'CosNotifyComm_NotifyPublish':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_NotifyPublish':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/NotifyPublish:1.0", - 'CosNotifyComm_NotifyPublish':typeID()), - check_tc('CosNotifyComm_NotifyPublish':oe_get_interface()), - ?match(true, 'CosNotifyComm_NotifyPublish':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(false, 'CosNotifyComm_NotifyPublish':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_NotifySubscribe' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_NotifySubscribe'(_) -> - ?nomatch(undefined, 'CosNotifyComm_NotifySubscribe':oe_tc(subscription_change)), - ?match(undefined, 'CosNotifyComm_NotifySubscribe':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_NotifySubscribe':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/NotifySubscribe:1.0", - 'CosNotifyComm_NotifySubscribe':typeID()), - check_tc('CosNotifyComm_NotifySubscribe':oe_get_interface()), - ?match(true, 'CosNotifyComm_NotifySubscribe':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(false, 'CosNotifyComm_NotifySubscribe':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_PullConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_PullConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyComm_PullConsumer':oe_tc(offer_change)), - ?nomatch(undefined, 'CosNotifyComm_PullConsumer':oe_tc(disconnect_pull_consumer)), - ?match(undefined, 'CosNotifyComm_PullConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_PullConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/PullConsumer:1.0", - 'CosNotifyComm_PullConsumer':typeID()), - check_tc('CosNotifyComm_PullConsumer':oe_get_interface()), - ?match(true, 'CosNotifyComm_PullConsumer':oe_is_a('CosNotifyComm_PullConsumer':typeID())), - ?match(true, 'CosNotifyComm_PullConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(true, 'CosNotifyComm_PullConsumer':oe_is_a('CosEventComm_PullConsumer':typeID())), - ?match(false, 'CosNotifyComm_PullConsumer':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_PullSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_PullSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyComm_PullSupplier':oe_tc(subscription_change)), - ?nomatch(undefined, 'CosNotifyComm_PullSupplier':oe_tc(pull)), - ?nomatch(undefined, 'CosNotifyComm_PullSupplier':oe_tc(try_pull)), - ?nomatch(undefined, 'CosNotifyComm_PullSupplier':oe_tc(disconnect_pull_supplier)), - ?match(undefined, 'CosNotifyComm_PullSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_PullSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/PullSupplier:1.0", - 'CosNotifyComm_PullSupplier':typeID()), - check_tc('CosNotifyComm_PullSupplier':oe_get_interface()), - ?match(true, 'CosNotifyComm_PullSupplier':oe_is_a('CosNotifyComm_PullSupplier':typeID())), - ?match(true, 'CosNotifyComm_PullSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(true, 'CosNotifyComm_PullSupplier':oe_is_a('CosEventComm_PullSupplier':typeID())), - ?match(false, 'CosNotifyComm_PullSupplier':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_PushConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_PushConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyComm_PushConsumer':oe_tc(offer_change)), - ?nomatch(undefined, 'CosNotifyComm_PushConsumer':oe_tc(push)), - ?nomatch(undefined, 'CosNotifyComm_PushConsumer':oe_tc(disconnect_push_consumer)), - ?match(undefined, 'CosNotifyComm_PushConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_PushConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/PushConsumer:1.0", - 'CosNotifyComm_PushConsumer':typeID()), - check_tc('CosNotifyComm_PushConsumer':oe_get_interface()), - ?match(true, 'CosNotifyComm_PushConsumer':oe_is_a('CosNotifyComm_PushConsumer':typeID())), - ?match(true, 'CosNotifyComm_PushConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(true, 'CosNotifyComm_PushConsumer':oe_is_a('CosEventComm_PushConsumer':typeID())), - ?match(false, 'CosNotifyComm_PushConsumer':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_PushSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_PushSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyComm_PushSupplier':oe_tc(subscription_change)), - ?nomatch(undefined, 'CosNotifyComm_PushSupplier':oe_tc(disconnect_push_supplier)), - ?match(undefined, 'CosNotifyComm_PushSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_PushSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/PushSupplier:1.0", - 'CosNotifyComm_PushSupplier':typeID()), - check_tc('CosNotifyComm_PushSupplier':oe_get_interface()), - ?match(true, 'CosNotifyComm_PushSupplier':oe_is_a('CosNotifyComm_PushSupplier':typeID())), - ?match(true, 'CosNotifyComm_PushSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(true, 'CosNotifyComm_PushSupplier':oe_is_a('CosEventComm_PushSupplier':typeID())), - ?match(false, 'CosNotifyComm_PushSupplier':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_SequencePullConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_SequencePullConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyComm_SequencePullConsumer':oe_tc(disconnect_sequence_pull_consumer)), - ?nomatch(undefined, 'CosNotifyComm_SequencePullConsumer':oe_tc(offer_change)), - ?match(undefined, 'CosNotifyComm_SequencePullConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_SequencePullConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/SequencePullConsumer:1.0", - 'CosNotifyComm_SequencePullConsumer':typeID()), - check_tc('CosNotifyComm_SequencePullConsumer':oe_get_interface()), - ?match(true, 'CosNotifyComm_SequencePullConsumer':oe_is_a('CosNotifyComm_SequencePullConsumer':typeID())), - ?match(true, 'CosNotifyComm_SequencePullConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(false, 'CosNotifyComm_SequencePullConsumer':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_SequencePullSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_SequencePullSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyComm_SequencePullSupplier':oe_tc(pull_structured_events)), - ?nomatch(undefined, 'CosNotifyComm_SequencePullSupplier':oe_tc(try_pull_structured_events)), - ?nomatch(undefined, 'CosNotifyComm_SequencePullSupplier':oe_tc(disconnect_sequence_pull_supplier)), - ?nomatch(undefined, 'CosNotifyComm_SequencePullSupplier':oe_tc(subscription_change)), - ?match(undefined, 'CosNotifyComm_SequencePullSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_SequencePullSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/SequencePullSupplier:1.0", - 'CosNotifyComm_SequencePullSupplier':typeID()), - check_tc('CosNotifyComm_SequencePullSupplier':oe_get_interface()), - ?match(true, 'CosNotifyComm_SequencePullSupplier':oe_is_a('CosNotifyComm_SequencePullSupplier':typeID())), - ?match(true, 'CosNotifyComm_SequencePullSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(false, 'CosNotifyComm_SequencePullSupplier':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_SequencePushConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_SequencePushConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyComm_SequencePushConsumer':oe_tc(push_structured_events)), - ?nomatch(undefined, 'CosNotifyComm_SequencePushConsumer':oe_tc(disconnect_sequence_push_consumer)), - ?nomatch(undefined, 'CosNotifyComm_SequencePushConsumer':oe_tc(offer_change)), - ?match(undefined, 'CosNotifyComm_SequencePushConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_SequencePushConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/SequencePushConsumer:1.0", - 'CosNotifyComm_SequencePushConsumer':typeID()), - check_tc('CosNotifyComm_SequencePushConsumer':oe_get_interface()), - ?match(true, 'CosNotifyComm_SequencePushConsumer':oe_is_a('CosNotifyComm_SequencePushConsumer':typeID())), - ?match(true, 'CosNotifyComm_SequencePushConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(false, 'CosNotifyComm_SequencePushConsumer':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_SequencePushSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_SequencePushSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyComm_SequencePushSupplier':oe_tc(disconnect_sequence_push_supplier)), - ?nomatch(undefined, 'CosNotifyComm_SequencePushSupplier':oe_tc(subscription_change)), - ?match(undefined, 'CosNotifyComm_SequencePushSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_SequencePushSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/SequencePushSupplier:1.0", - 'CosNotifyComm_SequencePushSupplier':typeID()), - check_tc('CosNotifyComm_SequencePushSupplier':oe_get_interface()), - ?match(true, 'CosNotifyComm_SequencePushSupplier':oe_is_a('CosNotifyComm_SequencePushSupplier':typeID())), - ?match(true, 'CosNotifyComm_SequencePushSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(false, 'CosNotifyComm_SequencePushSupplier':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_StructuredPullConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_StructuredPullConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyComm_StructuredPullConsumer':oe_tc(disconnect_structured_pull_consumer)), - ?nomatch(undefined, 'CosNotifyComm_StructuredPullConsumer':oe_tc(offer_change)), - ?match(undefined, 'CosNotifyComm_StructuredPullConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_StructuredPullConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/StructuredPullConsumer:1.0", - 'CosNotifyComm_StructuredPullConsumer':typeID()), - check_tc('CosNotifyComm_StructuredPullConsumer':oe_get_interface()), - ?match(true, 'CosNotifyComm_StructuredPullConsumer':oe_is_a('CosNotifyComm_StructuredPullConsumer':typeID())), - ?match(true, 'CosNotifyComm_StructuredPullConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(false, 'CosNotifyComm_StructuredPullConsumer':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_StructuredPullSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_StructuredPullSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyComm_StructuredPullSupplier':oe_tc(pull_structured_event)), - ?nomatch(undefined, 'CosNotifyComm_StructuredPullSupplier':oe_tc(try_pull_structured_event)), - ?nomatch(undefined, 'CosNotifyComm_StructuredPullSupplier':oe_tc(disconnect_structured_pull_supplier)), - ?nomatch(undefined, 'CosNotifyComm_StructuredPullSupplier':oe_tc(subscription_change)), - ?match(undefined, 'CosNotifyComm_StructuredPullSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_StructuredPullSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/StructuredPullSupplier:1.0", - 'CosNotifyComm_StructuredPullSupplier':typeID()), - check_tc('CosNotifyComm_StructuredPullSupplier':oe_get_interface()), - ?match(true, 'CosNotifyComm_StructuredPullSupplier':oe_is_a('CosNotifyComm_StructuredPullSupplier':typeID())), - ?match(true, 'CosNotifyComm_StructuredPullSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(false, 'CosNotifyComm_StructuredPullSupplier':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_StructuredPushConsumer' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_StructuredPushConsumer'(_) -> - ?nomatch(undefined, 'CosNotifyComm_StructuredPushConsumer':oe_tc(push_structured_event)), - ?nomatch(undefined, 'CosNotifyComm_StructuredPushConsumer':oe_tc(disconnect_structured_push_consumer)), - ?nomatch(undefined, 'CosNotifyComm_StructuredPushConsumer':oe_tc(offer_change)), - ?match(undefined, 'CosNotifyComm_StructuredPushConsumer':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_StructuredPushConsumer':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/StructuredPushConsumer:1.0", - 'CosNotifyComm_StructuredPushConsumer':typeID()), - check_tc('CosNotifyComm_StructuredPushConsumer':oe_get_interface()), - ?match(true, 'CosNotifyComm_StructuredPushConsumer':oe_is_a('CosNotifyComm_StructuredPushConsumer':typeID())), - ?match(true, 'CosNotifyComm_StructuredPushConsumer':oe_is_a('CosNotifyComm_NotifyPublish':typeID())), - ?match(false, 'CosNotifyComm_StructuredPushConsumer':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosNotifyComm_StructuredPushSupplier' -%% Description: -%%----------------------------------------------------------------- -'CosNotifyComm_StructuredPushSupplier'(_) -> - ?nomatch(undefined, 'CosNotifyComm_StructuredPushSupplier':oe_tc(disconnect_structured_push_supplier)), - ?nomatch(undefined, 'CosNotifyComm_StructuredPushSupplier':oe_tc(subscription_change)), - ?match(undefined, 'CosNotifyComm_StructuredPushSupplier':oe_tc(undefined)), - ?match([_|_], 'CosNotifyComm_StructuredPushSupplier':oe_get_interface()), - ?match("IDL:omg.org/CosNotifyComm/StructuredPushSupplier:1.0", - 'CosNotifyComm_StructuredPushSupplier':typeID()), - check_tc('CosNotifyComm_StructuredPushSupplier':oe_get_interface()), - ?match(true, 'CosNotifyComm_StructuredPushSupplier':oe_is_a('CosNotifyComm_StructuredPushSupplier':typeID())), - ?match(true, 'CosNotifyComm_StructuredPushSupplier':oe_is_a('CosNotifyComm_NotifySubscribe':typeID())), - ?match(false, 'CosNotifyComm_StructuredPushSupplier':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'oe_CosNotificationComm_Event' -%% Description: -%%----------------------------------------------------------------- -'oe_CosNotificationComm_Event'(_) -> - ?nomatch(undefined, 'oe_CosNotificationComm_Event':oe_tc(callSeq)), - ?nomatch(undefined, 'oe_CosNotificationComm_Event':oe_tc(callAny)), - ?match(undefined, 'oe_CosNotificationComm_Event':oe_tc(undefined)), - ?match([_|_], 'oe_CosNotificationComm_Event':oe_get_interface()), - ?match("IDL:oe_CosNotificationComm/Event:1.0", - 'oe_CosNotificationComm_Event':typeID()), - check_tc('oe_CosNotificationComm_Event':oe_get_interface()), - ?match(true, 'oe_CosNotificationComm_Event':oe_is_a('oe_CosNotificationComm_Event':typeID())), - ?match(false, 'oe_CosNotificationComm_Event':oe_is_a("wrong")), - ok. - - - - -%%----------------------------------------------------------------- -%% MISC functions -%%----------------------------------------------------------------- -check_tc([]) -> - ok; -check_tc([{Op, {RetType, InParameters, OutParameters}}|T]) -> - io:format("checked - ~s~n", [Op]), - lists:all(?checktc(Op), [RetType|InParameters]), - lists:all(?checktc(Op), OutParameters), - check_tc(T). - - diff --git a/lib/cosNotification/test/grammar_SUITE.erl b/lib/cosNotification/test/grammar_SUITE.erl deleted file mode 100644 index 536292fdee..0000000000 --- a/lib/cosNotification/test/grammar_SUITE.erl +++ /dev/null @@ -1,1091 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%-------------------------------------------------------------------- -%% File : grammar_SUITE.erl -%% Purpose : Testing the CosNotification BNF grammar. -%%-------------------------------------------------------------------- - --module(grammar_SUITE). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% cosEvent files. --include_lib("cosEvent/include/CosEventChannelAdmin.hrl"). -%% Application files --include_lib("cosNotification/include/CosNotification.hrl"). --include_lib("cosNotification/include/CosNotifyChannelAdmin.hrl"). --include_lib("cosNotification/include/CosNotifyComm.hrl"). --include_lib("cosNotification/include/CosNotifyFilter.hrl"). - --include_lib("cosNotification/src/CosNotification_Definitions.hrl"). - --include("idl_output/notify_test.hrl"). - --include_lib("common_test/include/ct.hrl"). - -%%--------------- DEFINES ------------------------------------ --define(default_timeout, test_server:minutes(20)). --define(match(ExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - io:format("------ CORRECT RESULT ------~n~p~n", - [AcTuAlReS]), - AcTuAlReS; - _ -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS) - end - end()). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, - cases/0, init_per_suite/1, end_per_suite/1, - union_api/1, enum_api/1, simple_types_api/1, - components_api/1, positional_api/1, variable_api/1, - init_per_testcase/2, end_per_testcase/2]). - --import(cosNotification_Filter, [create_filter/1, eval/2]). - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - cases(). - -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -cases() -> - [variable_api, union_api, enum_api, simple_types_api, - components_api, positional_api]. - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- -init_per_testcase(_Case, Config) -> - Path = code:which(?MODULE), - code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - - -end_per_testcase(_Case, Config) -> - Path = code:which(?MODULE), - code:del_path(filename:join(filename:dirname(Path), "idl_output")), - Dog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -init_per_suite(Config) -> - Path = code:which(?MODULE), - code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), - if - is_list(Config) -> - Config; - true -> - exit("Config not a list") - end. - -end_per_suite(Config) -> - Path = code:which(?MODULE), - code:del_path(filename:join(filename:dirname(Path), "idl_output")), - Config. - - -%%----------------------------------------------------------------- -%% simple types grammar tests -%%----------------------------------------------------------------- -simple_types_api(_Config) -> - %% Will always be true, no matter what kind of event we receive. - {ok,T1} = ?match({ok, _}, create_filter("2==2 and 3<4")), - ?match(true, eval(T1, ?not_CreateSE("DomainName","TypeName","EventName", - [],[], any:create(orber_tc:null(), null)))), - - %% Will always be true, no matter what kind of event we receive. - {ok,T2} = ?match({ok, _}, create_filter("")), - ?match(true, eval(T2, ?not_CreateSE("DomainName","TypeName","EventName", - [],[], any:create(orber_tc:null(), null)))), - - %% Check if $variable works - {ok,T3} = ?match({ok, _}, create_filter("$city == \'Berlin\'")), - ?match(true, eval(T3, ?not_CreateSE("DomainName","TypeName","EventName", - [#'CosNotification_Property'{name="city", - value=any:create(orber_tc:string(0), "Berlin")}], - [], any:create(orber_tc:null(), null)))), - ?match(false, eval(T3, ?not_CreateSE("DomainName","TypeName", "EventName", - [#'CosNotification_Property'{name="city", - value=any:create(orber_tc:string(0), "Dallas")}], - - [], any:create(orber_tc:null(), null)))), - - - {ok,T4} = ?match({ok, _}, create_filter("$zip == 44")), - ?match(true, eval(T4, ?not_CreateSE("DomainName","TypeName", "EventName", - [#'CosNotification_Property'{name="zip", - value=any:create(orber_tc:short(), 44)}], - - [], any:create(orber_tc:null(), null)))), - ?match(true, eval(T4, ?not_CreateSE("DomainName","TypeName", "EventName", - [],[], - any:create('CosNotification_Property':tc(), - #'CosNotification_Property' - {name="zip", - value=any:create(orber_tc:short(), - 44)})))), - ?match(false, eval(T4, ?not_CreateSE("DomainName","TypeName", "EventName", - [#'CosNotification_Property'{name="zip", - value=any:create(orber_tc:short(), 33)}], - - [], any:create(orber_tc:null(), null)))), - - %% Will always be true, no matter what kind of event we receive. - {ok,T5} = ?match({ok, _}, create_filter("\'oo'\~\'foobar\'")), - ?match(true, eval(T5, ?not_CreateSE("DomainName","TypeName","EventName", - [],[], any:create(orber_tc:null(), null)))), - %% Will always be false, no matter what kind of event we receive. - {ok,T6} = ?match({ok, _}, create_filter("\'o1'\~\'foobar\'")), - ?match(false, eval(T6, ?not_CreateSE("DomainName","TypeName","EventName", - [],[], any:create(orber_tc:null(), null)))), - - %% Can we apply the ~ operation as above using a variable - {ok,T7} = ?match({ok, _}, create_filter("$str~\'foobar\'")), - ?match(true, eval(T7, ?not_CreateSE("DomainName","TypeName","EventName", - [#'CosNotification_Property'{name="str", - value=any:create(orber_tc:string(0), "oo")}], - [], any:create(orber_tc:null(), null)))), - ?match(false, eval(T7, ?not_CreateSE("DomainName","TypeName","EventName", - [#'CosNotification_Property'{name="str", - value=any:create(orber_tc:string(0), "ok")}], - [], any:create(orber_tc:null(), null)))), - - - - {ok,_T8} = ?match({ok, _}, create_filter("$\\zip == 44444")), - - ok. - -%%----------------------------------------------------------------- -%% enum grammar tests -%%----------------------------------------------------------------- -enum_api(_Config) -> - %% Accept events whose 'in' enum is set to the value 'HOUSE' or 'CAR'. - {ok,T1} = ?match({ok, _}, create_filter("$.\\in == HOUSE or $.\\in == CAR")), - - ?match(true, eval(T1, any:create(orber_tc:alias("IFRId","in",tk_any), - any:create({tk_enum, "IFRId", "in", ["HOUSE", "CAR"]}, - 'HOUSE')))), - ?match(false, eval(T1, any:create(orber_tc:alias("IFRId","in",tk_any), - any:create({tk_enum, "IFRId", "in", ["HOUSE", "CAR"]}, - 'GARAGE')))), - ok. - - -%%----------------------------------------------------------------- -%% Union grammar tests -%%----------------------------------------------------------------- -union_api(_Config) -> - {ok,T1} = ?match({ok, _}, create_filter("exist $.uni1._d and $.uni1._d == 1 and $.uni1.(1) == 10")), - {ok,T2} = ?match({ok, _}, create_filter("default $.uni1._d and $.uni1.() == 10")), - {ok,T3} = ?match({ok, _}, create_filter("default $.uni1._d and $.uni1.(999) == 10")), - ?match(true, eval(T1, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName",[],[], - any:create(orber_tc:alias("IDL:notify_test/namedAny:1.0", - "uni1", - tk_any), - any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 1, - value=10}))))), - ?match(true, eval(T2, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName",[],[], - any:create(orber_tc:alias("IDL:notify_test/namedAny:1.0", - "uni1", - tk_any), - any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 100, - value=10}))))), - ?match(true, eval(T3, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName",[],[], - any:create(orber_tc:alias("IDL:notify_test/namedAny:1.0", - "uni1", - tk_any), - any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 100, - value=10}))))), - ?match(true, eval(T1, any:create(orber_tc:alias("IDL:notify_test/namedAny:1.0", - "uni1", - tk_any), - any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 1, - value=10})))), - ?match(false, eval(T2, any:create(orber_tc:alias("IDL:notify_test/namedAny:1.0", - "uni1", - tk_any), - any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 1, - value=10})))), - ?match(false, eval(T3, any:create(orber_tc:alias("IDL:notify_test/namedAny:1.0", - "uni1", - tk_any), - any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 1, - value=10})))), - ?match(true, eval(T1, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName",[],[], - any:create(notify_test_studies:tc(), #notify_test_studies - {uni1 = #notify_test_uni1{label= 1, value=10}, - gpa = 90, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 60)}], - monthly_attendance = {0,1,2,10}})))), - ?match(false, eval(T2, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName",[],[], - any:create(notify_test_studies:tc(), #notify_test_studies - {uni1 = #notify_test_uni1{label= 1, value=10}, - gpa = 90, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 60)}], - monthly_attendance = {0,1,2,10}})))), - ?match(false, eval(T3, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName",[],[], - any:create(notify_test_studies:tc(), #notify_test_studies - {uni1 = #notify_test_uni1{label= 1, value=10}, - gpa = 90, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 60)}], - monthly_attendance = {0,1,2,10}})))), - ?match(true, eval(T1, any:create(notify_test_studies:tc(), #notify_test_studies - {uni1 = #notify_test_uni1{label= 1, value=10}, - gpa = 90, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 60)}], - monthly_attendance = {0,1,2,10}}))), - ?match(false, eval(T2, any:create(notify_test_studies:tc(), #notify_test_studies - {uni1 = #notify_test_uni1{label= 1, value=10}, - gpa = 90, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 60)}], - monthly_attendance = {0,1,2,10}}))), - ?match(false, eval(T3, any:create(notify_test_studies:tc(), #notify_test_studies - {uni1 = #notify_test_uni1{label= 1, value=10}, - gpa = 90, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 60)}], - monthly_attendance = {0,1,2,10}}))), - - {ok,T4} = ?match({ok, _}, create_filter("exist $.alias.uni1._d and $.alias.uni1._d == 1 and $.alias.uni1.(1) == 10")), - ?match(true, eval(T4, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName",[],[], - any:create(orber_tc:alias(notify_test_studies:id(), - "alias", - notify_test_studies:tc()), - #notify_test_studies - {uni1 = #notify_test_uni1{label= 1, value=10}, - gpa = 90, tests = [], - monthly_attendance = {0,1,2,10}})))), - ?match(true, eval(T4, any:create(orber_tc:alias(notify_test_studies:id(), - "alias", - notify_test_studies:tc()), - #notify_test_studies - {uni1 = #notify_test_uni1{label= 1, value=10}, - gpa = 90, tests = [], - monthly_attendance = {0,1,2,10}}))), - %% Accept events with a default union discriminator set to the value 2. - {ok,T5} = ?match({ok, _}, create_filter("default $._d and $.defvalue == 2")), - ?match(true, eval(T5, any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 100, value=2}))), - %% label not default. - ?match(false, eval(T5, any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 2, value=2}))), - %% Default does not exist (nor the component defvalue) - ?match(false, eval(T5, any:create(notify_test_uni2:tc(), - #notify_test_uni2{label= 100, value=2}))), - %% Both wrong - ?match(false, eval(T5, any:create(notify_test_uni2:tc(), - #notify_test_uni2{label= 2, value=2}))), - - {ok,T6} = ?match({ok, _}, create_filter("default $._d and $.(-8) == 2")), - ?match(true, eval(T6, any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 100, value=2}))), - %% label not default. - ?match(false, eval(T6, any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 2, value=2}))), - %% Default does not exist (nor the component defvalue) - ?match(false, eval(T6, any:create(notify_test_uni2:tc(), - #notify_test_uni2{label= 100, value=2}))), - %% Both wrong - ?match(false, eval(T6, any:create(notify_test_uni2:tc(), - #notify_test_uni2{label= 2, value=2}))), - %% the same as the above, but we try to access a label that is not default - {ok,T7} = ?match({ok, _}, create_filter("default $._d and $.(2) == 2")), - ?match({error, _}, eval(T7, any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 100, value=2}))), - - %% Must be a default-union with its 'defvalue' set to 2. - {ok,T8} = ?match({ok, _}, create_filter("default $._d and $.('defvalue') == 2")), - ?match(true, eval(T8, any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 100, value=2}))), - %% label not default. - ?match(false, eval(T8, any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 2, value=2}))), - %% Default does not exist (nor the component defvalue) - ?match(false, eval(T8, any:create(notify_test_uni2:tc(), - #notify_test_uni2{label= 100, value=2}))), - %% Both wrong - ?match(false, eval(T8, any:create(notify_test_uni2:tc(), - #notify_test_uni2{label= 2, value=2}))), - - %% Must be a default-union with its value set to 2. - {ok,T9} = ?match({ok, _}, create_filter("default $._d and $.(+100) == 2")), - ?match(true, eval(T9, any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 100, value=2}))), - %% label not default. - ?match(false, eval(T9, any:create(notify_test_uni1:tc(), - #notify_test_uni1{label= 2, value=2}))), - %% Default does not exist (nor the component defvalue) - ?match(false, eval(T9, any:create(notify_test_uni2:tc(), - #notify_test_uni2{label= 100, value=2}))), - %% Both wrong - ?match(false, eval(T9, any:create(notify_test_uni2:tc(), - #notify_test_uni2{label= 2, value=2}))), - - %% So far, we have only tested to access the union itself. No will use more - %% complex union members. - %% T10 and T11 is "equal" - {ok,T10} = ?match({ok, _}, create_filter("$.M < 54")), - {ok,T11} = ?match({ok, _}, create_filter("$.(5) < 54")), - ?match(false, eval(T10, any:create(notify_test_K:tc(), - #notify_test_K{label= 5, value=54}))), - ?match(false, eval(T11, any:create(notify_test_K:tc(), - #notify_test_K{label= 5, value=54}))), - ?match(true, eval(T10, any:create(notify_test_K:tc(), - #notify_test_K{label= 5, value=50}))), - ?match(true, eval(T11, any:create(notify_test_K:tc(), - #notify_test_K{label= 5, value=50}))), - ?match({error,_}, eval(T10, any:create(notify_test_K:tc(), - #notify_test_K{label= -1, value=50}))), - ?match({error,_}, eval(T11, any:create(notify_test_K:tc(), - #notify_test_K{label= -1, value=50}))), - - %% T12 and T13 is "equal" - {ok,T12} = ?match({ok, _}, create_filter("$.L.C < 128")), - {ok,T13} = ?match({ok, _}, create_filter("$.(3).2 < 128")), - ?match(true, eval(T12, any:create(notify_test_K:tc(), - #notify_test_K{label= 3, value= - #notify_test_X{'A' = 1, - 'B' = "string", - 'C' = 120}}))), - ?match(true, eval(T13, any:create(notify_test_K:tc(), - #notify_test_K{label= 3, value= - #notify_test_X{'A' = 1, - 'B' = "string", - 'C' = 120}}))), - ?match(false, eval(T12, any:create(notify_test_K:tc(), - #notify_test_K{label= 3, value= - #notify_test_X{'A' = 1, - 'B' = "string", - 'C' = 200}}))), - ?match(false, eval(T13, any:create(notify_test_K:tc(), - #notify_test_K{label= 3, value= - #notify_test_X{'A' = 1, - 'B' = "string", - 'C' = 200}}))), - - %% Test if 'putty' is a substring of K - {ok,T15} = ?match({ok, _}, create_filter("'putty' ~ $.(2)")), - {ok,T16} = ?match({ok, _}, create_filter("'putty' ~ $.K")), - ?match(true, eval(T15, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "isputtyok"}))), - ?match(true, eval(T16, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "isputtyok"}))), - ?match(false, eval(T15, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "notputtok"}))), - ?match(false, eval(T16, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "notputtok"}))), - - {ok,_T17} = ?match({ok, _}, create_filter("'putty' ~ $.(3).1")), - {ok,_T18} = ?match({ok, _}, create_filter("'putty' ~ $.L.B")), - ?match(true, eval(T12, any:create(notify_test_K:tc(), - #notify_test_K{label= 3, value= - #notify_test_X{'A' = 1, - 'B' = "isputtyok", - 'C' = 120}}))), - ?match(true, eval(T13, any:create(notify_test_K:tc(), - #notify_test_K{label= 3, value= - #notify_test_X{'A' = 1, - 'B' = "isputtyok", - 'C' = 120}}))), - ?match(false, eval(T12, any:create(notify_test_K:tc(), - #notify_test_K{label= 3, value= - #notify_test_X{'A' = 1, - 'B' = "notputtok", - 'C' = 200}}))), - ?match(false, eval(T13, any:create(notify_test_K:tc(), - #notify_test_K{label= 3, value= - #notify_test_X{'A' = 1, - 'B' = "notputtok", - 'C' = 200}}))), - - %% Please observe that the switch 0 and 2 is defined to be equivalent. - {ok,T19} = ?match({ok, _}, create_filter("$._d == 2 and $.(0) != 'hoob'")), - {ok,T20} = ?match({ok, _}, create_filter("$._d == 2 and $.(2) != 'hoob'")), - ?match(true, eval(T19, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "nothoob"}))), - ?match(true, eval(T20, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "nothoob"}))), - ?match(false, eval(T19, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "hoob"}))), - ?match(false, eval(T20, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "hoob"}))), - - ?match(false, eval(T19, any:create(notify_test_K:tc(), - #notify_test_K{label= 5, value= 55}))), - ?match(false, eval(T20, any:create(notify_test_K:tc(), - #notify_test_K{label= 5, value= 55}))), - - ?match(false, eval(T19, any:create(notify_test_K:tc(), - #notify_test_K{label= 100, value= "nothoob"}))), - ?match(false, eval(T20, any:create(notify_test_K:tc(), - #notify_test_K{label= 100, value= "nothoob"}))), - - {ok,T21} = ?match({ok, _}, create_filter("exist $.K")), - {ok,T22} = ?match({ok, _}, create_filter("exist $.(0) or exist $.(2)")), - ?match(true, eval(T21, any:create(notify_test_K:tc(), - #notify_test_K{label= 0, value= "hoob"}))), - ?match(true, eval(T22, any:create(notify_test_K:tc(), - #notify_test_K{label= 0, value= "hoob"}))), - ?match(true, eval(T21, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "hoob"}))), - ?match(true, eval(T22, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "hoob"}))), - ?match(false, eval(T21, any:create(notify_test_K:tc(), - #notify_test_K{label= 5, value= 55}))), - ?match(false, eval(T22, any:create(notify_test_K:tc(), - #notify_test_K{label= 5, value= 55}))), - - - %% Please observe that the switch 0 and 2 is defined to be equivalent. - {ok,T23} = ?match({ok, _}, create_filter("exist $.(2)")), - {ok,T24} = ?match({ok, _}, create_filter("exist $.(0)")), - ?match(true, eval(T23, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "hoob"}))), - ?match(false, eval(T24, any:create(notify_test_K:tc(), - #notify_test_K{label= 2, value= "hoob"}))), - ?match(false, eval(T23, any:create(notify_test_K:tc(), - #notify_test_K{label= 0, value= "hoob"}))), - ?match(true, eval(T24, any:create(notify_test_K:tc(), - #notify_test_K{label= 0, value= "hoob"}))), - ?match(false, eval(T23, any:create(notify_test_K:tc(), - #notify_test_K{label= 5, value= 55}))), - ?match(false, eval(T24, any:create(notify_test_K:tc(), - #notify_test_K{label= 5, value= 55}))), - - ok. - -%%----------------------------------------------------------------- -%% Variables grammar tests -%%----------------------------------------------------------------- -variable_api(_Config) -> - %% Accept all "CommunicationsAlarm" events - {ok,T0} = ?match({ok, _}, create_filter("$type_name == 'CommunicationsAlarm'")), - - ?match(true, eval(T0, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName",[],[], - any:create(orber_tc:null(), null)))), - ?match(false, eval(T0, ?not_CreateSE("DomainName","CommunicationsOK", - "EventName", [],[], - any:create(orber_tc:null(), null)))), - ?match(true, eval(T0, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName", [],[], - any:create(orber_tc:alias("IFRId", "type_name", - orber_tc:string(0)), - "CommunicationsOK")))), - - ?match(true, eval(T0, any:create(orber_tc:alias("IFRId", "type_name", - orber_tc:string(0)), - "CommunicationsAlarm"))), - ?match(false, eval(T0, any:create(orber_tc:alias("IFRId", "type_name", - orber_tc:string(0)), - "CommunicationsOK"))), - - - %% Accept all "CommunicationsAlarm" events but no "lost_packet" messages. - {ok,T1} = ?match({ok, _}, create_filter("$type_name == 'CommunicationsAlarm' and not ($event_name == 'lost_packet')")), - - ?match(true, eval(T1, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName",[],[], - any:create(orber_tc:null(), null)))), - ?match(false, eval(T1, ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", [],[], - any:create(orber_tc:null(), null)))), - ?match(true, - eval(T1, any:create(orber_tc:sequence('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="type_name", - value=any:create(orber_tc:string(0), "CommunicationsAlarm")}, - #'CosNotification_Property'{name="event_name", - value=any:create(orber_tc:string(0), "EventName")}]))), - ?match(false, - eval(T1, any:create(orber_tc:sequence('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="type_name", - value=any:create(orber_tc:string(0), "CommunicationsAlarm")}, - #'CosNotification_Property'{name="event_name", - value=any:create(orber_tc:string(0), "lost_packet")}]))), - - - %% Accept "CommunicationsAlarm" events with priorities ranging from 1 to 5. - {ok,T2} = ?match({ok, _}, create_filter("$type_name == 'CommunicationsAlarm' and $priority >= 1 and $priority <= 5")), - ?match(true, eval(T2, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 2)}], - [], any:create(orber_tc:null(), null)))), - ?match(false, eval(T2, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 20)}], - [], any:create(orber_tc:null(), null)))), - - %% Select "MOVIE" events featuring at least 3 of the Marx Brothers. - {ok,T3} = ?match({ok, _}, create_filter("$type_name == 'MOVIE' and (('groucho' in $starlist) + ('chico' in $starlist) + ('harpo' in $starlist) + ('zeppo' in $starlist) + ('gummo' in $starlist)) > 2")), - ?match(true, eval(T3, ?not_CreateSE("DomainName","MOVIE", - "EventName", - [#'CosNotification_Property'{name="starlist", - value=any:create(orber_tc:sequence(orber_tc:string(0),0), - ["groucho", "harpo", "sam", "gummo"])}], - [], any:create(orber_tc:null(), null)))), - ?match(false, eval(T3, ?not_CreateSE("DomainName","MOVIE", - "EventName", - [#'CosNotification_Property'{name="starlist", - value=any:create(orber_tc:sequence(orber_tc:string(0),0), - ["frodo", "bilbo", "sam", "gummo"])}], - [], any:create(orber_tc:null(), null)))), - %% Accept students that took all 3 tests and had an average score of at least 80%. - {ok,T4} = ?match({ok, _}, create_filter("$test._length == 3 and ($test[0].score + $test[1].score + $test[2].score)/3 >=80")), - ?match(true, eval(T4, ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property'{name="test", - value=any:create(orber_tc:array(notify_test_data:tc(),0), - {#notify_test_data{score=75}, - #notify_test_data{score=80}, - #notify_test_data{score=85}})}], - any:create(orber_tc:null(), null)))), - ?match(false, eval(T4, ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property'{name="test", - value=any:create(orber_tc:array(notify_test_data:tc(),0), - {#notify_test_data{score=75}, - #notify_test_data{score=80}, - #notify_test_data{score=80}})}], - any:create(orber_tc:null(), null)))), - ?match(false, eval(T4, ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property'{name="test", - value=any:create(orber_tc:array(notify_test_data:tc(),0), - {#notify_test_data{score=75}, - #notify_test_data{score=85}})}], - any:create(orber_tc:null(), null)))), - %% Select processes that exceed a certain usage threshold. - {ok,T5} = ?match({ok, _}, create_filter("$memsize / 5.5 + $cputime * 1275.0 + $filesize * 1.25 > 500000.0")), - ?match(true, eval(T5, ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property'{name="memsize", - value=any:create(orber_tc:float(), 5.5)}, - #'CosNotification_Property'{name="cputime", - value=any:create(orber_tc:float(), 0.00078431137)}, - #'CosNotification_Property'{name="filesize", - value=any:create(orber_tc:float(), 500000)}], - any:create(orber_tc:null(), null)))), - ?match(false, eval(T5, ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property'{name="memsize", - value=any:create(orber_tc:float(), 5.5)}, - #'CosNotification_Property'{name="cputime", - value=any:create(orber_tc:float(), 0.00078431137)}, - #'CosNotification_Property'{name="filesize", - value=any:create(orber_tc:float(), 500)}], - any:create(orber_tc:null(), null)))), - ?match({error, _}, eval(T5, ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property'{name="memsize", - value=any:create(orber_tc:float(), 5.5)}, - #'CosNotification_Property'{name="filesize", - value=any:create(orber_tc:float(), 500)}], - any:create(orber_tc:null(), null)))), - - ?match(true, eval(T5, ?not_CreateSE("DomainName","TypeName", - "EventName", [], [], - any:create(orber_tc:sequence('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="memsize", - value=any:create(orber_tc:float(), 5.5)}, - #'CosNotification_Property'{name="cputime", - value=any:create(orber_tc:float(), 0.00078431137)}, - #'CosNotification_Property'{name="filesize", - value=any:create(orber_tc:float(), 500000)}])))), - ?match(false, eval(T5, ?not_CreateSE("DomainName","TypeName", - "EventName", [], [], - any:create(orber_tc:sequence('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="memsize", - value=any:create(orber_tc:float(), 5.5)}, - #'CosNotification_Property'{name="cputime", - value=any:create(orber_tc:float(), 0.00078431137)}, - #'CosNotification_Property'{name="filesize", - value=any:create(orber_tc:float(), 500)}])))), - ?match({error, _}, eval(T5, ?not_CreateSE("DomainName","TypeName", - "EventName", [], [], - any:create(orber_tc:sequence('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="memsize", - value=any:create(orber_tc:float(), 5.5)}, - #'CosNotification_Property'{name="filesize", - value=any:create(orber_tc:float(), 500)}])))), - - ?match(true, eval(T5, any:create(orber_tc:sequence('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="memsize", - value=any:create(orber_tc:float(), 5.5)}, - #'CosNotification_Property'{name="cputime", - value=any:create(orber_tc:float(), 0.00078431137)}, - #'CosNotification_Property'{name="filesize", - value=any:create(orber_tc:float(), 500000)}]))), - ?match(false, eval(T5, any:create(orber_tc:sequence('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="memsize", - value=any:create(orber_tc:float(), 5.5)}, - #'CosNotification_Property'{name="cputime", - value=any:create(orber_tc:float(), 0.00078431137)}, - #'CosNotification_Property'{name="filesize", - value=any:create(orber_tc:float(), 500)}]))), - ?match({error, _}, eval(T5, any:create(orber_tc:sequence('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="memsize", - value=any:create(orber_tc:float(), 5.5)}, - #'CosNotification_Property'{name="filesize", - value=any:create(orber_tc:float(), 500)}]))), - - %% Accept events where a threshold has the unscoped type name 'data'. - {ok,T6} = ?match({ok, _}, create_filter("exist $threshold._type_id and $threshold._type_id == 'data'")), - ?match(true, eval(T6, any:create(orber_tc:alias(notify_test_data:id(), - "threshold", - notify_test_data:tc()), - #notify_test_data{score = 10, name = "Erlang"}))), - - - - ?match(true, eval(T6, ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property' - {name="threshold", - value=any:create(notify_test_data:tc(), - #notify_test_data - {score = 10, - name = "Erlang"})}], - any:create(orber_tc:null(), null)))), - - - ?match(true, eval(T6, ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property' - {name="NotThreshold", - value=any:create(notify_test_data:tc(), - #notify_test_data - {score = 10, - name = "Erlang"})}], - any:create(orber_tc:alias(notify_test_data:id(), - "threshold", - notify_test_data:tc()), - #notify_test_data{score = 10, name = "Erlang"})))), - - - - %% Accept events with a serviceUser property of the correct standard type. - {ok,T7} = ?match({ok, _}, create_filter("$violation(TestData)._repos_id == 'IDL:notify_test/data:1.0'")), - ?match(true, eval(T7, ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property' - {name="violation", - value=any:create(orber_tc:array('CosNotification_Property':tc(),0), - [#'CosNotification_Property' - {name="TestData", - value=any:create(notify_test_data:tc(), - #notify_test_data - {score=100, - name="perfect score"})}])}], - any:create(orber_tc:null(), null)))), - - {ok,T8} = ?match({ok, _}, create_filter("$type_name == 'CommunicationsAlarm' and $event_name == 'lost_packet' and $priority < 2")), - %% All correct - Event1 = ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - %% Priority to high - Event2 = ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 2)}], - [], any:create(orber_tc:null(), null)), - %% Misspell event_name, i.e., lost_packets instead of lost_packet - Event3 = ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packets", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - %% Another type_name - Event4 = ?not_CreateSE("DomainName","TemperatureAlarm", - "lost_packets", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - - ?match(true, eval(T8, Event1)), - ?match(false, eval(T8, Event2)), - ?match(false, eval(T8, Event3)), - ?match(false, eval(T8, Event4)), - - {ok,T9} = ?match({ok, _}, create_filter("$gpa < 80 or $tests(midterm) > $tests(final) or $monthly_attendance[3] < 10")), - - %% midterm > final yields true, the others false - Event5 = ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property' - {name="tests", - value=any:create(orber_tc:array('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="midterm", - value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property'{name="final", - value=any:create(orber_tc:short(), 60)}])}, - #'CosNotification_Property'{name="monthly_attendance", - value=any:create(orber_tc:array(orber_tc:short(), 0), - {0,1,2,10})}, - #'CosNotification_Property'{name="gpa", - value=any:create(orber_tc:short(), 90)}], - any:create(orber_tc:null(), null)), - - %% monthly_attendance[3] < 10 yields true, the others false - Event6 = ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property'{name="tests", - value=any:create(orber_tc:array('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="midterm", - value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property'{name="final", - value=any:create(orber_tc:short(), 80)}])}, - #'CosNotification_Property'{name="monthly_attendance", - value=any:create(orber_tc:array(orber_tc:short(), 0), - {0,1,2,9})}, - #'CosNotification_Property'{name="gpa", - value=any:create(orber_tc:short(), 90)}], - any:create(orber_tc:null(), null)), - - %% gpa < 80 true, rest false. - Event7 = ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property'{name="tests", - value=any:create(orber_tc:array('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="midterm", - value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property'{name="final", - value=any:create(orber_tc:short(), 80)}])}, - #'CosNotification_Property'{name="monthly_attendance", - value=any:create(orber_tc:array(orber_tc:short(), 0), - {0,1,2,10})}, - #'CosNotification_Property'{name="gpa", - value=any:create(orber_tc:short(), 70)}], - any:create(orber_tc:null(), null)), - - %% All false - Event8 = ?not_CreateSE("DomainName","TypeName", - "EventName", [], - [#'CosNotification_Property'{name="tests", - value=any:create(orber_tc:array('CosNotification_Property':tc(),0), - [#'CosNotification_Property'{name="midterm", - value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property'{name="final", - value=any:create(orber_tc:short(), 80)}])}, - #'CosNotification_Property'{name="monthly_attendance", - value=any:create(orber_tc:array(orber_tc:short(), 0), - {0,1,2,10})}, - #'CosNotification_Property'{name="gpa", - value=any:create(orber_tc:short(), 80)}], - any:create(orber_tc:null(), null)), - - ?match(true, eval(T9, Event5)), - ?match(true, eval(T9, Event6)), - ?match(true, eval(T9, Event7)), - ?match(false, eval(T9, Event8)), - ok. - -%%----------------------------------------------------------------- -%% Misc grammar tests -%%----------------------------------------------------------------- -positional_api(_Config) -> - {ok,T1} = ?match({ok, _}, create_filter("$.3 < 80 or $.1(midterm) > $.1(final) or $.2[3] < 10")), - - %% midterm > final yields true, the others false - Event1 = any:create(notify_test_studies:tc(), #notify_test_studies - {gpa = 90, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 60)}], - monthly_attendance = {0,1,2,10}}), - %% monthly_attendance[3] < 10 yields true, the others false - Event2 = any:create(notify_test_studies:tc(), #notify_test_studies - {gpa = 90, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 80)}], - monthly_attendance = {0,1,2,9}}), - %% gpa < 80 true, rest false. - Event3 = any:create(notify_test_studies:tc(), #notify_test_studies - {gpa = 70, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 80)}], - monthly_attendance = {0,1,2,10}}), - %% All false - Event4 = any:create(notify_test_studies:tc(), #notify_test_studies - {gpa = 80, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 80)}], - monthly_attendance = {0,1,2,10}}), - - ?match(true, eval(T1, Event1)), - ?match(true, eval(T1, Event2)), - ?match(true, eval(T1, Event3)), - ?match(false, eval(T1, Event4)), - - {ok,T2} = ?match({ok, _}, create_filter("$.0.0.0.1 == 'CommunicationsAlarm'")), - - Event5 = ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", [], [], - any:create(orber_tc:null(), null)), - - ?match(true, eval(T2, Event5)), - - ok. - -%%----------------------------------------------------------------- -%% Components grammar tests -%%----------------------------------------------------------------- -components_api(_Config) -> - {ok,T1} = ?match({ok, _}, create_filter("$ == 2")), - ?match(true, eval(T1, ?not_CreateSE("DomainName","TypeName","EventName", - [],[], any:create(orber_tc:short(), 2)))), - ?match(true, eval(T1, any:create(orber_tc:short(), 2))), - ?match(false, eval(T1, ?not_CreateSE("DomainName","TypeName","EventName", - [],[], any:create(orber_tc:short(), 3)))), - ?match(false, eval(T1, any:create(orber_tc:short(), 3))), - - %% Select "MOVIE" events featuring at least 3 of the Marx Brothers. - {ok,T2} = ?match({ok, _}, create_filter("$type_name == 'MOVIE' and (('groucho' in $.starlist) + ('chico' in $.starlist) + ('harpo' in $.starlist) + ('zeppo' in $.starlist) + ('gummo' in $.starlist)) > 2")), - ?match(true, eval(T2, ?not_CreateSE("DomainName","MOVIE", "EventName", [], [], - any:create(orber_tc:alias("IFRId","starlist",tk_any), - any:create(orber_tc:sequence(orber_tc:string(0),0), - ["groucho", "harpo", "sam", "gummo"]))))), - ?match(false, eval(T2, ?not_CreateSE("DomainName","MOVIE", "EventName", [], [], - any:create(orber_tc:alias("IFRId","starlist",tk_any), - any:create(orber_tc:sequence(orber_tc:string(0),0), - ["frodo", "bilbo", "sam", "gummo"]))))), - - %% Accept only recent events (e.g., generated within the last 15 minutes or so). - {ok,_T3} = ?match({ok, _}, create_filter("$origination_timestamp.high + 2 < $curtime.high")), - - - %% Accept students that took all 3 tests and had an average score of at least 80%. - {ok,T4} = ?match({ok, _}, create_filter("$.test._length == 3 and ($.test[0].score + $.test[1].score + $.test[2].score)/3 >=80")), - ?match(true, eval(T4, ?not_CreateSE("DomainName","TypeName", "EventName", [], [], - any:create(orber_tc:alias("IFRId","test",tk_any), - any:create(orber_tc:array(notify_test_data:tc(),0), - {#notify_test_data{score=75}, - #notify_test_data{score=80}, - #notify_test_data{score=85}}))))), - ?match(false, eval(T4, ?not_CreateSE("DomainName","TypeName", "EventName", [], [], - any:create(orber_tc:alias("IFRId","test",tk_any), - any:create(orber_tc:array(notify_test_data:tc(),0), - {#notify_test_data{score=75}, - #notify_test_data{score=80}, - #notify_test_data{score=80}}))))), - ?match(false, eval(T4, ?not_CreateSE("DomainName","TypeName", "EventName", [], [], - any:create(orber_tc:alias("IFRId","test",tk_any), - any:create(orber_tc:array(notify_test_data:tc(),0), - {#notify_test_data{score=75}, - #notify_test_data{score=80}}))))), - - %% Select processes that exceed a certain usage threshold. - {ok,T5} = ?match({ok, _}, create_filter("$.memsize / 5.5 + $.cputime * 1275.0 + $.filesize * 1.25 > 500000.0")), - ?match(true, eval(T5, ?not_CreateSE("DomainName","TypeName", "EventName", [], [], - any:create(notify_test_computer:tc(), - #notify_test_computer - {memsize=5.5, - cputime = 0.00078431137, - filesize = 500000})))), - ?match(false, eval(T5, ?not_CreateSE("DomainName","TypeName", "EventName", [], [], - any:create(notify_test_computer:tc(), - #notify_test_computer - {memsize=5.5, - cputime = 0.00078431137, - filesize = 500})))), - ?match({error,_}, eval(T5, ?not_CreateSE("DomainName","TypeName", "EventName", [], [], - any:create(notify_test_computer:tc(), - #notify_test_computer - {memsize=5.5, - cputime = 0.00078431137})))), - - %% Accept only Notification Service structured events. - {ok,T6} = ?match({ok, _}, create_filter("$._repos_id == 'IDL:omg.org/CosNotification/StructuredEvent:1.0'")), - ?match(true, eval(T6, ?not_CreateSE("DomainName","CommunicationsAlarm", - "EventName", - [], [], any:create(orber_tc:null(), null)))), - - - - %% Accept only those events that have a specified security "rights list". - {ok,T7} = ?match({ok, _}, create_filter("exist $.header.variable_header(required_rights)")), - ?match(false, eval(T7, ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)))), - ?match(true, eval(T7, ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", - [#'CosNotification_Property'{name="required_rights", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)))), - - - {ok,T8} = ?match({ok, _}, create_filter("$.header.fixed_header.event_type.type_name == 'CommunicationsAlarm' and $.header.fixed_header.event_name == 'lost_packet' and $.header.variable_header(priority) < 2")), - %% All correct - Event1 = ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - %% Priority to high - Event2 = ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 2)}], - [], any:create(orber_tc:null(), null)), - %% Misspell event_name, i.e., lost_packets instead of lost_packet - Event3 = ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packets", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - %% Another type_name - Event4 = ?not_CreateSE("DomainName","TemperatureAlarm", - "lost_packets", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - - ?match(true, eval(T8, Event1)), - ?match(false, eval(T8, Event2)), - ?match(false, eval(T8, Event3)), - ?match(false, eval(T8, Event4)), - - - {ok,T9} = ?match({ok, _}, create_filter("$.gpa < 80 or $.tests(midterm) > $.tests(final) or $.monthly_attendance[3] < 10")), - - %% midterm > final yields true, the others false - Event5 = ?not_CreateSE("DomainName","TypeName", - "EventName", [], [], - any:create(notify_test_studies:tc(), #notify_test_studies - {gpa = 90, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 60)}], - monthly_attendance = {0,1,2,10}})), - %% monthly_attendance[3] < 10 yields true, the others false - Event6 = ?not_CreateSE("DomainName","TypeName", - "EventName", [], [], - any:create(notify_test_studies:tc(), #notify_test_studies - {gpa = 90, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 80)}], - monthly_attendance = {0,1,2,9}})), - %% gpa < 80 true, rest false. - Event7 = ?not_CreateSE("DomainName","TypeName", - "EventName", [], [], - any:create(notify_test_studies:tc(), #notify_test_studies - {gpa = 70, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 80)}], - monthly_attendance = {0,1,2,10}})), - %% All false - Event8 = ?not_CreateSE("DomainName","TypeName", - "EventName", [], [], - any:create(notify_test_studies:tc(), #notify_test_studies - {gpa = 80, - tests = [#'CosNotification_Property' - {name="midterm", value=any:create(orber_tc:short(), 70)}, - #'CosNotification_Property' - {name="final", value=any:create(orber_tc:short(), 80)}], - monthly_attendance = {0,1,2,10}})), - - ?match(true, eval(T9, Event5)), - ?match(true, eval(T9, Event6)), - ?match(true, eval(T9, Event7)), - ?match(false, eval(T9, Event8)), - ok. - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- - -%%-------------------- End of Module ------------------------------ diff --git a/lib/cosNotification/test/notification_SUITE.erl b/lib/cosNotification/test/notification_SUITE.erl deleted file mode 100644 index 624a76c64a..0000000000 --- a/lib/cosNotification/test/notification_SUITE.erl +++ /dev/null @@ -1,2163 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%-------------------------------------------------------------------- -%% File : notification_SUITE.erl -%% Purpose : -%%-------------------------------------------------------------------- - --module(notification_SUITE). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% cosEvent files. --include_lib("cosEvent/include/CosEventChannelAdmin.hrl"). -%% Application files --include_lib("cosNotification/include/CosNotification.hrl"). --include_lib("cosNotification/include/CosNotifyChannelAdmin.hrl"). --include_lib("cosNotification/include/CosNotifyComm.hrl"). --include_lib("cosNotification/include/CosNotifyFilter.hrl"). - --include_lib("cosNotification/src/CosNotification_Definitions.hrl"). - --include("idl_output/notify_test.hrl"). - --include_lib("common_test/include/ct.hrl"). - -%%--------------- DEFINES ------------------------------------ --define(default_timeout, test_server:minutes(20)). --define(match(ExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - io:format("------ CORRECT RESULT ------~n~p~n", - [AcTuAlReS]), - AcTuAlReS; - _ -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS) - end - end()). - --define(defaultQoS, - [#'CosNotification_Property'{name='CosNotification':'MaximumBatchSize'(), - value=any:create(orber_tc:long(), 100)}, - #'CosNotification_Property'{name='CosNotification':'PacingInterval'(), - value=any:create(orber_tc:unsigned_long_long(), - 20000000)}, - #'CosNotification_Property'{name='CosNotification':'OrderPolicy'(), - value=any:create(orber_tc:short(), - 'CosNotification':'AnyOrder'())}, - #'CosNotification_Property'{name='CosNotification':'EventReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'BestEffort'())}, - #'CosNotification_Property'{name='CosNotification':'ConnectionReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'BestEffort'())}, - #'CosNotification_Property'{name='CosNotification':'DiscardPolicy'(), - value=any:create(orber_tc:short(), - 'CosNotification':'AnyOrder'())}, - #'CosNotification_Property'{name='CosNotification':'StartTimeSupported'(), - value=any:create(orber_tc:boolean(), false)}, - #'CosNotification_Property'{name='CosNotification':'StopTimeSupported'(), - value=any:create(orber_tc:boolean(), false)}, - #'CosNotification_Property'{name='CosNotification':'Priority'(), - value=any:create(orber_tc:short(), - 'CosNotification':'DefaultPriority'())}]). --define(defaultQoS2, - [#'CosNotification_Property'{name='CosNotification':'MaximumBatchSize'(), - value=any:create(orber_tc:long(), 1)}, - #'CosNotification_Property'{name='CosNotification':'PacingInterval'(), - value=any:create(orber_tc:unsigned_long_long(), - 0)}, - #'CosNotification_Property'{name='CosNotification':'OrderPolicy'(), - value=any:create(orber_tc:short(), - 'CosNotification':'AnyOrder'())}, - #'CosNotification_Property'{name='CosNotification':'EventReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'BestEffort'())}, - #'CosNotification_Property'{name='CosNotification':'ConnectionReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'BestEffort'())}, - #'CosNotification_Property'{name='CosNotification':'DiscardPolicy'(), - value=any:create(orber_tc:short(), - 'CosNotification':'AnyOrder'())}, - #'CosNotification_Property'{name='CosNotification':'StartTimeSupported'(), - value=any:create(orber_tc:boolean(), false)}, - #'CosNotification_Property'{name='CosNotification':'StopTimeSupported'(), - value=any:create(orber_tc:boolean(), false)}, - #'CosNotification_Property'{name='CosNotification':'Priority'(), - value=any:create(orber_tc:short(), - 'CosNotification':'DefaultPriority'())}]). --define(defaultAdm, - [#'CosNotification_Property'{name='CosNotification':'MaxQueueLength'(), - value=any:create(orber_tc:long(), 100)}, - #'CosNotification_Property'{name='CosNotification':'MaxConsumers'(), - value=any:create(orber_tc:long(), 100)}, - #'CosNotification_Property'{name='CosNotification':'MaxSuppliers'(), - value=any:create(orber_tc:long(), 100)}]). - --define(FAC_OPT, []). - - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0, - init_per_suite/1, end_per_suite/1, qos_api/1, adm_api/1, - cosevent_api/1, filter_adm_api/1, events_api/1, events2_api/1, - event_qos_api/1, filter_api/1, mapping_filter_api/1, subscription_api/1, - init_per_testcase/2, end_per_testcase/2, persistent_max_events_api/1, - persistent_timeout_events_api/1, persistent_recover_events_api/1, - app_test/1]). - --export([terminated/1]). - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - cases(). - -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - -cases() -> - [persistent_max_events_api, - persistent_timeout_events_api, - persistent_recover_events_api, mapping_filter_api, - filter_api, filter_adm_api, event_qos_api, qos_api, - adm_api, cosevent_api, subscription_api, events_api, - events2_api, app_test]. - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- -init_per_testcase(_Case, Config) -> - Path = code:which(?MODULE), - code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Case, Config) -> - Path = code:which(?MODULE), - code:del_path(filename:join(filename:dirname(Path), "idl_output")), - Dog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -init_per_suite(Config) -> - Path = code:which(?MODULE), - code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), - ok = corba:orb_init([{flags, 16#02}, {orber_debug_level, 10}]), - orber:jump_start(), - cosNotificationApp:install_event(), - cosNotificationApp:install(), - 'oe_notify_test_server':'oe_register'(), - cosNotificationApp:start(), - if - is_list(Config) -> - Config; - true -> - exit("Config not a list") - end. - -end_per_suite(Config) -> - cosNotificationApp:stop(), - Path = code:which(?MODULE), - code:del_path(filename:join(filename:dirname(Path), "idl_output")), - 'oe_notify_test_server':'oe_unregister'(), - cosNotificationApp:uninstall(), - cosNotificationApp:uninstall_event(), - orber:jump_stop(), - Config. - - -%%----------------------------------------------------------------- -%% Tests app file -%%----------------------------------------------------------------- -app_test(_Config) -> - ok=test_server:app_test(cosNotification), - ok. - - -%%----------------------------------------------------------------- -%% Persistent events max limit -%%----------------------------------------------------------------- -persistent_max_events_api(_Config) -> - QoSPersistent = - [#'CosNotification_Property'{name='CosNotification':'ConnectionReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'Persistent'())}], - QoSEventPersistent = - [#'CosNotification_Property'{name='CosNotification':'EventReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'Persistent'())}], - application:set_env(cosNotification, notify, ?MODULE), - application:set_env(cosNotification, max_events, 2), - application:set_env(cosNotification, timeout_events, 300000), - application:set_env(cosNotification, interval_events, 10000), - %% Initialize the application. - Fac = (catch cosNotificationApp:start_global_factory(?FAC_OPT)), - ?match({_,key,_,_,_,_}, Fac), - {Ch, _Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS2, ?defaultAdm)), - ?match({_,key,_,_,_,_}, Ch), - - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSEventPersistent)), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSPersistent)), - - %% Create the Admin objects - {AdminSupplier, _ASID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_suppliers(Ch,'AND_OP')), - {AdminConsumer, _ACID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_consumers(Ch,'AND_OP')), - - %% Create Proxies and clients - {SequenceProxyPushSupplier,_ID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_push_supplier(AdminConsumer, 'SEQUENCE_EVENT')), - PushSeqC=?match({_,key,_,_,_,_}, 'notify_test_SeqPushC':oe_create(['PUSH_SEQUENCE',SequenceProxyPushSupplier], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':connect_sequence_push_consumer(SequenceProxyPushSupplier, PushSeqC)), - - {SequenceProxyPushConsumer,_ID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_push_consumer(AdminSupplier, 'SEQUENCE_EVENT')), - PushSeqS=?match({_,key,_,_,_,_}, 'notify_test_SeqPushS':oe_create(['PUSH_SEQUENCE',SequenceProxyPushConsumer], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':connect_sequence_push_supplier(SequenceProxyPushConsumer, PushSeqS)), - - %% Create a couple of Events to test with. - Event = ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - - ?match(ok, 'notify_test_SeqPushC':doAction(PushSeqC, {action, action})), - - %% Push and check the state. - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushConsumer':push_structured_events(SequenceProxyPushConsumer, [Event])), - ?match([], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - ?match(false, corba_object:non_existent(SequenceProxyPushSupplier)), - - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushConsumer':push_structured_events(SequenceProxyPushConsumer, [Event])), - ?match([], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - ?match(false, corba_object:non_existent(SequenceProxyPushSupplier)), - %% Now we've reached the limit. This call will terminate the proxy. - %% We cannot check for data at this point since the broken connection - %% will result in that the client terminates. - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushConsumer':push_structured_events(SequenceProxyPushConsumer, [Event])), - timer:sleep(5000), - ?match(true, corba_object:non_existent(SequenceProxyPushSupplier)), - ?match(true, corba_object:non_existent(PushSeqC)), - - - catch corba:dispose(SequenceProxyPushConsumer), - catch corba:dispose(SequenceProxyPushSupplier), - catch corba:dispose(AdminConsumer), - catch corba:dispose(AdminSupplier), - catch corba:dispose(Ch), - catch cosNotificationApp:stop_factory(Fac), - catch corba:dispose(PushSeqS), - catch corba:dispose(PushSeqC), - application:set_env(cosNotification, notify, undefined), - application:set_env(cosNotification, max_events, undefined), - application:set_env(cosNotification, timeout_events, undefined), - application:set_env(cosNotification, interval_events, undefined), - ok. - -terminated(Items) -> - io:format("Proxy terminated due to: ~p~n", [Items]). - -%%----------------------------------------------------------------- -%% Persistent events timeout -%%----------------------------------------------------------------- -persistent_timeout_events_api(_Config) -> - QoSPersistent = - [#'CosNotification_Property'{name='CosNotification':'ConnectionReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'Persistent'())}], - QoSEventPersistent = - [#'CosNotification_Property'{name='CosNotification':'EventReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'Persistent'())}], - application:set_env(cosNotification, notify, ?MODULE), - application:set_env(cosNotification, max_events, 1000), - application:set_env(cosNotification, timeout_events, 4000), - application:set_env(cosNotification, interval_events, 1000), - %% Initialize the application. - Fac = (catch cosNotificationApp:start_global_factory(?FAC_OPT)), - ?match({_,key,_,_,_,_}, Fac), - {Ch, _Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS2, ?defaultAdm)), - ?match({_,key,_,_,_,_}, Ch), - - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSEventPersistent)), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSPersistent)), - - %% Create the Admin objects - {AdminSupplier, _ASID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_suppliers(Ch,'AND_OP')), - {AdminConsumer, _ACID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_consumers(Ch,'AND_OP')), - - %% Create Proxies and clients - {SequenceProxyPushSupplier,_ID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_push_supplier(AdminConsumer, 'SEQUENCE_EVENT')), - PushSeqC=?match({_,key,_,_,_,_}, 'notify_test_SeqPushC':oe_create(['PUSH_SEQUENCE',SequenceProxyPushSupplier], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':connect_sequence_push_consumer(SequenceProxyPushSupplier, PushSeqC)), - - {SequenceProxyPushConsumer,_ID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_push_consumer(AdminSupplier, 'SEQUENCE_EVENT')), - PushSeqS=?match({_,key,_,_,_,_}, 'notify_test_SeqPushS':oe_create(['PUSH_SEQUENCE',SequenceProxyPushConsumer], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':connect_sequence_push_supplier(SequenceProxyPushConsumer, PushSeqS)), - - %% Create a couple of Events to test with. - Event = ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - - ?match(ok, 'notify_test_SeqPushC':doAction(PushSeqC, {action, action})), - - %% Push and check the state. - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushConsumer':push_structured_events(SequenceProxyPushConsumer, [Event])), - ?match([], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - ?match(false, corba_object:non_existent(SequenceProxyPushSupplier)), - - %% Now we've reached the limit. This call will terminate the proxy. - %% We cannot check for data at this point since the broken connection - %% will result in that the client terminates. - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushConsumer':push_structured_events(SequenceProxyPushConsumer, [Event])), - timer:sleep(10000), - ?match(true, corba_object:non_existent(SequenceProxyPushSupplier)), - ?match(true, corba_object:non_existent(PushSeqC)), - - - catch corba:dispose(SequenceProxyPushConsumer), - catch corba:dispose(SequenceProxyPushSupplier), - catch corba:dispose(AdminConsumer), - catch corba:dispose(AdminSupplier), - catch corba:dispose(Ch), - catch cosNotificationApp:stop_factory(Fac), - catch corba:dispose(PushSeqS), - catch corba:dispose(PushSeqC), - application:set_env(cosNotification, notify, undefined), - application:set_env(cosNotification, max_events, undefined), - application:set_env(cosNotification, timeout_events, undefined), - application:set_env(cosNotification, interval_events, undefined), - ok. - -%%----------------------------------------------------------------- -%% Persistent events max limit -%%----------------------------------------------------------------- -persistent_recover_events_api(_Config) -> - QoSPersistent = - [#'CosNotification_Property'{name='CosNotification':'ConnectionReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'Persistent'())}], - QoSEventPersistent = - [#'CosNotification_Property'{name='CosNotification':'EventReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'Persistent'())}], - application:set_env(cosNotification, notify, ?MODULE), - application:set_env(cosNotification, max_events, 1000), - application:set_env(cosNotification, timeout_events, 100000), - application:set_env(cosNotification, interval_events, 1000), - %% Initialize the application. - Fac = (catch cosNotificationApp:start_global_factory(?FAC_OPT)), - ?match({_,key,_,_,_,_}, Fac), - {Ch, _Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS2, ?defaultAdm)), - ?match({_,key,_,_,_,_}, Ch), - - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSEventPersistent)), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSPersistent)), - - %% Create the Admin objects - {AdminSupplier, _ASID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_suppliers(Ch,'AND_OP')), - {AdminConsumer, _ACID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_consumers(Ch,'AND_OP')), - - %% Create Proxies and clients - {SequenceProxyPushSupplier,_ID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_push_supplier(AdminConsumer, 'SEQUENCE_EVENT')), - PushSeqC=?match({_,key,_,_,_,_}, 'notify_test_SeqPushC':oe_create(['PUSH_SEQUENCE',SequenceProxyPushSupplier], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':connect_sequence_push_consumer(SequenceProxyPushSupplier, PushSeqC)), - - {SequenceProxyPushConsumer,_ID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_push_consumer(AdminSupplier, 'SEQUENCE_EVENT')), - PushSeqS=?match({_,key,_,_,_,_}, 'notify_test_SeqPushS':oe_create(['PUSH_SEQUENCE',SequenceProxyPushConsumer], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':connect_sequence_push_supplier(SequenceProxyPushConsumer, PushSeqS)), - - %% Create a couple of Events to test with. - Event = ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - - ?match(ok, 'notify_test_SeqPushC':doAction(PushSeqC, {action, action})), - - %% Push and check the state. - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushConsumer':push_structured_events(SequenceProxyPushConsumer, [Event])), - ?match([], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - ?match(false, corba_object:non_existent(SequenceProxyPushSupplier)), - %% Allow the proxy to try a few times and then change the client behavior - timer:sleep(4000), - ?match(ok, 'notify_test_SeqPushC':doAction(PushSeqC, {action, undefined})), - %% Wait some time so that the proxy timeout has kicked in. - timer:sleep(4000), - - %% Now the communication should work again. - ?match([Event], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - ?match(false, corba_object:non_existent(SequenceProxyPushSupplier)), - - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushConsumer':push_structured_events(SequenceProxyPushConsumer, [Event])), - timer:sleep(4000), - ?match([Event], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - catch corba:dispose(SequenceProxyPushConsumer), - catch corba:dispose(SequenceProxyPushSupplier), - catch corba:dispose(AdminConsumer), - catch corba:dispose(AdminSupplier), - catch corba:dispose(Ch), - catch cosNotificationApp:stop_factory(Fac), - catch corba:dispose(PushSeqS), - catch corba:dispose(PushSeqC), - application:set_env(cosNotification, notify, undefined), - application:set_env(cosNotification, max_events, undefined), - application:set_env(cosNotification, timeout_events, undefined), - application:set_env(cosNotification, interval_events, undefined), - ok. - - -%%----------------------------------------------------------------- -%% CosNotifyFilter::Filter API tests -%%----------------------------------------------------------------- -mapping_filter_api(_Config) -> - FiFac = 'CosNotifyFilter_FilterFactory':oe_create(), - ?match({_,key,_,_,_,_}, FiFac), - - Filter = 'CosNotifyFilter_FilterFactory':create_mapping_filter(FiFac, - "EXTENDED_TCL", - any:create(orber_tc:short(), 10)), - ?match({_,key,_,_,_,_}, Filter), - - ?match("EXTENDED_TCL", 'CosNotifyFilter_MappingFilter':'_get_constraint_grammar'(Filter)), - - %% Test before we add any constarints. - ?match([], 'CosNotifyFilter_MappingFilter':get_all_mapping_constraints(Filter)), - ?match({'EXCEPTION', {'CosNotifyFilter_ConstraintNotFound', _, 1}}, - 'CosNotifyFilter_MappingFilter':get_mapping_constraints(Filter, [1])), - ?match(ok, 'CosNotifyFilter_MappingFilter':remove_all_mapping_constraints(Filter)), - - %% Try adding an incorrect constraint_expr - ?match({'EXCEPTION',{'CosNotifyFilter_InvalidConstraint',_,_}}, - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(Filter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "name", - type_name = "type"}], - constraint_expr = "2==2 and 3<"}, - result_to_set = any:create(orber_tc:short(), 10)}])), - %% Try adding two correct constraint_expr - [{_,_,CID1,_},{_,_,CID2,_}]= - ?match([{'CosNotifyFilter_MappingConstraintInfo',_,_,_}, {'CosNotifyFilter_MappingConstraintInfo',_,_,_}], - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(Filter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "name", - type_name = "type"}], - constraint_expr = "2==2 and 3<4"}, - result_to_set = any:create(orber_tc:short(), 10)}, - #'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "name2", - type_name = "type2"}], - constraint_expr = "$.test._length == 3 and ($.test[0].score + $.test[1].score + $.test[2].score)/3 >=80"}, - result_to_set = any:create(orber_tc:short(), 10)}])), - - ?match([{'CosNotifyFilter_MappingConstraintInfo',_,CID2,_}, {'CosNotifyFilter_MappingConstraintInfo',_,CID1,_}], - 'CosNotifyFilter_MappingFilter':get_all_mapping_constraints(Filter)), - ?match([{'CosNotifyFilter_MappingConstraintInfo',_,CID1,_}], - 'CosNotifyFilter_MappingFilter':get_mapping_constraints(Filter, [CID1])), - ?match(ok, 'CosNotifyFilter_MappingFilter':remove_all_mapping_constraints(Filter)), - ?match([], 'CosNotifyFilter_MappingFilter':get_all_mapping_constraints(Filter)), - - %% Try adding a constraint_expr with using invalid value, i.e., not short. - ?match({'EXCEPTION',{'CosNotifyFilter_InvalidValue',_,_,_}}, - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(Filter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "name", - type_name = "type"}], - constraint_expr = "2==2 and 3<8"}, - result_to_set = any:create(orber_tc:long(), 10)}])), - - %% Try adding one correct and one incorrect constraint_expr - ?match({'EXCEPTION',{'CosNotifyFilter_InvalidConstraint',_,_}}, - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(Filter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "name", - type_name = "type"}], - constraint_expr = "2==2 and 3<"}, - result_to_set = any:create(orber_tc:short(), 10)}, - #'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "name2", - type_name = "type2"}], - constraint_expr = "$.test._length == 3 and ($.test[0].score + $.test[1].score + $.test[2].score)/3 >=80"}, - result_to_set = any:create(orber_tc:short(), 10)}])), - - %% Following testcases test different domain_name and type_name, e.g., - %% wildcards etc. - [{_,ConInfoData,CID3,_}] = - ?match([{'CosNotifyFilter_MappingConstraintInfo',_,_,_}], - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(Filter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "domain", - type_name = ""}, - #'CosNotification_EventType' - {domain_name = "*", - type_name = "type"}], - constraint_expr = "2==2 and 3<4"}, - result_to_set = any:create(orber_tc:short(), 10)}])), - - %% Try removing a constraint - ?match(ok, 'CosNotifyFilter_MappingFilter':modify_mapping_constraints(Filter,[CID3],[])), - ?match([], 'CosNotifyFilter_MappingFilter':get_all_mapping_constraints(Filter)), - - %% Add e new constraint - [{_,_,CID4,_}] = - ?match([{'CosNotifyFilter_MappingConstraintInfo',_,_,_}], - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(Filter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "domain1", - type_name = ""}, - #'CosNotification_EventType' - {domain_name = "domain2", - type_name = "*"}], - constraint_expr = "2==2 and 3<4"}, - result_to_set = any:create(orber_tc:short(), 10)}])), - - %% Try to update the constraint associated with CID4 to equal CID3. - ?match(ok, 'CosNotifyFilter_MappingFilter':modify_mapping_constraints(Filter,[], - [#'CosNotifyFilter_MappingConstraintInfo' - {constraint_expression= - #'CosNotifyFilter_ConstraintExp' - {event_types =[#'CosNotification_EventType' - {domain_name = "domain", - type_name = ""}, - #'CosNotification_EventType' - {domain_name = "*", - type_name = "type"}], - constraint_expr = "2==2 and 3<4"}, - constraint_id=CID4, - value = any:create(orber_tc:short(), 10)}])), - - ?match([{_,ConInfoData,CID4,_}], 'CosNotifyFilter_MappingFilter':get_all_mapping_constraints(Filter)), - - ?match({'EXCEPTION', {'CosNotifyFilter_ConstraintNotFound', _, CID3}}, - 'CosNotifyFilter_MappingFilter':get_mapping_constraints(Filter, [CID3])), - ?match(ok, 'CosNotifyFilter_MappingFilter':remove_all_mapping_constraints(Filter)), - ?match([], 'CosNotifyFilter_MappingFilter':get_all_mapping_constraints(Filter)), - - ?match([{'CosNotifyFilter_MappingConstraintInfo',_,_,_}], - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(Filter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "", - type_name = "type1"}, - #'CosNotification_EventType' - {domain_name = "*", - type_name = "type2"}], - constraint_expr = "2==2 and 3<4"}, - result_to_set = any:create(orber_tc:short(), 10)}])), - - ?match([{'CosNotifyFilter_MappingConstraintInfo',_,_,_}], - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(Filter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "domain1", - type_name = "type1"}, - #'CosNotification_EventType' - {domain_name = "domain2", - type_name = "type2"}], - constraint_expr = "2==2 and 3<4"}, - result_to_set = any:create(orber_tc:short(), 10)}])), - - ?match([{'CosNotifyFilter_MappingConstraintInfo',_,_,_}], - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(Filter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "dom*", - type_name = "type1"}, - #'CosNotification_EventType' - {domain_name = "domain2", - type_name = "typ*"}], - constraint_expr = "2==2 and 3<4"}, - result_to_set = any:create(orber_tc:short(), 10)}])), - - ?match([{'CosNotifyFilter_MappingConstraintInfo',_,_,_}], - 'CosNotifyFilter_MappingFilter':add_mapping_constraints(Filter, - [#'CosNotifyFilter_MappingConstraintPair' - {constraint_expression = #'CosNotifyFilter_ConstraintExp' - {event_types = [#'CosNotification_EventType' - {domain_name = "dom*1", - type_name = "type1"}, - #'CosNotification_EventType' - {domain_name = "domain2", - type_name = "typ*2"}], - constraint_expr = "2==2 and 3<4"}, - result_to_set = any:create(orber_tc:short(), 10)}])), - - catch corba:dispose(FiFac), - catch corba:dispose(Filter), - ok. - - -%%----------------------------------------------------------------- -%% CosNotifyFilter::Filter API tests -%%----------------------------------------------------------------- -filter_api(_Config) -> - Fac = cosNotificationApp:start_global_factory(?FAC_OPT), - ?match({_,key,_,_,_,_}, Fac), - {Ch, _Id1} = 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS, ?defaultAdm), - AC= 'CosNotifyChannelAdmin_EventChannel':for_consumers(Ch), - - FiFac = 'CosNotifyFilter_FilterFactory':oe_create(), - ?match({_,key,_,_,_,_}, FiFac), - - Filter = 'CosNotifyFilter_FilterFactory':create_filter(FiFac,"EXTENDED_TCL"), - ?match({_,key,_,_,_,_}, Filter), - - ?match("EXTENDED_TCL", 'CosNotifyFilter_Filter':'_get_constraint_grammar'(Filter)), - - %% Test Callback management. - ?match({'EXCEPTION',{'BAD_PARAM',_,_,_}}, - 'CosNotifyFilter_Filter':attach_callback(Filter, Ch)), - ?match([], 'CosNotifyFilter_Filter':get_callbacks(Filter)), - ?match({'EXCEPTION',{'CosNotifyFilter_CallbackNotFound',_}}, - 'CosNotifyFilter_Filter':detach_callback(Filter, 0)), - ID='CosNotifyFilter_Filter':attach_callback(Filter, AC), - ?match([ID], 'CosNotifyFilter_Filter':get_callbacks(Filter)), - ?match(ok, 'CosNotifyFilter_Filter':detach_callback(Filter, ID)), - ?match([], 'CosNotifyFilter_Filter':get_callbacks(Filter)), - - %% This callback is just attached so we can test that we can call notify_subscribe. - _ID2='CosNotifyFilter_Filter':attach_callback(Filter, AC), - - %% Test before we add any constarints. - ?match([], 'CosNotifyFilter_Filter':get_all_constraints(Filter)), - ?match({'EXCEPTION', {'CosNotifyFilter_ConstraintNotFound', _, 1}}, - 'CosNotifyFilter_Filter':get_constraints(Filter, [1])), - ?match(ok, 'CosNotifyFilter_Filter':remove_all_constraints(Filter)), - - %% Try adding an incorrect constraint_expr - ?match({'EXCEPTION',{'CosNotifyFilter_InvalidConstraint',_,_}}, - 'CosNotifyFilter_Filter':add_constraints(Filter, - [#'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "name", - type_name = "type"}], - constraint_expr = "2==2 and 3<"}])), - %% Try adding two correct constraint_expr - [{_,_,CID1},{_,_,CID2}]= - ?match([{'CosNotifyFilter_ConstraintInfo',_,_}, {'CosNotifyFilter_ConstraintInfo',_,_}], - 'CosNotifyFilter_Filter':add_constraints(Filter, - [#'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "name", - type_name = "type"}], - constraint_expr = "2==2 and 3<4"}, - #'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "name2", - type_name = "type2"}], - constraint_expr = "$.test._length == 3 and ($.test[0].score + $.test[1].score + $.test[2].score)/3 >=80"}])), - - ?match([{'CosNotifyFilter_ConstraintInfo',_,CID2}, {'CosNotifyFilter_ConstraintInfo',_,CID1}], - 'CosNotifyFilter_Filter':get_all_constraints(Filter)), - ?match([{'CosNotifyFilter_ConstraintInfo',_,CID1}], - 'CosNotifyFilter_Filter':get_constraints(Filter, [CID1])), - ?match(ok, 'CosNotifyFilter_Filter':remove_all_constraints(Filter)), - ?match([], 'CosNotifyFilter_Filter':get_all_constraints(Filter)), - - %% Try adding one correct and one incorrect constraint_expr - ?match({'EXCEPTION',{'CosNotifyFilter_InvalidConstraint',_,_}}, - 'CosNotifyFilter_Filter':add_constraints(Filter, - [#'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "name", - type_name = "type"}], - constraint_expr = "2==2 and 3<"}, - #'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "name2", - type_name = "type2"}], - constraint_expr = "$.test._length == 3 and ($.test[0].score + $.test[1].score + $.test[2].score)/3 >=80"}])), - - %% Following testcases test different domain_name and type_name, e.g., - %% wildcards etc. - [{_,ConInfoData,CID3}] = - ?match([{'CosNotifyFilter_ConstraintInfo',_,_}], - 'CosNotifyFilter_Filter':add_constraints(Filter, - [#'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "domain", - type_name = ""}, - #'CosNotification_EventType'{ - domain_name = "*", - type_name = "type"}], - constraint_expr = "2==2 and 3<4"}])), - - %% Try removing a constraint - ?match(ok, 'CosNotifyFilter_Filter':modify_constraints(Filter,[CID3],[])), - ?match([], 'CosNotifyFilter_Filter':get_all_constraints(Filter)), - - %% Add e new constraint - [{_,_,CID4}] = - ?match([{'CosNotifyFilter_ConstraintInfo',_,_}], - 'CosNotifyFilter_Filter':add_constraints(Filter, - [#'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "domain1", - type_name = ""}, - #'CosNotification_EventType'{ - domain_name = "domain2", - type_name = "*"}], - constraint_expr = "2==2 and 3<4"}])), - - %% Try to update the constraint associated with CID4 to equal CID3. - ?match(ok, 'CosNotifyFilter_Filter':modify_constraints(Filter,[], - [#'CosNotifyFilter_ConstraintInfo'{constraint_expression= - #'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "domain", - type_name = ""}, - #'CosNotification_EventType'{ - domain_name = "*", - type_name = "type"}], - constraint_expr = "2==2 and 3<4"}, - constraint_id=CID4}])), - - ?match([{_,ConInfoData,CID4}], 'CosNotifyFilter_Filter':get_all_constraints(Filter)), - - ?match({'EXCEPTION', {'CosNotifyFilter_ConstraintNotFound', _, CID3}}, - 'CosNotifyFilter_Filter':get_constraints(Filter, [CID3])), - ?match(ok, 'CosNotifyFilter_Filter':remove_all_constraints(Filter)), - ?match([], 'CosNotifyFilter_Filter':get_all_constraints(Filter)), - - ?match([{'CosNotifyFilter_ConstraintInfo',_,_}], - 'CosNotifyFilter_Filter':add_constraints(Filter, - [#'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "", - type_name = "type1"}, - #'CosNotification_EventType'{ - domain_name = "*", - type_name = "type2"}], - constraint_expr = "2==2 and 3<4"}])), - - ?match([{'CosNotifyFilter_ConstraintInfo',_,_}], - 'CosNotifyFilter_Filter':add_constraints(Filter, - [#'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "domain1", - type_name = "type1"}, - #'CosNotification_EventType'{ - domain_name = "domain2", - type_name = "type2"}], - constraint_expr = "2==2 and 3<4"}])), - - ?match([{'CosNotifyFilter_ConstraintInfo',_,_}], - 'CosNotifyFilter_Filter':add_constraints(Filter, - [#'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "dom*", - type_name = "type1"}, - #'CosNotification_EventType'{ - domain_name = "domain2", - type_name = "typ*"}], - constraint_expr = "2==2 and 3<4"}])), - - ?match([{'CosNotifyFilter_ConstraintInfo',_,_}], - 'CosNotifyFilter_Filter':add_constraints(Filter, - [#'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "dom*1", - type_name = "type1"}, - #'CosNotification_EventType'{ - domain_name = "domain2", - type_name = "typ*2"}], - constraint_expr = "2==2 and 3<4"}])), - - catch corba:dispose(FiFac), - catch corba:dispose(Filter), - catch corba:dispose(AC), - catch corba:dispose(Ch), - catch corba:dispose(Fac), - ok. - -%%----------------------------------------------------------------- -%% Subscription handling API tests -%%----------------------------------------------------------------- -subscription_api(_Config) -> - %% Initialize the application. - Fac = (catch cosNotificationApp:start_global_factory(?FAC_OPT)), - ?match({_,key,_,_,_,_}, Fac), - {Ch, _Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS, ?defaultAdm)), - ?match({_,key,_,_,_,_}, Ch), - - %% Create the Admin objects - {AdminSupplier, _ASID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_suppliers(Ch,'OR_OP')), - {AdminConsumer, _ACID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_consumers(Ch,'OR_OP')), - - %% Create Suppliers Proxies - {StructuredProxyPullSupplier,_}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_pull_supplier(AdminConsumer, 'STRUCTURED_EVENT')), - {StructuredProxyPushSupplier,_}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_push_supplier(AdminConsumer, 'STRUCTURED_EVENT')), - - %% Now we must create a Client for each proxy and connect them. - PushStrC=?match({_,key,_,_,_,_}, 'notify_test_StrPushC':oe_create(['PUSH_STRUCTURED',StructuredProxyPushSupplier], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':connect_structured_push_consumer(StructuredProxyPushSupplier, PushStrC)), - PullStrC=?match({_,key,_,_,_,_}, 'notify_test_StrPullC':oe_create(['PULL_STRUCTURED',StructuredProxyPullSupplier], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':connect_structured_pull_consumer(StructuredProxyPullSupplier, PullStrC)), - - %% Create Consumers Proxies - {StructuredProxyPullConsumer,_}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_pull_consumer(AdminSupplier, 'STRUCTURED_EVENT')), - {StructuredProxyPushConsumer,_}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_push_consumer(AdminSupplier, 'STRUCTURED_EVENT')), - - %% Now we must create a Client for each proxy and connect them. - PushStrS=?match({_,key,_,_,_,_}, 'notify_test_StrPushS':oe_create(['PUSH_STRUCTURED',StructuredProxyPushConsumer], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':connect_structured_push_supplier(StructuredProxyPushConsumer, PushStrS)), - - PullStrS=?match({_,key,_,_,_,_}, 'notify_test_StrPullS':oe_create(['PULL_STRUCTURED',StructuredProxyPullConsumer], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':connect_structured_pull_supplier(StructuredProxyPullConsumer, PullStrS)), - - ES1=[#'CosNotification_EventType'{domain_name = "name1", type_name = "type1"}, - #'CosNotification_EventType'{domain_name = "name2", type_name = "type2"}], - ES2=[#'CosNotification_EventType'{domain_name = "name3", type_name = "type3"}, - #'CosNotification_EventType'{domain_name = "name4", type_name = "type4"}], - - %% Initially it should have no associated types. Test that and set that - %% all updates should be forwarded to client. - ?match([], 'CosNotifyChannelAdmin_StructuredProxyPushConsumer': - obtain_subscription_types(StructuredProxyPushConsumer, - 'ALL_NOW_UPDATES_ON')), - ?match([], 'CosNotifyChannelAdmin_StructuredProxyPullConsumer': - obtain_subscription_types(StructuredProxyPullConsumer, - 'ALL_NOW_UPDATES_ON')), - - %% Update the offered types. - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer': - offer_change(StructuredProxyPushConsumer, ES1, [])), - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer': - offer_change(StructuredProxyPullConsumer, ES1, [])), - - %% To be sure, wait a couple of seconds. - timer:sleep(5000), - ?match([{'CosNotification_EventType',_,_}, - {'CosNotification_EventType',_,_}], - 'notify_test_StrPushC':doAction(PushStrS, return_data)), - ?match([{'CosNotification_EventType',_,_}, - {'CosNotification_EventType',_,_}], - 'notify_test_StrPullC':doAction(PullStrS, return_data)), - - %% Update the offered types. Remove ES1 and add ES2. - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer': - offer_change(StructuredProxyPushConsumer, ES2, ES1)), - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer': - offer_change(StructuredProxyPullConsumer, ES2, ES1)), - - %% To be sure, wait a couple of seconds. - timer:sleep(5000), - ?match([{'CosNotification_EventType',_,_}, - {'CosNotification_EventType',_,_}], - 'notify_test_StrPushC':doAction(PushStrS, return_data)), - ?match([{'CosNotification_EventType',_,_}, - {'CosNotification_EventType',_,_}], - 'notify_test_StrPullC':doAction(PullStrS, return_data)), - - %% Now, the objects should only contain 'ES2'. Test it. - ?match([{'CosNotification_EventType',_,_}, - {'CosNotification_EventType',_,_}], - 'CosNotifyChannelAdmin_StructuredProxyPushConsumer': - obtain_subscription_types(StructuredProxyPushConsumer, - 'ALL_NOW_UPDATES_ON')), - ?match([{'CosNotification_EventType',_,_}, - {'CosNotification_EventType',_,_}], - 'CosNotifyChannelAdmin_StructuredProxyPullConsumer': - obtain_subscription_types(StructuredProxyPullConsumer, - 'ALL_NOW_UPDATES_ON')), - - %% Now we will use wildcards, empty strings and test if they really - %% are ignored if so requested. - ES3=[#'CosNotification_EventType'{domain_name = "name1", type_name = "*"}, - #'CosNotification_EventType'{domain_name = "*", type_name = "type2"}], - ES4=[#'CosNotification_EventType'{domain_name = "name1", type_name = "*"}, - #'CosNotification_EventType'{domain_name = "name2", type_name = ""}], - ES5=[#'CosNotification_EventType'{domain_name = "na*", type_name = "type1"}], - ES6=[#'CosNotification_EventType'{domain_name = "n*1", type_name = "type1"}], - ES7=[#'CosNotification_EventType'{domain_name = "*1", type_name = "type1"}], - ES8=[#'CosNotification_EventType'{domain_name = "n*m*1", type_name = "type1"}], - ES9=[#'CosNotification_EventType'{domain_name = "n**1", type_name = "type1"}], - ES10=[#'CosNotification_EventType'{domain_name = "nam*1", type_name = "type1"}], - - Event1 = ?not_CreateSE("name1","type1", - "event_name", - [#'CosNotification_Property'{name="property_name", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - Event2 = ?not_CreateSE("name2","type1", - "event_name", - [#'CosNotification_Property'{name="property_name", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - Event3 = ?not_CreateSE("mame1","type1", - "event_name", - [#'CosNotification_Property'{name="property_name", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - Event4 = ?not_CreateSE("naame1","type1", - "event_name", - [#'CosNotification_Property'{name="property_name", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - Event5 = ?not_CreateSE("nname1","type1", - "event_name", - [#'CosNotification_Property'{name="property_name", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - Event6 = ?not_CreateSE("name12","type1", - "event_name", - [#'CosNotification_Property'{name="property_name", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier': - subscription_change(StructuredProxyPullSupplier, ES3, [])), - - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event1)), - - ?match(Event1, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier': - subscription_change(StructuredProxyPullSupplier, ES4, ES3)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event1)), - ?match(Event1, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier': - subscription_change(StructuredProxyPullSupplier, ES5, ES4)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event1)), - ?match(Event1, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier': - subscription_change(StructuredProxyPullSupplier, ES6, ES5)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event1)), - ?match(Event1, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier': - subscription_change(StructuredProxyPullSupplier, ES7, ES6)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event1)), - ?match(Event1, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier': - subscription_change(StructuredProxyPullSupplier, ES8, ES7)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event1)), - ?match(Event1, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier': - subscription_change(StructuredProxyPullSupplier, ES9, ES8)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event1)), - ?match(Event1, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event2)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event3)), - - timer:sleep(5000), - ?match({_NilStrEvent,false}, 'notify_test_StrPullC':doAction(PullStrC, try_pull_str)), - - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier': - subscription_change(StructuredProxyPullSupplier, ES10, ES9)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event1)), - ?match(Event1, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event4)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event5)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event6)), - - timer:sleep(5000), - ?match({_NilStrEvent,false}, 'notify_test_StrPullC':doAction(PullStrC, try_pull_str)), - - - catch corba:dispose(StructuredProxyPushConsumer), - catch corba:dispose(StructuredProxyPullConsumer), - catch corba:dispose(StructuredProxyPushSupplier), - catch corba:dispose(StructuredProxyPullSupplier), - catch corba:dispose(AdminConsumer), - catch corba:dispose(AdminSupplier), - catch corba:dispose(Ch), - catch cosNotificationApp:stop_factory(Fac), - - timer:sleep(5000), - ?match(true, corba_object:non_existent(PullStrS)), - ?match(true, corba_object:non_existent(PushStrS)), - ?match(true, corba_object:non_existent(PullStrC)), - ?match(true, corba_object:non_existent(PushStrC)), - - ok. - -%%----------------------------------------------------------------- -%% Filter admin API tests -%%----------------------------------------------------------------- -filter_adm_api(_Config) -> - Fac = (catch cosNotificationApp:start_global_factory(?FAC_OPT)), - ?match({_,key,_,_,_,_}, Fac), - {Ch, _Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS, ?defaultAdm)), - ?match({_,key,_,_,_,_}, Ch), - - FiFac = 'CosNotifyFilter_FilterFactory':oe_create(), - ?match({_,key,_,_,_,_}, FiFac), - - Filter = 'CosNotifyFilter_FilterFactory':create_filter(FiFac,"EXTENDED_TCL"), - ?match({_,key,_,_,_,_}, Filter), - - AC=?match({_,key,_,_,_,_}, - 'CosNotifyChannelAdmin_EventChannel':for_consumers(Ch)), - filter_tests('CosNotifyChannelAdmin_ConsumerAdmin', AC, Filter, Ch), - - AS=?match({_,key,_,_,_,_}, - 'CosNotifyChannelAdmin_EventChannel':for_suppliers(Ch)), - filter_tests('CosNotifyChannelAdmin_SupplierAdmin', AS, Filter, Ch), - - PushS=?match({_,key,_,_,_,_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_push_supplier(AC)), - filter_tests('CosNotifyChannelAdmin_ProxyPushSupplier', PushS, Filter, Ch), - - PullS=?match({_,key,_,_,_,_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_pull_supplier(AC)), - filter_tests('CosNotifyChannelAdmin_ProxyPullSupplier', PullS, Filter, Ch), - - PushC=?match({_,key,_,_,_,_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_push_consumer(AS)), - filter_tests('CosNotifyChannelAdmin_ProxyPushConsumer', PushC, Filter, Ch), - - PullC=?match({_,key,_,_,_,_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_pull_consumer(AS)), - filter_tests('CosNotifyChannelAdmin_ProxyPullConsumer', PullC, Filter, Ch), - - catch corba:dispose(FiFac), - catch corba:dispose(Filter), - catch corba:dispose(PushS), - catch corba:dispose(PullS), - catch corba:dispose(PushC), - catch corba:dispose(PullC), - catch corba:dispose(AC), - catch corba:dispose(AS), - catch corba:dispose(Ch), - catch cosNotificationApp:stop_factory(Fac), - ok. - -filter_tests(Mod, Obj, Filter, Ch) -> - io:format("############ TESTING MODULE ~p FILTER ############~n", [Mod]), - %% No filter added. - ?match([], Mod:get_all_filters(Obj)), - ?match(ok, Mod:remove_all_filters(Obj)), - ?match({'EXCEPTION',{'CosNotifyFilter_FilterNotFound',_}}, - Mod:get_filter(Obj, 0)), - %% Try add a Filter which is not a filter. - ?match({'EXCEPTION',{'BAD_PARAM',_,_,_}}, Mod:add_filter(Obj, Ch)), - %% Try to remove a single filter. - ?match({'EXCEPTION',{'CosNotifyFilter_FilterNotFound',_}}, - Mod:remove_filter(Obj, 0)), - ID = Mod:add_filter(Obj, Filter), - ?match([ID], Mod:get_all_filters(Obj)), - ?match(Filter, Mod:get_filter(Obj, ID)), - ?match(ok, Mod:remove_filter(Obj, ID)), - ?match([], Mod:get_all_filters(Obj)), - ID2 = Mod:add_filter(Obj, Filter), - ?match([ID2], Mod:get_all_filters(Obj)), - ?match(ok, Mod:remove_all_filters(Obj)), - ?match([], Mod:get_all_filters(Obj)), - ok. - -%%----------------------------------------------------------------- -%% Creating different event pushing and pulling API tests -%%----------------------------------------------------------------- -events_api(_Config) -> - %% Initialize the application. - Fac = (catch cosNotificationApp:start_global_factory(?FAC_OPT)), - ?match({_,key,_,_,_,_}, Fac), - {Ch, Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS, ?defaultAdm)), - ?match({_,key,_,_,_,_}, Ch), - events_api_helper(Fac, Ch, Id1). - -events2_api(doc) -> ["CosNotification event pushing and pulling tests II", ""]; -events2_api(suite) -> []; -events2_api(_Config) -> - %% Initialize the application. - Fac = (catch cosNotificationApp:start_global_factory(?FAC_OPT)), - ?match({_,key,_,_,_,_}, Fac), - {Ch, Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS2, ?defaultAdm)), - ?match({_,key,_,_,_,_}, Ch), - events_api_helper(Fac, Ch, Id1). - -events_api_helper(Fac, Ch, _Id1) -> - %% Now we will set up a test environment, with the following structure: - %% - %% Channel - %% / \ - %% Supplier Adm Consumer Adm - %% / \ - %% 1 proxy of each possible type - %% To each proxy we will connect a test client - %% The events will flow in ===>> direction. - %% - %% For the supplier Admins this include: - %% - ProxyPushConsumer - %% - SequenceProxyPushConsumer - %% - StructuredProxyPushConsumer - %% - ProxyPullConsumer - %% - SequenceProxyPullConsumer - %% - StructuredProxyPullConsumer - %% - %% For the consumer Admins this include: - %% - ProxyPushSupplier - %% - SequenceProxyPushSupplier - %% - StructuredProxyPushSupplier - %% - ProxyPullSupplier - %% - SequenceProxyPullSupplier - %% - StructuredProxyPullSupplier - %% - %% - %% We will not use any Filters to begin with, just want to make sure we can - %% deliver events from all start- to end-points. - - %% Create the Admin objects - {AdminSupplier, _ASID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_suppliers(Ch,'AND_OP')), - {AdminConsumer, _ACID}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_consumers(Ch,'AND_OP')), - - %% Create Suppliers Proxies - {ProxyPullSupplier,_ID1}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_pull_supplier(AdminConsumer, 'ANY_EVENT')), - {StructuredProxyPullSupplier,_ID2}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_pull_supplier(AdminConsumer, 'STRUCTURED_EVENT')), - {SequenceProxyPullSupplier,_ID3}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_pull_supplier(AdminConsumer, 'SEQUENCE_EVENT')), - - {ProxyPushSupplier,_I4D}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_push_supplier(AdminConsumer, 'ANY_EVENT')), - {StructuredProxyPushSupplier,_ID5}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_push_supplier(AdminConsumer, 'STRUCTURED_EVENT')), - {SequenceProxyPushSupplier,_ID6}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_push_supplier(AdminConsumer, 'SEQUENCE_EVENT')), - - %% Now we must create a Client for each proxy and connect them. - PushAnyC=?match({_,key,_,_,_,_}, 'notify_test_AnyPushC':oe_create(['PUSH_ANY', ProxyPushSupplier], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_ProxyPushSupplier':connect_any_push_consumer(ProxyPushSupplier, PushAnyC)), - - PushStrC=?match({_,key,_,_,_,_}, 'notify_test_StrPushC':oe_create(['PUSH_STRUCTURED',StructuredProxyPushSupplier], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPushSupplier':connect_structured_push_consumer(StructuredProxyPushSupplier, PushStrC)), - - PushSeqC=?match({_,key,_,_,_,_}, 'notify_test_SeqPushC':oe_create(['PUSH_SEQUENCE',SequenceProxyPushSupplier], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_SequenceProxyPushSupplier':connect_sequence_push_consumer(SequenceProxyPushSupplier, PushSeqC)), - - PullAnyC=?match({_,key,_,_,_,_}, 'notify_test_AnyPullC':oe_create(['PULL_ANY', ProxyPullSupplier], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_ProxyPullSupplier':connect_any_pull_consumer(ProxyPullSupplier, PullAnyC)), - - PullStrC=?match({_,key,_,_,_,_}, 'notify_test_StrPullC':oe_create(['PULL_STRUCTURED',StructuredProxyPullSupplier], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullSupplier':connect_structured_pull_consumer(StructuredProxyPullSupplier, PullStrC)), - - PullSeqC=?match({_,key,_,_,_,_}, 'notify_test_SeqPullC':oe_create(['PULL_SEQUENCE',SequenceProxyPullSupplier], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_SequenceProxyPullSupplier':connect_sequence_pull_consumer(SequenceProxyPullSupplier, PullSeqC)), - - - %% Create Consumers Proxies - {ProxyPullConsumer,_ID7}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_pull_consumer(AdminSupplier, 'ANY_EVENT')), - {StructuredProxyPullConsumer,_ID8}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_pull_consumer(AdminSupplier, 'STRUCTURED_EVENT')), - {SequenceProxyPullConsumer,_ID9}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_pull_consumer(AdminSupplier, 'SEQUENCE_EVENT')), - - {ProxyPushConsumer,_ID10}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_push_consumer(AdminSupplier, 'ANY_EVENT')), - {StructuredProxyPushConsumer,_ID11}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_push_consumer(AdminSupplier, 'STRUCTURED_EVENT')), - {SequenceProxyPushConsumer,_ID12}=?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_push_consumer(AdminSupplier, 'SEQUENCE_EVENT')), - - %% Now we must create a Client for each proxy and connect them. - PushAnyS=?match({_,key,_,_,_,_}, 'notify_test_AnyPushS':oe_create(['PUSH_ANY', ProxyPushConsumer], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_ProxyPushConsumer':connect_any_push_supplier(ProxyPushConsumer, PushAnyS)), - - PushStrS=?match({_,key,_,_,_,_}, 'notify_test_StrPushS':oe_create(['PUSH_STRUCTURED',StructuredProxyPushConsumer], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':connect_structured_push_supplier(StructuredProxyPushConsumer, PushStrS)), - - PushSeqS=?match({_,key,_,_,_,_}, 'notify_test_SeqPushS':oe_create(['PUSH_SEQUENCE',SequenceProxyPushConsumer], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_SequenceProxyPushConsumer':connect_sequence_push_supplier(SequenceProxyPushConsumer, PushSeqS)), - - PullAnyS=?match({_,key,_,_,_,_}, 'notify_test_AnyPullS':oe_create(['PULL_ANY', ProxyPullConsumer], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_ProxyPullConsumer':connect_any_pull_supplier(ProxyPullConsumer, PullAnyS)), - - PullStrS=?match({_,key,_,_,_,_}, 'notify_test_StrPullS':oe_create(['PULL_STRUCTURED',StructuredProxyPullConsumer], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPullConsumer':connect_structured_pull_supplier(StructuredProxyPullConsumer, PullStrS)), - - PullSeqS=?match({_,key,_,_,_,_}, 'notify_test_SeqPullS':oe_create(['PULL_SEQUENCE',SequenceProxyPullConsumer], - [{local_typecheck, false}])), - ?match(ok, 'CosNotifyChannelAdmin_SequenceProxyPullConsumer':connect_sequence_pull_supplier(SequenceProxyPullConsumer, PullSeqS)), - - - %% Create a couple of Events to test with. - Event = ?not_CreateSE("DomainName","CommunicationsAlarm", - "lost_packet", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 1)}], - [], any:create(orber_tc:null(), null)), - - Event2 = ?not_CreateSE("DomainName","TemperatureAlarm", - "over_heated", - [#'CosNotification_Property'{name="priority", - value=any:create(orber_tc:short(), 10)}], - [], any:create(orber_tc:null(), null)), - - - AnyEvent = any:create(orber_tc:long(), 100), - - StrEvent = ?not_CreateSE("","%ANY","",[],[],AnyEvent), - NilAnyEvent = any:create(orber_tc:null(), null), - NilStrEvent = ?not_CreateSE("","","",[],[],NilAnyEvent), - - ConvertedStr = any:create('CosNotification_StructuredEvent':tc(), Event), - - io:format("###################### PUSH STRUCTURED ########################"), - - %% Test with pushing a structured event. - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, Event)), - - %% Wait for a while so we are sure that all events have been delivered as far - %% as the Notification service can automatically. - timer:sleep(5000), - - %% Check if the Clients have received and stored the events. - ?match([{any,_,Event}], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([Event], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([Event], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - %% Instruct the Clients to pull the events and check if they match. - ?match({any,_,Event}, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(Event, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match([Event], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,1})), - - io:format("###################### PUSH SEQUENCE ########################"), - - %% Create an Event Sequence and push it. - EventSeq = [Event, Event2], - - %% Test with pushing a event sequence. - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushConsumer':push_structured_events(SequenceProxyPushConsumer, EventSeq)), - - %% Wait for a while so we are sure that all events have been delivered as far - %% as the Notification service can automatically. - timer:sleep(5000), - - %% Instruct the Clients to pull the events and check if they match. - ?match({any,_,Event}, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(Event, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match([Event,Event2], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,2})), - ?match({any,_,Event2}, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(Event2, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - - %% Check if the Push Clients have received and stored the events. - ?match([{any,_,Event}, {any,_,Event2}], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([Event, Event2], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([Event, Event2], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - io:format("###################### PUSH ANY ########################"), - - %% Test with pushing an any event. - ?match(ok,'CosEventChannelAdmin_ProxyPushConsumer':push(ProxyPushConsumer, AnyEvent)), - - %% Wait for a while so we are sure that all events have been delivered as far - %% as the Notification service can automatically. - timer:sleep(5000), - - %% Check if the Clients have received and stored the events. - ?match([AnyEvent], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([StrEvent], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([StrEvent], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - %% Instruct the Clients to pull the events and check if they match. - ?match(AnyEvent, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(StrEvent, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match([StrEvent], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,10})), - - - - io:format("###################### PUSH CONVERTED ANY #############"), - - %% Test with pushing a structured event. - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, StrEvent)), - - %% Wait for a while so we are sure that all events have been delivered as far - %% as the Notification service can automatically. - timer:sleep(5000), - - %% Check if the Clients have received and stored the events. - ?match([AnyEvent], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([StrEvent], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([StrEvent], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - %% Instruct the Clients to pull the events and check if they match. - ?match(AnyEvent, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(StrEvent, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match([StrEvent], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,1})), - - - io:format("###################### PUSH CONVERTED STRUCTURED ########"), - - %% Test with pushing an any event. - ?match(ok,'CosEventChannelAdmin_ProxyPushConsumer':push(ProxyPushConsumer, ConvertedStr)), - - %% Wait for a while so we are sure that all events have been delivered as far - %% as the Notification service can automatically. - timer:sleep(5000), - - %% Check if the Clients have received and stored the events. - ?match([ConvertedStr], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([Event], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([Event], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - %% Instruct the Clients to pull the events and check if they match. - ?match(ConvertedStr, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(Event, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match([Event], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,10})), - - - io:format("###################### TRY PULL ########################"), - - %% Now we will push an any event after a delay. This means that try_pull-functions, - %% since it's not blocking, will return, [], NilAny or NilStructured events and - %% the Boolean false. - spawn(notify_test_impl, delay, [ProxyPushConsumer, AnyEvent, 20000, - 'CosEventChannelAdmin_ProxyPushConsumer',push]), - ?match([], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - %% Instruct the Clients to pull the events and check if they match. - ?match({NilAnyEvent,false}, 'notify_test_AnyPullC':doAction(PullAnyC, try_pull_any)), - ?match({NilStrEvent,false}, 'notify_test_StrPullC':doAction(PullStrC, try_pull_str)), - ?match({[],false}, 'notify_test_SeqPullC':doAction(PullSeqC, {try_pull_seq,10})), - - - %% Instruct the Clients to pull the events and check if they match. - %% Pull is blocking so in the print-out we should see that nothing - %% is returned until the pushed event reaches the end proxies. - ?match(AnyEvent, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(StrEvent, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match([StrEvent], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,1})), - - %% To make sure there are no other circumstanses which lead to a delay we - %% hold for some time. - timer:sleep(5000), - %% Check if the Clients have received and stored the events. - ?match([AnyEvent], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([StrEvent], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([StrEvent], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - %% Test with pushing a event sequence but only pull sequences of length 1. - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushConsumer':push_structured_events(SequenceProxyPushConsumer, EventSeq)), - - %% Wait for a while so we are sure that all events have been delivered as far - %% as the Notification service can automatically. - timer:sleep(5000), - %% Pull 1 event at a time. - ?match([Event], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,1})), - ?match([Event2], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,1})), - - %% Following cases already tested; done for clean up. - ?match({any,_,Event}, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(Event, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match({any,_,Event2}, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(Event2, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match([{any,_,Event}, {any,_,Event2}], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([Event, Event2], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([Event, Event2], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - %% clean up done - - - io:format("###################### PROXY PULLER ########################"), - - %% Now we will just add Events to a cleint and wait for the Notification service - %% to pull the events and forward them to the consumer clients. - ?match(ok, 'notify_test_SeqPushC':doAction(PullAnyS, {set_data, [AnyEvent]})), - - - %% Instruct the Clients to pull the events and check if they match. - %% Pull is blocking so in the print-out we should see that nothing - %% is returned until the pushed event reaches the end proxies. - ?match(AnyEvent, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(StrEvent, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match([StrEvent], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,10})), - - %% To make sure there are no other circumstanses which lead to a delay we - %% hold for some time. - timer:sleep(5000), - %% Check if the Clients have received and stored the events. - ?match([AnyEvent], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([StrEvent], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([StrEvent], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - io:format("###################### SUSPENDED CONNECTION ################"), - - - %% Suspend the connections - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushSupplier':suspend_connection(SequenceProxyPushSupplier)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushSupplier':suspend_connection(StructuredProxyPushSupplier)), - - %% Test with pushing a event sequence. - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushConsumer':push_structured_events(SequenceProxyPushConsumer, EventSeq)), - - %% Wait for a while so we are sure that all events have been delivered as far - %% as the Notification service can automatically. - timer:sleep(5000), - - %% Instruct the Clients to pull the events and check if they match. - ?match({any,_,Event}, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(Event, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match([Event,Event2], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,2})), - ?match({any,_,Event2}, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(Event2, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - - %% Check if the Any Client have received and stored the events. - ?match([{any,_,Event}, {any,_,Event2}], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - - %% Check if the other Clients have received any events. Error if have. - ?match([], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - ?match(ok,'CosNotifyChannelAdmin_SequenceProxyPushSupplier':resume_connection(SequenceProxyPushSupplier)), - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushSupplier':resume_connection(StructuredProxyPushSupplier)), - - %% To be sure the test case don't fail due to time-race, sleep. - timer:sleep(5000), - - ?match([Event, Event2], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([Event, Event2], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - - io:format("###################### FILTER EVENTS #######################"), - - %% Now we will add filters and see if the system behaves correctly. - FiFac = 'CosNotifyFilter_FilterFactory':oe_create(), - Filter = 'CosNotifyFilter_FilterFactory':create_filter(FiFac,"EXTENDED_TCL"), - %% Add constraints to the Filter - [{_,_,CID1},{_,_,CID2}]= - ?match([{'CosNotifyFilter_ConstraintInfo',_,_}, {'CosNotifyFilter_ConstraintInfo',_,_}], - 'CosNotifyFilter_Filter':add_constraints(Filter, - [#'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "Spare*", - type_name = "MOVIE"}], - constraint_expr = "$type_name == 'MOVIE' and (('groucho' in $starlist) + ('chico' in $starlist) + ('harpo' in $starlist) + ('zeppo' in $starlist) + ('gummo' in $starlist)) > 2"}, - #'CosNotifyFilter_ConstraintExp'{event_types = - [#'CosNotification_EventType'{ - domain_name = "*", - type_name = "TestResults"}], - constraint_expr = "$test._length == 3 and ($test[0].score + $test[1].score + $test[2].score)/3 >=80"}])), - - ?match([{'CosNotifyFilter_ConstraintInfo',_,CID2}, {'CosNotifyFilter_ConstraintInfo',_,CID1}], - 'CosNotifyFilter_Filter':get_all_constraints(Filter)), - ?match([{'CosNotifyFilter_ConstraintInfo',_,CID1}], - 'CosNotifyFilter_Filter':get_constraints(Filter, [CID1])), - - %% Associate the Filter with different objects. - %% Since we use the same filter for both objects the events will never reach the admin. - _FilterID = 'CosNotifyChannelAdmin_ConsumerAdmin':add_filter(AdminConsumer, Filter), - - _FilterID2 = 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':add_filter(StructuredProxyPushConsumer, Filter), - event_filtering(FiFac, Filter, AdminConsumer, StructuredProxyPushConsumer, PushAnyC, - PushStrC, PushSeqC, PullAnyC, PullStrC, PullSeqC), - %% Remove the proxy filter so we can check if the events are filtered correctly by the admin. - ?match(ok, 'CosNotifyChannelAdmin_StructuredProxyPushConsumer':remove_all_filters(StructuredProxyPushConsumer)), - event_filtering(FiFac, Filter, AdminConsumer, StructuredProxyPushConsumer, PushAnyC, - PushStrC, PushSeqC, PullAnyC, PullStrC, PullSeqC), - - - catch corba:dispose(Filter), - catch corba:dispose(FiFac), - catch corba:dispose(SequenceProxyPushConsumer), - catch corba:dispose(StructuredProxyPushConsumer), - catch corba:dispose(ProxyPushConsumer), - catch corba:dispose(SequenceProxyPullConsumer), - catch corba:dispose(StructuredProxyPullConsumer), - catch corba:dispose(ProxyPullConsumer), - catch corba:dispose(SequenceProxyPushSupplier), - catch corba:dispose(StructuredProxyPushSupplier), - catch corba:dispose(ProxyPushSupplier), - catch corba:dispose(SequenceProxyPullSupplier), - catch corba:dispose(StructuredProxyPullSupplier), - catch corba:dispose(ProxyPullSupplier), - catch corba:dispose(AdminConsumer), - catch corba:dispose(AdminSupplier), - catch corba:dispose(Ch), - catch cosNotificationApp:stop_factory(Fac), - %% The Clients should have terminated by now. Check if it is so. - timer:sleep(5000), - ?match(true, corba_object:non_existent(PullSeqS)), - ?match(true, corba_object:non_existent(PullStrS)), - ?match(true, corba_object:non_existent(PullAnyS)), - ?match(true, corba_object:non_existent(PushSeqS)), - ?match(true, corba_object:non_existent(PushStrS)), - ?match(true, corba_object:non_existent(PushAnyS)), - ?match(true, corba_object:non_existent(PullSeqC)), - ?match(true, corba_object:non_existent(PullStrC)), - ?match(true, corba_object:non_existent(PullAnyC)), - ?match(true, corba_object:non_existent(PushSeqC)), - ?match(true, corba_object:non_existent(PushStrC)), - ?match(true, corba_object:non_existent(PushAnyC)), - ok. - -event_filtering(_FiFac, _Filter, _AdminConsumer, StructuredProxyPushConsumer, PushAnyC, PushStrC, PushSeqC, PullAnyC, PullStrC, PullSeqC) -> - NilAnyEvent = any:create(orber_tc:null(), null), - NilStrEvent = ?not_CreateSE("","","",[],[],NilAnyEvent), - - TrueEvent1 = ?not_CreateSE("SpareTime","MOVIE", - "EventName", - [#'CosNotification_Property'{name="starlist", - value=any:create(orber_tc:sequence(orber_tc:string(0),0), - ["groucho", "harpo", "sam", "gummo"])}], - [], any:create(orber_tc:null(), null)), - TrueEvent2 = ?not_CreateSE("Studies","TestResults", - "EventName", [], - [#'CosNotification_Property'{name="test", - value=any:create(orber_tc:array(notify_test_data:tc(),3), - {#notify_test_data{score=75, - name="name"}, - #notify_test_data{score=80, - name="name"}, - #notify_test_data{score=85, - name="name"}})}], - any:create(orber_tc:null(), null)), - - FalseEvent1 = ?not_CreateSE("SpareTime","MOVIE", - "EventName", - [#'CosNotification_Property'{name="starlist", - value=any:create(orber_tc:sequence(orber_tc:string(0),0), - ["frodo", "bilbo", "sam", "gummo"])}], - [], any:create(orber_tc:null(), null)), - FalseEvent2 = ?not_CreateSE("Studies","TestResults", - "EventName", [], - [#'CosNotification_Property'{name="test", - value=any:create(orber_tc:array(notify_test_data:tc(),3), - {#notify_test_data{score=75, - name="name"}, - #notify_test_data{score=80, - name="name"}, - #notify_test_data{score=80, - name="name"}})}], - any:create(orber_tc:null(), null)), - %% Test with pushing the first structured event that should not be filtered away. - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, TrueEvent1)), - - %% Wait for a while so we are sure that all events have been delivered as far - %% as the Notification service can automatically. - timer:sleep(5000), - - %% Check if the Clients have received and stored the events. - ?match([{any,_,TrueEvent1}], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([TrueEvent1], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([TrueEvent1], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - %% Instruct the Clients to pull the events and check if they match. - ?match({any,_,TrueEvent1}, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(TrueEvent1, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match([TrueEvent1], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,1})), - - %% Test with pushing the second structured event that should not be filtered away. - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, TrueEvent2)), - - %% Wait for a while so we are sure that all events have been delivered as far - %% as the Notification service can automatically. - timer:sleep(5000), - - %% Check if the Clients have received and stored the events. - ?match([{any,_,TrueEvent2}], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([TrueEvent2], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([TrueEvent2], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - %% Instruct the Clients to pull the events and check if they match. - ?match({any,_,TrueEvent2}, 'notify_test_AnyPullC':doAction(PullAnyC, pull_any)), - ?match(TrueEvent2, 'notify_test_StrPullC':doAction(PullStrC, pull_str)), - ?match([TrueEvent2], 'notify_test_SeqPullC':doAction(PullSeqC, {pull_seq,1})), - - %% Test with pushing the first structured event that should be filtered away. - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, FalseEvent1)), - - %% Wait for a while so we are sure that all events have been delivered as far - %% as the Notification service can automatically. - timer:sleep(5000), - - %% Check if the Clients have received and stored the events. - ?match([], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - %% Instruct the Clients to pull the events and check if they match. - ?match({NilAnyEvent,false}, 'notify_test_AnyPullC':doAction(PullAnyC, try_pull_any)), - ?match({NilStrEvent,false}, 'notify_test_StrPullC':doAction(PullStrC, try_pull_str)), - ?match({[],false}, 'notify_test_SeqPullC':doAction(PullSeqC, {try_pull_seq,10})), - - %% Test with pushing the second structured event that should be filtered away. - ?match(ok,'CosNotifyChannelAdmin_StructuredProxyPushConsumer':push_structured_event(StructuredProxyPushConsumer, FalseEvent2)), - - %% Wait for a while so we are sure that all events have been delivered as far - %% as the Notification service can automatically. - timer:sleep(5000), - - %% Check if the Clients have received and stored the events. - ?match([], 'notify_test_AnyPushC':doAction(PushAnyC, return_data)), - ?match([], 'notify_test_StrPushC':doAction(PushStrC, return_data)), - ?match([], 'notify_test_SeqPushC':doAction(PushSeqC, return_data)), - - %% Instruct the Clients to pull the events and check if they match. - ?match({NilAnyEvent,false}, 'notify_test_AnyPullC':doAction(PullAnyC, try_pull_any)), - ?match({NilStrEvent,false}, 'notify_test_StrPullC':doAction(PullStrC, try_pull_str)), - ?match({[],false}, 'notify_test_SeqPullC':doAction(PullSeqC, {try_pull_seq,10})). - - - -%%----------------------------------------------------------------- -%% Creating different cosEvent API tests -%%----------------------------------------------------------------- -cosevent_api(_Config) -> - Fac = (catch cosNotificationApp:start_global_factory(?FAC_OPT)), - ?match({_,key,_,_,_,_}, Fac), - {Ch, _Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS, ?defaultAdm)), - ?match({_,key,_,_,_,_}, Ch), - AC=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_EventChannel':for_consumers(Ch)), - AS=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_EventChannel':for_suppliers(Ch)), - - PushS=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_ConsumerAdmin':obtain_push_supplier(AC)), - PullS=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_ConsumerAdmin':obtain_pull_supplier(AC)), - - PushC=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_SupplierAdmin':obtain_push_consumer(AS)), - PullC=?match({_,key,_,_,_,_}, - 'CosEventChannelAdmin_SupplierAdmin':obtain_pull_consumer(AS)), - - PushAnyC=?match({_,key,_,_,_,_}, - 'notify_test_AnyPushC':oe_create(['PUSH_ANY', PushC], - [{local_typecheck, false}])), - PushStrC=?match({_,key,_,_,_,_}, - 'notify_test_StrPushC':oe_create(['PUSH_STRUCTURED',false], - [{local_typecheck, false}])), - PushSeqC=?match({_,key,_,_,_,_}, - 'notify_test_SeqPushC':oe_create(['PUSH_SEQUENCE',false], - [{local_typecheck, false}])), - - PullAnyC=?match({_,key,_,_,_,_}, - 'notify_test_AnyPullC':oe_create(['PULL_ANY', PullC], - [{local_typecheck, false}])), - PullStrC=?match({_,key,_,_,_,_}, - 'notify_test_StrPullC':oe_create(['PULL_STRUCTURED',false], - [{local_typecheck, false}])), - PullSeqC=?match({_,key,_,_,_,_}, - 'notify_test_SeqPullC':oe_create(['PULL_SEQUENCE',false], - [{local_typecheck, false}])), - - PushAnyS=?match({_,key,_,_,_,_}, - 'notify_test_AnyPushS':oe_create(['PUSH_ANY', PushC], - [{local_typecheck, false}])), - PushStrS=?match({_,key,_,_,_,_}, - 'notify_test_StrPushS':oe_create(['PUSH_STRUCTURED',false], - [{local_typecheck, false}])), - PushSeqS=?match({_,key,_,_,_,_}, - 'notify_test_SeqPushS':oe_create(['PUSH_SEQUENCE',false], - [{local_typecheck, false}])), - - PullAnyS=?match({_,key,_,_,_,_}, - 'notify_test_AnyPullS':oe_create(['PULL_ANY', PullS], - [{local_typecheck, false}])), - PullStrS=?match({_,key,_,_,_,_}, - 'notify_test_StrPullS':oe_create(['PULL_STRUCTURED',false], - [{local_typecheck, false}])), - PullSeqS=?match({_,key,_,_,_,_}, - 'notify_test_SeqPullS':oe_create(['PULL_SEQUENCE',false], - [{local_typecheck, false}])), - - %% In the OMG specification Proxies do not inherrit from CosEvent. Must use - %% Notify interface. - ?match({'EXCEPTION',{'BAD_PARAM',_,_,_}}, - 'CosEventChannelAdmin_ProxyPullConsumer':connect_pull_supplier(PullC, PushStrS)), - - ?match(ok, - 'CosEventChannelAdmin_ProxyPushSupplier':connect_push_consumer(PushS, PushAnyC)), - ?match(ok, - 'CosEventChannelAdmin_ProxyPullSupplier':connect_pull_consumer(PullS, PullAnyC)), - - ?match(ok, - 'CosEventChannelAdmin_ProxyPushConsumer':connect_push_supplier(PushC, PushAnyS)), - ?match(ok, - 'CosEventChannelAdmin_ProxyPullConsumer':connect_pull_supplier(PullC, PullAnyS)), - - ?match({'EXCEPTION',{'CosEventChannelAdmin_AlreadyConnected',_}}, - 'CosEventChannelAdmin_ProxyPullConsumer':connect_pull_supplier(PullC, PullAnyS)), - - ?match({'EXCEPTION',{'CosEventChannelAdmin_AlreadyConnected',_}}, - 'CosNotifyChannelAdmin_ProxyPullConsumer':connect_pull_supplier(PullC, PullAnyS)), - - ?match(true, corba_object:is_a(PushS, "IDL:omg.org/CosNotifyChannelAdmin/ProxyPushSupplier:1.0")), - ?match(true, corba_object:is_a(PushS, "IDL:omg.org/CosEventChannelAdmin/ProxyPushSupplier:1.0")), - - catch corba:dispose(PushStrC), - catch corba:dispose(PushSeqC), - catch corba:dispose(PullStrC), - catch corba:dispose(PullSeqC), - catch corba:dispose(PushStrS), - catch corba:dispose(PushSeqS), - catch corba:dispose(PullStrS), - catch corba:dispose(PullSeqS), - catch corba:dispose(PushS), - catch corba:dispose(PullS), - catch corba:dispose(PushC), - catch corba:dispose(PullC), - catch corba:dispose(AC), - catch corba:dispose(AS), - catch corba:dispose(Ch), - catch cosNotificationApp:stop_factory(Fac), - - %% The Clients should have terminated by now. Check if it is so. - timer:sleep(5000), - ?match(true, corba_object:non_existent(PullAnyS)), - ?match(true, corba_object:non_existent(PushAnyS)), - ?match(true, corba_object:non_existent(PullAnyC)), - ?match(true, corba_object:non_existent(PushAnyC)), - - - ok. - -%%----------------------------------------------------------------- -%% AdminPropertiesAdmin API tests -%%----------------------------------------------------------------- -adm_api(_Config) -> - Fac = (catch cosNotificationApp:start_global_factory(?FAC_OPT)), - ?match({_,key,_,_,_,_}, Fac), - - %% We need a few AdminProp:s to "play" with. - MQ0 = [#'CosNotification_Property'{name='CosNotification':'MaxQueueLength'(), - value=any:create(orber_tc:long(), 0)}], - MC0 = [#'CosNotification_Property'{name='CosNotification':'MaxConsumers'(), - value=any:create(orber_tc:long(), 0)}], - MS0 = [#'CosNotification_Property'{name='CosNotification':'MaxSuppliers'(), - value=any:create(orber_tc:long(), 0)}], - MQError1 = [#'CosNotification_Property'{name='CosNotification':'MaxQueueLength'(), - value=any:create(orber_tc:'float'(), 1.5)}], - MQError2 = [#'CosNotification_Property'{name='CosNotification':'MaxQueueLength'(), - value=any:create(orber_tc:long(), -1)}], - - {Ch, _Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS, ?defaultAdm)), - ?match({_,key,_,_,_,_}, Ch), - - %% Set new admin - ?match(ok, 'CosNotification_AdminPropertiesAdmin':set_admin(Ch, MQ0)), - %% It should be a list of three items. If we support more admin:s this - %% must be updated. - ?match([_,_,_], 'CosNotification_AdminPropertiesAdmin':get_admin(Ch)), - - %% Try to set admin with an uncorrect value, i.e., not integer >= 0. - ?match({'EXCEPTION',{'CosNotification_UnsupportedAdmin',_,_}}, - 'CosNotification_AdminPropertiesAdmin':set_admin(Ch, MQError1)), - ?match({'EXCEPTION',{'CosNotification_UnsupportedAdmin',_,_}}, - 'CosNotification_AdminPropertiesAdmin':set_admin(Ch, MQError2)), - - %% Try setting the other two admins and chech if the value is correct. - ?match(ok, 'CosNotification_AdminPropertiesAdmin':set_admin(Ch, MC0)), - ?match([_,_,_], 'CosNotification_AdminPropertiesAdmin':get_admin(Ch)), - - ?match(ok, 'CosNotification_AdminPropertiesAdmin':set_admin(Ch, MS0)), - ?match([_,_,_], 'CosNotification_AdminPropertiesAdmin':get_admin(Ch)), - - catch corba:dispose(Ch), - catch cosNotificationApp:stop_factory(Fac), - ok. - - -%%----------------------------------------------------------------- -%% QoSAdm API tests -%%----------------------------------------------------------------- -qos_api(_Config) -> - Fac = (catch cosNotificationApp:start_global_factory(?FAC_OPT)), - ?match({_,key,_,_,_,_}, Fac), - - {Ch, _Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS, ?defaultAdm)), - ?match({_,key,_,_,_,_}, Ch), - - - QoSPersistent = [#'CosNotification_Property'{name='CosNotification':'ConnectionReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'Persistent'())}], - QoSBestEffort = [#'CosNotification_Property'{name='CosNotification':'ConnectionReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'BestEffort'())}], - - QoSEventPersistent = [#'CosNotification_Property'{name='CosNotification':'EventReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'Persistent'())}], - QoSEventBestEffort = [#'CosNotification_Property'{name='CosNotification':'EventReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'BestEffort'())}], - - QoSOKMaxBatchSize = [#'CosNotification_Property'{name='CosNotification':'MaximumBatchSize'(), - value=any:create(orber_tc:long(), 200)}], - QoSToHighMaxBatchSize = [#'CosNotification_Property'{name='CosNotification':'MaximumBatchSize'(), - value=any:create(orber_tc:long(), 100000000)}], - - QoSToLowMaxBatchSize = [#'CosNotification_Property'{name='CosNotification':'MaximumBatchSize'(), - value=any:create(orber_tc:long(), -1)}], - - QoSOKStopTimeSupp = [#'CosNotification_Property'{name='CosNotification':'StopTimeSupported'(), - value=any:create(orber_tc:boolean(), true)}], - QoSWrongStopTimeSupp = [#'CosNotification_Property'{name="StopTimeSupp", - value=any:create(orber_tc:boolean(), true)}], - - QoSOKStartTimeSupp = [#'CosNotification_Property'{name='CosNotification':'StartTimeSupported'(), - value=any:create(orber_tc:boolean(), true)}], - QoSWrongStartTimeSupp = [#'CosNotification_Property'{name="StartTimeSupp", - value=any:create(orber_tc:boolean(), true)}], - QoSOKTimout = [#'CosNotification_Property'{name='CosNotification':'Timeout'(), - value=any:create(orber_tc:unsigned_long_long(), 100)}], - - - %% The most complex QoS to set is ConnectionReliability, and the reason for this - %% is that we cannot set the Channel to offer best effort while its children - %% offer persistent. A child may only offer Persistent if its parent do, which - %% is why we must check the following: - %% - %% # Persistent Change to Best Effort - %% _____ - %% | | (1) -> Check if children BE - %% |Chann| (2) ok <- - %% ----- - %% | - %% _____ - %% | | (3) -> Check if children BE - %% |Admin| (4) Check if parent Pers. <- - %% ----- - %% | - %% _____ - %% | | (5) -> ok - %% |Proxy| (6) Check if parent Pers. <- - %% ----- - %% NOTE: a parent always exists but we may change the QoS before creating any - %% childrens. The cases (2) and (5) is always ok, i.e., no need to confirm - %% with parent or children. - - %% We only have a channel. At the moment we can set ConnectionReliability - %% without asking anyone. - Q1='CosNotification_QoSAdmin':get_qos(Ch), - ?match({ok, _}, 'CosNotification_QoSAdmin':validate_qos(Ch, QoSBestEffort)), - - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSPersistent)), - %% Match if no problems occur if we try to set QoS as is. - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSPersistent)), - - %% Check validate. - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSEventPersistent)), - ?match({ok, _}, 'CosNotification_QoSAdmin':validate_qos(Ch, QoSOKTimout)), - ?match({ok, _}, 'CosNotification_QoSAdmin':validate_qos(Ch, QoSEventBestEffort)), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSEventBestEffort)), - ?match({ok, _}, 'CosNotification_QoSAdmin':validate_qos(Ch, QoSOKTimout)), - - Q2='CosNotification_QoSAdmin':get_qos(Ch), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSBestEffort)), - ?match(Q1, 'CosNotification_QoSAdmin':get_qos(Ch)), - - %% Now we add an Admin object. An Admin object cannot switch ConnectionReliability - %% to BestEffort without checking with its children or Persistent without - %% confirming this with its Parent. At the moment, however, we only have a parent. - {CAdm, Id2} = 'CosNotifyChannelAdmin_EventChannel':new_for_consumers(Ch, 'AND_OP'), - ?match(Q1,'CosNotification_QoSAdmin':get_qos(CAdm)), - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotification_QoSAdmin':set_qos(CAdm, QoSPersistent)), - ?match(Q1, 'CosNotification_QoSAdmin':get_qos(CAdm)), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(CAdm, QoSBestEffort)), - ?match(Q1, 'CosNotification_QoSAdmin':get_qos(CAdm)), - - %% Check if we can extract the Admin from the channel correctly. - ?match([0,Id2],'CosNotifyChannelAdmin_EventChannel':get_all_consumeradmins(Ch)), - ?match(CAdm,'CosNotifyChannelAdmin_EventChannel':get_consumeradmin(Ch, Id2)), - ?match(Ch, 'CosNotifyChannelAdmin_ConsumerAdmin':'_get_MyChannel'(CAdm)), - ?match(Id2, 'CosNotifyChannelAdmin_ConsumerAdmin':'_get_MyID'(CAdm)), - - %% Change the channel to provide Persistent service. Now we can set the - %% Admin service to Persistent to. (4) - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSPersistent)), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(CAdm, QoSPersistent)), - ?match(Q2, 'CosNotification_QoSAdmin':get_qos(CAdm)), - - %% Since the Admin object now provide Persistent the Channel cannot switch - %% to BestEffort. (1) - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotification_QoSAdmin':set_qos(Ch, QoSBestEffort)), - %% Should still match Persistent. - ?match(Q2, 'CosNotification_QoSAdmin':get_qos(Ch)), - {PSup, _Id3} = 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_push_supplier(CAdm, 'ANY_EVENT'), - ?match(Q2, 'CosNotification_QoSAdmin':get_qos(CAdm)), - ?match('PUSH_ANY', 'CosNotifyChannelAdmin_ProxyPushConsumer':'_get_MyType'(PSup)), - ?match(CAdm, 'CosNotifyChannelAdmin_ProxyPushConsumer':'_get_MyAdmin'(PSup)), - ?match(Q2, 'CosNotification_QoSAdmin':get_qos(PSup)), - - %% At this point they all offer persistent connection, which means we have - %% to start with the proxy if we want to change to Best Effort. Hence, - %% the following two cases will fail. - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotification_QoSAdmin':set_qos(Ch, QoSBestEffort)), - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotification_QoSAdmin':set_qos(CAdm, QoSBestEffort)), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(PSup, QoSBestEffort)), - %% Still not possible to change channel to Best Effort. - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotification_QoSAdmin':set_qos(Ch, QoSBestEffort)), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(CAdm, QoSBestEffort)), - %% Now we change the channel to Best Effort. - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSBestEffort)), - - %% Test if really are Best Effort - ?match(Q1, 'CosNotification_QoSAdmin':get_qos(Ch)), - ?match(Q1, 'CosNotification_QoSAdmin':get_qos(CAdm)), - ?match(Q1, 'CosNotification_QoSAdmin':get_qos(PSup)), - - %% Testing MaximumBatchSize (The highest value is defined in - %% CosNotification_Common.erl - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSOKMaxBatchSize)), - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotification_QoSAdmin':set_qos(Ch, QoSToHighMaxBatchSize)), - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotification_QoSAdmin':set_qos(Ch, QoSToLowMaxBatchSize)), - - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSOKStartTimeSupp)), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSOKStopTimeSupp)), - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotification_QoSAdmin':set_qos(Ch, QoSWrongStartTimeSupp)), - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotification_QoSAdmin':set_qos(Ch, QoSWrongStopTimeSupp)), - - catch corba:dispose(CAdm), - catch corba:dispose(PSup), - catch corba:dispose(Ch), - cosNotificationApp:stop_factory(Fac), - ok. - -%%----------------------------------------------------------------- -%% QoSAdm API tests -%%----------------------------------------------------------------- -event_qos_api(_Config) -> - Fac = (catch cosNotificationApp:start_global_factory(?FAC_OPT)), - ?match({_,key,_,_,_,_}, Fac), - - %% Create some objects to test with. We start with default settings. - {Ch, _Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, ?defaultQoS, ?defaultAdm)), - {CAdm, _Id2} = 'CosNotifyChannelAdmin_EventChannel':new_for_consumers(Ch, 'AND_OP'), - {PSup, _Id3} = 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_push_supplier(CAdm, 'ANY_EVENT'), - - %% Try setting an unsupported QoS. - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name="Unsupported QoS", - value=any:create(orber_tc:short(), 1)}])), - %% Try setting min and max priority. - ?match({ok, _}, 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name=?not_Priority, - value=any:create(orber_tc:short(), - ?not_LowestPriority)}, - #'CosNotification_Property'{name=?not_Priority, - value=any:create(orber_tc:short(), - ?not_HighestPriority)}])), - %% Try setting priority values which are 1 to high and 1 to low respectively. - ?match({'EXCEPTION',{'MARSHAL',_,_,_}}, - 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name=?not_Priority, - value=any:create(orber_tc:short(), - ?not_LowestPriority-1)}, - #'CosNotification_Property'{name=?not_Priority, - value=any:create(orber_tc:short(), - ?not_HighestPriority+1)}])), - %% Try setting start- and stop-time (false default). Note the value associated - %% with this property is not really a short but that is not what we are testing - %% here so... - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name=?not_StartTime, - value=any:create(orber_tc:short(), 0)}])), - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name=?not_StopTime, - value=any:create(orber_tc:short(), 0)}])), - %% Allow StopTime - ?match(ok, 'CosNotification_QoSAdmin':set_qos(PSup, [#'CosNotification_Property'{name='CosNotification':'StopTimeSupported'(), - value=any:create(orber_tc:boolean(), true)}])), - ?match({ok,_}, - 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name=?not_StopTime, - value=any:create(orber_tc:short(), 0)}])), - %% Allow StartTime - ?match(ok, 'CosNotification_QoSAdmin':set_qos(PSup, [#'CosNotification_Property'{name='CosNotification':'StartTimeSupported'(), - value=any:create(orber_tc:boolean(), true)}])), - ?match({ok,_}, - 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name=?not_StopTime, - value=any:create(orber_tc:short(), 0)}, - #'CosNotification_Property'{name=?not_StartTime, - value=any:create(orber_tc:short(), 0)}])), - - %% We must reset StopTime since we cannot guarantee that an event will be delivered - %% if risk beeing discarded due to a delay. - ?match(ok, 'CosNotification_QoSAdmin':set_qos(PSup, [#'CosNotification_Property'{name='CosNotification':'StopTimeSupported'(), - value=any:create(orber_tc:boolean(), false)}])), - %% Does it accept Best Effort EventReliability? Must always be true. - ?match({ok,_}, - 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name=?not_EventReliability, - value=any:create(orber_tc:short(), ?not_BestEffort)}])), - %% Default is Best Effort; test if we can set Persistent EventReliability. - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name=?not_EventReliability, - value=any:create(orber_tc:short(), ?not_Persistent)}])), - - %% Set Persistent - QoSPersistent = [#'CosNotification_Property'{name='CosNotification':'ConnectionReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'Persistent'())}], - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSPersistent)), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(CAdm, QoSPersistent)), - ?match(ok, 'CosNotification_QoSAdmin':set_qos(PSup, QoSPersistent)), - - %% Does it accept Best Effort EventReliability? Must always be true. - ?match({ok, _}, - 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name=?not_EventReliability, - value=any:create(orber_tc:short(), ?not_BestEffort)}])), - %% Test if we can use Persistent EventReliability. - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name=?not_EventReliability, - value=any:create(orber_tc:short(), ?not_Persistent)}])), - QoSEventPersistent = [#'CosNotification_Property'{name='CosNotification':'EventReliability'(), - value=any:create(orber_tc:short(), - 'CosNotification':'Persistent'())}], - ?match(ok, 'CosNotification_QoSAdmin':set_qos(Ch, QoSEventPersistent)), - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotification_QoSAdmin':set_qos(CAdm, QoSEventPersistent)), - ?match({'EXCEPTION',{'CosNotification_UnsupportedQoS',_,_}}, - 'CosNotification_QoSAdmin':set_qos(PSup, QoSEventPersistent)), - - ?match(ok, 'CosNotification_QoSAdmin':set_qos(PSup, [#'CosNotification_Property'{name='CosNotification':'StopTimeSupported'(), - value=any:create(orber_tc:boolean(), true)}])), - ?match({ok,_}, - 'CosNotifyChannelAdmin_ProxyConsumer': - validate_event_qos(PSup, - [#'CosNotification_Property'{name=?not_StopTime, - value=any:create(orber_tc:short(), 0)}, - #'CosNotification_Property'{name=?not_StartTime, - value=any:create(orber_tc:short(), 0)}])), - catch corba:dispose(CAdm), - catch corba:dispose(PSup), - catch corba:dispose(Ch), - cosNotificationApp:stop_factory(Fac), - ok. - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- - -%%-------------------- End of Module ------------------------------ diff --git a/lib/cosNotification/test/notify_test_impl.erl b/lib/cosNotification/test/notify_test_impl.erl deleted file mode 100644 index 6c833f4915..0000000000 --- a/lib/cosNotification/test/notify_test_impl.erl +++ /dev/null @@ -1,300 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : notify_test_impl.erl -%%---------------------------------------------------------------------- - --module(notify_test_impl). - --include_lib("orber/include/corba.hrl"). --include("idl_output/notify_test.hrl"). - -%%--------------- specified functions ------------------------ --export([stop_normal/2, - stop_brutal/2, - print/2, - doAction/3, - delay/5, - %% Exports from CosNotifyComm::StructuredPushConsumer - push_structured_event/3, disconnect_structured_push_consumer/2, - %% Exports from "CosNotifyComm::SequencePushConsumer" - push_structured_events/3, disconnect_sequence_push_consumer/2, - %% Exports from CosEventComm::PushConsumer - push/3, disconnect_push_consumer/2, - %% Exports from CosNotifyComm::NotifyPublish - disconnect_sequence_pull_consumer/2, - %% Exports from CosNotifyComm::StructuredPullConsumer - disconnect_structured_pull_consumer/2, - %% Exports from CosEventComm::PullConsumer - disconnect_pull_consumer/2, - %% Exports from CosNotifyComm::SequencePushSupplier - disconnect_sequence_push_supplier/2, - %% Exports from CosNotifyComm::StructuredPushSupplier - disconnect_structured_push_supplier/2, - %% Exports from CosEventComm::PushSupplier - disconnect_push_supplier/2, - %% Exports from CosNotifyComm::SequencePullSupplier - pull_structured_events/3, - try_pull_structured_events/3, - disconnect_sequence_pull_supplier/2, - %% Exports from CosNotifyComm::StructuredPullSupplier - pull_structured_event/2, - try_pull_structured_event/2, - disconnect_structured_pull_supplier/2, - %% Exports from CosEventComm::PullSupplier - pull/2, - try_pull/2, - disconnect_pull_supplier/2, - %% Exports from CosNotifyComm::SequencePullConsumer - offer_change/4, - %% Exports from CosNotifyComm::NotifySubscribe - subscription_change/4]). - -%%--------------- gen_server specific ------------------------ --export([init/1, terminate/2]). --export([handle_call/3, handle_cast/2, handle_info/2, code_change/3]). -%% Data structures --record(state, {myType, proxy, data, action}). - -%%--------------- LOCAL DATA --------------------------------- - -%%------------------------------------------------------------ -%% function : init, terminate -%%------------------------------------------------------------ -init([MyType, Proxy]) -> - process_flag(trap_exit,true), - {ok, #state{myType=MyType, proxy=Proxy, data=[]}}. - -terminate(Reason, State) -> - io:format("notify_test:terminate(~p ~p)~n",[Reason, State#state.myType]), - ok. - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. -handle_call(_,_, State) -> - {noreply, State}. -handle_cast(_, State) -> - {noreply, State}. -handle_info(_Info, State) -> - {noreply, State}. - -%%--------------- SERVER FUNCTIONS --------------------------- - -print(Self, State) -> - io:format("notify_test:print(~p ~p)~n",[Self, State]), - {reply, ok, State}. - -doAction(_Self, State, {set_data, Data}) -> - io:format("notify_test:doAction(add_data) ~p~n",[Data]), - {reply, ok, State#state{data=Data}}; -doAction(_Self, State, {add_data, Data}) -> - io:format("notify_test:doAction(add_data) ~p~n",[Data]), - {reply, ok, State#state{data=State#state.data++Data}}; -doAction(_Self, State, return_data) -> - io:format("notify_test:doAction(return_data)~n",[]), - {reply, State#state.data, State#state{data=[]}}; -doAction(_Self, State, clear_data) -> - io:format("notify_test:doAction(return_data)~n",[]), - {reply, ok, State#state{data=[]}}; -doAction(_Self, State, pull_any) -> - io:format("notify_test:doAction(pull_any)~n",[]), - Event='CosNotifyChannelAdmin_ProxyPullSupplier':pull(State#state.proxy), - {reply, Event, State}; -doAction(_Self, State, {pull_seq, Max}) -> - io:format("notify_test:doAction(pull_sequence)~n",[]), - Event='CosNotifyChannelAdmin_SequenceProxyPullSupplier':pull_structured_events(State#state.proxy, Max), - {reply, Event, State}; -doAction(_Self, State, pull_str) -> - Event='CosNotifyChannelAdmin_StructuredProxyPullSupplier':pull_structured_event(State#state.proxy), - io:format("notify_test:doAction(pull_structured)~n",[]), - {reply, Event, State}; -doAction(_Self, State, try_pull_any) -> - io:format("notify_test:doAction(try_pull_any)~n",[]), - Event='CosNotifyChannelAdmin_ProxyPullSupplier':try_pull(State#state.proxy), - {reply, Event, State}; -doAction(_Self, State, {try_pull_seq, Max}) -> - io:format("notify_test:doAction(try_pull_sequence)~n",[]), - Event='CosNotifyChannelAdmin_SequenceProxyPullSupplier':try_pull_structured_events(State#state.proxy, Max), - {reply, Event, State}; -doAction(_Self, State, try_pull_str) -> - Event='CosNotifyChannelAdmin_StructuredProxyPullSupplier':try_pull_structured_event(State#state.proxy), - io:format("notify_test:doAction(try_pull_structured)~n",[]), - {reply, Event, State}; -doAction(_Self, State, {action, Action}) -> - io:format("notify_test:doAction(~p)~n",[Action]), - {reply, ok, State#state{action = Action}}; - -doAction(_, State, _) -> - {reply, nop, State}. - -stop_normal(_Self, State) -> - {stop, normal, ok, State}. - -stop_brutal(_Self, _State) -> - exit("killed_brutal"). - - - -%%--------------- CosNotifyComm::NotifyPublish -------- -offer_change(_Self, State, Added, Removed) -> - ND=loop(Removed, State#state.data), - ND2=Added++ND, - {reply, ok, State#state{data=ND2}}. - -loop([],Data) -> - Data; -loop([H|T], Data) -> - ND=lists:delete(H,Data), - loop(T, ND). - -%%--------------- CosNotifyComm::NotifySubscribe -------- -subscription_change(_Self, State, Added, Removed) -> - ND=loop(Removed, State#state.data), - ND2=Added++ND, - {reply, ok, State#state{data=ND2}}. - -%%--------------- CosNotifyComm::SequencePushConsumer -------- -push_structured_events(_Self, #state{action = undefined} = State, Event) -> - io:format("notify_test:push_structured_events(~p)~n",[Event]), - {reply, ok, State#state{data=State#state.data++Event}}; -push_structured_events(_Self, #state{action = Action} = State, Event) -> - io:format("notify_test:push_structured_events(~p)~nAction: ~p~n", - [Event, Action]), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}), - {reply, ok, State#state{data=State#state.data++Event}}. -disconnect_sequence_push_consumer(_Self, State) -> - io:format("disconnect_sequence_push_consumer~n",[]), - {stop, normal, ok, State}. - -%%--------------- CosNotifyComm::StructuredPushConsumer -------- -push_structured_event(_Self, State, Event) -> - io:format("notify_test:push_structured_event(~p)~n",[Event]), - {reply, ok, State#state{data=State#state.data++[Event]}}. -disconnect_structured_push_consumer(_Self, State) -> - io:format("disconnect_structured_push_consumer~n",[]), - {stop, normal, ok, State}. - -%%--------------- CosEventComm::PushConsumer -------- -push(_Self, State, Event) -> - io:format("notify_test:push(~p)~n",[Event]), - {reply, ok, State#state{data=State#state.data++[Event]}}. -disconnect_push_consumer(_Self, State) -> - io:format("disconnect_push_consumer~n",[]), - {stop, normal, ok, State}. - -%%--------------- CosNotifyComm::SequencePullConsumer -------- -disconnect_sequence_pull_consumer(_Self, State) -> - io:format("disconnect_sequence_pull_consumer~n",[]), - {stop, normal, ok, State}. - -%%--------------- CosNotifyComm::StructuredPullConsumer -------- -disconnect_structured_pull_consumer(_Self, State) -> - io:format("disconnect_structured_pull_consumer~n",[]), - {stop, normal, ok, State}. - -%%--------------- CosEventComm::PullConsumer -------- -disconnect_pull_consumer(_Self, State) -> - io:format("disconnect_pull_consumer~n",[]), - {stop, normal, ok, State}. - -%%--------------- CosNotifyComm::SequencePushSupplier -------- -disconnect_sequence_push_supplier(_Self, State) -> - io:format("disconnect_sequence_push_supplier~n",[]), - {stop, normal, ok, State}. - -%%--------------- CosNotifyComm::StructuredPushSupplier -------- -disconnect_structured_push_supplier(_Self, State) -> - io:format("disconnect_structured_push_supplier~n",[]), - {stop, normal, ok, State}. - -%%--------------- CosEventComm::PushSupplier -------- -disconnect_push_supplier(_Self, State) -> - io:format("disconnect_push_supplier~n",[]), - {stop, normal, ok, State}. - -%%--------------- CosNotifyComm::SequencePullSupplier -------- -pull_structured_events(_Self, State, _Max) -> - io:format("notify_test:pullstructured_events()~n",[]), - {reply, ok, State}. -try_pull_structured_events(_Self, State, Max) -> - io:format("notify_test:try_pull_structured_events()~n",[]), - case State#state.data of - [] -> - {reply, {[],false}, State}; - List -> - R = split(List,Max), - {reply, {lists:sublist(List, Max), true}, State#state{data=R}} - end. - -split([],_) -> - []; -split(R,0) -> - R; -split([_H|T],Max) -> - split(T, Max-1). - -disconnect_sequence_pull_supplier(_Self, State) -> - io:format("disconnect_sequence_pull_supplier~n",[]), - {stop, normal, ok, State}. - -%%--------------- CosNotifyComm::StructuredPullSupplier -------- -pull_structured_event(_Self, State) -> - io:format("notify_test:pull_structured_event()~n",[]), - {reply, ok, State}. -try_pull_structured_event(_Self, State) -> - io:format("notify_test:try_pull_structured_event()~n",[]), - case State#state.data of - [] -> - {reply, {[],false}, State}; - [H|T] -> - {reply, {H, true}, State#state{data=T}} - end. -disconnect_structured_pull_supplier(_Self, State) -> - io:format("disconnect_structured_pull_supplier~n",[]), - {stop, normal, ok, State}. - -%%--------------- CosEventComm::PullSupplier -------- -pull(_Self, State) -> - io:format("notify_test:pull()~n",[]), - {reply, 'CosEventComm_PullSupplier':pull(State#state.proxy), State}. -try_pull(_Self, State) -> - io:format("notify_test:try_pull()~n",[]), - case State#state.data of - [] -> - {reply, {[],false}, State}; - [H|T] -> - {reply, {H, true}, State#state{data=T}} - end. -disconnect_pull_supplier(_Self, State) -> - io:format("disconnect_pull_supplier~n",[]), - {stop, normal, ok, State}. - -%%--------------- LOCAL FUNCTIONS ---------------------------- - -delay(Obj, Event, Time, Mod, F) -> - io:format("notify_test:delay(~p) TIME: ~p~n",[Event, erlang:timestamp()]), - timer:sleep(Time), - Mod:F(Obj, Event), - io:format("notify_test:delay() DONE: ~p~n",[erlang:timestamp()]), - ok. - -%%--------------- END OF MODULE ------------------------------ - diff --git a/lib/cosNotification/test/notify_test_server.cfg b/lib/cosNotification/test/notify_test_server.cfg deleted file mode 100644 index 60f50b23bb..0000000000 --- a/lib/cosNotification/test/notify_test_server.cfg +++ /dev/null @@ -1,55 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -{this, "notify_test::SeqPushC"}. -{{handle_info, "notify_test::SeqPushC"}, true}. -{{impl, "notify_test::SeqPushC"}, "notify_test_impl"}. -{this, "notify_test::StrPushC"}. -{{handle_info, "notify_test::StrPushC"}, true}. -{{impl, "notify_test::StrPushC"}, "notify_test_impl"}. -{this, "notify_test::AnyPushC"}. -{{handle_info, "notify_test::AnyPushC"}, true}. -{{impl, "notify_test::AnyPushC"}, "notify_test_impl"}. -{this, "notify_test::SeqPullC"}. -{{handle_info, "notify_test::SeqPullC"}, true}. -{{impl, "notify_test::SeqPullC"}, "notify_test_impl"}. -{this, "notify_test::StrPullC"}. -{{handle_info, "notify_test::StrPullC"}, true}. -{{impl, "notify_test::StrPullC"}, "notify_test_impl"}. -{this, "notify_test::AnyPullC"}. -{{handle_info, "notify_test::AnyPullC"}, true}. -{{impl, "notify_test::AnyPullC"}, "notify_test_impl"}. -{this, "notify_test::SeqPushS"}. -{{handle_info, "notify_test::SeqPushS"}, true}. -{{impl, "notify_test::SeqPushS"}, "notify_test_impl"}. -{this, "notify_test::StrPushS"}. -{{handle_info, "notify_test::StrPushS"}, true}. -{{impl, "notify_test::StrPushS"}, "notify_test_impl"}. -{this, "notify_test::AnyPushS"}. -{{handle_info, "notify_test::AnyPushS"}, true}. -{{impl, "notify_test::AnyPushS"}, "notify_test_impl"}. -{this, "notify_test::SeqPullS"}. -{{handle_info, "notify_test::SeqPullS"}, true}. -{{impl, "notify_test::SeqPullS"}, "notify_test_impl"}. -{this, "notify_test::StrPullS"}. -{{handle_info, "notify_test::StrPullS"}, true}. -{{impl, "notify_test::StrPullS"}, "notify_test_impl"}. -{this, "notify_test::AnyPullS"}. -{{handle_info, "notify_test::AnyPullS"}, true}. -{{impl, "notify_test::AnyPullS"}, "notify_test_impl"}. diff --git a/lib/cosNotification/test/notify_test_server.idl b/lib/cosNotification/test/notify_test_server.idl deleted file mode 100644 index 0334d67717..0000000000 --- a/lib/cosNotification/test/notify_test_server.idl +++ /dev/null @@ -1,114 +0,0 @@ -// -// %CopyrightBegin% -// -// Copyright Ericsson AB 1999-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -// - -#ifndef _NOTIFY_TEST_SERVER_IDL -#define _NOTIFY_TEST_SERVER_IDL - -#include -#include - -module notify_test { - - enum action {PULL_SEQ, PULL_STR, PULL_ANY, PUSH_SEQ, PUSH_STR, PUSH_ANY}; - - struct data { - short score; - string name; - }; - - struct computer { - float memsize; - float cputime; - float filesize; - }; - - struct X { - long A; - string B; - short C; - }; - - - union K switch(short) { - case -1: short neg; - case 0: - case 2: string K; - case 3: X L; - case 5: long M; - default: short N; - }; - - union uni1 switch(long) { - case 1: - case 2: long lo; - case 3: short sh; - default: short defvalue; - }; - - union uni2 switch(long) { - case 1: - case 2: long lo; - case 3: short sh; - }; - - typedef any namedAny; - typedef short ShortArray[4]; - struct studies { - uni1 uni1; - CosNotification::PropertySeq tests; - ShortArray monthly_attendance; - short gpa; - }; - - interface funcs { - void print(); - void doAction(in action Act); - }; - - // interface server - interface SeqPushC : funcs, CosNotifyComm::SequencePushConsumer { - }; - interface StrPushC : funcs, CosNotifyComm::StructuredPushConsumer { - }; - interface AnyPushC : funcs, CosEventComm::PushConsumer { - }; - interface SeqPullC : funcs, CosNotifyComm::SequencePullConsumer { - }; - interface StrPullC : funcs, CosNotifyComm::StructuredPullConsumer { - }; - interface AnyPullC : funcs, CosEventComm::PullConsumer { - }; - - interface SeqPushS : funcs, CosNotifyComm::SequencePushSupplier { - }; - interface StrPushS : funcs, CosNotifyComm::StructuredPushSupplier { - }; - interface AnyPushS : funcs, CosEventComm::PushSupplier { - }; - interface SeqPullS : funcs, CosNotifyComm::SequencePullSupplier { - }; - interface StrPullS : funcs, CosNotifyComm::StructuredPullSupplier { - }; - interface AnyPullS : funcs, CosEventComm::PullSupplier { - }; - -}; - -#endif diff --git a/lib/cosNotification/vsn.mk b/lib/cosNotification/vsn.mk deleted file mode 100644 index 1677057670..0000000000 --- a/lib/cosNotification/vsn.mk +++ /dev/null @@ -1,2 +0,0 @@ -COSNOTIFICATION_VSN = 1.2.3 - diff --git a/lib/cosProperty/AUTHORS b/lib/cosProperty/AUTHORS deleted file mode 100644 index 55d8059989..0000000000 --- a/lib/cosProperty/AUTHORS +++ /dev/null @@ -1,4 +0,0 @@ -Original Authors: -Niclas Eklund - -Contributors: diff --git a/lib/cosProperty/Makefile b/lib/cosProperty/Makefile deleted file mode 100644 index 44d1aafade..0000000000 --- a/lib/cosProperty/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2000-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include vsn.mk -VSN=$(COSPROPERTY_VSN) - -# ---------------------------------------------------- -# Common Macros -# ---------------------------------------------------- -# SUB_DIRECTORIES = src test examples doc/src -# At the moment we don't have any example programs. -SUB_DIRECTORIES = src doc/src - -SPECIAL_TARGETS = - -# ---------------------------------------------------- -# Default Subdir Targets -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_subdir.mk diff --git a/lib/cosProperty/doc/html/.gitignore b/lib/cosProperty/doc/html/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosProperty/doc/man3/.gitignore b/lib/cosProperty/doc/man3/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosProperty/doc/man6/.gitignore b/lib/cosProperty/doc/man6/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosProperty/doc/pdf/.gitignore b/lib/cosProperty/doc/pdf/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosProperty/doc/src/CosPropertyService_PropertiesIterator.xml b/lib/cosProperty/doc/src/CosPropertyService_PropertiesIterator.xml deleted file mode 100644 index 62a1732e99..0000000000 --- a/lib/cosProperty/doc/src/CosPropertyService_PropertiesIterator.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosPropertyService_PropertiesIterator - - - - 2000-07-25 - 1.0 -
- CosPropertyService_PropertiesIterator - This module implements the OMG CosPropertyService::PropertiesIterator interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosProperty/include/CosPropertyService.hrl").

-
- - - reset(Iterator) -> ok - Reset the position to the first property - - Iterator = #objref - - -

This operation resets the position to the first property.

-
-
- - next_one(Iterator) -> Reply - Return true if a Property exists at the current position and the out parameter is a valid Property. Otherwise false and a non-valid property - - Iterator = #objref - Reply = {boolean(), #'CosPropertyService_Property'{property_name = Name, property_value = Value}} - Name = string() - Value = #any - - -

This operation returns true . If false is returned the out - parameter is a non-valid Property.

-
-
- - next_n(Iterator, HowMany) -> Reply - Return true if the requested number of properties can be delivered and there are additional properties. Otherwise false is returned and a sequence of max HowManyproperties - - Iterator = #objref - HowMany = long() - Reply = {boolean(), Properties} - Properties = [#'CosPropertyService_Property'{property_name = Name, property_value = Value}] - Name = string() - Value = #any - - -

This operation returns true if the requested number of properties can be - delivered and there are additional properties. If false is returned and a - sequence of max HowMany properties will be returned and no more - properties can be delivered.

-
-
- - destroy(Iterator) -> ok - Terminate the target object - - Iterator = #objref - - -

This operation will terminate the Iterator and all subsequent calls - will fail.

-
-
-
- -
- diff --git a/lib/cosProperty/doc/src/CosPropertyService_PropertyNamesIterator.xml b/lib/cosProperty/doc/src/CosPropertyService_PropertyNamesIterator.xml deleted file mode 100644 index 5948490547..0000000000 --- a/lib/cosProperty/doc/src/CosPropertyService_PropertyNamesIterator.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosPropertyService_PropertyNamesIterator - - - - - - 2000-07-25 - 1.0 -
- CosPropertyService_PropertyNamesIterator - This module implements the OMG CosPropertyService::PropertyNamesIterator interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosProperty/include/CosPropertyService.hrl").

-
- - - reset(Iterator) -> ok - Reset the position to the first property name - - Iterator = #objref - - -

This operation resets the position to the first property name.

-
-
- - next_one(Iterator) -> Reply - Return true if a Property Name exists at the current position and the out parameter is a valid Property Name. Otherwise false and a non-valid Property Name - - Iterator = #objref - Reply = {boolean(), Name} - Name = string() - - -

This operation returns true if a Property Name exists at the current - position and the out parameter is a valid Property Name. - If false is returned the out parameter is a non-valid Property Name.

-
-
- - next_n(Iterator, HowMany) -> Reply - Return HowManyProperty Names and a boolean which is true if additional Property Names exists - - Iterator = #objref - HowMany = long() - Reply = {boolean(), [Name]} - Name = string() - - -

This operation returns true if the requested number of Property Names can be - delivered and there are additional property names. If false is returned a - sequence of max HowMany property names will be returned and no - more Property Names can be delivered.

-
-
- - destroy(Iterator) -> ok - Terminate the target object - - Iterator = #objref - - -

This operation will terminate the Iterator and all subsequent calls - will fail.

-
-
-
- -
- diff --git a/lib/cosProperty/doc/src/CosPropertyService_PropertySet.xml b/lib/cosProperty/doc/src/CosPropertyService_PropertySet.xml deleted file mode 100644 index 8e7fbbd80a..0000000000 --- a/lib/cosProperty/doc/src/CosPropertyService_PropertySet.xml +++ /dev/null @@ -1,201 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosPropertyService_PropertySet - - - - - - 2000-07-25 - 1.0 -
- CosPropertyService_PropertySet - This module implements the OMG CosPropertyService::PropertySet interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosProperty/include/CosPropertyService.hrl").

-
- - - define_property(PropertySet, Name, Value) -> Reply - Add a new property to the target object - - PropertySet = #objref - Name = non-empty string() - Value = #any - Reply = ok | {'EXCEPTION', #CosPropertyService_InvalidPropertyName{}} | {'EXCEPTION', #CosPropertyService_ConflictingProperty{}} | {'EXCEPTION', #CosPropertyService_UnsupportedTypeCode{}} | {'EXCEPTION', #CosPropertyService_UnsupportedProperty{}} | {'EXCEPTION', #CosPropertyService_ReadOnlyProperty{}} - - -

This operation adds a new property to the given object. Depending on - which initial arguments was supplied when starting the object several - exceptions may be raised.

-
-
- - define_properties(PropertySet, Properties) -> Reply - Add new properties to the target object - - PropertySet = #objref - Properties = [#'CosPropertyService_Property'{property_name = Name, property_value = Value}] - Name = string() - Value = #any - Reply = ok | {'EXCEPTION', #CosPropertyService_MultipleExceptions{exceptions = Excs}} - Excs = [#'CosPropertyService_PropertyException{reason = Reason, failing_property_name = Name}] - Reason = invalid_property_name | conflicting_property | property_not_found | unsupported_type_code | unsupported_property | unsupported_mode | fixed_property | read_only_property - - -

This operation adds several new properties to the given object. Depending on - which initial arguments was supplied when starting the object an - exceptions may be raised listing the properties failing.

-
-
- - get_number_of_properties(PropertySet) -> ulong() - Get the number of properties associated with the target object - - PropertySet = #objref - - -

This operation returns the number of properties associated with the target - object.

-
-
- - get_all_property_names(PropertySet, Max) -> Reply - Get Maxproperty names. If the target object have additional associated properties they will be put in the returned Iterator - - PropertySet = NamesIterator = #objref - Max = ulong() - Reply = {ok, Names, NamesIterator} - Names = [string()] - - -

This operation returns up to Max property names. If the target - object have additional associated properties they will be put in the - returned Iterator, otherwise the Iterator will be a NIL object.

-
-
- - get_property_value(PropertySet, Name) -> Reply - Return the property value associated with given name - - PropertySet = #objref - Name = string() - Reply = #any | {'EXCEPTION', #CosPropertyService_PropertyNotFound{}} | {'EXCEPTION', #CosPropertyService_InvalidPropertyName{}} - - -

This operation returns the property value associated with given name. If no such property - exists or the given name is an empty string an exception will be raised.

-
-
- - get_properties(PropertySet, Names) -> Reply - Return all properties associated with given names - - PropertySet = #objref - Names = [string()] - Reply = {boolean(), Properties} - Properties = [#'CosPropertyService_Property'{property_name = Name, property_value = Value}] - - -

This operation returns all properties associated with given names. If the - boolean flag is true all properties where retrieved correctly, otherwise, - all properties with the type tk_void was not found.

-
-
- - get_all_properties(PropertySet, Max) -> Reply - Return a list Maxproperties or less. If more properties are associated with the target object they will be put in thePropertiesIterator. - - PropertySet = PropertiesIterator = #objref - Reply = {ok, Properties, PropertiesIterator} - Properties = [#'CosPropertyService_Property'{property_name = Name, property_value = Value}] - - -

This operation return a list Max properties or less. If more - properties are associated with the target object they will be put in the - PropertiesIterator. If the object had less than Max - associated properties the Iterator will be a NIL object.

-
-
- - delete_property(PropertySet, Name) -> Reply - Delete the property with given Name - - PropertySet = #objref - Name = string() - Reply = ok | {'EXCEPTION', #CosPropertyService_FixedProperty{}} | {'EXCEPTION', #CosPropertyService_PropertyNotFound{}} | {'EXCEPTION', #CosPropertyService_InvalidPropertyName{}} - - -

This operation tries to delete the property with given Name. An exception - which indicates why it failed is raised if so needed.

-
-
- - delete_properties(PropertySet, Names) -> Reply - Delete all properties with given Names - - PropertySet = #objref - Names = [string()] - Reply = ok | {'EXCEPTION', #CosPropertyService_MultipleExceptions{exceptions = Excs}} - Excs = [#'CosPropertyService_PropertyException{reason = Reason, failing_property_name = Name}] - Reason = invalid_property_name | conflicting_property | property_not_found | unsupported_type_code | unsupported_property | unsupported_mode | fixed_property | read_only_property - - -

This operation tries to delete all given Properties. If one or more removal - fails an exception is raised which describe why.

-
-
- - delete_all_properties(PropertySet) -> boolean() - Delete all properties - - PropertySet = #objref - - -

This operation deletes all properties. The boolean flag, if set to false, - indicates that it was not possible to remove one or more properties, e.g., - may be read only.

-
-
- - is_property_defined(PropertySet, Name) -> Reply - Return true if the target have an associated property with given name - - PropertySet = #objref - Name = non-empty string() - Reply = boolean() | {'EXCEPTION', #CosPropertyService_InvalidPropertyName{}} - - -

This operation returns true if the target have an associated property with - given name.

-
-
-
- -
- diff --git a/lib/cosProperty/doc/src/CosPropertyService_PropertySetDef.xml b/lib/cosProperty/doc/src/CosPropertyService_PropertySetDef.xml deleted file mode 100644 index 2cbf2fc4f9..0000000000 --- a/lib/cosProperty/doc/src/CosPropertyService_PropertySetDef.xml +++ /dev/null @@ -1,168 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosPropertyService_PropertySetDef - - - - 2000-07-25 - 1.0 -
- CosPropertyService_PropertySetDef - This module implements the OMG CosPropertyService::PropertySetDef interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosProperty/include/CosPropertyService.hrl").

-

This module also exports the functions described in

-

CosPropertyService_PropertySet

-
- - - get_allowed_property_types(PropertySetDef) -> Reply - Return allowed TypeCodes for the target object - - PropertySetDef = #objref - Reply = {ok, PropertyTypes} - PropertyTypes = [CORBA::TypeCode] - - -

This operation return the TypeCodes which we are allowed to use when adding - new properties.

-
-
- - get_allowed_properties(PropertySetDef) -> Reply - Return a sequence of the allowed properties - - PropertySetDef = #objref - Reply = {ok, PropertyDefs} - PropertyDefs = [#'CosPropertyService_PropertyDef'{property_name = Name, property_value = Value, property_mode = Mode}] - Name = string() - Value = #any - Mode = normal | read_only | fixed_normal | fixed_readonly | undefined - - -

This operation a sequence of the allowed properties we may alter; depends on - which mode associated with a certain property.

-
-
- - define_property_with_mode(PropertySetDef, Name, Value, Mode) -> Reply - Associate a new property with the target object - - PropertySetDef = #objref - Name = non-empty string() - Value = #any - Mode = normal | read_only | fixed_normal | fixed_readonly | undefined - Reply = ok | {'EXCEPTION', #CosPropertyService_InvalidPropertyName{}} | {'EXCEPTION', #CosPropertyService_ConflictingProperty{}} | {'EXCEPTION', #CosPropertyService_UnsupportedTypeCode{}} | {'EXCEPTION', #CosPropertyService_UnsupportedProperty{}} | {'EXCEPTION', #CosPropertyService_UnsupportedMode{}} | {'EXCEPTION', #CosPropertyService_ReadOnlyProperty{}} - - -

This operation attempts to associate a new property with the target object. - If we fail to do so the appropriate exception is raised.

-
-
- - define_properties_with_modes(PropertySetDef, PropertyDefs) -> Reply - Associate the given Property Definitions with the target object - - PropertySetDef = #objref - PropertyDefs = [#'CosPropertyService_PropertyDef'{property_name = Name, property_value = Value, property_mode = Mode}] - Name = string() - Value = #any - Mode = normal | read_only | fixed_normal | fixed_readonly | undefined - Reply = ok | {'EXCEPTION', #CosPropertyService_MultipleExceptions{exceptions = Excs}} - Excs = [#'CosPropertyService_PropertyException{reason = Reason, failing_property_name = Name}] - Reason = invalid_property_name | conflicting_property | property_not_found | unsupported_type_code | unsupported_property | unsupported_mode | fixed_property | read_only_property - - -

This operation attempts to associate the given Property Definitions with the - target object. If one or more attempts fail an exception is raised - describing which properties we where not able to create.

-
-
- - get_property_mode(PropertySetDef, Name) -> Reply - Return the mode of the given property - - PropertySetDef = #objref - Name = string() - Reply = Mode | {'EXCEPTION', #CosPropertyService_InvalidPropertyName{}} | {'EXCEPTION', #CosPropertyService_PropertyNotFound{}} - Mode = normal | read_only | fixed_normal | fixed_readonly | undefined - - -

This operation returns the type of the given property.

-
-
- - get_property_modes(PropertySetDef, Names) -> Reply - Return the modes of the given properties - - PropertySetDef = #objref - Names = [string()] - Reply = {boolean(), PropertyModes} - PropertyModes = [#'CosPropertyService_PropertyMode'{property_name = Name, property_mode = Mode}] - Name = string() - Mode = normal | read_only | fixed_normal | fixed_readonly | undefined - - -

This operation returns the modes of the listed properties. If the boolean - flag is false, all properties with mode undefined this operation - failed to comply.

-
-
- - set_property_mode(PropertySetDef, Name, Mode) -> Reply - Change the given property's mode - - PropertySetDef = #objref - Name = string() - Mode = normal | read_only | fixed_normal | fixed_readonly | undefined - Reply = ok | {'EXCEPTION', #CosPropertyService_InvalidPropertyName{}} | {'EXCEPTION', #CosPropertyService_UnsupportedMode{}} | {'EXCEPTION', #CosPropertyService_PropertyNotFound{}} - - -

This operation changes the given property's mode. Return the appropriate - exception if not able to fulfill the request.

-
-
- - set_property_modes(PropertySetDef, PropertyModes) -> Reply - Change the listed properties mode's - - PropertySetDef = #objref - PropertyModes = [#'CosPropertyService_PropertyMode'{property_name = Name, property_mode = Mode}] - Name = string() - Mode = normal | read_only | fixed_normal | fixed_readonly | undefined - Reply = ok | {'EXCEPTION', #CosPropertyService_MultipleExceptions{exceptions = Excs}} - Excs = [#'CosPropertyService_PropertyException{reason = Reason, failing_property_name = Name}] - Reason = invalid_property_name | conflicting_property | property_not_found | unsupported_type_code | unsupported_property | unsupported_mode | fixed_property | read_only_property - - -

This operation attempts to update the listed properties mode's. Raises an - exception which describe which and why an operation failed.

-
-
-
- -
- diff --git a/lib/cosProperty/doc/src/CosPropertyService_PropertySetDefFactory.xml b/lib/cosProperty/doc/src/CosPropertyService_PropertySetDefFactory.xml deleted file mode 100644 index d6425db9cf..0000000000 --- a/lib/cosProperty/doc/src/CosPropertyService_PropertySetDefFactory.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosPropertyService_PropertySetDefFactory - - - - Niclas Eklund - - 2000-07-25 - 1.0 -
- CosPropertyService_PropertySetDefFactory - This module implements the OMG CosPropertyService::PropertySetDefFactory interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosProperty/include/CosPropertyService.hrl").

-
- - - create_propertysetdef(Factory) -> - Create a new PropertySetDefwith no predefined settings - - Factory = PropertySetDef = #objref - - -

This operation creates a new PropertySetDef with no predefined - settings.

-
-
- - create_constrained_propertysetdef(Factory, PropertyTypes, PropertyDefs) -> Reply - Create a new PropertySetDefwith specified constraints - - Factory = PropertySetDef = #objref - PropertyTypes = [CORBA::TypeCode] - PropertyDefs = [#'CosPropertyService_PropertyDef'{property_name = Name, property_value = Value, property_mode = Mode}] - Name = string() - Value = #any - Mode = normal | read_only | fixed_normal | fixed_readonly | undefined - Reply = {'EXCEPTION', #CosPropertyService_ConstraintNotSupported{}} | PropertySetDef - PropertySetDef = #objref - - -

This operation creates a new PropertySetDef with specific - constraints. PropertyTypes states allowed TypeCode's and PropertyDefs valid - CosPropertyService::PropertyDef data.

-
-
- - create_initial_propertysetdef(Factory, PropertyDefs) -> Reply - Create a new PropertySetDefwith specified initial properties - - Factory = PropertySetDef = #objref - PropertyDefs = [#'CosPropertyService_PropertyDef'{property_name = Name, property_value = Value, property_mode = Mode}] - Name = string() - Value = #any - Mode = normal | read_only | fixed_normal | fixed_readonly | undefined - Reply = {'EXCEPTION', #CosPropertyService_MultipleExceptions{exceptions = Excs}} | PropertySetDef - Excs = [#'CosPropertyService_PropertyException{reason = Reason, failing_property_name = Name}] - Reason = invalid_property_name | conflicting_property | property_not_found | unsupported_type_code | unsupported_property | unsupported_mode | fixed_property | read_only_property - PropertySetDef = #objref - - -

This operation creates a new PropertySetDef with specific - initial properties.

-
-
-
- -
- diff --git a/lib/cosProperty/doc/src/CosPropertyService_PropertySetFactory.xml b/lib/cosProperty/doc/src/CosPropertyService_PropertySetFactory.xml deleted file mode 100644 index 0aa22dd716..0000000000 --- a/lib/cosProperty/doc/src/CosPropertyService_PropertySetFactory.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosPropertyService_PropertySetFactory - - - - - - 2000-07-25 - 1.0 -
- CosPropertyService_PropertySetFactory - This module implements the OMG CosPropertyService::PropertySetFactory interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosProperty/include/CosPropertyService.hrl").

-
- - - create_propertyset(Factory) -> PropertySet - Create a new PropertySet with no predefined properties - - Factory = PropertySet = #objref - - -

This operation creates a new PropertySet with no predefined - properties.

-
-
- - create_constrained_propertyset(Factory, PropertyTypes, Properties) -> Reply - Create a new PropertySetwith specified constraints - - Factory = #objref - PropertyTypes = [CORBA::TypeCode] - Properties = [#'CosPropertyService_Property'{property_name = Name, property_value = Value}] - Name = string() - Value = #any - Reply = {'EXCEPTION', #CosPropertyService_ConstraintNotSupported{}} | PropertySet - PropertySet = #objref - - -

This operation creates a new PropertySet with specific constraints. - PropertyTypes states allowed TypeCode's and Properties valid - CosPropertyService::Property data.

-
-
- - create_initial_propertyset(Factory, Properties) -> Reply - Create a new PropertySetwith specified initial properties - - Factory = #objref - Properties = [#'CosPropertyService_Property'{property_name = Name, property_value = Value}] - Name = string() - Value = #any - Reply = {'EXCEPTION', #CosPropertyService_MultipleExceptions{exceptions = Excs}} | PropertySet - Excs = [#'CosPropertyService_PropertyException{reason = Reason, failing_property_name = Name}] - Reason = invalid_property_name | conflicting_property | property_not_found | unsupported_type_code | unsupported_property | unsupported_mode | fixed_property | read_only_property - PropertySet = #objref - - -

This operation creates a new PropertySet with specific - initial properties.

-
-
-
- -
- diff --git a/lib/cosProperty/doc/src/Makefile b/lib/cosProperty/doc/src/Makefile deleted file mode 100644 index ec11ca1735..0000000000 --- a/lib/cosProperty/doc/src/Makefile +++ /dev/null @@ -1,144 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2000-2017. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../../vsn.mk -VSN=$(COSPROPERTY_VSN) -APPLICATION=cosProperty - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN) - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -XML_APPLICATION_FILES = ref_man.xml -XML_REF3_FILES = \ - cosProperty.xml \ - CosPropertyService_PropertySetFactory.xml \ - CosPropertyService_PropertySetDefFactory.xml \ - CosPropertyService_PropertySet.xml \ - CosPropertyService_PropertySetDef.xml \ - CosPropertyService_PropertiesIterator.xml \ - CosPropertyService_PropertyNamesIterator.xml - -XML_REF6_FILES = - -XML_PART_FILES = \ - part.xml -XML_CHAPTER_FILES = \ - ch_contents.xml \ - ch_introduction.xml \ - ch_install.xml \ - ch_example.xml \ - notes.xml - -BOOK_FILES = book.xml - -XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \ - $(XML_PART_FILES) $(XML_CHAPTER_FILES) - -TECHNICAL_DESCR_FILES = - -GIF_FILES = - -PS_FILES = - -# ---------------------------------------------------- - -INTERNAL_HTML_FILES = $(TECHNICAL_DESCR_FILES:%.xml=$(HTMLDIR)/%.html) - -HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \ - $(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html) - -INFO_FILE = ../../info - -EXTRA_FILES = \ - $(DEFAULT_GIF_FILES) \ - $(DEFAULT_HTML_FILES) \ - $(XML_REF3_FILES:%.xml=$(HTMLDIR)/%.html) \ - $(XML_REF6_FILES:%.xml=$(HTMLDIR)/%.html) \ - $(XML_CHAPTER_FILES:%.xml=$(HTMLDIR)/%.html) - -MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3) -MAN6_FILES = $(XML_REF6_FILES:%.xml=$(MAN6DIR)/%.6) - -HTML_REF_MAN_FILE = $(HTMLDIR)/index.html - -TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -XML_FLAGS += -DVIPS_FLAGS += - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -$(HTMLDIR)/%.gif: %.gif - $(INSTALL_DATA) $< $@ - -docs: pdf html man - -$(TOP_PDF_FILE): $(XML_FILES) - -pdf: $(TOP_PDF_FILE) - -html: gifs $(HTML_REF_MAN_FILE) - -clean clean_docs: - rm -rf $(HTMLDIR)/* - rm -f $(MAN3DIR)/* - rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) - rm -f errs core *~ - -man: $(MAN3_FILES) $(MAN6_FILES) - -gifs: $(GIF_FILES:%=$(HTMLDIR)/%) - -$(INDEX_TARGET): $(INDEX_SRC) - sed -e 's;%VSN%;$(VSN);' $(INDEX_SRC) > $(INDEX_TARGET) - -debug opt: - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_docs_spec: docs - $(INSTALL_DIR) "$(RELSYSDIR)/doc/pdf" - $(INSTALL_DATA) $(TOP_PDF_FILE) "$(RELSYSDIR)/doc/pdf" - $(INSTALL_DIR) "$(RELSYSDIR)/doc/html" - $(INSTALL_DATA) $(HTMLDIR)/* \ - "$(RELSYSDIR)/doc/html" - $(INSTALL_DATA) $(INFO_FILE) "$(RELSYSDIR)" - $(INSTALL_DIR) "$(RELEASE_PATH)/man/man3" - $(INSTALL_DATA) $(MAN3DIR)/* "$(RELEASE_PATH)/man/man3" - -release_spec: diff --git a/lib/cosProperty/doc/src/book.xml b/lib/cosProperty/doc/src/book.xml deleted file mode 100644 index 9ee681b057..0000000000 --- a/lib/cosProperty/doc/src/book.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosProperty - Niclas Eklund - - 2000-06-07 - 1.0 -
- - - cosProperty - - - - - - - - - - - - - - -
- diff --git a/lib/cosProperty/doc/src/ch_contents.xml b/lib/cosProperty/doc/src/ch_contents.xml deleted file mode 100644 index 5c3112a644..0000000000 --- a/lib/cosProperty/doc/src/ch_contents.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - The cosProperty Application - Niclas Eklund - - 2000-06-07 - 1.0 - ch_contents.xml -
- -
- Content Overview -

The cosProperty documentation is divided into three sections: -

- - -

PART ONE - The User's Guide -

-Description of the cosProperty Application including - services and a small tutorial demonstrating - the development of a simple service.

-
- -

PART TWO - Release Notes -

-A concise history of cosProperty.

-
- -

PART THREE - The Reference Manual -

- A quick reference guide, including a - brief description, to all the functions available in cosProperty.

-
-
-
- -
- Brief description of the User's Guide -

The User's Guide contains the following parts:

- - -

cosProperty overview

-
- -

cosProperty installation

-
- -

A tutorial example

-
-
-
-
- diff --git a/lib/cosProperty/doc/src/ch_example.xml b/lib/cosProperty/doc/src/ch_example.xml deleted file mode 100644 index da13af2312..0000000000 --- a/lib/cosProperty/doc/src/ch_example.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosProperty Examples - Niclas Eklund - - 2000-06-07 - A - ch_example.xml -
- -
- A tutorial on how to create a simple service - -
- Initiate the application -

To use the cosProperty application Orber must be running.

-
- -
- How to run everything -

Below is a short transcript on how to run cosProperty.

- - -%% Start Mnesia and Orber -mnesia:delete_schema([node()]), -mnesia:create_schema([node()]), -orber:install([node()]), -mnesia:start(), -orber:start(), - -%% Install Property Service in the IFR. -cosProperty:install(), - -%% Install Property Service in mnesia. -cosProperty:install_db(), - -%% Now start the application. -cosProperty:start(), - -%% To be able to create Property objects we must first a Factory -%% of our preferred type. -Fac = cosProperty:start_SetDefFactory(), - -%% Now we can create a Property object. -'CosPropertyService_PropertySetDefFactory': - create_propertysetdef(Fac), - -%% Now we can create any allowed properties. There are many -%% options which are all described further in the documentation. - -
-
-
- diff --git a/lib/cosProperty/doc/src/ch_install.xml b/lib/cosProperty/doc/src/ch_install.xml deleted file mode 100644 index a1aa2914b4..0000000000 --- a/lib/cosProperty/doc/src/ch_install.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Installing cosProperty - Niclas Eklund - - 2000-06-07 - - ch-install.xml -
- -
- Installation Process -

This chapter describes how to install - cosProperty in an Erlang Environment. -

- -
- Preparation -

Before starting the installation process for cosProperty, - the application Orber must be running.

-
- -
- Configuration -

First the cosProperty application must be installed by using - cosProperty:install() and, if requested, cosProperty:install_db(), - followed by cosProperty:start(). - Now we can start the desired Factory type by using either - cosProperty:start_SetFactory() or - cosProperty:start_SetDefFactory().

-
-
-
- diff --git a/lib/cosProperty/doc/src/ch_introduction.xml b/lib/cosProperty/doc/src/ch_introduction.xml deleted file mode 100644 index 03ef6f619c..0000000000 --- a/lib/cosProperty/doc/src/ch_introduction.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Introduction to cosProperty - Niclas Eklund - - 2000-06-07 - - ch_introduction.xml -
- -
- Overview -

The cosProperty application is compliant with the OMG - Service CosProperty Service. -

- -
- Purpose and Dependencies -

cosProperty is dependent on Orber, which provides CORBA functionality in an Erlang environment.

-
- -
- Prerequisites -

To fully understand the concepts presented in the - documentation, it is recommended that the user is familiar - with distributed programming, CORBA and the Orber application. -

-

Recommended reading includes CORBA, Fundamentals and Programming - Jon Siegel and Open Telecom Platform Documentation Set. It is also helpful to have read Concurrent Programming in Erlang.

-
-
-
- diff --git a/lib/cosProperty/doc/src/cosProperty.xml b/lib/cosProperty/doc/src/cosProperty.xml deleted file mode 100644 index d9310b3113..0000000000 --- a/lib/cosProperty/doc/src/cosProperty.xml +++ /dev/null @@ -1,150 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosProperty - - - - 2000-06-07 - PA1 -
- cosProperty - The main module of the cosProperty application - -

To get access to the record definitions for the structures use:

--include_lib("cosProperty/include/*.hrl").

-

This module contains the functions for starting and stopping the application.

-
- - - install() -> Return - Install the cosProperty application in the IFR - - Return = ok | {'EXIT', Reason} - - -

This operation installs the cosProperty application in the IFR.

-
-
- - install_db() -> Return - Install data in mnesia necessary for running the cosProperty application - - Return = ok | {'EXIT', Reason} - - -

This operation installs data in mnesia necessary for running the - cosProperty application.

-
-
- - uninstall() -> Return - Remove all data in the IFR related to the cosProperty application - - Return = ok | {'EXIT', Reason} - - -

This operation removes all data in the IFR related to the cosProperty - application.

-
-
- - uninstall_db() -> Return - Remove all data from mnesia related to the cosProperty application - - Return = ok | {'EXIT', Reason} - - -

This operation removes all data from mnesia related to the cosProperty - application.

-
-
- - start() -> Return - Start the cosProperty application - - Return = ok | {error, Reason} - - -

This operation starts the cosProperty application.

-
-
- - start_SetDefFactory() -> Return - Start a PropertySetDef Factory - - Return = Factory | {'EXCEPTION', E} - Factory = CosPropertyService::PropertySetDefFactory reference. - - -

This operation starts a PropertySetDef Factory.

-
-
- - start_SetFactory() -> Return - Start a PropertySet Factory - - Return = Factory | {'EXCEPTION', E} - Factory = CosPropertyService::PropertySetDefFactory reference. - - -

This operation starts a PropertySet Factory.

-
-
- - stop_SetDefFactory(Factory) -> Return - Stop the given PropertySetDef Factory - - Factory = CosPropertyService::PropertySetDefFactory reference. - Return = ok | {'EXCEPTION', E} - - -

This operation stops the supplied PropertySetDef Factory.

-
-
- - stop_SetFactory(Factory) -> Return - Stop the given PropertySet Factory - - Factory = CosPropertyService::PropertySetFactory reference. - Return = ok | {'EXCEPTION', E} - - -

This operation stops the supplied PropertySet Factory.

-
-
- - stop() -> Return - Stop the cosProperty application - - Return = ok | {error, Reason} - - -

This operation stops the cosProperty application.

-
-
-
- -
- diff --git a/lib/cosProperty/doc/src/notes.xml b/lib/cosProperty/doc/src/notes.xml deleted file mode 100644 index 4de246de67..0000000000 --- a/lib/cosProperty/doc/src/notes.xml +++ /dev/null @@ -1,377 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosProperty Release Notes - - - - - 2000-06-07 - A - notes.xml -
- - -
cosProperty 1.2.3 - -
Fixed Bugs and Malfunctions - - -

Removed all old unused files in the documentation. -

-

- Own Id: OTP-14475 Aux Id: ERL-409, PR-1493

-
-
-
- -
- -
cosProperty 1.2.2 - -
Improvements and New Features - - -

- Fix dialyzer warnings.

-

- Own Id: OTP-14006

-
-
-
- -
- -
cosProperty 1.2.1 - -
Improvements and New Features - - -

- Internal changes

-

- Own Id: OTP-13551

-
-
-
- -
- -
cosProperty 1.2 - -
Improvements and New Features - - -

Remove the usage of erlang:now() from all Corba - applications and use the new rand module instead of - random.

-

- Own Id: OTP-12687

-
-
-
- -
- -
cosProperty 1.1.17 - -
Improvements and New Features - - -

The default encoding of Erlang files has been changed - from ISO-8859-1 to UTF-8.

The encoding of XML - files has also been changed to UTF-8.

-

- Own Id: OTP-10907

-
-
-
- -
- -
cosProperty 1.1.16 - -
Improvements and New Features - - -

- Misc build updates

-

- Own Id: OTP-10784

-
-
-
- -
- -
cosProperty 1.1.15 - -
Improvements and New Features - - -

Erlang/OTP can now be built using parallel make if you - limit the number of jobs, for instance using 'make - -j6' or 'make -j10'. 'make -j' does not - work at the moment because of some missing - dependencies.

-

- Own Id: OTP-9451

-
-
-
- -
- -
- cosProperty 1.1.14 - -
- Improvements and New Features - - -

- Removed superfluous usage of shy in the documentation since it can cause problem if - a buggy tool is used.

-

- Own Id: OTP-9319 Aux Id:

-
-
-
-
- -
- cosProperty 1.1.13 - -
- Improvements and New Features - - -

Eliminated Dialyzer warnings when using exit or throw.

-

Own id: OTP-9050 Aux Id:

-
-
-
-
- -
- cosProperty 1.1.12 - -
- Fixed Bugs and Malfunctions - - -

Test suites published.

-

Own id: OTP-8543 Aux Id:

-
-
-
-
- -
- cosProperty 1.1.11 - -
- Fixed Bugs and Malfunctions - - -

The documentation EIX file was not generated.

-

Own id: OTP-8355 Aux Id:

-
-
-
-
- -
- cosProperty 1.1.10 - -
- Improvements and New Features - - -

- The documentation is now built with open source tools (xsltproc and fop) - that exists on most platforms. One visible change is that the frames are removed.

-

- Own Id: OTP-8201 Aux Id:

-
-
-
-
- -
- cosProperty 1.1.9 - -
- Improvements and New Features - - -

Obsolete guards, e.g. record vs is_record, has been changed - to avoid compiler warnings.

-

Own id: OTP-7987

-
-
-
-
- -
- cosProperty 1.1.8 -
- Improvements and New Features - - -

Updated file headers.

-

Own id: OTP-7837

-
-
-
-
- -
- cosProperty 1.1.7 -
- Improvements and New Features - - -

Documentation source included in open source releases.

-

Own id: OTP-7595

-
-
-
-
- -
- cosProperty 1.1.6 -
- Improvements and New Features - - -

Updated file headers.

-

Own id: OTP-7011

-
-
-
-
- -
- cosProperty 1.1.5 -
- Improvements and New Features - - -

The documentation source has been converted from SGML to XML.

-

Own Id: OTP-6754 Aux Id:

-
-
-
-
- -
- cosProperty 1.1.4 -
- Improvements and New Features - - -

Minor Makefile changes.

-

Own Id: OTP-6701 Aux Id:

-
-
-
-
- -
- cosProperty 1.1.3 - -
- Fixed Bugs and Malfunctions - - -

The appup source file was missing a trailing newline.

-

Own id: OTP-6626

-
-
-
-
- -
- cosProperty 1.1.2 - -
- Improvements and New Features - - -

Removed some unused code.

-

Own Id: OTP-6527 Aux Id:

-
-
-
-
- -
- cosProperty 1.1.1 - -
- Fixed Bugs and Malfunctions - - -

The app-file contained duplicated modules.

-

Own id: OTP-4976

-
-
-
-
- -
- cosProperty 1.1 - -
- Improvements and New Features - - -

The stub/skeleton-files generated by IC have been improved, - i.e., depending on the IDL-files, reduced the size of the - erl- and beam-files and decreased dependencies off Orber's - Interface Repository. It is necessary to re-compile all IDL-files - and use COS-applications, including Orber, compiled with - IC-4.2.

-

Own id: OTP-4576

-
-
-
-
- -
- cosProperty 1.0.1 - -
- Improvements and New Features - - -

First release of the cosProperty application.

-

Own Id: -

-
-
-
-
-
- diff --git a/lib/cosProperty/doc/src/part.xml b/lib/cosProperty/doc/src/part.xml deleted file mode 100644 index 9d28c6dda4..0000000000 --- a/lib/cosProperty/doc/src/part.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosProperty User's Guide - Niclas Eklund - - 2000-06-07 - 1.0 -
- -

The cosProperty Application is an Erlang implementation of the OMG - CORBA Property Service.

-
- - - - -
- diff --git a/lib/cosProperty/doc/src/ref_man.xml b/lib/cosProperty/doc/src/ref_man.xml deleted file mode 100644 index a315c0285f..0000000000 --- a/lib/cosProperty/doc/src/ref_man.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosProperty Reference Manual - Niclas Eklund - - 2000-06-07 - 1.0 -
- -

The cosProperty Application is an Erlang implementation of the OMG - CORBA Property Service.

-
- - - - - - - -
- diff --git a/lib/cosProperty/ebin/.gitignore b/lib/cosProperty/ebin/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosProperty/examples/.gitignore b/lib/cosProperty/examples/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosProperty/include/.gitignore b/lib/cosProperty/include/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosProperty/info b/lib/cosProperty/info deleted file mode 100644 index 67c56e92ed..0000000000 --- a/lib/cosProperty/info +++ /dev/null @@ -1,2 +0,0 @@ -group: orb -short: Orber OMG Property Service diff --git a/lib/cosProperty/priv/.gitignore b/lib/cosProperty/priv/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosProperty/src/CosProperty.cfg b/lib/cosProperty/src/CosProperty.cfg deleted file mode 100644 index f10bf843d6..0000000000 --- a/lib/cosProperty/src/CosProperty.cfg +++ /dev/null @@ -1,5 +0,0 @@ -{this, "CosPropertyService::PropertySet"}. -{this, "CosPropertyService::PropertySetDef"}. -{this, "CosPropertyService::PropertySetDefFactory"}. -{this, "CosPropertyService::PropertySetFactory"}. - diff --git a/lib/cosProperty/src/CosProperty.idl b/lib/cosProperty/src/CosProperty.idl deleted file mode 100644 index 156fb37ccc..0000000000 --- a/lib/cosProperty/src/CosProperty.idl +++ /dev/null @@ -1,192 +0,0 @@ -#ifndef _COSPROPERTY_IDL -#define _COSPROPERTY_IDL - -#pragma prefix "omg.org" - -module CosPropertyService { - /*****************************************************/ - /* Data Types */ - /*****************************************************/ - typedef string PropertyName; - - struct Property { - PropertyName property_name; - any property_value; - }; - - enum PropertyModeType { - normal, read_only, fixed_normal, fixed_readonly, undefined }; - - struct PropertyDef { - PropertyName property_name; - any property_value; - PropertyModeType property_mode; - }; - - struct PropertyMode { - PropertyName property_name; - PropertyModeType property_mode; - }; - - typedef sequence PropertyNames; - typedef sequence Properties; - typedef sequence PropertyDefs; - typedef sequence PropertyModes; - typedef sequence PropertyTypes; - - interface PropertyNamesIterator; - interface PropertiesIterator; - interface PropertySetFactory; - interface PropertySetDef; - interface PropertySet; - - /*****************************************************/ - /* Exceptions */ - /*****************************************************/ - exception ConstraintNotSupported{}; - exception InvalidPropertyName {}; - exception ConflictingProperty {}; - exception PropertyNotFound {}; - exception UnsupportedTypeCode {}; - exception UnsupportedProperty {}; - exception UnsupportedMode {}; - exception FixedProperty {}; - exception ReadOnlyProperty {}; - - enum ExceptionReason { invalid_property_name, conflicting_property, - property_not_found, unsupported_type_code, - unsupported_property, unsupported_mode, - fixed_property, read_only_property }; - - struct PropertyException { - ExceptionReason reason; - PropertyName failing_property_name; - }; - - typedef sequence PropertyExceptions; - exception MultipleExceptions { PropertyExceptions exceptions; }; - - /*****************************************************/ - /* Interface Definitions */ - /*****************************************************/ - interface PropertySetFactory { - PropertySet create_propertyset(); - - PropertySet create_constrained_propertyset( in PropertyTypes allowed_property_types, - in Properties allowed_properties) - raises(ConstraintNotSupported); - - PropertySet create_initial_propertyset( in Properties initial_properties) - raises(MultipleExceptions); }; - - /*---------------------------------------------------*/ - interface PropertySetDefFactory { - PropertySetDef create_propertysetdef(); - - PropertySetDef create_constrained_propertysetdef( in PropertyTypes allowed_property_types, - in PropertyDefs allowed_property_defs) - raises(ConstraintNotSupported); - - PropertySetDef create_initial_propertysetdef( in PropertyDefs initial_property_defs) - raises(MultipleExceptions); - }; - - /*---------------------------------------------------*/ - interface PropertySet { - /* Support for defining and modifying properties */ - void define_property( in PropertyName property_name, in any property_value) - raises(InvalidPropertyName, ConflictingProperty, UnsupportedTypeCode, - UnsupportedProperty, ReadOnlyProperty); - - void define_properties( in Properties nproperties) - raises(MultipleExceptions); - - /* Support for Getting Properties and their Names */ - unsigned long get_number_of_properties(); - - void get_all_property_names( in unsigned long how_many, - out PropertyNames property_names, - out PropertyNamesIterator rest); - - any get_property_value( in PropertyName property_name) - raises(PropertyNotFound, InvalidPropertyName); - - boolean get_properties( in PropertyNames property_names, - out Properties nproperties); - - void get_all_properties( in unsigned long how_many, - out Properties nproperties, - out PropertiesIterator rest); - - /* Support for Deleting Properties */ - void delete_property( in PropertyName property_name) - raises(PropertyNotFound, InvalidPropertyName, FixedProperty); - - void delete_properties( in PropertyNames property_names) - raises(MultipleExceptions); - - boolean delete_all_properties(); - - /* Support for Existence Check */ - boolean is_property_defined( in PropertyName property_name) - raises(InvalidPropertyName); - }; - - /*---------------------------------------------------*/ - interface PropertySetDef:PropertySet { - /* Support for retrieval of PropertySet constraints*/ - void get_allowed_property_types( out PropertyTypes property_types); - - void get_allowed_properties( out PropertyDefs property_defs); - - /* Support for defining and modifying properties */ - void define_property_with_mode( in PropertyName property_name, - in any property_value, - in PropertyModeType property_mode) - raises(InvalidPropertyName, ConflictingProperty, UnsupportedTypeCode, - UnsupportedProperty, UnsupportedMode, ReadOnlyProperty); - - void define_properties_with_modes( in PropertyDefs property_defs) - raises(MultipleExceptions); - - /* Support for Getting and Setting Property Modes */ - PropertyModeType get_property_mode( in PropertyName property_name) - raises(PropertyNotFound, InvalidPropertyName); - - boolean get_property_modes( in PropertyNames property_names, - out PropertyModes property_modes); - - void set_property_mode( in PropertyName property_name, - in PropertyModeType property_mode) - raises(InvalidPropertyName, PropertyNotFound, UnsupportedMode); - - void set_property_modes( in PropertyModes property_modes) - raises(MultipleExceptions); - }; - - /*---------------------------------------------------*/ - interface PropertyNamesIterator{ - void reset(); - - boolean next_one( out PropertyName property_name); - - boolean next_n ( in unsigned long how_many, - out PropertyNames property_names); - - void destroy(); - }; - - /*---------------------------------------------------*/ - interface PropertiesIterator { - void reset(); - - boolean next_one( out Property aproperty); - - boolean next_n( in unsigned long how_many, - out Properties nproperties); - - void destroy(); - }; -}; - -#endif diff --git a/lib/cosProperty/src/CosPropertyService_PropertiesIterator_impl.erl b/lib/cosProperty/src/CosPropertyService_PropertiesIterator_impl.erl deleted file mode 100644 index 5972e8f4d2..0000000000 --- a/lib/cosProperty/src/CosPropertyService_PropertiesIterator_impl.erl +++ /dev/null @@ -1,167 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosPropertyService_PropertiesIterator_impl.erl -%% Description : -%% -%%---------------------------------------------------------------------- --module('CosPropertyService_PropertiesIterator_impl'). - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). --include("CosPropertyService.hrl"). --include("cosProperty.hrl"). - - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- -%% Mandatory server functions --export([init/1, - terminate/2, - code_change/3]). - --export([reset/1, - next_one/1, - next_n/2, - destroy/1]). - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- --export([ - ]). - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {properties, counter=1, length}). - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- --define(CreateInitState(L), #state{properties = L, length = length(L)}). --define(get_Properties(S), S#state.properties). --define(get_Counter(S), S#state.counter). --define(get_Length(S), S#state.length). - --define(set_Properties(S, P), S#state{properties = P}). --define(set_Counter(S, C), S#state{counter = C}). --define(set_Length(S, L), S#state{length = L}). - --define(increment_Counter(S), S#state{counter = S#state.counter+1}). --define(decrement_Counter(S), S#state{counter = S#state.counter-1}). --define(addto_Counter(S, N), S#state{counter = S#state.counter+N}). --define(subfrom_Counter(S, N), S#state{counter = S#state.counter-N}). - - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Description: Initiates the server -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%%---------------------------------------------------------------------- -init(Properties) -> - {ok, ?CreateInitState(Properties)}. - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Description: Shutdown the server -%% Returns : any (ignored by gen_server) -%%---------------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -%%---------------------------------------------------------------------- -%% Function : code_change/3 -%% Description: Convert process state when code is changed -%% Returns : {ok, NewState} -%%---------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%---------------------------------------------------------------------% -%% Function : reset -%% Arguments : - -%% Description: -%% Returns : {ok, NewState} -%%---------------------------------------------------------------------- -reset(State) -> - {reply, ok, ?set_Counter(State, 1)}. - -%%---------------------------------------------------------------------- -%% Function : next_one -%% Arguments : - -%% Description: -%% Returns : {ok, {bool(), PropertyList}, NewState} -%%---------------------------------------------------------------------- -next_one(State) when ?get_Counter(State) > ?get_Length(State) -> - {reply, {false, - #'CosPropertyService_Property' - {property_name = "", - property_value = any:create(orber_tc:null(), null)}}, - State}; -next_one(State) -> - {reply, {true, lists:nth(?get_Counter(State), ?get_Properties(State))}, - ?set_Counter(State, 1+?get_Counter(State))}. - -%%---------------------------------------------------------------------- -%% Function : next_n -%% Arguments : N - how many properties we should return. -%% Description: -%% Returns : {ok, {bool(), PropertyList}, NewState} -%%---------------------------------------------------------------------- -next_n(State, N) -> - case lists:sublist(?get_Properties(State), - ?get_Counter(State), - N) of - Properties when N+?get_Counter(State) < ?get_Length(State) -> - {reply, {true, Properties}, ?set_Counter(State, N+?get_Counter(State))}; - Properties -> - {reply, {false, Properties}, ?set_Counter(State, ?get_Length(State))} - end. - -%%---------------------------------------------------------------------% -%% Function : destroy -%% Arguments : - -%% Description: Terminate the object -%% Returns : {ok, NewState} -%%---------------------------------------------------------------------- -destroy(State) -> - {stop, normal, ok, State}. - -%%====================================================================== -%% Internal functions -%%===================================================================== - -%%====================================================================== -%% END OF MODULE -%%====================================================================== - diff --git a/lib/cosProperty/src/CosPropertyService_PropertyNamesIterator_impl.erl b/lib/cosProperty/src/CosPropertyService_PropertyNamesIterator_impl.erl deleted file mode 100644 index 7ce4f6b303..0000000000 --- a/lib/cosProperty/src/CosPropertyService_PropertyNamesIterator_impl.erl +++ /dev/null @@ -1,159 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosPropertyService_PropertyNamesIterator_impl.erl -%% Description : -%% -%%---------------------------------------------------------------------- --module('CosPropertyService_PropertyNamesIterator_impl'). - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). --include("CosPropertyService.hrl"). --include("cosProperty.hrl"). - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- -%% Mandatory server functions --export([init/1, - terminate/2, - code_change/3]). - --export([reset/1, - next_one/1, - next_n/2, - destroy/1]). - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- --export([ - ]). - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {properties, counter=1, length}). - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- --define(CreateInitState(L), #state{properties = L, length = length(L)}). --define(get_Properties(S), S#state.properties). --define(get_Counter(S), S#state.counter). --define(get_Length(S), S#state.length). - --define(set_Properties(S, P), S#state{properties = P}). --define(set_Counter(S, C), S#state{counter = C}). --define(set_Length(S, L), S#state{length = L}). - --define(increment_Counter(S), S#state{counter = S#state.counter+1}). --define(decrement_Counter(S), S#state{counter = S#state.counter-1}). --define(addto_Counter(S, N), S#state{counter = S#state.counter+N}). --define(subfrom_Counter(S, N), S#state{counter = S#state.counter-N}). - - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Description: Initiates the server -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%%---------------------------------------------------------------------- -init(Properties) -> - {ok, ?CreateInitState(Properties)}. - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Description: Shutdown the server -%% Returns : any (ignored by gen_server) -%%---------------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -%%---------------------------------------------------------------------- -%% Function : code_change/3 -%% Description: Convert process state when code is changed -%% Returns : {ok, NewState} -%%---------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%---------------------------------------------------------------------% -%% Function : reset -%% Arguments : - -%% Description: -%% Returns : {ok, NewState} -%%---------------------------------------------------------------------- -reset(State) -> - {reply, ok, ?set_Counter(State, 1)}. - -%%---------------------------------------------------------------------% -%% Function : next_one -%% Arguments : - -%% Description: -%% Returns : {ok, {bool(), PropertyName}, NewState} -%%---------------------------------------------------------------------- -next_one(State) when ?get_Counter(State) > ?get_Length(State) -> - {reply, {false, ""}, State}; -next_one(State) -> - {reply, {true, lists:nth(?get_Counter(State), ?get_Properties(State))}, - ?set_Counter(State, 1+?get_Counter(State))}. - -%%---------------------------------------------------------------------% -%% Function : next_n -%% Arguments : N - how many properties we should return. -%% Description: -%% Returns : {ok, {bool(), PropertyNameList}, NewState} -%%---------------------------------------------------------------------- -next_n(State, N) -> - case lists:sublist(?get_Properties(State), ?get_Counter(State), N) of - Properties when N+?get_Counter(State) < ?get_Length(State) -> - {reply, {true, Properties}, ?set_Counter(State, N+?get_Counter(State))}; - Properties -> - {reply, {false, Properties}, ?set_Counter(State, ?get_Length(State))} - end. - -%%---------------------------------------------------------------------% -%% Function : destroy -%% Arguments : - -%% Description: Terminate the object -%% Returns : {ok, NewState} -%%---------------------------------------------------------------------- -destroy(State) -> - {stop, normal, ok, State}. - -%%====================================================================== -%% Internal functions -%%====================================================================== - -%%====================================================================== -%% END OF MODULE -%%====================================================================== diff --git a/lib/cosProperty/src/CosPropertyService_PropertySetDefFactory_impl.erl b/lib/cosProperty/src/CosPropertyService_PropertySetDefFactory_impl.erl deleted file mode 100644 index 722bb45eb7..0000000000 --- a/lib/cosProperty/src/CosPropertyService_PropertySetDefFactory_impl.erl +++ /dev/null @@ -1,186 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosPropertyService_PropertySetDefFactory_impl.erl -%% Description : -%% -%%---------------------------------------------------------------------- --module('CosPropertyService_PropertySetDefFactory_impl'). - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). --include("CosPropertyService.hrl"). --include("cosProperty.hrl"). - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- --export([init/1, - terminate/2, - code_change/3]). - --export([create_propertysetdef/2, - create_constrained_propertysetdef/4, - create_initial_propertysetdef/3]). - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- --export([]). - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {}). - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- --define(checkTCfun, fun(TC) -> orber_tc:check_tc(TC) end). - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%---------------------------------------------------------------------- -init([]) -> - {ok, #state{}}. - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Returns : any (ignored by gen_server) -%% Description: Shutdown the server -%%---------------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -%%---------------------------------------------------------------------- -%% Function : code_change/3 -%% Returns : {ok, NewState} -%% Description: Convert process state when code is changed -%%---------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%---------------------------------------------------------------------% -%% Function : create_propertysetdef -%% Arguments : -%% Returns : CosPropertyService::PropertySetDef reference. -%% Description: -%%---------------------------------------------------------------------- -create_propertysetdef(_OE_This, State) -> - {reply, - 'CosPropertyService_PropertySetDef': - oe_create({normal, [], [], [], ?PropertySetDef}, [{pseudo, true}]), - State}. - -%%---------------------------------------------------------------------% -%% Function : create_constrained_propertysetdef -%% Arguments : PropTypes - list of property types. -%% PropDefs - list of property defs. -%% Returns : CosPropertyService::PropertySetDef | -%% {'EXCEPTION', CosPropertyService::ConstraintNotSupported} -%% Description: -%%---------------------------------------------------------------------- -create_constrained_propertysetdef(_OE_This, State, PropTypes, PropDefs) -> - case lists:all(?checkTCfun, PropTypes) of - true -> - crosscheckTC(PropDefs, PropTypes), - {reply, - 'CosPropertyService_PropertySetDef': - oe_create({normal, PropTypes, PropDefs, [], ?PropertySetDef}, [{pseudo, true}]), - State}; - false -> - corba:raise(#'CosPropertyService_ConstraintNotSupported'{}) - end. - -crosscheckTC([], _) -> - ok; -crosscheckTC([#'CosPropertyService_PropertyDef' - {property_name = Name, - property_value = Value, - property_mode = _Mode}|T], TCs) -> - case lists:member(any:get_typecode(Value), TCs) of - true when Name =/= "" -> - crosscheckTC(T, TCs); - _ -> - corba:raise(#'CosPropertyService_ConstraintNotSupported'{}) - end. - -%%---------------------------------------------------------------------% -%% Function : create_initial_propertysetdef -%% Arguments : -%% Returns : CosPropertyService::PropertySetDef | -%% {'EXCEPTION', CosPropertyService::MultipleExceptions} -%% Description: -%%---------------------------------------------------------------------- -create_initial_propertysetdef(_OE_This, State, PropDefs) -> - InitProps = evaluate_propertysetdef(PropDefs), - {reply, - 'CosPropertyService_PropertySetDef': - oe_create({normal, [], [], InitProps, ?PropertySetDef}, [{pseudo, true}]), - State}. - -%%====================================================================== -%% Internal functions -%%====================================================================== -evaluate_propertysetdef(SetDefs) -> - case evaluate_propertysetdef(SetDefs, [], []) of - {ok, NewProperties} -> - NewProperties; - {error, Exc} -> - corba:raise(#'CosPropertyService_MultipleExceptions'{exceptions = Exc}) - end. - -evaluate_propertysetdef([], NewProperties, []) -> - %% No exceptions found. - {ok, NewProperties}; -evaluate_propertysetdef([], _, Exc) -> - {error, Exc}; -evaluate_propertysetdef([#'CosPropertyService_PropertyDef' - {property_name = Name, - property_value = Value, - property_mode = Mode}|T], X, Exc) -> - case orber_tc:check_tc(any:get_typecode(Value)) of - true -> - evaluate_propertysetdef(T, [{Name, Value, Mode}|X], Exc); - false -> - evaluate_propertysetdef(T, X, [#'CosPropertyService_PropertyException' - {reason = unsupported_type_code, - failing_property_name = Name}|Exc]) - end. - - - -%%====================================================================== -%% END OF MODULE -%%====================================================================== - diff --git a/lib/cosProperty/src/CosPropertyService_PropertySetDef_impl.erl b/lib/cosProperty/src/CosPropertyService_PropertySetDef_impl.erl deleted file mode 100644 index cc67daa9e0..0000000000 --- a/lib/cosProperty/src/CosPropertyService_PropertySetDef_impl.erl +++ /dev/null @@ -1,1042 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2017. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: CosPropertyService_PropertySetDef_impl.erl -%% Modified: -%% -%%----------------------------------------------------------------- -%% README: -%% (1) The OMG specification states that a property name may not -%% be an empty string (""). We may restrict this further -%% but there is no reason for that. -%%----------------------------------------------------------------- --module('CosPropertyService_PropertySetDef_impl'). - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). --include_lib("cosProperty/include/CosPropertyService.hrl"). --include("cosProperty.hrl"). - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- -%% Mandatory callbacks --export([init/1, - terminate/2, - code_change/3]). - -%% Inherrit from CosPropertyService::PropertySet --export([define_property/4, - define_properties/3, - get_number_of_properties/2, - get_all_property_names/3, - get_property_value/3, - get_properties/3, - get_all_properties/3, - delete_property/3, - delete_properties/3, - delete_all_properties/2, - is_property_defined/3]). - -%% CosPropertyService::PropertySetDef --export([get_allowed_property_types/2, - get_allowed_properties/2, - define_property_with_mode/5, - define_properties_with_modes/3, - get_property_mode/3, - get_property_modes/3, - set_property_mode/4, - set_property_modes/3]). - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- --export([dump/0]). - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {dbKey, defaultMode, okTypes, okProperties, myType}). - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- - --define(create_InitState(K, D, AT, AP, MT), #state{dbKey = K, defaultMode = D, - okTypes = AT, okProperties = AP, - myType = MT}). -%% Selectors --define(get_DBKey(S), S#state.dbKey). --define(get_DefaultMode(S), S#state.defaultMode). --define(get_okTypes(S), S#state.okTypes). --define(get_okProperties(S), S#state.okProperties). -%% MISC --define(is_NotSetDef(S), S#state.myType =/= ?PropertySetDef). --define(no_PropertyLimits(S), S#state.okProperties == []). --define(no_TypeLimits(S), S#state.okTypes == []). --define(is_NotStatic(S), is_binary(S#state.dbKey)). - -%% Fun:s --define(Local2Property, fun({N,V,_M}) -> - #'CosPropertyService_Property'{property_name = N, - property_value = V} - end). --define(Local2Names, fun({N,_V,_M}) -> - N - end). --define(MemberName(N), fun(R) -> - case R of - Property when is_record(R, 'CosPropertyService_Property') -> - Property#'CosPropertyService_Property'.property_name == N; - PropertyDef when is_record(R, 'CosPropertyService_PropertyDef') -> - PropertyDef#'CosPropertyService_PropertyDef'.property_name == N; - _-> - false - end - end). - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Description: Initiates the server -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%%---------------------------------------------------------------------- -init({DefMode, AllowedTypes, AllowedProperties, InitProperties, MyType}) -> - Key = term_to_binary({{erlang:system_time(), - erlang:unique_integer()}, - node()}), - _F = ?write_function(#oe_CosPropertyService{key=Key, - properties=InitProperties}), - write_result(mnesia:transaction(_F)), - {ok, ?create_InitState(Key, DefMode, AllowedTypes, AllowedProperties, MyType)}; -init({static, DefMode, AllowedTypes, AllowedProperties, InitProperties, MyType}) -> - {ok, ?create_InitState(InitProperties, DefMode, AllowedTypes, - AllowedProperties, MyType)}. - -%%---------------------------------------------------------------------% -%% Function : terminate -%% Description: Shutdown the server -%% Returns : any (ignored by gen_server) -%%---------------------------------------------------------------------- -terminate(_Reason, State) when ?is_NotStatic(State) -> - _DF = ?delete_function({oe_CosPropertyService, ?get_DBKey(State)}), - catch write_result(mnesia:transaction(_DF)), - ok; -terminate(_Reason, _State) -> - ok. - -%%---------------------------------------------------------------------% -%% Function : code_change -%% Description: Convert process state when code is changed -%% Returns : {ok, State} -%%---------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - - -%%---------------------------------------------------------------------- -%% Interface CosPropertyService::PropertySet -%%---------------------------------------------------------------------- -%%---------------------------------------------------------------------% -%% Function : define_property -%% Arguments : -%% Description: -%% Returns : {ok, State} -%%---------------------------------------------------------------------- -define_property(_, _, "", _) -> - corba:raise(#'CosPropertyService_InvalidPropertyName'{}); -define_property(_OE_This, State, Name, Value) when ?is_NotStatic(State) -> - evaluate_property_data(State, Value, Name), - _DF = - fun() -> - case mnesia_read(State) of - {'EXCEPTION', E} -> - {'EXCEPTION', E}; - X -> - case catch update_property(X, Name, value, Value, - ?get_DefaultMode(State)) of - {'EXCEPTION', E} when - is_record(E, 'CosPropertyService_PropertyNotFound') -> - mnesia_write(State, [{Name, Value, ?get_DefaultMode(State)}|X]); - {'EXCEPTION', E} -> - {'EXCEPTION', E}; - NewProperties -> - mnesia_write(State, NewProperties) - end - end - end, - {reply, mnesia_transaction(_DF), State}; -define_property(_OE_This, State, Name, Value) -> - evaluate_property_data(State, Value, Name), - X = ?get_DBKey(State), - case catch update_property(X, Name, value, Value, ?get_DefaultMode(State)) of - {'EXCEPTION', E} when is_record(E, 'CosPropertyService_PropertyNotFound') -> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}); - {'EXCEPTION', E} -> - corba:raise(E); - _NewProperties -> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - - -%%---------------------------------------------------------------------% -%% Function : get_property_value -%% Arguments : -%% Description: -%% Returns : {ok, State} -%%---------------------------------------------------------------------- -get_property_value(_, _, "") -> - corba:raise(#'CosPropertyService_InvalidPropertyName'{}); -get_property_value(_OE_THIS, State, Name) -> - X = lookup_table(?get_DBKey(State)), - {reply, find_property(X, Name, value), State}. - -%%---------------------------------------------------------------------% -%% Function : delete_property -%% Arguments : -%% Description: -%% Returns : {ok, State} -%%---------------------------------------------------------------------- -delete_property(_, _, "") -> - corba:raise(#'CosPropertyService_InvalidPropertyName'{}); -delete_property(_OE_THIS, State, Name) when ?is_NotStatic(State) -> - _DF = - fun() -> - case mnesia_read(State) of - {'EXCEPTION', E} -> - {'EXCEPTION', E}; - X -> - case catch remove_property(X, Name) of - {'EXCEPTION', E} -> - {'EXCEPTION', E}; - NewProperties -> - mnesia_write(State, NewProperties) - end - end - end, - {reply, mnesia_transaction(_DF), State}; -delete_property(_OE_THIS, State, Name) -> - X = lookup_table(?get_DBKey(State)), - %% Check the properties; must raise an exception. - remove_property(X, Name), - %% Something is not correct. - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). - - -%%---------------------------------------------------------------------% -%% Function : define_properties -%% Arguments : -%% Description: -%% Returns : {ok, State} -%%---------------------------------------------------------------------- -define_properties(_OE_THIS, State, PropertySeq) when ?is_NotStatic(State) -> - {OKProperties, Exc} = evaluate_properties_data(State, PropertySeq), - _DF = - fun() -> - case mnesia_read(State) of - {'EXCEPTION', E} -> - {'EXCEPTION', E}; - X -> - case catch define_properties_helper(State, - OKProperties, X, Exc) of - {'EXCEPTION', E} -> - {'EXCEPTION', E}; - NewProperties -> - mnesia_write(State, NewProperties) - end - end - end, - {reply, mnesia_transaction(_DF), State}; -define_properties(_OE_THIS, State, PropertySeq) -> - {OKProperties, Exc} = evaluate_properties_data(State, PropertySeq), - X = lookup_table(?get_DBKey(State)), - case define_properties_helper(State, OKProperties, X, Exc) of - {'EXCEPTION', E} -> - corba:raise(E); - _ -> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -define_properties_helper(_State, [], NewProperties, []) -> - %% No exceptions, insert the properties. - NewProperties; -define_properties_helper(_State, [], _, MultipleExceptions) -> - {'EXCEPTION', #'CosPropertyService_MultipleExceptions'{exceptions = MultipleExceptions}}; -define_properties_helper(State, [#'CosPropertyService_Property' - {property_name = Name, - property_value = Value}|T], Properties, Exc) -> - case catch update_property(Properties, Name, value, Value, ?get_DefaultMode(State)) of - {'EXCEPTION', E} when is_record(E, 'CosPropertyService_PropertyNotFound') -> - define_properties_helper(State, T, [{Name, Value, ?get_DefaultMode(State)}|Properties], Exc); - {'EXCEPTION', E} -> - define_properties_helper(State, T, Properties, - [#'CosPropertyService_PropertyException' - {reason = remap_exception(E), - failing_property_name = Name}|Exc]); - NewProperties -> - define_properties_helper(State, T, NewProperties, Exc) - end. - -%%---------------------------------------------------------------------% -%% Function : get_number_of_properties -%% Arguments : - -%% Description: Returns the number of properties currently associated -%% with this object. -%% Returns : {ok, ulong(), State} -%%---------------------------------------------------------------------- -get_number_of_properties(_OE_THIS, State) -> - X = lookup_table(?get_DBKey(State)), - {reply, length(X), State}. - -%%---------------------------------------------------------------------% -%% Function : get_all_property_names -%% Arguments : -%% Description: -%% Returns : {ok, State} -%%---------------------------------------------------------------------- -get_all_property_names(_OE_THIS, State, Max) -> - X = lookup_table(?get_DBKey(State)), - {reply, get_all_property_names_helper(X, [], Max), State}. - -get_all_property_names_helper([], Acc, _) -> - %% There are no more properties; return a nil-object refernce. - {ok, Acc, corba:create_nil_objref()}; -get_all_property_names_helper(Left, Acc, 0) -> - %% There are more properties; create Name Iterartor. - PropertyNames = lists:map(?Local2Names, Left), - {ok, Acc, cosProperty:start_PropertyNamesIterator(PropertyNames)}; -get_all_property_names_helper([{Name, _, _}|T], Acc, No) -> - get_all_property_names_helper(T, [Name|Acc], No-1). - - -%%---------------------------------------------------------------------% -%% Function : get_properties -%% Arguments : A list of property names, i.e., string() -%% Description: -%% Returns : {ok, State} -%%---------------------------------------------------------------------- -get_properties(_OE_THIS, State, PropertyNames) -> - X = lookup_table(?get_DBKey(State)), - {reply, locate_names(PropertyNames, X, true, []), State}. - -locate_names([], _, AllOK, Acc) -> - {AllOK, Acc}; -locate_names([""|T], X, _AllOK, Acc) -> - locate_names(T, X, false, [#'CosPropertyService_Property' - {property_name = "", - property_value = - any:create(tk_void, ok)}|Acc]); -locate_names([H|T], X, AllOK, Acc) -> - case catch find_property(X, H, value) of - {'EXCEPTION', _} -> - locate_names(T, X, false, [#'CosPropertyService_Property' - {property_name = H, - property_value = - any:create(tk_void, ok)}|Acc]); - Val -> - locate_names(T, X, AllOK, [#'CosPropertyService_Property' - {property_name = H, - property_value = Val}|Acc]) - end. - -%%---------------------------------------------------------------------% -%% Function : get_all_properties -%% Arguments : -%% Description: -%% Returns : {ok, State} -%%---------------------------------------------------------------------- -get_all_properties(_OE_THIS, State, Max) -> - X = lookup_table(?get_DBKey(State)), - {reply, get_all_properties_helper(X, [], Max), State}. - -get_all_properties_helper([], Acc, _) -> -%% There are no more properties; return a nil-object refernce. - {ok, Acc, corba:create_nil_objref()}; -get_all_properties_helper(Left, Acc, 0) -> - %% There are more properties; create Iterartor. - Properties = lists:map(?Local2Property, Left), - {ok, Acc, cosProperty:start_PropertiesIterator(Properties)}; -get_all_properties_helper([{Name, Val, _}|T], Acc, No) -> - get_all_properties_helper(T, [#'CosPropertyService_Property' - {property_name = Name, - property_value = Val}|Acc], No-1). - -%%---------------------------------------------------------------------% -%% Function : delete_properties -%% Arguments : -%% Description: -%% Returns : {ok, State} -%%---------------------------------------------------------------------- -delete_properties(_OE_THIS, State, []) -> - {reply, ok, State}; -delete_properties(_OE_THIS, State, PropertyNames) when ?is_NotStatic(State) -> - _DF = - fun() -> - case mnesia_read(State) of - {'EXCEPTION', E} -> - {'EXCEPTION', E}; - X -> - case catch delete_properties_helper(X, [], [], - PropertyNames, State, - length(X)) of - {'EXCEPTION', E} -> - {'EXCEPTION', E}; - {{'EXCEPTION', E}, NotDeleted} -> - ok = mnesia_write(State, NotDeleted), - {'EXCEPTION', E}; - {ok, NotDeleted} -> - mnesia_write(State, NotDeleted) - end - end - end, - {reply, mnesia_transaction(_DF), State}; -delete_properties(_OE_THIS, State, PropertyNames) -> - X = lookup_table(?get_DBKey(State)), - case delete_properties_helper(X, [], [], PropertyNames, State, length(X)) of - {'EXCEPTION', E} -> - corba:raise(E); - _-> - %% Not acceptable if it was possible to delete one or more Properties. - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -delete_properties_helper([], [], NotDeleted, [], _State, _Len) -> - %% Since there are no exceptions we have been able to delete all - %% properties. - {ok, NotDeleted}; -delete_properties_helper([], MultipleExc, NotDeleted, Names, _State, Len) -> - %% Write remaining events to DB. - case length(NotDeleted) of - Len -> - {'EXCEPTION', #'CosPropertyService_MultipleExceptions' - {exceptions = add_not_found(Names, MultipleExc)}}; - _-> - {{'EXCEPTION', #'CosPropertyService_MultipleExceptions' - {exceptions = add_not_found(Names, MultipleExc)}}, - NotDeleted} - end; -delete_properties_helper([{Name, Val, Mode}|T], MultipleExc, NotDeleted, - Names, State, Len) -> - case lists:member(Name, Names) of - true when Mode =/= fixed_normal, Mode =/= fixed_readonly -> - delete_properties_helper(T, MultipleExc, NotDeleted, - lists:delete(Name, Names), State, Len); - true -> - delete_properties_helper(T, [#'CosPropertyService_PropertyException' - {reason = fixed_property, - failing_property_name = Name}|MultipleExc], - [{Name, Val, Mode}|NotDeleted], - lists:delete(Name, Names), State, Len); - false -> - delete_properties_helper(T, MultipleExc, [{Name, Val, Mode}|NotDeleted], - Names, State, Len) - end. - -add_not_found([], MultipleExc) -> - MultipleExc; -add_not_found([Name|T], MultipleExc) -> - add_not_found(T, [#'CosPropertyService_PropertyException' - {reason = property_not_found, - failing_property_name = Name}|MultipleExc]). - - - -%%---------------------------------------------------------------------% -%% Function : delete_all_properties -%% Arguments : -%% Description: -%% Returns : {ok, State} -%%---------------------------------------------------------------------- -delete_all_properties(_OE_THIS, State) when ?is_NotStatic(State) -> - _DF = - fun() -> - case mnesia_read(State) of - {'EXCEPTION', E} -> - {'EXCEPTION', E}; - X -> - case catch delete_all_properties_helper(X, [], State, - length(X)) of - {'EXCEPTION', E} -> - {'EXCEPTION', E}; - true -> - ok = mnesia_write(State, []), - true; - false -> - false; - {false, NotDeleted} -> - ok = mnesia_write(State, NotDeleted), - false - end - end - end, - {reply, mnesia_transaction(_DF), State}; -delete_all_properties(_OE_THIS, State) -> - X = lookup_table(?get_DBKey(State)), - case delete_all_properties_helper(X, [], State, length(X)) of - false -> - {reply, false, State}; - _-> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -delete_all_properties_helper([], [], _State, _) -> - %% Was able to delete all properties. - true; -delete_all_properties_helper([], NotDeleted, _State, Len) -> - %% Write remaining events to DB. - case length(NotDeleted) of - Len -> - false; - _-> - {false, NotDeleted} - end; -delete_all_properties_helper([{Name, Val, fixed_normal}|T], NotDeleted, State, Len) -> - delete_all_properties_helper(T, [{Name, Val, fixed_normal}|NotDeleted], State, Len); -delete_all_properties_helper([{Name, Val, fixed_readonly}|T], NotDeleted, State, Len) -> - delete_all_properties_helper(T, [{Name, Val, fixed_readonly}|NotDeleted], State, Len); -delete_all_properties_helper([_|T], NotDeleted, State, Len) -> - delete_all_properties_helper(T, NotDeleted, State, Len). - -%%---------------------------------------------------------------------% -%% Function : is_property_defined -%% Arguments : -%% Description: -%% Returns : {ok, State} -%%---------------------------------------------------------------------- -is_property_defined(_, _, "") -> - corba:raise(#'CosPropertyService_InvalidPropertyName'{}); -is_property_defined(_OE_THIS, State, Name) -> - X = lookup_table(?get_DBKey(State)), - {reply, lists:keymember(Name, 1, X), State}. - -%%---------------------------------------------------------------------- -%% Interface CosPropertyService::PropertySetDef -%%---------------------------------------------------------------------- -%%---------------------------------------------------------------------% -%% Function : get_allowed_property_types -%% Arguments : - -%% Description: Returns the initially supplied restrictions. An empty -%% list means no restrictions. -%% Returns : {ok, TypeCodeList,State} -%%---------------------------------------------------------------------- -get_allowed_property_types(_OE_THIS, State) when ?is_NotSetDef(State) -> - corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}); -get_allowed_property_types(_OE_THIS, State) -> - {reply, {ok, ?get_okTypes(State)}, State}. - -%%---------------------------------------------------------------------% -%% Function : get_allowed_properties -%% Arguments : -%% Description: Returns the initially supplied restrictions. An empty -%% list means no restrictions. -%% Returns : {ok, PropertyDefList, State} -%%---------------------------------------------------------------------- -get_allowed_properties(_OE_THIS, State) when ?is_NotSetDef(State) -> - corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}); -get_allowed_properties(_OE_THIS, State) -> - {reply, {ok, ?get_okProperties(State)}, State}. - -%%---------------------------------------------------------------------% -%% Function : define_property_with_mode -%% Arguments : -%% Description: -%% Returns : {ok, State} -%%---------------------------------------------------------------------- -define_property_with_mode(_OE_THIS, State, _, _, _) when ?is_NotSetDef(State) -> - corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}); -define_property_with_mode(_, _, "", _, _) -> - corba:raise(#'CosPropertyService_InvalidPropertyName'{}); -define_property_with_mode(_OE_THIS, State, Name, Value, Mode) - when ?is_NotStatic(State) -> - evaluate_property_data(State, Value, Name), - _DF = - fun() -> - case mnesia_read(State) of - {'EXCEPTION', E} -> - {'EXCEPTION', E}; - X -> - case catch update_property(X, Name, both, Value, Mode) of - {'EXCEPTION', E} - when is_record(E, 'CosPropertyService_PropertyNotFound') -> - mnesia_write(State, [{Name, Value, Mode}|X]); - {'EXCEPTION', E} -> - {'EXCEPTION', E}; - NewProperties -> - mnesia_write(State, NewProperties) - end - end - end, - {reply, mnesia_transaction(_DF), State}; -define_property_with_mode(_OE_THIS, State, Name, Value, Mode) -> - evaluate_property_data(State, Value, Name), - X = lookup_table(?get_DBKey(State)), - case catch update_property(X, Name, both, Value, Mode) of - {'EXCEPTION', E} when is_record(E, 'CosPropertyService_PropertyNotFound') -> - %% Should get not allowed exception. - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}); - {'EXCEPTION', E} -> - corba:raise(E); - _ -> - %% Should be impossible. - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%---------------------------------------------------------------------% -%% Function : define_properties_with_modes -%% Arguments : -%% Description: -%% Returns : {ok, State} -%%---------------------------------------------------------------------- -define_properties_with_modes(_OE_THIS, State, _) when ?is_NotSetDef(State) -> - corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}); -define_properties_with_modes(_OE_THIS, State, PropertyDefSeq) - when ?is_NotStatic(State)-> - {OKProperteDefs, Exc} = evaluate_properties_data(State, PropertyDefSeq), - _DF = - fun() -> - case mnesia_read(State) of - {'EXCEPTION', E} -> - {'EXCEPTION', E}; - X -> - case catch define_properties_with_modes_helper(OKProperteDefs, - X, Exc, State) of - {'EXCEPTION', E} -> - {'EXCEPTION', E}; - NewProperties -> - mnesia_write(State, NewProperties) - end - end - end, - {reply, mnesia_transaction(_DF), State}; -define_properties_with_modes(_OE_THIS, State, PropertyDefSeq) -> - {OKProperteDefs, Exc} = evaluate_properties_data(State, PropertyDefSeq), - X = lookup_table(?get_DBKey(State)), - case define_properties_with_modes_helper(OKProperteDefs, X, Exc, State) of - {'EXCEPTION', E} -> - corba:raise(E); - _ -> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - - -define_properties_with_modes_helper([], NewPropertyDefs, [], _State) -> - %% No exceptions found. - NewPropertyDefs; -define_properties_with_modes_helper([], _, Exc, _) -> - {'EXCEPTION', #'CosPropertyService_MultipleExceptions'{exceptions = Exc}}; -define_properties_with_modes_helper([#'CosPropertyService_PropertyDef' - {property_name = Name, - property_value = Value, - property_mode = Mode}|T], X, Exc, State) -> - case catch update_property(X, Name, both, Value, Mode) of - {'EXCEPTION', E} when is_record(E, 'CosPropertyService_PropertyNotFound') -> - define_properties_with_modes_helper(T, [{Name, Value, Mode}|X], Exc, State); - {'EXCEPTION', E} -> - define_properties_with_modes_helper(T, X, - [#'CosPropertyService_PropertyException' - {reason = remap_exception(E), - failing_property_name = Name}|Exc], - State); - NewX -> - define_properties_with_modes_helper(T, NewX, Exc, State) - end. - -%%---------------------------------------------------------------------% -%% Function : get_property_mode -%% Arguments : -%% Description: -%% Returns : {ok, State} -%%---------------------------------------------------------------------- -get_property_mode(_OE_THIS, State, _) when ?is_NotSetDef(State) -> - corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}); -get_property_mode(_, _, "") -> - corba:raise(#'CosPropertyService_InvalidPropertyName'{}); -get_property_mode(_OE_THIS, State, Name) -> - X = lookup_table(?get_DBKey(State)), - {reply, find_property(X, Name, mode), State}. - -%%---------------------------------------------------------------------% -%% Function : get_property_modes -%% Arguments : -%% Description: -%% Returns : {ok, State} -%%---------------------------------------------------------------------- -get_property_modes(_OE_THIS, State, _) when ?is_NotSetDef(State) -> - corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}); -get_property_modes(_OE_THIS, State, PropertyNames) -> - X = lookup_table(?get_DBKey(State)), - {reply, get_property_modes_helper(PropertyNames, X, [], true), State}. - -get_property_modes_helper([], _, Acc, Bool) -> - {Bool, Acc}; -get_property_modes_helper([""|T], Properties, Acc, _) -> - get_property_modes_helper(T, Properties, - [#'CosPropertyService_PropertyMode' - {property_name = "", - property_mode = undefined}|Acc], false); -get_property_modes_helper([Name|T], Properties, Acc, Bool) -> - case lists:keysearch(Name, 1, Properties) of - {value, {Name, _, Mode}} -> - get_property_modes_helper(T, Properties, - [#'CosPropertyService_PropertyMode' - {property_name = Name, - property_mode = Mode}|Acc], Bool); - false -> - get_property_modes_helper(T, Properties, - [#'CosPropertyService_PropertyMode' - {property_name = Name, - property_mode = undefined}|Acc], false) - end. - -%%---------------------------------------------------------------------% -%% Function : set_property_mode -%% Arguments : -%% Description: -%% Returns : {ok, State} -%%---------------------------------------------------------------------- -set_property_mode(_OE_THIS, State, _, _) when ?is_NotSetDef(State) -> - corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}); -set_property_mode(_, _, "", _) -> - corba:raise(#'CosPropertyService_InvalidPropertyName'{}); -set_property_mode(_OE_THIS, State, Name, Mode) when ?is_NotStatic(State) -> - _DF = - fun() -> - case mnesia_read(State) of - {'EXCEPTION', E} -> - {'EXCEPTION', E}; - X -> - case catch update_property(X, Name, mode, undefined, Mode) of - {'EXCEPTION', E} -> - {'EXCEPTION', E}; - NewProperties -> - mnesia_write(State, NewProperties) - end - end - end, - {reply, mnesia_transaction(_DF), State}; -set_property_mode(_OE_THIS, State, Name, Mode) -> - X = lookup_table(?get_DBKey(State)), - update_property(X, Name, mode, undefined, Mode), - %% Something is not correct, shouldn't be allowed to update a property when - %% static. - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). - -%%---------------------------------------------------------------------% -%% Function : set_property_modes -%% Arguments : -%% Description: -%% Returns : {ok, State} -%%---------------------------------------------------------------------- -set_property_modes(_OE_THIS, State, _) when ?is_NotSetDef(State) -> - corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}); -set_property_modes(_OE_THIS, State, PropertyModes) when ?is_NotStatic(State) -> - _DF = - fun() -> - case mnesia_read(State) of - {'EXCEPTION', E} -> - {'EXCEPTION', E}; - X -> - case catch set_property_modes_helper(PropertyModes, X, [], - State) of - {'EXCEPTION', E} -> - {'EXCEPTION', E}; - NewProperties -> - mnesia_write(State, NewProperties) - end - end - end, - {reply, mnesia_transaction(_DF), State}; -set_property_modes(_OE_THIS, State, PropertyModes) -> - X = lookup_table(?get_DBKey(State)), - case set_property_modes_helper(PropertyModes, X, [], State) of - {'EXCEPTION', E} -> - corba:raise(E); - _ -> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -set_property_modes_helper([], NewProperties, [], _State) -> - %% No exceptions, write to DB. - NewProperties; -set_property_modes_helper([], _, Exc, _) -> - {'EXCEPTION', #'CosPropertyService_MultipleExceptions'{exceptions = Exc}}; -set_property_modes_helper([#'CosPropertyService_PropertyMode' - {property_name = Name, - property_mode = Mode}|T], X, Exc, State) -> - case catch update_property(X, Name, mode, undefined, Mode) of - {'EXCEPTION', E} -> - set_property_modes_helper(T, X, - [#'CosPropertyService_PropertyException' - {reason = remap_exception(E), - failing_property_name = Name}|Exc], - State); - NewX -> - set_property_modes_helper(T, NewX, Exc, State) - end. - - -%%====================================================================== -%% Internal functions -%%====================================================================== - -remap_exception(#'CosPropertyService_ConflictingProperty'{}) -> conflicting_property; -remap_exception(#'CosPropertyService_FixedProperty'{}) -> fixed_property; -remap_exception(#'CosPropertyService_InvalidPropertyName'{}) -> invalid_property_name; -remap_exception(#'CosPropertyService_PropertyNotFound'{}) -> property_not_found; -remap_exception(#'CosPropertyService_UnsupportedTypeCode'{}) -> unsupported_type_code; -remap_exception(#'CosPropertyService_UnsupportedProperty'{}) -> unsupported_property; -remap_exception(#'CosPropertyService_ReadOnlyProperty'{}) -> read_only_property; -remap_exception(#'CosPropertyService_UnsupportedMode'{}) -> unsupported_mode. - -find_property([], _, _) -> - corba:raise(#'CosPropertyService_PropertyNotFound'{}); -find_property([{Name, Value, _}|_], Name, value) -> - Value; -find_property([{Name, _, Mode}|_], Name, mode) -> - Mode; -% Left out for now to avoid dialyzer warning. -%find_property([{Name, Value, Mode}|_], Name, all) -> -% {Name, Value, Mode}; -find_property([_|T], Name, Which) -> - find_property(T, Name, Which). - -remove_property(PropertList, Name) -> - remove_property(PropertList, Name, []). -remove_property([], _, _) -> - corba:raise(#'CosPropertyService_PropertyNotFound'{}); -remove_property([{Name, _, fixed_normal}|_T], Name, _) -> - corba:raise(#'CosPropertyService_FixedProperty'{}); -remove_property([{Name, _, fixed_readonly}|_T], Name, _) -> - corba:raise(#'CosPropertyService_FixedProperty'{}); -remove_property([{Name, _, _}|T], Name, Acc) -> - T++Acc; -remove_property([H|T], Name, Acc) -> - remove_property(T, Name, [H|Acc]). - - -update_property(_, "", _, _, _) -> - corba:raise(#'CosPropertyService_InvalidPropertyName'{}); -update_property(PropertyList, Name, Which, Value, Mode) -> - update_property(PropertyList, Name, Which, Value, Mode, []). - -update_property([], _, _, _, _, _) -> - corba:raise(#'CosPropertyService_PropertyNotFound'{}); -update_property([{Name, _, fixed_readonly}|_], Name, value, _, _, _) -> - corba:raise(#'CosPropertyService_FixedProperty'{}); -update_property([{Name, _, fixed_normal}|_], Name, both, _, _, _) -> - corba:raise(#'CosPropertyService_FixedProperty'{}); -update_property([{Name, _, fixed_readonly}|_], Name, both, _, _, _) -> - corba:raise(#'CosPropertyService_FixedProperty'{}); -update_property([{Name, #any{typecode = TC}, Mode}|T], Name, - value, #any{typecode = TC, value = Value}, _Mod, Acc) -> - [{Name, #any{typecode = TC, value = Value}, Mode}|T]++Acc; -update_property([{Name, #any{typecode = TC}, _Mode}|T], Name, - both, #any{typecode = TC, value = Value}, Mod, Acc) -> - [{Name, #any{typecode = TC, value = Value}, Mod}|T]++Acc; -update_property([{Name, _, _}|_], Name, value, _, _, _) -> - corba:raise(#'CosPropertyService_ConflictingProperty'{}); -update_property([{Name, _, _}|_], Name, both, _, _, _) -> - corba:raise(#'CosPropertyService_ConflictingProperty'{}); -%% Normally we don't need to raise an exception for the two following cases but -%% to be able to manage static Properties we must raise an exception. Well, -%% on the other hand, why should a user try to change a mode to the same value?! -%% But we have no other option. -update_property([{Name, _Value, fixed_normal}|_T], Name, mode, _, fixed_normal, _Acc) -> - corba:raise(#'CosPropertyService_FixedProperty'{}); -update_property([{Name, _Value, fixed_readonly}|_T], Name, mode, _, fixed_readonly, _Acc) -> - corba:raise(#'CosPropertyService_FixedProperty'{}); -update_property([{Name, _Value, fixed_normal}|_T], Name, mode, _, _Mode, _Acc) -> - corba:raise(#'CosPropertyService_UnsupportedMode'{}); -update_property([{Name, _Value, fixed_readonly}|_T], Name, mode, _, _Mode, _Acc) -> - corba:raise(#'CosPropertyService_UnsupportedMode'{}); -update_property([{Name, Value, _}|T], Name, mode, _, Mode, Acc) -> - [{Name, Value, Mode}|T]++Acc; -update_property([H|T], Name, Which, Value, Mode, Acc) -> - update_property(T, Name, Which, Value, Mode, [H|Acc]). - - -lookup_table(Key) when is_binary(Key) -> - _RF = ?read_function({oe_CosPropertyService, Key}), - case mnesia:transaction(_RF) of - {atomic, [#oe_CosPropertyService{properties=Properties}]} -> - Properties; - {atomic, []} -> - corba:raise(#'OBJECT_NOT_EXIST'{completion_status=?COMPLETED_NO}); - _Other -> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; -lookup_table(Key) when is_list(Key) -> - Key; -lookup_table(_) -> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). - -mnesia_transaction(Fun) -> - case mnesia:transaction(Fun) of - {atomic, {'EXCEPTION', E}} -> - corba:raise(E); - {atomic, ok} -> - ok; - {atomic, Reply} -> - Reply; - _Other -> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -mnesia_read(State) -> - case mnesia:wread({oe_CosPropertyService, ?get_DBKey(State)}) of - [#oe_CosPropertyService{properties = X}] -> - X; - _Other -> - {'EXCEPTION', #'INTERNAL'{completion_status=?COMPLETED_NO}} - end. - -mnesia_write(State, X) -> - mnesia:write(#oe_CosPropertyService{key = ?get_DBKey(State), properties = X}). - -%% Check a write transaction -write_result({atomic,ok}) -> ok; -write_result(_Foo) -> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). - -evaluate_properties_data(State, PropertySeq) -> - evaluate_properties_data(State, PropertySeq, [], []). - -evaluate_properties_data(_State, [], OKProperties, Exc) -> - {OKProperties, Exc}; - -evaluate_properties_data(State, [#'CosPropertyService_Property' - {property_name = Name, - property_value = Value}|T], Acc, Exc) -> - case catch evaluate_property_data(State, Value, Name) of - ok -> - evaluate_properties_data(State, T, [#'CosPropertyService_Property' - {property_name = Name, - property_value = Value}|Acc], Exc); - {'EXCEPTION', E} when is_record(E, 'CosPropertyService_UnsupportedTypeCode') -> - evaluate_properties_data(State, T, Acc, - [#'CosPropertyService_PropertyException' - {reason = unsupported_type_code, - failing_property_name = Name}|Exc]); - {'EXCEPTION', E} when is_record(E, 'CosPropertyService_UnsupportedProperty') -> - evaluate_properties_data(State, T, Acc, - [#'CosPropertyService_PropertyException' - {reason = unsupported_property, - failing_property_name = Name}|Exc]) - end; -evaluate_properties_data(State, [#'CosPropertyService_PropertyDef' - {property_name = Name, - property_value = Value, - property_mode = Mode}|T], Acc, Exc) -> - case catch evaluate_property_data(State, Value, Name) of - ok -> - evaluate_properties_data(State, T, [#'CosPropertyService_PropertyDef' - {property_name = Name, - property_value = Value, - property_mode = Mode}|Acc], Exc); - {'EXCEPTION', E} when is_record(E, 'CosPropertyService_UnsupportedTypeCode') -> - evaluate_properties_data(State, T, Acc, - [#'CosPropertyService_PropertyException' - {reason = unsupported_type_code, - failing_property_name = Name}|Exc]); - {'EXCEPTION', E} when is_record(E, 'CosPropertyService_UnsupportedProperty') -> - evaluate_properties_data(State, T, Acc, - [#'CosPropertyService_PropertyException' - {reason = unsupported_property, - failing_property_name = Name}|Exc]) - end; -evaluate_properties_data(_, _, _, _) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -evaluate_property_data(State, _, _) when ?no_PropertyLimits(State), - ?no_TypeLimits(State) -> - ok; -evaluate_property_data(State, Value, _Name) when ?no_PropertyLimits(State) -> - case lists:member(any:get_typecode(Value), ?get_okTypes(State)) of - true -> - ok; - _ -> - corba:raise(#'CosPropertyService_UnsupportedTypeCode'{}) - end; -evaluate_property_data(State, _Value, Name) when ?no_TypeLimits(State) -> - case lists:any(?MemberName(Name), ?get_okProperties(State)) of - true -> - ok; - _ -> - corba:raise(#'CosPropertyService_UnsupportedProperty'{}) - end; -evaluate_property_data(State, Value, Name) -> - case lists:any(?MemberName(Name), ?get_okProperties(State)) of - true -> - case lists:member(any:get_typecode(Value), ?get_okTypes(State)) of - true -> - ok; - _ -> - corba:raise(#'CosPropertyService_UnsupportedTypeCode'{}) - end; - _ -> - corba:raise(#'CosPropertyService_UnsupportedProperty'{}) - end. - - -%%---------------------------------------------------------------------- -%% Debugging functions -%%---------------------------------------------------------------------- -dump() -> - case catch mnesia:dirty_first('oe_CosPropertyService') of - {'EXIT', R} -> - io:format("Exited with ~p\n",[R]); - Key -> - dump_print(Key), - dump_loop(Key) - end. - -dump_loop(PreviousKey) -> - case catch mnesia:dirty_next('oe_CosPropertyService', PreviousKey) of - {'EXIT', R} -> - io:format("Exited with ~p\n",[R]); - '$end_of_table' -> - ok; - Key -> - dump_print(Key), - dump_loop(Key) - end. - -dump_print(Key) -> - case catch mnesia:dirty_read({'oe_CosPropertyService', Key}) of - {'EXIT', R} -> - io:format("Exited with ~p\n",[R]); - [{_,_,X}] -> - io:format("Property: ~p~n", [X]); - _ -> - ok - end. - - -%%-------------------------- END OF MODULE ----------------------------- diff --git a/lib/cosProperty/src/CosPropertyService_PropertySetFactory_impl.erl b/lib/cosProperty/src/CosPropertyService_PropertySetFactory_impl.erl deleted file mode 100644 index bc6572b634..0000000000 --- a/lib/cosProperty/src/CosPropertyService_PropertySetFactory_impl.erl +++ /dev/null @@ -1,183 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosPropertyService_PropertySetFactory_impl.erl -%% Description : -%% -%%---------------------------------------------------------------------- --module('CosPropertyService_PropertySetFactory_impl'). - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). --include("CosPropertyService.hrl"). --include("cosProperty.hrl"). - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- --export([init/1, - terminate/2, - code_change/3]). - --export([create_propertyset/2, - create_constrained_propertyset/4, - create_initial_propertyset/3]). - - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- --export([]). - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {}). - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- --define(checkTCfun, fun(TC) -> orber_tc:check_tc(TC) end). - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%---------------------------------------------------------------------- -init([]) -> - {ok, #state{}}. - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Returns : any (ignored by gen_server) -%% Description: Shutdown the server -%%---------------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -%%---------------------------------------------------------------------- -%% Function : code_change/3 -%% Returns : {ok, NewState} -%% Description: Convert process state when code is changed -%%---------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%---------------------------------------------------------------------- -%% Function : create_propertyset -%% Arguments : -%% Returns : CosPropertyService::PropertySet reference. -%% Description: -%%---------------------------------------------------------------------- -create_propertyset(_OE_This, State) -> - {reply, - 'CosPropertyService_PropertySetDef': - oe_create({normal, [], [], [], ?PropertySet}, [{pseudo, true}]), - State}. - -%%---------------------------------------------------------------------- -%% Function : create_constrained_propertyset -%% Arguments : PropTypes - list of property types. -%% Properties - list of properties. -%% Returns : CosPropertyService::PropertySet | -%% {'EXCEPTION', CosPropertyService::ConstraintNotSupported} -%% Description: -%%---------------------------------------------------------------------- -create_constrained_propertyset(_OE_This, State, PropTypes, Properties) -> - case lists:all(?checkTCfun, PropTypes) of - true -> - crosscheckTC(Properties, PropTypes), - {reply, - 'CosPropertyService_PropertySetDef': - oe_create({normal, PropTypes, Properties, [], ?PropertySet}, - [{pseudo, true}]), - State}; - false -> - corba:raise(#'CosPropertyService_ConstraintNotSupported'{}) - end. - -crosscheckTC([], _) -> - ok; -crosscheckTC([#'CosPropertyService_Property' - {property_name = Name, - property_value = Value}|T], TCs) -> - case lists:member(any:get_typecode(Value), TCs) of - true when Name =/= "" -> - crosscheckTC(T, TCs); - _ -> - corba:raise(#'CosPropertyService_ConstraintNotSupported'{}) - end. - -%%---------------------------------------------------------------------- -%% Function : create_initial_propertyset -%% Arguments : Properties - list of properties. -%% Returns : CosPropertyService::PropertySetDef | -%% {'EXCEPTION', CosPropertyService::MultipleExceptions} -%% Description: -%%---------------------------------------------------------------------- -create_initial_propertyset(_OE_This, State, Properties) -> - InitProps = evaluate_propertyset(Properties), - {reply, - 'CosPropertyService_PropertySetDef': - oe_create({normal, [], [], InitProps, ?PropertySet}, [{pseudo, true}]), - State}. - -%%====================================================================== -%% Internal functions -%%====================================================================== -evaluate_propertyset(Sets) -> - case evaluate_propertyset(Sets, [], []) of - {ok, NewProperties} -> - NewProperties; - {error, Exc} -> - corba:raise(#'CosPropertyService_MultipleExceptions'{exceptions = Exc}) - end. - -evaluate_propertyset([], NewProperties, []) -> - %% No exceptions found. - {ok, NewProperties}; -evaluate_propertyset([], _, Exc) -> - {error, Exc}; -evaluate_propertyset([#'CosPropertyService_Property' - {property_name = Name, - property_value = Value}|T], X, Exc) -> - case orber_tc:check_tc(any:get_typecode(Value)) of - true -> - evaluate_propertyset(T, [{Name, Value, normal}|X], Exc); - false -> - evaluate_propertyset(T, X, [#'CosPropertyService_PropertyException' - {reason = unsupported_type_code, - failing_property_name = Name}|Exc]) - end. - -%%====================================================================== -%% END OF MODULE -%%====================================================================== diff --git a/lib/cosProperty/src/Makefile b/lib/cosProperty/src/Makefile deleted file mode 100644 index 1fdc258a6d..0000000000 --- a/lib/cosProperty/src/Makefile +++ /dev/null @@ -1,188 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2000-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk - -ifeq ($(TYPE),debug) -ERL_COMPILE_FLAGS += -Ddebug -W -endif - -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSPROPERTY_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/cosProperty-$(VSN) - -EXTERNAL_INC_PATH = ../include - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- - -MODULES = \ - cosProperty \ - CosPropertyService_PropertySetDefFactory_impl \ - CosPropertyService_PropertySetDef_impl \ - CosPropertyService_PropertySetFactory_impl \ - CosPropertyService_PropertiesIterator_impl \ - CosPropertyService_PropertyNamesIterator_impl - - -ERL_FILES = $(MODULES:%=%.erl) -HRL_FILES = \ - cosProperty.hrl \ - -GEN_ERL_FILES = \ - oe_CosProperty.erl \ - CosPropertyService_ConflictingProperty.erl \ - CosPropertyService_ConstraintNotSupported.erl \ - CosPropertyService_FixedProperty.erl \ - CosPropertyService_InvalidPropertyName.erl \ - CosPropertyService_MultipleExceptions.erl \ - CosPropertyService_Properties.erl \ - CosPropertyService_PropertiesIterator.erl \ - CosPropertyService_Property.erl \ - CosPropertyService_PropertyDef.erl \ - CosPropertyService_PropertyDefs.erl \ - CosPropertyService_PropertyException.erl \ - CosPropertyService_PropertyExceptions.erl \ - CosPropertyService_PropertyMode.erl \ - CosPropertyService_PropertyModes.erl \ - CosPropertyService_PropertyNames.erl \ - CosPropertyService_PropertyNamesIterator.erl \ - CosPropertyService_PropertyNotFound.erl \ - CosPropertyService_PropertySet.erl \ - CosPropertyService_PropertySetDef.erl \ - CosPropertyService_PropertySetDefFactory.erl \ - CosPropertyService_PropertySetFactory.erl \ - CosPropertyService_PropertyTypes.erl \ - CosPropertyService_ReadOnlyProperty.erl \ - CosPropertyService_UnsupportedMode.erl \ - CosPropertyService_UnsupportedProperty.erl \ - CosPropertyService_UnsupportedTypeCode.erl - -LOCAL_HRL_FILES = \ - oe_CosProperty.hrl \ - CosPropertyService.hrl \ - CosPropertyService_PropertiesIterator.hrl \ - CosPropertyService_PropertyNamesIterator.hrl \ - CosPropertyService_PropertySet.hrl \ - CosPropertyService_PropertySetDef.hrl \ - CosPropertyService_PropertySetDefFactory.hrl \ - CosPropertyService_PropertySetFactory.hrl - -GEN_HRL_FILES = $(LOCAL_HRL_FILES:%=$(EXTERNAL_INC_PATH)/%) - -GEN_FILES = \ - $(GEN_HRL_FILES) \ - $(GEN_ERL_FILES) - -TARGET_FILES = \ - $(GEN_ERL_FILES:%.erl=$(EBIN)/%.$(EMULATOR)) \ - $(MODULES:%=$(EBIN)/%.$(EMULATOR)) - -IDL_FILES = \ - CosProperty.idl - -APPUP_FILE = cosProperty.appup -APPUP_SRC = $(APPUP_FILE).src -APPUP_TARGET = $(EBIN)/$(APPUP_FILE) - -APP_FILE = cosProperty.app -APP_SRC = $(APP_FILE).src -APP_TARGET = $(EBIN)/$(APP_FILE) - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/cosProperty/ebin \ - -pa $(ERL_TOP)/lib/ic/ebin\ - -pa $(ERL_TOP)/lib/orber/ebin - -# The -pa option is just used temporary until erlc can handle -# includes from other directories than ../include . -ERL_COMPILE_FLAGS += \ - $(ERL_IDL_FLAGS) \ - -pa $(ERL_TOP)/lib/orber/include \ - -pa $(ERL_TOP)/lib/cosProperty/include \ - -I$(ERL_TOP)/lib/cosProperty/include \ - -I$(ERL_TOP)/lib/orber/include \ - +'{parse_transform,sys_pre_attributes}' \ - +'{attribute,insert,app_vsn,"cosProperty_$(COSPROPERTY_VSN)"}' - - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) - -debug: - @${MAKE} TYPE=debug opt - -cleanb: - rm -f $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) - rm -f errs core *~ - -clean: - rm -f $(TARGET_FILES) $(GEN_FILES) $(APP_TARGET) $(APPUP_TARGET) IDL-GENERATED - rm -f errs core *~ - -$(APP_TARGET): $(APP_SRC) - $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ - -$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ - -docs: - -# ---------------------------------------------------- -# Special Build Targets -# ---------------------------------------------------- -IDL-GENERATED: CosProperty.idl - $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosProperty.cfg"}' CosProperty.idl - $(V_at)mv $(LOCAL_HRL_FILES) $(EXTERNAL_INC_PATH) - $(V_at)>IDL-GENERATED - -$(GEN_FILES): IDL-GENERATED - -$(TARGET_FILES): IDL-GENERATED - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)/ebin" - $(INSTALL_DATA) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) "$(RELSYSDIR)/ebin" - $(INSTALL_DIR) "$(RELSYSDIR)/src" - $(INSTALL_DATA) $(GEN_FILES) $(IDL_FILES) "$(RELSYSDIR)/src" - $(INSTALL_DATA) $(ERL_FILES) $(HRL_FILES) $(GEN_ERL_FILES) $(IDL_FILES) "$(RELSYSDIR)/src" - $(INSTALL_DIR) "$(RELSYSDIR)/include" - $(INSTALL_DATA) $(GEN_HRL_FILES) "$(RELSYSDIR)/include" - -release_docs_spec: diff --git a/lib/cosProperty/src/cosProperty.app.src b/lib/cosProperty/src/cosProperty.app.src deleted file mode 100644 index 7fad7a602a..0000000000 --- a/lib/cosProperty/src/cosProperty.app.src +++ /dev/null @@ -1,47 +0,0 @@ -{application, cosProperty, - [{description, "The Erlang CosProperty application"}, - {vsn, "%VSN%"}, - {modules, - [ - 'cosProperty', - 'CosPropertyService_PropertySetDefFactory_impl', - 'CosPropertyService_PropertySetDef_impl', - 'CosPropertyService_PropertySetFactory_impl', - 'CosPropertyService_PropertiesIterator_impl', - 'CosPropertyService_PropertyNamesIterator_impl', - 'oe_CosProperty', - 'CosPropertyService_ConflictingProperty', - 'CosPropertyService_ConstraintNotSupported', - 'CosPropertyService_FixedProperty', - 'CosPropertyService_InvalidPropertyName', - 'CosPropertyService_MultipleExceptions', - 'CosPropertyService_Properties', - 'CosPropertyService_PropertiesIterator', - 'CosPropertyService_Property', - 'CosPropertyService_PropertyDef', - 'CosPropertyService_PropertyDefs', - 'CosPropertyService_PropertyException', - 'CosPropertyService_PropertyExceptions', - 'CosPropertyService_PropertyMode', - 'CosPropertyService_PropertyModes', - 'CosPropertyService_PropertyNames', - 'CosPropertyService_PropertyNamesIterator', - 'CosPropertyService_PropertyNotFound', - 'CosPropertyService_PropertySet', - 'CosPropertyService_PropertySetDef', - 'CosPropertyService_PropertySetDefFactory', - 'CosPropertyService_PropertySetFactory', - 'CosPropertyService_PropertyTypes', - 'CosPropertyService_ReadOnlyProperty', - 'CosPropertyService_UnsupportedMode', - 'CosPropertyService_UnsupportedProperty', - 'CosPropertyService_UnsupportedTypeCode' - ] - }, - {registered, [oe_cosPropertySup]}, - {applications, [orber, stdlib, kernel]}, - {env, []}, - {mod, {cosProperty, []}}, - {runtime_dependencies, ["stdlib-2.0","orber-3.6.27","mnesia-4.12", - "kernel-3.0","erts-7.0"]} -]}. diff --git a/lib/cosProperty/src/cosProperty.appup.src b/lib/cosProperty/src/cosProperty.appup.src deleted file mode 100644 index f3eead4a0c..0000000000 --- a/lib/cosProperty/src/cosProperty.appup.src +++ /dev/null @@ -1,6 +0,0 @@ -{"%VSN%", - [ - ], - [ - ] -}. diff --git a/lib/cosProperty/src/cosProperty.erl b/lib/cosProperty/src/cosProperty.erl deleted file mode 100644 index e94d200c2f..0000000000 --- a/lib/cosProperty/src/cosProperty.erl +++ /dev/null @@ -1,416 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : cosProperty.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module(cosProperty). - -%%--------------- INCLUDES ----------------------------------- --include("cosProperty.hrl"). --include_lib("cosProperty/include/CosPropertyService.hrl"). - -%%--------------- EXPORTS------------------------------------- -%% cosProperty API external --export([start/0, - start_SetDefFactory/0, - start_SetFactory/0, - stop_SetDefFactory/1, - stop_SetFactory/1, - stop/0, - install/0, - install/1, - install_db/0, - install_db/1, - install_db/2, - uninstall/0, - uninstall/1, - uninstall_db/0]). - -%% cosProperty API internal --export([create_link/3, - get_option/3, - type_check/2, - query_result/1, - start_PropertiesIterator/1, - start_PropertyNamesIterator/1, - create_static_SetDef/2]). - -%% Application callbacks --export([start/2, init/1, stop/1]). - -%%--------------- DEFINES ------------------------------------ - --define(SUPERVISOR_NAME, oe_cosPropertySup). --define(SUP_FLAG, {simple_one_for_one,50,10}). --define(SUP_PROP_SPEC(T,I), - ['CosPropertyService_PropertiesIterator',I, - [{sup_child, true}, {regname, {global, T}}]]). --define(SUP_NAMES_SPEC(T,I), - ['CosPropertyService_PropertyNamesIterator',I, - [{sup_child, true}, {regname, {global, T}}]]). --define(SUP_CHILD, - {"oe_PropertyChild", - {cosProperty,create_link, []}, - transient,100000,worker, - []}). - -%%------------------------------------------------------------ -%% function : install -%% Arguments: - -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Install necessary data in the IFR DB -%%------------------------------------------------------------ -install() -> - install([]). -install(_Options) -> - case catch oe_CosProperty:'oe_register'() of - ok -> - ok; - {'EXIT',{unregistered,App}} -> - ?write_ErrorMsg("Unable to register cosProperty; application ~p not registered.~n", - [App]), - exit({unregistered,App}); - {'EXCEPTION',_} -> - ?write_ErrorMsg("Unable to register cosProperty; propably already registered. -You are adviced to confirm this.~n", []), - exit({error, "Register in the IFR failed."}); - Reason -> - ?write_ErrorMsg("Unable to register cosProperty; reason ~p", [Reason]), - exit({error, "Register in the IFR failed."}) - end. - -%%------------------------------------------------------------ -%% function : install_db -%% Arguments: - -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Install necessary data in the IFR DB -%%------------------------------------------------------------ -install_db() -> - install_db(infinity, []). -install_db(Timeout) -> - install_db(Timeout, []). -install_db(Timeout, Options) -> - case install_table(Timeout, Options) of - ok -> - ok; - {error, [DB_tables_created, Wait]} -> - ?write_ErrorMsg("Able to register cosProperty but failed adding table in mnesia (~p, ~p)", - [DB_tables_created, Wait]), - exit({error, "Adding data in mnesia failed."}); - Why -> - ?write_ErrorMsg("Able to register cosProperty but failed adding table in mnesia with reason ~p", - [Why]), - exit({error, "Adding data in mnesia failed."}) - end. - -%%------------------------------------------------------------ -%% function : install_table -%% Arguments: - -%% Returns : ok | {error, Data} -%% Effect : Install necessary data in mnesia -%%------------------------------------------------------------ -install_table(Timeout, Options) -> - %% Fetch a list of the defined tables to see if 'oe_CosPropertyService' - %% is defined. - AllTabs = mnesia:system_info(tables), - DB_tables_created = - case lists:member('oe_CosPropertyService', AllTabs) of - true -> - case lists:member({local_content, true}, - Options) of - true-> - mnesia:add_table_copy('oe_CosPropertyService', - node(), - ram_copies); - _-> - mnesia:create_table('oe_CosPropertyService',[{attributes, - record_info(fields, - 'oe_CosPropertyService')} - |Options]) - end; - _ -> - mnesia:create_table('oe_CosPropertyService',[{attributes, - record_info(fields, - 'oe_CosPropertyService')} - |Options]) - end, - Wait = mnesia:wait_for_tables(['oe_CosPropertyService'], Timeout), - %% Check if any error has occured yet. If there are errors, return them. - if - DB_tables_created == {atomic, ok}, - Wait == ok -> - ok; - true -> - {error, [DB_tables_created, Wait]} - end. - - -%%------------------------------------------------------------ -%% function : query_result -%% Arguments: - -%% Returns : error | Data -%% Effect : Check a read transaction -%%------------------------------------------------------------ -query_result(Qres) -> - case Qres of - {atomic, [Hres]} -> - Hres#oe_CosPropertyService.properties; - {atomic, [_Hres | _Tres]} -> - error; - {atomic, []} -> - error; - _Other -> - error - end. - -%%------------------------------------------------------------ -%% function : uninstall -%% Arguments: - -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Remove data related to cosProperty from the IFR DB -%%------------------------------------------------------------ -uninstall() -> - uninstall([]). -uninstall(_Options) -> - application:stop(cosProperty), - oe_CosProperty:oe_unregister(). - -%%------------------------------------------------------------ -%% function : uninstall -%% Arguments: - -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Remove data related to cosProperty from the IFR DB -%%------------------------------------------------------------ -uninstall_db() -> - application:stop(cosProperty), - case mnesia:delete_table('oe_CosPropertyService') of - {atomic, ok} -> - ok; - {aborted, _Reason} -> - exit({error, "Removing data from mnesia failed."}) - end. - -%%------------------------------------------------------------ -%% function : create_static_SetDef -%% Arguments: -%% Returns : -%% Effect : Starts or stops the cosProperty application. -%%------------------------------------------------------------ -create_static_SetDef(PropTypes, PropDefs) -> - InitProps = propertyDef2local(PropDefs, []), - 'CosPropertyService_PropertySetDef':oe_create({static, fixed_readonly, PropTypes, - PropDefs, InitProps, - ?PropertySetDef}, - [{pseudo, true}]). -propertyDef2local([#'CosPropertyService_PropertyDef' - {property_name = Name, - property_value = Value, - property_mode = fixed_readonly}|T], Acc) -> - propertyDef2local(T, [{Name, Value, fixed_readonly}|Acc]); -propertyDef2local([], Acc) -> - Acc; -propertyDef2local(_, _) -> - exit({error, "Bad Mode type supplied. Must be fixed_readonly"}). - -%%------------------------------------------------------------ -%% function : start/stop -%% Arguments: -%% Returns : -%% Effect : Starts or stops the cosProperty application. -%%------------------------------------------------------------ -start() -> - application:start(cosProperty). -stop() -> - application:stop(cosProperty). - - - -%%-----------------------------------------------------------% -%% function : start_SetDefFactory -%% Arguments: - -%% Returns : A PropertySetDefFactory reference. -%% Effect : -%%------------------------------------------------------------ -start_SetDefFactory() -> - 'CosPropertyService_PropertySetDefFactory':oe_create([], [{pseudo, true}]). - -%%-----------------------------------------------------------% -%% function : start_SetFactory -%% Arguments: - -%% Returns : A PropertySetFactory reference. -%% Effect : -%%------------------------------------------------------------ -start_SetFactory() -> - 'CosPropertyService_PropertySetFactory':oe_create([], [{pseudo, true}]). - -%%-----------------------------------------------------------% -%% function : stop_SetDefFactory -%% Arguments: Factory - A PropertySetDefFactory reference. -%% Returns : -%% Effect : -%%------------------------------------------------------------ -stop_SetDefFactory(Factory) -> - corba:dispose(Factory). - -%%-----------------------------------------------------------% -%% function : stop_SetFactory -%% Arguments: Factory - A PropertySetFactory reference. -%% Returns : -%% Effect : -%%------------------------------------------------------------ -stop_SetFactory(Factory) -> - corba:dispose(Factory). - -%%------------------------------------------------------------ -%% function : start -%% Arguments: Type - see module application -%% Arg - see module application -%% Returns : -%% Effect : Module callback for application -%%------------------------------------------------------------ -start(_, _) -> - supervisor:start_link({local, ?SUPERVISOR_NAME}, cosProperty, app_init). - - -%%------------------------------------------------------------ -%% function : stop -%% Arguments: Arg - see module application -%% Returns : -%% Effect : Module callback for application -%%------------------------------------------------------------ -stop(_) -> - ok. - -%%-----------------------------------------------------------% -%% function : init -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ -%% Starting using create_factory/X -init(own_init) -> - {ok,{?SUP_FLAG, [?SUP_CHILD]}}; -%% When starting as an application. -init(app_init) -> - {ok,{?SUP_FLAG, [?SUP_CHILD]}}. - -%%-----------------------------------------------------------% -%% function : create_link -%% Arguments: Module - which Module to call -%% Env/ArgList - ordinary oe_create arguments. -%% Returns : -%% Exception: -%% Effect : Necessary since we want the supervisor to be a -%% 'simple_one_for_one'. Otherwise, using for example, -%% 'one_for_one', we have to call supervisor:delete_child -%% to remove the childs startspecification from the -%% supervisors internal state. -%%------------------------------------------------------------ -create_link(Module, Env, ArgList) -> - Module:oe_create_link(Env, ArgList). - -%%-----------------------------------------------------------% -%% function : start_PropertiesIterator -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -start_PropertiesIterator(Args) -> - Name = create_name(propertiesIterator), - case supervisor:start_child(?SUPERVISOR_NAME, ?SUP_PROP_SPEC(Name, Args)) of - {ok, Pid, Obj} when is_pid(Pid) -> - Obj; - _Other-> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%-----------------------------------------------------------% -%% function : start_PropertyNamesIterator -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -start_PropertyNamesIterator(Args) -> - Name = create_name(propertiesIterator), - case supervisor:start_child(?SUPERVISOR_NAME, ?SUP_NAMES_SPEC(Name, Args)) of - {ok, Pid, Obj} when is_pid(Pid) -> - Obj; - _Other-> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - - -%%-----------------------------------------------------------% -%% function : get_option -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -get_option(Key, OptionList, DefaultList) -> - case lists:keysearch(Key, 1, OptionList) of - {value,{Key,Value}} -> - Value; - _ -> - case lists:keysearch(Key, 1, DefaultList) of - {value,{Key,Value}} -> - Value; - _-> - {error, "Invalid option"} - end - end. - -%%-----------------------------------------------------------% -%% function : type_check -%% Arguments: Obj - objectrefernce to test. -%% Mod - Module which contains typeID/0. -%% Returns : 'ok' or raises exception. -%% Effect : -%%------------------------------------------------------------ -type_check(Obj, Mod) -> - case catch corba_object:is_a(Obj,Mod:typeID()) of - true -> - ok; - _ -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end. - - -%%-----------------------------------------------------------% -%% function : create_name/1 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -create_name(Type) -> - Time = erlang:system_time(), - Unique = erlang:unique_integer([positive]), - lists:concat(['oe_',node(),'_',Type,'_',Time,'_',Unique]). - -%%--------------- END OF MODULE ------------------------------ - - diff --git a/lib/cosProperty/src/cosProperty.hrl b/lib/cosProperty/src/cosProperty.hrl deleted file mode 100644 index 0225a43ebd..0000000000 --- a/lib/cosProperty/src/cosProperty.hrl +++ /dev/null @@ -1,82 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : cosProperty.hrl -%% Purpose : -%%---------------------------------------------------------------------- - - -%%--------------- INCLUDES ----------------------------------- -%% External --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). - -%%----------------------------------------------------------------- -%% Mnesia Table definition record -%%----------------------------------------------------------------- --record('oe_CosPropertyService', {key, properties}). - -%%----------------------------------------------------------------- -%% Macros -%%----------------------------------------------------------------- --define(PropertySet, 0). --define(PropertySetDef, 1). - -%% This macro returns a read fun suitable for evaluation in a transaction --define(read_function(Objkey), - fun() -> - mnesia:read(Objkey) - end). - -%% This macro returns a write fun suitable for evaluation in a transaction --define(write_function(R), - fun() -> - mnesia:write(R) - end). - -%% This macro returns a delete fun suitable for evaluation in a transaction --define(delete_function(R), - fun() -> - mnesia:delete(R) - end). - --define(query_check(Q_res), {atomic, Q_res}). - - --define(write_ErrorMsg(Txt, Arg), -error_logger:error_msg("================ CosProperty ==============~n" - Txt - "===========================================~n", - Arg)). - - - --ifdef(debug). --define(debug_print(F,A), - io:format("[LINE: ~p MODULE: ~p] "++F,[?LINE, ?MODULE]++A)). --define(property_TypeCheck(O,M), 'cosProperty':type_check(O,M)). --else. --define(debug_print(F,A), ok). --define(property_TypeCheck(O,I), ok). --endif. - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosProperty/test/Makefile b/lib/cosProperty/test/Makefile deleted file mode 100644 index 5f599c9621..0000000000 --- a/lib/cosProperty/test/Makefile +++ /dev/null @@ -1,129 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2000-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSPROPERTY_VSN) -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/cosProperty_test - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -TEST_SPEC_FILE = cosProperty.spec -COVER_FILE = cosProperty.cover - - -IDL_FILES = - -IDLOUTDIR = idl_output - -MODULES = \ - property_SUITE \ - generated_SUITE - -GEN_MODULES = \ - -GEN_HRL_FILES = \ - -ERL_FILES = $(MODULES:%=%.erl) - -HRL_FILES = - -GEN_FILES = \ - $(GEN_HRL_FILES:%=$(IDLOUTDIR)/%) \ - $(GEN_MODULES:%=$(IDLOUTDIR)/%.erl) - -GEN_TARGET_FILES = $(GEN_MODULES:%=$(IDLOUTDIR)/%.$(EMULATOR)) - -SUITE_TARGET_FILES = $(MODULES:%=%.$(EMULATOR)) - -TARGET_FILES = \ - $(GEN_TARGET_FILES) \ - $(SUITE_TARGET_FILES) - - -# ---------------------------------------------------- -# PROGRAMS -# ---------------------------------------------------- -LOCAL_CLASSPATH = $(ERL_TOP)lib/cosProperty/priv:$(ERL_TOP)lib/cosProperty/test -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/cosProperty/ebin \ - -pa $(ERL_TOP)/lib/cosProperty/src \ - -pa $(ERL_TOP)/lib/orber/ebin \ - -pa $(ERL_TOP)/lib/ic/ebin - -ERL_COMPILE_FLAGS += \ - $(ERL_IDL_FLAGS) \ - -pa $(ERL_TOP)/lib/orber/include \ - -pa $(ERL_TOP)/lib/cosProperty/ebin \ - -pa $(ERL_TOP)/lib/cosProperty/test/idl_output \ - -I$(ERL_TOP)/lib/orber/include \ - -I$(ERL_TOP)/lib/cosProperty/src \ - -I$(ERL_TOP)/lib/cosProperty \ - -I$(ERL_TOP)/lib/cosProperty/test/$(IDLOUTDIR) - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- - - -tests debug opt: $(TARGET_FILES) - -clean: - rm -f idl_output/* - rm -f $(TARGET_FILES) - rm -f errs core *~ - -docs: - -# ---------------------------------------------------- -# Special Targets -# ---------------------------------------------------- - -# ---------------------------------------------------- -# Release Targets -# ---------------------------------------------------- -# We don't copy generated intermediate erlang and hrl files - -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: - -release_docs_spec: - -release_tests_spec: tests - $(INSTALL_DIR) "$(RELSYSDIR)" - $(INSTALL_DATA) $(IDL_FILES) $(TEST_SPEC_FILE) \ - $(COVER_FILE) $(ERL_FILES) "$(RELSYSDIR)" - $(INSTALL_DATA) $(SUITE_TARGET_FILES) "$(RELSYSDIR)" -# $(INSTALL_DIR) "$(RELSYSDIR)/$(IDLOUTDIR)" -# $(INSTALL_DATA) $(GEN_TARGET_FILES) $(GEN_FILES) \ -# "$(RELSYSDIR)/$(IDLOUTDIR)" - diff --git a/lib/cosProperty/test/cosProperty.cover b/lib/cosProperty/test/cosProperty.cover deleted file mode 100644 index a0f5f17671..0000000000 --- a/lib/cosProperty/test/cosProperty.cover +++ /dev/null @@ -1,2 +0,0 @@ -{incl_app,cosProperty,details}. - diff --git a/lib/cosProperty/test/cosProperty.spec b/lib/cosProperty/test/cosProperty.spec deleted file mode 100644 index d3d44321c8..0000000000 --- a/lib/cosProperty/test/cosProperty.spec +++ /dev/null @@ -1 +0,0 @@ -{suites,"../cosProperty_test",all}. diff --git a/lib/cosProperty/test/generated_SUITE.erl b/lib/cosProperty/test/generated_SUITE.erl deleted file mode 100644 index 313f5bf8f9..0000000000 --- a/lib/cosProperty/test/generated_SUITE.erl +++ /dev/null @@ -1,546 +0,0 @@ -%%----------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File : generated_SUITE.erl -%% Purpose : -%%----------------------------------------------------------------- - --module(generated_SUITE). - --include_lib("common_test/include/ct.hrl"). --include_lib("orber/include/corba.hrl"). - --define(default_timeout, test_server:minutes(3)). - --define(match(ExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - AcTuAlReS; - _ -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS) - end - end()). - --define(nomatch(Not, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - Not -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS); - _ -> - AcTuAlReS - end - end()). - - --define(checktc(_Op), - fun(TC) -> - case orber_tc:check_tc(TC) of - false -> - io:format("###### ERROR ERROR ######~n~p - ~p~n", [Op, TC]), - exit(TC); - true -> - true - end - end). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --compile(export_all). - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - ['CosPropertyService_ConflictingProperty', - 'CosPropertyService_ConstraintNotSupported', - 'CosPropertyService_FixedProperty', - 'CosPropertyService_InvalidPropertyName', - 'CosPropertyService_MultipleExceptions', - 'CosPropertyService_Properties', - 'CosPropertyService_Property', - 'CosPropertyService_PropertyDef', - 'CosPropertyService_PropertyDefs', - 'CosPropertyService_PropertyException', - 'CosPropertyService_PropertyExceptions', - 'CosPropertyService_PropertyMode', - 'CosPropertyService_PropertyModes', - 'CosPropertyService_PropertyNames', - 'CosPropertyService_PropertyNotFound', - 'CosPropertyService_PropertyTypes', - 'CosPropertyService_ReadOnlyProperty', - 'CosPropertyService_UnsupportedMode', - 'CosPropertyService_UnsupportedProperty', - 'CosPropertyService_UnsupportedTypeCode', - 'CosPropertyService_PropertyNamesIterator', - 'CosPropertyService_PropertiesIterator', - 'CosPropertyService_PropertySet', - 'CosPropertyService_PropertySetDef', - 'CosPropertyService_PropertySetDefFactory', - 'CosPropertyService_PropertySetFactory']. - -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- -init_per_testcase(_Case, Config) -> - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Case, Config) -> - Dog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_ConflictingProperty' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_ConflictingProperty'(_) -> - ?match(true, orber_tc:check_tc('CosPropertyService_ConflictingProperty':tc())), - ?match("IDL:omg.org/CosPropertyService/ConflictingProperty:1.0", - 'CosPropertyService_ConflictingProperty':id()), - ?match("CosPropertyService_ConflictingProperty", - 'CosPropertyService_ConflictingProperty':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_ConstraintNotSupported' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_ConstraintNotSupported'(_) -> - ?match(true, orber_tc:check_tc('CosPropertyService_ConstraintNotSupported':tc())), - ?match("IDL:omg.org/CosPropertyService/ConstraintNotSupported:1.0", - 'CosPropertyService_ConstraintNotSupported':id()), - ?match("CosPropertyService_ConstraintNotSupported", - 'CosPropertyService_ConstraintNotSupported':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_FixedProperty' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_FixedProperty'(_) -> - ?match(true, orber_tc:check_tc('CosPropertyService_FixedProperty':tc())), - ?match("IDL:omg.org/CosPropertyService/FixedProperty:1.0", - 'CosPropertyService_FixedProperty':id()), - ?match("CosPropertyService_FixedProperty", - 'CosPropertyService_FixedProperty':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_InvalidPropertyName' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_InvalidPropertyName'(_) -> - ?match(true, orber_tc:check_tc('CosPropertyService_InvalidPropertyName':tc())), - ?match("IDL:omg.org/CosPropertyService/InvalidPropertyName:1.0", - 'CosPropertyService_InvalidPropertyName':id()), - ?match("CosPropertyService_InvalidPropertyName", - 'CosPropertyService_InvalidPropertyName':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_MultipleExceptions' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_MultipleExceptions'(_) -> - ?match(true, orber_tc:check_tc('CosPropertyService_MultipleExceptions':tc())), - ?match("IDL:omg.org/CosPropertyService/MultipleExceptions:1.0", - 'CosPropertyService_MultipleExceptions':id()), - ?match("CosPropertyService_MultipleExceptions", - 'CosPropertyService_MultipleExceptions':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_Properties' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_Properties'(_) -> - ?match(true, orber_tc:check_tc('CosPropertyService_Properties':tc())), - ?match("IDL:omg.org/CosPropertyService/Properties:1.0", - 'CosPropertyService_Properties':id()), - ?match("CosPropertyService_Properties", - 'CosPropertyService_Properties':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_Property' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_Property'(_) -> - ?match(true, orber_tc:check_tc('CosPropertyService_Property':tc())), - ?match("IDL:omg.org/CosPropertyService/Property:1.0", - 'CosPropertyService_Property':id()), - ?match("CosPropertyService_Property", - 'CosPropertyService_Property':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_PropertyDef' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_PropertyDef'(_) -> - ?match(true, orber_tc:check_tc('CosPropertyService_PropertyDef':tc())), - ?match("IDL:omg.org/CosPropertyService/PropertyDef:1.0", - 'CosPropertyService_PropertyDef':id()), - ?match("CosPropertyService_PropertyDef", - 'CosPropertyService_PropertyDef':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_PropertyDefs' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_PropertyDefs'(_) -> - ?match(true, orber_tc:check_tc('CosPropertyService_PropertyDefs':tc())), - ?match("IDL:omg.org/CosPropertyService/PropertyDefs:1.0", - 'CosPropertyService_PropertyDefs':id()), - ?match("CosPropertyService_PropertyDefs", - 'CosPropertyService_PropertyDefs':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_PropertyException' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_PropertyException'(_) -> - ?match(true, orber_tc:check_tc('CosPropertyService_PropertyException':tc())), - ?match("IDL:omg.org/CosPropertyService/PropertyException:1.0", - 'CosPropertyService_PropertyException':id()), - ?match("CosPropertyService_PropertyException", - 'CosPropertyService_PropertyException':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_PropertyExceptions' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_PropertyExceptions'(_) -> - ?match(true, orber_tc:check_tc('CosPropertyService_PropertyExceptions':tc())), - ?match("IDL:omg.org/CosPropertyService/PropertyExceptions:1.0", - 'CosPropertyService_PropertyExceptions':id()), - ?match("CosPropertyService_PropertyExceptions", - 'CosPropertyService_PropertyExceptions':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_PropertyMode' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_PropertyMode'(_) -> - ?match(true, orber_tc:check_tc('CosPropertyService_PropertyMode':tc())), - ?match("IDL:omg.org/CosPropertyService/PropertyMode:1.0", - 'CosPropertyService_PropertyMode':id()), - ?match("CosPropertyService_PropertyMode", - 'CosPropertyService_PropertyMode':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_PropertyModes' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_PropertyModes'(_) -> - ?match(true, orber_tc:check_tc('CosPropertyService_PropertyModes':tc())), - ?match("IDL:omg.org/CosPropertyService/PropertyModes:1.0", - 'CosPropertyService_PropertyModes':id()), - ?match("CosPropertyService_PropertyModes", - 'CosPropertyService_PropertyModes':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_PropertyNames' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_PropertyNames'(_) -> - ?match(true, orber_tc:check_tc('CosPropertyService_PropertyNames':tc())), - ?match("IDL:omg.org/CosPropertyService/PropertyNames:1.0", - 'CosPropertyService_PropertyNames':id()), - ?match("CosPropertyService_PropertyNames", - 'CosPropertyService_PropertyNames':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_PropertyNotFound' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_PropertyNotFound'(_) -> - ?match(true, orber_tc:check_tc('CosPropertyService_PropertyNotFound':tc())), - ?match("IDL:omg.org/CosPropertyService/PropertyNotFound:1.0", - 'CosPropertyService_PropertyNotFound':id()), - ?match("CosPropertyService_PropertyNotFound", - 'CosPropertyService_PropertyNotFound':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_PropertyTypes' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_PropertyTypes'(_) -> - ?match(true, orber_tc:check_tc('CosPropertyService_PropertyTypes':tc())), - ?match("IDL:omg.org/CosPropertyService/PropertyTypes:1.0", - 'CosPropertyService_PropertyTypes':id()), - ?match("CosPropertyService_PropertyTypes", - 'CosPropertyService_PropertyTypes':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_ReadOnlyProperty' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_ReadOnlyProperty'(_) -> - ?match(true, orber_tc:check_tc('CosPropertyService_ReadOnlyProperty':tc())), - ?match("IDL:omg.org/CosPropertyService/ReadOnlyProperty:1.0", - 'CosPropertyService_ReadOnlyProperty':id()), - ?match("CosPropertyService_ReadOnlyProperty", - 'CosPropertyService_ReadOnlyProperty':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_UnsupportedMode' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_UnsupportedMode'(_) -> - ?match(true, orber_tc:check_tc('CosPropertyService_UnsupportedMode':tc())), - ?match("IDL:omg.org/CosPropertyService/UnsupportedMode:1.0", - 'CosPropertyService_UnsupportedMode':id()), - ?match("CosPropertyService_UnsupportedMode", - 'CosPropertyService_UnsupportedMode':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_UnsupportedProperty' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_UnsupportedProperty'(_) -> - ?match(true, orber_tc:check_tc('CosPropertyService_UnsupportedProperty':tc())), - ?match("IDL:omg.org/CosPropertyService/UnsupportedProperty:1.0", - 'CosPropertyService_UnsupportedProperty':id()), - ?match("CosPropertyService_UnsupportedProperty", - 'CosPropertyService_UnsupportedProperty':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_UnsupportedTypeCode' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_UnsupportedTypeCode'(_) -> - ?match(true, orber_tc:check_tc('CosPropertyService_UnsupportedTypeCode':tc())), - ?match("IDL:omg.org/CosPropertyService/UnsupportedTypeCode:1.0", - 'CosPropertyService_UnsupportedTypeCode':id()), - ?match("CosPropertyService_UnsupportedTypeCode", - 'CosPropertyService_UnsupportedTypeCode':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_PropertyNamesIterator' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_PropertyNamesIterator'(_) -> - ?nomatch(undefined, 'CosPropertyService_PropertyNamesIterator':oe_tc(reset)), - ?nomatch(undefined, 'CosPropertyService_PropertyNamesIterator':oe_tc(next_one)), - ?nomatch(undefined, 'CosPropertyService_PropertyNamesIterator':oe_tc(next_n)), - ?nomatch(undefined, 'CosPropertyService_PropertyNamesIterator':oe_tc(destroy)), - ?match(undefined, 'CosPropertyService_PropertyNamesIterator':oe_tc(undefined)), - ?match([_|_], 'CosPropertyService_PropertyNamesIterator':oe_get_interface()), - ?match("IDL:omg.org/CosPropertyService/PropertyNamesIterator:1.0", - 'CosPropertyService_PropertyNamesIterator':typeID()), - check_tc('CosPropertyService_PropertyNamesIterator':oe_get_interface()), - ?match(true, 'CosPropertyService_PropertyNamesIterator':oe_is_a('CosPropertyService_PropertyNamesIterator':typeID())), - ?match(false, 'CosPropertyService_PropertyNamesIterator':oe_is_a("wrong")), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_PropertiesIterator' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_PropertiesIterator'(_) -> - ?nomatch(undefined, 'CosPropertyService_PropertiesIterator':oe_tc(reset)), - ?nomatch(undefined, 'CosPropertyService_PropertiesIterator':oe_tc(next_one)), - ?nomatch(undefined, 'CosPropertyService_PropertiesIterator':oe_tc(next_n)), - ?nomatch(undefined, 'CosPropertyService_PropertiesIterator':oe_tc(destroy)), - ?match(undefined, 'CosPropertyService_PropertiesIterator':oe_tc(undefined)), - ?match([_|_], 'CosPropertyService_PropertiesIterator':oe_get_interface()), - ?match("IDL:omg.org/CosPropertyService/PropertiesIterator:1.0", - 'CosPropertyService_PropertiesIterator':typeID()), - check_tc('CosPropertyService_PropertiesIterator':oe_get_interface()), - ?match(true, 'CosPropertyService_PropertiesIterator':oe_is_a('CosPropertyService_PropertiesIterator':typeID())), - ?match(false, 'CosPropertyService_PropertiesIterator':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_PropertySet' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_PropertySet'(_) -> - ?nomatch(undefined, 'CosPropertyService_PropertySet':oe_tc(define_property)), - ?nomatch(undefined, 'CosPropertyService_PropertySet':oe_tc(define_properties)), - ?nomatch(undefined, 'CosPropertyService_PropertySet':oe_tc(get_number_of_properties)), - ?nomatch(undefined, 'CosPropertyService_PropertySet':oe_tc(get_all_property_names)), - ?nomatch(undefined, 'CosPropertyService_PropertySet':oe_tc(get_property_value)), - ?nomatch(undefined, 'CosPropertyService_PropertySet':oe_tc(get_properties)), - ?nomatch(undefined, 'CosPropertyService_PropertySet':oe_tc(get_all_properties)), - ?nomatch(undefined, 'CosPropertyService_PropertySet':oe_tc(delete_property)), - ?nomatch(undefined, 'CosPropertyService_PropertySet':oe_tc(delete_properties)), - ?nomatch(undefined, 'CosPropertyService_PropertySet':oe_tc(delete_all_properties)), - ?nomatch(undefined, 'CosPropertyService_PropertySet':oe_tc(is_property_defined)), - ?match(undefined, 'CosPropertyService_PropertySet':oe_tc(undefined)), - ?match([_|_], 'CosPropertyService_PropertySet':oe_get_interface()), - ?match("IDL:omg.org/CosPropertyService/PropertySet:1.0", - 'CosPropertyService_PropertySet':typeID()), - check_tc('CosPropertyService_PropertySet':oe_get_interface()), - ?match(true, 'CosPropertyService_PropertySet':oe_is_a('CosPropertyService_PropertySet':typeID())), - ?match(false, 'CosPropertyService_PropertySet':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_PropertySetDef' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_PropertySetDef'(_) -> - ?nomatch(undefined, 'CosPropertyService_PropertySetDef':oe_tc(get_allowed_property_types)), - ?nomatch(undefined, 'CosPropertyService_PropertySetDef':oe_tc(get_allowed_properties)), - ?nomatch(undefined, 'CosPropertyService_PropertySetDef':oe_tc(define_property_with_mode)), - ?nomatch(undefined, 'CosPropertyService_PropertySetDef':oe_tc(define_properties_with_modes)), - ?nomatch(undefined, 'CosPropertyService_PropertySetDef':oe_tc(get_property_mode)), - ?nomatch(undefined, 'CosPropertyService_PropertySetDef':oe_tc(get_property_modes)), - ?nomatch(undefined, 'CosPropertyService_PropertySetDef':oe_tc(set_property_mode)), - ?nomatch(undefined, 'CosPropertyService_PropertySetDef':oe_tc(set_property_modes)), - ?nomatch(undefined, 'CosPropertyService_PropertySetDef':oe_tc(define_property)), - ?nomatch(undefined, 'CosPropertyService_PropertySetDef':oe_tc(define_properties)), - ?nomatch(undefined, 'CosPropertyService_PropertySetDef':oe_tc(get_number_of_properties)), - ?nomatch(undefined, 'CosPropertyService_PropertySetDef':oe_tc(get_all_property_names)), - ?nomatch(undefined, 'CosPropertyService_PropertySetDef':oe_tc(get_property_value)), - ?nomatch(undefined, 'CosPropertyService_PropertySetDef':oe_tc(get_properties)), - ?nomatch(undefined, 'CosPropertyService_PropertySetDef':oe_tc(get_all_properties)), - ?nomatch(undefined, 'CosPropertyService_PropertySetDef':oe_tc(delete_property)), - ?nomatch(undefined, 'CosPropertyService_PropertySetDef':oe_tc(delete_properties)), - ?nomatch(undefined, 'CosPropertyService_PropertySetDef':oe_tc(delete_all_properties)), - ?nomatch(undefined, 'CosPropertyService_PropertySetDef':oe_tc(is_property_defined)), - ?match(undefined, 'CosPropertyService_PropertySetDef':oe_tc(undefined)), - ?match([_|_], 'CosPropertyService_PropertySetDef':oe_get_interface()), - ?match("IDL:omg.org/CosPropertyService/PropertySetDef:1.0", - 'CosPropertyService_PropertySetDef':typeID()), - check_tc('CosPropertyService_PropertySetDef':oe_get_interface()), - ?match(true, 'CosPropertyService_PropertySetDef':oe_is_a('CosPropertyService_PropertySetDef':typeID())), - ?match(true, 'CosPropertyService_PropertySetDef':oe_is_a('CosPropertyService_PropertySet':typeID())), - ?match(false, 'CosPropertyService_PropertySetDef':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_PropertySetDefFactory' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_PropertySetDefFactory'(_) -> - ?nomatch(undefined, 'CosPropertyService_PropertySetDefFactory':oe_tc(create_propertysetdef)), - ?nomatch(undefined, 'CosPropertyService_PropertySetDefFactory':oe_tc(create_constrained_propertysetdef)), - ?nomatch(undefined, 'CosPropertyService_PropertySetDefFactory':oe_tc(create_initial_propertysetdef)), - ?match(undefined, 'CosPropertyService_PropertySetDefFactory':oe_tc(undefined)), - ?match([_|_], 'CosPropertyService_PropertySetDefFactory':oe_get_interface()), - ?match("IDL:omg.org/CosPropertyService/PropertySetDefFactory:1.0", - 'CosPropertyService_PropertySetDefFactory':typeID()), - check_tc('CosPropertyService_PropertySetDefFactory':oe_get_interface()), - ?match(true, 'CosPropertyService_PropertySetDefFactory':oe_is_a('CosPropertyService_PropertySetDefFactory':typeID())), - ?match(false, 'CosPropertyService_PropertySetDefFactory':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosPropertyService_PropertySetFactory' -%% Description: -%%----------------------------------------------------------------- -'CosPropertyService_PropertySetFactory'(_) -> - ?nomatch(undefined, 'CosPropertyService_PropertySetFactory':oe_tc(create_propertyset)), - ?nomatch(undefined, 'CosPropertyService_PropertySetFactory':oe_tc(create_constrained_propertyset)), - ?nomatch(undefined, 'CosPropertyService_PropertySetFactory':oe_tc(create_initial_propertyset)), - ?match(undefined, 'CosPropertyService_PropertySetFactory':oe_tc(undefined)), - ?match([_|_], 'CosPropertyService_PropertySetFactory':oe_get_interface()), - ?match("IDL:omg.org/CosPropertyService/PropertySetFactory:1.0", - 'CosPropertyService_PropertySetFactory':typeID()), - check_tc('CosPropertyService_PropertySetFactory':oe_get_interface()), - ?match(true, 'CosPropertyService_PropertySetFactory':oe_is_a('CosPropertyService_PropertySetFactory':typeID())), - ?match(false, 'CosPropertyService_PropertySetFactory':oe_is_a("wrong")), - ok. - - - -%%----------------------------------------------------------------- -%% MISC functions -%%----------------------------------------------------------------- -check_tc([]) -> - ok; -check_tc([{Op, {RetType, InParameters, OutParameters}}|T]) -> - io:format("checked - ~s~n", [Op]), - lists:all(?checktc(Op), [RetType|InParameters]), - lists:all(?checktc(Op), OutParameters), - check_tc(T). - - diff --git a/lib/cosProperty/test/property_SUITE.erl b/lib/cosProperty/test/property_SUITE.erl deleted file mode 100644 index 77f35c319a..0000000000 --- a/lib/cosProperty/test/property_SUITE.erl +++ /dev/null @@ -1,736 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : property_SUITE.erl -%% Description : -%% -%%---------------------------------------------------------------------- --module(property_SUITE). - - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). --include_lib("cosProperty/src/cosProperty.hrl"). --include_lib("cosProperty/include/CosPropertyService.hrl"). - --include_lib("common_test/include/ct.hrl"). - -%%--------------- DEFINES ------------------------------------ --define(default_timeout, test_server:minutes(20)). --define(match(ExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - io:format("------ CORRECT RESULT ------~n~p~n", - [AcTuAlReS]), - AcTuAlReS; - _ -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS) - end - end()). - --define(match_inverse(NotExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - NotExpectedRes -> - io:format("###### ERROR ERROR ######~n ~p~n", - [AcTuAlReS]), - exit(AcTuAlReS); - _ -> - io:format("------ CORRECT RESULT ------~n~p~n", - [AcTuAlReS]), - AcTuAlReS - end - end()). - - --define(val1, #any{typecode=tk_short, value=1}). --define(val2, #any{typecode=tk_short, value=2}). --define(val3, #any{typecode=tk_short, value=3}). --define(val4, #any{typecode=tk_short, value=4}). --define(val5, #any{typecode=tk_long, value=5}). --define(badval, #any{typecode=tk_shirt, value=5}). - --define(id1, "id1"). --define(id2, "id2"). --define(id3, "id3"). --define(id4, "id4"). --define(id5, "id5"). --define(badid, ""). - - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- -%% Fixed exports --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0, - init_per_suite/1, end_per_suite/1, - init_per_testcase/2, end_per_testcase/2]). -%% Test cases --export([create_setdef_api/1, create_set_api/1, define_with_mode_api/1, - define_api/1, names_iterator_api/1, properties_iterator_api/1, - app_test/1]). - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - cases(). - -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - -cases() -> - [create_setdef_api, create_set_api, - define_with_mode_api, define_api, names_iterator_api, - properties_iterator_api, app_test]. - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- -init_per_testcase(_Case, Config) -> - Path = code:which(?MODULE), - code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - - -end_per_testcase(_Case, Config) -> - Path = code:which(?MODULE), - code:del_path(filename:join(filename:dirname(Path), "idl_output")), - Dog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -init_per_suite(Config) -> - Path = code:which(?MODULE), - code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), - orber:jump_start(), - cosProperty:install(), - cosProperty:install_db(), - ?match(ok, application:start(cosProperty)), - if - is_list(Config) -> - Config; - true -> - exit("Config not a list") - end. - -end_per_suite(Config) -> - Path = code:which(?MODULE), - code:del_path(filename:join(filename:dirname(Path), "idl_output")), - application:stop(cosProperty), - cosProperty:uninstall_db(), - cosProperty:uninstall(), - orber:jump_stop(), - Config. - -%%----------------------------------------------------------------- -%% Tests app file -%%----------------------------------------------------------------- -app_test(_Config) -> - ok=test_server:app_test(cosProperty), - ok. - - -%%----------------------------------------------------------------- -%% CosPropertyService_PropertySetDefFactory API tests -%%----------------------------------------------------------------- -create_setdef_api(_Config) -> - - ValidDefs = [#'CosPropertyService_PropertyDef' - {property_name = ?id1, - property_value = ?val1, - property_mode = normal}, - #'CosPropertyService_PropertyDef' - {property_name = ?id2, - property_value = ?val2, - property_mode = normal}], - InvalidDefs = [#'CosPropertyService_PropertyDef' - {property_name = ?id1, - property_value = ?val1, - property_mode = normal}, - #'CosPropertyService_PropertyDef' - {property_name = ?badid, - property_value = ?badval, - property_mode = normal}], - - Fac = ?match({_,pseudo,_,_,_,_}, cosProperty:start_SetDefFactory()), - - Obj1 = ?match({_,pseudo,_,_,_,_}, 'CosPropertyService_PropertySetDefFactory': - create_propertysetdef(Fac)), - 'CosPropertyService_PropertySetDef_impl':dump(), - corba:dispose(Obj1), - - - Obj2 = ?match({_,pseudo,_,_,_,_}, 'CosPropertyService_PropertySetDefFactory': - create_constrained_propertysetdef(Fac, [tk_short], ValidDefs)), - 'CosPropertyService_PropertySetDef_impl':dump(), - corba:dispose(Obj2), - - %% Both arguments correct but 'ValidDefs' contain other TC:s than - %% tk_null. - ?match({'EXCEPTION', _}, 'CosPropertyService_PropertySetDefFactory': - create_constrained_propertysetdef(Fac, [tk_null], ValidDefs)), - 'CosPropertyService_PropertySetDef_impl':dump(), - - ?match({'EXCEPTION', _}, 'CosPropertyService_PropertySetDefFactory': - create_constrained_propertysetdef(Fac, [tk_null], InvalidDefs)), - 'CosPropertyService_PropertySetDef_impl':dump(), - - %% The allowed TC not supported. - ?match({'EXCEPTION', _}, 'CosPropertyService_PropertySetDefFactory': - create_constrained_propertysetdef(Fac, [tk_noll], ValidDefs)), - 'CosPropertyService_PropertySetDef_impl':dump(), - - Obj4 = ?match({_,pseudo,_,_,_,_}, 'CosPropertyService_PropertySetDefFactory': - create_initial_propertysetdef(Fac, ValidDefs)), - 'CosPropertyService_PropertySetDef_impl':dump(), - corba:dispose(Obj4), - - ?match({'EXCEPTION', _}, 'CosPropertyService_PropertySetDefFactory': - create_initial_propertysetdef(Fac, InvalidDefs)), - - ?match(ok, cosProperty:stop_SetDefFactory(Fac)), - - ok. - - -%%----------------------------------------------------------------- -%% CosPropertyService_PropertySetFactory API tests -%%----------------------------------------------------------------- -create_set_api(_Config) -> - Valid = [#'CosPropertyService_Property' - {property_name = ?id1, - property_value = ?val1}, - #'CosPropertyService_Property' - {property_name = ?id2, - property_value = ?val2}], - Invalid = [#'CosPropertyService_Property' - {property_name = ?id1, - property_value = ?val1}, - #'CosPropertyService_Property' - {property_name = ?badid, - property_value = ?badval}], - - Fac = ?match({_,pseudo,_,_,_,_}, cosProperty:start_SetFactory()), - Obj1 = ?match({_,pseudo,_,_,_,_}, 'CosPropertyService_PropertySetFactory': - create_propertyset(Fac)), - 'CosPropertyService_PropertySetDef_impl':dump(), - corba:dispose(Obj1), - - - Obj2 = ?match({_,pseudo,_,_,_,_}, 'CosPropertyService_PropertySetFactory': - create_constrained_propertyset(Fac, [tk_short], Valid)), - 'CosPropertyService_PropertySetDef_impl':dump(), - corba:dispose(Obj2), - - %% Both arguments correct but 'Valid' contain other TC:s than - %% tk_null. - ?match({'EXCEPTION', _}, 'CosPropertyService_PropertySetFactory': - create_constrained_propertyset(Fac, [tk_null], Valid)), - 'CosPropertyService_PropertySetDef_impl':dump(), - - ?match({'EXCEPTION', _}, 'CosPropertyService_PropertySetFactory': - create_constrained_propertyset(Fac, [tk_null], Invalid)), - 'CosPropertyService_PropertySetDef_impl':dump(), - - %% The allowed TC not supported. - ?match({'EXCEPTION', _}, 'CosPropertyService_PropertySetFactory': - create_constrained_propertyset(Fac, [tk_noll], Valid)), - 'CosPropertyService_PropertySetDef_impl':dump(), - - Obj4 = ?match({_,pseudo,_,_,_,_}, 'CosPropertyService_PropertySetFactory': - create_initial_propertyset(Fac, Valid)), - 'CosPropertyService_PropertySetDef_impl':dump(), - corba:dispose(Obj4), - - ?match({'EXCEPTION', _}, 'CosPropertyService_PropertySetFactory': - create_initial_propertyset(Fac, Invalid)), - ?match(ok, cosProperty:stop_SetFactory(Fac)), - ok. - -%%----------------------------------------------------------------- -%% CosPropertyService_PropertySetDef API tests -%%----------------------------------------------------------------- -define_api(_Config) -> - ValidDefs = [#'CosPropertyService_Property' - {property_name = ?id1, - property_value = ?val1}, - #'CosPropertyService_Property' - {property_name = ?id2, - property_value = ?val2}, - #'CosPropertyService_Property' - {property_name = ?id3, - property_value = ?val3}], - - Fac = ?match({_,pseudo,_,_,_,_}, cosProperty:start_SetFactory()), - - io:format("@@@@ Testing PropertySet returned by the factory operation create_propertyset/1 @@@@", []), - Obj = ?match({_,pseudo,_,_,_,_}, 'CosPropertyService_PropertySetFactory': - create_propertyset(Fac)), - ?match(ok, 'CosPropertyService_PropertySet':define_property(Obj, ?id1, ?val1)), - ?match(ok, 'CosPropertyService_PropertySet':define_property(Obj, ?id1, ?val1)), - - ?match(1, 'CosPropertyService_PropertySet':get_number_of_properties(Obj)), - ?match(ok, 'CosPropertyService_PropertySet': - define_properties(Obj, [#'CosPropertyService_Property'{property_name = ?id2, - property_value = ?val2}, - #'CosPropertyService_Property'{property_name = ?id3, - property_value = ?val3}])), - - ?match(3, 'CosPropertyService_PropertySet':get_number_of_properties(Obj)), - - ?match({true, [_]}, 'CosPropertyService_PropertySet':get_properties(Obj, [?id1])), - ?match({true, [_, _, _]}, 'CosPropertyService_PropertySet':get_properties(Obj, [?id1, ?id2, ?id3])), - ?match({false,[_, _, _]}, 'CosPropertyService_PropertySet':get_properties(Obj, [?id1, "wrong", ?id3])), - - ?match(?val2, 'CosPropertyService_PropertySet':get_property_value(Obj, ?id2)), - ?match(ok, 'CosPropertyService_PropertySet':delete_property(Obj, ?id1)), - - ?match(2, 'CosPropertyService_PropertySet':get_number_of_properties(Obj)), - - ?match(ok, 'CosPropertyService_PropertySet':define_property(Obj, ?id1, ?val1)), - ?match(ok, 'CosPropertyService_PropertySet':define_property(Obj, ?id2, ?val2)), - ?match(ok, 'CosPropertyService_PropertySet':define_property(Obj, ?id3, ?val3)), - - ?match(true, 'CosPropertyService_PropertySet':delete_all_properties(Obj)), - ?match(0, 'CosPropertyService_PropertySet':get_number_of_properties(Obj)), - - ?match(ok, 'CosPropertyService_PropertySet': - define_properties(Obj, [#'CosPropertyService_Property'{property_name = ?id1, - property_value = ?val1}, - #'CosPropertyService_Property'{property_name = ?id2, - property_value = ?val2}, - #'CosPropertyService_Property'{property_name = ?id3, - property_value = ?val3}])), - - ?match(3, 'CosPropertyService_PropertySet':get_number_of_properties(Obj)), - ?match(?val2, 'CosPropertyService_PropertySet':get_property_value(Obj, ?id2)), - - ?match({'EXCEPTION',{'CosPropertyService_PropertyNotFound',_}}, - 'CosPropertyService_PropertySet':get_property_value(Obj, "wrongID")), - ?match({'EXCEPTION',{'CosPropertyService_InvalidPropertyName',_}}, - 'CosPropertyService_PropertySet':get_property_value(Obj, "")), - ?match({'EXCEPTION',{'CosPropertyService_InvalidPropertyName',_}}, - 'CosPropertyService_PropertySet':is_property_defined(Obj, "")), - ?match(false, 'CosPropertyService_PropertySet':is_property_defined(Obj, "wrongID")), - ?match(true, 'CosPropertyService_PropertySet':is_property_defined(Obj, ?id1)), - - %% This function is not supported by PropertySet. - ?match({'EXCEPTION',{'NO_IMPLEMENT',_,_,_}}, - 'CosPropertyService_PropertySetDef':get_property_modes(Obj, [?id1, ?id2, ?id3])), - - ?match({'EXCEPTION',{'CosPropertyService_MultipleExceptions',_,_}}, - 'CosPropertyService_PropertySet':delete_properties(Obj, [?id1, ?id2, ?id3, "wrongID"])), - ?match(0, 'CosPropertyService_PropertySet':get_number_of_properties(Obj)), - corba:dispose(Obj), - - io:format("@@@@ Testing PropertySet returned by the factory operation create_constrained_propertyset/3 @@@@", []), - Obj2 = ?match({_,pseudo,_,_,_,_}, 'CosPropertyService_PropertySetFactory': - create_constrained_propertyset(Fac, [tk_short], ValidDefs)), - - ?match(0, 'CosPropertyService_PropertySet':get_number_of_properties(Obj2)), - ?match({'EXCEPTION', {'CosPropertyService_UnsupportedProperty',_}}, - 'CosPropertyService_PropertySet':define_property(Obj2, ?id4, ?val4)), - ?match({'EXCEPTION', {'CosPropertyService_UnsupportedTypeCode',_}}, - 'CosPropertyService_PropertySet':define_property(Obj2, ?id1, ?val5)), - ?match(ok, 'CosPropertyService_PropertySet':define_property(Obj2, ?id1, ?val1)), - ?match(1, 'CosPropertyService_PropertySet':get_number_of_properties(Obj2)), - ?match({'EXCEPTION',{'CosPropertyService_MultipleExceptions',_,_}}, - 'CosPropertyService_PropertySet': - define_properties(Obj2, [#'CosPropertyService_Property'{property_name = ?id2, - property_value = ?val2}, - #'CosPropertyService_Property'{property_name = ?id3, - property_value = ?val3}, - #'CosPropertyService_Property'{property_name = "wrongId", - property_value = ?val2}])), - ?match(ok,'CosPropertyService_PropertySet': - define_properties(Obj2, [#'CosPropertyService_Property'{property_name = ?id2, - property_value = ?val2}, - #'CosPropertyService_Property'{property_name = ?id3, - property_value = ?val3}])), - ?match(3, 'CosPropertyService_PropertySet':get_number_of_properties(Obj2)), - ?match({'EXCEPTION',{'CosPropertyService_PropertyNotFound',_}}, - 'CosPropertyService_PropertySet':get_property_value(Obj2, "wrongID")), - ?match(?val2, 'CosPropertyService_PropertySet':get_property_value(Obj2, ?id2)), - ?match({'EXCEPTION',{'CosPropertyService_InvalidPropertyName',_}}, - 'CosPropertyService_PropertySet':get_property_value(Obj2, "")), - ?match({'EXCEPTION',{'CosPropertyService_InvalidPropertyName',_}}, - 'CosPropertyService_PropertySet':is_property_defined(Obj2, "")), - ?match(false, 'CosPropertyService_PropertySet':is_property_defined(Obj2, "wrongID")), - ?match(true, 'CosPropertyService_PropertySet':is_property_defined(Obj2, ?id1)), - - - ?match({'EXCEPTION',{'CosPropertyService_PropertyNotFound',_}}, - 'CosPropertyService_PropertySet':delete_property(Obj2, "wrongID")), - ?match(3, 'CosPropertyService_PropertySet':get_number_of_properties(Obj2)), - ?match(ok, 'CosPropertyService_PropertySet':delete_property(Obj2, ?id1)), - ?match(2, 'CosPropertyService_PropertySet':get_number_of_properties(Obj2)), - - ?match(ok, 'CosPropertyService_PropertySet':delete_properties(Obj2, [?id2])), - ?match(1, 'CosPropertyService_PropertySet':get_number_of_properties(Obj2)), - - ?match({'EXCEPTION',{'CosPropertyService_MultipleExceptions',_,_}}, - 'CosPropertyService_PropertySet':delete_properties(Obj2, [?id3, "wrongID"])), - ?match(0, 'CosPropertyService_PropertySet':get_number_of_properties(Obj2)), - corba:dispose(Obj2), - - io:format("@@@@ Testing PropertySet returned by the factory operation create_initial_propertyset/2 @@@@", []), - Obj3 = ?match({_,pseudo,_,_,_,_}, 'CosPropertyService_PropertySetFactory': - create_initial_propertyset(Fac, ValidDefs)), - ?match(3, 'CosPropertyService_PropertySet':get_number_of_properties(Obj3)), - - ?match(ok, 'CosPropertyService_PropertySet':define_property(Obj3, ?id4, ?val4)), - ?match(4, 'CosPropertyService_PropertySet':get_number_of_properties(Obj3)), - - ?match(ok,'CosPropertyService_PropertySet': - define_properties(Obj3, [#'CosPropertyService_Property'{property_name = ?id5, - property_value = ?val5}])), - - ?match(5, 'CosPropertyService_PropertySet':get_number_of_properties(Obj3)), - - ?match({'EXCEPTION',{'CosPropertyService_PropertyNotFound',_}}, - 'CosPropertyService_PropertySet':get_property_value(Obj3, "wrongID")), - ?match(?val2, 'CosPropertyService_PropertySet':get_property_value(Obj3, ?id2)), - ?match({'EXCEPTION',{'CosPropertyService_InvalidPropertyName',_}}, - 'CosPropertyService_PropertySet':get_property_value(Obj3, "")), - ?match({'EXCEPTION',{'CosPropertyService_InvalidPropertyName',_}}, - 'CosPropertyService_PropertySet':is_property_defined(Obj3, "")), - ?match(false, 'CosPropertyService_PropertySet':is_property_defined(Obj3, "wrongID")), - ?match(true, 'CosPropertyService_PropertySet':is_property_defined(Obj3, ?id1)), - - ?match({'EXCEPTION',{'CosPropertyService_PropertyNotFound',_}}, - 'CosPropertyService_PropertySet':delete_property(Obj3, "wrongId")), - ?match(ok, 'CosPropertyService_PropertySet':delete_property(Obj3, ?id5)), - ?match(4, 'CosPropertyService_PropertySet':get_number_of_properties(Obj3)), - - ?match({'EXCEPTION',{'CosPropertyService_MultipleExceptions',_,_}}, - 'CosPropertyService_PropertySet':delete_properties(Obj3, [?id1, ?id2, ?id3, "wrongID"])), - ?match(1, 'CosPropertyService_PropertySet':get_number_of_properties(Obj3)), - - ?match(true, 'CosPropertyService_PropertySet':delete_all_properties(Obj3)), - ?match(0, 'CosPropertyService_PropertySet':get_number_of_properties(Obj3)), - - corba:dispose(Obj3), - ?match(ok, cosProperty:stop_SetFactory(Fac)), - - ok. - -%%----------------------------------------------------------------- -%% CosPropertyService_PropertySetDef API tests -%%----------------------------------------------------------------- -define_with_mode_api(_Config) -> - ValidDefs = [#'CosPropertyService_PropertyDef' - {property_name = ?id1, - property_value = ?val1, - property_mode = normal}, - #'CosPropertyService_PropertyDef' - {property_name = ?id2, - property_value = ?val2, - property_mode = normal}, - #'CosPropertyService_PropertyDef' - {property_name = ?id3, - property_value = ?val3, - property_mode = normal}], - - Fac = ?match({_,pseudo,_,_,_,_}, cosProperty:start_SetDefFactory()), - - io:format("@@@@ Testing PropertySetDef returned by the factory operation create_propertysetdef/1 @@@@", []), - Obj = ?match({_,pseudo,_,_,_,_}, 'CosPropertyService_PropertySetDefFactory': - create_propertysetdef(Fac)), - - %% Initally no prop's created and no restrictions at all - ?match(0, 'CosPropertyService_PropertySetDef':get_number_of_properties(Obj)), - ?match({ok, []}, 'CosPropertyService_PropertySetDef':get_allowed_property_types(Obj)), - ?match({ok, []}, 'CosPropertyService_PropertySetDef':get_allowed_properties(Obj)), - - %% Add two properties. - ?match(ok, 'CosPropertyService_PropertySetDef':define_property_with_mode(Obj, ?id4, ?val4, read_only)), - ?match(ok, 'CosPropertyService_PropertySetDef':define_property_with_mode(Obj, ?id5, ?val5, normal)), - %% Try to add the same property again (shouldn't add another since using the sam Id). - ?match(ok, 'CosPropertyService_PropertySetDef':define_property_with_mode(Obj, ?id5, ?val5, normal)), - - %% Try to add another identical proprty with wrong TC. - ?match({'EXCEPTION',{'CosPropertyService_ConflictingProperty',_}}, - 'CosPropertyService_PropertySetDef':define_property_with_mode(Obj, ?id5, ?val4, normal)), - - - %% Should be two now. - ?match(2, 'CosPropertyService_PropertySetDef':get_number_of_properties(Obj)), - - ?match(read_only, 'CosPropertyService_PropertySetDef':get_property_mode(Obj, ?id4)), - ?match(normal, 'CosPropertyService_PropertySetDef':get_property_mode(Obj, ?id5)), - ?match(ok, 'CosPropertyService_PropertySetDef': - define_properties_with_modes(Obj, - [#'CosPropertyService_PropertyDef'{property_name = ?id1, - property_value = ?val1, - property_mode = normal}, - #'CosPropertyService_PropertyDef'{property_name = ?id2, - property_value = ?val2, - property_mode = normal}, - #'CosPropertyService_PropertyDef'{property_name = ?id3, - property_value = ?val3, - property_mode = normal}])), - %% Should be five now. - ?match(5, 'CosPropertyService_PropertySetDef':get_number_of_properties(Obj)), - ?match({true, [_,_]}, 'CosPropertyService_PropertySetDef':get_property_modes(Obj, [?id1, ?id3])), - ?match({false, [_,_,_]}, 'CosPropertyService_PropertySetDef':get_property_modes(Obj, [?id1, ?id3, "wrongID"])), - - ?match(ok, 'CosPropertyService_PropertySetDef':set_property_mode(Obj, ?id1, read_only)), - ?match(read_only, 'CosPropertyService_PropertySetDef':get_property_mode(Obj, ?id1)), - - ?match({'EXCEPTION',{'CosPropertyService_PropertyNotFound',_}}, - 'CosPropertyService_PropertySetDef':set_property_mode(Obj, "wrongID", read_only)), - - ?match({'EXCEPTION',{'CosPropertyService_MultipleExceptions',_,_}}, - 'CosPropertyService_PropertySetDef': - set_property_modes(Obj, - [#'CosPropertyService_PropertyMode'{property_name = ?id2, - property_mode = read_only}, - #'CosPropertyService_PropertyMode'{property_name = ?id3, - property_mode = read_only}, - #'CosPropertyService_PropertyMode'{property_name = "wrongID", - property_mode = read_only}])), - ?match(normal, 'CosPropertyService_PropertySetDef':get_property_mode(Obj, ?id2)), - ?match(ok, - 'CosPropertyService_PropertySetDef': - set_property_modes(Obj, - [#'CosPropertyService_PropertyMode'{property_name = ?id2, - property_mode = read_only}, - #'CosPropertyService_PropertyMode'{property_name = ?id3, - property_mode = read_only}])), - ?match(read_only, 'CosPropertyService_PropertySetDef':get_property_mode(Obj, ?id2)), - - corba:dispose(Obj), - - - io:format("@@@@ Testing PropertySetDef returned by the factory operation create_constrained_propertysetdef/3 @@@@", []), - Obj2 = ?match({_,pseudo,_,_,_,_}, 'CosPropertyService_PropertySetDefFactory': - create_constrained_propertysetdef(Fac, [tk_short], ValidDefs)), - - %% Initally no prop's created and the restrictions that only Properties eq. to ValidDefs - %% may be handled. - ?match(0, 'CosPropertyService_PropertySetDef':get_number_of_properties(Obj2)), - ?match({ok, [tk_short]}, 'CosPropertyService_PropertySetDef':get_allowed_property_types(Obj2)), - %% We cannot be sure in which order it's returned. Hmm, that's not really true but it - %% may change in the future. - ?match({ok, [_,_,_]}, 'CosPropertyService_PropertySetDef':get_allowed_properties(Obj2)), - %% Try to add a Property with and Id not eq. to ?id1, ?id2 or ?id3; must fail. - ?match({'EXCEPTION', {'CosPropertyService_UnsupportedProperty',_}}, - 'CosPropertyService_PropertySetDef':define_property_with_mode(Obj2, ?id4, ?val4, read_only)), - %% To be sure that nothing was updated. - ?match(0, 'CosPropertyService_PropertySetDef':get_number_of_properties(Obj2)), - %% Add a valid Property. - ?match(ok, 'CosPropertyService_PropertySetDef':define_property_with_mode(Obj2, ?id1, ?val1, normal)), - ?match(1, 'CosPropertyService_PropertySetDef':get_number_of_properties(Obj2)), - %% Add a sequence of 1 valid and one invalid Prop's - ?match({'EXCEPTION', {'CosPropertyService_MultipleExceptions',_,_}}, - 'CosPropertyService_PropertySetDef': - define_properties_with_modes(Obj2, - [#'CosPropertyService_PropertyDef'{property_name = ?id2, - property_value = ?val2, - property_mode = normal}, - #'CosPropertyService_PropertyDef'{property_name = "wrongID", - property_value = ?val2, - property_mode = normal}])), - %% One should be added. - ?match(1, 'CosPropertyService_PropertySetDef':get_number_of_properties(Obj2)), - ?match(ok, 'CosPropertyService_PropertySetDef': - define_properties_with_modes(Obj2, - [#'CosPropertyService_PropertyDef'{property_name = ?id3, - property_value = ?val3, - property_mode = normal}])), - %% Add a sequence of 1 valid Prop. - ?match(2, 'CosPropertyService_PropertySetDef':get_number_of_properties(Obj2)), - ?match(normal, 'CosPropertyService_PropertySetDef':get_property_mode(Obj2, ?id1)), - ?match(normal, 'CosPropertyService_PropertySetDef':get_property_mode(Obj2, ?id3)), - - - ?match({true, [_,_]}, 'CosPropertyService_PropertySetDef':get_property_modes(Obj2, [?id1, ?id3])), - ?match({false, [_,_,_]}, 'CosPropertyService_PropertySetDef':get_property_modes(Obj2, [?id1, ?id3, "wrongID"])), - - ?match(ok, 'CosPropertyService_PropertySetDef':set_property_mode(Obj2, ?id1, read_only)), - ?match(read_only, 'CosPropertyService_PropertySetDef':get_property_mode(Obj2, ?id1)), - ?match(ok, 'CosPropertyService_PropertySetDef': - set_property_modes(Obj2, - [#'CosPropertyService_PropertyMode'{property_name = ?id1, - property_mode = read_only}, - #'CosPropertyService_PropertyMode'{property_name = ?id3, - property_mode = read_only}])), - ?match(read_only, 'CosPropertyService_PropertySetDef':get_property_mode(Obj2, ?id1)), - ?match(read_only, 'CosPropertyService_PropertySetDef':get_property_mode(Obj2, ?id3)), - ?match({'EXCEPTION',{'CosPropertyService_MultipleExceptions',_,_}}, - 'CosPropertyService_PropertySetDef': - set_property_modes(Obj2, - [#'CosPropertyService_PropertyMode'{property_name = ?id1, - property_mode = normal}, - #'CosPropertyService_PropertyMode'{property_name = ?id3, - property_mode = normal}, - #'CosPropertyService_PropertyMode'{property_name = "wrongID", - property_mode = normal}])), - - ?match(read_only, 'CosPropertyService_PropertySetDef':get_property_mode(Obj2, ?id1)), - ?match(read_only, 'CosPropertyService_PropertySetDef':get_property_mode(Obj2, ?id3)), - corba:dispose(Obj2), - - io:format("@@@@ Testing PropertySetDef returned by the factory operation create_initial_propertysetdef/2 @@@@", []), - Obj3 = ?match({_,pseudo,_,_,_,_}, 'CosPropertyService_PropertySetDefFactory': - create_initial_propertysetdef(Fac, ValidDefs)), - - %% Initally the supplied prop's are created and no restrictions. - ?match(3, 'CosPropertyService_PropertySetDef':get_number_of_properties(Obj3)), - ?match({ok, []}, 'CosPropertyService_PropertySetDef':get_allowed_property_types(Obj3)), - ?match({ok, []}, 'CosPropertyService_PropertySetDef':get_allowed_properties(Obj3)), - - %% Add a new properties an test if they have been inserted. - ?match(ok, 'CosPropertyService_PropertySetDef':define_property_with_mode(Obj3, ?id4, ?val4, read_only)), - ?match(4, 'CosPropertyService_PropertySetDef':get_number_of_properties(Obj3)), - ?match(ok, 'CosPropertyService_PropertySetDef':define_property_with_mode(Obj3, ?id5, ?val5, read_only)), - ?match(5, 'CosPropertyService_PropertySetDef':get_number_of_properties(Obj3)), - - %% Lookup each Property's mode. - ?match(normal, 'CosPropertyService_PropertySetDef':get_property_mode(Obj3, ?id1)), - ?match(normal, 'CosPropertyService_PropertySetDef':get_property_mode(Obj3, ?id2)), - ?match(normal, 'CosPropertyService_PropertySetDef':get_property_mode(Obj3, ?id3)), - ?match(read_only, 'CosPropertyService_PropertySetDef':get_property_mode(Obj3, ?id4)), - ?match(read_only, 'CosPropertyService_PropertySetDef':get_property_mode(Obj3, ?id5)), - - ?match({true, [_,_,_,_,_]}, - 'CosPropertyService_PropertySetDef':get_property_modes(Obj3, [?id1, ?id2, ?id3, ?id4, ?id5])), - ?match({false, [_,_]}, - 'CosPropertyService_PropertySetDef':get_property_modes(Obj3, [?id1, "wrongID"])), - ?match(ok, 'CosPropertyService_PropertySetDef':set_property_mode(Obj3, ?id4, normal)), - ?match(normal, 'CosPropertyService_PropertySetDef':get_property_mode(Obj3, ?id4)), - - ?match(ok, 'CosPropertyService_PropertySetDef': - set_property_modes(Obj3, - [#'CosPropertyService_PropertyMode'{property_name = ?id1, - property_mode = read_only}, - #'CosPropertyService_PropertyMode'{property_name = ?id2, - property_mode = read_only}])), - ?match(read_only, 'CosPropertyService_PropertySetDef':get_property_mode(Obj3, ?id1)), - ?match(read_only, 'CosPropertyService_PropertySetDef':get_property_mode(Obj3, ?id2)), - ?match({'EXCEPTION',{'CosPropertyService_MultipleExceptions',_,_}}, - 'CosPropertyService_PropertySetDef': - set_property_modes(Obj3, - [#'CosPropertyService_PropertyMode'{property_name = ?id3, - property_mode = read_only}, - #'CosPropertyService_PropertyMode'{property_name = ?id4, - property_mode = read_only}, - #'CosPropertyService_PropertyMode'{property_name = "wrongID", - property_mode = read_only}])), - - ?match(normal, 'CosPropertyService_PropertySetDef':get_property_mode(Obj3, ?id3)), - ?match(normal, 'CosPropertyService_PropertySetDef':get_property_mode(Obj3, ?id4)), - - corba:dispose(Obj3), - - ?match(ok, cosProperty:stop_SetDefFactory(Fac)), - - ok. - - - -%%----------------------------------------------------------------- -%% CosPropertyService_PropertyNamesIterator API tests -%%----------------------------------------------------------------- -names_iterator_api(_Config) -> - Fac = ?match({_,pseudo,_,_,_,_}, cosProperty:start_SetFactory()), - Obj = ?match({_,pseudo,_,_,_,_}, 'CosPropertyService_PropertySetFactory': - create_propertyset(Fac)), - ?match(ok, 'CosPropertyService_PropertySet': - define_properties(Obj, [#'CosPropertyService_Property'{property_name = ?id1, - property_value = ?val1}, - #'CosPropertyService_Property'{property_name = ?id2, - property_value = ?val2}, - #'CosPropertyService_Property'{property_name = ?id3, - property_value = ?val3}])), - - ?match(3, 'CosPropertyService_PropertySetDef':get_number_of_properties(Obj)), - {_, _,ItObj} = ?match({ok, [], _}, 'CosPropertyService_PropertySetDef':get_all_property_names(Obj, 0)), - ?match({false, [_,_,_]}, 'CosPropertyService_PropertyNamesIterator':next_n(ItObj,3)), - ?match(ok, 'CosPropertyService_PropertyNamesIterator':reset(ItObj)), - ?match({false, [_,_,_]}, 'CosPropertyService_PropertyNamesIterator':next_n(ItObj,4)), - ?match(ok, 'CosPropertyService_PropertyNamesIterator':reset(ItObj)), - ?match({true, [_]}, 'CosPropertyService_PropertyNamesIterator':next_n(ItObj,1)), - ?match({true, _}, 'CosPropertyService_PropertyNamesIterator':next_one(ItObj)), - ?match({true, _}, 'CosPropertyService_PropertyNamesIterator':next_one(ItObj)), - ?match({false, _}, 'CosPropertyService_PropertyNamesIterator':next_one(ItObj)), - ?match(ok, 'CosPropertyService_PropertyNamesIterator':destroy(ItObj)), - - corba:dispose(Obj), - ok. - -%%----------------------------------------------------------------- -%% CosPropertyService_PropertiesIterator API tests -%%----------------------------------------------------------------- -properties_iterator_api(_Config) -> - Fac = ?match({_,pseudo,_,_,_,_}, cosProperty:start_SetFactory()), - Obj = ?match({_,pseudo,_,_,_,_}, 'CosPropertyService_PropertySetFactory': - create_propertyset(Fac)), - - ?match(ok, 'CosPropertyService_PropertySet': - define_properties(Obj, [#'CosPropertyService_Property'{property_name = ?id1, - property_value = ?val1}, - #'CosPropertyService_Property'{property_name = ?id2, - property_value = ?val2}, - #'CosPropertyService_Property'{property_name = ?id3, - property_value = ?val3}])), - - ?match(3, 'CosPropertyService_PropertySetDef':get_number_of_properties(Obj)), - {_, _,ItObj} = ?match({ok, [], _}, - 'CosPropertyService_PropertySetDef':get_all_properties(Obj, 0)), - ?match({false, [_,_,_]}, 'CosPropertyService_PropertiesIterator':next_n(ItObj,3)), - ?match(ok, 'CosPropertyService_PropertiesIterator':reset(ItObj)), - ?match({false, [_,_,_]}, 'CosPropertyService_PropertiesIterator':next_n(ItObj,4)), - ?match(ok, 'CosPropertyService_PropertiesIterator':reset(ItObj)), - ?match({true, [_]}, 'CosPropertyService_PropertiesIterator':next_n(ItObj,1)), - ?match({true, {'CosPropertyService_Property',_,_}}, - 'CosPropertyService_PropertiesIterator':next_one(ItObj)), - ?match({true, {'CosPropertyService_Property',_,_}}, - 'CosPropertyService_PropertiesIterator':next_one(ItObj)), - ?match({false, {'CosPropertyService_Property',_,_}}, - 'CosPropertyService_PropertiesIterator':next_one(ItObj)), - ?match(ok, 'CosPropertyService_PropertiesIterator':destroy(ItObj)), - corba:dispose(Obj), - ok. - - -%%----------------------------------------------------------------- -%% END OF MODULE -%%----------------------------------------------------------------- diff --git a/lib/cosProperty/vsn.mk b/lib/cosProperty/vsn.mk deleted file mode 100644 index a3a952346e..0000000000 --- a/lib/cosProperty/vsn.mk +++ /dev/null @@ -1,2 +0,0 @@ -COSPROPERTY_VSN = 1.2.3 - diff --git a/lib/cosTime/AUTHORS b/lib/cosTime/AUTHORS deleted file mode 100644 index 55d8059989..0000000000 --- a/lib/cosTime/AUTHORS +++ /dev/null @@ -1,4 +0,0 @@ -Original Authors: -Niclas Eklund - -Contributors: diff --git a/lib/cosTime/Makefile b/lib/cosTime/Makefile deleted file mode 100644 index e1b0b27284..0000000000 --- a/lib/cosTime/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2000-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include vsn.mk -VSN=$(COSTIME_VSN) - -# ---------------------------------------------------- -# Common Macros -# ---------------------------------------------------- -# SUB_DIRECTORIES = src test examples doc/src -# At the moment we don't have any example programs. -SUB_DIRECTORIES = src doc/src - -SPECIAL_TARGETS = - -# ---------------------------------------------------- -# Default Subdir Targets -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_subdir.mk diff --git a/lib/cosTime/doc/html/.gitignore b/lib/cosTime/doc/html/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosTime/doc/man3/.gitignore b/lib/cosTime/doc/man3/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosTime/doc/man6/.gitignore b/lib/cosTime/doc/man6/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosTime/doc/pdf/.gitignore b/lib/cosTime/doc/pdf/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosTime/doc/src/CosTime_TIO.xml b/lib/cosTime/doc/src/CosTime_TIO.xml deleted file mode 100644 index c01154a2c5..0000000000 --- a/lib/cosTime/doc/src/CosTime_TIO.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosTime_TIO - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 2000-02-01 - 1.0 -
- CosTime_TIO - This module implements the OMG CosTime::TIO interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosTime/include/*.hrl").

-
- - - '_get_time_interval'(TIO) -> TimeInterval - Return the interval associated with the target object - - TIO = #objref - TimeInterval = #'TimeBase_IntervalT{lower_bound, upper_bound} - lower_bound = upper_bound = ulonglong - - -

This operation returns the interval associated with the target object.

-
-
- - spans(TIO, UTO) -> Reply - Return an OverlapType which describe how the interval in the target object and the timerange represented by the UTO object overlap - - TIO = UTO = OtherTIO = #objref - Reply = {OverlapType, OtherTIO} - OverlapType = 'OTContainer' | 'OTContained' | 'OTOverlap' | 'OTNoOverlap' - - -

This operation returns a OverlapType depending on how the interval - in the target object and the timerange represented by the UTO object - overlap. If the OverlapType is 'OTNoOverlap' the out parameter represents - the gap between the two intervals. If OverlapType is one of the others, the - out parameter represents the overlap interval. - The definitions of the OverlapType's are:

-

- - 'OTContainer' - target objects lower and upper limits are, - respectively, less or equal to and greater or equal to given object's. - 'OTContained' - target objects lower and upper limits are, - respectively, greater or equal to and less or equal to given object's. - 'OTOverlap' - target objects interval overlap given object's. - 'OTNoOverlap' - target objects interval do not overlap given object's. - -
-
- - overlaps(TIO, OtherTIO) -> Reply - Return an OverlapType which describe how the interval in the target object and the timerange represented by the TIO object overlap - - TIO = OtherTIO = AnotherTIO = #objref - Reply = {OverlapType, AnotherTIO} - OverlapType = 'OTContainer' | 'OTContained' | 'OTOverlap' | 'OTNoOverlap' - - -

This operation returns a OverlapType depending on how the interval - in the target object and the timerange represented by the TIO object - overlap. The OverlapType's are described under spans/2.

-
-
- - time(TIO) -> UTO - Return a UTO in which the interval equals the time interval in the target object and time value is the midpoint of the interval - - TIO = UTO = #objref - - -

This operation returns a UTO in which the interval equals the time interval - in the target object and time value is the midpoint of the interval.

-
-
-
- -
- diff --git a/lib/cosTime/doc/src/CosTime_TimeService.xml b/lib/cosTime/doc/src/CosTime_TimeService.xml deleted file mode 100644 index b578128277..0000000000 --- a/lib/cosTime/doc/src/CosTime_TimeService.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosTime_TimeService - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 2000-02-01 - 1.0 -
- CosTime_TimeService - This module implements the OMG CosTime::TimeService interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosTime/include/*.hrl").

-
- - - universal_time(TimeService) -> Reply - Return the current time and the Inaccuracy given when starting this application in a UTO - - TimeService = #objref - Reply = UTO | {'EXCEPTION", #'TimerService_TimeUnavailable'{}} - UTO = #objref - - -

This operation returns the current time and the Inaccuracy given - when starting this application in a UTO. The time base is - 15 october 1582 00:00. Comparing two time objects which use - different time base is, by obvious reasons, pointless.

-
-
- - new_universal_time(TimeService, Time, Inaccuracy, Tdf) -> UTO - Create a new UTO object representing the time parameters given - - TimeService = UTO = #objref - Time = Inaccuracy = ulonglong() - Tdf = short() - - -

This operation creates a new UTO object representing the time - parameters given. This is the only way to create a UTO with an - arbitrary time from its components. This is useful when using the - Timer Event Service.

-
-
- - uto_from_utc(TimeService, Utc) -> UTO - Create a UTO representing the given time in Utc form - - TimeService = UTO = #objref - Utc = #'TimeBase_UtcT'{time, inacclo, inacchi, tdf} - time = ulonglong() - inacclo = ulong() - inacchi = ushort() - tdf = short() - - -

This operation is used to create a UTO given a time in the Utc form.

-
-
- - new_interval(TimeService, Lower, Upper) -> TIO - Create a new TIO object representing the input parameters - - TimeService = TIO = #objref - Lower = Upper = ulonglong() - - -

This operation is used to create a new TIO object, representing - the input parameters. If Lower is greater than Upper - BAD_PARAM is raised.

-
-
-
- -
- diff --git a/lib/cosTime/doc/src/CosTime_UTO.xml b/lib/cosTime/doc/src/CosTime_UTO.xml deleted file mode 100644 index 432d9d92f9..0000000000 --- a/lib/cosTime/doc/src/CosTime_UTO.xml +++ /dev/null @@ -1,156 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosTime_UTO - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 2000-02-01 - 1.0 -
- CosTime_UTO - This module implements the OMG CosTime::UTO interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosTime/include/*.hrl").

-
- - - '_get_time'(UTO) -> ulonglong() - Return the time associated with the target object - - UTO = #objref - - -

This operation returns the time associated with the target object.

-
-
- - '_get_inaccuracy'(UTO) -> ulonglong() - Return the inaccuracy associated with the target object - - UTO = #objref - - -

This operation returns the inaccuracy associated with the target object.

-
-
- - '_get_tdf'(UTO) -> short() - Return the time displacement factor associated with the target object - - UTO = #objref - - -

This operation returns the time displacement factor associated with - the target object.

-
-
- - '_get_utc_time'(UTO) -> UtcT - Return the data associated with the target object in Utc form - - UTO = #objref - Utc = #'TimeBase_UtcT'{time, inacclo, inacchi, tdf} - time = ulonglong() - inacclo = ulong() - inacchi = ushort() - tdf = short() - - -

This operation returns the data associated with the target object in - Utc form.

-
-
- - absolute_time(UTO) -> OtherUTO - Create a new UTO object representing the time in the target object added to current time (UTC) - - UTO = OtherUTO = #objref - - -

This operation create a new UTO object representing the time in the target - object added to current time (UTC). The time base is - 15 october 1582 00:00. Comparing two time objects which use - different time base is, by obvious reasons, pointless. - Raises DATA_CONVERSION if causes an overflow. This operation is only useful - if the target object represents a relative time.

-
-
- - compare_time(UTO, ComparisonType, OtherUTO) -> Reply - Compare the time associated with the target object and the given UTO object - - UTO = OtherUTO = #objref - ComparisonType = 'IntervalC' | 'MidC' - Reply = 'TCEqualTo' | 'TCLessThan' | 'TCGreaterThan' | 'TCIndeterminate' - - -

This operation compares the time associated with the target object and the - given UTO object. The different ComparisonType are:

-

- - 'MidC' - only compare the time represented by each object. Furthermore, - the target object is always used as the first parameter in the - comparison, i.e., if the target object's time is larger - 'TCGreaterThan' will be returned. - 'IntervalC' - also takes the inaccuracy into consideration, i.e., - if the two objects interval overlaps 'TCIndeterminate' is returned, - otherwise the as for 'MidC'. - -
-
- - time_to_interval(UTO, OtherUTO) -> TIO - Create a TIO representing the interval between the target object and the given UTO midpoint times - - UTO = OtherUTO = TIO = #objref - - -

This operation returns a TIO representing the interval between the target - object and the given UTO midpoint times. The inaccuracy in the objects are - not taken into consideration.

-
-
- - interval(UTO) -> TIO - Create a TIO object representing the error interval around the time value represented by the target object - - UTO = TIO = #objref - - -

This operation creates a TIO object representing the error interval - around the time value represented by the target object, i.e., - TIO.upper_bound = UTO.time+UTO.inaccuracy and - TIO.lower_bound = UTO.time-UTO.inaccuracy.

-
-
-
- -
- diff --git a/lib/cosTime/doc/src/CosTimerEvent_TimerEventHandler.xml b/lib/cosTime/doc/src/CosTimerEvent_TimerEventHandler.xml deleted file mode 100644 index 4b43b0b12e..0000000000 --- a/lib/cosTime/doc/src/CosTimerEvent_TimerEventHandler.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosTimerEvent_TimerEventHandler - - - - Niclas Eklund - - 2000-02-01 - 1.0 -
- CosTimerEvent_TimerEventHandler - This module implements the OMG CosTimerEvent::TimerEventHandler interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosTime/include/*.hrl").

-
- - - '_get_status'(TimerEventHandler) -> Reply - Return the status of the target object - - TimerEventHandler = #objref - Reply = 'ESTimeSet' | 'ESTimeCleared' | 'ESTriggered' | 'ESFailedTrigger' - - -

This operation returns the status of the target object.

- - 'ESTimeSet' - timer is set to trigger event(s). - 'ESTimeCleared' - no time set or the timer have been reset. - 'ESTriggered' - event has already been sent. - 'ESFailedTrigger' - tried to, but failed, sending the event. - -

If the target object is of type 'TTPeriodic' the status value - 'ESTriggered' is not valid.

-
-
- - time_set(TimerEventHandler) -> Reply - Return trueif the time has been set for an event that is yet to be triggered, falseotherwise. The outparameter represents the current time value of the target object - - TimerEventHandler = #objref - Reply = {boolean(), UTO} - UTO = #objref - - -

This operation returns true if the time has been set for an event that - is yet to be triggered, false otherwise. The outparameter represents - the current time value of the target object.

-
-
- - set_timer(TimerEventHandler, TimeType, TriggerTime) -> void() - Terminate terminate any previous set trigger, and set a new trigger specified by the TimeTypeand UTOobjects - - TimerEventHandler = #objref - TimeType = 'TTAbsolute' | 'TTRelative' | 'TTPeriodic' - TriggerTime = UTO - UTO = #objref - - -

This operation terminates any previous set trigger, and set a new trigger - specified by the TimeType and UTO objects.

-

The relation between the UTO object and the TimeTypes are:

- - 'TTAbsolute' - the UTO object must represent absolute time, i.e., - number of 100 nanoseconds passed since 15 october - 1582 00:00. - 'TTRelative' - the UTO object must represent the from now until when - the event should be triggered, e.g., within 30*10^7 nanoseconds. - 'TTPeriodic' - the same as for 'TTRelative', but this option - will trigger an event periodically until timer cancelled. - -
-
- - cancel_timer(TimerEventHandler) -> boolean() - Cancel, if possible, triggering of event(s). Returntrueif an event is actually cancelled, falseotherwise - - TimerEventHandler = #objref - - -

This operation cancel, if possible, the triggering of event(s). Returns - true if an event is actually cancelled, false otherwise.

-
-
- - set_data(TimerEventHandler, EventData) -> ok - Change the event data sent when triggered - - TimerEventHandler = #objref - EventData = #any - - -

This operation changes the event data sent when triggered.

-
-
-
- -
- diff --git a/lib/cosTime/doc/src/CosTimerEvent_TimerEventService.xml b/lib/cosTime/doc/src/CosTimerEvent_TimerEventService.xml deleted file mode 100644 index 1db4760c81..0000000000 --- a/lib/cosTime/doc/src/CosTimerEvent_TimerEventService.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosTimerEvent_TimerEventService - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 2000-02-01 - 1.0 -
- CosTimerEvent_TimerEventService - This module implements the OMG CosTimerEvent::TimerEventService interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosTime/include/*.hrl").

-
- - - register(TimerEventService, CosEventCommPushConsumer, Data) -> TimerEventHandler - Create a new TimerEventHandlerobject which push the givenDatato given CosEventCommPushConsumerafter the timer have been set - - TimerEventService = CosEventCommPushConsumer = TimerEventHandler = #objref - Data = #any - - -

This operation will create a new TimerEventHandler object which - will push given Data to given CosEventCommPushConsumer after - the timer have been set.

-
-
- - unregister(TimerEventService, TimerEventHandler) -> ok - Terminate the target TimerEventHandler object - - TimerEventService = TimerEventHandler = #objref - - -

This operation will terminate the given TimerEventHandler.

-
-
- - event_time(TimerEventService, TimerEvent) -> UTO - Return a UTO containing the time at which the associated event was triggered - - TimerEventService = #objref - TimerEvent = #'CosTimerEvent_TimerEvent'{utc, event_data} - utc = - event_data = #any} - UTO = #objref - - -

This operation returns a UTO containing the time at which the associated - event was triggered.

-
-
-
- -
- diff --git a/lib/cosTime/doc/src/Makefile b/lib/cosTime/doc/src/Makefile deleted file mode 100644 index 6886d2812c..0000000000 --- a/lib/cosTime/doc/src/Makefile +++ /dev/null @@ -1,138 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2000-2017. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../../vsn.mk -VSN=$(COSTIME_VSN) -APPLICATION=cosTime - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN) - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -XML_APPLICATION_FILES = ref_man.xml -XML_REF3_FILES = \ - cosTime.xml \ - CosTime_TIO.xml \ - CosTime_TimeService.xml \ - CosTime_UTO.xml \ - CosTimerEvent_TimerEventHandler.xml \ - CosTimerEvent_TimerEventService.xml \ - -XML_PART_FILES = \ - part.xml -XML_CHAPTER_FILES = \ - ch_contents.xml \ - ch_introduction.xml \ - ch_install.xml \ - ch_example.xml \ - notes.xml - -BOOK_FILES = book.xml - -XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \ - $(XML_PART_FILES) $(XML_CHAPTER_FILES) - -TECHNICAL_DESCR_FILES = - -GIF_FILES = - -PS_FILES = - -# ---------------------------------------------------- - -INTERNAL_HTML_FILES = $(TECHNICAL_DESCR_FILES:%.xml=$(HTMLDIR)/%.html) - -HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \ - $(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html) - -INFO_FILE = ../../info -EXTRA_FILES = \ - $(DEFAULT_GIF_FILES) \ - $(DEFAULT_HTML_FILES) \ - $(XML_REF3_FILES:%.xml=$(HTMLDIR)/%.html) \ - $(XML_CHAPTER_FILES:%.xml=$(HTMLDIR)/%.html) - -MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3) - -HTML_REF_MAN_FILE = $(HTMLDIR)/index.html - -TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -XML_FLAGS += -DVIPS_FLAGS += - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -$(HTMLDIR)/%.gif: %.gif - $(INSTALL_DATA) $< $@ - -docs: pdf html man - -$(TOP_PDF_FILE): $(XML_FILES) - -pdf: $(TOP_PDF_FILE) - -html: gifs $(HTML_REF_MAN_FILE) - -clean clean_docs: - rm -rf $(HTMLDIR)/* - rm -f $(MAN3DIR)/* - rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) - rm -f errs core *~ - -man: $(MAN3_FILES) - -gifs: $(GIF_FILES:%=$(HTMLDIR)/%) - -$(INDEX_TARGET): $(INDEX_SRC) - sed -e 's;%VSN%;$(VSN);' $(INDEX_SRC) > $(INDEX_TARGET) - -debug opt: - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_docs_spec: docs - $(INSTALL_DIR) "$(RELSYSDIR)/doc/pdf" - $(INSTALL_DATA) $(TOP_PDF_FILE) "$(RELSYSDIR)/doc/pdf" - $(INSTALL_DIR) "$(RELSYSDIR)/doc/html" - $(INSTALL_DATA) $(HTMLDIR)/* \ - "$(RELSYSDIR)/doc/html" - $(INSTALL_DATA) $(INFO_FILE) "$(RELSYSDIR)" - $(INSTALL_DIR) "$(RELEASE_PATH)/man/man3" - $(INSTALL_DATA) $(MAN3DIR)/* "$(RELEASE_PATH)/man/man3" - -release_spec: diff --git a/lib/cosTime/doc/src/book.xml b/lib/cosTime/doc/src/book.xml deleted file mode 100644 index a89b005e84..0000000000 --- a/lib/cosTime/doc/src/book.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosTime - Niclas Eklund - - 2000-01-31 - 1.0 -
- - - cosTime - - - - - - - - - - - - - - -
- diff --git a/lib/cosTime/doc/src/ch_contents.xml b/lib/cosTime/doc/src/ch_contents.xml deleted file mode 100644 index 8b1c9dd646..0000000000 --- a/lib/cosTime/doc/src/ch_contents.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - The cosTime Application - Niclas Eklund - - 2000-01-31 - 1.0 - ch_contents.xml -
- -
- Content Overview -

The cosTime documentation is divided into three sections: -

- - -

PART ONE - The User's Guide -

-Description of the cosTime Application including - services and a small tutorial demonstrating - the development of a simple service.

-
- -

PART TWO - Release Notes -

-A concise history of cosTime.

-
- -

PART THREE - The Reference Manual -

- A quick reference guide, including a - brief description, to all the functions available in cosTime.

-
-
-
- -
- Brief Description of the User's Guide -

The User's Guide contains the following parts:

- - -

cosTime overview

-
- -

cosTime installation

-
- -

A tutorial example

-
-
-
-
- diff --git a/lib/cosTime/doc/src/ch_example.xml b/lib/cosTime/doc/src/ch_example.xml deleted file mode 100644 index 690fba8d93..0000000000 --- a/lib/cosTime/doc/src/ch_example.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosTime Examples - Niclas Eklund - - 2000-01-31 - A - ch_example.xml -
- -
- A Tutorial on How to Create a Simple Service - -
- Initiate the Application -

To use the complete cosTime application Time and Timer Event Services - must be installed. The application is then started by using - cosTime:start(). To get access to Time Service or Timer Event Service, - use start_time_service/2 or start_timerevent_service/1.

-

The Time Service are global, i.e., there may only exist one instance per - Orber domain.

-

The Timer Event Service is locally registered, i.e., there may only exist - one instance per node.

- -

The Time and Timer Event Service use the time base - 15 october 1582 00:00. Performing operations using other time - bases will not yield correct result. Furthermore, time and inaccuracy - must be expressed in 100 nano seconds.

-
-
- -
- How to Run Everything -

Below is a short transcript on how to run cosTime.

- - -%% Start Mnesia and Orber -mnesia:delete_schema([node()]), -mnesia:create_schema([node()]), -orber:install([node()]), -mnesia:start(), -orber:start(), - -%% Install Time Service in the IFR. -cosTime:install_time(), - -%% Install Timer Event Service in the IFR. Which, require -%% the Time Service and cosEvent or cosNotification -%% application to be installed. -cosNotification:install(), -cosTime:install_timerevent(), - -%% Now start the application and necessary services. -cosTime:start(), -%% Tdf == Time displacement factor -%% Inaccuracy measured in 100 nano seconds -TS=cosTime:start_time_service(TDF, Inaccuracy), -TES=cosTime:start_timerevent_service(TS), - -%% Access a cosNotification Proxy Push Consumer. How this is -%% done is implementation specific. -ProxyPushConsumer = .... - -%% How we construct the event is also implementation specific. -AnyEvent = .... - -%% Create a new relative universal time. -%% Time measured in 100 nano seconds. -UTO='CosTime_TimeService': - new_universal_time(TS, Time, Inaccuracy, TDF), -EH='CosTimerEvent_TimerEventService': - register(TES, ProxyPushConsumer, AnyEvent), - -%% If we want to trigger one event Time*10^-7 seconds from now: -'CosTimerEvent_TimerEventHandler':set_timer(EH, 'TTRelative', UTO), - -%% If we want to trigger an event every Time*10^-7 seconds, starting -%% Time*10^-7 seconds from now: -'CosTimerEvent_TimerEventHandler':set_timer(EH, 'TTPeriodic', UTO), - -%% If we want to use absolute time we must retrieve such an object. -%% One way is to convert the one we got, UTO, by using: -UTO2='CosTime_UTO':absolute_time(UTO), -%% If any other way is used, the correct time base MUST be used, i.e., -%% 15 october 1582 00:00. -'CosTimerEvent_TimerEventHandler':set_timer(EH, 'TTAbsolute', UTO2), - -
-
-
- diff --git a/lib/cosTime/doc/src/ch_install.xml b/lib/cosTime/doc/src/ch_install.xml deleted file mode 100644 index 9d819a7be7..0000000000 --- a/lib/cosTime/doc/src/ch_install.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Installing cosTime - Niclas Eklund - - 2000-01-31 - - ch_install.xml -
- -
- Installation Process -

This chapter describes how to install - cosTime in an Erlang Environment. -

- -
- Preparation -

Before starting the installation process for cosTime, - the application Orber must be running.

-
- -
- Configuration -

When using both the Time and TimerEvent Services the cosTime application - first must be installed using cosTime:install_time() and - cosTime:install_timerevent(), followed by cosTime:start(). - Now we can choose which can start the servers by using - cosTime:start_time_service(Tdf, Inaccuracy) - and cosTime:start_timerevent_service(TimeService).

-
-
-
- diff --git a/lib/cosTime/doc/src/ch_introduction.xml b/lib/cosTime/doc/src/ch_introduction.xml deleted file mode 100644 index 1a11606716..0000000000 --- a/lib/cosTime/doc/src/ch_introduction.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Introduction to cosTime - Niclas Eklund - - 2000-01-31 - - ch_introduction.xml -
- -
- Overview -

The cosTime application is Time and TimerEvent Services compliant with the OMG - Services CosTime and CosTimerEvent. -

- -
- Purpose and Dependencies -

This application use calender:now_to_universal_time(Now) to create a - UTC. Hence, the underlying OS must deliver a correct result when calling - erlang:now().

-

cosTime is dependent on Orber, which provides CORBA functionality in an Erlang environment.

-

cosTimerEvent is dependent on Orber and cosNotification, - which provides CORBA functionality and Event handling in an Erlang environment.

-
- -
- Prerequisites -

To fully understand the concepts presented in the - documentation, it is recommended that the user is familiar - with distributed programming, CORBA, the Orber and cosNotification applications. -

-

Recommended reading includes CORBA, Fundamentals and Programming - Jon Siegel and Open Telecom Platform Documentation Set. It is also helpful to have read Concurrent Programming in Erlang.

-
-
-
- diff --git a/lib/cosTime/doc/src/cosTime.xml b/lib/cosTime/doc/src/cosTime.xml deleted file mode 100644 index 02aef1401c..0000000000 --- a/lib/cosTime/doc/src/cosTime.xml +++ /dev/null @@ -1,175 +0,0 @@ - - - - -
- - 2000 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - cosTime - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 2000-01-31 - PA1 -
- cosTime - The main module of the cosTime application - -

To get access to the record definitions for the structures use:

--include_lib("cosTime/include/*.hrl").

-

This module contains the functions for starting and stopping the application.

-

This application use the time base 15 october 1582 00:00. - Performing operations using other time bases will not yield correct result.

-

The OMG CosTime specification defines the operation - secure_universal_time. As of today we cannot provide this functionality - considering the criteria demanded to fulfill the OMG specification.

-

When using this application, time and inaccuracy supplied by the user must - be given in number of 100 nano seconds. The - Time Displacement Factor is positive east of the meridian, while - those to the west are negative.

-

This application use calender:now_to_universal_time(Now) to create a - UTC. Hence, the underlying OS must deliver a correct result when calling - erlang:now().

-

When determining the inaccuracy of the system, the user should consider the - way the time objects will be used. Communicating with other ORB's, add a - substantial overhead and should be taken into consideration.

-
- - - install_time() -> Return - Install the cosTime Time Service part application - - Return = ok | {'EXIT', Reason} - - -

This operation installs the cosTime Time Service part application.

-
-
- - uninstall_time() -> Return - Uninstall the cosTime Time Service part application - - Return = ok | {'EXIT', Reason} - - -

This operation uninstalls the cosTime Time Service part application.

-
-
- - install_timerevent() -> Return - Install the cosTime Timer Event Service part application - - Return = ok | {'EXIT', Reason} - - -

This operation installs the cosTime Timer Event Service part application.

- -

The Timer Event Service part requires Time Service part and - cosEvent or the cosNotification application to be installed - first.

-
-
-
- - uninstall_timerevent() -> Return - Uninstall the cosTime Timer Event Service part application - - Return = ok | {'EXIT', Reason} - - -

This operation uninstalls the cosTime Timer Event Service part application.

-
-
- - start() -> Return - Start the cosTime application - - Return = ok | {error, Reason} - - -

This operation starts the cosTime application.

-
-
- - stop() -> Return - Stop the cosTime application - - Return = ok | {error, Reason} - - -

This operation stops the cosTime application.

-
-
- - start_time_service(Tdf, Inaccuracy) -> Return - Start a Time Service object - - Tdf = short() - Inaccuracy = ulonglong(), eq. #100 nano seconds - Return = ok | {'EXCEPTION', #'BAD_PARAM'{}} - - -

This operation starts a Time Service server. Please note that there - may only be exactly one Time Service active at a time. The Inaccuracy - parameter defines the inaccuracy the underlying OS will introduce. Remember - to take into account latency when passing time object between nodes.

-
-
- - stop_time_service(TimeService) -> ok - Stop the target Time Service object - - TimeService = #objref - - -

This operation stops the Time Service object.

-
-
- - start_timerevent_service(TimeService) -> ok - Start a Timer Event Service object - - TimeService = #objref - - -

This operation starts a Timer Event Service server. Please note that there - may only be exactly one Timer Event Service per node active at a time. The - supplied TimeServcie reference will be the object Timer Event Service - contacts to get access to a new UTC.

-
-
- - stop_timerevent_service(TimerEventService) -> ok - Stop the target Timer Event Service object - - TimerEventService = #objref - - -

This operation stops the Timer Event Service object.

-
-
-
- -
- diff --git a/lib/cosTime/doc/src/notes.xml b/lib/cosTime/doc/src/notes.xml deleted file mode 100644 index 16e02f8b1f..0000000000 --- a/lib/cosTime/doc/src/notes.xml +++ /dev/null @@ -1,360 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosTime Release Notes - Niclas Eklund - Niclas Eklund - - - - 2000-01-31 - A - notes.xml -
- -
cosTime 1.2.3 - -
Fixed Bugs and Malfunctions - - -

Removed all old unused files in the documentation. -

-

- Own Id: OTP-14475 Aux Id: ERL-409, PR-1493

-
-
-
- -
- -
cosTime 1.2.2 - -
Improvements and New Features - - -

- Internal changes

-

- Own Id: OTP-13551

-
-
-
- -
- -
cosTime 1.2.1 - -
Improvements and New Features - - -

Suppress Dialyzer warnings.

-

- Own Id: OTP-12862

-
-
-
- -
- -
cosTime 1.2 - -
Improvements and New Features - - -

Remove the usage of erlang:now() from all Corba - applications and use the new rand module instead of - random.

-

- Own Id: OTP-12687

-
-
-
- -
- -
cosTime 1.1.14 - -
Improvements and New Features - - -

The default encoding of Erlang files has been changed - from ISO-8859-1 to UTF-8.

The encoding of XML - files has also been changed to UTF-8.

-

- Own Id: OTP-10907

-
-
-
- -
- -
cosTime 1.1.13 - -
Improvements and New Features - - -

- Misc build updates

-

- Own Id: OTP-10784

-
-
-
- -
- -
cosTime 1.1.12 - -
Improvements and New Features - - -

Erlang/OTP can now be built using parallel make if you - limit the number of jobs, for instance using 'make - -j6' or 'make -j10'. 'make -j' does not - work at the moment because of some missing - dependencies.

-

- Own Id: OTP-9451

-
-
-
- -
- -
- cosTime 1.1.11 - -
- Improvements and New Features - - -

- Removed superfluous usage of shy in the documentation since it can cause problem if - a buggy tool is used.

-

- Own Id: OTP-9319 Aux Id:

-
-
-
-
- -
- cosTime 1.1.10 - -
- Improvements and New Features - - -

- Eliminated Dialyzer warnings when using exit or throw.

-

- Own Id: OTP-9050 Aux Id:

-
-
-
-
- -
- cosTime 1.1.9 - -
- Improvements and New Features - - -

- Test suites published.

-

- Own Id: OTP-8543 Aux Id:

-
-
-
-
- -
- cosTime 1.1.8 - -
- Fixed Bugs and Malfunctions - - -

The documentation EIX file was not generated.

-

Own id: OTP-8355 Aux Id:

-
-
-
-
- -
- cosTime 1.1.7 - -
- Improvements and New Features - - -

- The documentation is now built with open source tools (xsltproc and fop) - that exists on most platforms. One visible change is that the frames are removed.

-

- Own Id: OTP-8201 Aux Id:

-
-
-
-
- -
- cosTime 1.1.6 - -
- Improvements and New Features - - -

Obsolete guards, e.g. record vs is_record, has been changed - to avoid compiler warnings.

-

Own id: OTP-7987

-
-
-
-
- -
- cosTime 1.1.5 - -
- Improvements and New Features - - -

Updated file headers.

-

Own id: OTP-7837

-
-
-
-
- -
- cosTime 1.1.4 - -
- Improvements and New Features - - -

Documentation source included in open source releases.

-

Own id: OTP-7595

-
-
-
-
- -
- cosTime 1.1.3 - -
- Improvements and New Features - - -

Updated file headers.

-

Own id: OTP-7011

-
-
-
-
- -
- cosTime 1.1.2 - -
- Improvements and New Features - - -

The documentation source has been converted from SGML to XML.

-

Own id: OTP-6754

-
-
-
-
- -
- cosTime 1.1.1 - -
- Improvements and New Features - - -

Minor Makefile changes.

-

Own id: OTP-6701

-
-
-
-
- -
- cosTime 1.1 - -
- Improvements and New Features - - -

The stub/skeleton-files generated by IC have been improved, - i.e., depending on the IDL-files, reduced the size of the - erl- and beam-files and decreased dependencies off Orber's - Interface Repository. It is necessary to re-compile all IDL-files - and use COS-applications, including Orber, compiled with - IC-4.2.

-

Own id: OTP-4576

-
-
-
-
- -
- cosTime 1.0.1.1 - -
- Incompatibilities - - -

An includepath in CosTimerEvent.idl have been - changed. Hence, if you include this file you should check - your include paths for your IDL-file(s), i.e., add - the path to CosEventComm.idl.

-

Own Id: OTP-4093

-
-
-
-
- -
- cosTime 1.0.1 - -
- Improvements and New Features - - -

First release of the cosTime application.

-

Own Id: -

-
-
-
-
-
- diff --git a/lib/cosTime/doc/src/part.xml b/lib/cosTime/doc/src/part.xml deleted file mode 100644 index f0b26d4a56..0000000000 --- a/lib/cosTime/doc/src/part.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosTime User's Guide - Niclas Eklund - - 2000-01-31 - 1.0 -
- -

The cosTime application is an Erlang implementation of the OMG - CORBA Time and TimerEvent Services.

-
- - - - -
- diff --git a/lib/cosTime/doc/src/ref_man.xml b/lib/cosTime/doc/src/ref_man.xml deleted file mode 100644 index 66bca4af0e..0000000000 --- a/lib/cosTime/doc/src/ref_man.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - -
- - 20002016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosTime Reference Manual - Niclas Eklund - - 2000-01-31 - 1.0 -
- -

The cosTime application is an Erlang implementation of the OMG - CORBA Time and TimerEvent Services.

-
- - - - - - -
- diff --git a/lib/cosTime/ebin/.gitignore b/lib/cosTime/ebin/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosTime/examples/.gitignore b/lib/cosTime/examples/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosTime/include/.gitignore b/lib/cosTime/include/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosTime/info b/lib/cosTime/info deleted file mode 100644 index 7820f3fdaa..0000000000 --- a/lib/cosTime/info +++ /dev/null @@ -1,12 +0,0 @@ -group: orb -short: Orber OMG Timer and TimerEvent Services - - - - - - - - - - diff --git a/lib/cosTime/priv/.gitignore b/lib/cosTime/priv/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosTime/src/CosTime.cfg b/lib/cosTime/src/CosTime.cfg deleted file mode 100644 index 1aad9ebb94..0000000000 --- a/lib/cosTime/src/CosTime.cfg +++ /dev/null @@ -1,6 +0,0 @@ -{this, "CosTime::UTO"}. -{{handle_info, "CosTime::UTO"}, true}. -{this, "CosTime::TIO"}. -{{handle_info, "CosTime::TIO"}, true}. -{this, "CosTime::TimeService"}. -{{handle_info, "CosTime::TimeService"}, true}. diff --git a/lib/cosTime/src/CosTime.idl b/lib/cosTime/src/CosTime.idl deleted file mode 100644 index 2bf32681c1..0000000000 --- a/lib/cosTime/src/CosTime.idl +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef _COS_TIME_IDL_ -#define _COS_TIME_IDL_ - -#pragma prefix "omg.org" - -#include - -module CosTime { - enum TimeComparison { - TCEqualTo, - TCLessThan, - TCGreaterThan, - TCIndeterminate - }; - enum ComparisonType{ - IntervalC, - MidC }; - enum OverlapType { - OTContainer, - OTContained, - OTOverlap, - OTNoOverlap - }; - - exception TimeUnavailable {}; - interface TIO; // forward declaration - - interface UTO { - readonly attribute TimeBase::TimeT time; - readonly attribute TimeBase::InaccuracyT inaccuracy; - readonly attribute TimeBase::TdfT tdf; - readonly attribute TimeBase::UtcT utc_time; - - UTO absolute_time(); - TimeComparison compare_time( in ComparisonType comparison_type, in UTO uto ); - TIO time_to_interval( in UTO uto ); - TIO interval(); - }; - - interface TIO { - readonly attribute TimeBase::IntervalT time_interval; - - OverlapType spans ( in UTO time, out TIO overlap ); - OverlapType overlaps ( in TIO interval, out TIO overlap ); - UTO time (); - }; - - interface TimeService { - UTO universal_time() - raises(TimeUnavailable ); - UTO secure_universal_time() - raises(TimeUnavailable ); - UTO new_universal_time( in TimeBase::TimeT time, in TimeBase::InaccuracyT inaccuracy, in TimeBase::TdfT tdf ); - UTO uto_from_utc( in TimeBase::UtcT utc ); - TIO new_interval( in TimeBase::TimeT lower, in TimeBase::TimeT upper ); - }; -}; - -#endif diff --git a/lib/cosTime/src/CosTime_TIO_impl.erl b/lib/cosTime/src/CosTime_TIO_impl.erl deleted file mode 100644 index 6d4046d428..0000000000 --- a/lib/cosTime/src/CosTime_TIO_impl.erl +++ /dev/null @@ -1,201 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosTime_TIO_impl.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module('CosTime_TIO_impl'). - -%%--------------- INCLUDES ----------------------------------- --include("cosTimeApp.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%%--------------- External ----------------------------------- -%% Attributes (external) --export(['_get_time_interval'/2]). - -%% Interface functions --export([spans/3, overlaps/3, time/2]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - - -%% Data structures --record(state, {interval, - tdf, - timer}). -%% Data structures constructors --define(get_InitState(I,T,TO), - #state{interval = I, - tdf = T, - timer = TO}). - -%% Data structures selectors --define(get_IntervalT(S), S#state.interval). --define(get_Lower(S), (S#state.interval)#'TimeBase_IntervalT'.lower_bound). --define(get_Upper(S), (S#state.interval)#'TimeBase_IntervalT'.upper_bound). --define(get_Tdf(S), S#state.tdf). --define(get_TimerObj(S), S#state.timer). - -%%-----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the gen_server module. -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. -handle_info(_Info, State) -> - {noreply, State}. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init([Interval, Tdf, Timer]) -> - {ok, ?get_InitState(Interval, Tdf, Timer)}. - -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------- -%%------------------------ attributes ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Attribute: '_get_time_interval' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_time_interval'(_OE_THIS, State) -> - {reply, ?get_IntervalT(State), State}. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% function : spans -%% Arguments: Time - UTO -%% Returns : CosTime::OverLapType - enum() -%% TIO - out-parameter. -%%----------------------------------------------------------- -spans(_OE_THIS, State, Time) -> - ?time_TypeCheck(Time, 'CosTime_UTO'), - case catch 'CosTime_UTO':'_get_utc_time'(Time) of - #'TimeBase_UtcT'{time = Btime, inacclo = InaccL, inacchi=InaccH} -> - Inaccuarcy = ?concat_TimeT(InaccH, InaccL), - BL = Btime - Inaccuarcy, - BU = Btime + Inaccuarcy, - L = ?get_Lower(State), - U = ?get_Upper(State), - {Type, NewL, NewU} = - if - L==BU -> - {'OTContainer',BL,BU}; - L>=BL, U= - {'OTContained',L,U}; - L=BL -> - {'OTOverlap',BL,U}; - L>=BL, L=BU -> - {'OTOverlap',L,BU}; - L>BU -> - {'OTNoOverlap',BU,L}; - true -> - {'OTNoOverlap',U,BL} - end, - {reply, - {Type, - 'CosTime_TIO':oe_create([#'TimeBase_IntervalT'{lower_bound=NewL, - upper_bound=NewU}, - ?get_Tdf(State), - ?get_TimerObj(State)], - [{pseudo,true}|?CREATE_OPTS])}, - State}; - _ -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end. - - -%%----------------------------------------------------------% -%% function : overlaps -%% Arguments: Interval - TIO -%% Returns : CosTime::OverLapType - enum() -%% TIO - out-parameter. -%%----------------------------------------------------------- -overlaps(_OE_THIS, State, Interval) -> - ?time_TypeCheck(Interval, 'CosTime_TIO'), - case catch 'CosTime_TIO':'_get_time_interval'(Interval) of - #'TimeBase_IntervalT'{lower_bound=BL, upper_bound=BU} -> - L = ?get_Lower(State), - U = ?get_Upper(State), - {Type, NewL, NewU} = - if - L==BU -> - {'OTContainer',BL,BU}; - L>=BL, U= - {'OTContained',L,U}; - L=BL -> - {'OTOverlap',BL,U}; - L>=BL, L=BU -> - {'OTOverlap',L,BU}; - L>BU -> - {'OTNoOverlap',BU,L}; - true -> - {'OTNoOverlap',U,BL} - end, - {reply, - {Type, - 'CosTime_TIO':oe_create([#'TimeBase_IntervalT'{lower_bound=NewL, - upper_bound=NewU}, - ?get_Tdf(State), - ?get_TimerObj(State)], - [{pseudo,true}|?CREATE_OPTS])}, - State}; - _ -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end. - -%%----------------------------------------------------------% -%% function : time -%% Arguments: - -%% Returns : UTO -%%----------------------------------------------------------- -time(_OE_THIS, State) -> - L = ?get_Lower(State), - H = ?get_Upper(State), - Utc = #'TimeBase_UtcT'{time=(erlang:trunc(((H-L)/2))+L), - inacclo=L, - inacchi=H, - tdf=?get_Tdf(State)}, - {reply, - 'CosTime_UTO':oe_create([Utc, ?get_TimerObj(State)], [{pseudo,true}|?CREATE_OPTS]), - State}. - - -%%--------------- LOCAL FUNCTIONS ---------------------------- - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosTime/src/CosTime_TimeService_impl.erl b/lib/cosTime/src/CosTime_TimeService_impl.erl deleted file mode 100644 index 72c65757ad..0000000000 --- a/lib/cosTime/src/CosTime_TimeService_impl.erl +++ /dev/null @@ -1,182 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosTime_TimeService_impl.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module('CosTime_TimeService_impl'). - -%%--------------- INCLUDES ----------------------------------- --include("cosTimeApp.hrl"). - -%%--------------- EXPORTS ------------------------------------ -%%--------------- External ----------------------------------- -%% Interface functions --export([universal_time/2, secure_universal_time/2, new_universal_time/5]). --export([uto_from_utc/3, new_interval/4]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - - -%% Data structures --record(state, - {tdf, - inaccuracy}). -%% Data structures constructors --define(get_InitState(T,I), - #state{tdf = T, - inaccuracy = I}). - -%% Data structures selectors --define(get_Inaccuracy(S), S#state.inaccuracy). --define(get_Tdf(S), S#state.tdf). - -%% Data structures modifiers - -%% MISC - -%%-----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the gen_server module. -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(_Info, State) -> - ?debug_print("INFO: ~p~n", [_Info]), - {noreply, State}. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init([Tdf, Inaccuracy]) -> - process_flag(trap_exit, true), - {ok, ?get_InitState(Tdf, Inaccuracy)}. - -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% function : universal_time -%% Arguments: - -%% Returns : CosTime::UTO | -%% {'EXCEPTION", #'CosTime_TimeUnavailable'{}} -%% NOTE : cosTime:create_universal_time will raise the correct -%% exception. -%%----------------------------------------------------------- -universal_time(OE_THIS, State) -> - {ok, Time} = create_universal_time(), - Inaccuracy = ?get_Inaccuracy(State), - Utc = #'TimeBase_UtcT'{time=Time, inacclo = ?low_TimeT(Inaccuracy), - inacchi = ?high_TimeT(Inaccuracy), - tdf = ?get_Tdf(State)}, - {reply, 'CosTime_UTO':oe_create([Utc, OE_THIS], [{pseudo,true}|?CREATE_OPTS]), State}. - -%%----------------------------------------------------------% -%% function : secure_universal_time -%% Arguments: -%% Returns : {'EXCEPTION", #'CosTime_TimeUnavailable'{}} -%%----------------------------------------------------------- --spec secure_universal_time(_, _) -> no_return(). -secure_universal_time(_OE_THIS, _State) -> - corba:raise(#'CosTime_TimeUnavailable'{}). - -%%----------------------------------------------------------% -%% function : new_universal_time -%% Arguments: Time - TimeBase::TimeT -%% Inaccuracy - TimeBase::InaccuracyT inaccuracy -%% Tdf - TimeBase::TdfT -%% Returns : CosTime::UTO -%%----------------------------------------------------------- -new_universal_time(OE_THIS, State, Time, Inaccuracy, Tdf) when - is_integer(Time) andalso is_integer(Inaccuracy) andalso is_integer(Tdf) andalso - Tdf=<12 andalso Inaccuracy= - Utc = #'TimeBase_UtcT'{time=Time, inacclo = ?low_TimeT(Inaccuracy), - inacchi = ?high_TimeT(Inaccuracy), tdf = Tdf}, - {reply, 'CosTime_UTO':oe_create([Utc, OE_THIS], [{pseudo,true}|?CREATE_OPTS]), State}; -new_universal_time(_, _, _, _, _) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : uto_from_utc -%% Arguments: Utc - TimeBase::UtcT -%% Returns : CosTime::UTO -%%----------------------------------------------------------- -uto_from_utc(OE_THIS, State, Utc) when is_record(Utc, 'TimeBase_UtcT') -> - {reply, 'CosTime_UTO':oe_create([Utc, OE_THIS],[{pseudo,true}|?CREATE_OPTS]),State}; -uto_from_utc(_, _, _) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : new_interval -%% Arguments: Lower - TimeBase::TimeT -%% Upper - TimeBase::TimeT -%% Returns : CosTime::TIO -%%----------------------------------------------------------- -new_interval(OE_THIS, State, Lower, Upper) when is_integer(Lower) andalso is_integer(Upper) andalso - Lower= - {reply, 'CosTime_TIO':oe_create([#'TimeBase_IntervalT'{lower_bound=Lower, - upper_bound=Upper}, - ?get_Tdf(State), - OE_THIS], - [{pseudo,true}|?CREATE_OPTS]), State}; -new_interval(_, _, _, _) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - - -%%--------------- LOCAL FUNCTIONS ---------------------------- -%%-----------------------------------------------------------% -%% function : create_universal_utc -%% Arguments: - -%% Returns : TimeT or raises exception. -%% Effect : Creates a universal time; if time unavailable we -%% must raise CosTime_TimeUnavailable. -%% NOTE : 'datetime_to_gregorian_seconds' use year 0 as time -%% base. We want to use 15 october 1582, 00:00 as base. -%%------------------------------------------------------------ - -create_universal_time() -> - %% Time is supposed to be #100 nano-secs passed. - %% We add micro secs for a greater precision. - {MS,S,US} = erlang:timestamp(), - case catch calendar:datetime_to_gregorian_seconds( - calendar:now_to_universal_time({MS,S,US})) of - Secs when is_integer(Secs) -> - {ok, (Secs-?ABSOLUTE_TIME_DIFF)*10000000 + US*10}; - _ -> - corba:raise(#'CosTime_TimeUnavailable'{}) - end. - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ - diff --git a/lib/cosTime/src/CosTime_UTO_impl.erl b/lib/cosTime/src/CosTime_UTO_impl.erl deleted file mode 100644 index 09f3eb2fdb..0000000000 --- a/lib/cosTime/src/CosTime_UTO_impl.erl +++ /dev/null @@ -1,242 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosTime_UTO_impl.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module('CosTime_UTO_impl'). - -%%--------------- INCLUDES ----------------------------------- --include("cosTimeApp.hrl"). - - -%%--------------- EXPORTS ------------------------------------ -%%--------------- External ----------------------------------- -%% Attributes (external) --export(['_get_time'/2, - '_get_inaccuracy'/2, - '_get_tdf'/2, - '_get_utc_time'/2]). - -%% Interface functions --export([absolute_time/2, compare_time/4]). --export([time_to_interval/3, interval/2]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - - -%% Data structures --record(state, {timer, utc}). -%% Data structures constructors --define(get_InitState(U, T), #state{timer = T, utc = U}). - -%% Data structures selectors --define(get_Time(S), (S#state.utc)#'TimeBase_UtcT'.time). --define(get_Inaccuracy(S), ?concat_TimeT((S#state.utc)#'TimeBase_UtcT'.inacchi, - (S#state.utc)#'TimeBase_UtcT'.inacclo)). --define(get_Tdf(S), (S#state.utc)#'TimeBase_UtcT'.tdf). --define(get_Utc(S), S#state.utc). --define(get_TimeObj(S), S#state.timer). - - -%%-----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the gen_server module. -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. -handle_info(_Info, State) -> - {noreply, State}. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init([Utc, TimeObj]) -> - {ok, ?get_InitState(Utc, TimeObj)}. - -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------- -%%------------------------ attributes ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Attribute: '_get_time' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_time'(_OE_THIS, State) -> - {reply, ?get_Time(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_inaccuracy' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_inaccuracy'(_OE_THIS, State) -> - {reply, ?get_Inaccuracy(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_tdf' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_tdf'(_OE_THIS, State) -> - {reply, ?get_Tdf(State), State}. - -%%----------------------------------------------------------% -%% Attribute: '_get_utc_time' -%% Type : readonly -%% Returns : -%%----------------------------------------------------------- -'_get_utc_time'(_OE_THIS, State) -> - {reply, ?get_Utc(State), State}. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% function : absolute_time -%% Arguments: - -%% Returns : UTO -%% NOTE : Return the base time to the relative time in the object. -%%----------------------------------------------------------- -absolute_time(_OE_THIS, State) -> - case catch 'CosTime_UTO':'_get_time'( - 'CosTime_TimeService':universal_time(?get_TimeObj(State)))+ - ?get_Time(State) of - UniTime when is_integer(UniTime) andalso UniTime =< ?max_TimeT -> - Utc=?get_Utc(State), - {reply, 'CosTime_UTO':oe_create([Utc#'TimeBase_UtcT'{time=UniTime}, - ?get_TimeObj(State)], - [{pseudo,true}|?CREATE_OPTS]), State}; - UniTime when is_integer(UniTime) -> - %% Oopss, overflow! - corba:raise(#'DATA_CONVERSION'{completion_status=?COMPLETED_NO}); - _ -> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%----------------------------------------------------------% -%% function : compare_time -%% Arguments: Comparison_type - CosTime::ComparisonType -%% Uto - ObjRef -%% Returns : TimeComparison - 'TCEqualTo' | 'TCLessThan' | -%% 'TCGreaterThan' | 'TCIndeterminate' -%%----------------------------------------------------------- -compare_time(_OE_THIS, State, 'IntervalC', Uto) -> - ?time_TypeCheck(Uto, 'CosTime_UTO'), - case catch {'CosTime_UTO':'_get_time'(Uto), - 'CosTime_UTO':'_get_inaccuracy'(Uto)} of - {Time,Inaccuracy} when is_integer(Time) andalso is_integer(Inaccuracy) -> - OwnInacc = ?get_Inaccuracy(State), - if - ?get_Time(State)+OwnInacc < Time-Inaccuracy -> - {reply, 'TCLessThan', State}; - ?get_Time(State)-OwnInacc > Time+Inaccuracy -> - {reply, 'TCGreaterThan', State}; - ?get_Time(State) == Time, Inaccuracy==0, OwnInacc==0 -> - %% TimeService specification (july 1997, p14-7:2) states - %% that they are only equal if both UTO's Inaccuracy - %% equals zero. - {reply, 'TCEqualTo', State}; - true -> - {reply, 'TCIndeterminate', State} - end; - _ -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end; -compare_time(_OE_THIS, State, 'MidC', Uto) -> - ?time_TypeCheck(Uto, 'CosTime_UTO'), - case catch 'CosTime_UTO':'_get_time'(Uto) of - Time when is_integer(Time) -> - if - ?get_Time(State) < Time -> - {reply, 'TCLessThan', State}; - ?get_Time(State) > Time -> - {reply, 'TCGreaterThan', State}; - true -> - {reply, 'TCEqualTo', State} - end; - _ -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end; -compare_time(_OE_THIS, _State, _, _) -> - %% Comparison_type given not correct?! - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : time_to_interval -%% Arguments: -%% Returns : TIO -%%----------------------------------------------------------- -time_to_interval(_OE_THIS, State, Uto) -> - ?time_TypeCheck(Uto, 'CosTime_UTO'), - case catch 'CosTime_UTO':'_get_time'(Uto) of - Time when is_integer(Time) -> - OwnTime = ?get_Time(State), - if - Time > OwnTime -> - {reply, 'CosTime_TIO':oe_create([#'TimeBase_IntervalT'{lower_bound=OwnTime, - upper_bound=Time}, - ?get_Tdf(State), - ?get_TimeObj(State)], - [{pseudo,true}|?CREATE_OPTS]), State}; - true -> - {reply, 'CosTime_TIO':oe_create([#'TimeBase_IntervalT'{lower_bound=Time, - upper_bound=OwnTime}, - ?get_Tdf(State), - ?get_TimeObj(State)], - [{pseudo,true}|?CREATE_OPTS]), State} - end; - _ -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end. - -%%----------------------------------------------------------% -%% function : interval -%% Arguments: -%% Returns : TIO -%%----------------------------------------------------------- -interval(_OE_THIS, State) -> - Lower = ?get_Time(State) - ?get_Inaccuracy(State), - Upper = ?get_Time(State) + ?get_Inaccuracy(State), - {reply, 'CosTime_TIO':oe_create([#'TimeBase_IntervalT'{lower_bound=Lower, - upper_bound=Upper}, - ?get_Tdf(State), - ?get_TimeObj(State)], - [{pseudo,true}|?CREATE_OPTS]), State}. - - -%%--------------- LOCAL FUNCTIONS ---------------------------- - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ - diff --git a/lib/cosTime/src/CosTimerEvent.cfg b/lib/cosTime/src/CosTimerEvent.cfg deleted file mode 100644 index 7f16197168..0000000000 --- a/lib/cosTime/src/CosTimerEvent.cfg +++ /dev/null @@ -1,4 +0,0 @@ -{this, "CosTimerEvent::TimerEventHandler"}. -{{handle_info, "CosTimerEvent::TimerEventHandler"}, true}. -{this, "CosTimerEvent::TimerEventService"}. -{{handle_info, "CosTimerEvent::TimerEventService"}, true}. diff --git a/lib/cosTime/src/CosTimerEvent.idl b/lib/cosTime/src/CosTimerEvent.idl deleted file mode 100644 index b845862f98..0000000000 --- a/lib/cosTime/src/CosTimerEvent.idl +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef _COS_TIMEREVENT_IDL_ -#define _COS_TIMEREVENT_IDL_ - -#pragma prefix "omg.org" - -#include"CosEventComm.idl" -#include -#include - -module CosTimerEvent{ - - enum TimeType { - TTAbsolute, - TTRelative, - TTPeriodic - }; - enum EventStatus { - ESTimeSet, - ESTimeCleared, - ESTriggered, - ESFailedTrigger - }; - - struct TimerEventT { - TimeBase::UtcT utc; - any event_data; - }; - - interface TimerEventHandler { - readonly attribute EventStatus status; - boolean time_set( out CosTime::UTO uto ); - void set_timer( in TimeType time_type, in CosTime::UTO trigger_time ); - boolean cancel_timer(); - void set_data( in any event_data ); - }; - - interface TimerEventService { - - TimerEventHandler register( in CosEventComm::PushConsumer event_interface, in any data ); - void unregister( in TimerEventHandler timer_event_handler ); - CosTime::UTO event_time( in TimerEventT timer_event ); - }; -}; - -#endif diff --git a/lib/cosTime/src/CosTimerEvent_TimerEventHandler_impl.erl b/lib/cosTime/src/CosTimerEvent_TimerEventHandler_impl.erl deleted file mode 100644 index 5bc751dfb1..0000000000 --- a/lib/cosTime/src/CosTimerEvent_TimerEventHandler_impl.erl +++ /dev/null @@ -1,305 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosTimerEvent_TimerEventHandler_impl.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module('CosTimerEvent_TimerEventHandler_impl'). - -%%--------------- INCLUDES ----------------------------------- --include("cosTimeApp.hrl"). - - -%%--------------- EXPORTS ------------------------------------ -%%--------------- External ----------------------------------- -%% Attributes (external) --export(['_get_status'/2]). -%% Interface functions --export([time_set/2, set_timer/4]). --export([cancel_timer/2, set_data/3]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - - -%% Data structures --record(state, {parent, - parentPid, - event, - status = 'ESTimeCleared', - timer, - time, - timeObj, - myType, - pushConsumer, - uto}). -%% Data structures constructors --define(get_InitState(P,PP,E,PC,TO), - #state{parent=P, - parentPid=PP, - event=E, - pushConsumer=PC, - timeObj=TO}). - -%% Data structures selectors --define(get_Status(S), S#state.status). --define(get_ParentPid(S), S#state.parentPid). --define(get_Parent(S), S#state.parent). --define(get_Event(S), S#state.event). --define(get_Timer(S), S#state.timer). --define(get_Time(S), S#state.time). --define(get_TimeObj(S), S#state.timeObj). --define(get_MyType(S), S#state.myType). --define(get_PushConsumer(S), S#state.pushConsumer). --define(get_Uto(S), S#state.uto). - -%% Data structures modifiers --define(set_Status(S,V), S#state{status=V}). --define(set_ParentPid(S,PP), S#state{parentPid=PP}). --define(set_Parent(S,P), S#state{parent=P}). --define(set_Event(S,E), S#state{event=E}). --define(set_Timer(S,T), S#state{timer=T}). --define(set_Time(S,T), S#state{time=T}). --define(set_MyType(S,Ty), S#state{myType=Ty}). --define(set_PushConsumer(S,P), S#state{pushConsumer=P}). --define(set_Uto(S,U,Type), S#state{uto=U, myType=Type}). --define(set_TimeData(S,U,Ty,Ti),S#state{uto=U, myType=Ty, time=Ti}). - -%% MISC --define(not_Cancelled(S), S#state.status =/= 'ESTimeCleared'). --define(is_TimeSet(S), S#state.status == 'ESTimeSet'). --define(is_UtoSet(S), S#state.uto =/= undefined). --define(is_NotAbsolute(S), S#state.myType =/= 'TTAbsolute'). - -%%-----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the gen_server module. -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(Info, State) -> - ?debug_print("INFO: ~p~n", [Info]), - case Info of - {'EXIT', Pid, _Reason} when Pid == ?get_ParentPid(State) -> - ?debug_print("PARENT TERMINATED with reason: ~p~n",[_Reason]), - {noreply, State}; - oe_event when ?not_Cancelled(State) -> - %% Push event - case catch 'CosEventComm_PushConsumer':push(?get_PushConsumer(State), - ?get_Event(State)) of - ok -> - ?debug_print("PUSHED: ~p~n", [?get_Event(State)]), - {noreply, ?set_Status(State, 'ESTriggered')}; - _Other-> - ?debug_print("FAILED PUSH: ~p ~p~n", [?get_Event(State), _Other]), - {noreply, ?set_Status(State, 'ESFailedTrigger')} - end; - oe_periodic_event when ?not_Cancelled(State) -> - %% Push event - catch 'CosEventComm_PushConsumer':push(?get_PushConsumer(State), - ?get_Event(State)), - {noreply, State}; - _ -> - {noreply, State} - end. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init([Parent, ParentPid, PushConsumer, Event, TimeObj]) -> - process_flag(trap_exit, true), - {ok, ?get_InitState(Parent, ParentPid, Event, PushConsumer, TimeObj)}. - -terminate(_Reason, State) -> - clear_timer(State), - ok. - -%%----------------------------------------------------------- -%%------------------------ attributes ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% Attribute: '_get_status' -%% Type : readonly -%% Returns : 'ESTimeSet' | 'ESTimeCleared' | 'ESTriggered' | -%% 'ESFailedTrigger' -%%----------------------------------------------------------- -'_get_status'(_OE_THIS, State) -> - {reply, ?get_Status(State), State}. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% function : time_set -%% Arguments: - -%% Returns : {boolean(), CosTime::UTO} -%%----------------------------------------------------------- -time_set(_OE_THIS, State) when ?is_UtoSet(State) -> - {reply, {?is_TimeSet(State), ?get_Uto(State)}, State}; -time_set(_OE_THIS, State) -> - Utc = #'TimeBase_UtcT'{time=0, inacclo = 0,inacchi = 0, tdf = 0}, - {reply, - {?is_TimeSet(State), - 'CosTime_UTO':oe_create([Utc, ?get_TimeObj(State)], [{pseudo,true}|?CREATE_OPTS])}, - State}. - - -%%----------------------------------------------------------- -%% function : set_timer -%% Arguments: TimeType - 'TTAbsolute' | 'TTRelative' | 'TTPeriodic' -%% TriggerTime - CosTime::UTO -%% Returns : ok -%%----------------------------------------------------------- -set_timer(_OE_THIS, State, 'TTAbsolute', TriggerTime) -> - NewState = clear_timer(State), - ?time_TypeCheck(TriggerTime, 'CosTime_UTO'), - case catch {'CosTime_UTO':'_get_time'(TriggerTime), - 'CosTime_UTO':'_get_time'( - 'CosTime_TimeService':universal_time(?get_TimeObj(State)))} of - {Time, CurrentTime} when is_integer(Time) andalso is_integer(CurrentTime) andalso - Time > CurrentTime -> - %% Set a timer to send a message in (Time-CurrentTime)*10^-7 secs. - case timer:send_after(?convert_TimeT2TimerT(Time-CurrentTime), oe_event) of - {ok, TRef} -> - NewState1 = ?set_Timer(NewState, TRef), - NewState2 = ?set_Uto(NewState1, TriggerTime, 'TTAbsolute'), - ?debug_print("TIMER SET: ~p~n", [?convert_TimeT2TimerT(Time-CurrentTime)]), - {reply, ok, ?set_Status(NewState2, 'ESTimeSet')}; - _-> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; - {Time, CurrentTime} when is_integer(Time) andalso is_integer(CurrentTime) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}); - _-> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; -set_timer(_OE_THIS, State, 'TTRelative', TriggerTime) -> - NewState = clear_timer(State), - ?time_TypeCheck(TriggerTime, 'CosTime_UTO'), - case catch {'CosTime_UTO':'_get_time'(TriggerTime), ?get_Time(State)} of - {0,OldTime} when ?is_NotAbsolute(NewState) andalso is_integer(OldTime) -> - %% Set a timer to send a message within Time*10^-7 secs - case timer:send_after(OldTime, oe_event) of - {ok, TRef} -> - NewState1 = ?set_Timer(NewState, TRef), - NewState2 = ?set_Uto(NewState1, TriggerTime, 'TTRelative'), - ?debug_print("TIMER SET: ~p~n", [?convert_TimeT2TimerT(OldTime)]), - {reply, ok, ?set_Status(NewState2, 'ESTimeSet')}; - _-> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; - {UtoTime,_} when is_integer(UtoTime) -> - %% Set a timer to send a message within Time*10^-7 secs - Time = ?convert_TimeT2TimerT(UtoTime), - case timer:send_after(Time, oe_event) of - {ok, TRef} -> - NewState1 = ?set_Timer(NewState, TRef), - NewState2 = ?set_TimeData(NewState1, TriggerTime, - 'TTRelative', Time), - ?debug_print("TIMER SET: ~p~n", [?convert_TimeT2TimerT(Time)]), - {reply, ok, ?set_Status(NewState2, 'ESTimeSet')}; - _-> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; - - _-> - {reply, {'EXCEPTION', #'BAD_PARAM'{completion_status=?COMPLETED_NO}}, NewState} - end; -set_timer(_OE_THIS, State, 'TTPeriodic', TriggerTime) -> - NewState = clear_timer(State), - ?time_TypeCheck(TriggerTime, 'CosTime_UTO'), - case catch {'CosTime_UTO':'_get_time'(TriggerTime), ?get_Time(State)} of - {0,OldTime} when ?is_NotAbsolute(NewState) andalso is_integer(OldTime) -> - %% Set a timer to send a message within Time*10^-7 secs - case timer:send_interval(OldTime, oe_periodic_event) of - {ok, TRef} -> - NewState1 = ?set_Timer(NewState, TRef), - NewState2 = ?set_Uto(NewState1, TriggerTime, 'TTPeriodic'), - ?debug_print("TIMER SET: ~p~n", [?convert_TimeT2TimerT(OldTime)]), - {reply, ok, ?set_Status(NewState2, 'ESTimeSet')}; - _-> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; - {UtoTime,_} when is_integer(UtoTime) -> - %% Set a timer to send a message within Time*10^-7 secs - Time = ?convert_TimeT2TimerT(UtoTime), - case timer:send_interval(Time, oe_periodic_event) of - {ok, TRef} -> - NewState1 = ?set_Timer(NewState, TRef), - NewState2 = ?set_TimeData(NewState1, TriggerTime, - 'TTPeriodic', Time), - ?debug_print("TIMER SET: ~p~n", [?convert_TimeT2TimerT(Time)]), - {reply, ok, ?set_Status(NewState2, 'ESTimeSet')}; - _-> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; - - _-> - {reply, {'EXCEPTION', #'BAD_PARAM'{completion_status=?COMPLETED_NO}}, NewState} - end; -set_timer(_OE_THIS, _State, _, _) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------% -%% function : cancel_timer -%% Arguments: - -%% Returns : boolean() -%%----------------------------------------------------------- -cancel_timer(_OE_THIS, State) -> - NewState=clear_timer(State), - case ?get_Status(NewState) of - 'ESTriggered' -> - {reply, false, NewState}; - 'ESFailedTrigger' -> - {reply, false, NewState}; - _ -> - {reply, true, ?set_Status(NewState, 'ESTimeCleared')} - end. - -%%----------------------------------------------------------% -%% function : set_data -%% Arguments: EventData - any# -%% Returns : ok -%%----------------------------------------------------------- -set_data(_OE_THIS, State, EventData) when is_record(EventData, any) -> - {reply, ok, ?set_Event(State, EventData)}; -set_data(_OE_THIS, _State, _EventData) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - - -%%--------------- LOCAL FUNCTIONS ---------------------------- -clear_timer(State) when ?get_Timer(State) == undefined -> - State; -clear_timer(State) -> - catch timer:cancel(?get_Timer(State)), - ?set_Timer(State, undefined). - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosTime/src/CosTimerEvent_TimerEventService_impl.erl b/lib/cosTime/src/CosTimerEvent_TimerEventService_impl.erl deleted file mode 100644 index 59552e4b1b..0000000000 --- a/lib/cosTime/src/CosTimerEvent_TimerEventService_impl.erl +++ /dev/null @@ -1,119 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosTimerEvent_TimerEventService_impl.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module('CosTimerEvent_TimerEventService_impl'). - -%%--------------- INCLUDES ----------------------------------- --include("cosTimeApp.hrl"). - - -%%--------------- EXPORTS ------------------------------------ -%%--------------- External ----------------------------------- -%% Interface functions --export([register/4, unregister/3, event_time/3]). - -%%--------------- gen_server specific exports ---------------- --export([handle_info/2, code_change/3]). --export([init/1, terminate/2]). - - -%% Data structures --record(state, {timer}). -%% Data structures constructors --define(get_InitState(T), - #state{timer=T}). - -%% Data structures selectors --define(get_TimerObj(S), S#state.timer). - -%% Data structures modifiers - -%% MISC - -%%-----------------------------------------------------------% -%% function : handle_info, code_change -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the gen_server module. -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_info(_Info, State) -> - ?debug_print("INFO: ~p~n", [_Info]), - {noreply, State}. - -%%----------------------------------------------------------% -%% function : init, terminate -%% Arguments: -%%----------------------------------------------------------- - -init([Timer]) -> - process_flag(trap_exit, true), - timer:start(), - {ok, ?get_InitState(Timer)}. - -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% function : register -%% Arguments: EventInterface - CosEventComm::PushConsumer -%% Data - #any -%% Returns : TimerEventHandler - objref# -%%----------------------------------------------------------- -register(OE_THIS, State, EventInterface, Data) -> - {reply, - cosTime:start_event_handler([OE_THIS, self(),EventInterface, Data, - ?get_TimerObj(State)]), - State}. - -%%----------------------------------------------------------% -%% function : unregister -%% Arguments: TimerEventHandler - objref# -%% Returns : ok -%%----------------------------------------------------------- -unregister(_OE_THIS, State, TimerEventHandler) -> - catch corba:dispose(TimerEventHandler), - {reply, ok, State}. - -%%----------------------------------------------------------% -%% function : event_time -%% Arguments: TimerEvent - #'CosTimerEvent_TimerEventT'{utc, event_data} -%% Returns : CosTime::UTO -%%----------------------------------------------------------- -event_time(_OE_THIS, State, #'CosTimerEvent_TimerEventT'{utc=Utc}) -> - {reply, 'CosTime_UTO':oe_create([Utc],[{pseudo,true}]), State}. - - -%%--------------- LOCAL FUNCTIONS ---------------------------- - -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosTime/src/Makefile b/lib/cosTime/src/Makefile deleted file mode 100644 index 55d59baea3..0000000000 --- a/lib/cosTime/src/Makefile +++ /dev/null @@ -1,207 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2000-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk - -ifeq ($(TYPE),debug) -ERL_COMPILE_FLAGS += -Ddebug -W -endif - -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSTIME_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/cosTime-$(VSN) - -EXTERNAL_INC_PATH = ../include - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- - -MODULES = \ - cosTime \ - CosTime_TIO_impl \ - CosTime_TimeService_impl \ - CosTime_UTO_impl \ - CosTimerEvent_TimerEventHandler_impl \ - CosTimerEvent_TimerEventService_impl \ - -ERL_FILES = $(MODULES:%=%.erl) -HRL_FILES = \ - cosTimeApp.hrl \ - -GEN_TIMEBASE_ERL_FILES = \ - oe_TimeBase.erl \ - TimeBase_IntervalT.erl \ - TimeBase_UtcT.erl - -GEN_COSTIME_ERL_FILES = \ - oe_CosTime.erl \ - CosTime_TIO.erl \ - CosTime_TimeService.erl \ - CosTime_TimeUnavailable.erl \ - CosTime_UTO.erl \ - -GEN_COSTIMEREVENT_ERL_FILES = \ - oe_CosTimerEvent.erl \ - CosTimerEvent_TimerEventHandler.erl \ - CosTimerEvent_TimerEventService.erl \ - CosTimerEvent_TimerEventT.erl \ - -GEN_TIMEBASE_HRL_FILES = \ - oe_TimeBase.hrl \ - TimeBase.hrl \ - -EXTERNAL_TIMEBASE_HRL_FILES = $(GEN_TIMEBASE_HRL_FILES:%=$(EXTERNAL_INC_PATH)/%) - -GEN_COSTIME_HRL_FILES = \ - oe_CosTime.hrl \ - CosTime.hrl \ - CosTime_TIO.hrl \ - CosTime_TimeService.hrl \ - CosTime_UTO.hrl - -EXTERNAL_COSTIME_HRL_FILES = $(GEN_COSTIME_HRL_FILES:%=$(EXTERNAL_INC_PATH)/%) - -GEN_COSTIMEREVENT_HRL_FILES = \ - oe_CosTimerEvent.hrl \ - CosTimerEvent.hrl \ - CosTimerEvent_TimerEventHandler.hrl \ - CosTimerEvent_TimerEventService.hrl \ - -EXTERNAL_COSTIMEREVENT_HRL_FILES = $(GEN_COSTIMEREVENT_HRL_FILES:%=$(EXTERNAL_INC_PATH)/%) - - -GEN_ERL_FILES = \ - $(GEN_TIMEBASE_ERL_FILES) \ - $(GEN_COSTIME_ERL_FILES) \ - $(GEN_COSTIMEREVENT_ERL_FILES) - -GEN_HRL_FILES = \ - $(EXTERNAL_TIMEBASE_HRL_FILES) \ - $(EXTERNAL_COSTIME_HRL_FILES) \ - $(EXTERNAL_COSTIMEREVENT_HRL_FILES) \ - -GEN_FILES = \ - $(GEN_HRL_FILES) \ - $(GEN_ERL_FILES) - -TARGET_FILES = \ - $(GEN_TIMEBASE_ERL_FILES:%.erl=$(EBIN)/%.$(EMULATOR)) \ - $(GEN_COSTIME_ERL_FILES:%.erl=$(EBIN)/%.$(EMULATOR)) \ - $(GEN_COSTIMEREVENT_ERL_FILES:%.erl=$(EBIN)/%.$(EMULATOR)) \ - $(MODULES:%=$(EBIN)/%.$(EMULATOR)) - -IDL_FILES = \ - TimeBase.idl \ - CosTime.idl \ - CosTimerEvent.idl - -APPUP_FILE = cosTime.appup -APPUP_SRC = $(APPUP_FILE).src -APPUP_TARGET = $(EBIN)/$(APPUP_FILE) - -APP_FILE = cosTime.app -APP_SRC = $(APP_FILE).src -APP_TARGET = $(EBIN)/$(APP_FILE) - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/cosTime/ebin \ - -pa $(ERL_TOP)/lib/ic/ebin\ - -pa $(ERL_TOP)/lib/orber/ebin \ - -I$(ERL_TOP)/lib/cosEvent/src - -# The -pa option is just used temporary until erlc can handle -# includes from other directories than ../include . -ERL_COMPILE_FLAGS += \ - $(ERL_IDL_FLAGS) \ - -pa $(ERL_TOP)/lib/orber/include \ - -pa $(ERL_TOP)/lib/cosTime/include \ - -I$(ERL_TOP)/lib/cosTime/include \ - -I$(ERL_TOP)/lib/orber/include \ - +'{parse_transform,sys_pre_attributes}' \ - +'{attribute,insert,app_vsn,"cosTime_$(COSTIME_VSN)"}' - - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) - -debug: - @${MAKE} TYPE=debug opt - -cleanb: - rm -f $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) - rm -f errs core *~ - -clean: - rm -f $(TARGET_FILES) $(GEN_FILES) $(APP_TARGET) $(APPUP_TARGET) IDL-GENERATED - rm -f errs core *~ - -$(APP_TARGET): $(APP_SRC) - $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ - -$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ - -docs: - -# ---------------------------------------------------- -# Special Build Targets -# ---------------------------------------------------- -IDL-GENERATED: TimeBase.idl CosTime.idl CosTimerEvent.idl - $(gen_verbose)erlc $(ERL_IDL_FLAGS) TimeBase.idl - $(V_at)mv $(GEN_TIMEBASE_HRL_FILES) $(EXTERNAL_INC_PATH) - $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosTime.cfg"}' CosTime.idl - $(V_at)mv $(GEN_COSTIME_HRL_FILES) $(EXTERNAL_INC_PATH) - $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosTimerEvent.cfg"}' CosTimerEvent.idl - $(V_at)mv $(GEN_COSTIMEREVENT_HRL_FILES) $(EXTERNAL_INC_PATH) - $(V_at)>IDL-GENERATED - -$(GEN_FILES): IDL-GENERATED - -$(TARGET_FILES): IDL-GENERATED - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)/ebin" - $(INSTALL_DATA) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) "$(RELSYSDIR)/ebin" - $(INSTALL_DIR) "$(RELSYSDIR)/src" - $(INSTALL_DATA) $(GEN_FILES) $(IDL_FILES) "$(RELSYSDIR)/src" - $(INSTALL_DATA) $(ERL_FILES) $(HRL_FILES) $(GEN_ERL_FILES) $(IDL_FILES) "$(RELSYSDIR)/src" - $(INSTALL_DIR) "$(RELSYSDIR)/include" - $(INSTALL_DATA) $(GEN_HRL_FILES) "$(RELSYSDIR)/include" - -release_docs_spec: diff --git a/lib/cosTime/src/TimeBase.idl b/lib/cosTime/src/TimeBase.idl deleted file mode 100644 index 92a0c652d8..0000000000 --- a/lib/cosTime/src/TimeBase.idl +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _TIMEBASE_IDL_ -#define _TIMEBASE_IDL_ - -#pragma prefix "omg.org" - -module TimeBase { - typedef unsigned long long TimeT; - typedef TimeT InaccuracyT; - typedef short TdfT; - struct UtcT { - TimeT time; // 8 octets - unsigned long inacclo; // 4 octets - unsigned short inacchi; // 2 octets - TdfT tdf; // 2 octets // total 16 octets. - }; - struct IntervalT { - TimeT lower_bound; - TimeT upper_bound; - }; -}; - -#endif diff --git a/lib/cosTime/src/cosTime.app.src b/lib/cosTime/src/cosTime.app.src deleted file mode 100644 index ac71fe1b29..0000000000 --- a/lib/cosTime/src/cosTime.app.src +++ /dev/null @@ -1,32 +0,0 @@ -{application, cosTime, - [{description, "The Erlang CosTime application"}, - {vsn, "%VSN%"}, - {modules, - [ - 'cosTime', - 'oe_TimeBase', - 'oe_CosTime', - 'oe_CosTimerEvent', - 'CosTime_TIO', - 'CosTime_TimeService', - 'CosTime_TimeUnavailable', - 'CosTime_UTO', - 'CosTimerEvent_TimerEventHandler', - 'CosTimerEvent_TimerEventService', - 'CosTimerEvent_TimerEventT', - 'TimeBase_IntervalT', - 'TimeBase_UtcT', - 'CosTime_TIO_impl', - 'CosTime_TimeService_impl', - 'CosTime_UTO_impl', - 'CosTimerEvent_TimerEventHandler_impl', - 'CosTimerEvent_TimerEventService_impl' - ] - }, - {registered, [oe_cosTimeSup, oe_cosTimerEventService]}, - {applications, [orber, stdlib, kernel]}, - {env, []}, - {mod, {cosTime, []}}, - {runtime_dependencies, ["stdlib-2.0","orber-3.6.27","kernel-3.0","erts-7.0", - "cosEvent-2.1.15"]} -]}. diff --git a/lib/cosTime/src/cosTime.appup.src b/lib/cosTime/src/cosTime.appup.src deleted file mode 100644 index f3eead4a0c..0000000000 --- a/lib/cosTime/src/cosTime.appup.src +++ /dev/null @@ -1,6 +0,0 @@ -{"%VSN%", - [ - ], - [ - ] -}. diff --git a/lib/cosTime/src/cosTime.erl b/lib/cosTime/src/cosTime.erl deleted file mode 100644 index a32e210a26..0000000000 --- a/lib/cosTime/src/cosTime.erl +++ /dev/null @@ -1,343 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : cosTime.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module(cosTime). - -%%--------------- INCLUDES ----------------------------------- --include("cosTimeApp.hrl"). - -%%--------------- EXPORTS------------------------------------- -%% cosTime API external --export([start/0, stop/0, - install_time/0, uninstall_time/0, - install_timerevent/0, uninstall_timerevent/0, - start_time_service/2, start_timerevent_service/1, stop_timerevent_service/1, - stop_time_service/1]). - -%% cosTime API internal --export([create_link/3, get_option/3, type_check/2, start_event_handler/1]). - -%% Application callbacks --export([start/2, init/1, stop/1]). - -%%--------------- DEFINES ------------------------------------ --define(IDL_TIME_MODULES, ['oe_TimeBase', - 'oe_CosTime']). --define(IDL_TIMEREVENT_MODULES, ['oe_CosTimerEvent']). --define(SUPERVISOR_NAME, oe_cosTimeSup). --define(SUP_FLAG, {simple_one_for_one,50,10}). --define(SUP_TIMESERVICE_SPEC(T,I), - ['CosTime_TimeService',[T, I], - [{sup_child, true}, {regname, {global, "oe_cosTimeService"}}]]). --define(SUP_TIMEREVENTSERVICE_SPEC(Args), - ['CosTimerEvent_TimerEventService', Args, - [{sup_child, true}, {regname, {local, 'oe_cosTimerEventService'}}]]). --define(SUP_TIMEREVENTHANDLER_SPEC(Name, Args), - ['CosTimerEvent_TimerEventHandler',Args, - [{sup_child, true}, {regname, {global, Name}}]]). --define(SUP_CHILD, - {"oe_TimeChild", - {cosTime,create_link, []}, - transient,100000,worker, - []}). - -%%------------------------------------------------------------ -%% function : install_*/X -%% Arguments: - | Time (seconds) -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Install necessary data in the IFR DB -%%------------------------------------------------------------ - -install_time() -> - case install_loop(?IDL_TIME_MODULES,[]) of - ok -> - ok; - {error, Reason} -> - exit(Reason) - end. - -install_timerevent() -> - case install_loop(?IDL_TIMEREVENT_MODULES,[]) of - ok -> - ok; - {error, Reason} -> - exit(Reason) - end. - -install_loop([], _) -> - ok; -install_loop([H|T], Accum) -> - case catch H:'oe_register'() of - {'EXIT',{unregistered,App}} -> - ?write_ErrorMsg("Unable to register '~p'; application ~p not registered.\n" - "Trying to unregister ~p\n", [H,App,Accum]), - uninstall_loop(Accum, {exit, register}); - {'EXCEPTION',_} -> - ?write_ErrorMsg("Unable to register '~p'; propably already registered.\n" - "You are adviced to confirm this.\n" - "Trying to unregister ~p\n", [H,Accum]), - uninstall_loop(Accum, {exit, register}); - ok -> - install_loop(T, [H|Accum]); - _ -> - ?write_ErrorMsg("Unable to register '~p'; reason unknown.\n" - "Trying to unregister ~p\n", [H,Accum]), - uninstall_loop(Accum, {exit, register}) - end. - -%%------------------------------------------------------------ -%% function : uninstall_*/X -%% Arguments: - | Time (seconds) -%% Returns : ok | EXIT | EXCEPTION -%% Effect : Remove data related to cosTime from the IFR DB -%%------------------------------------------------------------ - -uninstall_time() -> - case uninstall_loop(lists:reverse(?IDL_TIME_MODULES),ok) of - ok -> - ok; - {error, Reason} -> - exit(Reason) - end. - -uninstall_timerevent() -> - case uninstall_loop(lists:reverse(?IDL_TIMEREVENT_MODULES),ok) of - ok -> - ok; - {error, Reason} -> - exit(Reason) - end. - -uninstall_loop([],ok) -> - ok; -uninstall_loop([],{exit, register}) -> - {error, {?MODULE, "oe_register failed"}}; -uninstall_loop([],{exit, unregister}) -> - {error, {?MODULE, "oe_unregister failed"}}; -uninstall_loop([],{exit, both}) -> - {error, {?MODULE, "oe_register and, for some of those already registered, oe_unregister failed"}}; -uninstall_loop([H|T], Status) -> - case catch H:'oe_unregister'() of - ok -> - uninstall_loop(T, Status); - _ when Status == ok -> - ?write_ErrorMsg("Unable to unregister '~p'; propably already unregistered.\n" - "You are adviced to confirm this.~n",[H]), - uninstall_loop(T, {exit, unregister}); - _ -> - ?write_ErrorMsg("Unable to unregister '~p'; propably already unregistered.\n" - "You are adviced to confirm this.~n",[H]), - uninstall_loop(T, {exit, both}) - end. - -%%------------------------------------------------------------ -%% function : start/stop -%% Arguments: -%% Returns : -%% Effect : Starts or stops the cosTime application. -%%------------------------------------------------------------ - -start() -> - application:start(cosTime). -stop() -> - application:stop(cosTime). - -%%------------------------------------------------------------ -%% function : start -%% Arguments: Type - see module application -%% Arg - see module application -%% Returns : -%% Effect : Module callback for application -%%------------------------------------------------------------ - -start(_, _) -> - supervisor:start_link({local, ?SUPERVISOR_NAME}, cosTime, app_init). - - -%%------------------------------------------------------------ -%% function : stop -%% Arguments: Arg - see module application -%% Returns : -%% Effect : Module callback for application -%%------------------------------------------------------------ - -stop(_) -> - ok. - -%%------------------------------------------------------------ -%% function : start_time_service -%% Arguments: Tdf - time difference to UTC -%% Inaccuracy - ulonglong -%% Upper - inaccuracy high -%% Returns : -%% Effect : -%%------------------------------------------------------------ -start_time_service(Tdf, Inaccuracy) when is_integer(Tdf) andalso is_integer(Inaccuracy) -> - case supervisor:start_child(?SUPERVISOR_NAME, - ?SUP_TIMESERVICE_SPEC(Tdf, Inaccuracy)) of - {ok, Pid, Obj} when is_pid(Pid) -> - Obj; - _Other-> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; -start_time_service(_Tdf, _Inaccuracy) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - - -%%------------------------------------------------------------ -%% function : stop_time_service -%% Arguments: Obj - TimeService objref -%% Returns : -%% Effect : -%%------------------------------------------------------------ -stop_time_service(Obj) -> - corba:dispose(Obj). - -%%------------------------------------------------------------ -%% function : start_timerevent_service -%% Arguments: Timer - Timer Service Reference -%% Returns : -%% Effect : -%%------------------------------------------------------------ -start_timerevent_service(Timer) -> - case supervisor:start_child(?SUPERVISOR_NAME, - ?SUP_TIMEREVENTSERVICE_SPEC([Timer])) of - {ok, Pid, Obj} when is_pid(Pid) -> - Obj; - _Other-> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -%%-----------------------------------------------------------% -%% function : stop_timerevent_service -%% Arguments: Obj - TimerEventService objref -%% Returns : -%% Effect : -%%------------------------------------------------------------ -stop_timerevent_service(Obj) -> - corba:dispose(Obj). - -%%-----------------------------------------------------------% -%% function : init -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ - -%% Starting using create_factory/X -init(own_init) -> - {ok,{?SUP_FLAG, [?SUP_CHILD]}}; -%% When starting as an application. -init(app_init) -> - {ok,{?SUP_FLAG, [?SUP_CHILD]}}. - -%%-----------------------------------------------------------% -%% function : create_link -%% Arguments: Module - which Module to call -%% Env/ArgList - ordinary oe_create arguments. -%% Returns : -%% Exception: -%% Effect : Necessary since we want the supervisor to be a -%% 'simple_one_for_one'. Otherwise, using for example, -%% 'one_for_one', we have to call supervisor:delete_child -%% to remove the childs startspecification from the -%% supervisors internal state. -%%------------------------------------------------------------ -create_link(Module, Env, ArgList) -> - Module:oe_create_link(Env, ArgList). - -%%-----------------------------------------------------------% -%% function : start_event_handler -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ - -start_event_handler(Args) -> - Name = create_name(eventhandler), - case supervisor:start_child(?SUPERVISOR_NAME, ?SUP_TIMEREVENTHANDLER_SPEC(Name,Args)) of - {ok, Pid, Obj} when is_pid(Pid) -> - Obj; - _Other-> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - - -%%-----------------------------------------------------------% -%% function : get_option -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ - -get_option(Key, OptionList, DefaultList) -> - case lists:keysearch(Key, 1, OptionList) of - {value,{Key,Value}} -> - Value; - _ -> - case lists:keysearch(Key, 1, DefaultList) of - {value,{Key,Value}} -> - Value; - _-> - {error, "Invalid option"} - end - end. - -%%-----------------------------------------------------------% -%% function : type_check -%% Arguments: Obj - objectrefernce to test. -%% Mod - Module which contains typeID/0. -%% Returns : 'ok' or raises exception. -%% Effect : -%%------------------------------------------------------------ - -type_check(Obj, Mod) -> - case catch corba_object:is_a(Obj,Mod:typeID()) of - true -> - ok; - _ -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end. - - -%%-----------------------------------------------------------% -%% function : create_name/1 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ - -create_name(Type) -> - Time = erlang:system_time(), - Unique = erlang:unique_integer([positive]), - lists:concat(['oe_',node(),'_',Type,'_',Time,'_',Unique]). - -%%--------------- END OF MODULE ------------------------------ - - diff --git a/lib/cosTime/src/cosTimeApp.hrl b/lib/cosTime/src/cosTimeApp.hrl deleted file mode 100644 index 7c084dc585..0000000000 --- a/lib/cosTime/src/cosTimeApp.hrl +++ /dev/null @@ -1,77 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : cosTimeApp.hrl -%% Purpose : -%%---------------------------------------------------------------------- - - -%%--------------- INCLUDES ----------------------------------- -%% External --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). - -%% Local --include("CosTimerEvent.hrl"). --include("CosTime.hrl"). --include("CosTimerEvent.hrl"). --include("TimeBase.hrl"). - --define(CREATE_OPTS, [{no_security, orber:partial_security()}]). - --define(max_Inaccuracy, 281474976710655). --define(max_TimeT, 18446744073709551616). - -%% The calendar module uses year 0 as base for gregorian functions. -%% 'ABSOULTE_TIME_DIFF' is #seconds from year 0 until 15 october 1582, 00:00. --define(ABSOLUTE_TIME_DIFF, 49947926400). -%% As above but diff year 0 to 00:00 GMT, January 1, 1970 --define(STANDARD_TIME_DIFF, 62167219200). - --define(split_TimeT(T), {((T band 16#0000ffff00000000) bsr 32), - (T band 16#00000000ffffffff)}). - --define(high_TimeT(T), ((T band 16#0000ffff00000000) bsr 32)). --define(low_TimeT(T), (T band 16#00000000ffffffff)). - --define(concat_TimeT(H,L), ((H bsl 32) + L)). - --define(convert_TimeT2TimerT(N), erlang:trunc(N*1.0e-4)). - --define(write_ErrorMsg(Txt, Arg), -error_logger:error_msg("================ CosTime ==================~n" - Txt - "===========================================~n", - Arg)). - - - --ifdef(debug). --define(debug_print(F,A), - io:format("[LINE: ~p MODULE: ~p] "++F,[?LINE, ?MODULE]++A)). --define(time_TypeCheck(O,M), 'cosTime':type_check(O,M)). --else. --define(debug_print(F,A), ok). --define(time_TypeCheck(O,I), ok). --endif. - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosTime/test/Makefile b/lib/cosTime/test/Makefile deleted file mode 100644 index 91d3eccf43..0000000000 --- a/lib/cosTime/test/Makefile +++ /dev/null @@ -1,135 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2000-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSTIME_VSN) -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/cosTime_test - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -TEST_SPEC_FILE = cosTime.spec -COVER_FILE = cosTime.cover - - -IDL_FILES = - -IDLOUTDIR = idl_output - -MODULES = \ - time_SUITE \ - generated_SUITE - -GEN_MODULES = \ - -GEN_HRL_FILES = \ - -ERL_FILES = $(MODULES:%=%.erl) - -HRL_FILES = - -GEN_FILES = \ - $(GEN_HRL_FILES:%=$(IDLOUTDIR)/%) \ - $(GEN_MODULES:%=$(IDLOUTDIR)/%.erl) - -GEN_TARGET_FILES = $(GEN_MODULES:%=$(IDLOUTDIR)/%.$(EMULATOR)) - -SUITE_TARGET_FILES = $(MODULES:%=%.$(EMULATOR)) - -TARGET_FILES = \ - $(GEN_TARGET_FILES) \ - $(SUITE_TARGET_FILES) - - -# ---------------------------------------------------- -# PROGRAMS -# ---------------------------------------------------- -LOCAL_CLASSPATH = $(ERL_TOP)lib/cosTime/priv:$(ERL_TOP)lib/cosTime/test -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/cosTime/ebin \ - -pa $(ERL_TOP)/lib/cosTime/src \ - -pa $(ERL_TOP)/lib/cosTime/include \ - -pa $(ERL_TOP)/lib/cosNotification/ebin \ - -pa $(ERL_TOP)/lib/orber/ebin \ - -pa $(ERL_TOP)/lib/ic/ebin - -ERL_COMPILE_FLAGS += \ - $(ERL_IDL_FLAGS) \ - -pa $(ERL_TOP)/lib/orber/include \ - -pa $(ERL_TOP)/lib/cosNotification/include \ - -pa $(ERL_TOP)/lib/cosTime/ebin \ - -pa $(ERL_TOP)/lib/cosTime/include \ - -pa $(ERL_TOP)/lib/cosTime/test/idl_output \ - -I$(ERL_TOP)/lib/orber/include \ - -I$(ERL_TOP)/lib/cosNotification/include \ - -I$(ERL_TOP)/lib/cosTime/src \ - -I$(ERL_TOP)/lib/cosTime/include \ - -I$(ERL_TOP)/lib/cosTime \ - -I$(ERL_TOP)/lib/cosTime/test/$(IDLOUTDIR) - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- - - -tests debug opt: $(TARGET_FILES) - -clean: - rm -f idl_output/* - rm -f $(TARGET_FILES) - rm -f errs core *~ - -docs: - -# ---------------------------------------------------- -# Special Targets -# ---------------------------------------------------- - -# ---------------------------------------------------- -# Release Targets -# ---------------------------------------------------- -# We don't copy generated intermediate erlang and hrl files - -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: - -release_docs_spec: - -release_tests_spec: tests - $(INSTALL_DIR) "$(RELSYSDIR)" - $(INSTALL_DATA) $(IDL_FILES) $(TEST_SPEC_FILE) \ - $(COVER_FILE) $(ERL_FILES) "$(RELSYSDIR)" - $(INSTALL_DATA) $(SUITE_TARGET_FILES) "$(RELSYSDIR)" -# $(INSTALL_DIR) "$(RELSYSDIR)/$(IDLOUTDIR)" -# $(INSTALL_DATA) $(GEN_TARGET_FILES) $(GEN_FILES) \ -# "$(RELSYSDIR)/$(IDLOUTDIR)" - diff --git a/lib/cosTime/test/cosTime.cover b/lib/cosTime/test/cosTime.cover deleted file mode 100644 index 81a05b8cfd..0000000000 --- a/lib/cosTime/test/cosTime.cover +++ /dev/null @@ -1,2 +0,0 @@ -{incl_app,cosTime,details}. - diff --git a/lib/cosTime/test/cosTime.spec b/lib/cosTime/test/cosTime.spec deleted file mode 100644 index 8bf6f740fe..0000000000 --- a/lib/cosTime/test/cosTime.spec +++ /dev/null @@ -1 +0,0 @@ -{suites,"../cosTime_test",all}. diff --git a/lib/cosTime/test/generated_SUITE.erl b/lib/cosTime/test/generated_SUITE.erl deleted file mode 100644 index b030155340..0000000000 --- a/lib/cosTime/test/generated_SUITE.erl +++ /dev/null @@ -1,289 +0,0 @@ -%%----------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File : generated_SUITE.erl -%% Purpose : -%%----------------------------------------------------------------- - --module(generated_SUITE). - --include_lib("common_test/include/ct.hrl"). --include_lib("orber/include/corba.hrl"). - --define(default_timeout, test_server:minutes(3)). - --define(match(ExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - AcTuAlReS; - _ -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS) - end - end()). - --define(nomatch(Not, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - Not -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS); - _ -> - AcTuAlReS - end - end()). - - --define(checktc(_Op), - fun(TC) -> - case orber_tc:check_tc(TC) of - false -> - io:format("###### ERROR ERROR ######~n~p - ~p~n", [Op, TC]), - exit(TC); - true -> - true - end - end). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --compile(export_all). - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - ['TimeBase_IntervalT', 'TimeBase_UtcT', - 'CosTime_TimeUnavailable', 'CosTimerEvent_TimerEventT', - 'CosTime_TIO', 'CosTime_TimeService', 'CosTime_UTO', - 'CosTimerEvent_TimerEventHandler', - 'CosTimerEvent_TimerEventService']. - -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- -init_per_testcase(_Case, Config) -> - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - - -end_per_testcase(_Case, Config) -> - Dog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'TimeBase_IntervalT' -%% Description: -%%----------------------------------------------------------------- -'TimeBase_IntervalT'(_) -> - ?match(true, orber_tc:check_tc('TimeBase_IntervalT':tc())), - ?match("IDL:omg.org/TimeBase/IntervalT:1.0", - 'TimeBase_IntervalT':id()), - ?match("TimeBase_IntervalT", - 'TimeBase_IntervalT':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'TimeBase_UtcT' -%% Description: -%%----------------------------------------------------------------- -'TimeBase_UtcT'(_) -> - ?match(true, orber_tc:check_tc('TimeBase_UtcT':tc())), - ?match("IDL:omg.org/TimeBase/UtcT:1.0", - 'TimeBase_UtcT':id()), - ?match("TimeBase_UtcT", - 'TimeBase_UtcT':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTime_TimeUnavailable' -%% Description: -%%----------------------------------------------------------------- -'CosTime_TimeUnavailable'(_) -> - ?match(true, orber_tc:check_tc('CosTime_TimeUnavailable':tc())), - ?match("IDL:omg.org/CosTime/TimeUnavailable:1.0", - 'CosTime_TimeUnavailable':id()), - ?match("CosTime_TimeUnavailable", - 'CosTime_TimeUnavailable':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTimerEvent_TimerEventT' -%% Description: -%%----------------------------------------------------------------- -'CosTimerEvent_TimerEventT'(_) -> - ?match(true, orber_tc:check_tc('CosTimerEvent_TimerEventT':tc())), - ?match("IDL:omg.org/CosTimerEvent/TimerEventT:1.0", - 'CosTimerEvent_TimerEventT':id()), - ?match("CosTimerEvent_TimerEventT", - 'CosTimerEvent_TimerEventT':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTime_TIO' -%% Description: -%%----------------------------------------------------------------- -'CosTime_TIO'(_) -> - ?nomatch(undefined, 'CosTime_TIO':oe_tc('_get_time_interval')), - ?nomatch(undefined, 'CosTime_TIO':oe_tc(spans)), - ?nomatch(undefined, 'CosTime_TIO':oe_tc(overlaps)), - ?nomatch(undefined, 'CosTime_TIO':oe_tc(time)), - ?match(undefined, 'CosTime_TIO':oe_tc(undefined)), - ?match([_|_], 'CosTime_TIO':oe_get_interface()), - ?match("IDL:omg.org/CosTime/TIO:1.0", 'CosTime_TIO':typeID()), - check_tc('CosTime_TIO':oe_get_interface()), - ?match(true, 'CosTime_TIO':oe_is_a('CosTime_TIO':typeID())), - ?match(false, 'CosTime_TIO':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTime_TimeService' -%% Description: -%%----------------------------------------------------------------- -'CosTime_TimeService'(_) -> - ?nomatch(undefined, 'CosTime_TimeService':oe_tc(universal_time)), - ?nomatch(undefined, 'CosTime_TimeService':oe_tc(secure_universal_time)), - ?nomatch(undefined, 'CosTime_TimeService':oe_tc(new_universal_time)), - ?nomatch(undefined, 'CosTime_TimeService':oe_tc(uto_from_utc)), - ?nomatch(undefined, 'CosTime_TimeService':oe_tc(new_interval)), - ?match(undefined, 'CosTime_TimeService':oe_tc(undefined)), - ?match([_|_], 'CosTime_TimeService':oe_get_interface()), - ?match("IDL:omg.org/CosTime/TimeService:1.0", - 'CosTime_TimeService':typeID()), - check_tc('CosTime_TimeService':oe_get_interface()), - ?match(true, 'CosTime_TimeService':oe_is_a('CosTime_TimeService':typeID())), - ?match(false, 'CosTime_TimeService':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTime_UTO' -%% Description: -%%----------------------------------------------------------------- -'CosTime_UTO'(_) -> - ?nomatch(undefined, 'CosTime_UTO':oe_tc('_get_time')), - ?nomatch(undefined, 'CosTime_UTO':oe_tc('_get_inaccuracy')), - ?nomatch(undefined, 'CosTime_UTO':oe_tc('_get_tdf')), - ?nomatch(undefined, 'CosTime_UTO':oe_tc('_get_utc_time')), - ?nomatch(undefined, 'CosTime_UTO':oe_tc(absolute_time)), - ?nomatch(undefined, 'CosTime_UTO':oe_tc(compare_time)), - ?nomatch(undefined, 'CosTime_UTO':oe_tc(time_to_interval)), - ?nomatch(undefined, 'CosTime_UTO':oe_tc(interval)), - ?match(undefined, 'CosTime_UTO':oe_tc(undefined)), - ?match([_|_], 'CosTime_UTO':oe_get_interface()), - ?match("IDL:omg.org/CosTime/UTO:1.0", 'CosTime_UTO':typeID()), - check_tc('CosTime_UTO':oe_get_interface()), - ?match(true, 'CosTime_UTO':oe_is_a('CosTime_UTO':typeID())), - ?match(false, 'CosTime_UTO':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTimerEvent_TimerEventHandler' -%% Description: -%%----------------------------------------------------------------- -'CosTimerEvent_TimerEventHandler'(_) -> - ?nomatch(undefined, 'CosTimerEvent_TimerEventHandler':oe_tc('_get_status')), - ?nomatch(undefined, 'CosTimerEvent_TimerEventHandler':oe_tc(time_set)), - ?nomatch(undefined, 'CosTimerEvent_TimerEventHandler':oe_tc(set_timer)), - ?nomatch(undefined, 'CosTimerEvent_TimerEventHandler':oe_tc(cancel_timer)), - ?nomatch(undefined, 'CosTimerEvent_TimerEventHandler':oe_tc(set_data)), - ?match(undefined, 'CosTimerEvent_TimerEventHandler':oe_tc(undefined)), - ?match([_|_], 'CosTimerEvent_TimerEventHandler':oe_get_interface()), - ?match("IDL:omg.org/CosTimerEvent/TimerEventHandler:1.0", - 'CosTimerEvent_TimerEventHandler':typeID()), - check_tc('CosTimerEvent_TimerEventHandler':oe_get_interface()), - ?match(true, 'CosTimerEvent_TimerEventHandler':oe_is_a('CosTimerEvent_TimerEventHandler':typeID())), - ?match(false, 'CosTimerEvent_TimerEventHandler':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTimerEvent_TimerEventService' -%% Description: -%%----------------------------------------------------------------- -'CosTimerEvent_TimerEventService'(_) -> - ?nomatch(undefined, 'CosTimerEvent_TimerEventService':oe_tc(register)), - ?nomatch(undefined, 'CosTimerEvent_TimerEventService':oe_tc(unregister)), - ?nomatch(undefined, 'CosTimerEvent_TimerEventService':oe_tc(event_time)), - ?match(undefined, 'CosTimerEvent_TimerEventService':oe_tc(undefined)), - ?match([_|_], 'CosTimerEvent_TimerEventService':oe_get_interface()), - ?match("IDL:omg.org/CosTimerEvent/TimerEventService:1.0", - 'CosTimerEvent_TimerEventService':typeID()), - check_tc('CosTimerEvent_TimerEventService':oe_get_interface()), - ?match(true, 'CosTimerEvent_TimerEventService':oe_is_a('CosTimerEvent_TimerEventService':typeID())), - ?match(false, 'CosTimerEvent_TimerEventService':oe_is_a("wrong")), - ok. - - - - -%%----------------------------------------------------------------- -%% MISC functions -%%----------------------------------------------------------------- -check_tc([]) -> - ok; -check_tc([{Op, {RetType, InParameters, OutParameters}}|T]) -> - io:format("checked - ~s~n", [Op]), - lists:all(?checktc(Op), [RetType|InParameters]), - lists:all(?checktc(Op), OutParameters), - check_tc(T). - - diff --git a/lib/cosTime/test/time_SUITE.erl b/lib/cosTime/test/time_SUITE.erl deleted file mode 100644 index f85f13badb..0000000000 --- a/lib/cosTime/test/time_SUITE.erl +++ /dev/null @@ -1,301 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : time_SUITE.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module(time_SUITE). - - -%%--------------- INCLUDES ----------------------------------- --include_lib("cosTime/src/cosTimeApp.hrl"). - --include_lib("common_test/include/ct.hrl"). - -%%--------------- DEFINES ------------------------------------ --define(default_timeout, test_server:minutes(20)). --define(match(ExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - io:format("------ CORRECT RESULT ------~n~p~n", - [AcTuAlReS]), - AcTuAlReS; - _ -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS) - end - end()). - --define(match_inverse(NotExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - NotExpectedRes -> - io:format("###### ERROR ERROR ######~n ~p~n", - [AcTuAlReS]), - exit(AcTuAlReS); - _ -> - io:format("------ CORRECT RESULT ------~n~p~n", - [AcTuAlReS]), - AcTuAlReS - end - end()). - - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0, - init_per_suite/1, end_per_suite/1, time_api/1, timerevent_api/1, - init_per_testcase/2, end_per_testcase/2, - app_test/1]). - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - cases(). - -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -cases() -> - [time_api, timerevent_api, app_test]. - - - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- - -init_per_testcase(_Case, Config) -> - Path = code:which(?MODULE), - code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - - -end_per_testcase(_Case, Config) -> - Path = code:which(?MODULE), - code:del_path(filename:join(filename:dirname(Path), "idl_output")), - Dog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -init_per_suite(Config) -> - Path = code:which(?MODULE), - code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), - mnesia:delete_schema([node()]), - mnesia:create_schema([node()]), - orber:install([node()]), - application:start(mnesia), - application:start(orber), - cosNotificationApp:install_event(), - cosNotificationApp:install(), - cosTime:install_time(), - cosTime:install_timerevent(), - if - is_list(Config) -> - Config; - true -> - exit("Config not a list") - end. - -end_per_suite(Config) -> - Path = code:which(?MODULE), - code:del_path(filename:join(filename:dirname(Path), "idl_output")), - cosTime:uninstall_time(), - cosTime:uninstall_timerevent(), - cosNotificationApp:uninstall(), - cosNotificationApp:uninstall_event(), - application:stop(orber), - application:stop(mnesia), - mnesia:delete_schema([node()]), - Config. - -%%----------------------------------------------------------------- -%% Tests app file -%%----------------------------------------------------------------- -app_test(_Config) -> - ok=test_server:app_test(cosTime), - ok. - -%%----------------------------------------------------------------- -%% CosTime API tests -%%----------------------------------------------------------------- -time_api(_Config) -> - ?match(ok, application:start(cosTime)), - TS=cosTime:start_time_service(0, 500), - Time=calendar:datetime_to_gregorian_seconds({{1582,1,1},{0,0,0}}), - Inaccuracy = 1000, - Tdf =1, - Utc = #'TimeBase_UtcT'{time=Time, inacclo = ?low_TimeT(Inaccuracy), - inacchi = ?high_TimeT(Inaccuracy), tdf = Tdf}, - UTO1='CosTime_TimeService':new_universal_time(TS, Time, Inaccuracy, Tdf), - UTO2='CosTime_TimeService':uto_from_utc(TS, Utc), - ?match(Time, 'CosTime_UTO':'_get_time'(UTO1)), - ?match(Inaccuracy, 'CosTime_UTO':'_get_inaccuracy'(UTO1)), - ?match(Tdf, 'CosTime_UTO':'_get_tdf'(UTO1)), - ?match(Utc, 'CosTime_UTO':'_get_utc_time'(UTO1)), - - ?match(Time, 'CosTime_UTO':'_get_time'(UTO2)), - ?match(Inaccuracy, 'CosTime_UTO':'_get_inaccuracy'(UTO2)), - ?match(Tdf, 'CosTime_UTO':'_get_tdf'(UTO2)), - ?match(Utc, 'CosTime_UTO':'_get_utc_time'(UTO2)), - - TIO1='CosTime_TimeService':new_interval(TS, 2, 5), - _TIO2='CosTime_TimeService':new_interval(TS, 3, 6), - TIO3='CosTime_TimeService':new_interval(TS, 1, 3), - TIO4='CosTime_TimeService':new_interval(TS, 3, 4), - TIO5='CosTime_TimeService':new_interval(TS, 7, 8), - TIO6='CosTime_TimeService':new_interval(TS, 2, 6), - TIO7='CosTime_TimeService':new_interval(TS, 3, 7), - - {_,TIO8} = ?match({'OTContained', _}, 'CosTime_TIO':overlaps(TIO1, TIO6)), - {_,TIO9} = ?match({'OTContainer', _}, 'CosTime_TIO':overlaps(TIO1, TIO1)), - {_,TIO10} = ?match({'OTContainer', _}, 'CosTime_TIO':overlaps(TIO1, TIO4)), - {_,TIO11} = ?match({'OTOverlap', _}, 'CosTime_TIO':overlaps(TIO1, TIO3)), - {_,TIO12} = ?match({'OTOverlap', _}, 'CosTime_TIO':overlaps(TIO1, TIO7)), - {_,TIO13} = ?match({'OTNoOverlap', _}, 'CosTime_TIO':overlaps(TIO1, TIO5)), - - ?match({'TimeBase_IntervalT',2,5},'CosTime_TIO':'_get_time_interval'(TIO8)), - ?match({'TimeBase_IntervalT',2,5},'CosTime_TIO':'_get_time_interval'(TIO9)), - ?match({'TimeBase_IntervalT',3,4},'CosTime_TIO':'_get_time_interval'(TIO10)), - ?match({'TimeBase_IntervalT',2,3},'CosTime_TIO':'_get_time_interval'(TIO11)), - ?match({'TimeBase_IntervalT',3,5},'CosTime_TIO':'_get_time_interval'(TIO12)), - ?match({'TimeBase_IntervalT',5,7},'CosTime_TIO':'_get_time_interval'(TIO13)), - - UTO3='CosTime_TimeService':new_universal_time(TS, 4, 2, 0), %% 2-6 - UTO4='CosTime_TimeService':new_universal_time(TS, 2, 1, 0), %% 1-3 - UTO5='CosTime_TimeService':new_universal_time(TS, 3, 0, 0), %% 3-3 - UTO6='CosTime_TimeService':new_universal_time(TS, 9, 1, 0), %% 8-10 - UTO7='CosTime_TimeService':new_universal_time(TS, 4, 3, 0), %% 1-7 - UTO8='CosTime_TimeService':new_universal_time(TS, 5, 2, 0), %% 3-7 - - {_,TIO14} = ?match({'OTContained', _}, 'CosTime_TIO':spans(TIO1, UTO7)), - {_,TIO15} = ?match({'OTContainer', _}, 'CosTime_TIO':spans(TIO1, UTO5)), - {_,TIO16} = ?match({'OTOverlap', _}, 'CosTime_TIO':spans(TIO1, UTO4)), - {_,TIO17} = ?match({'OTOverlap', _}, 'CosTime_TIO':spans(TIO1, UTO8)), - {_,TIO18} = ?match({'OTNoOverlap', _}, 'CosTime_TIO':spans(TIO1, UTO6)), - {_,TIO19} = ?match({'OTContained', _}, 'CosTime_TIO':spans(TIO1, UTO3)), - - ?match({'TimeBase_IntervalT',2,5},'CosTime_TIO':'_get_time_interval'(TIO14)), - ?match({'TimeBase_IntervalT',3,3},'CosTime_TIO':'_get_time_interval'(TIO15)), - ?match({'TimeBase_IntervalT',2,3},'CosTime_TIO':'_get_time_interval'(TIO16)), - ?match({'TimeBase_IntervalT',3,5},'CosTime_TIO':'_get_time_interval'(TIO17)), - ?match({'TimeBase_IntervalT',5,8},'CosTime_TIO':'_get_time_interval'(TIO18)), - ?match({'TimeBase_IntervalT',2,5},'CosTime_TIO':'_get_time_interval'(TIO19)), - - - cosTime:stop_time_service(TS), - application:stop(cosTime), - ok. - - -%%----------------------------------------------------------------- -%% CosTimerEvent API tests -%%----------------------------------------------------------------- -timerevent_api(_Config) -> - %% Init cosTime apps. - ?match(ok, application:start(cosTime)), - TS=cosTime:start_time_service(0, 500), - TES=cosTime:start_timerevent_service(TS), - - %%----- Initialize the cosNotification application. ----- - cosNotificationApp:start(), - Fac = (catch cosNotificationApp:start_factory([])), - {Ch, _Id1} = (catch 'CosNotifyChannelAdmin_EventChannelFactory':create_channel(Fac, [], [])), - %% Create the Admin objects - {AdminSupplier, _ASID}= ?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_suppliers(Ch,'OR_OP')), - {AdminConsumer, _ACID}= ?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_EventChannel':new_for_consumers(Ch,'OR_OP')), - - %% Create a push consumer TimerEventService will push events to. - {ProxyPushConsumer,_ID10}= ?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_SupplierAdmin':obtain_notification_push_consumer(AdminSupplier, 'ANY_EVENT')), - - %% Create a pull suppliers so we can check we actually got the event. - {ProxyPullSupplier,_ID1} = ?match({{_,key,_,_,_,_},_}, - 'CosNotifyChannelAdmin_ConsumerAdmin':obtain_notification_pull_supplier(AdminConsumer, 'ANY_EVENT')), - - AnyEvent = any:create(orber_tc:long(), 100), - UTO=?match({_,pseudo,_,_,_,_}, 'CosTime_TimeService':new_universal_time(TS, 10*10000000,1,1)), - EH=?match({_,key,_,_,_,_}, 'CosTimerEvent_TimerEventService':register(TES, ProxyPushConsumer, AnyEvent)), - - ?match('ESTimeCleared','CosTimerEvent_TimerEventHandler':'_get_status'(EH)), - ?match({false,_},'CosTimerEvent_TimerEventHandler':time_set(EH)), - ?match(ok,'CosTimerEvent_TimerEventHandler':set_timer(EH, 'TTRelative', UTO)), - ?match({true,_},'CosTimerEvent_TimerEventHandler':time_set(EH)), - ?match('ESTimeSet','CosTimerEvent_TimerEventHandler':'_get_status'(EH)), - - ?match({{any,tk_null,null}, false}, - 'CosNotifyChannelAdmin_ProxyPullSupplier':try_pull(ProxyPullSupplier)), - - ?match(AnyEvent, 'CosNotifyChannelAdmin_ProxyPullSupplier':pull(ProxyPullSupplier)), - ?match('ESTriggered','CosTimerEvent_TimerEventHandler':'_get_status'(EH)), - - %% It's allowed to send an UTO with time eq. to 0 if the server is TTRelative. - %% When TTAbsolute BAD_PARAM is raised. - UTO2=?match({_,pseudo,_,_,_,_}, 'CosTime_TimeService':new_universal_time(TS, 0,1,1)), - ?match({'EXCEPTION',_},'CosTimerEvent_TimerEventHandler':set_timer(EH, 'TTAbsolute', UTO2)), - ?match(ok,'CosTimerEvent_TimerEventHandler':set_timer(EH, 'TTRelative', UTO2)), - ?match(AnyEvent, 'CosNotifyChannelAdmin_ProxyPullSupplier':pull(ProxyPullSupplier)), - - %% TTPeriodic is defined to be relative, i.e., we can use the tactic as above. - ?match(ok,'CosTimerEvent_TimerEventHandler':set_timer(EH, 'TTPeriodic', UTO2)), - - %% Sleep for UTO*2+4 secs. At this point the Timer should have delivered 2 events. - timer:sleep(24000), - %% Cancel the timer so no more events will be delivered. - ?match(true,'CosTimerEvent_TimerEventHandler':cancel_timer(EH)), - - ?match({AnyEvent, true}, 'CosNotifyChannelAdmin_ProxyPullSupplier':try_pull(ProxyPullSupplier)), - ?match({AnyEvent, true}, 'CosNotifyChannelAdmin_ProxyPullSupplier':try_pull(ProxyPullSupplier)), - ?match({{any,tk_null,null}, false}, - 'CosNotifyChannelAdmin_ProxyPullSupplier':try_pull(ProxyPullSupplier)), - - - - %% Clean up. - cosNotificationApp:stop(), - cosTime:stop_timerevent_service(TES), - cosTime:stop_time_service(TS), - application:stop(cosTime), - ok. - - diff --git a/lib/cosTime/vsn.mk b/lib/cosTime/vsn.mk deleted file mode 100644 index 7d6fcbebcd..0000000000 --- a/lib/cosTime/vsn.mk +++ /dev/null @@ -1,2 +0,0 @@ -COSTIME_VSN = 1.2.3 - diff --git a/lib/cosTransactions/AUTHORS b/lib/cosTransactions/AUTHORS deleted file mode 100644 index 6d03df4c5a..0000000000 --- a/lib/cosTransactions/AUTHORS +++ /dev/null @@ -1,4 +0,0 @@ -Original Authors: -Niclas Eklund - -Contributors: diff --git a/lib/cosTransactions/Makefile b/lib/cosTransactions/Makefile deleted file mode 100644 index e8d0d1c0cd..0000000000 --- a/lib/cosTransactions/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include vsn.mk -VSN=$(COSTRANSACTIONS_VSN) - -# ---------------------------------------------------- -# Common Macros -# ---------------------------------------------------- -# SUB_DIRECTORIES = src test examples doc/src -# At the moment we don't have any example programs. -SUB_DIRECTORIES = src doc/src - -SPECIAL_TARGETS = - -# ---------------------------------------------------- -# Default Subdir Targets -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_subdir.mk diff --git a/lib/cosTransactions/doc/html/.gitignore b/lib/cosTransactions/doc/html/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosTransactions/doc/man3/.gitignore b/lib/cosTransactions/doc/man3/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosTransactions/doc/man6/.gitignore b/lib/cosTransactions/doc/man6/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosTransactions/doc/pdf/.gitignore b/lib/cosTransactions/doc/pdf/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosTransactions/doc/src/CosTransactions_Control.xml b/lib/cosTransactions/doc/src/CosTransactions_Control.xml deleted file mode 100644 index bf5e25a701..0000000000 --- a/lib/cosTransactions/doc/src/CosTransactions_Control.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - -
- - 1999 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosTransactions_Control - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 1999-04-12 - PA1 -
- CosTransactions_Control - This module implements the OMG CosTransactions::Control interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosTransactions/include/CosTransactions.hrl").

-
- - - get_coordinator(Control) -> Return - Return the Coordinator object associated with the target object - - Control = #objref - Return = Coordinator | {'EXCEPTION', E} - Coordinator = #objref - E = #'CosTransactions_Unavailable' {} - - -

This operation returns the Coordinator object associated with the target object. - The Coordinator supports operations for termination of a transaction.

-
-
- - get_terminator(Control) -> Return - Return the Terminator object associated with the target object - - Control = #objref - Return = Terminator | {'EXCEPTION', E} - Terminator = #objref - E = #'CosTransactions_Unavailable' {} - - -

This operation returns the Terminator object associated with the target object. - The Terminator supports operations for termination of a transaction.

-
-
-
- -
- diff --git a/lib/cosTransactions/doc/src/CosTransactions_Coordinator.xml b/lib/cosTransactions/doc/src/CosTransactions_Coordinator.xml deleted file mode 100644 index 006ba4cc29..0000000000 --- a/lib/cosTransactions/doc/src/CosTransactions_Coordinator.xml +++ /dev/null @@ -1,230 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosTransactions_Coordinator - - - - 1999-04-12 - PA1 -
- CosTransactions_Coordinator - This module implements the OMG CosTransactions::Coordinator interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosTransactions/include/CosTransactions.hrl").

-
- - - create_subtransaction(Coordinator) -> Control - Create a new subtransaction. - - Coordinator = #objref - Control = #objref - - -

A new subtransaction is created whose parent is the Coordinator argument.

-

Raises exception:

- - 'SubtransactionsUnavailable' - if nested transactions are not supported. - 'Inactive' - if target transaction has already been prepared. - -
-
- - get_transaction_name(Coordinator) -> Name - Return the name associated with the object. - - Coordinator = #objref - Name = string() of type "oe_name@machine_type_timestamp" - - -

Returns a printable string, which describe the transaction. The main purpose is to support debugging.

-
-
- - get_parent_status(Coordinator) -> Status - Return the status of the parent transaction. - - Coordinator = #objref - Status = atom() - - -

Returns the status of the parent transaction - associated with the target object. If the target object is a top-level - transaction this operation is equivalent to get_status/1 operation.

-

Possible Status replies:

- - 'StatusCommitted' - 'StatusCommitting' - 'StatusMarkedRollback' - 'StatusRollingBack' - 'StatusRolledBack' - 'StatusActive' - 'StatusPrepared' - 'StatusUnknown' - 'StatusNoTransaction' - 'StatusPreparing' - -
-
- - get_status(Coordinator) -> Status - Return the status of the transaction associated with the target object - - Coordinator = #objref - Status = atom() - - -

Returns the status of the transaction associated with the target object.

-
-
- - get_top_level_status(Coordinator) -> Status - Return the status of the top-level transaction associated with the target object - - Coordinator = #objref - Status = atom() - - -

Returns the status of the top-level transaction associated with the target object.

-
-
- - hash_top_level_tran(Coordinator) -> Return - Return a hash code for the top-level transaction associated with the target object - - Coordinator = #objref - Return = integer() - - -

Returns a hash code for the top-level transaction - associated with the target object. Equals the operation - hash_transaction/1 if the target object is a top-level transaction.

-
-
- - hash_transaction(Coordinator) -> Return - Return a hash code for the transaction associated with the target object. - - Coordinator = #objref - Return = integer() - - -

Returns a hash code for the transaction associated with the target object.

-
-
- - is_descendant_transaction(Coordinator, OtherCoordinator) -> Return - Return a boolean which indicates whether the transaction associated with the target object is a descendant of the transaction associated with the parameter object - - Coordinator = #objref - OtherCoordinator = #objref - Return = Boolean - - -

Returns true if the transaction associated with the target object is a - descendant of the transaction associated with the parameter object.

-
-
- - is_same_transaction(Coordinator, OtherCoordinator) -> Return - Return true if the transaction associated with the target object is related to the transaction associated with the parameter object - - Coordinator = #objref - OtherCoordinator = #objref - Return = Boolean - - -

Returns true if the transaction associated with the target object is - related to the transaction associated with the parameter object.

-
-
- - is_top_level_transaction(Coordinator) -> Return - Return true if the transaction associated with the target object is a top-level transaction - - Coordinator = #objref - Return = Boolean - - -

Returns true if the transaction associated with the target object is - a top-level transaction.

-
-
- - register_resource(Coordinator, Resource) -> RecoveryCoordinator - Register the parameter Resourceobject as a participant in the transaction associated with the target object - - Coordinator = #objref - Resource = #objref - RecoveryCoordinator = #objref - - -

This operation registers the parameter Resource object as a participant in the - transaction associated with the target object. The RecoveryCoordinator returned - by this operation can be used by this Resource during recovery.

- -

The Resources will be called in FIFO-order when preparing or committing. - Hence, be sure to register the Resources in the correct order.

-
-

Raises exception:

- - 'Inactive' - if target transaction has already been prepared. - -
-
- - register_subtran_aware(Coordinator, SubtransactionAwareResource) -> Return - Register the parameter SubtransactionAwareResourceobject such that it will be notified when the transaction, associated wit the target object, has committed or rolled back - - Coordinator = #objref - Return = ok - - -

This operation registers the parameter SubtransactionAwareResource object such that - it will be notified when the transaction, associated wit the target object, - has committed or rolled back.

- -

The Resources will be called in FIFO-order. - Hence, be sure to register the Resources in the correct order.

-
-
-
- - rollback_only(Coordinator) -> Return - Modify the transaction associated with the target object so the only possible outcome is to rollback the transaction - - Coordinator = #objref - Return = ok - - -

The transaction associated with the target object is modified so the only - possible outcome is to rollback the transaction.

-
-
-
- -
- diff --git a/lib/cosTransactions/doc/src/CosTransactions_RecoveryCoordinator.xml b/lib/cosTransactions/doc/src/CosTransactions_RecoveryCoordinator.xml deleted file mode 100644 index 2d61f815a3..0000000000 --- a/lib/cosTransactions/doc/src/CosTransactions_RecoveryCoordinator.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosTransactions_RecoveryCoordinator - - - - - - 1999-04-12 - PA1 -
- CosTransactions_RecoveryCoordinator - This module implements the OMG CosTransactions::RecoveryCoordinator interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosTransactions/include/CosTransactions.hrl").

-
- - - replay_completion(RecoveryCoordinator, Timeout, Resource) -> Return - Return the current status of the transaction - - RecoveryCoordinator = #objref - Timeout = integer(), milliseconds | 'infinity' - Resource = #objref - Return = Status | {'EXCEPTION', E} - E = #'CosTransactions_NotPrepared'{} - Status = atom() - - -

The RecoveryCoordinator object is returned by the operation - CosTransactions_Coordinator:register_resource/3. The replay_completion/2 - may only be used by the registered Resource and returns the current status - of the transaction. The operation is used when recovering after a failure.

-

Possible Status replies:

- - 'StatusCommitted' - 'StatusCommitting' - 'StatusMarkedRollback' - 'StatusRollingBack' - 'StatusRolledBack' - 'StatusActive' - 'StatusPrepared' - 'StatusUnknown' - 'StatusNoTransaction' - 'StatusPreparing' - - -

replay_completion/3 is blocking and may cause dead-lock if a child - calls this function at the same time as its parent invokes an operation - on the child. Dead-lock will not occur if the timeout has any value except 'infinity'.

-

If the call is external incoming (intra-ORB) the timeout will not be activated. - Hence, similar action must be taken if the Resource resides on another vendors ORB.

-
-
-
-
- -
- diff --git a/lib/cosTransactions/doc/src/CosTransactions_Resource.xml b/lib/cosTransactions/doc/src/CosTransactions_Resource.xml deleted file mode 100644 index 40006b55d9..0000000000 --- a/lib/cosTransactions/doc/src/CosTransactions_Resource.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosTransactions_Resource - - - - 1999-04-12 - PA1 -
- CosTransactions_Resource - This module implements the OMG CosTransactions::Resource interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosTransactions/include/CosTransactions.hrl").

-
- - - commit(Resource) -> Return - Instruct the target object to commit the transaction - - Resource = #objref - Return = ok | {'EXCEPTION', E} - E = #'CosTransactions_NotPrepared'{} | #'CosTransactions_HeuristicRollback'{} | #'CosTransactions_HeuristicMixed'{} | #'CosTransactions_HeuristicHazard'{} - - -

This operation instructs the Resource to commit all changes made as a part of the transaction.

-

The Resource can raise:

- - Heuristic Exception - if a Heuristic decision is made which differ - from the true outcome of the transaction. The Resource must remember - the Heuristic outcome until the forget operation is performed. - -
-
- - commit_one_phase(Resource) -> Return - Instruct the target object to commit the transaction - - Resource = #objref - Return = ok | {'EXCEPTION', E} - E = #'CosTransactions_HeuristicHazard'{} | #'CosTransactions_TransactionRolledBack'{} - - -

If possible, the Resource should commit all changes made as part of the transaction, - else it should raise the TRANSACTION_ROLLEDBACK exception. - This operation can only be used if the Resource is the only child of its parent.

-
-
- - forget(Resource) -> Return - Instruct the target object to forget any heuristic decisions - - Resource = #objref - Return = ok - - -

This operation informs the Resource that it is safe to forget any Heuristic - decisions and the knowledge of the transaction.

-
-
- - prepare(Resource) -> Return - Instruct the target object to begin the two-phase commit protocol - - Resource = #objref - Return = Vote | {'EXCEPTION', E} - Vote = 'VoteReadOnly' | 'VoteCommit' | 'VoteRollback' - E = #'CosTransactions_HeuristicMixed'{} | #'CosTransactions_HeuristicHazard'{} - - -

This operation is invoked on the Resource to begin the two-phase commit protocol.

-

The Resource can reply:

- - 'VoteReadOnly' - if no persistent data has been modified by the transaction. - The Resource can forget all knowledge of the transaction. - 'VoteCommit' - if the Resource has been prepared and is able to write all the - data needed to commit the transaction to stable storage. - 'VoteRollback' - under any circumstances but must do so if none of the alternatives above - are applicable. - Heuristic Exception - if a Heuristic decision is made which differ - from the true outcome of the transaction. The Resource must remember - the Heuristic outcome until the forget operation is performed. - -
-
- - rollback(Resource) -> Return - Instruct the target object to rollback the transaction - - Resource = #objref - Return = ok | {'EXCEPTION', E} - E = #'CosTransactions_HeuristicCommit'{} | #'CosTransactions_HeuristicMixed'{} | #'CosTransactions_HeuristicHazard'{} - - -

This operation instructs the Resource to rollback all changes made as a part of the transaction.

-

The Resource can raise:

- - Heuristic Exception - if a Heuristic decision is made which differ - from the true outcome of the transaction. The Resource must remember - the Heuristic outcome until the forget operation is performed. - -
-
-
- -
- diff --git a/lib/cosTransactions/doc/src/CosTransactions_SubtransactionAwareResource.xml b/lib/cosTransactions/doc/src/CosTransactions_SubtransactionAwareResource.xml deleted file mode 100644 index 30102d18d9..0000000000 --- a/lib/cosTransactions/doc/src/CosTransactions_SubtransactionAwareResource.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosTransactions_SubtransactionAwareResource - - - - 1999-04-12 - PA1 -
- CosTransactions_SubtransactionAwareResource - This module implements the OMG CosTransactions::SubtransactionAwareResource interface. - -

This interface inherits the CosTransactions::Resource interface. Hence, - it must also support all operations defined in the Resource interface.

-

To get access to the record definitions for the structures use:

--include_lib("cosTransactions/include/CosTransactions.hrl").

-
- - - commit_subtransaction(SubtransactionAwareResource, Coordinator) -> Return - Notify the target object that the transaction has committed - - SubtransactionAwareResource = #objref - Coordinator = #objref - Return = ok - - -

If the SubtransactionAwareResource have been registered with a subtransaction - using the operation CosTransactions_Coordinator:register_subtran_aware/2, - it will be notified when the transaction has committed.

- -

The results of a committed subtransaction are relative to the completion of its ancestor - transactions, that is, these results can be undone if any ancestor transaction is rolled back.

-
-
-
- - rollback_subtransaction(SubtransactionAwareResource) -> Return - Notify the target object that the transaction has been rolled back - - SubtransactionAwareResource = #objref - Return = ok - - -

If the SubtransactionAwareResource have been registered with a transactions - using the operation CosTransactions_Coordinator:register_subtran_aware/2 - it will be notified when the transaction has rolled back.

-
-
-
- -
- diff --git a/lib/cosTransactions/doc/src/CosTransactions_Synchronization.xml b/lib/cosTransactions/doc/src/CosTransactions_Synchronization.xml deleted file mode 100644 index c21e7c559d..0000000000 --- a/lib/cosTransactions/doc/src/CosTransactions_Synchronization.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - -
- - 1999 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosTransactions_Synchronization - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 1999-04-12 - PA1 -
- CosTransactions_Synchronization - This module implements the OMG CosTransactions::Synchronization interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosTransactions/CosTransactions.hrl").

-
- - - before_completion(Synchronization) -> Return - Notify the target object that the transaction is about to enter the prepare phase - - Synchronization = #objref - Return = ok - - -

If the target object is a transaction using the operation register_synchronization/2 - it will be notified to perform necessary processing prior to the prepare phase.

-
-
- - after_completion(Synchronization) -> Return - Notify the target object that the transaction is completed - - Synchronization = #objref - Return = ok - - -

If the target object is a transaction using the operation register_synchronization/2 - it will be notified to perform necessary processing after terminating the transaction.

-
-
-
- -
- diff --git a/lib/cosTransactions/doc/src/CosTransactions_Terminator.xml b/lib/cosTransactions/doc/src/CosTransactions_Terminator.xml deleted file mode 100644 index f75f4d912d..0000000000 --- a/lib/cosTransactions/doc/src/CosTransactions_Terminator.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - -
- - 1999 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosTransactions_Terminator - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 1999-04-12 - PA1 -
- CosTransactions_Terminator - This module implements the OMG CosTransactions::Terminator interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosTransactions/include/CosTransactions.hrl").

-
- - - commit(Terminator, ReportHeuristics) -> Return - Try to commit a transaction - - Terminator = #objref - ReportHeuristics = boolean() - Return = ok | {'EXCEPTION', E} - E = #'CosTransactions_HeuristicMixed'{} | #'CosTransactions_HeuristicHazrd'{} | #'CosTransactions_TransactionRolledBack'{} - - -

This operation initiates the two-phase commit protocol. If the transaction has not been marked - 'rollback only' and all the participants agree to commit, the operation terminates normally. Otherwise, - the TransactionRolledBack is raised. If the parameter ReportHeuristics is true and inconsistent - outcomes by raising an Heuristic Exception.

-
-
- - rollback(Terminator) -> Return - Rollback a transaction - - Terminator = #objref - Return = ok - - -

This operation roles back the transaction.

-
-
-
- -
- diff --git a/lib/cosTransactions/doc/src/CosTransactions_TransactionFactory.xml b/lib/cosTransactions/doc/src/CosTransactions_TransactionFactory.xml deleted file mode 100644 index c4469ef850..0000000000 --- a/lib/cosTransactions/doc/src/CosTransactions_TransactionFactory.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - -
- - 1999 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosTransactions_TransactionFactory - - - - - - 1999-04-12 - PA1 -
- CosTransactions_TransactionFactory - This module implements the OMG CosTransactions::TransactionFactory interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosTransactions/include/CosTransactions.hrl").

-
- - - create(TransactionFactory, Timeout) -> Control - Create a new top-level transaction - - TransactionFactory = #objref - Timeout = integer() - Control = #objref - - -

This operation creates a new top-level transaction.

-

The Timeout argument can be:

- - 0 - no timeout. - N (integer() > 0) - the transaction will be subject to being rolled back - if it does not complete before N seconds have elapsed. - -
-
-
- -
- diff --git a/lib/cosTransactions/doc/src/CosTransactions_TransactionalObject.xml b/lib/cosTransactions/doc/src/CosTransactions_TransactionalObject.xml deleted file mode 100644 index 319da2bd16..0000000000 --- a/lib/cosTransactions/doc/src/CosTransactions_TransactionalObject.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosTransactions_TransactionalObject - - - - 1999-04-12 - PA1 -
- CosTransactions_TransactionalObject - This module implements the OMG CosTransactions::TransactionalObject interface. - -

To get access to the record definitions for the structures use:

--include_lib("cosTransactions/CosTransactions.hrl").

-

The TransactionalObject interface is used by an object to indicate that it is transactional. - By supporting this interface, an object indicates that it wants the transaction context associated with - the client to be associated with all operation on its interface. No operations are defined.

-
- -
- diff --git a/lib/cosTransactions/doc/src/Makefile b/lib/cosTransactions/doc/src/Makefile deleted file mode 100644 index 3c054593a9..0000000000 --- a/lib/cosTransactions/doc/src/Makefile +++ /dev/null @@ -1,142 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2017. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../../vsn.mk -VSN=$(COSTRANSACTIONS_VSN) -APPLICATION=cosTransactions - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN) - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -XML_APPLICATION_FILES = ref_man.xml -XML_REF3_FILES = \ - cosTransactions.xml \ - CosTransactions_Control.xml \ - CosTransactions_Coordinator.xml \ - CosTransactions_RecoveryCoordinator.xml \ - CosTransactions_Resource.xml \ - CosTransactions_SubtransactionAwareResource.xml \ - CosTransactions_Terminator.xml \ - CosTransactions_TransactionFactory.xml -# CosTransactions_Synchronization.xml - -XML_PART_FILES = \ - part.xml -XML_CHAPTER_FILES = \ - ch_contents.xml \ - ch_introduction.xml \ - ch_install.xml \ - ch_example.xml \ - ch_skeletons.xml \ - notes.xml - -BOOK_FILES = book.xml - -XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \ - $(XML_PART_FILES) $(XML_CHAPTER_FILES) - -TECHNICAL_DESCR_FILES = - -GIF_FILES = - -PS_FILES = - -# ---------------------------------------------------- - -INTERNAL_HTML_FILES = $(TECHNICAL_DESCR_FILES:%.xml=$(HTMLDIR)/%.html) - -HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \ - $(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html) - -INFO_FILE = ../../info -EXTRA_FILES = \ - $(DEFAULT_GIF_FILES) \ - $(DEFAULT_HTML_FILES) \ - $(XML_REF3_FILES:%.xml=$(HTMLDIR)/%.html) \ - $(XML_CHAPTER_FILES:%.xml=$(HTMLDIR)/%.html) - -MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3) - -HTML_REF_MAN_FILE = $(HTMLDIR)/index.html - -TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -XML_FLAGS += -DVIPS_FLAGS += - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -$(HTMLDIR)/%.gif: %.gif - $(INSTALL_DATA) $< $@ - -docs: pdf html man - -$(TOP_PDF_FILE): $(XML_FILES) - -pdf: $(TOP_PDF_FILE) - -html: gifs $(HTML_REF_MAN_FILE) - -clean clean_docs: - rm -rf $(HTMLDIR)/* - rm -f $(MAN3DIR)/* - rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) - rm -f errs core *~ - -man: $(MAN3_FILES) - -gifs: $(GIF_FILES:%=$(HTMLDIR)/%) - -$(INDEX_TARGET): $(INDEX_SRC) - sed -e 's;%VSN%;$(VSN);' $(INDEX_SRC) > $(INDEX_TARGET) - -debug opt: - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_docs_spec: docs - $(INSTALL_DIR) "$(RELSYSDIR)/doc/pdf" - $(INSTALL_DATA) $(TOP_PDF_FILE) "$(RELSYSDIR)/doc/pdf" - $(INSTALL_DIR) "$(RELSYSDIR)/doc/html" - $(INSTALL_DATA) $(HTMLDIR)/* \ - "$(RELSYSDIR)/doc/html" - $(INSTALL_DATA) $(INFO_FILE) "$(RELSYSDIR)" - $(INSTALL_DIR) "$(RELEASE_PATH)/man/man3" - $(INSTALL_DATA) $(MAN3DIR)/* "$(RELEASE_PATH)/man/man3" - -release_spec: diff --git a/lib/cosTransactions/doc/src/book.xml b/lib/cosTransactions/doc/src/book.xml deleted file mode 100644 index 33a8c323bb..0000000000 --- a/lib/cosTransactions/doc/src/book.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosTransactions - Niclas Eklund - - 1999-04-14 - 2.0 -
- - - cosTransactions - - - - - - - - - - - - - - -
- diff --git a/lib/cosTransactions/doc/src/ch_contents.xml b/lib/cosTransactions/doc/src/ch_contents.xml deleted file mode 100644 index 9b2832a032..0000000000 --- a/lib/cosTransactions/doc/src/ch_contents.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - The cosTransactions Application - Niclas Eklund - - 1999-04-14 - B - ch_contents.xml -
- -
- Content Overview -

The cosTransactions documentation is divided into three sections: -

- - -

PART ONE - The User's Guide -

-Description of the cosTransactions Application including - services and a small tutorial demonstrating - the development of a simple service.

-
- -

PART TWO - Release Notes -

-A concise history of cosTransactions.

-
- -

PART THREE - The Reference Manual -

- A quick reference guide, including a - brief description, to all the functions available in cosTransactions.

-
-
-
- -
- Brief Description of the User's Guide -

The User's Guide contains the following parts:

- - -

cosTransactions overview

-
- -

cosTransactions installation

-
- -

A tutorial example

-
-
-
-
- diff --git a/lib/cosTransactions/doc/src/ch_example.xml b/lib/cosTransactions/doc/src/ch_example.xml deleted file mode 100644 index a2451e5fbc..0000000000 --- a/lib/cosTransactions/doc/src/ch_example.xml +++ /dev/null @@ -1,283 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosTransactions Examples - - - 1999-04-27 - A - ch_example.xml -
- -
- A Tutorial on How to Create a Simple Service - -
- Interface design -

To use the cosTransactions application participants must be implemented. - There are two types of participants:

- - CosTransactions_Resource - operations used to commit or rollback resources. - CosTransactions_SubtransactionAwareResource - - operations used when the resources want to be notified when a subtransaction commits. - This interface inherits the CosTransactions_Resource - -

The interfaces for these participants are defined in CosTransactions.idl

-
- -
- Generating a Participant Interface -

We start by creating an interface which inherits from CosTransactions::Resource. Hence, - we must also implement all operations defined in the Resource interface. The IDL-file could look like:

- - -module ownResourceImpl { - - interface ownInterface:CosTransactions::Resource { - - void ownFunctions(in any NeededArguments) - raises(Systemexceptions,OwnExceptions); - - }; -}; - -#endif - ]]> -

Run the IDL compiler on this file by calling the ic:gen/1 function. - This will produce the API named ownResourceImpl_ownInterface.erl. - After generating the API stubs and the server skeletons it is time to - implement the servers and if no special options are sent - to the IDl compiler the file name is ownResourceImpl_ownInterface_impl.erl.

-
- -
- Implementation of Participant interface -

If the participant is intended to be a plain Resource, we must implement the following operations:

- - prepare/1 - this operation is invoked on the Resource to begin the two-phase commit protocol. - rollback/1 - this operation instructs the Resource to rollback all changes made as a part of the transaction. - commit/1 - this operation instructs the Resource to commit all changes made as a part of the transaction. - commit_one_phase/1 - if possible, the Resource should commit all changes made as part of the transaction. - This operation can only be used if the Resource is the only child of its parent. - forget/1 - this operation informs the Resource that it is safe to forget any - Heuristic decisions is a unilateral decision by a participant to commit - or rollback without receiving the true outcome of the transaction from its parent's coordinator. - and the knowledge of the transaction. - ownFunctions - all application specific operations. - -

If the participant wants to be notified when a subtransaction commits, we must also implement the following operations - (besides the operations above):

- - commit_subtransaction/2 - if the SubtransactionAwareResource have been registered - with a transactions using the operation CosTransactions_Coordinator:register_subtran_aware/2 it will - be notified when the transaction has - committed. - rollback_subtransaction/1 - if the SubtransactionAwareResource have been registered - with a transactions using the operation CosTransactions_Coordinator:register_subtran_aware/2 - it will be notified when the transaction has - rolled back. - - -

The results of a committed subtransaction are relative to the completion of its ancestor transactions, - that is, these results can be undone if any ancestor transaction is rolled back.

-
-
- -
- Participant Operations Behavior -

Each application participant must behave in a certain way to ensure that the two-phase commit protocol - can complete the transactions correctly.

- -
- prepare -

This operation ask the participant to vote on the outcome of the transaction. Possible replies are:

- - 'VoteReadOnly' - if no data associated with the transaction has been modified VoteReadOnly may be returned. - The Resource can forget all knowledge of the transaction and terminate. - 'VoteCommit' - if the Resource is able to write all the data needed to commit the transaction to a stable storage, - VoteCommit may be returned. The Resource will then wait until it is informed of the outcome of the transaction. - The Resource may, however, make a unilateral decision (Heuristic) to commit or rollback changes associated - with the transaction. When the Resource is informed of the true outcome (rollback/commit) and it is equal to - the Heuristic decision the Resource just return 'ok'. But, if there is a mismatch and the commit-operation is irreversible, - the Resource must raise a Heuristic Exception and wait - until the forget operation is invoked. The Heuristic Decision must be recorded in stable storage. - 'VoteRollback' - the Resource may vote VoteRollback under any circumstances. - The Resource can forget all knowledge of the transaction and terminate. - - -

Before replying to the prepare operation, the Resource must record the prepare state, the reference of its - superior RecoveryCoordinator in stable storage. - The RecoveryCoordinator is obtained when registering as a participant in a transaction.

-
-
- -
- rollback -

The Resource should, if necessary, rollback all changes made as part of the transaction. If the Resource is not aware of the - transaction it should do nothing, e.g., recovered after a failure and have no data in stable storage. Heuristic Decisions - must be handled as described above.

-
- -
- commit -

The Resource should, if necessary, commit all changes made as part of the transaction. If the Resource is not aware of the - transaction it should do nothing, e.g., recovered after a failure and have no data in stable storage. Heuristic Decisions - must be handled as described above.

-
- -
- commit_one_phase -

If possible, the Resource should commit all changes made as part of the transaction. If it cannot, it should raise the - TRANSACTION_ROLLEDBACK exception. This operation can only be used if the Resource is the only child of its parent. - If a failure occurs the completion of the operation must be retried when the failure is repaired. Heuristic Decisions - must be handled as described above.

-
- -
- forget -

If the Resource raised a Heuristic Exception to commit, rollback or commit_one_phase this operation - will be performed. The Resource can forget all knowledge of the transaction and terminate.

-
- -
- commit_subtransaction -

If the SubtransactionAwareResource have been registered with a subtransaction - using the operation CosTransactions_Coordinator:register_subtran_aware/2 - it will be notified when the transaction has committed. The Resource may raise the exception - 'TRANSACTION_ROLLEDBACK'.

- -

The result of a committed subtransaction is relative to the completion of its ancestor - transactions, that is, these results can be undone if any ancestor transaction is rolled back.

-
-
- -
- rollback_subtransaction -

If the SubtransactionAwareResource have been registered with a subtransaction - using the operation CosTransactions_Coordinator:register_subtran_aware/2 - it will be notified when the subtransaction has rolled back.

-
-
- -
- How to Run Everything -

Below is a short transcript on how to run cosTransactions.

- - -%% Start Mnesia and Orber -mnesia:delete_schema([node()]), -mnesia:create_schema([node()]), -orber:install([node()]), -application:start(mnesia), -application:start(orber), - -%% Register CosTransactions in the IFR. -'oe_CosTransactions':'oe_register'(), - -%% Register the application specific Resource implementations -%% in the IFR. -'oe_ownResourceImpl':'oe_register'(), - -%%-- Set parameters -- -%% Timeout can be either 0 (no timeout) or an integer N > 0. -%% The later state that the transaction should be rolled -%% back if the transaction have not completed within N seconds. -TimeOut = 0, - -%% Do we want the transaction to report Heuristic Exceptions? -%% This variable must be boolean and indicates the way the -%% Terminator should behave. -Heuristics = true, - -%% Start the cosTransactions application. -cosTransactions:start(), %% or application:start(cosTransactions), - -%% Start a factory using the default configuration -TrFac = cosTransactions:start_factory(), -%% ... or use configuration parameters. -TrFac = cosTransactions:start_factory([{typecheck, false}, {hash_max, 3013}]), - -%% Create a new top-level transaction. -Control = 'CosTransactions_TransactionFactory':create(TrFac, TimeOut), - -%% Retrieve the Coordinator and Terminator object references from -%% the Control Object. -Term = 'CosTransactions_Control':get_terminator(Control), -Coord = 'CosTransactions_Control':get_coordinator(Control), - -%% Create two SubTransactions with the root-Coordinator as parent. -SubCont1 = 'CosTransactions_Coordinator':create_subtransaction(Coord), -SubCont2 = 'CosTransactions_Coordinator':create_subtransaction(Coord), - -%% Retrieve the Coordinator references from the Control Objects. -SubCoord1 = 'CosTransactions_Control':get_coordinator(SubCont1), -SubCoord2 = 'CosTransactions_Control':get_coordinator(SubCont2), - -%% Create application Resources. We can, for example, start the Resources -%% our selves or look them up in the naming service. This is application -%% specific. -Res1 = ... -Res2 = ... -Res3 = ... -Res4 = ... - -%% Register Resources with respective Coordinator. Each call returns -%% a RecoveryCoordinator object reference. -RC1 = 'CosTransactions_Coordinator':register_resource(SubCoord1, Res1), -RC2 = 'CosTransactions_Coordinator':register_resource(SubCoord1, Res2), -RC3 = 'CosTransactions_Coordinator':register_resource(SubCoord2, Res3), -RC4 = 'CosTransactions_Coordinator':register_resource(SubCoord2, Res4), - -%% Register Resource 4 with SubCoordinator 1 so that the Resource will be -%% informed when the SubCoordinator commits or roll-back. -'CosTransactions_Coordinator':register_subtran_aware(SubCoord1, Res4), - -%% We are now ready to try to commit the transaction. The second argument -%% must be a boolean -Outcome = (catch 'CosTransactions_Terminator':commit(Term, Heuristics)), - - -

For the cosTransaction application to be able to recognize if a Resource is - dead or in the process of restarting the Resource must be started as persistent, - e.g., 'OwnResource':oe_create_link(Env, [{regname, {global, RegName}}, {persistent, true}]). - For more information see the Orber documentation.

-
-

The outcome of the transaction can be:

- - ok - the transaction was successfully committed. - {'EXCEPTION', HeuristicExc} - at least one participant made a - Heuristic decision or, due to a failure, one or more participants - where unreachable. - {'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{}} - - the transaction was successfully rolled back. - Any system exception - - the transaction failed with unknown reason. - -
-
-
- diff --git a/lib/cosTransactions/doc/src/ch_install.xml b/lib/cosTransactions/doc/src/ch_install.xml deleted file mode 100644 index 4270c320b5..0000000000 --- a/lib/cosTransactions/doc/src/ch_install.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Installing cosTransactions - - - 1999-04-20 - - ch_install.xml -
- -
- Installation Process -

This chapter describes how to install - cosTransactions - in an Erlang Environment. -

- -
- Preparation -

Before starting the installation process for cosTransactions, - the application Orber must be running.

-

The cosTransactions application must be able to log progress to disk. The log files are - created in the current directory as "oe_name@machine_type_timestamp". Hence, read and - write rights must be granted. If the transaction completes in an orderly fashion the - logfiles are removed, but not if an error, which demands human intervention, occur.

-
- -
- Configuration -

When using the Transaction Service the cosTransactions application - must be started using either cosTransactions:start() or - application:start(cosTransactions). -

-

The following application configuration parameters exist:

- - maxRetries - default is 40 times, i.e., if a transaction participant is unreachable - the application will retry to contact it N times. Reaching the maximum is considered to be a disaster. - comFailWait - default is 5000 milliseconds, i.e., before the application - retries to contact unreachable transaction participants the application wait Time milliseconds. - -

Then the Transaction Factory - must be started:

- - cosTransactions:start_factory() - starts and returns a reference to a factory using default configuration parameters. - cosTransactions:start_factory(Options) - starts and returns a reference to a factory using given configuration parameters. - -

The following options exist: -

- - {hash_max, HashValue} - - This value denotes the upper bound of the hash value the Coordinator uses. - Default is 1013. HashValue must be an integer. - {allow_subtr, Boolean} - - If set to true it is possible to create subtransactions. - Default is true. - {typecheck, Boolean} - - If set to to true all transaction operation's arguments will be type-checked. - Default is true. - {tty, Boolean} - - Enables or disables error printouts to the tty. - If Flag is false, all text that the error logger would have sent to the terminal is discarded. - If Flag is true, error messages are sent to the terminal screen. - {logfile, FileName} - - This function makes it possible to store all system information in FileName (string()). - It can be used in combination with the tty(false) item to have a silent system, - where all system information are logged to a file. - As default no logfile is used. - {maxRetries, Integer} - - default is 40 times, i.e., if a transaction participant is unreachable the application will - retry to contact it N times. Reaching the maximum is considered to be a disaster. - This option overrides the application configuration parameter. - {comFailWait, Integer} - - default is 5000 milliseconds, i.e., before the application retries to contact unreachable - transaction participants the application wait Time milliseconds. - This option overrides the application configuration parameter. - -

The Factory is now ready to use. For a more detailed description see Examples. -

-
-
-
- diff --git a/lib/cosTransactions/doc/src/ch_introduction.xml b/lib/cosTransactions/doc/src/ch_introduction.xml deleted file mode 100644 index 43d25360bc..0000000000 --- a/lib/cosTransactions/doc/src/ch_introduction.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Introduction to cosTransactions - Niclas Eklund - - 1999-04-26 - - ch_introduction.xml -
- -
- Overview -

The cosTransactions application is a Transaction Service compliant with the OMG - Transaction Service CosTransactions 1.1. -

- -
- Purpose and Dependencies -

cosTransactions is dependent on Orber version 3.0.1 or later(see the Orber - documentation), which provides CORBA functionality in an Erlang environment.

-

cosTransactions is dependent on supervisor/stdlib-1.7 or later.

-

Basically, cosTransaction implements a two-phase commit protocol and allows objects running - on different platforms to participate in a transaction.

-
- -
- Prerequisites -

To fully understand the concepts presented in the - documentation, it is recommended that the user is familiar - with distributed programming, CORBA and the Orber application. -

-

Recommended reading includes CORBA, Fundamentals and Programming - Jon Siegel and Open Telecom Platform Documentation Set. It is also helpful to have read - Concurrent Programming in Erlang and, for example, Transaction Processing: concepts and techniques - Jim Gray, Andreas Reuter.

- -

The cosTransaction application is compliant with the OMG CosTransactions specification 1.1. Using - other vendors transaction service, compliant with the OMG CosTransactions specification 1.0, may - not work since the 'TRANSACTION_REQUIRED', 'TRANSACTION_ROLLEDBACK' and 'INVALID_TRANSACTION' - exceptions have been redefined to be system exceptions, i.e., used to be transaction-specific ('CosTransactions_Exc').

-
-
-
-
- diff --git a/lib/cosTransactions/doc/src/ch_skeletons.xml b/lib/cosTransactions/doc/src/ch_skeletons.xml deleted file mode 100644 index e101cff5da..0000000000 --- a/lib/cosTransactions/doc/src/ch_skeletons.xml +++ /dev/null @@ -1,214 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Resource Skeletons - Niclas Eklund - - 1999-04-29 - - ch_skeletons.xml -
- -
- Resource Skeletons -

This chapter provides a skeleton for application Resources. For more information - see the Orber documentation.

- -%%%----------------------------------------------------------- -%%% File : Module_Interface_impl.erl -%%% Author : -%%% Purpose : -%%% Created : -%%%----------------------------------------------------------- - --module('Module_Interface_impl'). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("cosTransactions/include/CosTransactions.hrl"). - -%%--------------- EXPORTS------------------------------------- -%%- Inherit from CosTransactions::Resource ------------------- --export([prepare/2, - rollback/2, - commit/2, - commit_one_phase/2, - forget/2]). - -%%- Inherit from CosTransactions::SubtransactionAwareResource --export([commit_subtransaction/3, - rollback_subtransaction/2]). - -%%--------------- gen_server specific ------------------------ --export([init/1, terminate/2, code_change/3, handle_info/2]). - -%%------------------------------------------------------------ -%% function : gen_server specific -%%------------------------------------------------------------ -init(Env) -> - %% 'trap_exit' optional - process_flag(trap_exit,true), - - %%--- Possible replies --- - %% Reply and await next request - {ok, State}. - - %% Reply and if no more requests within Time the special - %% timeout message should be handled in the - %% Module_Interface_impl:handle_info/2 call-back function (use the - %% IC option {{handle_info, "Module::Interface"}, true}). - {ok, State, TimeOut}. - - %% Return ignore in order to inform the parent, especially if it is a - %% supervisor, that the server, as an example, did not start in - %% accordance with the configuration data. - ignore. - - %% If the initializing procedure fails, the reason - %% is supplied as StopReason. - {stop, StopReason}. - - -terminate(Reason, State) -> - ok. - -code_change(OldVsn, State, Extra) -> - {ok, NewState}. - -%% If use IC option {{handle_info, "Module::Interface"}, true} -handle_info(Info, State) -> - %%--- Possible replies --- - %% Await the next invocation. - {noreply, State}. - %% Stop with Reason. - {stop, Reason, State}. - - -%%- Inherit from CosTransactions::Resource ------------------- -prepare(State) -> - - %%% Do application specific actions here %%% - - %%-- Reply: -- - %% If no data related to the transaction changed. - {reply, 'VoteReadOnly', State} - %% .. or (for example): - {stop, normal, 'VoteReadOnly', State}. - - %% If able to commit - {reply, 'VoteCommit', State} - - %% If not able to commit - {reply, 'VoteRollback', State} - %% .. or (for example): - {stop, normal, 'VoteRollback', State}. - -rollback(State) -> - - %%% Do application specific actions here %%% - - %%-- Reply: -- - %% If able to rollback successfully - {reply, ok, State} - %% .. or (for example): - {stop, normal, ok, State}. - - %% If Heuristic Decision. Raise exception: - corba:raise(#'CosTransactions_HeuristicMixed' {}) - corba:raise(#'CosTransactions_HeuristicHazard' {}) - corba:raise(#'CosTransactions_HeuristicCommit'{}) - - -commit(State) -> - - %%% Do application specific actions here %%% - - %%-- Reply: -- - %% If able to commit successfully - {reply, ok, State} - %% .. or (for example): - {stop, normal, ok, State}. - - %% If the prepare operation never been invoked: - corba:raise(#'CosTransactions_NotPrepared'{}) - - %% If Heuristic Decision. Raise exception: - corba:raise(#'CosTransactions_HeuristicMixed' {}) - corba:raise(#'CosTransactions_HeuristicHazard' {}) - corba:raise(#'CosTransactions_HeuristicRollback'{}) - - -commit_one_phase(State) -> - - %%% Do application specific actions here %%% - - %%-- Reply: -- - %% If able to commit successfully - {reply, ok, State} - %% .. or (for example): - {stop, normal, ok, State}. - - %% If fails. Raise exception: - corba:raise(#'CosTransactions_HeuristicHazard' {}) - - %% If able to rollback successfully - corba:raise(#'CosTransactions_TransactionRolledBack' {}) - - -forget(State) -> - - %%% Do application specific actions here %%% - - %%-- Reply: -- - {reply, ok, State}. - %% .. or (for example): - {stop, normal, ok, State}. - - - -%%%%%% If the Resource is also supposed to be a %%%%%% -%%%%%% SubtransactionAwareResource implement these. %%%%%% - -%%- Inherit from CosTransactions::SubtransactionAwareResource -commit_subtransaction(State, Parent) -> - %%% Do application specific actions here %%% - - %%-- Reply: -- - {reply, ok, State}. - %% .. or (for example): - {stop, normal, ok, State}. - -rollback_subtransaction(State) -> - %%% Do application specific actions here %%% - - %%-- Reply: -- - {reply, ok, State}. - %% .. or (for example): - {stop, normal, ok, State}. - -%%--------------- END OF MODULE ------------------------------ - -
-
- diff --git a/lib/cosTransactions/doc/src/cosTransactions.xml b/lib/cosTransactions/doc/src/cosTransactions.xml deleted file mode 100644 index 772baaf18a..0000000000 --- a/lib/cosTransactions/doc/src/cosTransactions.xml +++ /dev/null @@ -1,142 +0,0 @@ - - - - -
- - 1999 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - cosTransactions - Niclas Eklund - Niclas Eklund - - Niclas Eklund - - 1999-04-23 - PA1 -
- cosTransactions - The main module of the cosTransactions application. - -

To get access to the record definitions for the structures use:

--include_lib("cosTransactions/include/CosTransactions.hrl").

-

This module contains the functions for starting and stopping the application. - If the application is started using application:start(cosTransactions) the - default configuration is used (see listing below). The Factory reference is stored using the CosNaming Service - under the id "oe_cosTransactionsFac_IPNo".

-

The following application configuration parameters exist:

- - maxRetries - default is 40 times, i.e., if a transaction participant is unreachable - the application will retry to contact it N times. Reaching the maximum is considered to be a disaster. - comFailWait - default is 5000 milliseconds, i.e., before the application - retries to contact unreachable transaction participants the application wait Time milliseconds. - -
- - - start() -> Return - Start the cosTransactions application - - Return = ok | {error, Reason} - - -

This operation starts the cosTransactions application.

-
-
- - stop() -> Return - Stop the cosTransactions application - - Return = ok | {error, Reason} - - -

This operation stops the cosTransactions application.

-
-
- - start_factory() -> TransactionFactory - Start a Transaction Factory - - TransactionFactory = #objref - - -

This operation creates a Transaction Factory. - The Factory is used to create a new top-level transaction using default options (see listing below).

-
-
- - start_factory(FacDef) -> TransactionFactory - Start a Transaction Factorywith given options - - FacDef = [Options], see Option listing below. - TransactionFactory = #objref - - -

This operation creates a Transaction Factory. - The Factory is used to create a new top-level transaction.

-

The FacDef list must be a list of {Item, Value} tuples, - where the following values are allowed:

- - {hash_max, HashValue} - - This value denotes the upper bound of the hash value the - Coordinator uses. - Default is 1013. HashValue must be an integer. - {allow_subtr, Boolean} - - If set to true it is possible to create subtransactions. - Default is true. - {typecheck, Boolean} - - If set to to true all transaction operation's arguments will be type-checked. - Default is true. - {tty, Boolean} - - Enables or disables error printouts to the tty. - If Flag is false, all text that the error logger would have sent to the terminal is discarded. - If Flag is true, error messages are sent to the terminal screen. - {logfile, FileName} - - This function makes it possible to store all system information in FileName (string()). - It can be used in combination with the tty(false) item in to have a silent system, - where all system information are logged to a file. - As default no logfile is used. - {maxRetries, Integer} - - default is 40 times, i.e., if a transaction participant is unreachable the application will - retry to contact it N times. Reaching the maximum is considered to be a disaster. - This option overrides the application configuration parameter. - {comFailWait, Integer} - - default is 5000 milliseconds, i.e., before the application retries to contact unreachable - transaction participants the application wait Time milliseconds. - This option overrides the application configuration parameter. - -
-
- - stop_factory(TransactionFactory) -> Reply - Terminate the target object - - TransactionFactory = #objref - Reply = ok | {'EXCEPTION', E} - - -

This operation stop the target transaction factory.

-
-
-
- -
- diff --git a/lib/cosTransactions/doc/src/notes.xml b/lib/cosTransactions/doc/src/notes.xml deleted file mode 100644 index 2401c04c3f..0000000000 --- a/lib/cosTransactions/doc/src/notes.xml +++ /dev/null @@ -1,407 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosTransactions Release Notes - Niclas Eklund - Niclas Eklund - - - - 99-04-14 - A - notes.xml -
- -
cosTransactions 1.3.3 - -
Fixed Bugs and Malfunctions - - -

Removed all old unused files in the documentation. -

-

- Own Id: OTP-14475 Aux Id: ERL-409, PR-1493

-
-
-
- -
- -
cosTransactions 1.3.2 - -
Improvements and New Features - - -

- Internal changes

-

- Own Id: OTP-13551

-
-
-
- -
- -
cosTransactions 1.3.1 - -
Improvements and New Features - - -

Suppress Dialyzer warnings.

-

- Own Id: OTP-12862

-
-
-
- -
- -
cosTransactions 1.3 - -
Improvements and New Features - - -

Remove the usage of erlang:now() from all Corba - applications and use the new rand module instead of - random.

-

- Own Id: OTP-12687

-
-
-
- -
- -
cosTransactions 1.2.14 - -
Improvements and New Features - - -

The default encoding of Erlang files has been changed - from ISO-8859-1 to UTF-8.

The encoding of XML - files has also been changed to UTF-8.

-

- Own Id: OTP-10907

-
-
-
- -
- -
cosTransactions 1.2.13 - -
Improvements and New Features - - -

- Misc build updates

-

- Own Id: OTP-10784

-
-
-
- -
- -
cosTransactions 1.2.12 - -
Improvements and New Features - - -

Erlang/OTP can now be built using parallel make if you - limit the number of jobs, for instance using 'make - -j6' or 'make -j10'. 'make -j' does not - work at the moment because of some missing - dependencies.

-

- Own Id: OTP-9451

-
-
-
- -
- -
- cosTransactions 1.2.11 -
- Improvements and New Features - - -

- Removed superfluous usage of shy in the documentation since it can cause problem if - a buggy tool is used.

-

- Own Id: OTP-9319 Aux Id:

-
-
-
-
- -
- cosTransactions 1.2.10 -
- Improvements and New Features - - -

- Test suites published.

-

- Own Id: OTP-8543 Aux Id:

-
-
-
-
- Fixed Bugs and Malfunctions - - -

Added missing trailing bracket to define in hrl-file.

-

Own id: OTP-8489 Aux Id:

-
-
-
-
- -
- cosTransactions 1.2.9 - -
- Fixed Bugs and Malfunctions - - -

The documentation EIX file was not generated.

-

Own id: OTP-8355 Aux Id:

-
-
-
-
- -
- cosTransactions 1.2.8 - -
- Improvements and New Features - - -

- The documentation is now built with open source tools (xsltproc and fop) - that exists on most platforms. One visible change is that the frames are removed.

-

- Own Id: OTP-8201 Aux Id:

-
-
-
-
- -
- cosTransactions 1.2.7 - -
- Improvements and New Features - - -

Obsolete guards, e.g. record vs is_record, has been changed - to avoid compiler warnings.

-

Own id: OTP-7987

-
-
-
-
- -
- cosTransactions 1.2.6 - -
- Improvements and New Features - - -

Updated file headers.

-

Own id: OTP-7837

-
-
-
-
- -
- cosTransactions 1.2.5 - -
- Improvements and New Features - - -

Documentation source included in open source releases.

-

Own id: OTP-7595

-
-
-
-
- -
- cosTransactions 1.2.4 - -
- Improvements and New Features - - -

Updated file headers.

-

Own id: OTP-7011

-
-
-
-
- -
- cosTransactions 1.2.3 - -
- Improvements and New Features - - -

The documentation source has been converted from SGML to XML.

-

Own id: OTP-6754 Aux Id:

-
-
-
-
- -
- cosTransactions 1.2.2 - -
- Improvements and New Features - - -

Minor Makefile changes.

-

Own id: OTP-6701 Aux Id:

-
-
-
-
- -
- cosTransactions 1.2.1 - -
- Improvements and New Features - - -

Removed some unused code.

-

Own id: OTP-6527 Aux Id:

-
-
-
-
- -
- cosTransactions 1.2 - -
- Improvements and New Features - - -

The stub/skeleton-files generated by IC have been improved, - i.e., depending on the IDL-files, reduced the size of the - erl- and beam-files and decreased dependencies off Orber's - Interface Repository. It is necessary to re-compile all IDL-files - and use COS-applications, including Orber, compiled with - IC-4.2.

-

Own id: OTP-4576

-
-
-
-
- -
- cosTransactions 1.1.2 - -
- Improvements and New Features - - -

To avoid un-necessary Heuristic decisions cosTransactions now - recognize more systems exceptions.

-

Own Id: OTP-4485

-
-
-
-
- -
- cosTransactions 1.1.1.1 - -
- Improvements and New Features - - -

Updated internal documentation.

-
-
-
-
- -
- cosTransactions 1.1.1 - -
- Improvements and New Features - - -

cosTransactions is now able to handle upgrade properly.

-

Own Id: -

-
- -

The cosTransactions factory now accepts maxRetries and - comFailWait options, which overrides the configuration parameters.

-

Own Id: -

-
-
-
- -
- Incompatibilities - - -

The configuration parameters comm_failure_wait and max_retries - changed to maxRetries and comFailWait. The default value for - maxRetries have been raised from 20 to 40.

-

Own Id: -

-
-
-
-
- -
- cosTransactions 1.1 - -
- Improvements and New Features - - -

First release of the cosTransactions application.

-

Own Id: OTP-1741

-
-
-
-
-
- diff --git a/lib/cosTransactions/doc/src/part.xml b/lib/cosTransactions/doc/src/part.xml deleted file mode 100644 index 6777d7d979..0000000000 --- a/lib/cosTransactions/doc/src/part.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosTransactions User's Guide - Niclas Eklund - - 1999-04-20 - 2.2 -
- -

The cosTransactions application is an Erlang implementation - of the OMG CORBA Transaction Service.

-
- - - - - -
- diff --git a/lib/cosTransactions/doc/src/ref_man.xml b/lib/cosTransactions/doc/src/ref_man.xml deleted file mode 100644 index 9d296967b3..0000000000 --- a/lib/cosTransactions/doc/src/ref_man.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - cosTransactions Reference Manual - Niclas Eklund - - 1999-04-14 - 2.0 -
- -

The cosTransactions application is an Erlang implementation - of the OMG CORBA Transaction Service.

-
- - - - - - - - -
- diff --git a/lib/cosTransactions/ebin/.gitignore b/lib/cosTransactions/ebin/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosTransactions/examples/Makefile b/lib/cosTransactions/examples/Makefile deleted file mode 100644 index 57a51f5932..0000000000 --- a/lib/cosTransactions/examples/Makefile +++ /dev/null @@ -1,158 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk - -EBIN= ../ebin - -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSTRANSACTIONS_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/cosTransactions-$(VSN) - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- - -INETRC_EXAMPLE = \ -# inetrc - -IDL_FILES = \ -# hotel.idl \ -# travelAgency.idl - -GEN_ERL_MODULES = \ -# oe_travelAgency \ -# travelAgency_book \ - -MODULES= \ -# travelAgency_book_impl \ - -GEN_HRL_FILES = \ -# oe_travelAgency.hrl \ -# travelAgency_book.hrl - -HRL_FILES= - -ERL_FILES= $(MODULES:%=%.erl) - -JAVA_CLASSES = \ -# HotelResource - -JAVA_FILES= $(JAVA_CLASSES:%=%.java) -CLASS_FILES= $(JAVA_CLASSES:%=%.class) - -TARGET_FILES = \ - $(GEN_ERL_MODULES:%=$(EBIN)/%.$(EMULATOR)) \ - $(MODULES:%=$(EBIN)/%.$(EMULATOR)) - - -ifeq ($(findstring sparc-sun-solaris2, $(TARGET)),sparc-sun-solaris2) - JAVA_TARGET=java -endif - -# ---------------------------------------------------- -# PROGRAMS -# ---------------------------------------------------- -JAVA_IDL = idl -LOCAL_CLASSPATH = $(ERL_TOP)/lib/cosTransactions/priv:$(ERL_TOP)/lib/cosTransactions/examples/java_output:$(ERL_TOP)/lib/cosTransactions/src:$(ERL_TOP)/lib/cosTransactions/examples:$(ERL_TOP)/lib/cosTransactions/examples/java_output/hotel - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa /clearcase/otp/libraries/cosTransactions/ebin -pa /clearcase/otp/libraries/ic/ebin -# includes from other directories than ../include . -ERL_COMPILE_FLAGS += \ - $(ERL_IDL_FLAGS) \ - -pa /clearcase/otp/libraries/cosTransactions -I/clearcase/otp/libraries/cosTransactions -YRL_FLAGS = - -JAVA_OPTIONS = -classpath ../priv:/opt/local/pgm/OrbixWeb2.0.1 - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -tests debug opt: $(TARGET_FILES) $(JAVA_TARGET) - -java: java_costransactions_idl java_objects -# java_hotel_idl - -clean: - rm -f $(TARGET_FILES) $(GEN_ERL_MODULES:%=%.erl) $(GEN_HRL_FILES) $(CLASS_FILES) - rm -rf java_costransactions_idl - rm -rf java_output/* - rm -f errs core *~ -# rm -rf java_hotel_idl - -docs: - -java_costransactions_idl: - $(JAVA_IDL) ../src/CosTransactions.idl - @if [ -d java_output ]; then \ - echo "compiling java classes for CosTransactions ... This will take a while!!"; \ - CLASSPATH="${CLASSPATH}:${LOCAL_CLASSPATH}"; \ - export CLASSPATH;\ - (cd java_output/CosTransactions; $(JAVA) *.java;); \ - fi - @touch java_costransactions_idl - -#java_hotel_idl: -# $(JAVA_IDL) hotel.idl -# @if [ -d java_output ]; then \ -# echo "compiling java classes for hotel ..."; \ -# CLASSPATH="${CLASSPATH}:${LOCAL_CLASSPATH}"; \ -# export CLASSPATH;\ -# (cd java_output/hotel; $(JAVA) *.java;); \ -# fi -# @touch java_hotel_idl - -#java_objects: -# @if [ -d java_output ]; then \ -# echo "compiling java example files ..."; \ -# CLASSPATH="${CLASSPATH}:${LOCAL_CLASSPATH}"; \ -# export CLASSPATH;\ -# $(JAVA) *.java; \ -# fi -# @touch java_hotel_resource - -#oe_travelAgency.erl: travelAgency.idl -# erlc $(ERL_IDL_FLAGS) travelAgency.idl - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - - -release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)/examples" - $(INSTALL_DATA) $(ERL_FILES) $(JAVA_FILES) $(IDL_FILES) "$(RELSYSDIR)/examples" - $(INSTALL_DATA) $(INETRC_EXAMPLE) "$(RELSYSDIR)/examples" - @tar cf - java_output | (cd $(RELSYSDIR); tar xf -) - -release_docs_spec: diff --git a/lib/cosTransactions/include/.gitignore b/lib/cosTransactions/include/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosTransactions/info b/lib/cosTransactions/info deleted file mode 100644 index e5d7c53ac0..0000000000 --- a/lib/cosTransactions/info +++ /dev/null @@ -1,2 +0,0 @@ -group: orb -short: Orber OMG Transaction Service diff --git a/lib/cosTransactions/priv/.gitignore b/lib/cosTransactions/priv/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/cosTransactions/src/CosTransactions.cfg b/lib/cosTransactions/src/CosTransactions.cfg deleted file mode 100644 index 05709d21cf..0000000000 --- a/lib/cosTransactions/src/CosTransactions.cfg +++ /dev/null @@ -1,15 +0,0 @@ -{this, "CosTransactions::Coordinator"}. -{this, "CosTransactions::RecoveryCoordinator"}. -{this, "CosTransactions::Terminator"}. -{this, "CosTransactions::Control"}. -{this, "CosTransactions::Resource"}. -{this, "CosTransactions::TransactionFactory"}. -{{handle_info, "CosTransactions::Terminator"}, true}. -{{handle_info, "CosTransactions::TransactionFactory"}, true}. -{this, "ETraP::Server"}. -{{handle_info, "ETraP::Server"}, true}. -{{impl, "CosTransactions::Coordinator"}, "ETraP_Server_impl"}. -{{impl, "CosTransactions::RecoveryCoordinator"}, "ETraP_Server_impl"}. -{{impl, "CosTransactions::Control"}, "ETraP_Server_impl"}. -{{impl, "CosTransactions::Resource"}, "ETraP_Server_impl"}. -{timeout,"CosTransactions::RecoveryCoordinator"}. diff --git a/lib/cosTransactions/src/CosTransactions.idl b/lib/cosTransactions/src/CosTransactions.idl deleted file mode 100644 index 11ec5cbf5b..0000000000 --- a/lib/cosTransactions/src/CosTransactions.idl +++ /dev/null @@ -1,193 +0,0 @@ -#ifndef _COSTRANSACTIONS_IDL -#define _COSTRANSACTIONS_IDL - -#pragma prefix "omg.org" - -module CosTransactions { - -// DATATYPES - enum Status { - StatusActive, - StatusMarkedRollback, - StatusPrepared, - StatusCommitted, - StatusRolledBack, - StatusUnknown, - StatusNoTransaction, - StatusPreparing, - StatusCommitting, - StatusRollingBack - }; - - enum Vote { - VoteCommit, - VoteRollback, - VoteReadOnly - }; - - // Forward references for interfaces defined later in module - interface Control; - interface Terminator; - interface Coordinator; - interface Resource; - interface RecoveryCoordinator; - interface SubtransactionAwareResource; - interface TransactionFactory; - interface TransactionalObject; - // interface Synchronization; - - // Structure definitions - struct otid_t { - long formatID; /*format identifier. 0 is OSI TP */ - long bqual_length; - sequence tid; - }; - struct TransIdentity { - Coordinator coord; - Terminator term; - otid_t otid; - }; - struct PropagationContext { - unsigned long timeout; - TransIdentity current; - sequence parents; - any implementation_specific_data; - }; - // interface Current; - - // Standard exceptions - // Defined in orber/include/corba.hrl - // exception TransactionRequired {}; - // exception TransactionRolledBack {}; - // exception InvalidTransaction {}; - - // Heuristic exceptions - exception HeuristicRollback {}; - exception HeuristicCommit {}; - exception HeuristicMixed {}; - exception HeuristicHazard {}; - - // Exception from Orb operations - exception WrongTransaction {}; - - // Other transaction-specific exceptions - exception SubtransactionsUnavailable {}; - exception NotSubtransaction {}; - exception Inactive {}; - exception NotPrepared {}; - exception NoTransaction {}; - exception InvalidControl {}; - exception Unavailable {}; - exception SynchronizationUnavailable {}; - - interface TransactionFactory { - Control create(in unsigned long time_out); - Control recreate(in PropagationContext ctx); - }; - - interface Control { - Terminator get_terminator() - raises(Unavailable); - Coordinator get_coordinator() - raises(Unavailable); - }; - - interface Terminator { - void commit(in boolean report_heuristics) - raises( HeuristicMixed, - HeuristicHazard ); - void rollback(); - }; - - interface Coordinator { - - Status get_status(); - Status get_parent_status(); - Status get_top_level_status(); - - boolean is_same_transaction(in Coordinator tc); - boolean is_related_transaction(in Coordinator tc); - boolean is_ancestor_transaction(in Coordinator tc); - boolean is_descendant_transaction(in Coordinator tc); - boolean is_top_level_transaction(); - - unsigned long hash_transaction(); - unsigned long hash_top_level_tran(); - - RecoveryCoordinator register_resource(in Resource r) - raises(Inactive); - -// void register_synchronization (in Synchronization sync) -// raises(Inactive, SynchronizationUnavailable); - - void register_subtran_aware(in SubtransactionAwareResource r) - raises(Inactive, NotSubtransaction); - - void rollback_only() - raises(Inactive); - - string get_transaction_name(); - Control create_subtransaction() - raises(SubtransactionsUnavailable, Inactive); - - PropagationContext get_txcontext () - raises(Unavailable); - }; - - - interface RecoveryCoordinator { - Status replay_completion(in Resource r) - raises(NotPrepared); - }; - - interface Resource { - Vote prepare() - raises(HeuristicMixed, - HeuristicHazard); - void rollback() - raises( HeuristicCommit, - HeuristicMixed, - HeuristicHazard ); - void commit() - raises( NotPrepared, - HeuristicRollback, - HeuristicMixed, - HeuristicHazard ); - void commit_one_phase() - raises( HeuristicHazard, - HeuristicRollback, - HeuristicMixed); - void forget(); - }; - -// interface TransactionalObject { -// }; - -// interface Synchronization : TransactionalObject { -// void before_completion(); -// void after_completion(in CosTransactions::Status status); -// }; - - interface SubtransactionAwareResource : Resource { - void commit_subtransaction(in Coordinator parent); - void rollback_subtransaction(); - }; - -}; // End of CosTransactions Module - -module ETraP { - - // interface Server - interface Server : - CosTransactions::Coordinator, CosTransactions::Resource, - CosTransactions::RecoveryCoordinator, CosTransactions::Control { - }; -// interface Server : -// CosTransactions::Coordinator, CosTransactions::Resource, -// CosTransactions::RecoveryCoordinator, CosTransactions::Control, -// CosTransactions::Synchronization { -// }; - -}; // End of ETraP Module - -#endif diff --git a/lib/cosTransactions/src/CosTransactions_Terminator_impl.erl b/lib/cosTransactions/src/CosTransactions_Terminator_impl.erl deleted file mode 100644 index d995eb64e4..0000000000 --- a/lib/cosTransactions/src/CosTransactions_Terminator_impl.erl +++ /dev/null @@ -1,363 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosTransactions_Terminator_impl.erl -%% Purpose : Support operations to commit or roll-back a transaction. -%%---------------------------------------------------------------------- - --module('CosTransactions_Terminator_impl'). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). -%% Local --include_lib("ETraP_Common.hrl"). --include_lib("CosTransactions.hrl"). - -%%--------------- IMPORTS------------------------------------- --import(etrap_logmgr, [log_safe/2, get_next/2]). - -%%--------------- EXPORTS------------------------------------- -%%-compile(export_all). --export([commit/3, rollback/2]). --export([init/1, terminate/2]). --export([handle_call/3, handle_cast/2, handle_info/2, code_change/3]). - -%%--------------- LOCAL DATA --------------------------------- -%-record(terminator, {reg_resources, rollback_only, regname, coordinator}). - -%%------------------------------------------------------------ -%% function : init, terminate -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the module ic. Used to initiate -%% and terminate a gen_server. -%%------------------------------------------------------------ - -init(State) -> - process_flag(trap_exit,true), - case catch start_object(State) of - {'EXIT', Reason} -> - %% Happens when, for example, we encounter an - %% error when reading from the log file. - {stop, Reason}; - Other -> - Other - end. - -start_object(State) -> - case catch file:read_file_info(?tr_get_terminator(State)) of - {error, enoent} -> - %% File does not exist. It's the first time. No restart. - ?debug_print("Terminator:init(~p)~n", [?tr_get_terminator(State)]), - etrap_logmgr:start(?tr_get_terminator(State)), - {ok, State, ?tr_get_timeout(State)}; - {error, Reason} -> % File exist but error occurred. - ?tr_error_msg("CosTransactions_Terminator( ~p ) Cannot open log file: ~p~n", - [?tr_get_terminator(State), Reason]), - {stop, {error, "unable_to_open_log"}}; - _ -> % File exists, perform restart. - etrap_logmgr:start(?tr_get_terminator(State)), - ?debug_print("RESTART Terminator:init(~p)~n", - [?tr_get_terminator(State)]), - do_restart(State, get_next(?tr_get_terminator(State), start), init) - end. - - -terminate(Reason, State) -> - ?debug_print("STOP ~p ~p~n", [?tr_get_terminator(State), Reason]), - case Reason of - normal -> - %% normal termination. Transaction completed. - log_safe(?tr_get_terminator(State), done), - etrap_logmgr:stop(?tr_get_terminator(State)), - file:delete(?tr_get_terminator(State)), - ok; - _ -> - ok - end. - -%%------------------------------------------------------------ -%% function : handle_call, handle_cast, handle_info, code_change -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the module ic. -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_call(_,_, State) -> - {noreply, State}. - - -handle_cast(_, State) -> - {noreply, State}. - - -handle_info(Info, State) -> - ?debug_print("Terminator:handle_info(~p)~n", [Info]), - Pid = self(), - case Info of - timeout -> - ?tr_error_msg("Object( ~p ) timeout. Rolling back.~n", - [?tr_get_terminator(State)]), - {stop, normal, State}; - {suicide, Pid} -> - {stop, normal, State}; - _-> - {noreply, State} - end. - -%%------------------------------------------------------------ -%% function : commit -%% Arguments: Self - its own object reference. -%% State - Gen-Server State -%% Heuristics - boolean; report heuristic decisions? -%% Returns : ok - equal to void -%% Effect : -%% Exception: HeuristicMixed - Highest priority -%% HeuristicHazard - Lowest priority -%%------------------------------------------------------------ - -commit(_Self, State, _Heuristics) when ?tr_is_retransmit(State) -> - ?debug_print("Terminator:commit() recalled.~n", []), - {stop, normal, ?tr_get_reportH(State), State}; -commit(Self, State, Heuristics) -> - ?debug_print("Terminator:commit() called.~n", []), - NewState = ?tr_set_reportH(State, Heuristics), - log_safe(?tr_get_terminator(NewState), {init_commit, NewState}), - transmit(Self, NewState, Heuristics). - - -transmit(Self, State, Heuristics) -> - case catch 'ETraP_Common':try_timeout(?tr_get_alarm(State)) of - false -> -% catch 'ETraP_Server':before_completion(?tr_get_etrap(State)), - case catch 'CosTransactions_Resource':prepare(?tr_get_etrap(State)) of - 'VoteCommit' -> - evaluate_answer(Self, State, Heuristics, - 'ETraP_Common':try_timeout(?tr_get_alarm(State))); - 'VoteRollback' -> - {stop, normal, - {'EXCEPTION', - #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - State}; - 'VoteReadOnly' -> - {stop, normal, ok, State}; - {'EXCEPTION', E} when is_record(E,'CosTransactions_HeuristicMixed'), - Heuristics==true-> - catch 'ETraP_Server':forget(?tr_get_etrap(State)), - {stop, normal, {'EXCEPTION', E}, State}; - {'EXCEPTION', E} when is_record(E,'CosTransactions_HeuristicHazard'), - Heuristics==true-> - catch 'ETraP_Server':forget(?tr_get_etrap(State)), - {stop, normal, {'EXCEPTION', E}, State}; - {'EXCEPTION', E} when is_record(E,'CosTransactions_HeuristicMixed') -> - catch 'ETraP_Server':forget(?tr_get_etrap(State)), - {stop, normal, - {'EXCEPTION',#'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - State}; - {'EXCEPTION', E} when is_record(E,'CosTransactions_HeuristicHazard') -> - catch 'ETraP_Server':forget(?tr_get_etrap(State)), - {stop, normal, - {'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - State}; - Other -> - ?tr_error_msg("Coordinator:prepare( ~p ) failed. REASON ~p~n", - [?tr_get_etrap(State), Other]), - {stop, normal, - {'EXCEPTION', - #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - State} - end; - _ -> - %% Timeout, rollback. - log_safe(?tr_get_terminator(State), rolled_back), - catch 'ETraP_Server':rollback(?tr_get_etrap(State)), -% catch 'ETraP_Server':after_completion(?tr_get_etrap(State), -% 'StatusRolledBack'), - {stop, normal, - {'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - State} - end. - -evaluate_answer(Self, State, Heuristics, false) -> - evaluate_answer(Self, State, Heuristics, commit); -evaluate_answer(Self, State, Heuristics, true) -> - evaluate_answer(Self, State, Heuristics, rollback); -evaluate_answer(_Self, State, Heuristics, Vote) -> - case catch 'ETraP_Common':send_stubborn('ETraP_Server', Vote, - ?tr_get_etrap(State), - ?tr_get_maxR(State), - ?tr_get_maxW(State)) of - ok -> - ?eval_debug_fun({_Self, commit_ok1}, State), - log_safe(?tr_get_terminator(State), committed), - ?eval_debug_fun({_Self, commit_ok2}, State), -% catch 'ETraP_Server':after_completion(?tr_get_etrap(State), -% 'StatusCommitted'), - {stop, normal, ok, State}; - {'EXCEPTION', E} when Heuristics == true andalso - is_record(E,'CosTransactions_HeuristicMixed') -> - log_safe(?tr_get_terminator(State), {heuristic, State, E}), - ?eval_debug_fun({_Self, commit_heuristic1}, State), - catch 'ETraP_Server':forget(?tr_get_etrap(State)), -% catch 'ETraP_Server':after_completion(?tr_get_etrap(State), -% 'StatusRolledBack'), - {stop, normal, {'EXCEPTION', E}, State}; - {'EXCEPTION', E} when Heuristics == true andalso - is_record(E, 'CosTransactions_HeuristicHazard') -> - log_safe(?tr_get_terminator(State), {heuristic, State, E}), - catch 'ETraP_Server':forget(?tr_get_etrap(State)), -% catch 'ETraP_Server':after_completion(?tr_get_etrap(State), -% 'StatusRolledBack'), - {stop, normal, {'EXCEPTION', E}, State}; - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') -> - log_safe(?tr_get_terminator(State), rolled_back), - {stop, normal, {'EXCEPTION', ?tr_hazard}, State}; - {'EXCEPTION', E} when is_record(E, 'TRANSACTION_ROLLEDBACK') -> - log_safe(?tr_get_terminator(State), rolled_back), -% catch 'ETraP_Server':after_completion(?tr_get_etrap(State), -% 'StatusRolledBack'), - {stop, normal, {'EXCEPTION', E}, State}; - {'EXCEPTION', E} when is_record(E, 'CosTransactions_HeuristicCommit') -> - catch 'ETraP_Server':forget(?tr_get_etrap(State)), -% catch 'ETraP_Server':after_completion(?tr_get_etrap(State), -% 'StatusRolledBack'), - {stop, normal, ok, State}; - {'EXCEPTION', E} when is_record(E, 'CosTransactions_HeuristicRollback') -> - catch 'ETraP_Server':forget(?tr_get_etrap(State)), -% catch 'ETraP_Server':after_completion(?tr_get_etrap(State), -% 'StatusCommitted'), - {stop, normal, - {'EXCEPTION', - #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - State}; - _Other when Heuristics == true -> - log_safe(?tr_get_terminator(State), rolled_back), -% catch 'ETraP_Server':after_completion(?tr_get_etrap(State), -% 'StatusRolledBack'), - {stop, normal, {'EXCEPTION', ?tr_hazard}, State}; - _Other -> - log_safe(?tr_get_terminator(State), rolled_back), -% catch 'ETraP_Server':after_completion(?tr_get_etrap(State), -% 'StatusRolledBack'), - {stop, normal, ok, State} - end. - -%%-----------------------------------------------------------% -%% function : rollback -%% Arguments: Self - its own object reference. -%% State - Gen-Server State -%% Returns : ok - equal to void -%% Effect : -%%------------------------------------------------------------ - -rollback(_Self, State) -> - ?debug_print("Terminator:rollback() called.~n", []), - log_safe(?tr_get_terminator(State), rolled_back), - catch 'ETraP_Server':rollback(?tr_get_etrap(State)), - {stop, normal, ok, State}. - -%%-----------------------------------------------------------% -%% function : do_restart -%% Arguments: State - server context -%% Returns : -%% Effect : -%%------------------------------------------------------------ - -%% No data in file. Commit never initiated so we rollback (presumed rollback. -do_restart(State, eof, init) -> - log_safe(?tr_get_terminator(State), rolled_back), - catch 'ETraP_Server':rollback(?tr_get_etrap(State)), -% catch 'ETraP_Server':after_completion(?tr_get_etrap(State), 'StatusRolledBack'), - self() ! {suicide, self()}, - {ok, State}; - -do_restart(State, {error, Reason}, _) -> - ?tr_error_msg("CosTransactions_Terminator (~p) failed. Cannot read log file: ~p~n", - [?tr_get_terminator(State), Reason]), - {stop, Reason}; -do_restart(State, eof, Phase) -> - ?debug_print("Terminator:do_restart(~p)~n", [Phase]), - case Phase of - committed -> - {ok, ?tr_set_reportH(State, ok)}; - rolled_back -> - self() ! {suicide, self()}, - {ok, State}; - init_commit -> - case catch corba_object:non_existent(?tr_get_etrap(State)) of - true -> - self() ! {suicide, self()}, - {ok, State}; - _-> - case transmit(false, State, ?tr_get_reportH(State)) of - {stop, normal, ok, NewState} -> - {ok, NewState}; - {stop, normal, - {'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - NewState} -> - self() ! {suicide, self()}, - {ok, NewState}; - {stop, normal, {'EXCEPTION', Exc}, NewState} -> - if - ?tr_dont_reportH(State) -> - self() ! {suicide, self()}, - {ok, NewState}; - true -> - {ok, ?tr_set_reportH(NewState, Exc)} - end - end - end; - {heuristic, Exc} -> - catch 'ETraP_Server':forget(?tr_get_etrap(State)), -% catch 'ETraP_Server':after_completion(?tr_get_etrap(State), -% 'StatusRolledBack'), - if - ?tr_dont_reportH(State) -> - self() ! {suicide, self()}, - {ok, State}; - true -> - {ok, ?tr_set_reportH(State, {'EXCEPTION',Exc})} - end - end; -%% All done. -do_restart(State, {done, _Cursor}, _Phase) -> - ?debug_print("Terminator:do_restart(~p)~n", [_Phase]), - self() ! {suicide, self()}, - {ok, State}; -do_restart(State, {rolled_back, Cursor}, _Phase) -> - ?debug_print("Terminator:do_restart(~p)~n", [_Phase]), - do_restart(State, get_next(?tr_get_terminator(State), Cursor), rolled_back); -do_restart(State, {committed, Cursor}, _Phase) -> - ?debug_print("Terminator:do_restart(~p)~n", [_Phase]), - do_restart(State, get_next(?tr_get_terminator(State), Cursor), committed); -do_restart(State, {{heuristic, SavedState, Exc}, Cursor}, _Phase) -> - ?debug_print("Terminator:do_restart(~p)~n", [_Phase]), - do_restart(SavedState, get_next(?tr_get_terminator(State), Cursor), - {heuristic, Exc}); -do_restart(State, {{init_commit, SavedState}, Cursor}, _) -> - ?debug_print("Terminator:do_restart(~p)~n", [init_commit]), - do_restart(SavedState, get_next(?tr_get_terminator(State), Cursor), init_commit). - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosTransactions/src/CosTransactions_TransactionFactory_impl.erl b/lib/cosTransactions/src/CosTransactions_TransactionFactory_impl.erl deleted file mode 100644 index e24bcb9a04..0000000000 --- a/lib/cosTransactions/src/CosTransactions_TransactionFactory_impl.erl +++ /dev/null @@ -1,180 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : CosTransactions_TransactionFactory_impl.erl -%% Purpose : Is provided to allow the transaction originator to begin -%% a transaction. -%%---------------------------------------------------------------------- - --module('CosTransactions_TransactionFactory_impl'). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). - -%% Local --include_lib("ETraP_Common.hrl"). --include_lib("CosTransactions.hrl"). -%%--------------- IMPORTS------------------------------------- --import('ETraP_Common', [get_option/3]). - -%%--------------- EXPORTS------------------------------------- --export([create/3, recreate/3, init/1, terminate/2]). --export([handle_call/3, handle_cast/2, handle_info/2, code_change/3]). - -%%--------------- LOCAL DATA --------------------------------- --record(factory, {hashMax, subtrOK, typeCheck, maxRetries, comFailWait}). - -%%--------------- LOCAL DEFINITIONS -------------------------- - -%%------------------------------------------------------------ -%% function : init -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the module ic. Used to initiate -%% a gen_server. -%%------------------------------------------------------------ - -init(Options) when is_list(Options) -> - ?debug_print("Factory:init(~p)~n", [Options]), - process_flag(trap_exit,true), - DefaultValues = [{maxRetries, ?tr_max_retries}, - {comFailWait, ?tr_comm_failure_wait}|?tr_FAC_DEF], - Hash = get_option(hash_max, Options, DefaultValues), - SubtrOK = get_option(allow_subtr, Options, DefaultValues), - TypeCheck = get_option(typecheck, Options, DefaultValues), - TTY = get_option(tty, Options, DefaultValues), - LogFile = get_option(logfile, Options, DefaultValues), - MaxRetries = get_option(maxRetries, Options, DefaultValues), - ComFailWait = get_option(comFailWait, Options, DefaultValues), - error_logger:tty(TTY), - case LogFile of - false -> - ok; - _-> - error_logger:logfile({open, LogFile}) - end, - {ok, #factory{typeCheck = TypeCheck, hashMax = Hash, subtrOK = SubtrOK, - maxRetries = MaxRetries, comFailWait = ComFailWait}}; - -init(Options) -> - ?tr_error_msg("TransactionFactory~nBad argument: ~p~n", [Options]), - corba:raise(?tr_badparam). - - -%%------------------------------------------------------------ -%% function : terminate -%% Arguments: -%% Returns : -%% Effect : Function demanded by the module ic. Used to -%% terminate a gen_server. -%%------------------------------------------------------------ - -terminate(_Reason, _State) -> - ?debug_print("Factory:terminate(~p)~n", [_Reason]), - ok. - -%%------------------------------------------------------------ -%% function : handle_call, handle_cast, handle_info, code_change -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the module ic. -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_call(_,_, State) -> - {noreply, State}. - - -handle_cast(_, State) -> - {noreply, State}. - - -handle_info({'EXIT',_From,shutdown}, State) -> - ?debug_print("Factory:handle_info(~p)~n", [shutdown]), - {stop, shutdown, State}; -handle_info(_Info, State) -> - ?debug_print("Factory:handle_info(~p)~n", [_Info]), - {noreply, State}. - -%%------------------------------------------------------------ -%% function : create -%% Arguments: TimeOut - rollback the transaction after TimeOut -%% seconds. If 0 no timeout. -%% Returns : a Control object -%% Effect : Creates a new top-level transaction. The Control -%% can be used to manage or control participation -%% in the new transaction. Used for direct context -%% management. -%%------------------------------------------------------------ - -create(_Self, State, TimeOut) when is_integer(TimeOut) -> - %% Generate objectnames. - ETraPName = 'ETraP_Common':create_name("root"), - TermName = 'ETraP_Common':create_name("term"), - EState = ?tr_create_context(ETraPName, TermName, - State#factory.typeCheck, - State#factory.hashMax, - State#factory.subtrOK, - State#factory.maxRetries, - State#factory.comFailWait), - - case TimeOut of - 0 -> - ETraP = ?tr_start_child(?SUP_ETRAP(EState)), - {reply, ETraP, State}; - _ -> - if - TimeOut > 0 -> - TimeStampSec = erlang:monotonic_time(seconds), - EState2 = ?tr_set_alarm(EState, TimeStampSec+TimeOut), - EState3 = ?tr_set_timeout(EState2, TimeOut*1000), - ETraP = ?tr_start_child(?SUP_ETRAP(EState3)), - {reply, ETraP, State}; - true -> - ?tr_error_msg("TransactionFactory:create( Integer >= 0 )~nBad argument. Not an integer.~n", []), - corba:raise(?tr_badparam) - end - end; - -create(_Self, _State, _TimeOut) -> - ?tr_error_msg("TransactionFactory:create( Integer >= 0 )~nBad argument. Not an integer.~n", []), - corba:raise(?tr_badparam). - - -%%------------------------------------------------------------ -%% function : recreate -%% Arguments: PropagationContext -%% Returns : a Control object -%% Effect : -%%------------------------------------------------------------ - --spec recreate(_, _, _) -> no_return(). -recreate(_Self, _State, #'CosTransactions_PropagationContext'{current = _C}) -> - corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_YES}). -%recreate(Self, State, #'CosTransactions_PropagationContext'{current = C}) -> -% {reply, C#'CosTransactions_TransIdentity'.coord, State}. - - -%%--------------- END OF MODULE ------------------------------ - diff --git a/lib/cosTransactions/src/ETraP_Common.erl b/lib/cosTransactions/src/ETraP_Common.erl deleted file mode 100644 index a5f2bf4831..0000000000 --- a/lib/cosTransactions/src/ETraP_Common.erl +++ /dev/null @@ -1,187 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : ETraP_Common.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module('ETraP_Common'). - -%%--------------- INCLUDES ---------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Local --include_lib("ETraP_Common.hrl"). --include_lib("CosTransactions.hrl"). - -%%--------------- EXPORTS ----------------------------------- --export([try_timeout/1, - get_option/3, - create_name/2, - create_name/1, - is_debug_compiled/0, - send_stubborn/5, - create_link/3]). - -%%--------------- DEFINITIONS OF CONSTANTS ------------------ -%%------------------------------------------------------------ -%% function : create_link -%% Arguments: Module - which Module to call -%% Env/ARgList - ordinary oe_create arguments. -%% Returns : -%% Exception: -%% Effect : Necessary since we want the supervisor to be a -%% 'simple_one_for_one'. Otherwise, using for example, -%% 'one_for_one', we have to call supervisor:delete_child -%% to remove the childs startspecification from the -%% supervisors internal state. -%%------------------------------------------------------------ -create_link(Module, Env, ArgList) -> - Module:oe_create_link(Env, ArgList). - -%%------------------------------------------------------------ -%% function : get_option -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ - -get_option(Key, OptionList, DefaultList) -> - case lists:keysearch(Key, 1, OptionList) of - {value,{Key,Value}} -> - Value; - _ -> - case lists:keysearch(Key, 1, DefaultList) of - {value,{Key,Value}} -> - Value; - _-> - {error, "Invalid option"} - end - end. -%%------------------------------------------------------------ -%% function : create_name/2 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ - -create_name(Name,Type) -> - Time = erlang:system_time(), - Unique = erlang:unique_integer([positive]), - lists:concat(['oe_',node(),'_',Type,'_',Name,'_',Time,'_',Unique]). - -%%------------------------------------------------------------ -%% function : create_name/1 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ - -create_name(Type) -> - Time = erlang:system_time(), - Unique = erlang:unique_integer([positive]), - lists:concat(['oe_',node(),'_',Type,'_',Time,'_',Unique]). - -%%------------------------------------------------------------ -%% function : try_timeout -%% Arguments: Id - name of the timeoutSrv server. -%% Returns : Boolean -%% Exception: -%% Effect : -%%------------------------------------------------------------ - -try_timeout(TimeoutAt) -> - case TimeoutAt of - infinity -> - false; - _-> - TimeSec = erlang:monotonic_time(seconds), - if - TimeSec < TimeoutAt -> - false; - true -> - true - end - end. - -%%------------------------------------------------------------ -%% function : send_stubborn -%% Arguments: M - module -%% F - function -%% A - arguments -%% MaxR - Maximum no retries -%% Wait - sleep Wait seconds before next try. -%% Returns : see effect -%% Exception: -%% Effect : Retries repeatedly until anything else besides -%% 'EXIT', 'COMM_FAILURE' or 'OBJECT_NOT_EXIST' -%%------------------------------------------------------------ - -send_stubborn(M, F, A, MaxR, Wait) when is_list(A) -> - send_stubborn(M, F, A, MaxR, Wait, 0); -send_stubborn(M, F, A, MaxR, Wait) -> - send_stubborn(M, F, [A], MaxR, Wait, 0). -send_stubborn(M, F, A, MaxR, _Wait, MaxR) -> - ?tr_error_msg("~p:~p( ~p ) failed!! Tried ~p times.~n", [M,F,A,MaxR]), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}); -send_stubborn(M, F, A, MaxR, Wait, Times) -> - ?debug_print("~p:~p(~p) # of retries: ~p~n", [M,F,A, Times]), - case catch apply(M,F,A) of - {'EXCEPTION', E} when is_record(E, 'COMM_FAILURE')-> - NewTimes = Times +1, - timer:sleep(Wait), - send_stubborn(M, F, A, MaxR, Wait, NewTimes); - {'EXCEPTION', E} when is_record(E, 'TRANSIENT')-> - NewTimes = Times +1, - timer:sleep(Wait), - send_stubborn(M, F, A, MaxR, Wait, NewTimes); - {'EXCEPTION', E} when is_record(E, 'TIMEOUT')-> - NewTimes = Times +1, - timer:sleep(Wait), - send_stubborn(M, F, A, MaxR, Wait, NewTimes); - {'EXIT', _} -> - NewTimes = Times +1, - timer:sleep(Wait), - send_stubborn(M, F, A, MaxR, Wait, NewTimes); - Other -> - ?debug_print("~p:~p(~p) Resulted in: ~p~n", [M,F,A, Other]), - Other - end. - -%%------------------------------------------------------------ -%% function : is_debug_compiled -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ - --ifdef(debug). - is_debug_compiled() -> true. --else. - is_debug_compiled() -> false. --endif. - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosTransactions/src/ETraP_Common.hrl b/lib/cosTransactions/src/ETraP_Common.hrl deleted file mode 100644 index 906e984a5b..0000000000 --- a/lib/cosTransactions/src/ETraP_Common.hrl +++ /dev/null @@ -1,341 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%--------------------------------------------------------------------- -%% File : ETraP_Common.hrl -%% Purpose : -%%--------------------------------------------------------------------- - --ifndef(ETRAP_COMMON_HRL). --define(ETRAP_COMMON_HRL, true). - -%%--------------- INCLUDES --------------------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("cosTransactions/include/CosTransactions.hrl"). - -%%-------- CONSTANTS --------------------------------------------------- -%% Timeouts --define(tr_comm_failure_wait, - case catch application:get_env(cosTransactions, comFailWait) of - {ok, _Time} when is_integer(_Time) -> - _Time; - _ -> - 5000 - end). - --define(tr_max_retries, - case catch application:get_env(cosTransactions, maxRetries) of - {ok, _Max} when is_integer(_Max) -> - _Max; - _ -> - 40 - end). - -%% Exceptions -% Heuristic --define(tr_mixed, - #'CosTransactions_HeuristicMixed' {}). --define(tr_hazard, - #'CosTransactions_HeuristicHazard' {}). --define(tr_commit, - #'CosTransactions_HeuristicCommit' {}). --define(tr_rollback, - #'CosTransactions_HeuristicRollback' {}). -%% Standard --define(tr_subunavailable, - #'CosTransactions_SubtransactionsUnavailable' {}). --define(tr_unavailable, - #'CosTransactions_Unavailable' {}). --define(tr_unprepared, - #'CosTransactions_NotPrepared' {}). --define(tr_inactive, - #'CosTransactions_Inactive' {}). --define(tr_nosync, - #'CosTransactions_SynchronizationUnavailable' {}). --define(tr_badparam, - #'BAD_PARAM'{completion_status=?COMPLETED_NO}). --define(tr_NotSubtr, - #'CosTransactions_NotSubtransaction' {}). - -%% TypeID:s --define(tr_Terminator, - 'CosTransactions_Terminator':typeID()). --define(tr_Coordinator, - 'CosTransactions_Coordinator':typeID()). --define(tr_Control, - 'CosTransactions_Control':typeID()). --define(tr_RecoveryCoordinator, - 'CosTransactions_RecoveryCoordinator':typeID()). --define(tr_SubtransactionAwareResource, - 'CosTransactions_SubtransactionAwareResource':typeID()). --define(tr_Synchronization, - 'CosTransactions_Synchronization':typeID()). --define(tr_Resource, - 'CosTransactions_Resource':typeID()). --define(tr_ETraP, - 'ETraP_Server':typeID()). --define(tr_TransactionalObject, - 'CosTransactions_TransactionalObject':typeID()). - - -%%-------- MISC -------------------------------------------------------- - --define(tr_error_msg(Txt, Arg), -error_logger:error_msg("============ CosTransactions ==============~n" - Txt - "===========================================~n", - Arg)). - - --define(tr_NIL_OBJ_REF, corba:create_nil_objref()). - --define(tr_FAC_DEF, [{hash_max, 1013}, - {allow_subtr, true}, - {typecheck, true}, - {tty, false}, - {logfile, false}]). - - -%%-------- Supervisor child-specs ------------------------------------ --define(FACTORY_NAME, oe_cosTransactionsFactory). --define(SUPERVISOR_NAME, cosTransactions_sup). --define(SUP_FLAG, {simple_one_for_one,50,10}). - --define(SUP_FAC(Env), - ['CosTransactions_TransactionFactory',Env, - [{sup_child, true}, {regname, {local, ?FACTORY_NAME}}]]). - --define(SUP_ETRAP(Env), - ['ETraP_Server', Env, - [{sup_child, true}, {persistent, true}, - {regname, {global, ?tr_get_etrap(Env)}}]]). - --define(SUP_TERMINATOR(Env), - ['CosTransactions_Terminator', Env, - [{sup_child, true}, {persistent, true}, - {regname, {global, ?tr_get_etrap(Env)}}]]). - --define(SUP_CHILD, - {"oe_child", - {'ETraP_Common',create_link, []}, - transient,100000,worker, - ['ETraP_Common', - 'ETraP_Server_impl', - 'ETraP_Server', - 'CosTransactions_Terminator_impl', - 'CosTransactions_Terminator', - 'CosTransactions_TransactionFactory_impl', - 'CosTransactions_TransactionFactory']}). - - --define(tr_start_child(SPEC), - case supervisor:start_child(?SUPERVISOR_NAME, SPEC) of - {ok, Pid, Obj} when is_pid(Pid) -> - Obj; - _Other-> - corba:raise(?tr_badparam) - end). - --define(tr_start_child_pid(SPEC), - supervisor:start_child(?SUPERVISOR_NAME, SPEC)). - --define(tr_terminate_child(Child), - supervisor:terminate_child(?SUPERVISOR_NAME, Child)). - --define(tr_delete_child(Child), - supervisor:delete_child(?SUPERVISOR_NAME, Child)). - -%%-------- DATASTRUCTURES ---------------------------------------------- -%% tr_*_* --record(context, {terminator, etrap, recCoord, alarm = infinity, - timeout = infinity, parents=[], trid, typeCheck, - sub_tr_allowed, hashMax, local, rollback=false, - reportH, maxRetries, comFailWait}). - - -%%-------- FUNS -------------------------------------------------------- --define(tr_IS_MEMBER(Obj), - fun(X) -> - case catch corba_object:is_equivalent(Obj, X) of - true -> - true; - _ -> - false - end - end). - -%% Managing conditional debug functions --define(is_debug_compiled, 'ETraP_Common':is_debug_compiled()). --define(set_debug_context(L, C), - etrap_test_lib:set_debug_context(L, C, ?FILE, ?LINE)). - - --ifdef(debug). --define(put_debug_data(Key, Data), erlang:put(Key, Data)). --define(get_debug_data(Key), erlang:get(Key)). --define(eval_debug_fun(I, E), - etrap_test_lib:eval_debug_fun(I, E, ?FILE, ?LINE)). --define(activate_debug_fun(I, F, C), - etrap_test_lib:activate_debug_fun(I, F, C, ?FILE, ?LINE)). --define(deactivate_debug_fun(I), - etrap_test_lib:deactivate_debug_fun(I, ?FILE, ?LINE)). --define(debug_print(F,A), - io:format("[LINE: ~p] "++F,[?LINE]++A)). --define(scratch_debug_fun, - etrap_test_lib:scratch_debug_fun()). --else. --define(put_debug_data(Key, Data), ok). --define(get_debug_data(Key), ok). --define(eval_debug_fun(I, E), ok). --define(activate_debug_fun(I, F, C), ok). --define(deactivate_debug_fun(I), ok). --define(debug_print(F,A), ok). --define(scratch_debug_fun, ok). --endif. - - -%%-------- CONSTRUCTORS ------------------------------------------------ - --define(tr_create_context(ETraP, Terminator, TypeCheck, HM, SubtrOK, MaxRetries, - ComFailWait), - #context{etrap = ETraP, terminator = Terminator, typeCheck = TypeCheck, - hashMax = HM, sub_tr_allowed = SubtrOK, maxRetries = MaxRetries, - comFailWait = ComFailWait}). - - -%%-------- MISC -------------------------------------------------------- --define(tr_notimeout(Context), - 'ETraP_Common':try_timeout(Context#context.alarm) == false). --define(tr_is_root(Context), Context#context.parents == []). --define(tr_dont_reportH(Context), Context#context.reportH == false). --define(tr_is_retransmit(Context), - Context#context.reportH =/= undefined, - Context#context.reportH =/= true, - Context#context.reportH =/= false). - -%%-------- SELECTORS --------------------------------------------------- - --define(tr_get_reportH(Context), - Context#context.reportH). - --define(tr_get_rollback(Context), - Context#context.rollback). - --define(tr_get_subTraOK(Context), - Context#context.sub_tr_allowed). - --define(tr_get_hashMax(Context), - Context#context.hashMax). - --define(tr_get_local(Context), - Context#context.local). - --define(tr_get_trid(Context), - Context#context.trid). - --define(tr_get_typeCheck(Context), - Context#context.typeCheck). - --define(tr_get_recCoord(Context), - Context#context.recCoord). - --define(tr_get_alarm(Context), - Context#context.alarm). - --define(tr_get_timeout(Context), - Context#context.timeout). - --define(tr_get_etrap(Context), - Context#context.etrap). - --define(tr_get_terminator(Context), - Context#context.terminator). - --define(tr_get_id(Context), - Context#context.self). - --define(tr_get_maxW(Context), - Context#context.comFailWait). - --define(tr_get_maxR(Context), - Context#context.maxRetries). - --define(tr_get_parents(Context), - Context#context.parents). - --define(tr_get_parent(Context), - lists:nth(1, Context#context.parents)). - -%%-------- MODIFIERS --------------------------------------------------- - --define(tr_set_reportH(Context, Bool), - Context#context{reportH = Bool}). - --define(tr_set_rollback(Context, Bool), - Context#context{rollback = Bool}). - --define(tr_set_subTraOK(Context, Bool), - Context#context{sub_tr_allowed = Bool}). - --define(tr_set_hashMax(Context, HM), - Context#context{hashMax = HM}). - --define(tr_reset_local(Context), - Context#context{local = undefined}). - --define(tr_set_local(Context, Local), - Context#context{local = Local}). - --define(tr_set_trid(Context, TRID), - Context#context{trid = TRID}). - --define(tr_set_typeCheck(Context, Bool), - Context#context{typeCheck = Bool}). - --define(tr_set_id(Context, ID), - Context#context{self = ID}). - --define(tr_set_parents(Context, Parents), - Context#context{parents = Parents}). - --define(tr_add_parent(Context, Parent), - Context#context{parents = [Parent] ++ Context#context.parents}). - --define(tr_set_recCoord(Context, R), - Context#context{recCoord = R}). - --define(tr_set_alarm(Context, EC), - Context#context{alarm = EC}). - --define(tr_set_timeout(Context, T), - Context#context{timeout = T}). - --define(tr_set_etrap(Context, ETraP), - Context#context{etrap = ETraP}). - --define(tr_set_terminator(Context, T), - Context#context{terminator = T}). - --endif. - -%%-------------- EOF --------------------------------------------------- - - diff --git a/lib/cosTransactions/src/ETraP_Server_impl.erl b/lib/cosTransactions/src/ETraP_Server_impl.erl deleted file mode 100644 index 5c7b5f6350..0000000000 --- a/lib/cosTransactions/src/ETraP_Server_impl.erl +++ /dev/null @@ -1,1745 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : ETraP_Server_impl.erl -%% Purpose : -%%---------------------------------------------------------------------- -%% GENERAL CODE COMMENTS: -%% ###################### -%% TypeChecking incoming arguments: -%% -------------------------------- -%% We allow the user to configure the system so that external calls -%% (not CosTransactions calls) may be typechecked or not when calling -%% for example 'replay_completion'. With typecheck the user will get -%% instant feedback. But since 'is_a' add quiet a lot extra overhead -%% if the object is located on a remote ORB. Hence, it is up to the -%% user to decide; speed vs. "safety". -%% -%% Log behavior -%% ------------ -%% Log files are created in the current directory, which is why the -%% application requires read/write rights for current directory. The -%% file name looks like: -%% "oe_nonode@nohost_subc_1429872479809947099_438" (the two last parts are -%% erlang:system_time() and erlang:unique_integer([positive])) -%% It is equal to what the object is started as, i.e., {regname, {global, X}}. -%% -%% If the application is unable to read the log it will exit and the -%% supervisor definitions (found in ETraP_Common.hrl) determines how -%% many times we will retry. If it's impossible to read the log it's -%% considered as a disaster, i.e., user intervention is needed. -%% -%% If an Object is unreachable when a Coordinator is trying to inform -%% of the true outcome of the transaction the application will retry N -%% times with T seconds wait in between. If it's still impossible to -%% reach the object it's considered as a disaster, i.e., user -%% intervention is needed. -%% -%%---------------------------------------------------------------------- - --module('ETraP_Server_impl'). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). - -%% Local --include_lib("cosTransactions/src/ETraP_Common.hrl"). --include_lib("cosTransactions/include/CosTransactions.hrl"). - - -%%--------------- IMPORTS------------------------------------- --import('ETraP_Common', [try_timeout/1]). - -%%--------------- EXPORTS------------------------------------- -%%--------------- Inherit from CosTransactions::Resource ---- --export([prepare/2, - rollback/2, - commit/2, - commit_one_phase/2, - forget/2]). - -%%--------------- Inherit from CosTransactions::Control ----- --export([get_terminator/2, - get_coordinator/2]). - -%%----- Inherit from CosTransactions::RecoveryCoordinator --- --export([replay_completion/3]). - -%%--------------- Inherit from CosTransactions::Coordinator - --export([create_subtransaction/2, - get_txcontext/2, - get_transaction_name/2, - get_parent_status/2, - get_status/2, - get_top_level_status/2, - hash_top_level_tran/2, - hash_transaction/2, - is_ancestor_transaction/3, - is_descendant_transaction/3, - is_related_transaction/3, - is_same_transaction/3, - is_top_level_transaction/2, - register_resource/3, - register_subtran_aware/3, - register_synchronization/3, - rollback_only/2]). - -%%--------- Inherit from CosTransactions::Synchronization --- -%-export([before_completion/2, -% after_completion/3]). - - -%%--------------- gen_server specific ------------------------ --export([init/1, terminate/2]). --export([handle_call/3, handle_cast/2, handle_info/2, code_change/3]). - - - -%%--------------- LOCAL DATA --------------------------------- --record(exc, - {rollback = false, - mixed = false, - hazard = false, - unprepared = false, - commit = false}). - -%%--------------- LOCAL DEFINITIONS -------------------------- - -%%--------------- MISC MACROS -------------------------------- --define(etr_log(Log, Data), etrap_logmgr:log_safe(Log, Data)). --define(etr_read(Log, Cursor), etrap_logmgr:get_next(Log, Cursor)). - --record(coord, - {status, %% Status of the transaction. - members = [], %% List of registred resources. - votedCommit = [], %% List of the ones that voted commit. - raisedHeuristic = [], %% The members which raised an Heur. exc. - subAw = [], %% Resorces which want to be informed of outcome. - sync = [], - exc = void, - self, - etsR}). - -%% Selectors --define(etr_get_status(L), L#coord.status). --define(etr_get_members(L), lists:reverse(L#coord.members)). --define(etr_get_vc(L), lists:reverse(L#coord.votedCommit)). --define(etr_get_raisedH(L), lists:reverse(L#coord.raisedHeuristic)). --define(etr_get_exc(L), L#coord.exc). --define(etr_get_subAw(L), lists:reverse(L#coord.subAw)). --define(etr_get_sync(L), lists:reverse(L#coord.sync)). --define(etr_get_self(L), L#coord.self). --define(etr_get_etsR(L), L#coord.etsR). --define(etr_get_init(Env), #coord{}). --define(etr_get_exc_init(), #exc{}). -%% Modifiers --define(etr_set_status(L, D), L#coord{status = D}). --define(etr_set_members(L, D), L#coord{members = D}). --define(etr_add_member(L, D), L#coord{members = [D|L#coord.members]}). --define(etr_set_vc(L, D), L#coord{votedCommit = D}). --define(etr_add_vc(L, D), L#coord{votedCommit = [D|L#coord.votedCommit]}). --define(etr_remove_vc(L, D), L#coord{votedCommit = - lists:delete(D, ?etr_get_vc(L))}). --define(etr_set_raisedH(L, D), L#coord{raisedHeuristic = [D]}). --define(etr_add_raisedH(L, D), L#coord{raisedHeuristic = - [D|L#coord.raisedHeuristic]}). --define(etr_remove_raisedH(L, D), L#coord{raisedHeuristic = - lists:delete(D, ?etr_get_raisedH(L))}). --define(etr_set_exc(L, D), L#coord{exc = D}). --define(etr_set_subAw(L, D), L#coord{subAw = [D]}). --define(etr_add_subAw(L, D), L#coord{subAw = [D|L#coord.subAw]}). --define(etr_remove_subAw(L, D), L#coord{subAw = - lists:delete(D,?etr_get_subAw(L))}). --define(etr_set_sync(L, D), L#coord{sync = [D]}). --define(etr_add_sync(L, D), L#coord{sync = [D|L#coord.sync]}). --define(etr_remove_sync(L, D), L#coord{sync = lists:delete(D,?etr_get_sync(L))}). --define(etr_set_self(L, D), L#coord{self = D}). --define(etr_set_etsR(L, D), L#coord{etsR = D}). - - -%%------------------------------------------------------------ -%% function : init, terminate -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the module ic. -%%------------------------------------------------------------ - -init(Env) -> - process_flag(trap_exit,true), - case catch start_object(Env) of - {'EXIT', Reason} -> - %% Happens when, for example, we encounter an - %% error when reading from the log file. - {stop, Reason}; - {'EXCEPTION', E} -> - self() ! {suicide, self()}, - corba:raise(E); - Other -> - Other - end. - - - -terminate(Reason, {Env, _Local}) -> - ?debug_print("STOP ~p ~p~n", [?tr_get_etrap(Env), Reason]), - case Reason of - normal -> - %% normal termination. Transaction completed. - etrap_logmgr:stop(?tr_get_etrap(Env)), - file:delete(?tr_get_etrap(Env)), - ok; - _ -> - ?tr_error_msg("Object(~p) terminated abnormal.~n",[?tr_get_etrap(Env)]), - ok - end. - - -%%------------------------------------------------------------ -%% function : handle_call, handle_cast, handle_info, code_change -%% Arguments: -%% Returns : -%% Effect : Functions demanded by the gen_server module. -%%------------------------------------------------------------ - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -handle_call(_,_, State) -> - {noreply, State}. - -handle_cast(_, State) -> - {noreply, State}. - - -handle_info(Info, {Env, Local}) -> - ?debug_print("ETraP_Server:handle_info(~p)~n", [Info]), - Pid = self(), - case Info of - timeout -> - ?tr_error_msg("Object( ~p ) timeout. Rolling back.~n", - [?tr_get_etrap(Env)]), - {stop, normal, {Env, Local}}; - {suicide, Pid} -> - {stop, normal, {Env, Local}}; - _-> - {noreply, {Env, Local}} - end. - - -%%--------------- Inherit from CosTransactions::Control ----- -%%-----------------------------------------------------------% -%% function : get_terminator -%% Arguments: Self - its own object reference. -%% State - Gen-Server State -%% Returns : a Terminator object reference. -%% Effect : Supports operations for termination of a transaction -%%------------------------------------------------------------ - -get_terminator(Self, {Env, Local}) -> - %% Only allows the root-coordinator to export the termonator. - %% The reason for this is that only the root-coordinator is allowed - %% to initiate termination of a transaction. This is however possible - %% to change and add restictions elsewhere, i.e. to verify if the - %% commit or rollback call is ok. - case catch ?tr_get_parents(Env) of - [] -> % No parents, it's a root-coordinator. - % Create terminators environment. - TEnv = ?tr_set_etrap(Env, Self), - T = ?tr_start_child(?SUP_TERMINATOR(TEnv)), - {reply, T, {Env, Local}, ?tr_get_timeout(TEnv)}; - _ -> - corba:raise(?tr_unavailable) - end. - -%%-----------------------------------------------------------% -%% function : get_coordinator -%% Arguments: Self - its own object reference. -%% State - Gen-Server State -%% Returns : a Coordinator object reference. The OMG specification -%% states that a object reference must be returned. -%% Effect : Supports operations needed by resources to participate -%% in the transaction. -%%------------------------------------------------------------ - -get_coordinator(Self, State) -> - {reply, Self, State}. - -%%----- Inherit from CosTransactions::RecoveryCoordinator --- -%%-----------------------------------------------------------% -%% function : replay_completion -%% Arguments: -%% Returns : Status -%% Effect : Provides a hint to the Coordinator that the commit -%% or rollback operations have not been performed on -%% the resource. -%%------------------------------------------------------------ - -replay_completion(_Self, {Env, Local}, Resource) -> - type_check(?tr_get_typeCheck(Env), ?tr_Resource, - "RecoveryCoordinator:replay_completion", Resource), - case ?etr_get_status(Local) of - 'StatusActive' -> - corba:raise(?tr_unprepared); - Status -> - case lists:any(?tr_IS_MEMBER(Resource), ?etr_get_members(Local)) of - true -> - {reply, Status, {Env, Local}}; - _ -> - corba:raise(#'NO_PERMISSION'{completion_status=?COMPLETED_YES}) - end - end. - -%%--------------- Inherit from CosTransactions::Resource ---- -%%-----------------------------------------------------------% -%% function : prepare -%% Arguments: -%% Returns : a Vote -%% Effect : Is invoked to begin the two-phase-commit on the -%% resource. -%%------------------------------------------------------------ - -prepare(_Self, {Env, Local}) -> - %% Set status as prepared. No new Resources are allowed to register. - NewL = ?etr_set_status(Local, 'StatusPrepared'), - - ?eval_debug_fun({?tr_get_etrap(Env), root_delay}, Env), - - case catch send_prepare(?etr_get_members(NewL), - ?tr_get_alarm(Env)) of - readOnly -> - %% All voted ReadOnly, done. No need to log. - {stop, normal, 'VoteReadOnly', {Env, NewL}}; - %% Replace the reply above if allow synchronization -% case ?etr_get_sync(Local) of -% [] -> -% {stop, normal, 'VoteReadOnly', {Env, NewL}}; -% _ -> -% {reply, 'VoteReadOnly', {Env, NewL}} -% end; - {commit, VC} -> - %% All voted Commit. - NewL2 = ?etr_set_vc(NewL, VC), - case catch try_timeout(?tr_get_alarm(Env)) of - false -> - case ?etr_log(?tr_get_etrap(Env), {pre_vote, commit, NewL2}) of - ok -> - ?eval_debug_fun({?tr_get_etrap(Env), prepare1}, Env), - {reply, 'VoteCommit', {Env, NewL2}}; - _-> - %% Cannot log. Better to be safe than sorry; do rollback. - %% However, try to log rollback. - ?etr_log(?tr_get_etrap(Env),{pre_vote, rollback, NewL2}), - send_decision({Env, NewL2}, 'VoteRollback', rollback) - end; - _-> - ?etr_log(?tr_get_etrap(Env), - {pre_vote, rollback, NewL2}), - %% timeout, reply rollback. - send_decision({Env, NewL2}, 'VoteRollback', rollback) - end; - {rollback, VC} -> - %% Rollback vote received. - %% Send rollback to commit voters. - N2 = ?etr_set_vc(NewL, VC), - NewL2 = ?etr_set_status(N2,'StatusRolledBack'), - ?etr_log(?tr_get_etrap(Env), {pre_vote, rollback, NewL2}), - send_decision({Env, NewL2}, 'VoteRollback', rollback); - {'EXCEPTION', E, VC, Obj} -> - NewL2 = case is_heuristic(E) of - true -> - N2 = ?etr_set_vc(NewL, VC), - N3 = ?etr_set_exc(N2, E), - ?etr_set_raisedH(N3, Obj); - _-> - ?etr_set_vc(NewL, VC) - end, - ?etr_log(?tr_get_etrap(Env),{pre_vote,rollback, NewL2}), - ?eval_debug_fun({?tr_get_etrap(Env), prepare2}, Env), - send_decision({Env, NewL2}, {'EXCEPTION', E}, rollback); - {failed, VC} -> - NewL2 = ?etr_set_vc(NewL, VC), - ?etr_log(?tr_get_etrap(Env),{pre_vote, rollback, NewL2}), - send_decision({Env, NewL2}, - {'EXCEPTION', ?tr_hazard}, rollback) - end. - - -%%-----------------------------------------------------------% -%% function : rollback -%% Arguments: Self - the servers own objref. -%% {Env, Local} - the servers internal state. -%% Returns : ok -%% Effect : Rollback the transaction. If its status is -%% "StatusRolledBack", this is not the first -%% rollback call to this server. Might occur if -%% the parent coordinator just recoeverd from a crasch. -%% Exception: HeuristicCommit, HeuristicMixed, HeuristicHazard -%%------------------------------------------------------------ - -rollback(Self, {Env, Local}) -> - case ?etr_get_status(Local) of - 'StatusRolledBack' -> - case ?etr_get_exc(Local) of - void -> - {stop, normal, ok, {Env, Local}}; - %% Replace the reply above if allow synchronization - %% Rolled back successfullly earlier. -% case ?etr_get_sync(Local) of -% [] -> -% {stop, normal, ok, {Env, Local}}; -% _ -> -% {reply, ok, {Env, Local}} -% end; - E -> - %% Already rolledback with heuristic decision - corba:raise(E) - end; - 'StatusPrepared' -> - NewL = ?etr_set_status(Local, 'StatusRolledBack'), - ?eval_debug_fun({?tr_get_etrap(Env), rollback}, Env), - ?etr_log(?tr_get_etrap(Env), rollback), - ?eval_debug_fun({?tr_get_etrap(Env), rollback2}, Env), - send_decision({Env, NewL}, ok, rollback); - 'StatusActive' -> - NewL = ?etr_set_status(Local, 'StatusRolledBack'), - ?etr_log(?tr_get_etrap(Env), {rollback, NewL}), - send_info(?etr_get_members(NewL), 'CosTransactions_Resource', rollback), - notify_subtrAware(rollback, ?etr_get_subAw(NewL), Self), - {stop, normal, ok, {Env, NewL}} -%% Replace the reply above if allow synchronization -% case ?etr_get_sync(Local) of -% [] -> -% {stop, normal, ok, {NewEnv, NewL}}; -% _ -> -% {reply, ok, {NewEnv, NewL}} -% end; - end. - - -%%-----------------------------------------------------------% -%% function : commit -%% Arguments: Self - the servers own objref. -%% {Env, Local} - the servers internal state. -%% Returns : ok -%% Effect : Commit the transaction. -%% Exception: HeuristicRollback, HeuristicMixed, HeuristicHazard, -%% NotPrepared -%%------------------------------------------------------------ - -commit(_Self, {Env, Local}) -> - case ?etr_get_status(Local) of - 'StatusPrepared' -> - ?eval_debug_fun({?tr_get_etrap(Env), commit}, Env), - NewL = ?etr_set_status(Local, 'StatusCommitted'), - ?etr_log(?tr_get_etrap(Env),commit), - ?eval_debug_fun({?tr_get_etrap(Env), commit2}, Env), - send_decision({Env, NewL}, ok, commit); - 'StatusCommitted' -> - case ?etr_get_exc(Local) of - void -> - {stop, normal, ok, {Env, Local}}; - %% Replace the reply above if allow synchronization -% case ?etr_get_sync(Local) of -% [] -> -% {stop, normal, ok, {Env, Local}}; -% _ -> -% {reply, ok, {Env, Local}} -% end; - E-> - corba:raise(E) - end; - _ -> - corba:raise(?tr_unprepared) - end. - -%%-----------------------------------------------------------% -%% function : commit_one_phase -%% Arguments: Self - the servers own objref. -%% {Env, Local} - the servers internal state. -%% Returns : ok -%% Effect : Commit the transaction using one-phase commit. -%% Use ONLY when there is only one registered Resource. -%% Exception: HeuristicRollback, HeuristicMixed, HeuristicHazard, -%% TRANSACTION_ROLLEDBACK -%%------------------------------------------------------------ - -commit_one_phase(_Self, {Env, Local}) -> - case ?etr_get_members(Local) of - [Resource] -> - case ?etr_get_status(Local) of - 'StatusActive' -> - %% Set status as prepared. No new Resources are allowed to register. - NewL = ?etr_set_status(Local, 'StatusPrepared'), - ?eval_debug_fun({?tr_get_etrap(Env), onePC}, Env), - case try_timeout(?tr_get_alarm(Env)) of - false -> - case catch 'CosTransactions_Resource':prepare(Resource) of - 'VoteCommit' -> - case try_timeout(?tr_get_alarm(Env)) of - false -> - send_decision({Env, NewL}, ok, commit, [Resource]); - _-> - %% Timeout, rollback. - send_decision({Env, NewL}, - {'EXCEPTION', - #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - rollback, [Resource]) - end; - 'VoteRollback' -> - {stop, normal, - {'EXCEPTION', - #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - {Env, NewL}}; - 'VoteReadOnly' -> - {stop, normal, ok, {Env, NewL}}; - {'EXCEPTION', E} - when is_record(E, 'CosTransactions_HeuristicMixed') -> - {reply, {'EXCEPTION', E}, {Env, NewL}}; - {'EXCEPTION', E} - when is_record(E, 'CosTransactions_HeuristicHazard') -> - {reply, {'EXCEPTION', E}, {Env, NewL}}; - Other -> - ?tr_error_msg("Coordinator:prepare( ~p ) failed. REASON ~p~n", - [Resource, Other]), - {stop, normal, - {'EXCEPTION', - #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - {Env, NewL}} - end; - _-> - NewL2 = ?etr_set_status(NewL, 'StatusRolledBack'), - send_info(Resource, 'CosTransactions_Resource', rollback), - {stop, normal, - {'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - {Env, NewL2}} - %% Replace the reply above if allow synchronization -% case ?etr_get_sync(NewL2) of -% [] -> -% send_info(Resource, 'CosTransactions_Resource', rollback), -% {stop, normal, -% {'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, -% {Env, NewL2}}; -% _ -> -% send_info(Resource, 'CosTransactions_Resource', rollback), -% {reply, -% {'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, -% {Env, NewL2}} -% end - end; - _ -> - case evaluate_status(?etr_get_status(Local)) of - commit -> - test_exc(set_exception(?etr_get_exc_init(), - ?etr_get_exc(Local)), - commit, ok, {Env, Local}); - _-> - test_exc(set_exception(?etr_get_exc_init(), - ?etr_get_exc(Local)), - rollback, - {'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - {Env, Local}) - end - end; - _-> - {reply, {'EXCEPTION', #'NO_PERMISSION'{completion_status=?COMPLETED_NO}}, - {Env, Local}} - end. - -%%-----------------------------------------------------------% -%% function : forget -%% Arguments: Self - the servers own objref. -%% State - the servers internal state. -%% Returns : ok -%% Effect : The resource can forget all knowledge about the -%% transaction. Terminate this server. -%%------------------------------------------------------------ - -forget(_Self, {Env, Local}) -> - ?etr_log(?tr_get_etrap(Env), forget_phase), - send_forget(?etr_get_raisedH(Local), ?tr_get_etrap(Env)), - {stop, normal, ok, {Env, ?etr_set_exc(Local, void)}}. -%% Replace the reply above if allow synchronization -% case ?etr_get_sync(Local) of -% [] -> -% {stop, normal, ok, {Env, ?etr_set_exc(Local, void)}}; -% _ -> -% {reply, ok, {Env, ?etr_set_exc(Local, void)}} -% end. - -%%--------------- Inherrit from CosTransactions::Coordinator - - -%%-----------------------------------------------------------% -%% function : get_status -%% Arguments: Self - its own object reference. -%% State - Gen-Server State -%% Returns : Status -%% Effect : Returns the status of the transaction associated -%% with the target object. -%%------------------------------------------------------------ - -get_status(_Self, {Env, Local}) -> - {reply, ?etr_get_status(Local), {Env, Local}}. - - -%%-----------------------------------------------------------% -%% function : get_parent_status -%% Arguments: Self - its own object reference. -%% State - Gen-Server State -%% Returns : Status -%% Effect : Returns the status of the parent transaction -%% associated with the target object. If top-level -%% transaction equal to get_status. -%%------------------------------------------------------------ - -get_parent_status(_Self, {Env, Local}) -> - case catch ?tr_get_parents(Env) of - [] -> - {reply, ?etr_get_status(Local), {Env, Local}}; - [Parent|_] -> - case catch 'CosTransactions_Coordinator':get_status(Parent) of - {'EXCEPTION', _E} -> - corba:raise(?tr_unavailable); - {'EXIT', _} -> - corba:raise(?tr_unavailable); - Status -> - {reply, Status, {Env, Local}} - end - end. - - -%%-----------------------------------------------------------% -%% function : get_top_level_status -%% Arguments: Self - its own object reference. -%% State - Gen-Server State -%% Returns : Status -%% Effect : Returns the status of the top-level transaction -%% associated with the target object. If top-level -%% transaction equal to get_status. -%%------------------------------------------------------------ - -get_top_level_status(_Self, {Env, Local}) -> - case catch ?tr_get_parents(Env) of - [] -> - {reply, ?etr_get_status(Local), {Env, Local}}; - Ancestrors -> - case catch 'CosTransactions_Coordinator':get_status(lists:last(Ancestrors)) of - {'EXCEPTION', _E} -> - corba:raise(?tr_unavailable); - {'EXIT', _} -> - corba:raise(?tr_unavailable); - Status -> - {reply, Status, {Env, Local}} - end - end. - - -%%-----------------------------------------------------------% -%% function : is_same_transaction -%% Arguments: Self - its own object reference. -%% State - Gen-Server State -%% Coordinator object reference -%% Returns : boolean -%% Effect : -%%------------------------------------------------------------ - -is_same_transaction(Self, {Env, Local}, Coordinator) -> - type_check(?tr_get_typeCheck(Env), ?tr_Coordinator, - "Coordinator:is_same_transaction", Coordinator), - {reply, corba_object:is_equivalent(Self, Coordinator), {Env, Local}}. - -%%------------------------------------------------------------ -%% function : is_related_transaction -%% Arguments: Self - its own object reference. -%% State - Gen-Server State -%% Coordinator object reference -%% Returns : boolean -%% Effect : -%%------------------------------------------------------------ - --spec is_related_transaction(_, _, _) -> no_return(). -is_related_transaction(_Self, {_Env, _Local}, _Coordinator) -> - corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_YES}). -% type_check(?tr_get_typeCheck(Env), ?tr_Coordinator, -% "Coordinator:is_related_transaction", Coordinator), -% {reply, false, {Env, Local}}. - - -%%------------------------------------------------------------ -%% function : is_ancestor_transaction -%% Coordinator object reference -%% Returns : boolean -%% Effect : -%%------------------------------------------------------------ - --spec is_ancestor_transaction(_, _, _) -> no_return(). -is_ancestor_transaction(_Self, {_Env, _Local}, _Coordinator) -> - corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_YES}). -% type_check(?tr_get_typeCheck(Env), ?tr_Coordinator, -% "Coordinator:is_ancestor_transaction", Coordinator), -% {reply, false, {Env, Local}}. - - -%%-----------------------------------------------------------% -%% function : is_descendant_transaction -%% Arguments: Self - its own object reference. -%% State - Gen-Server State -%% Coordinator object reference -%% Returns : boolean -%% Effect : -%%------------------------------------------------------------ - -is_descendant_transaction(Self, {Env, Local}, Coordinator) -> - type_check(?tr_get_typeCheck(Env), ?tr_Coordinator, - "Coordinator:is_descendant_transaction", Coordinator), - {reply, - lists:any(?tr_IS_MEMBER(Coordinator), [Self|?tr_get_parents(Env)]), - {Env, Local}}. - -%%-----------------------------------------------------------% -%% function : is_top_level_transaction -%% Arguments: Self - its own object reference. -%% State - Gen-Server State -%% Returns : boolean -%% Effect : -%%------------------------------------------------------------ - -is_top_level_transaction(_Self, {Env, Local}) -> - case catch ?tr_get_parents(Env) of - [] -> - {reply, true, {Env, Local}}; - _ -> - {reply, false, {Env, Local}} - end. - -%%-----------------------------------------------------------% -%% function : hash_transaction -%% Arguments: Self - its own object reference. -%% State - Gen-Server State -%% Returns : hash code -%% Effect : Returns a hash code for the transaction associated -%% with the target object. -%%------------------------------------------------------------ - -hash_transaction(Self, {Env, Local}) -> - {reply, corba_object:hash(Self, ?tr_get_hashMax(Env)), {Env, Local}}. - - -%%-----------------------------------------------------------% -%% function : hash_top_level_tran -%% Arguments: Self - its own object reference. -%% State - Gen-Server State -%% Returns : hash code -%% Effect : Returns a hash code for the top-level transaction -%% associated with the target object. Equals -%% hash_transaction if it's a top-level transaction. -%%------------------------------------------------------------ - -hash_top_level_tran(Self, {Env, Local}) -> - case ?tr_get_parents(Env) of - [] -> - {reply, - corba_object:hash(Self, ?tr_get_hashMax(Env)), - {Env, Local}}; - Ancestrors -> - case catch corba_object:hash(lists:last(Ancestrors), - ?tr_get_hashMax(Env)) of - {'EXCEPTION', _E} -> - corba:raise(?tr_unavailable); - Hash -> - {reply, Hash, {Env, Local}} - end - end. - - - -%%-----------------------------------------------------------% -%% function : register_resource -%% Arguments: Self - its own object reference. -%% State - Gen-Server State -%% Resource object reference -%% Returns : RecoveryCoordinator (can be used during recovery) -%% Effect : Registers the specified resource as as participant -%% in the transaction associated with the target object. -%% Exception: Inactive - Is prepared or terminated. -%%------------------------------------------------------------ - -register_resource(Self, {Env, Local}, Resource) -> - type_check(?tr_get_typeCheck(Env), ?tr_Resource, - "Coordinator:register_resource", Resource), - case ?etr_get_status(Local) of - 'StatusActive' -> % ok to register the Resource. - NewLocal = ?etr_add_member(Local, Resource), - RecoveryCoord = corba:create_subobject_key(Self, ?tr_get_etrap(Env)), - {reply, RecoveryCoord, {Env, NewLocal}, ?tr_get_timeout(Env)}; - _-> % Not active anymore. New members not ok. - corba:raise(?tr_inactive) - end. - - - -%%-----------------------------------------------------------% -%% function : register_subtran_aware -%% Arguments: Self - its own object reference. -%% State - Gen-Server State -%% SubTransactionAwareResource object reference -%% Returns : - -%% Effect : Registers the specified object such that it -%% will be notified when the subtransaction has -%% commited or rolled back. -%%------------------------------------------------------------ - -register_subtran_aware(Self, {Env, Local}, SubTrAwareResource) -> - case ?tr_get_parents(Env) of - [] -> - corba:raise(?tr_NotSubtr); - _-> - type_check(?tr_get_typeCheck(Env), ?tr_SubtransactionAwareResource, - "Coordinator:register_subtran_aware", SubTrAwareResource), - NewL = ?etr_add_subAw(Local, SubTrAwareResource), - {reply, ok, {Env, ?etr_set_self(NewL, Self)}, - ?tr_get_timeout(Env)} - end. - -%%-----------------------------------------------------------% -%% function : register_synchronization -%% Arguments: Self - its own object reference. -%% State - Gen-Server State -%% Synchronization -%% Returns : - -%% Effect : -%%------------------------------------------------------------ - --spec register_synchronization(_, _, _) -> no_return(). -register_synchronization(_Self, {_Env, _Local}, _Synchronization) -> - corba:raise(#'CosTransactions_SynchronizationUnavailable'{}). - -%register_synchronization(Self, {Env, Local}, Synchronization) -> -% type_check(?tr_get_typeCheck(Env), ?tr_Synchronization, -% "Coordinator:register_synchronization", Synchronization), -% case ?etr_get_status(Local) of -% 'StatusActive' -> -% case catch ?tr_get_parents(Env) of -% [] -> -% {reply, ok, {Env, ?etr_add_sync(Local, Synchronization)}, -% ?tr_get_timeout(Env)}; -% [Parent|_] -> -% case catch 'ETraP_Server':register_synchronization(Parent, Self) of -% {'EXCEPTION', E} -> -% corba:raise(E); -% ok -> -% {reply, ok, {Env, ?etr_add_sync(Local, Synchronization)}, -% ?tr_get_timeout(Env)}; -% What -> -% corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_MAYBE}) -% end -% end; -% _ -> -% corba:raise(?tr_inactive) -% end. - -%%-----------------------------------------------------------% -%% function : rollback_only -%% Arguments: Self - its own object reference. -%% State - Gen-Server State -%% Returns : - -%% Effect : The transaction associated with the target object -%% is modified so that rollback IS the result. -%%------------------------------------------------------------ - -rollback_only(Self, {Env, Local}) -> - case ?etr_get_status(Local) of - 'StatusActive' -> - NewL = ?etr_set_status(Local, 'StatusRolledBack'), - NewEnv = ?tr_set_rollback(Env, true), - ?etr_log(?tr_get_etrap(Env),{rollback, NewL}), - send_info(?etr_get_members(NewL), 'CosTransactions_Resource', rollback), - notify_subtrAware(rollback, ?etr_get_subAw(NewL), Self), - {stop, normal, ok, {NewEnv, NewL}}; -%% Replace the reply above if allow synchronization -% case ?etr_get_sync(Local) of -% [] -> -% {stop, normal, ok, {NewEnv, NewL}}; -% _ -> -% {reply, ok, {NewEnv, NewL}} -% end; - _ -> - corba:raise(?tr_inactive) - end. - -%%-----------------------------------------------------------% -%% function : get_transaction_name -%% Arguments: Self - its own object reference. -%% State - Gen-Server State -%% Returns : string - which describes the transaction associated -%% with the target object. -%% Effect : Intended for debugging. -%%------------------------------------------------------------ - -get_transaction_name(_Self, {Env, Local}) -> - {reply, ?tr_get_etrap(Env), {Env, Local}}. - -%%-----------------------------------------------------------% -%% function : create_subtransaction -%% Arguments: Self - its own object reference. -%% State - Gen-Server State -%% Returns : A control object if subtransactions are allowed, -%% otherwise an exception is raised. -%% Effect : A new subtransaction is created whos parent is -%% the transaction associated with the target object. -%% Exception: SubtransactionUnavailabe - no support for nested -%% transactions. -%% Inactive - already been prepared. -%%------------------------------------------------------------ - -create_subtransaction(Self, {Env, Local}) -> - case ?etr_get_status(Local) of - 'StatusActive' -> - case ?tr_get_subTraOK(Env) of - true -> - ETraPName = 'ETraP_Common':create_name("subc"), - Tname = 'ETraP_Common':create_name("subt"), - - %% Create context for the new object. - State = ?tr_create_context(ETraPName, Tname, - ?tr_get_typeCheck(Env), - ?tr_get_hashMax(Env), - ?tr_get_subTraOK(Env), - ?tr_get_maxR(Env), - ?tr_get_maxW(Env)), - - - State2 = ?tr_add_parent(State, Self), - - State3 = ?tr_set_alarm(State2, ?tr_get_alarm(Env)), - - State4 = ?tr_set_timeout(State3, ?tr_get_timeout(Env)), - - Control = ?tr_start_child(?SUP_ETRAP(State4)), - %% Set the SubCoordinator object reference and register it as participant. - SubCoord = 'CosTransactions_Control':get_coordinator(Control), - NewLocal = ?etr_add_member(Local, SubCoord), - {reply, Control, {Env, NewLocal}, ?tr_get_timeout(Env)}; - _ -> - %% subtransactions not allowed, raise exception. - corba:raise(?tr_subunavailable) - end; - _-> - corba:raise(?tr_inactive) - end. - -%%-----------------------------------------------------------% -%% function : get_txcontext -%% Arguments: -%% Returns : PropagationContext -%% Effect : -%%------------------------------------------------------------ - --spec get_txcontext(_, _) -> no_return(). -get_txcontext(_Self, {_Env, _Local}) -> - corba:raise(#'CosTransactions_Unavailable'{}). - -%get_txcontext(Self, {Env, Local}) -> -% Otid = #'CosTransactions_otid_t'{formatID=0, -% bqual_length=0, -% tid=[corba_object:hash(Self, -% ?tr_get_hashMax(Env))]}, -% TrIDs = create_TransIdentities(?tr_get_parents(Env), Env, [], Otid), -% C=case ?tr_get_parents(Env) of -% [] -> -% #'CosTransactions_TransIdentity'{coord=Self, -% term=?tr_get_terminator(Env), -% otid=Otid}; -% _-> -% #'CosTransactions_TransIdentity'{coord=Self, -% term=?tr_NIL_OBJ_REF, -% otid=Otid} -% end, -% case ?tr_get_timeout(Env) of -% infinity -> -% #'CosTransactions_PropagationContext'{timeout=0, -% current= C, -% parents=TrIDs}; -% T -> -% #'CosTransactions_PropagationContext'{timeout=T/1000, -% current= C, -% parents=TrIDs} -% end. - -%create_TransIdentities([], _, Parents, _) -> Parents; -%create_TransIdentities([Phead|Ptail], Env, Parents, Otid) -> -% NO=Otid#'CosTransactions_TransIdentity'{otid= -% corba_object:hash(Phead, -% ?tr_get_hashMax(Env))}, -% create_TransIdentities([Phead|Ptail], Env, Parents++ -% [#'CosTransactions_TransIdentity'{coord=Phead, -% term=?tr_NIL_OBJ_REF, -% otid=NO}], -% Otid). - - -%%--------- Inherit from CosTransactions::Synchronization --- - -%%-----------------------------------------------------------% -%% function : before_completion -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ - -%before_completion(Self, {Env, Local}) -> -% send_info(?etr_get_sync(Local), -% 'CosTransactions_Synchronization', before_completion), -% {reply, ok, {Env, Local}}. - -%%-----------------------------------------------------------% -%% function : after_completion -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ - -%after_completion(Self, {Env, Local}, Status) -> -% send_info(?etr_get_sync(Local), Status, -% 'CosTransactions_Synchronization', after_completion), -% {stop, normal, ok, {Env, Local}}. - -%%--------------- IMPLEMENTATION SPECIFIC ------------------- -%%-----------------------------------------------------------% -%% function : start_object -%% Arguments: -%% Returns : EXIT, EXCEPTION, or {ok, State} -%% Effect : used by init/1 only. -%%------------------------------------------------------------ - -start_object(Env)-> - ?put_debug_data(self, Env), - Local = ?etr_get_init(Env), - LogName = ?tr_get_etrap(Env), - case catch file:read_file_info(LogName) of - {error, enoent} -> - %% File does not exist. It's the first time. No restart. - ?debug_print("ETraP_Server:init(~p)~n",[?tr_get_etrap(Env)]), - etrap_logmgr:start(LogName), - {ok, - {Env, ?etr_set_status(Local, 'StatusActive')}, - ?tr_get_timeout(Env)}; - {error, Reason} -> - %% File exist but error occurred. - ?tr_error_msg("Control (~p) Cannot open log file: ~p~n", - [LogName, Reason]), - {stop, "unable_to_open_log"}; - _ -> - %% File exists, perform restart. - etrap_logmgr:start(LogName), - ?debug_print("RESTART ~p~n", [?tr_get_etrap(Env)]), - prepare_restart({Env, ?etr_set_status(Local, 'StatusUnknown')}, - ?etr_read(?tr_get_etrap(Env), start)) - end. - - -%%-----------------------------------------------------------% -%% function : send_prepare -%% Arguments: List of registred resources. -%% Returns : ok - equal to void -%% Effect : calls send_prepare/3, which sends a prepare call -%% to resources participating in the transaction and then collect -%% their votes. send_prepare will block until -%% it recieves a reply from the resource. -%%------------------------------------------------------------ - -send_prepare(RegResources, Alarm) -> - send_prepare(RegResources, [], Alarm). - -% All voted ReadOnly. We are done. -send_prepare([], [], _) -> - readOnly; - -% All voted commit (VC) or ReadOnly. -send_prepare([], VC, Alarm) -> - case catch try_timeout(Alarm) of - false -> - {commit, VC}; - _-> - {rollback, VC} - end; - -send_prepare([Rhead|Rtail], VC, Alarm) -> - ?debug_print("send_prepare()~n",[]), - case catch 'CosTransactions_Resource':prepare(Rhead) of - 'VoteCommit' -> - case catch try_timeout(Alarm) of - false -> - _Env = ?get_debug_data(self), - ?eval_debug_fun({?tr_get_etrap(_Env), send_prepare}, _Env), - send_prepare(Rtail, VC++[Rhead], Alarm); - _-> - %% Timeout, rollback. However, the resource did vote - %% commit. Add it to the list. - send_info(Rtail, 'CosTransactions_Resource', rollback), - {rollback, VC++[Rhead]} - end; - 'VoteRollback' -> - %% Don't care about timeout since we voted rollback. - %% A rollback received. No need for more prepare-calls. - %% See OMG 10-51, Transaction Service:v1.0 - send_info(Rtail, 'CosTransactions_Resource', rollback), - {rollback, VC}; - 'VoteReadOnly' -> - case catch try_timeout(Alarm) of - false -> - send_prepare(Rtail, VC, Alarm); - _-> - %% timeout, reply rollback. - send_info(Rtail, 'CosTransactions_Resource', rollback), - {rollback, VC} - end; - {'EXCEPTION',E} when is_record(E, 'TIMEOUT') -> - ?tr_error_msg("Coordinator:prepare( ~p )~nObject unreachable.~n", - [Rhead]), - %% Since we use presumed abort we will rollback the transaction. - send_info(Rtail, 'CosTransactions_Resource', rollback), - {rollback, VC}; - {'EXCEPTION',E} when is_record(E, 'TRANSIENT') -> - ?tr_error_msg("Coordinator:prepare( ~p )~nObject unreachable.~n", - [Rhead]), - %% Since we use presumed abort we will rollback the transaction. - send_info(Rtail, 'CosTransactions_Resource', rollback), - {rollback, VC}; - {'EXCEPTION',E} when is_record(E, 'COMM_FAILURE') -> - ?tr_error_msg("Coordinator:prepare( ~p )~nObject unreachable.~n", - [Rhead]), - %% Since we use presumed abort we will rollback the transaction. - send_info(Rtail, 'CosTransactions_Resource', rollback), - {rollback, VC}; - {'EXCEPTION', E} when is_record(E, 'OBJECT_NOT_EXIST') -> - ?tr_error_msg("Coordinator:prepare( ~p )~nObject unreachable.~n", - [Rhead]), - send_info(Rtail, 'CosTransactions_Resource', rollback), - {rollback, VC}; - {'EXCEPTION', Exc} -> - ?tr_error_msg("Coordinator:prepare( ~p )~nThe Object raised exception: ~p~n", - [Rhead, Exc]), - send_info(Rtail, 'CosTransactions_Resource', rollback), - %% This can occur if a subtransaction get one or more - %% "VoteCommit" followed by a "VoteRollback". - %% The subtransaction then do a send_decision(rollback), - %% which can generate Heuristic decisions. Must rollback - %% since at least one participant voted rollback. - {'EXCEPTION', Exc, VC, Rhead}; - Other -> - ?tr_error_msg("Coordinator:prepare( ~p ) failed. REASON ~p~n", - [Rhead, Other]), - send_info(Rtail, 'CosTransactions_Resource', rollback), - {failed, VC} - end. - -%%-----------------------------------------------------------% -%% function : type_check -%% Arguments: Bool - perform typecheck? -%% ID - Type it should be. -%% Func - Name of the function (for error_msg) -%% Obj - objectrefernce to test. -%% Returns : 'ok' or raises exception. -%% Effect : -%%------------------------------------------------------------ -type_check(false, _, _, _) -> - ok; -type_check(_, ID, Func, Obj) -> - case catch corba_object:is_a(Obj,ID) of - true -> - ok; - _ -> - ?tr_error_msg("~p( ~p ) Bad argument!!~n", [Func, Obj]), - corba:raise(?tr_badparam) - end. - -%%-----------------------------------------------------------% -%% function : is_heuristic -%% Arguments: Exception -%% Returns : boolean -%% Effect : Returns true if the exception is a heuristic exc. -%%------------------------------------------------------------ - -is_heuristic(E) when is_record(E, 'CosTransactions_HeuristicMixed') -> true; -is_heuristic(E) when is_record(E, 'CosTransactions_HeuristicHazard') -> true; -is_heuristic(E) when is_record(E, 'CosTransactions_HeuristicCommit') -> true; -is_heuristic(E) when is_record(E, 'CosTransactions_HeuristicRollback') -> true; -is_heuristic(_) -> false. - -%%-----------------------------------------------------------% -%% function : exception_set -%% Arguments: Genserver state -%% Returns : -%% Effect : Used when restarting. -%%------------------------------------------------------------ - -exception_set({Env,Local}) -> - case ?etr_get_exc(Local) of - void -> - self() ! {suicide, self()}, - {ok, {Env, Local}}; - _ -> - {ok, {Env, Local}} - end. - -%%-----------------------------------------------------------% -%% function : set_exception -%% Arguments: Locally defined #exc{} -%% Heuristic mixed or hazard Exeption -%% Returns : Altered locally defined #exc{} -%% Effect : Set the correct tuple member to true. -%%------------------------------------------------------------ - -set_exception(Exc, E) when is_record(E, 'CosTransactions_HeuristicMixed') -> - Exc#exc{mixed = true}; -set_exception(Exc, E) when is_record(E, 'CosTransactions_HeuristicHazard') -> - Exc#exc{hazard = true}; -set_exception(Exc, _) -> Exc. - -%%-----------------------------------------------------------% -%% function : send_forget -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ - -send_forget([], _) -> ok; -send_forget([Rhead|Rtail], LogName) -> - ?debug_print("send_forget()~n",[]), - _Env = ?get_debug_data(self), - case catch 'CosTransactions_Resource':forget(Rhead) of - ok -> - ?eval_debug_fun({?tr_get_etrap(_Env), send_forget1}, _Env), - ?etr_log(LogName, {forgotten, Rhead}), - ?eval_debug_fun({?tr_get_etrap(_Env), send_forget2}, _Env), - send_forget(Rtail, LogName); - Other -> - ?tr_error_msg("CosTransactions_Coordinator failed sending forget to ~p~nREASON: ~p~n", - [Rhead, Other]), - ?eval_debug_fun({?tr_get_etrap(_Env), send_forget3}, _Env), - ?etr_log(LogName, {not_forgotten, Rhead}), - ?eval_debug_fun({?tr_get_etrap(_Env), send_forget4}, _Env), - send_forget(Rtail, LogName) - end. - -%%-----------------------------------------------------------% -%% function : send_decision -%% Arguments: List of registred resources which vote commit. -%% Vote - the outcome of the transaction. -%% Returns : ok - equal to void -%% Effect : Inform those who voted commit of the outcome. -%% They who voted rollback already knows the outcome. -%% They who voted ReadOnly are not affected. -%%------------------------------------------------------------ - -%%-- Adding extra parameters -send_decision({Env, Local}, Reply, Vote) -> - send_decision({Env, Local}, Reply, ?etr_get_vc(Local), Vote, #exc{}, [], 0). -send_decision({Env, Local}, Reply, Vote, VC) -> - send_decision({Env, Local}, Reply, VC, Vote, #exc{}, [], 0). -send_decision(State, no_reply, VC, Vote, Exc) -> - send_decision(State, no_reply, VC, Vote, Exc, [], 0). - -%%-- Decision sent to all members. Do not reply (used when restarting). -send_decision({Env, Local}, no_reply, [], _, #exc{mixed = true}, [], _) -> - {Env, ?etr_set_exc(Local, ?tr_mixed)}; -send_decision({Env, Local}, no_reply, [], _, #exc{hazard = true}, [], _) -> - {Env, ?etr_set_exc(Local, ?tr_hazard)}; -send_decision({Env, Local}, no_reply, [], _, _, [], _) -> - {Env, Local}; -send_decision({Env, Local}, no_reply, [], Vote, Exc, Failed, Times) -> - case ?tr_get_maxR(Env) of - Times -> - ?tr_error_msg("MAJOR ERROR, failed sending commit decision to: ~p. Tried ~p times.", [Failed,Times]), - {Env, ?etr_set_exc(Local, ?tr_hazard)}; - _-> - timer:sleep(?tr_get_maxW(Env)), - NewTimes = Times+1, - send_decision({Env, Local}, no_reply, Failed, Vote, Exc, [], NewTimes) - end; -%%-- end special cases. - -%% Decision sent to all members. Test exceptions. -send_decision({Env, Local}, Reply, [], Vote, Exc, [], _) -> - notify_subtrAware(Vote, ?etr_get_subAw(Local), ?etr_get_self(Local)), - test_exc(Exc, Vote, Reply, {Env, Local}); -%% Decision not sent to all members (one or more failed). Retry. -send_decision({Env, Local}, Reply, [], Vote, Exc, Failed, Times) -> - case ?tr_get_maxR(Env) of - Times -> - ?tr_error_msg("MAJOR ERROR, failed sending commit decision to: ~p. Tried ~p times.", [Failed,Times]), - notify_subtrAware(Vote, ?etr_get_subAw(Local), ?etr_get_self(Local)), - test_exc(Exc#exc{hazard = true}, Vote, Reply, {Env, Local}); - _-> - NewTimes = Times+1, - timer:sleep(?tr_get_maxW(Env)), - send_decision({Env, Local}, Reply, Failed, Vote, Exc, [], NewTimes) - end; - -send_decision({Env, Local}, Reply, [Rhead|Rtail], Vote, Exc, Failed, Times) -> - ?debug_print("Coordinator:send_decision(~p) Try: ~p~n",[Vote, Times]), - case catch 'CosTransactions_Resource':Vote(Rhead) of - ok -> - ?etr_log(?tr_get_etrap(Env),{sent, Rhead}), - send_decision({Env, Local}, Reply, Rtail, Vote, Exc, Failed, Times); - {'EXCEPTION', E} when Vote == commit andalso - is_record(E, 'CosTransactions_NotPrepared') -> - ?debug_print("send_decision resource unprepared~n",[]), - case catch 'CosTransactions_Resource':prepare(Rhead) of - 'VoteCommit' -> - send_decision({Env, Local}, Reply, [Rhead|Rtail], Vote, Exc, Failed, Times); - 'VoteRollback' -> - send_decision({Env, Local}, Reply, Rtail, Vote, Exc#exc{mixed = true}, Failed, Times); - {'EXCEPTION', E} -> - {SetExc, NewL, DidFail} = - evaluate_answer(E, Rhead, Vote, Exc, - ?tr_get_etrap(Env), Local), - send_decision({Env, NewL}, Reply, Rtail, Vote, SetExc, DidFail++Failed, Times) - end; - {'EXCEPTION', E} -> - {SetExc, NewL, DidFail} = - evaluate_answer(E, Rhead, Vote, Exc, ?tr_get_etrap(Env), Local), - ?tr_error_msg("Resource:~p( ~p )~nRaised Exception: ~p~n", - [Vote, Rhead, E]), - send_decision({Env, NewL}, Reply, Rtail, Vote, SetExc, DidFail++Failed, Times); - {'EXIT', _} -> - send_decision({Env, Local}, Reply, Rtail, - Vote, Exc, [Rhead|Failed], Times); - Other -> - ?tr_error_msg("Resource:~p( ~p ) failed.~nREASON: ~p~n", - [Vote, Rhead, Other]), - case catch corba_object:non_existent(Rhead) of - true when Vote == commit -> - %% Presumed rollback - send_decision({Env, Local}, Reply, Rtail, Vote, - Exc#exc{mixed = true}, Failed, Times); - true -> - %% Presumed rollback - send_decision({Env, Local}, Reply, Rtail, Vote, - Exc#exc{hazard = true}, Failed, Times); - _ -> - send_decision({Env, Local}, Reply, Rtail, - Vote, Exc, [Rhead|Failed], Times) - end - end. - -%%-----------------------------------------------------------% -%% function : notify_subtrAware, -%% Arguments: -%% Returns : -%% Effect : Invoke an operation on a list of objects. We don't -%% care about return values or exceptions. -%%------------------------------------------------------------ - -notify_subtrAware(commit, Resources, Self) -> - send_info(Resources, Self, - 'CosTransactions_SubtransactionAwareResource', - commit_subtransaction); -notify_subtrAware(_, Resources, _) -> - send_info(Resources, 'CosTransactions_SubtransactionAwareResource', - rollback_subtransaction). - -%%-----------------------------------------------------------% -%% function : send_info -%% Arguments: ObjectList - List of object refernces to call. -%% M - Module -%% F - Function -%% (Arg - required arguments) -%% Returns : ok -%% Effect : A lightweight function to be used when we don't -%% "care" about the return value. -%%------------------------------------------------------------ - -send_info([], _, _, _) -> - ok; -send_info([Rhead|Rtail], Arg, M, F) -> - ?debug_print("~p( ~p )~n",[F, Arg]), - case catch M:F(Rhead, Arg) of - {'EXIT',R} -> - ?tr_error_msg("~p:~p(~p, ~p) returned {'EXIT',~p}", [M,F,Rhead,Arg,R]); - {'EXCEPTION',E} -> - ?tr_error_msg("~p:~p(~p, ~p) returned {'EXCEPTION',~p}", [M,F,Rhead,Arg,E]); - _-> - ok - end, - send_info(Rtail, Arg, M, F). - -send_info([], _, _) -> - ok; -send_info([Rhead|Rtail], M, F) -> - ?debug_print("~p( )~n",[F]), - case catch M:F(Rhead) of - {'EXIT',R} -> - ?tr_error_msg("~p:~p(~p) returned {'EXIT',~p}", [M,F,Rhead,R]); - {'EXCEPTION',E} -> - ?tr_error_msg("~p:~p(~p) returned {'EXCEPTION',~p}", [M,F,Rhead,E]); - _-> - ok - end, - send_info(Rtail, M, F). - -%%-----------------------------------------------------------% -%% function : evaluate_answer -%% Arguments: -%% Returns : -%% Effect : Check what kind of exception we received. -%%------------------------------------------------------------ - -evaluate_answer(E, Rhead, _Vote, Exc, Log, Local) - when is_record(E, 'CosTransactions_HeuristicMixed') -> - ?etr_log(Log, {heuristic, {Rhead, E}}), - {Exc#exc{mixed = true}, ?etr_add_raisedH(Local, Rhead), []}; -evaluate_answer(E, Rhead, _Vote, Exc, Log, Local) - when is_record(E, 'CosTransactions_HeuristicHazard') -> - ?etr_log(Log, {heuristic, {Rhead, E}}), - {Exc#exc{hazard = true}, ?etr_add_raisedH(Local, Rhead), []}; -evaluate_answer(E, Rhead, Vote, Exc, Log, Local) - when is_record(E, 'CosTransactions_HeuristicCommit') -> - case Vote of - commit -> - ?etr_log(Log, {heuristic, {Rhead, E}}), - {Exc, ?etr_add_raisedH(Local, Rhead), []}; - _-> - ?etr_log(Log, {heuristic, {Rhead, ?tr_mixed}}), - {Exc#exc{mixed = true}, ?etr_add_raisedH(Local, Rhead), []} - end; -evaluate_answer(E, Rhead, Vote, Exc, Log, Local) - when is_record(E, 'CosTransactions_HeuristicRollback')-> - case Vote of - rollback -> - ?etr_log(Log, {heuristic, {Rhead, ?tr_rollback}}), - {Exc, ?etr_add_raisedH(Local, Rhead), []}; - _-> - ?etr_log(Log, {heuristic, {Rhead, ?tr_mixed}}), - {Exc#exc{mixed = true}, ?etr_add_raisedH(Local, Rhead), []} - end; -evaluate_answer(E, Rhead, Vote, Exc, Log, Local) - when Vote == commit andalso is_record(E, 'TRANSACTION_ROLLEDBACK') -> - ?etr_log(Log, {heuristic, {Rhead, ?tr_mixed}}), - {Exc#exc{mixed = true}, ?etr_add_raisedH(Local, Rhead), []}; -evaluate_answer(E, Rhead, Vote, Exc, Log, Local) when is_record(E, 'TIMEOUT') -> - ?tr_error_msg("Coordinator:~p( ~p ) Object unreachable.~nReason: ~p~n", - [Vote, Rhead, E]), - case catch corba_object:non_existent(Rhead) of - true -> - %% Since we have presumed abort, the child will - %% assume rollback if this server do not exist any more. - ?etr_log(Log, {heuristic, {Rhead, ?tr_hazard}}), - {Exc#exc{hazard = true}, Local, []}; - _ -> - {Exc, Local, [Rhead]} - end; -evaluate_answer(E, Rhead, Vote, Exc, Log, Local) when is_record(E, 'TRANSIENT') -> - ?tr_error_msg("Coordinator:~p( ~p ) Object unreachable.~nReason: ~p~n", - [Vote, Rhead, E]), - case catch corba_object:non_existent(Rhead) of - true -> - %% Since we have presumed abort, the child will - %% assume rollback if this server do not exist any more. - ?etr_log(Log, {heuristic, {Rhead, ?tr_hazard}}), - {Exc#exc{hazard = true}, Local, []}; - _ -> - {Exc, Local, [Rhead]} - end; -evaluate_answer(E, Rhead, Vote, Exc, Log, Local) when is_record(E, 'COMM_FAILURE') -> - ?tr_error_msg("Coordinator:~p( ~p ) Object unreachable.~nReason: ~p~n", - [Vote, Rhead, E]), - case catch corba_object:non_existent(Rhead) of - true -> - %% Since we have presumed abort, the child will - %% assume rollback if this server do not exist any more. - ?etr_log(Log, {heuristic, {Rhead, ?tr_hazard}}), - {Exc#exc{hazard = true}, Local, []}; - _ -> - {Exc, Local, [Rhead]} - end; -evaluate_answer(E, Rhead, Vote, Exc, Log, Local)when is_record(E, 'OBJECT_NOT_EXIST') -> - ?tr_error_msg("Coordinator:~p( ~p ) Object unreachable.~nReason: ~p~n", - [Vote, Rhead, E]), - %% Since we have presumed abort, the child will - %% assume rollback if this server do not exist any more. - ?etr_log(Log, {heuristic, {Rhead, ?tr_hazard}}), - {Exc#exc{hazard = true}, Local, []}; -evaluate_answer(Unknown, Rhead, Vote, Exc, _Log, Local)-> - ?tr_error_msg("Coordinator:~p( ~p ). Unknown reply: ~p.~n", - [Vote, Rhead, Unknown]), - {Exc, Local, []}. - - -%%-----------------------------------------------------------% -%% function : test_exc -%% Arguments: Exc - instance of #exc{} locally declared. -%% Vote - 'rollback' or 'commit' -%% Reply - If no exceptions this is the default reply. -%% State - genserver state -%% Returns : -%% Effect : Raise the correct exception or simply reply to -%% the genserver. NOTE that the testing for exceptions -%% differs if we are performing a rollback or commit. -%% Check if Mixed first; takes priority over Hazard. -%% HeuristicRollback and VoteCommit together give -%% HeuristicMixed -%% HeuristicCommit and VoteRollback together give -%% HeuristicMixed -%%------------------------------------------------------------ - -test_exc(#exc{mixed = true}, _, _, {Env, Local}) -> - {reply, {'EXCEPTION', ?tr_mixed}, {Env, ?etr_set_exc(Local, ?tr_mixed)}}; -% Left out for now to avoid dialyzer warning. -%test_exc(#exc{rollback = true}, commit, _, {Env, Local}) -> -% {reply, {'EXCEPTION', ?tr_mixed}, {Env, ?etr_set_exc(Local, ?tr_mixed)}}; -% Left out for now to avoid dialyzer warning. -%test_exc(#exc{commit = true}, rollback, _, {Env, Local}) -> -% {reply, {'EXCEPTION', ?tr_mixed}, {Env, ?etr_set_exc(Local, ?tr_mixed)}}; -test_exc(#exc{hazard = true}, _, _, {Env, Local}) -> - {reply, {'EXCEPTION', ?tr_hazard}, {Env, ?etr_set_exc(Local, ?tr_hazard)}}; -test_exc(_, _, {'EXCEPTION', E}, {Env, Local}) - when is_record(E, 'TRANSACTION_ROLLEDBACK')-> - {stop, normal, {'EXCEPTION', E}, {Env, Local}}; -%% Replace the case above if allow synchronization -%test_exc(_, _, {'EXCEPTION', E}, {Env, Local}) -% when record(E, 'TRANSACTION_ROLLEDBACK')-> -% case ?etr_get_sync(Local) of -% [] -> -% {stop, normal, {'EXCEPTION', E}, {Env, Local}}; -% _-> -% {reply, {'EXCEPTION', E}, {Env, Local}} -% end; -test_exc(_, _, {'EXCEPTION', E}, State) -> - {reply, {'EXCEPTION', E}, State}; -test_exc(_, _, Reply, {Env, Local}) -> - {stop, normal, Reply, {Env, Local}}. -%% Replace the case above if allow synchronization -%test_exc(_, _, Reply, {Env, Local}) -> -% case ?etr_get_sync(Local) of -% [] -> -% {stop, normal, Reply, {Env, Local}}; -% _ -> -% {reply, Reply, {Env, Local}} -% end. - -%%-----------------------------------------------------------% -%% function : evaluate_status -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ - -evaluate_status(Status) -> - case Status of - 'StatusCommitted' -> commit; - 'StatusCommitting' -> commit; - 'StatusMarkedRollback' -> rollback; - 'StatusRollingBack' -> rollback; - 'StatusRolledBack' -> rollback; - 'StatusActive' -> rollback; - 'StatusPrepared' -> rollback; - 'StatusUnknown' -> rollback; - 'StatusNoTransaction' -> rollback; - 'StatusPreparing' -> rollback; - _-> rollback - end. - - -%%-----------------------------------------------------------% -%% function : prepare_restart -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ - -%% The file contains no data. The coordinator crashed before -%% a prepare-call was made. Presumed rollback. -prepare_restart(State, eof) -> - ?debug_print("prepare_restart: eof, init~n",[]), - self() ! {suicide, self()}, - {ok, State}; -%% Collected all necessary votes. Do commit_restart. -prepare_restart({Env, _}, {{pre_vote, _Vote, Data}, Cursor}) -> - ?debug_print("prepare_restart: pre_vote( ~p )~n",[_Vote]), - if - ?tr_is_root(Env) -> - commit_restart({Env, Data}, - ?etr_read(?tr_get_etrap(Env), Cursor), root); - true -> - commit_restart({Env, Data}, - ?etr_read(?tr_get_etrap(Env), Cursor), subCoord) - end; -%% 'rollback' called without 'prepare'. This case occurs if the Coordinator -%% crashes when send_info or notify_subtrAware. -prepare_restart({Env, _}, {{rollback, NewL}, _Cursor}) -> - ?debug_print("prepare_restart: pre_vote( rollback )~n",[]), - send_info(?etr_get_members(NewL), 'CosTransactions_Resource', rollback), - notify_subtrAware(rollback, ?etr_get_subAw(NewL), ?etr_get_self(NewL)), - self() ! {suicide, self()}, - {ok, {Env, NewL}}; -%% Something is wrong in the log. -prepare_restart(_, _) -> - ?tr_error_msg("Internal log read failed:~n", []), - {stop, {error, "restart failed"}}. - -%%-----------------------------------------------------------% -%% function : commit_restart -%% Arguments: Env - server context -%% Returns : -%% Effect : -%%------------------------------------------------------------ -commit_restart({Env, Local}, Data, Phase) -> - Exc = set_exception(#exc{}, ?etr_get_exc(Local)), - commit_restart({Env, Local}, Data, Phase, Exc). - -%% Normal case. No errors no exceptions. -commit_restart({Env, Local}, {{sent, Obj}, Cursor}, Vote, Exc) -> - ?debug_print("commit_restart: sent~n",[]), - commit_restart({Env, ?etr_remove_vc(Local, Obj)}, - ?etr_read(?tr_get_etrap(Env), Cursor), Vote, Exc); -commit_restart({Env, Local}, {{heuristic, {Obj,E}}, Cursor}, Vote, Exc) -> - ?debug_print("commit_restart: heuristic ~p~n",[E]), - NewExc = set_exception(Exc, E), - commit_restart({Env, ?etr_add_raisedH(Local, Obj)}, - ?etr_read(?tr_get_etrap(Env), Cursor), Vote, NewExc); - - -%% --- cases which only can occure once in the log ------------ - -%% The file contains no data. The coordinator crashed before -%% a decision was made. Causes rollback. -commit_restart({E, L}, eof, root, Exc) -> - ?debug_print("commit_restart: eof init (root only)~n",[]), - {Env, Local} = send_decision({E, L}, no_reply, ?etr_get_vc(L), - rollback, Exc), - exception_set({Env, Local}); -%% Replace the reply above if allow synchronization -% case ?etr_get_sync(Local) of -% [] -> -% exception_set({Env, Local}); -% SynchObjs -> -% {ok, {Env, Local}} -% end; - - -%% Passed the prepare_restart. Not received a commit decision from the -%% parent. -commit_restart({E, L}, eof, subCoord, Exc) -> - ?debug_print("commit_restart: eof init (subcoord only)~n",[]), - case catch corba_object:non_existent(?tr_get_parent(E)) of - true -> - %% Presumed rollback. - {Env, Local} = send_decision({E, L}, no_reply, ?etr_get_vc(L), - rollback, Exc), - self() ! {suicide, self()}, - {ok, {Env, Local}}; -%% Replace the reply above if allow synchronization -% case ?etr_get_sync(Local) of -% [] -> -% self() ! {suicide, self()}, -% {ok, {Env, Local}}; -% SynchObjs -> -% case ?tr_get_parents(Env) of -% [] -> -% send_info(SynchObjs, ?etr_get_status(Local), -% 'CosTransactions_Synchronization', after_completion); -% _-> -% ok -% end, -% self() ! {suicide, self()}, -% {ok, {Env, Local}} -% end; - _-> - {ok, {E, L}} - end; - -commit_restart({Env, Local}, eof, Vote, Exc) -> - ?debug_print("commit_restart: eof VOTE: ~p~n",[Vote]), - case ?etr_get_vc(Local) of - [] -> - ?debug_print("commit_restart: all sent, test exc~n",[]), - exception_set({Env, Local}); - VC -> - ?debug_print("commit_restart: note done. send more~n",[]), - State = send_decision({Env, Local}, no_reply, VC, Vote, Exc), - exception_set(State) - end; - -%% Decision made, i.e. rollback or commit. -commit_restart({Env, Local}, {rollback, Cursor}, _Phase, Exc) -> - ?debug_print("commit_restart: decided rollback~n",[]), - commit_restart({Env, ?etr_set_status(Local, 'StatusRolledBack')}, - ?etr_read(?tr_get_etrap(Env), Cursor), rollback, Exc); -commit_restart({Env, Local}, {commit, Cursor}, _Phase, Exc) -> - ?debug_print("commit_restart: decided commit~n",[]), - commit_restart({Env, ?etr_set_status(Local, 'StatusCommitted')}, - ?etr_read(?tr_get_etrap(Env), Cursor), commit, Exc); -commit_restart({Env, Local}, {forget_phase, Cursor}, _, _) -> - ?debug_print("commit_restart: start sending forget~n",[]), - forget_restart({Env, Local}, ?etr_read(?tr_get_etrap(Env), Cursor)); - -commit_restart({_Env, _Local}, _R, _, _) -> - ?debug_print("RESTART FAIL: ~p~n",[_R]), - ?tr_error_msg("Internal log read failed:~n", []), - exit("restart failed"). - -%%-----------------------------------------------------------% -%% function : forget_restart -%% Arguments: {Env, Local} - server context -%% Returns : -%% Effect : -%%------------------------------------------------------------ - -%% Exception logged. Test if we issued a 'forget()' to the Resource. -forget_restart({Env, Local}, eof) -> - case ?etr_get_raisedH(Local) of - [] -> - ?debug_print("forget_restart: all done~n",[]); - Left -> - ?debug_print("forget_restart: not done. send more~n",[]), - send_forget(Left, ?tr_get_etrap(Env)) - end, - self() ! {suicide, self()}, - {ok, {Env, Local}}; -%% Replace the reply above if allow synchronization -% case ?etr_get_sync(Local) of -% [] -> -% self() ! {suicide, self()}, -% {ok, {Env, Local}}; -% SynchObjs -> -% case ?tr_get_parents(Env) of -% [] -> -% send_info(SynchObjs, ?etr_get_status(Local), -% 'CosTransactions_Synchronization', after_completion), -% self() ! {suicide, self()}, -% {ok, {Env, Local}}; -% _-> -% {ok, {Env, Local}} -% end -% end; -forget_restart({Env, Local}, {{forgotten, Obj}, Cursor}) -> - ?debug_print("forget_restart: forgotten heuristic~n",[]), - NewL = ?etr_remove_raisedH(Local, Obj), - forget_restart({Env, NewL}, ?etr_read(?tr_get_etrap(Env), Cursor)); -forget_restart({Env, Local}, {{not_forgotten, Obj}, Cursor}) -> - ?debug_print("forget_restart: not_forgotten~n",[]), - NewL = ?etr_remove_raisedH(Local, Obj), - send_forget([Obj], dummy), - forget_restart({Env, NewL}, ?etr_read(?tr_get_etrap(Env), Cursor)). - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosTransactions/src/Makefile b/lib/cosTransactions/src/Makefile deleted file mode 100644 index 4cc1e487c2..0000000000 --- a/lib/cosTransactions/src/Makefile +++ /dev/null @@ -1,181 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -EBIN=../ebin - -ifeq ($(TYPE),debug) -ERL_COMPILE_FLAGS += -Ddebug -W -endif - -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSTRANSACTIONS_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/cosTransactions-$(VSN) -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- - -MODULES = \ - ETraP_Common \ - etrap_logmgr \ - ETraP_Server_impl \ - CosTransactions_Terminator_impl \ - CosTransactions_TransactionFactory_impl \ - cosTransactions - -ERL_FILES = $(MODULES:%=%.erl) -HRL_FILES = \ - ETraP_Common.hrl - -GEN_ERL_FILES = \ - oe_CosTransactions.erl \ - CosTransactions_Control.erl \ - CosTransactions_Coordinator.erl \ - CosTransactions_HeuristicCommit.erl \ - CosTransactions_HeuristicHazard.erl \ - CosTransactions_HeuristicMixed.erl \ - CosTransactions_HeuristicRollback.erl \ - CosTransactions_Inactive.erl \ - CosTransactions_InvalidControl.erl \ - CosTransactions_NoTransaction.erl \ - CosTransactions_NotPrepared.erl \ - CosTransactions_NotSubtransaction.erl \ - CosTransactions_RecoveryCoordinator.erl \ - CosTransactions_Resource.erl \ - CosTransactions_SubtransactionAwareResource.erl \ - CosTransactions_SubtransactionsUnavailable.erl \ - CosTransactions_Terminator.erl \ - CosTransactions_TransactionFactory.erl \ - CosTransactions_Unavailable.erl \ - CosTransactions_SynchronizationUnavailable.erl \ - CosTransactions_TransIdentity.erl \ - CosTransactions_PropagationContext.erl \ - CosTransactions_otid_t.erl \ - CosTransactions_WrongTransaction.erl \ - ETraP_Server.erl -# CosTransactions_Synchronization.erl \ - -EXTERNAL_INC_PATH = ../include - -GEN_HRL_FILES = \ - oe_CosTransactions.hrl \ - CosTransactions.hrl \ - CosTransactions_Control.hrl \ - CosTransactions_Coordinator.hrl \ - CosTransactions_RecoveryCoordinator.hrl \ - CosTransactions_Resource.hrl \ - CosTransactions_SubtransactionAwareResource.hrl \ - CosTransactions_Terminator.hrl \ - CosTransactions_TransactionFactory.hrl \ - ETraP.hrl \ - ETraP_Server.hrl -# CosTransactions_Synchronization.hrl \ - -EXTERNAL_GEN_HRL_FILES = $(GEN_HRL_FILES:%=$(EXTERNAL_INC_PATH)/%) - -GEN_FILES = $(GEN_ERL_FILES) $(EXTERNAL_GEN_HRL_FILES) - -TARGET_FILES = \ - $(GEN_ERL_FILES:%.erl=$(EBIN)/%.$(EMULATOR)) \ - $(MODULES:%=$(EBIN)/%.$(EMULATOR)) - -IDL_FILE = \ - CosTransactions.idl - -APPUP_FILE = cosTransactions.appup -APPUP_SRC = $(APPUP_FILE).src -APPUP_TARGET = $(EBIN)/$(APPUP_FILE) - -APP_FILE = cosTransactions.app -APP_SRC = $(APP_FILE).src -APP_TARGET = $(EBIN)/$(APP_FILE) - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/cosTransactions/ebin \ - -pa $(ERL_TOP)/lib/ic/ebin\ - -pa $(ERL_TOP)/lib/orber/ebin - -# The -pa option is just used temporary until erlc can handle -# includes from other directories than ../include . -ERL_COMPILE_FLAGS += \ - $(ERL_IDL_FLAGS) \ - -I$(ERL_TOP)/lib/cosTransactions/include \ - -I$(ERL_TOP)/lib/orber/include \ - +'{parse_transform,sys_pre_attributes}' \ - +'{attribute,insert,app_vsn,"cosTransactions_$(COSTRANSACTIONS_VSN)"}' - - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) - -debug: - @${MAKE} TYPE=debug - -clean: - rm -f $(TARGET_FILES) $(GEN_FILES) $(APP_TARGET) $(APPUP_TARGET) IDL-GENERATED - rm -f errs core *~ - -$(APP_TARGET): $(APP_SRC) - $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $(APP_SRC) > $(APP_TARGET) - -$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ - -docs: - -# ---------------------------------------------------- -# Special Build Targets -# ---------------------------------------------------- -IDL-GENERATED: CosTransactions.idl - $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosTransactions.cfg"}' CosTransactions.idl - $(V_at)mv $(GEN_HRL_FILES) $(EXTERNAL_INC_PATH) - $(V_at)>IDL-GENERATED - -$(GEN_FILES): IDL-GENERATED - -$(TARGET_FILES): IDL-GENERATED - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)/ebin" - $(INSTALL_DATA) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) "$(RELSYSDIR)/ebin" - $(INSTALL_DIR) "$(RELSYSDIR)/src" - $(INSTALL_DATA) $(ERL_FILES) $(HRL_FILES) $(GEN_ERL_FILES) $(IDL_FILE) "$(RELSYSDIR)/src" - $(INSTALL_DIR) "$(RELSYSDIR)/include" - $(INSTALL_DATA) $(EXTERNAL_GEN_HRL_FILES) "$(RELSYSDIR)/include" - -release_docs_spec: diff --git a/lib/cosTransactions/src/cosTransactions.app.src b/lib/cosTransactions/src/cosTransactions.app.src deleted file mode 100644 index 074d82f487..0000000000 --- a/lib/cosTransactions/src/cosTransactions.app.src +++ /dev/null @@ -1,44 +0,0 @@ -{application, cosTransactions, - [{description, "The Erlang CosTransactions application"}, - {vsn, "%VSN%"}, - {modules, - [ - etrap_logmgr, - 'ETraP_Server_impl', - 'CosTransactions_Terminator_impl', - 'CosTransactions_TransactionFactory_impl', - 'ETraP_Common', - oe_CosTransactions, - 'CosTransactions_Control', - 'CosTransactions_Coordinator', - 'CosTransactions_HeuristicCommit', - 'CosTransactions_HeuristicHazard', - 'CosTransactions_HeuristicMixed', - 'CosTransactions_HeuristicRollback', - 'CosTransactions_Inactive', - 'CosTransactions_InvalidControl', - 'CosTransactions_NoTransaction', - 'CosTransactions_NotPrepared', - 'CosTransactions_NotSubtransaction', - 'CosTransactions_RecoveryCoordinator', - 'CosTransactions_Resource', - 'CosTransactions_SubtransactionAwareResource', - 'CosTransactions_SubtransactionsUnavailable', - 'CosTransactions_Terminator', - 'CosTransactions_TransactionFactory', - 'CosTransactions_Unavailable', - 'CosTransactions_SynchronizationUnavailable', - 'CosTransactions_TransIdentity', - 'CosTransactions_PropagationContext', - 'CosTransactions_otid_t', - 'CosTransactions_WrongTransaction', - 'ETraP_Server', - cosTransactions - ] - }, - {registered, [cosTransactions_sup, oe_cosTransactionsFactory]}, - {applications, [orber, stdlib, kernel]}, - {env, []}, - {mod, {cosTransactions, []}}, - {runtime_dependencies, ["stdlib-2.0","orber-3.6.27","kernel-3.0","erts-7.0"]} -]}. diff --git a/lib/cosTransactions/src/cosTransactions.appup.src b/lib/cosTransactions/src/cosTransactions.appup.src deleted file mode 100644 index f3eead4a0c..0000000000 --- a/lib/cosTransactions/src/cosTransactions.appup.src +++ /dev/null @@ -1,6 +0,0 @@ -{"%VSN%", - [ - ], - [ - ] -}. diff --git a/lib/cosTransactions/src/cosTransactions.erl b/lib/cosTransactions/src/cosTransactions.erl deleted file mode 100644 index 60e5fff46d..0000000000 --- a/lib/cosTransactions/src/cosTransactions.erl +++ /dev/null @@ -1,116 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : cosTransactions.erl -%% Purpose : Initialize the 'cosTransactions' application -%%---------------------------------------------------------------------- - --module(cosTransactions). - -%%--------------- INCLUDES ----------------------------------- -%% Local --include_lib("ETraP_Common.hrl"). --include_lib("CosTransactions.hrl"). -%%--------------- EXPORTS------------------------------------- -%% cosTransactions API external --export([start/0, stop/0, start_factory/1, start_factory/0, stop_factory/1]). - -%% Application callbacks --export([start/2, init/1, stop/1]). - -%%------------------------------------------------------------ -%% function : start/stop -%% Arguments: -%% Returns : -%% Effect : Starts or stops the cosTRansaction application. -%%------------------------------------------------------------ - -start() -> - application:start(cosTransactions). -stop() -> - application:stop(cosTransactions). - -%%------------------------------------------------------------ -%% function : start_factory -%% Arguments: none or an argumentlist which by default is defined -%% in ETraP_Common.hrl, i.e., '?tr_FAC_DEF' -%% Returns : ObjectRef | {'EXCEPTION', _} | {'EXIT', Reason} -%% Effect : Starts a CosTransactions_TransactionFactory -%%------------------------------------------------------------ - -start_factory() -> - ?tr_start_child(?SUP_FAC(?tr_FAC_DEF)). - -start_factory(Args) when is_list(Args) -> - ?tr_start_child(?SUP_FAC(Args)); -start_factory(Args) -> - ?tr_error_msg("applications:start( ~p ) failed. Bad parameters~n", [Args]), - exit("applications:start failed. Bad parameters"). - -%%------------------------------------------------------------ -%% function : stop_factory -%% Arguments: Factory Object Reference -%% Returns : ok | {'EXCEPTION', _} -%% Effect : -%%------------------------------------------------------------ - -stop_factory(Fac)-> - corba:dispose(Fac). - -%%------------------------------------------------------------ -%% function : start -%% Arguments: Type - see module application -%% Arg - see module application -%% Returns : -%% Effect : Module callback for application -%%------------------------------------------------------------ - -start(_, _) -> - supervisor:start_link({local, ?SUPERVISOR_NAME}, cosTransactions, app_init). - - -%%------------------------------------------------------------ -%% function : stop -%% Arguments: Arg - see module application -%% Returns : -%% Effect : Module callback for application -%%------------------------------------------------------------ - -stop(_) -> - ok. - -%%------------------------------------------------------------ -%% function : init -%% Arguments: -%% Returns : -%% Effect : -%%------------------------------------------------------------ - -%% Starting using create_factory/X -init(own_init) -> - {ok,{?SUP_FLAG, [?SUP_CHILD]}}; -%% When starting as an application. -init(app_init) -> - {ok,{?SUP_FLAG, [?SUP_CHILD]}}. - - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosTransactions/src/etrap_logmgr.erl b/lib/cosTransactions/src/etrap_logmgr.erl deleted file mode 100644 index a5d9affe7d..0000000000 --- a/lib/cosTransactions/src/etrap_logmgr.erl +++ /dev/null @@ -1,201 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : etrap_logmgr.erl -%% Purpose : Make it easier to use disk_log. -%%---------------------------------------------------------------------- - --module(etrap_logmgr). - -%%--------------- INCLUDES ----------------------------------- -%% Local --include_lib("ETraP_Common.hrl"). -%%--------------- IMPORTS------------------------------------- -%%--------------- EXPORTS------------------------------------- --export([start/1, stop/1, log_safe/2, log_lazy/2, get_next/2]). - - -%%------------------------------------------------------------ -%% function : start -%% Arguments: LogName - name of the disk_log. -%% Returns : -%% Effect : creating linked log -%%------------------------------------------------------------ - -start(LogName) -> - case catch disk_log:open([{name, LogName}, - {file, LogName}, - {type, halt}, - {size, infinity}]) of - {ok, LogName} -> - ok; - {error, Reason} -> - ?tr_error_msg("Initiating internal log failed: ~p", [Reason]), - exit({error, Reason}); - {repaired, LogName, {recovered, _Rec}, {badbytes, _Bad}} -> - ok; - Other -> - ?tr_error_msg("Initiating internal log failed: ~p", [Other]), - exit({error, Other}) - end. - -%%------------------------------------------------------------ -%% function : stop -%% Arguments: LogName - name of the disk_log. -%% Returns : -%% Effect : -%%------------------------------------------------------------ - -stop(LogName) -> - case catch disk_log:close(LogName) of - ok -> - ok; - {error, Reason} -> - ?tr_error_msg("Stopping internal log failed: ~p", [Reason]), - {error, Reason}; - Other -> - ?tr_error_msg("Stopping internal log failed: ~p", [Other]), - {error, Other} - end. - - -%%------------------------------------------------------------ -%% function : log_safe -%% Arguments: LogName - name of the disk_log. If 'dummy' is -%% used nothing should be logged. Reason, reuse code. -%% LogRecord - record to store in the log. -%% Returns : -%% Effect : Writes a logrecord and synchronizes to make sure -%% that the record is stored. -%%------------------------------------------------------------ - -log_safe(dummy, _) -> - ok; -log_safe(LogName, LogRecord) -> - case write_safe(LogName, LogRecord) of - ok -> - ok; - _ -> - %% We have to catch the exit because in some cases - %% it's not possible to abort action in the 2PC-protocol. - case catch start(LogName) of - ok -> - write_safe(LogName, LogRecord); - {'EXIT', Reason} -> - {error, Reason} - end - end. - - -write_safe(LogName, LogRecord) -> - case catch disk_log:log(LogName, LogRecord) of - ok -> % wrote to kernel successfully - case catch disk_log:sync(LogName) of - ok -> % Written to disk successfully - ok; - {error, Reason} -> - ?tr_error_msg("Internal log write failed: ~p ~p", - [Reason, LogName]), - {error, Reason}; - Other -> - ?tr_error_msg("Internal log write failed: ~p ~p", - [Other, LogName]), - {error, Other} - end; - {error, Reason} -> - ?tr_error_msg("Internal log write failed: ~p ~p", [Reason, LogName]), - {error, Reason}; - Other -> - ?tr_error_msg("Internal log write failed: ~p ~p", [Other, LogName]), - {error, Other} - end. - - -%%------------------------------------------------------------ -%% function : log_lazy -%% Arguments: LogName - name of the disk_log. If 'dummy' is -%% used nothing should be logged. Reason, reuse code. -%% LogRecord - record to store in the log. -%% Returns : -%% Effect : Writes a logrecord. The record may be lost. -%%------------------------------------------------------------ - -log_lazy(dummy, _LogRecord) -> - ok; -log_lazy(LogName, LogRecord) -> - case write_lazy(LogName, LogRecord) of - ok -> - ok; - _ -> - %% We have to catch the exit because in some cases - %% it's not possible to abort action in the 2PC-protocol. - case catch start(LogName) of - ok -> - write_lazy(LogName, LogRecord); - {'EXIT', Reason} -> - {error, Reason} - end - end. - -write_lazy(LogName, LogRecord) -> - case catch disk_log:log(LogName, LogRecord) of - ok -> - %% wrote to kernel successfully - ok; - {error, Reason} -> - %% Write to kernel failed with Reason - ?tr_error_msg("Internal log write failed: ~p", [Reason]), - {error, Reason}; - Other -> - %% unknown message received. - ?tr_error_msg("Internal log write failed: ~p", [Other]), - {error, Other} - end. - - -%%------------------------------------------------------------ -%% function : get_next -%% Arguments: LogName - name of the disk_log. -%% Cursor - place to read from. -%% Returns : {Cursor, LogRecs} - A cursor and up to N logrecords. -%% eof - the atom 'eof', indicating logfile empty. -%% {error, Reason} - error. -%% Effect : -%% Purpose : Used when performing a REDO scan -%%------------------------------------------------------------ - -get_next(LogName, Cursor) -> - case catch disk_log:chunk(LogName, Cursor, 1) of - {NewCursor, [Data]} -> - {Data, NewCursor}; - eof -> - eof; - {error, Reason} -> - ?tr_error_msg("Internal log '~p' read failed: ~p", - [LogName, Reason]), - exit({error, Reason}); - _Other -> - ?tr_error_msg("Internal log '~p' read failed: 'log_corrupt'", [LogName]), - exit({error, "log_corrupt"}) - end. - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosTransactions/test/Makefile b/lib/cosTransactions/test/Makefile deleted file mode 100644 index 58199248d1..0000000000 --- a/lib/cosTransactions/test/Makefile +++ /dev/null @@ -1,151 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -#ifeq ($(TYPE),debug) -#ERL_COMPILE_FLAGS += -Ddebug -W -#endif - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(COSTRANSACTIONS_VSN) -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/cosTransactions_test - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -TEST_SPEC_FILE = cosTransactions.spec -COVER_FILE = cosTransactions.cover - - -IDL_FILES = \ - etrap_test.idl - -IDLOUTDIR = idl_output - -MODULES = \ - transactions_SUITE \ - etrap_test_server_impl \ - etrap_test_lib \ - generated_SUITE - -GEN_MODULES = \ - oe_etrap_test \ - etrap_test_server - -GEN_HRL_FILES = \ - oe_etrap_test.hrl \ - etrap_test_server.hrl - -ERL_FILES = $(MODULES:%=%.erl) - -HRL_FILES = \ - etrap_test_lib.hrl - -GEN_FILES = \ - $(GEN_HRL_FILES:%=$(IDLOUTDIR)/%) \ - $(GEN_MODULES:%=$(IDLOUTDIR)/%.erl) - -GEN_TARGET_FILES = $(GEN_MODULES:%=$(IDLOUTDIR)/%.$(EMULATOR)) - -SUITE_TARGET_FILES = $(MODULES:%=%.$(EMULATOR)) - -TARGET_FILES = \ - $(GEN_TARGET_FILES) \ - $(SUITE_TARGET_FILES) - - -# ---------------------------------------------------- -# PROGRAMS -# ---------------------------------------------------- -LOCAL_CLASSPATH = $(ERL_TOP)/lib/cosTransactions/priv:$(ERL_TOP)/lib/cosTransactions/test -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/cosTransactions/ebin\ - -pa $(ERL_TOP)/lib/orber/ebin \ - -pa $(ERL_TOP)/lib/ic/ebin - -ERL_COMPILE_FLAGS += \ - $(ERL_IDL_FLAGS) \ - -pa $(ERL_TOP)/lib/orber/include \ - -pa $(ERL_TOP)/lib/cosTransactions/ebin \ - -pa $(ERL_TOP)/lib/cosTransactions/test/idl_output \ - -I$(ERL_TOP)/lib/orber/include \ - -I$(ERL_TOP)/lib/cosTransactions \ - -I$(ERL_TOP)/lib/cosTransactions/test/$(IDLOUTDIR) - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- - - -tests debug opt: $(TARGET_FILES) - -clean: - rm -f idl_output/* - rm -f $(TARGET_FILES) - rm -f errs core *~ - -#debug: -# @${MAKE} TYPE=debug - -docs: - -# ---------------------------------------------------- -# Special Targets -# ---------------------------------------------------- - -IDL-GENERATED: etrap_test.idl - erlc $(ERL_IDL_FLAGS) -o$(IDLOUTDIR) \ - +'{cfgfile,"etrap_test.cfg"}' etrap_test.idl - >IDL-GENERATED - -$(GEN_FILES): IDL-GENERATED - -$(TARGET_FILES): IDL-GENERATED - -# ---------------------------------------------------- -# Release Targets -# ---------------------------------------------------- -# We don't copy generated intermediate erlang and hrl files - -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: - -release_docs_spec: - -release_tests_spec: tests - $(INSTALL_DIR) "$(RELSYSDIR)" - $(INSTALL_DATA) $(IDL_FILES) $(TEST_SPEC_FILE) \ - $(COVER_FILE) $(ERL_FILES) $(HRL_FILES) "$(RELSYSDIR)" - $(INSTALL_DATA) $(SUITE_TARGET_FILES) "$(RELSYSDIR)" - $(INSTALL_DIR) "$(RELSYSDIR)/$(IDLOUTDIR)" - $(INSTALL_DATA) $(GEN_TARGET_FILES) $(GEN_FILES) \ - "$(RELSYSDIR)/$(IDLOUTDIR)" - diff --git a/lib/cosTransactions/test/cosTransactions.cover b/lib/cosTransactions/test/cosTransactions.cover deleted file mode 100644 index b27bae999d..0000000000 --- a/lib/cosTransactions/test/cosTransactions.cover +++ /dev/null @@ -1,2 +0,0 @@ -{incl_app,cosTransactions,details}. - diff --git a/lib/cosTransactions/test/cosTransactions.spec b/lib/cosTransactions/test/cosTransactions.spec deleted file mode 100644 index 9918c8ca16..0000000000 --- a/lib/cosTransactions/test/cosTransactions.spec +++ /dev/null @@ -1 +0,0 @@ -{suites,"../cosTransactions_test",all}. diff --git a/lib/cosTransactions/test/etrap_test.cfg b/lib/cosTransactions/test/etrap_test.cfg deleted file mode 100644 index a2bc7d3fb7..0000000000 --- a/lib/cosTransactions/test/etrap_test.cfg +++ /dev/null @@ -1,21 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -{this, "etrap_test::server"}. -{{handle_info, "etrap_test::server"}, true}. diff --git a/lib/cosTransactions/test/etrap_test.idl b/lib/cosTransactions/test/etrap_test.idl deleted file mode 100644 index 7379115be7..0000000000 --- a/lib/cosTransactions/test/etrap_test.idl +++ /dev/null @@ -1,39 +0,0 @@ -// -// %CopyrightBegin% -// -// Copyright Ericsson AB 1999-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -// - -#ifndef _TEST_IDL -#define _TEST_IDL -#include <../src/CosTransactions.idl> -module etrap_test { - - // interface server - interface server : - CosTransactions::Coordinator, CosTransactions::SubtransactionAwareResource, - CosTransactions::RecoveryCoordinator, CosTransactions::Control { - }; -// interface Server : -// CosTransactions::Coordinator, CosTransactions::SubtransactionAwareResource, -// CosTransactions::RecoveryCoordinator, CosTransactions::Control, -// CosTransactions::Synchronization { -// }; - -}; // End of test Module - -#endif diff --git a/lib/cosTransactions/test/etrap_test_lib.erl b/lib/cosTransactions/test/etrap_test_lib.erl deleted file mode 100644 index e8d8c3a429..0000000000 --- a/lib/cosTransactions/test/etrap_test_lib.erl +++ /dev/null @@ -1,126 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(etrap_test_lib). - -%%--------------- INCLUDES --------------------------------------------- --include("etrap_test_lib.hrl"). --include_lib("cosTransactions/src/ETraP_Common.hrl"). - -%%--------------- EXPORTS ---------------------------------------------- --export([scratch_debug_fun/0, - activate_debug_fun/5, - update_debug_info/1, - deactivate_debug_fun/3, - eval_debug_fun/4, - set_debug_context/4]). - -%%--------------- CONSTANTS/DEFINITIONS -------------------------------- --define(DEBUG_TAB, etrap_debug). --record(debug_info, {id, function, type, file, line}). - -%%--------------- DEBUG FUNCTIONS -------------------------------------- -%% Managing conditional debug functions -%% -%% The main idea with the debug_fun's is to allow test programs -%% to control the internal behaviour of CosTransactions. -%% -%% First should calls to ?eval_debug_fun be inserted at well -%% defined places in CosTransaction's code. E.g. in critical situations -%% of startup, transaction commit, backups etc. -%% -%% Then compile CosTransactions with the compiler option 'debug'. -%% -%% In test programs ?activate_debug_fun should be called -%% in order to bind a fun to the debug identifier stated -%% in the call to ?eval_debug_fun. - -scratch_debug_fun() -> - catch ets:delete(?DEBUG_TAB), - ets:new(?DEBUG_TAB, - [set, public, named_table, {keypos, 2}]). - -activate_debug_fun(FunId, Fun, Type, File, Line) -> - io:format("Activiating ~p RETRIES: ~p WAIT: ~p~n", - [FunId, ?tr_max_retries, ?tr_comm_failure_wait]), - Info = #debug_info{id = FunId, - function = Fun, - type = Type, - file = File, - line = Line}, - update_debug_info(Info). - -update_debug_info(Info) -> - case catch ets:insert(?DEBUG_TAB, Info) of - {'EXIT', _} -> - scratch_debug_fun(), - ets:insert(?DEBUG_TAB, Info); - _ -> - ok - end, - ok. - -deactivate_debug_fun(FunId, _File, _Line) -> - catch ets:delete(?DEBUG_TAB, FunId), - ok. - -eval_debug_fun(FunId, Env, File, Line) -> - case catch ets:lookup(?DEBUG_TAB, FunId) of - [] -> - ok; - [Info] -> - Fun = Info#debug_info.function, - case Info#debug_info.type of - transient -> - deactivate_debug_fun(FunId, File, Line); - _-> - ok - end, - io:format("Running debug fun ~p:~p (LINE: ~p)~n", [File, FunId, Line]), - Fun(Env); - {'EXIT', _R} -> - ok - end. - - -set_debug_context([], [], _, _)-> ok; -set_debug_context([], _, _, _)-> - ets:delete(?DEBUG_TAB), - exit("failed transactions_SUITE. Bad configuration."); -set_debug_context(_, [], _, _)-> - ets:delete(?DEBUG_TAB), - exit("failed transactions_SUITE Bad configuration."); -set_debug_context([RHead|RTail], [CHead|CTail], File, Line)-> - write_context(RHead, CHead, File, Line), - set_debug_context(RTail, CTail, File, Line). - -write_context(_Resource, [], _, _)-> ok; -write_context(Resource, [{Func, Fun, Type}|PTail], File, Line)-> - etrap_test_lib:activate_debug_fun({Resource, Func}, - Fun, Type, - File, Line), - write_context(Resource, PTail, File, Line); -write_context(_,_, _, _) -> - ets:delete(?DEBUG_TAB), - exit("failed transactions_SUITE. Bad configuration."). - - -%%--------------- END OF MODULE ---------------------------------------- diff --git a/lib/cosTransactions/test/etrap_test_lib.hrl b/lib/cosTransactions/test/etrap_test_lib.hrl deleted file mode 100644 index 6fe61a4d45..0000000000 --- a/lib/cosTransactions/test/etrap_test_lib.hrl +++ /dev/null @@ -1,101 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --ifndef(ETRAP_TEST_LIB_HRL). --define(ETRAP_TEST_LIB_HRL, true). - --define(match(ExpectedRes, Expr, Msg), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - io:format("~n------ CORRECT RESULT ------~n~p~n~p~n", - [AcTuAlReS, Msg]), - ok; - _ -> - io:format("~n###### ERROR ERROR ######~n~p~n~p~n", - [AcTuAlReS, Msg]), - exit(AcTuAlReS) - end - end()). - --define(match_inverse(NotExpectedRes, Expr, Msg), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - NotExpectedRes -> - io:format("~n###### ERROR ERROR ######~n ~p~n~p~n", - [AcTuAlReS, Msg]), - exit(AcTuAlReS); - _ -> - io:format("~n------ CORRECT RESULT ------~n~p~n~p~n", - [AcTuAlReS, Msg]), - ok - end - end()). - - --define(crash_and_recover, fun(_Env)-> exit(crash_and_burn) end). - --define(crash_no_recovery, fun(Env)-> throw({stop,normal,{Env,state}}) end). - --define(delay(Time), fun(_Id) -> timer:sleep(Time*1000) end). - --define(TIMEOUT, 4). --define(SUP_TEST(Env, Name), - ['etrap_test_server', Env, - [{sup_child, true}, {persistent, true}, - {regname, {global, Name}}]]). - --define(no_context, [[],[],[], []]). --define(nop, []). --define(delay_transient(Tag, Ti), - [{Tag, ?delay(Ti), transient}]). --define(crash_transient(Tag), - [{Tag, ?crash_and_recover, transient}]). --define(crash_permanent(Tag), - [{Tag, ?crash_no_recovery, permanent}]). - -%%----------------------------------------------------------- -%% Definition of 'Resource' action. -%% function action reply -%%----------------------------------------------------------- -%% raise #'CosTransactions_HeuristicMixed' {} --define(rollback_mix, [{rollback, exc, ?tr_mixed}]). --define(commit_mix, [{commit, exc, ?tr_mixed}]). --define(prepare_mix, [{prepare, exc, ?tr_mixed}]). -%% raise #'CosTransactions_HeuristicRollback' {} --define(rollback_rb, [{rollback, exc, ?tr_rollback}]). --define(commit_rb, [{commit, exc, ?tr_rollback}]). -%% raise #'CosTransactions_HeuristicCommit' {} --define(rollback_cm, [{rollback, exc, ?tr_commit}]). --define(commit_cm, [{commit, exc, ?tr_commit}]). -%% delay reply --define(rollback_delay, [{rollback, delay, ?TIMEOUT*2}]). --define(commit_delay, [{commit, delay, ?TIMEOUT*2}]). --define(prepare_delay, [{prepare, delay, ?TIMEOUT*2}]). -%% other reply than default --define(prepare_commit, [{prepare, reply, 'VoteCommit'}]). --define(prepare_rollback, [{prepare, stop_reply, 'VoteRollback'}]). - --endif. - -%%-------------- EOF --------------------------------------------------- diff --git a/lib/cosTransactions/test/etrap_test_server_impl.erl b/lib/cosTransactions/test/etrap_test_server_impl.erl deleted file mode 100644 index 8a244b42c7..0000000000 --- a/lib/cosTransactions/test/etrap_test_server_impl.erl +++ /dev/null @@ -1,211 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(etrap_test_server_impl). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). -%% Local --include_lib("cosTransactions/src/ETraP_Common.hrl"). --include_lib("cosTransactions/include/CosTransactions.hrl"). -%%--------------- IMPORTS------------------------------------- -%%--------------- EXPORTS------------------------------------- --export([prepare/2, - rollback/2, - commit/2, - commit_one_phase/2, - forget/2, -% before_completion/2, -% after_completion/3, - commit_subtransaction/3, - rollback_subtransaction/2]). - - -%%--------------- gen_server specific ------------------------ --export([init/1, terminate/2]). --export([handle_call/3, handle_cast/2, handle_info/2, code_change/3]). - -%%------------------------------------------------------------ -%% function : init, terminate -%%------------------------------------------------------------ -init(State) -> - process_flag(trap_exit,true), - io:format("etrap_test_server:init ~p~n", [State]), - ?debug_print("STARTING etrap_test_server( ~p )~n", [State]), - {ok, State}. - -terminate(Reason, _State) -> - io:format("etrap_test_server:terminate ~p~n", [Reason]), - ?debug_print("STOPREASON etrap_test_server( ~p )~n", [Reason]), - ok. - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. -handle_call(_,_, State) -> - {noreply, State}. -handle_cast(_, State) -> - {noreply, State}. -handle_info(_Info, State) -> - {noreply, State}. - -%%-- Inherit from CosTransactions::SubtransactionAwareResource -- -prepare(_Self, State) -> - case ?is_debug_compiled of - true -> - io:format("etrap_test_server:prepare ~p~n", [State]); - _-> - ok - end, -% ?debug_print("etrap_test_server:prepare ~p~n", [State]), - action(prepare, State, {reply, 'VoteCommit', State}). - -rollback(_Self, State) -> - case ?is_debug_compiled of - true -> - io:format("etrap_test_server:rollback ~p~n", [State]); - _-> - ok - end, -% ?debug_print("etrap_test_server:rollback ~p~n", [State]), - case sync_test(State) of - true -> - action(rollback, State, {reply, ok, State}); - _-> - action(rollback, State, {stop, normal, ok, State}) - end. - -commit(_Self, State) -> - case ?is_debug_compiled of - true -> - io:format("etrap_test_server:commit ~p~n", [State]); - _-> - ok - end, -% ?debug_print("etrap_test_server:commit ~p~n", [State]), - case sync_test(State) of - true -> - action(commit, State, {reply, ok, State}); - _-> - action(commit, State, {stop, normal, ok, State}) - end. - -commit_one_phase(_Self, State) -> - case ?is_debug_compiled of - true -> - io:format("etrap_test_server:commit_one_phase ~p~n", [State]); - _-> - ok - end, -% ?debug_print("etrap_test_server:commit_one_phase ~p~n", [State]), - case sync_test(State) of - true -> - {reply, ok, State}; - _-> - {stop, normal, ok, State} - end. - -forget(_Self, State) -> - case ?is_debug_compiled of - true -> - io:format("etrap_test_server:forget ~p~n", [State]); - _-> - ok - end, -% ?debug_print("etrap_test_server:forget ~p~n", [State]), - case sync_test(State) of - true -> - {reply, ok, State}; - _-> - {stop, normal, ok, State} - end. - -commit_subtransaction(_Self, State, Parent) -> - case ?is_debug_compiled of - true -> - io:format("etrap_test_server:commit_subtransaction( ~p )~n", [Parent]); - _-> - ok - end, -% ?debug_print("etrap_test_server:commit_subtransaction( ~p )~n", [Parent]), - {reply, ok, State}. -rollback_subtransaction(_Self, State) -> - case ?is_debug_compiled of - true -> - io:format("etrap_test_server:rollback_subtransaction()~n", []); - _-> - ok - end, -% ?debug_print("etrap_test_server:rollback_subtransaction()~n", []), - {reply, ok, State}. - -%before_completion(_Self, State) -> -% case ?is_debug_compiled of -% true -> -% io:format("etrap_test_server:before_completion()~n", []); -% _-> -% ok -% end, -%% ?debug_print("etrap_test_server:before_completion()~n", []), -% {reply, ok, State}. -%after_completion(_Self, State, Status) -> -% case ?is_debug_compiled of -% true -> -% io:format("etrap_test_server:after_completion( ~p )~n", [Status]); -% _-> -% ok -% end, -%% ?debug_print("etrap_test_server:after_completion( ~p )~n", [Status]), -% {stop, normal, ok, State}. - -%%--------------- LOCAL FUNCTIONS ---------------------------- -action(Key, State, Default) -> - case catch lists:keysearch(Key, 1, State) of - {value,{Key, stop_reply, R}} -> - case sync_test(State) of - true -> - {reply, R, State}; - _-> - {stop, normal, R, State} - end; - {value,{Key, reply, R}} -> - {reply, R, State}; - {value,{Key, exc, E}} -> - corba:raise(E); - {value,{Key, delay, Time}} -> - timer:sleep(Time*1000), - Default; - {value,{Key,Value}} -> - Value; - _ -> - Default - end. - -sync_test(State) -> - case catch lists:keysearch(sync, 1, State) of - {value,{sync, true}} -> - true; - _ -> - false - end. - - -%%--------------- END OF MODULE ------------------------------ - diff --git a/lib/cosTransactions/test/generated_SUITE.erl b/lib/cosTransactions/test/generated_SUITE.erl deleted file mode 100644 index 52b850b189..0000000000 --- a/lib/cosTransactions/test/generated_SUITE.erl +++ /dev/null @@ -1,543 +0,0 @@ -%%----------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File : generated_SUITE.erl -%% Purpose : -%% Created : 27 Jan 2004 -%%----------------------------------------------------------------- - --module(generated_SUITE). - --include_lib("common_test/include/ct.hrl"). --include_lib("orber/include/corba.hrl"). - --define(default_timeout, test_server:minutes(3)). - --define(match(ExpectedRes, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - ExpectedRes -> - AcTuAlReS; - _ -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS) - end - end()). - --define(nomatch(Not, Expr), - fun() -> - AcTuAlReS = (catch (Expr)), - case AcTuAlReS of - Not -> - io:format("###### ERROR ERROR ######~n~p~n", - [AcTuAlReS]), - exit(AcTuAlReS); - _ -> - AcTuAlReS - end - end()). - - --define(checktc(_Op), - fun(TC) -> - case orber_tc:check_tc(TC) of - false -> - io:format("###### ERROR ERROR ######~n~p - ~p~n", [Op, TC]), - exit(TC); - true -> - true - end - end). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --compile(export_all). - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - ['CosTransactions_Control', - 'CosTransactions_Coordinator', - 'CosTransactions_HeuristicCommit', - 'CosTransactions_HeuristicHazard', - 'CosTransactions_HeuristicMixed', - 'CosTransactions_HeuristicRollback', - 'CosTransactions_Inactive', - 'CosTransactions_InvalidControl', - 'CosTransactions_NoTransaction', - 'CosTransactions_NotPrepared', - 'CosTransactions_NotSubtransaction', - 'CosTransactions_RecoveryCoordinator', - 'CosTransactions_Resource', - 'CosTransactions_SubtransactionAwareResource', - 'CosTransactions_SubtransactionsUnavailable', - 'CosTransactions_Terminator', - 'CosTransactions_TransactionFactory', - 'CosTransactions_Unavailable', - 'CosTransactions_SynchronizationUnavailable', - 'CosTransactions_TransIdentity', - 'CosTransactions_PropagationContext', - 'CosTransactions_otid_t', - 'CosTransactions_WrongTransaction', 'ETraP_Server']. - -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- -init_per_testcase(_Case, Config) -> - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - -end_per_testcase(_Case, Config) -> - Dog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_HeuristicCommit' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_HeuristicCommit'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_HeuristicCommit':tc())), - ?match("IDL:omg.org/CosTransactions/HeuristicCommit:1.0", - 'CosTransactions_HeuristicCommit':id()), - ?match("CosTransactions_HeuristicCommit", - 'CosTransactions_HeuristicCommit':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_HeuristicHazard' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_HeuristicHazard'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_HeuristicHazard':tc())), - ?match("IDL:omg.org/CosTransactions/HeuristicHazard:1.0", - 'CosTransactions_HeuristicHazard':id()), - ?match("CosTransactions_HeuristicHazard", - 'CosTransactions_HeuristicHazard':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_HeuristicMixed' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_HeuristicMixed'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_HeuristicMixed':tc())), - ?match("IDL:omg.org/CosTransactions/HeuristicMixed:1.0", - 'CosTransactions_HeuristicMixed':id()), - ?match("CosTransactions_HeuristicMixed", - 'CosTransactions_HeuristicMixed':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_HeuristicRollback' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_HeuristicRollback'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_HeuristicRollback':tc())), - ?match("IDL:omg.org/CosTransactions/HeuristicRollback:1.0", - 'CosTransactions_HeuristicRollback':id()), - ?match("CosTransactions_HeuristicRollback", - 'CosTransactions_HeuristicRollback':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_Inactive' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_Inactive'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_Inactive':tc())), - ?match("IDL:omg.org/CosTransactions/Inactive:1.0", - 'CosTransactions_Inactive':id()), - ?match("CosTransactions_Inactive", - 'CosTransactions_Inactive':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_InvalidControl' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_InvalidControl'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_InvalidControl':tc())), - ?match("IDL:omg.org/CosTransactions/InvalidControl:1.0", - 'CosTransactions_InvalidControl':id()), - ?match("CosTransactions_InvalidControl", - 'CosTransactions_InvalidControl':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_NoTransaction' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_NoTransaction'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_NoTransaction':tc())), - ?match("IDL:omg.org/CosTransactions/NoTransaction:1.0", - 'CosTransactions_NoTransaction':id()), - ?match("CosTransactions_NoTransaction", - 'CosTransactions_NoTransaction':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_NotPrepared' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_NotPrepared'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_NotPrepared':tc())), - ?match("IDL:omg.org/CosTransactions/NotPrepared:1.0", - 'CosTransactions_NotPrepared':id()), - ?match("CosTransactions_NotPrepared", - 'CosTransactions_NotPrepared':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_NotSubtransaction' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_NotSubtransaction'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_NotSubtransaction':tc())), - ?match("IDL:omg.org/CosTransactions/NotSubtransaction:1.0", - 'CosTransactions_NotSubtransaction':id()), - ?match("CosTransactions_NotSubtransaction", - 'CosTransactions_NotSubtransaction':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_SubtransactionsUnavailable' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_SubtransactionsUnavailable'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_SubtransactionsUnavailable':tc())), - ?match("IDL:omg.org/CosTransactions/SubtransactionsUnavailable:1.0", - 'CosTransactions_SubtransactionsUnavailable':id()), - ?match("CosTransactions_SubtransactionsUnavailable", - 'CosTransactions_SubtransactionsUnavailable':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_Unavailable' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_Unavailable'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_Unavailable':tc())), - ?match("IDL:omg.org/CosTransactions/Unavailable:1.0", - 'CosTransactions_Unavailable':id()), - ?match("CosTransactions_Unavailable", - 'CosTransactions_Unavailable':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_SynchronizationUnavailable' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_SynchronizationUnavailable'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_SynchronizationUnavailable':tc())), - ?match("IDL:omg.org/CosTransactions/SynchronizationUnavailable:1.0", - 'CosTransactions_SynchronizationUnavailable':id()), - ?match("CosTransactions_SynchronizationUnavailable", - 'CosTransactions_SynchronizationUnavailable':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_TransIdentity' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_TransIdentity'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_TransIdentity':tc())), - ?match("IDL:omg.org/CosTransactions/TransIdentity:1.0", - 'CosTransactions_TransIdentity':id()), - ?match("CosTransactions_TransIdentity", - 'CosTransactions_TransIdentity':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_PropagationContext' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_PropagationContext'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_PropagationContext':tc())), - ?match("IDL:omg.org/CosTransactions/PropagationContext:1.0", - 'CosTransactions_PropagationContext':id()), - ?match("CosTransactions_PropagationContext", - 'CosTransactions_PropagationContext':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_otid_t' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_otid_t'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_otid_t':tc())), - ?match("IDL:omg.org/CosTransactions/otid_t:1.0", - 'CosTransactions_otid_t':id()), - ?match("CosTransactions_otid_t", - 'CosTransactions_otid_t':name()), - ok. - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_WrongTransaction' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_WrongTransaction'(_) -> - ?match(true, orber_tc:check_tc('CosTransactions_WrongTransaction':tc())), - ?match("IDL:omg.org/CosTransactions/WrongTransaction:1.0", - 'CosTransactions_WrongTransaction':id()), - ?match("CosTransactions_WrongTransaction", - 'CosTransactions_WrongTransaction':name()), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_Control' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_Control'(_) -> - ?nomatch(undefined, 'CosTransactions_Control':oe_tc(get_terminator)), - ?nomatch(undefined, 'CosTransactions_Control':oe_tc(get_coordinator)), - ?match(undefined, 'CosTransactions_Control':oe_tc(undefined)), - ?match([_|_], 'CosTransactions_Control':oe_get_interface()), - ?match("IDL:omg.org/CosTransactions/Control:1.0", - 'CosTransactions_Control':typeID()), - check_tc('CosTransactions_Control':oe_get_interface()), - ?match(true, 'CosTransactions_Control':oe_is_a('CosTransactions_Control':typeID())), - ?match(false, 'CosTransactions_Control':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_Coordinator' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_Coordinator'(_) -> - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(get_status)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(get_parent_status)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(get_top_level_status)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(is_same_transaction)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(is_related_transaction)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(is_ancestor_transaction)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(is_descendant_transaction)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(is_top_level_transaction)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(hash_transaction)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(hash_top_level_tran)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(register_resource)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(register_subtran_aware)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(rollback_only)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(get_transaction_name)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(create_subtransaction)), - ?nomatch(undefined, 'CosTransactions_Coordinator':oe_tc(get_txcontext)), - ?match(undefined, 'CosTransactions_Coordinator':oe_tc(undefined)), - ?match([_|_], 'CosTransactions_Coordinator':oe_get_interface()), - ?match("IDL:omg.org/CosTransactions/Coordinator:1.0", - 'CosTransactions_Coordinator':typeID()), - check_tc('CosTransactions_Coordinator':oe_get_interface()), - ?match(true, 'CosTransactions_Coordinator':oe_is_a('CosTransactions_Coordinator':typeID())), - ?match(false, 'CosTransactions_Coordinator':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_RecoveryCoordinator' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_RecoveryCoordinator'(_) -> - ?nomatch(undefined, 'CosTransactions_RecoveryCoordinator':oe_tc(replay_completion)), - ?match(undefined, 'CosTransactions_RecoveryCoordinator':oe_tc(undefined)), - ?match([_|_], 'CosTransactions_RecoveryCoordinator':oe_get_interface()), - ?match("IDL:omg.org/CosTransactions/RecoveryCoordinator:1.0", - 'CosTransactions_RecoveryCoordinator':typeID()), - check_tc('CosTransactions_RecoveryCoordinator':oe_get_interface()), - ?match(true, 'CosTransactions_RecoveryCoordinator':oe_is_a('CosTransactions_RecoveryCoordinator':typeID())), - ?match(false, 'CosTransactions_RecoveryCoordinator':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_Resource' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_Resource'(_) -> - ?nomatch(undefined, 'CosTransactions_Resource':oe_tc(prepare)), - ?nomatch(undefined, 'CosTransactions_Resource':oe_tc(rollback)), - ?nomatch(undefined, 'CosTransactions_Resource':oe_tc(commit)), - ?nomatch(undefined, 'CosTransactions_Resource':oe_tc(commit_one_phase)), - ?nomatch(undefined, 'CosTransactions_Resource':oe_tc(forget)), - ?match(undefined, 'CosTransactions_Resource':oe_tc(undefined)), - ?match([_|_], 'CosTransactions_Resource':oe_get_interface()), - ?match("IDL:omg.org/CosTransactions/Resource:1.0", - 'CosTransactions_Resource':typeID()), - check_tc('CosTransactions_Resource':oe_get_interface()), - ?match(true, 'CosTransactions_Resource':oe_is_a('CosTransactions_Resource':typeID())), - ?match(false, 'CosTransactions_Resource':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_SubtransactionAwareResource' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_SubtransactionAwareResource'(_) -> - ?nomatch(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(commit_subtransaction)), - ?nomatch(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(rollback_subtransaction)), - ?nomatch(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(prepare)), - ?nomatch(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(rollback)), - ?nomatch(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(commit)), - ?nomatch(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(commit_one_phase)), - ?nomatch(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(forget)), - ?match(undefined, 'CosTransactions_SubtransactionAwareResource':oe_tc(undefined)), - ?match([_|_], 'CosTransactions_SubtransactionAwareResource':oe_get_interface()), - ?match("IDL:omg.org/CosTransactions/SubtransactionAwareResource:1.0", - 'CosTransactions_SubtransactionAwareResource':typeID()), - check_tc('CosTransactions_SubtransactionAwareResource':oe_get_interface()), - ?match(true, 'CosTransactions_SubtransactionAwareResource':oe_is_a('CosTransactions_SubtransactionAwareResource':typeID())), - ?match(true, 'CosTransactions_SubtransactionAwareResource':oe_is_a('CosTransactions_Resource':typeID())), - ?match(false, 'CosTransactions_SubtransactionAwareResource':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_Terminator' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_Terminator'(_) -> - ?nomatch(undefined, 'CosTransactions_Terminator':oe_tc(commit)), - ?nomatch(undefined, 'CosTransactions_Terminator':oe_tc(rollback)), - ?match(undefined, 'CosTransactions_Terminator':oe_tc(undefined)), - ?match([_|_], 'CosTransactions_Terminator':oe_get_interface()), - ?match("IDL:omg.org/CosTransactions/Terminator:1.0", - 'CosTransactions_Terminator':typeID()), - check_tc('CosTransactions_Terminator':oe_get_interface()), - ?match(true, 'CosTransactions_Terminator':oe_is_a('CosTransactions_Terminator':typeID())), - ?match(false, 'CosTransactions_Terminator':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'CosTransactions_TransactionFactory' -%% Description: -%%----------------------------------------------------------------- -'CosTransactions_TransactionFactory'(_) -> - ?nomatch(undefined, 'CosTransactions_TransactionFactory':oe_tc(create)), - ?nomatch(undefined, 'CosTransactions_TransactionFactory':oe_tc(recreate)), - ?match(undefined, 'CosTransactions_TransactionFactory':oe_tc(undefined)), - ?match([_|_], 'CosTransactions_TransactionFactory':oe_get_interface()), - ?match("IDL:omg.org/CosTransactions/TransactionFactory:1.0", - 'CosTransactions_TransactionFactory':typeID()), - check_tc('CosTransactions_TransactionFactory':oe_get_interface()), - ?match(true, 'CosTransactions_TransactionFactory':oe_is_a('CosTransactions_TransactionFactory':typeID())), - ?match(false, 'CosTransactions_TransactionFactory':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% Test Case: 'ETraP_Server' -%% Description: -%%----------------------------------------------------------------- -'ETraP_Server'(_) -> - ?nomatch(undefined, 'ETraP_Server':oe_tc(get_status)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(get_parent_status)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(get_top_level_status)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(is_same_transaction)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(is_related_transaction)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(is_ancestor_transaction)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(is_descendant_transaction)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(is_top_level_transaction)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(hash_transaction)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(hash_top_level_tran)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(register_resource)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(register_subtran_aware)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(rollback_only)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(get_transaction_name)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(create_subtransaction)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(get_txcontext)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(prepare)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(rollback)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(commit)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(commit_one_phase)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(forget)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(replay_completion)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(get_terminator)), - ?nomatch(undefined, 'ETraP_Server':oe_tc(get_coordinator)), - ?match(undefined, 'ETraP_Server':oe_tc(undefined)), - ?match([_|_], 'ETraP_Server':oe_get_interface()), - ?match("IDL:omg.org/ETraP/Server:1.0", - 'ETraP_Server':typeID()), - check_tc('ETraP_Server':oe_get_interface()), - ?match(true, 'ETraP_Server':oe_is_a('ETraP_Server':typeID())), - ?match(true, 'ETraP_Server':oe_is_a('CosTransactions_Coordinator':typeID())), - ?match(true, 'ETraP_Server':oe_is_a('CosTransactions_Resource':typeID())), - ?match(true, 'ETraP_Server':oe_is_a('CosTransactions_RecoveryCoordinator':typeID())), - ?match(true, 'ETraP_Server':oe_is_a('CosTransactions_Control':typeID())), - ?match(false, 'ETraP_Server':oe_is_a("wrong")), - ok. - - -%%----------------------------------------------------------------- -%% MISC functions -%%----------------------------------------------------------------- -check_tc([]) -> - ok; -check_tc([{Op, {RetType, InParameters, OutParameters}}|T]) -> - io:format("checked - ~s~n", [Op]), - lists:all(?checktc(Op), [RetType|InParameters]), - lists:all(?checktc(Op), OutParameters), - check_tc(T). - - diff --git a/lib/cosTransactions/test/transactions_SUITE.erl b/lib/cosTransactions/test/transactions_SUITE.erl deleted file mode 100644 index 00753a4e6e..0000000000 --- a/lib/cosTransactions/test/transactions_SUITE.erl +++ /dev/null @@ -1,396 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(transactions_SUITE). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). - -%% Local --include_lib("cosTransactions/src/ETraP_Common.hrl"). --include_lib("cosTransactions/include/CosTransactions.hrl"). --include("etrap_test_lib.hrl"). - --include_lib("common_test/include/ct.hrl"). - --define(default_timeout, test_server:minutes(20)). - - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, cases/0, - init_per_suite/1, end_per_suite/1, resource_api/1, etrap_api/1, - init_per_testcase/2, end_per_testcase/2, app_test/1]). - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - cases(). - -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -cases() -> - [etrap_api, resource_api, app_test]. - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- -init_per_testcase(_Case, Config) -> - Path = code:which(?MODULE), - code:add_pathz(filename:join(filename:dirname(Path), "idl_output")), - 'oe_CosTransactions':'oe_register'(), - 'oe_etrap_test':'oe_register'(), - Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. - - -end_per_testcase(_Case, Config) -> - 'oe_etrap_test':'oe_unregister'(), - 'oe_CosTransactions':'oe_unregister'(), - Path = code:which(?MODULE), - code:del_path(filename:join(filename:dirname(Path), "idl_output")), - Dog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(Dog), - ok. - -init_per_suite(Config) -> - mnesia:delete_schema([node()]), - mnesia:create_schema([node()]), - orber:install([node()]), - application:start(mnesia), - application:start(orber), - if - is_list(Config) -> - Config; - true -> - exit("Config not a list") - end. - -end_per_suite(Config) -> - application:stop(orber), - application:stop(mnesia), - mnesia:delete_schema([node()]), - Config. - -%%----------------------------------------------------------------- -%% Tests app file -%%----------------------------------------------------------------- -app_test(_Config) -> - ok=test_server:app_test(cosTransactions), - ok. - -%%----------------------------------------------------------------- -%% API tests -%%----------------------------------------------------------------- -etrap_api(_Config) -> - ?match(ok, application:start(cosTransactions), - "Starting the cosTransactions application"), - TrFac = cosTransactions:start_factory(), - %% Start a new transaction: - %% RootCoord - %% / \ - %% SubCoord1 SubCoord2 - Control = 'CosTransactions_TransactionFactory':create(TrFac, 0), - Term = 'CosTransactions_Control':get_terminator(Control), - Coord = 'CosTransactions_Control':get_coordinator(Control), - SubCont1 = 'CosTransactions_Coordinator':create_subtransaction(Coord), - SubCont2 = 'CosTransactions_Coordinator':create_subtransaction(Coord), - SubCoord1 = 'CosTransactions_Control':get_coordinator(SubCont1), - SubCoord2 = 'CosTransactions_Control':get_coordinator(SubCont2), - - - %%------ Test CosTransactions::Coordinator ------ - ?match(true, - 'CosTransactions_Coordinator':is_same_transaction(Coord, Coord), - "'CosTransactions_Coordinator':is_same_transaction"), - ?match(false, - 'CosTransactions_Coordinator':is_same_transaction(Coord, SubCoord1), - "'CosTransactions_Coordinator':is_same_transaction"), - ?match(true, - 'CosTransactions_Coordinator':is_descendant_transaction(Coord, Coord), - "'CosTransactions_Coordinator':is_descendant_transaction"), - ?match(false, - 'CosTransactions_Coordinator':is_descendant_transaction(Coord, SubCoord1), - "'CosTransactions_Coordinator':is_descendant_transaction"), - ?match(true, - 'CosTransactions_Coordinator':is_descendant_transaction(SubCoord1, Coord), - "'CosTransactions_Coordinator':is_descendant_transaction"), - ?match(false, - 'CosTransactions_Coordinator':is_descendant_transaction(SubCoord1, SubCoord2), - "'CosTransactions_Coordinator':is_descendant_transaction"), - ?match(true, - 'CosTransactions_Coordinator':is_top_level_transaction(Coord), - "'CosTransactions_Coordinator':is_top_level_transaction"), - ?match(false, - 'CosTransactions_Coordinator':is_top_level_transaction(SubCoord2), - "'CosTransactions_Coordinator':is_top_level_transaction"), - - RootHash = 'CosTransactions_Coordinator':hash_transaction(Coord), - RepeatHash= 'CosTransactions_Coordinator':hash_transaction(Coord), - RootHash2 = 'CosTransactions_Coordinator':hash_top_level_tran(SubCoord1), - RootHash3 = 'CosTransactions_Coordinator':hash_top_level_tran(Coord), - _SubHash = 'CosTransactions_Coordinator':hash_transaction(SubCoord2), - ?match(RootHash, RepeatHash, - "'CosTransactions_Coordinator':hash_transaction"), - ?match(RootHash, RootHash2, - "'CosTransactions_Coordinator':hash_top_level_tran"), - ?match(RootHash, RootHash3, - "'CosTransactions_Coordinator':hash_top_level_tran"), -% ?match_inverse(RootHash, SubHash, -% "'CosTransactions_Coordinator':hash_transaction"), - - ?match('StatusActive', - 'CosTransactions_Coordinator':get_status(Coord), - "'CosTransactions_Coordinator':get_status"), - ?match('StatusActive', - 'CosTransactions_Coordinator':get_status(SubCoord1), - "'CosTransactions_Coordinator':get_status"), - ?match('StatusActive', - 'CosTransactions_Coordinator':get_parent_status(Coord), - "'CosTransactions_Coordinator':get_parent_status"), - ?match('StatusActive', - 'CosTransactions_Coordinator':get_parent_status(SubCoord1), - "'CosTransactions_Coordinator':get_parent_status"), - ?match('StatusActive', - 'CosTransactions_Coordinator':get_top_level_status(Coord), - "'CosTransactions_Coordinator':get_top_level_status"), - ?match('StatusActive', - 'CosTransactions_Coordinator':get_top_level_status(SubCoord1), - "'CosTransactions_Coordinator':get_top_level_status"), - - %% Create a CosTransactions::Resource to experiments with. - %% Start a new transaction: - %% RootCoord - %% / \ - %% SubCoord1 SubCoord2 - %% / - %% Resource - N1 = 'ETraP_Common':create_name("test"), - O1 = etrap_test_server:oe_create(?nop, {global, N1}), - _RC1 = 'CosTransactions_Coordinator':register_resource(SubCoord1, O1), -% 'CosTransactions_Coordinator':register_synchronization(SubCoord1, O1), - - ?match('VoteCommit', - 'CosTransactions_Resource':prepare(SubCoord1), - "'CosTransactions_Coordinator':prepare"), - %% The Transaction are no longer in 'StatusActive' state. No new - %% "members" allowed. - ?match('StatusPrepared', - 'CosTransactions_Coordinator':get_status(SubCoord1), - "'CosTransactions_Coordinator':get_status"), -% ?match({'EXCEPTION', ?tr_inactive}, -% 'CosTransactions_Coordinator':register_synchronization(SubCoord1, O1), -% "'CosTransactions_Coordinator':register_synchronization"), - ?match({'EXCEPTION', ?tr_inactive}, - 'CosTransactions_Coordinator':register_resource(SubCoord1, O1), - "'CosTransactions_Coordinator':register_resource"), - ?match({'EXCEPTION', ?tr_inactive}, - 'CosTransactions_Coordinator':create_subtransaction(SubCoord1), - "'CosTransactions_Coordinator':create_subtransaction"), - - catch corba:dispose(SubCoord1), - catch corba:dispose(SubCoord2), - catch corba:dispose(SubCont1), - catch corba:dispose(SubCont2), - catch corba:dispose(Term), - catch corba:dispose(Control), - catch corba:dispose(Coord), - catch corba:dispose(O1), - - cosTransactions:stop_factory(TrFac), - application:stop(cosTransactions), - ok. - -%%----------------------------------------------------------------- -%% API tests -%%----------------------------------------------------------------- -resource_api(_Config) -> - ?match(ok, application:start(cosTransactions), - "Starting the cosTransactions application"), - TrFac = cosTransactions:start_factory([{typecheck, true}]), - - ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - run(TrFac, 0, {?nop, ?nop, ?nop, ?prepare_rollback}), - "TESTCASE #1: Prepare rollback Resource 4"), - ?match({'EXCEPTION', ?tr_mixed}, - run(TrFac, 0, {?nop, ?nop, ?commit_mix, ?nop}), - "TESTCASE #2: Heuristic Mixed exception Resource 3"), - ?match(ok, - run(TrFac, 0, {?nop, ?nop, ?nop, ?nop}), - "TESTCASE #3: Normal completion. No errors."), - ?match(ok, - run(TrFac, 0, {?nop, ?nop, ?nop, ?commit_cm}), - "TESTCASE #4: Heuristic Commit Exception Resource 4"), - ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - run(TrFac, 0, {?nop, ?rollback_rb, ?nop, ?prepare_rollback}), - "TESTCASE #5: Heuristic Rollbac Resource 2, Resource 4 reply 'VoteRollback'"), - ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - run(TrFac, 0, {?nop, ?nop, ?prepare_rollback, ?rollback_rb}), - "TESTCASE #6: Heuristic Rollbac Resource 4, Resource 3 reply 'VoteRollback'"), - ?match(ok, - run(TrFac, 0, {?nop, ?nop, ?commit_delay, ?nop}), - "TESTCASE #7: Resource 3 delay during commit. No timeout."), - ?match(ok, - run(TrFac, 0, {?nop, ?nop, ?prepare_delay, ?nop}), - "TESTCASE #8: Resource 3 delay during prepare. No timeout."), - ?match(ok, - run(TrFac, ?TIMEOUT, {?nop, ?commit_delay, ?nop, ?nop}), - "TESTCASE #9: Resource 3 delay during commit. Timeout."), - ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - run(TrFac, ?TIMEOUT, {?nop, ?prepare_delay, ?nop, ?nop}), - "TESTCASE #10: Resource 3 delay during prepare. Timeout."), - case ?is_debug_compiled of - true -> - %% Testing the Coordinators (root and sub). - ?match(ok, - run(TrFac, 0, {?nop, ?nop, ?nop, ?nop, [?nop, ?nop,?crash_transient(commit), ?nop]}), - "TESTCASE #11: SubCoord 3 crash transient during commit."), - ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{}}, - run(TrFac, 0, {?nop, ?nop, ?nop, ?nop, [?nop, ?nop,?crash_transient(send_prepare), ?nop]}), - "TESTCASE #12: SubCoord 3 crash transient during send prepare."), - ?match({'EXCEPTION', ?tr_hazard}, - run(TrFac, 0, {?nop, ?nop, ?nop, ?nop, [?nop, ?nop,?crash_permanent(commit), ?nop]}), - "TESTCASE #13: SubCoord 3 crash permanent during commit."), - ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{}}, - run(TrFac, 0, {?nop, ?nop, ?nop, ?nop, [?nop, ?nop,?crash_permanent(send_prepare), ?nop]}), - "TESTCASE #14: SubCoord 3 crash permanent during prepare."), - ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{}}, - run(TrFac, 0, {?nop, ?nop, ?nop, ?nop, [?nop, ?crash_transient(send_prepare), ?crash_transient(commit), ?nop]}), - "TESTCASE #15: SubCoord 2 crash transient during prepare. SubCoord 3 crash transient during commit"), - ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - run(TrFac, 0, {?nop, ?nop, ?nop, ?nop, [?crash_transient(send_prepare), ?nop, ?nop, ?nop]}), - "TESTCASE #16: RootCoord crash transient during send prepare."), - ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{}}, - run(TrFac, 0, {?nop, ?nop, ?nop, ?nop, [?nop, ?crash_transient(prepare1), ?nop, ?nop]}), - "TESTCASE #17: SubCoord 1 crash transient during prepare1."), - ?match({'EXCEPTION', ?tr_mixed}, - run(TrFac, 0, {?nop, ?prepare_mix, ?nop, ?nop, [?nop, ?nop, ?crash_transient(prepare2), ?nop]}), - "TESTCASE #18: SubCoord 3 crash transient during prepare2. Resource 2 raise Heuristic Mixed during prepare"), - ?match({'EXCEPTION', ?tr_mixed}, - run(TrFac, 0, {?nop, ?commit_mix, ?nop, ?nop, [?nop, ?nop, ?crash_transient(commit2), ?nop]}), - "TESTCASE #19: Resource 2 raise Heurist mixed during commit. SubCoord crash transient commit2"), - ?match({'EXCEPTION', ?tr_mixed}, - run(TrFac, 0, {?nop, ?rollback_cm, ?nop, ?prepare_rollback, [?nop, ?crash_transient(rollback2), ?nop, ?nop]}), - "TESTCASE #20: Resource 2 raise Heuristic Commit during rollback. Resource 4 'VoteRollback'. SubCoord 2 crash transient rollback2."), - ?match({'EXCEPTION', ?tr_mixed}, - run(TrFac, 0, {?nop, ?nop, ?nop, ?commit_mix, [?nop, ?nop, ?crash_transient(send_forget1), ?nop]}), - "TESTCASE #21: Resource 4 raise Heuristic Mixed during commit. SubCoord 2 crash transient send_forget1."), - ?match({'EXCEPTION', ?tr_mixed}, - run(TrFac, 0, {?nop, ?nop, ?nop, ?commit_mix, [?crash_transient(send_forget1), ?nop, ?nop, ?nop]}), - "TESTCASE #22: Resource 4 raise Heuristic Mixed during commit. Root Coord crash transient send_forget1."), - ?match({'EXCEPTION', ?tr_mixed}, - run(TrFac, 0, {?nop, ?nop, ?nop, ?commit_mix, [?crash_transient(send_forget3), ?nop, ?crash_transient(send_forget1), ?nop]}), - "TESTCASE #23: Resource 4 raise Heuristic Mixed during commit. Root Coord crash transient send_forget3. SubCoord 3 crash transient send_forget1."), - ?match({'EXCEPTION', #'TRANSACTION_ROLLEDBACK'{completion_status=?COMPLETED_YES}}, - run(TrFac, ?TIMEOUT, {?nop, ?nop, ?nop, ?nop, [?delay_transient(root_delay, ?TIMEOUT*2), ?nop, ?nop, ?nop]}), - "TESTCASE #24: Delay RootCoord. Timeout."), - %% Testing the Terminator. - ?match({'EXCEPTION', ?tr_mixed}, - run(TrFac, ?TIMEOUT, {?nop, ?prepare_mix, ?nop, ?nop, [?nop, ?nop, ?nop, ?crash_transient(commit_heuristic1)]}), - "TESTCASE #25: Terminator crash transient after received and logged Heuristic mix."), - ?match(ok, - run(TrFac, ?TIMEOUT, {?nop, ?nop, ?nop, ?nop, [?nop, ?nop, ?nop, ?crash_transient(commit_ok2)]}), - "TESTCASE #26: Terminator crash transient after received and logged 'ok'."); - _ -> - ok - end, - - cosTransactions:stop_factory(TrFac), - application:stop(cosTransactions), - ok. - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- - -run(TrFac, Time, Spec) -> - Control = 'CosTransactions_TransactionFactory':create(TrFac, Time), - Term = 'CosTransactions_Control':get_terminator(Control), - Coord = 'CosTransactions_Control':get_coordinator(Control), - SubCont1 = 'CosTransactions_Coordinator':create_subtransaction(Coord), - SubCont2 = 'CosTransactions_Coordinator':create_subtransaction(Coord), - SubCoord1 = 'CosTransactions_Control':get_coordinator(SubCont1), - SubCoord2 = 'CosTransactions_Control':get_coordinator(SubCont2), - %% Start resources/participants. - {O1, O2, O3, O4, Ctx} = start_resources(Spec), - - %% Get generated names to use for debugging. - CoordN = 'CosTransactions_Coordinator':get_transaction_name(Coord), - SubC1N = 'CosTransactions_Coordinator':get_transaction_name(SubCoord1), - SubC2N = 'CosTransactions_Coordinator':get_transaction_name(SubCoord2), - - ?set_debug_context([CoordN, SubC1N, SubC2N, Term], Ctx), - - %% Register the resources as participants. - _RC1 = 'CosTransactions_Coordinator':register_resource(SubCoord1, O1), - _RC2 = 'CosTransactions_Coordinator':register_resource(SubCoord1, O2), - _RC3 = 'CosTransactions_Coordinator':register_resource(SubCoord2, O3), - _RC4 = 'CosTransactions_Coordinator':register_resource(SubCoord2, O4), - - 'CosTransactions_Coordinator':register_subtran_aware(SubCoord1, O4), -% 'CosTransactions_Coordinator':register_synchronization(SubCoord1, O2), - -% Reply = (catch 'CosTransactions_Terminator':commit(Term, true)), - Reply = (catch 'ETraP_Common':send_stubborn('CosTransactions_Terminator', - commit, [Term, true], - ?tr_max_retries, - ?tr_comm_failure_wait)), - - catch corba:dispose(SubCoord1), - catch corba:dispose(SubCoord2), - catch corba:dispose(SubCont1), - catch corba:dispose(SubCont2), - catch corba:dispose(Term), - catch corba:dispose(Control), - catch corba:dispose(Coord), - catch corba:dispose(O1), - catch corba:dispose(O2), - catch corba:dispose(O3), - catch corba:dispose(O4), - Reply. - -start_resources({A1, A2, A3, A4})-> - start_resources({A1, A2, A3, A4, ?no_context}); -start_resources({A1, A2, A3, A4, Ctx})-> - N1 = 'ETraP_Common':create_name("test"), - N2 = 'ETraP_Common':create_name("test"), - N3 = 'ETraP_Common':create_name("test"), - N4 = 'ETraP_Common':create_name("test"), - {_,_,O1} = supervisor:start_child(?SUPERVISOR_NAME, ?SUP_TEST(A1, N1)), - {_,_,O2} = supervisor:start_child(?SUPERVISOR_NAME, ?SUP_TEST(A2, N2)), -% {_,_,O2} = supervisor:start_child(?SUPERVISOR_NAME, ?SUP_TEST([{sync,true}|A2], N2)), - {_,_,O3} = supervisor:start_child(?SUPERVISOR_NAME, ?SUP_TEST(A3, N3)), - {_,_,O4} = supervisor:start_child(?SUPERVISOR_NAME, ?SUP_TEST(A4, N4)), - {O1, O2, O3, O4, Ctx}. diff --git a/lib/cosTransactions/vsn.mk b/lib/cosTransactions/vsn.mk deleted file mode 100644 index bba2058231..0000000000 --- a/lib/cosTransactions/vsn.mk +++ /dev/null @@ -1 +0,0 @@ -COSTRANSACTIONS_VSN = 1.3.3 diff --git a/lib/ic/AUTHORS b/lib/ic/AUTHORS deleted file mode 100644 index f3791aabaa..0000000000 --- a/lib/ic/AUTHORS +++ /dev/null @@ -1,8 +0,0 @@ -Original Authors: - -Peter Lundel -Lars Thorsen -Babbis Xagorarakis - - -Contributors: diff --git a/lib/ic/Makefile b/lib/ic/Makefile deleted file mode 100644 index 624aa62a6e..0000000000 --- a/lib/ic/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1998-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include vsn.mk -VSN=$(ORBER_VSN) - -# ---------------------------------------------------- -# Common Macros -# ---------------------------------------------------- - -SUB_DIRECTORIES = src c_src java_src doc/src examples/pre_post_condition - -SPECIAL_TARGETS = - -# ---------------------------------------------------- -# Default Subdir Targets -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_subdir.mk - diff --git a/lib/ic/c_src/Makefile b/lib/ic/c_src/Makefile deleted file mode 100644 index 35d6013279..0000000000 --- a/lib/ic/c_src/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1998-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -# -# Invoke with GNU make or clearmake -C gnu. -# - -include $(ERL_TOP)/make/run_make.mk diff --git a/lib/ic/c_src/Makefile.in b/lib/ic/c_src/Makefile.in deleted file mode 100644 index c0dad59557..0000000000 --- a/lib/ic/c_src/Makefile.in +++ /dev/null @@ -1,165 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1998-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -CC = @CC@ -LIBS = @LIBS@ - -LIBDIR = ../priv/lib/$(TARGET) -OBJDIR = ../priv/obj/$(TARGET) -INCDIR = ../include -ERL_INTERFACE_FLAGS = \ - -I$(ERL_TOP)/lib/erl_interface/include \ - -I$(ERL_TOP)/lib/erl_interface/src - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(IC_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/ic-$(VSN) - -# ---------------------------------------------------- -# File Specs -# ---------------------------------------------------- - -IDL_FILES = \ - $(INCDIR)/erlang.idl - -ifeq ($(findstring win32,$(TARGET)),win32) -USING_MINGW=@MIXED_CYGWIN_MINGW@ -ifeq ($(USING_MINGW),yes) -AR_OUT = rcv -CC_FLAGS = -LIBRARY = $(LIBDIR)/libic.a -SKIP_BUILDING_BINARIES := false -else -LIBRARY = $(LIBDIR)/ic.lib -AR_OUT = -out: -CC_FLAGS = -MT -endif -ifeq ($(HOST_OS),) -HOST_OS := $(shell $(ERL_TOP)/erts/autoconf/config.guess) -endif -ifeq ($(findstring solaris,$(HOST_OS)),solaris) -SKIP_BUILDING_BINARIES := true -endif -else -ifeq ($(V),0) -AR_OUT = rc -else -AR_OUT = rcv -endif -CC_FLAGS = @DED_CFLAGS@ -LIBRARY = $(LIBDIR)/libic.a -SKIP_BUILDING_BINARIES := false -endif - -C_FILES = \ - ic.c \ - ic_tmo.c \ - oe_ei_encode_version.c \ - oe_ei_encode_long.c \ - oe_ei_encode_ulong.c \ - oe_ei_encode_double.c \ - oe_ei_encode_char.c \ - oe_ei_encode_string.c \ - oe_ei_encode_atom.c \ - oe_ei_encode_pid.c \ - oe_ei_encode_port.c \ - oe_ei_encode_ref.c \ - oe_ei_encode_term.c \ - oe_ei_encode_tuple_header.c \ - oe_ei_encode_list_header.c \ - oe_ei_encode_longlong.c \ - oe_ei_encode_ulonglong.c \ - oe_ei_encode_wchar.c \ - oe_ei_encode_wstring.c \ - oe_ei_decode_longlong.c \ - oe_ei_decode_ulonglong.c \ - oe_ei_decode_wchar.c \ - oe_ei_decode_wstring.c \ - oe_ei_code_erlang_binary.c - -H_FILES = $(INCDIR)/ic.h - -OBJ_FILES= $(C_FILES:%.c=$(OBJDIR)/%.o) - -ALL_CFLAGS = @CFLAGS@ @DEFS@ -I$(INCDIR) $(ERL_INTERFACE_FLAGS) $(CFLAGS) - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- - -ifeq ($(SKIP_BUILDING_BINARIES), true) -debug opt: -else -debug opt: $(LIBRARY) -endif - -clean: - rm -f $(LIBRARY) $(OBJ_FILES) - rm -f core *~ - -docs: - -# ---------------------------------------------------- -# Special Build Targets -# ---------------------------------------------------- - -_create_dirs := $(shell mkdir -p $(OBJDIR) $(LIBDIR)) - -$(LIBRARY): $(OBJ_FILES) - -$(V_AR) $(AR_OUT) $@ $(OBJ_FILES) - -$(V_RANLIB) $@ - -$(OBJDIR)/%.o: %.c - $(V_CC) $(CC_FLAGS) -c -o $@ $(ALL_CFLAGS) $< - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)/c_src" - $(INSTALL_DIR) "$(RELSYSDIR)/include" - $(INSTALL_DIR) "$(RELSYSDIR)/priv/lib" - $(INSTALL_DIR) "$(RELEASE_PATH)/usr/include" - $(INSTALL_DIR) "$(RELEASE_PATH)/usr/lib" - $(INSTALL_DATA) ic.c ic_tmo.c "$(RELSYSDIR)/c_src" - $(INSTALL_DATA) $(IDL_FILES) $(H_FILES) "$(RELSYSDIR)/include" - $(INSTALL_DATA) $(LIBRARY) "$(RELSYSDIR)/priv/lib" - $(INSTALL_DATA) $(IDL_FILES) $(H_FILES) "$(RELEASE_PATH)/usr/include" - $(INSTALL_DATA) $(LIBRARY) "$(RELEASE_PATH)/usr/lib" - -release_docs_spec: - - - - - - diff --git a/lib/ic/c_src/Makefile.win32 b/lib/ic/c_src/Makefile.win32 deleted file mode 100644 index 670a17f958..0000000000 --- a/lib/ic/c_src/Makefile.win32 +++ /dev/null @@ -1,109 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# - -CC = cl.exe -LIBRARIAN = lib.exe /nologo - -IC_INCLUDE = ..\include -EI_INCLUDE = \erts\lib\erl_interface\src - -CFLAGS = /MT /nologo /Ox /I$(IC_INCLUDE) /I$(EI_INCLUDE) -TARGET = win32 -OBJDIR = ..\priv\obj\$(TARGET) -LIBDIR = ..\priv\lib\$(TARGET) - - -C_FILES = \ - ic.c \ - oe_ei_encode_version.c \ - oe_ei_encode_long.c \ - oe_ei_encode_ulong.c \ - oe_ei_encode_double.c \ - oe_ei_encode_char.c \ - oe_ei_encode_string.c \ - oe_ei_encode_atom.c \ - oe_ei_encode_pid.c \ - oe_ei_encode_port.c \ - oe_ei_encode_ref.c \ - oe_ei_encode_term.c \ - oe_ei_encode_tuple_header.c \ - oe_ei_encode_list_header.c \ - oe_ei_encode_longlong.c \ - oe_ei_encode_ulonglong.c \ - oe_ei_encode_wchar.c \ - oe_ei_encode_wstring.c \ - oe_ei_decode_longlong.c \ - oe_ei_decode_ulonglong.c \ - oe_ei_decode_wchar.c \ - oe_ei_decode_wstring.c - -OBJ_FILES = \ - $(OBJDIR)\ic.obj \ - $(OBJDIR)\oe_ei_encode_version.obj \ - $(OBJDIR)\oe_ei_encode_long.obj \ - $(OBJDIR)\oe_ei_encode_ulong.obj \ - $(OBJDIR)\oe_ei_encode_double.obj \ - $(OBJDIR)\oe_ei_encode_char.obj \ - $(OBJDIR)\oe_ei_encode_string.obj \ - $(OBJDIR)\oe_ei_encode_atom.obj \ - $(OBJDIR)\oe_ei_encode_pid.obj \ - $(OBJDIR)\oe_ei_encode_port.obj \ - $(OBJDIR)\oe_ei_encode_ref.obj \ - $(OBJDIR)\oe_ei_encode_term.obj \ - $(OBJDIR)\oe_ei_encode_tuple_header.obj \ - $(OBJDIR)\oe_ei_encode_list_header.obj \ - $(OBJDIR)\oe_ei_encode_longlong.obj \ - $(OBJDIR)\oe_ei_encode_ulonglong.obj \ - $(OBJDIR)\oe_ei_encode_wchar.obj \ - $(OBJDIR)\oe_ei_encode_wstring.obj \ - $(OBJDIR)\oe_ei_decode_longlong.obj \ - $(OBJDIR)\oe_ei_decode_ulonglong.obj \ - $(OBJDIR)\oe_ei_decode_wchar.obj \ - $(OBJDIR)\oe_ei_decode_wstring.obj - - -LIBRARY = $(LIBDIR)\ic.lib - - -all: $(OBJDIR) $(LIBDIR) $(LIBRARY) - -release: - echo "Nothing to do" - -clean: - -del $(OBJ_FILES) $(LIBRARY) - -$(LIBRARY): $(OBJ_FILES) - $(LIBRARIAN) /OUT:$@ $** - -{}.c{$(OBJDIR)}.obj: - $(CC) $(CFLAGS) /c /Fo$@ $< - -$(OBJDIR): - -mkdir $(OBJDIR) - -$(LIBDIR): - -mkdir $(LIBDIR) - -$(LIBRARY): - - -{}.c: $(EI_INCLUDE)\ei.h $(IC_INCLUDE)\ic. diff --git a/lib/ic/c_src/ic.c b/lib/ic/c_src/ic.c deleted file mode 100644 index 6e55a13f4f..0000000000 --- a/lib/ic/c_src/ic.c +++ /dev/null @@ -1,613 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1998-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - -static int oe_send(CORBA_Environment *env); - -void CORBA_free(void *p) -{ - if (p != NULL) - free(p); -} - - -CORBA_char *CORBA_string_alloc(CORBA_unsigned_long len) -{ - return (CORBA_char *) malloc(len+1); -} - - -CORBA_wchar *CORBA_wstring_alloc(CORBA_unsigned_long len) -{ - return (CORBA_wchar *) malloc(len*(__OE_WCHAR_SIZE_OF__+1)); -} - - -CORBA_Environment *CORBA_Environment_alloc(int inbufsz, int outbufsz) -{ - CORBA_Environment *env; - - env = malloc(sizeof(CORBA_Environment)); - - if (env != NULL) { - - /* CORBA */ - env->_major = CORBA_NO_EXCEPTION; - - /* Set by user */ - env->_fd= -1; - env->_inbufsz = inbufsz; - env->_inbuf = malloc(inbufsz); - env->_outbufsz = outbufsz; - env->_outbuf = malloc(outbufsz); - env->_memchunk = __OE_MEMCHUNK__; - env->_regname[0] = '\0'; - env->_to_pid = NULL; - env->_from_pid = NULL; - - /* Set by client or server */ - env->_iin = 0; - env->_iout = 0; - env->_operation[0] = '\0'; - env->_received = 0; - /* env->_caller */ - /* env->_unique */ - env->_exc_id = NULL; - env->_exc_value = NULL; - env->_ref_counter_1 = 0; - env->_ref_counter_2 = 0; - env->_ref_counter_3 = 0; - } - - return env; -} - -#if 0 -/* NOT EXPORTED SO FAR */ -void CORBA_Environment_free(CORBA_Environment *env) -{ - - CORBA_free(env->_inbuf); - CORBA_free(env->_outbuf); - CORBA_exception_free(env); - CORBA_free(env); -} -#endif - - -CORBA_char *CORBA_exception_id(CORBA_Environment *env) -{ - - return env->_exc_id; -} - -void *CORBA_exception_value(CORBA_Environment *env) -{ - - return env->_exc_value; -} - -void CORBA_exception_free(CORBA_Environment *env) -{ - - /* Setting major value */ - env->_major=CORBA_NO_EXCEPTION; - - /* Freeing storage */ - CORBA_free(env->_exc_id); - CORBA_free(env->_exc_value); - env->_exc_id = env->_exc_value = NULL; -} - -void CORBA_exc_set(CORBA_Environment *env, - CORBA_exception_type Major, - CORBA_char *Id, - CORBA_char *Value) -{ - int ilen,vlen; - - /* Create exception only if exception not already set */ - if (env->_major == CORBA_NO_EXCEPTION) { - - /* Counting lengths */ - ilen = strlen(Id)+1; - vlen = strlen(Value)+1; - - /* Allocating storage */ - env->_exc_id = (CORBA_char *) malloc(ilen); - env->_exc_value = (CORBA_char *) malloc(vlen); - - /* Initiating */ - env->_major = Major; - strcpy(env->_exc_id,Id); - strcpy(env->_exc_value,Value); - } -} - -#define ERLANG_REF_NUM_SIZE 18 -#define ERLANG_REF_MASK (~(~((unsigned int)0) << ERLANG_REF_NUM_SIZE)) - -/* Initiating message reference */ -void ic_init_ref(CORBA_Environment *env, erlang_ref *ref) -{ - - strcpy(ref->node, erl_thisnodename()); - - ref->len = 3; - - ++env->_ref_counter_1; - env->_ref_counter_1 &= ERLANG_REF_MASK; - if (env->_ref_counter_1 == 0) - if (++env->_ref_counter_2 == 0) - ++env->_ref_counter_3; - ref->n[0] = env->_ref_counter_1; - ref->n[1] = env->_ref_counter_2; - ref->n[2] = env->_ref_counter_3; - - ref->creation = erl_thiscreation(); -} - -/* Comparing message references */ -int ic_compare_refs(erlang_ref *ref1, erlang_ref *ref2) -{ - int i; - - if(strcmp(ref1->node, ref2->node) != 0) - return -1; - - if (ref1->len != ref2->len) - return -1; - - for (i = 0; i < ref1->len; i++) - if (ref1->n[i] != ref2->n[i]) - return -1; - - return 0; -} - -/* Length counter for wide strings */ -int ic_wstrlen(CORBA_wchar * p) -{ - int len = 0; - - while(1) { - if (p[len] == 0) - return len; - - len+=1; - } -} - - -/* Wide string compare function */ -int ic_wstrcmp(CORBA_wchar * ws1, CORBA_wchar * ws2) -{ - int index = 0; - - while(1) { - if (ws1[index] == ws2[index]) { - - if (ws1[index] == 0) - return 0; - - index += 1; - - } else - return -1; - } -} - -/* For backward compatibility -- replaced by prepare_request_decoding() */ -int ___call_info___(CORBA_Object obj, CORBA_Environment *env) -{ - return oe_prepare_request_decoding(env); -} - -/* #define DEBUG_MAP */ - -#if defined(DEBUG_MAP) - -#define PRINT_MAPS(P, M, S) print_maps(P, M, S) -#define PRINT_MAP(T, M) print_map(T, "", M) - -static void print_map(char *title, char *prefix, oe_map_t *map) -{ - if (map == NULL) { - fprintf(stdout, "%s => NULL\n", title); - return; - } - - fprintf(stdout, "%s%s\n", prefix, title); - - { - int j, len = map->length; - - fprintf(stdout, "%s length: %d\n", prefix, len); - fprintf(stdout, "%s operations: 0x%X%d\n", prefix, map->operations); - - for (j = 0 ; j < len ; j++) { - fprintf(stdout, "%s operation[%d]:\n", prefix, j); - - if (map->operations[j].interface != NULL) { - fprintf(stdout, "%s intf: %s\n", prefix, - map->operations[j].interface); - } else { - fprintf(stdout, "%s intf: NULL\n", prefix); - } - fprintf(stdout, "%s name: %s\n", prefix, - map->operations[j].name); - fprintf(stdout, "%s func: 0x%X\n", prefix, - map->operations[j].function); - } - } - fflush(stdout); -} - -static void print_maps(char* title, oe_map_t * maps, int size) -{ - int i; - char p[64]; - - fprintf(stdout, "%s\n", title); - - for (i = 0 ; i < size ; i++) { - sprintf(p, "map[%d]:", i); - print_map(p, " ", &maps[i]); - } - fprintf(stdout, "\n"); - fflush(stdout); -} - -#else - -#define PRINT_MAPS(P, M, S) -#define PRINT_MAP(T, M) - -#endif /* if defined(DEBUG_MAP) */ - - -/* Generic server switch */ -int oe_exec_switch(CORBA_Object obj, CORBA_Environment *env, oe_map_t *map) -{ - /* Setting local variables */ - int res = 0; - int index = 0; - - /* XXX map may be NULL !! */ - int length = map->length; - char* op = env->_operation; - - PRINT_MAP("switching on map", map); - - /* Initiating exception indicator */ - env->_major = CORBA_NO_EXCEPTION; - - if ((res = oe_prepare_request_decoding(env) < 0)) - return res; -#if defined(DEBUG_MAP) - fprintf(stdout, "looking for operation: %s\n", op); fflush(stdout); -#endif - for (index = 0; index < length; index++) { -#if defined(DEBUG_MAP) - fprintf(stdout, "map->operations[%d].name: %s\n", - index, map->operations[index].name); - fflush(stdout); -#endif - if(strcmp(map->operations[index].name, op) == 0) { -#if defined(DEBUG_MAP) - fprintf(stdout, "calling map->operations[%d].function: 0x%X\n", - index, map->operations[index].function); - fflush(stdout); -#endif - return map->operations[index].function(obj, env); - } - } - /* Bad call */ - CORBA_exc_set(env, CORBA_SYSTEM_EXCEPTION, BAD_OPERATION, - "Invalid operation"); - return -1; -} - -/* For backward compatibility */ -int ___switch___(CORBA_Object obj, CORBA_Environment *env, oe_map_t *map) -{ - return oe_exec_switch(obj, env, map); -} - - -oe_map_t* oe_merge_maps(oe_map_t *maps, int size) -{ - int i, j, length, len, maplen, malloc_size; - void *memp; - oe_map_t *merged; - - if ((maps == NULL) || (size <= 0)) - return NULL; - - PRINT_MAPS("merging maps", maps, size); - - length = 0; - for (i = 0; i < size; i++) - length += (maps[i].length); - - maplen = OE_ALIGN(sizeof(oe_map_t)); - malloc_size = maplen + OE_ALIGN(length*sizeof(oe_operation_t)); - if ((memp = malloc(malloc_size)) == NULL) - return NULL; - - merged = memp; - merged->length = length; - merged->operations = (oe_operation_t *)((char*)memp + maplen); - - for (i = 0, len = 0; i < size; i++) { - for(j = 0 ; j < maps[i].length; j++) - merged->operations[len+j] = maps[i].operations[j]; - len += maps[i].length; - } - PRINT_MAP("merged map", merged); - return merged; -} - -/* For backward compatibility */ -oe_map_t* ___merge___(oe_map_t *maps, int size) -{ - return oe_merge_maps(maps, size); -} - -/* Client send message (Erlang distribution protocol) */ -static int oe_send(CORBA_Environment *env) -{ - if (strlen(env->_regname) == 0) { - if (ei_send_encoded(env->_fd, env->_to_pid, env->_outbuf, - env->_iout) < 0) { - /* XXX Cannot send to peer? */ - CORBA_exc_set(env, CORBA_SYSTEM_EXCEPTION, NO_RESPONSE, - "Cannot connect to server"); - return -1; - } - } else { - if (ei_send_reg_encoded(env->_fd, env->_from_pid, - env->_regname, env->_outbuf, - env->_iout) < 0) { - /* XXX Cannot send to peer? */ - CORBA_exc_set(env, CORBA_SYSTEM_EXCEPTION, NO_RESPONSE, - "Cannot connect to server"); - return -1; - } - } - return 0; -} - -/* Send notification (gen_server client) */ -int oe_send_notification(CORBA_Environment *env) -{ - return oe_send(env); -} - -/* Send request and receive reply (gen_server client) */ -int oe_send_request_and_receive_reply(CORBA_Environment *env) -{ - int msgType = 0; - erlang_msg msg; - - if (oe_send(env) < 0) - return -1; - - do { - if ((msgType = ei_receive_encoded(env->_fd, - &env->_inbuf, - &env->_inbufsz, - &msg, &env->_iin)) < 0) { - CORBA_exc_set(env, CORBA_SYSTEM_EXCEPTION, MARSHAL, - "Cannot decode message"); - return -1; - } - } while (msgType != ERL_SEND && msgType != ERL_REG_SEND); - - /* Extracting return message header */ - if (oe_prepare_reply_decoding(env) < 0) { - CORBA_exc_set(env, CORBA_SYSTEM_EXCEPTION, MARSHAL, "Bad message"); - return -1; - } - return 0; -} - -/* Prepare notification encoding (gen_server client) */ -int oe_prepare_notification_encoding(CORBA_Environment *env) -{ - env->_iout = 0; - oe_ei_encode_version(env); - oe_ei_encode_tuple_header(env, 2); - oe_ei_encode_atom(env, "$gen_cast"); - return 0; -} - -/* Prepare request encoding (gen_server client) */ -int oe_prepare_request_encoding(CORBA_Environment *env) -{ - int error = 0; - - env->_iout = 0; - oe_ei_encode_version(env); - oe_ei_encode_tuple_header(env, 3); - oe_ei_encode_atom(env, "$gen_call"); - oe_ei_encode_tuple_header(env, 2); - if ((error = oe_ei_encode_pid(env, env->_from_pid)) < 0) - return error; - if ((error = oe_ei_encode_ref(env, &env->_unique)) < 0) - return error; - return 0; -} - -/* Prepare reply decoding (gen_server client) */ -int oe_prepare_reply_decoding(CORBA_Environment *env) -{ - int error = 0; - int version = 0; - erlang_ref unique; - - env->_iin = 0; - env->_received = 0; - - if ((error = ei_decode_version(env->_inbuf, - &env->_iin, - &version)) < 0) - return error; - if ((error = ei_decode_tuple_header(env->_inbuf, - &env->_iin, - &env->_received)) < 0) - return error; - if ((error = ei_decode_ref(env->_inbuf, - &env->_iin, - &unique)) < 0) - return error; - return ic_compare_refs(&env->_unique, &unique); -} - - -/* Prepare request decoding (gen_server server) */ -int oe_prepare_request_decoding(CORBA_Environment *env) -{ - char gencall_atom[10]; - int error = 0; - int version = 0; - - env->_iin = 0; - env->_received = 0; - memset(gencall_atom, 0, 10); - ei_decode_version(env->_inbuf, &env->_iin, &version); - ei_decode_tuple_header(env->_inbuf, &env->_iin, &env->_received); - ei_decode_atom(env->_inbuf, &env->_iin, gencall_atom); - - if (strcmp(gencall_atom, "$gen_cast") == 0) { - if ((error = ei_decode_atom(env->_inbuf, &env->_iin, - env->_operation)) < 0) { - ei_decode_tuple_header(env->_inbuf, &env->_iin, &env->_received); - if ((error = ei_decode_atom(env->_inbuf, &env->_iin, - env->_operation)) < 0) { - CORBA_exc_set(env, CORBA_SYSTEM_EXCEPTION, BAD_OPERATION, - "Bad Message, cannot extract operation"); - return error; - } - env->_received -= 1; - } else - env->_received -= 2; - return 0; - } - if (strcmp(gencall_atom, "$gen_call") == 0) { - ei_decode_tuple_header(env->_inbuf, &env->_iin, &env->_received); - if ((error = ei_decode_pid(env->_inbuf, &env->_iin, - &env->_caller)) < 0) { - CORBA_exc_set(env, CORBA_SYSTEM_EXCEPTION, MARSHAL, - "Bad Message, bad caller identity"); - return error; - } - if ((error = ei_decode_ref(env->_inbuf, &env->_iin, - &env->_unique)) < 0) { - CORBA_exc_set(env, CORBA_SYSTEM_EXCEPTION, MARSHAL, - "Bad Message, bad message reference"); - return error; - } - if ((error = ei_decode_atom(env->_inbuf, &env->_iin, - env->_operation)) < 0) { - - ei_decode_tuple_header(env->_inbuf, &env->_iin, &env->_received); - - if ((error = ei_decode_atom(env->_inbuf, &env->_iin, - env->_operation)) < 0) { - CORBA_exc_set(env, CORBA_SYSTEM_EXCEPTION, BAD_OPERATION, - "Bad Message, cannot extract operation"); - return error; - } - env->_received -= 1; - return 0; - } - else { - env->_received -= 2; - return 0; - } - } - - CORBA_exc_set(env, CORBA_SYSTEM_EXCEPTION, MARSHAL, - "Bad message, neither cast nor call"); - return -1; -} - -/* Prepare reply encoding (gen_server server) */ -int oe_prepare_reply_encoding(CORBA_Environment *env) -{ - env->_iout = 0; - oe_ei_encode_version(env); - oe_ei_encode_tuple_header(env, 2); - oe_ei_encode_ref(env, &env->_unique); - return 0; -} - -/* ---- Function for making it more easy to implement a server */ -/* Server receive (possibly) send reply (gen_server server) */ - -int oe_server_receive(CORBA_Environment *env, oe_map_t *map) -{ - int res = 0, loop = 1; - erlang_msg msg; - - while (res >= 0 && loop > 0) { - res = ei_receive_encoded(env->_fd, &env->_inbuf, &env->_inbufsz, - &msg, &env->_iin); - switch(res) { - case ERL_SEND: - case ERL_REG_SEND: - oe_exec_switch(NULL, env, map); - switch(env->_major) { - case CORBA_NO_EXCEPTION: - break; - case CORBA_SYSTEM_EXCEPTION: - /* XXX stderr */ - fprintf(stderr, "Request failure, reason : %s\n", - (char *) CORBA_exception_value(env)); - CORBA_exception_free(env); - break; - default: /* Should not happen */ - CORBA_exception_free(env); - break; - } - /* send reply */ - /* XXX We are required to set env->_iout = 0 if oneway?? */ - if (env->_iout > 0) - ei_send_encoded(env->_fd, &env->_caller, env->_outbuf, - env->_iout); - loop = 0; - break; - case ERL_TICK: - break; - default: - /* XXX */ - if (res < 0) { - fprintf(stderr, "Result negative: %d\n", res); - loop = 0; - } - break; - } - } - - return 0; -} - diff --git a/lib/ic/c_src/ic_tmo.c b/lib/ic/c_src/ic_tmo.c deleted file mode 100644 index ef66f67d55..0000000000 --- a/lib/ic/c_src/ic_tmo.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2004-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - -static int oe_send_tmo(CORBA_Environment *env, unsigned int ms); - -/* Client send message (Erlang distribution protocol) */ -static int oe_send_tmo(CORBA_Environment *env, unsigned int ms) -{ - if (strlen(env->_regname) == 0) { - if (ei_send_encoded_tmo(env->_fd, env->_to_pid, env->_outbuf, - env->_iout, ms) < 0) { - /* XXX Cannot send to peer? */ - CORBA_exc_set(env, CORBA_SYSTEM_EXCEPTION, NO_RESPONSE, - "Cannot connect to server"); - return -1; - } - } else { - if (ei_send_reg_encoded_tmo(env->_fd, env->_from_pid, - env->_regname, env->_outbuf, - env->_iout, ms) < 0) { - /* XXX Cannot send to peer? */ - CORBA_exc_set(env, CORBA_SYSTEM_EXCEPTION, NO_RESPONSE, - "Cannot connect to server"); - return -1; - } - } - return 0; -} - -/* Send notification (gen_server client) */ -int oe_send_notification_tmo(CORBA_Environment *env, unsigned int send_ms) -{ - return oe_send_tmo(env, send_ms); -} - -/* Send request and receive reply (gen_server client) */ -int oe_send_request_and_receive_reply_tmo(CORBA_Environment *env, - unsigned int send_ms, - unsigned int recv_ms) -{ - int msgType = 0; - erlang_msg msg; - - if (oe_send_tmo(env, send_ms) < 0) - return -1; - - do { - if ((msgType = ei_receive_encoded_tmo(env->_fd, - &env->_inbuf, - &env->_inbufsz, - &msg, &env->_iin, - recv_ms)) < 0) { - CORBA_exc_set(env, CORBA_SYSTEM_EXCEPTION, MARSHAL, - "Cannot decode message"); - return -1; - } - } while (msgType != ERL_SEND && msgType != ERL_REG_SEND); - - /* Extracting return message header */ - if (oe_prepare_reply_decoding(env) < 0) { - CORBA_exc_set(env, CORBA_SYSTEM_EXCEPTION, MARSHAL, "Bad message"); - return -1; - } - return 0; -} - -/* Server receive (possibly) send reply (gen_server server) */ - -int oe_server_receive_tmo(CORBA_Environment *env, oe_map_t *map, - unsigned int send_ms, - unsigned int recv_ms) -{ - int res = 0, loop = 1; - erlang_msg msg; - - while (res >= 0 && loop > 0) { - res = ei_receive_encoded_tmo(env->_fd, &env->_inbuf, &env->_inbufsz, - &msg, &env->_iin, recv_ms); - switch(res) { - case ERL_SEND: - case ERL_REG_SEND: - oe_exec_switch(NULL, env, map); - switch(env->_major) { - case CORBA_NO_EXCEPTION: - break; - case CORBA_SYSTEM_EXCEPTION: - /* XXX stderr */ - fprintf(stderr, "Request failure, reason : %s\n", - (char *) CORBA_exception_value(env)); - CORBA_exception_free(env); - break; - default: /* Should not happen */ - CORBA_exception_free(env); - break; - } - /* send reply */ - /* XXX We are required to set env->_iout = 0 if oneway?? */ - if (env->_iout > 0) - ei_send_encoded_tmo(env->_fd, &env->_caller, env->_outbuf, - env->_iout, send_ms); - loop = 0; - break; - case ERL_TICK: - break; - default: - /* XXX */ - if (res < 0) { - fprintf(stderr, "Result negative: %d\n", res); - loop = 0; - } - break; - } - } - - return 0; -} - diff --git a/lib/ic/c_src/oe_ei_code_erlang_binary.c b/lib/ic/c_src/oe_ei_code_erlang_binary.c deleted file mode 100644 index 81610facbc..0000000000 --- a/lib/ic/c_src/oe_ei_code_erlang_binary.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2001-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - - -int oe_encode_erlang_binary(CORBA_Environment *ev, erlang_binary *binary) { - - int size = ev->_iout; - - ei_encode_binary(0, &size, binary->_buffer, binary->_length); - - if (size >= ev->_outbufsz) { - char *buf = ev->_outbuf; - int bufsz = ev->_outbufsz + ev->_memchunk; - - while (size >= bufsz) - bufsz += ev->_memchunk; - - if ((buf = realloc(buf, bufsz)) == NULL) { - CORBA_exc_set(ev, CORBA_SYSTEM_EXCEPTION, NO_MEMORY, "End of heap memory while encoding"); - return -1; /* OUT OF MEMORY */ - } - - ev->_outbuf = buf; - ev->_outbufsz = bufsz; - } - - return ei_encode_binary(ev->_outbuf, &ev->_iout, binary->_buffer, binary->_length); -} - - - -int oe_sizecalc_erlang_binary(CORBA_Environment *ev, int* _index, int* _size) { - - long _malloc_size = 0; - int _error = 0; - - if(*_size == 0) - *_size = ((*_size + sizeof(erlang_binary))+sizeof(double)-1)&~(sizeof(double)-1); - - if ((_error = ei_decode_binary(ev->_inbuf, _index, 0, &_malloc_size)) < 0) - return _error; - - *_size = ((*_size + (int)_malloc_size)+sizeof(double)-1)&~(sizeof(double)-1); - - return 0; -} - - -int oe_decode_erlang_binary(CORBA_Environment *ev, char *_first, int* _index, erlang_binary *binary) { - - long _length = 0; - int _error = 0; - - if((char*) binary == _first) - *_index = ((*_index + sizeof(erlang_binary))+sizeof(double)-1)&~(sizeof(double)-1); - - binary->_buffer = (CORBA_octet *)(_first+*_index); - - if ((_error = ei_decode_binary(ev->_inbuf, &ev->_iin, binary->_buffer, &_length)) < 0) - return _error; - - binary->_length = (CORBA_unsigned_long)_length; - - *_index = ((*_index)+_length+sizeof(double)-1)&~(sizeof(double)-1); - - return 0; -} - - - -int print_erlang_binary(erlang_binary *binary) { - - int i=0; - - if (binary == NULL) - return -1; - - fprintf(stdout,"binary->_length : %ld\n",binary->_length); - fprintf(stdout,"binary->_buffer : "); - if(binary->_buffer != NULL) { - for (i=0; i_length; i++) - fprintf(stdout,"%c",binary->_buffer[i]); - fprintf(stdout,"\n"); - } else - fprintf(stdout,"NULL\n"); - return 0; -} diff --git a/lib/ic/c_src/oe_ei_decode_longlong.c b/lib/ic/c_src/oe_ei_decode_longlong.c deleted file mode 100644 index 7d872ce94f..0000000000 --- a/lib/ic/c_src/oe_ei_decode_longlong.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - - -int oe_ei_decode_longlong(const char *buf, int *index, CORBA_long_long *p) { - return ei_decode_long(buf, index, p); -} diff --git a/lib/ic/c_src/oe_ei_decode_ulonglong.c b/lib/ic/c_src/oe_ei_decode_ulonglong.c deleted file mode 100644 index d071d09a43..0000000000 --- a/lib/ic/c_src/oe_ei_decode_ulonglong.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - - -int oe_ei_decode_ulonglong(const char *buf, int *index, CORBA_unsigned_long_long *p) { - return ei_decode_ulong(buf, index, p); -} diff --git a/lib/ic/c_src/oe_ei_decode_wchar.c b/lib/ic/c_src/oe_ei_decode_wchar.c deleted file mode 100644 index bb6899b7b3..0000000000 --- a/lib/ic/c_src/oe_ei_decode_wchar.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - - -int oe_ei_decode_wchar(const char *buf, int *index, CORBA_wchar *p) { - return ei_decode_ulong(buf, index, p); -} diff --git a/lib/ic/c_src/oe_ei_decode_wstring.c b/lib/ic/c_src/oe_ei_decode_wstring.c deleted file mode 100644 index 5b676fd579..0000000000 --- a/lib/ic/c_src/oe_ei_decode_wstring.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - - -/* Scratch function */ -int oe_ei_decode_wstring(const char *buf, int *index, CORBA_wchar *p) { - - int length,error_code,type,tmp=0; - char * tmp_space = NULL; - - - if ((error_code = ei_get_type(buf, index, &type, &length)) < 0) - return error_code; - - switch(type) { - - case ERL_LIST_EXT: /* A list */ - case ERL_NIL_EXT: /* An empty list */ - - if (p) { /* Decoding part */ - - if ((error_code = ei_decode_list_header(buf, index, &length)) < 0) - return error_code; - - if (length != 0) { - for(tmp = 0; tmp < length; tmp++) - if ((error_code = oe_ei_decode_wchar(buf, index, &(p[tmp]))) < 0) - return error_code; - - /* Read list tail also */ - if ((error_code = ei_decode_list_header(buf, index, &length)) < 0) - return error_code; - } - - p[tmp] = 0; /* Wide NULL */ - - } else { /* Allocation counting part */ - - if ((error_code = ei_decode_list_header(buf, index, &length)) < 0) - return error_code; - - if (length != 0) { - for(tmp = 0; tmp < length; tmp++) - if ((error_code = oe_ei_decode_wchar(buf, index, 0)) < 0) - return error_code; - - /* Read list tail also */ - if ((error_code = ei_decode_list_header(buf, index, &length)) < 0) - return error_code; - } - } - - break; - - case ERL_STRING_EXT: /* A string */ - - if (p) { /* Decoding part */ - - /* Allocate temporary string */ - tmp_space = (char*) malloc(length*(__OE_WCHARSZ__+1)); - - if ((error_code = ei_decode_string(buf, index, tmp_space)) < 0) - return error_code; - - /* Assign characters to wide characters */ - for(tmp = 0; tmp < length; tmp++) - p[tmp] = tmp_space[tmp]; - - p[tmp] = 0; /* Wide NULL */ - - /* Free temporary string */ - CORBA_free(tmp_space); - - } else { /* Allocation counting part */ - - if ((error_code = ei_decode_string(buf, index, 0)) < 0) - return error_code; - - } - break; - - default: /* Bad header */ - return -1; - } - - return 0; -} - - diff --git a/lib/ic/c_src/oe_ei_encode_atom.c b/lib/ic/c_src/oe_ei_encode_atom.c deleted file mode 100644 index 99a9fe26f0..0000000000 --- a/lib/ic/c_src/oe_ei_encode_atom.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1998-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - -#include - - -#define DIRTY_ATOM_ENC_MAX(LATIN1_CHARS) ((LATIN1_CHARS)*2 + 3) - - -int oe_ei_encode_atom(CORBA_Environment *ev, const char *p) { - int size = ev->_iout; - size_t len = strlen(p); - - if (DIRTY_ATOM_ENC_MAX(len) >= ev->_outbufsz) { - - ei_encode_atom_len(0,&size,p,len); - - if (size >= ev->_outbufsz) { - char *buf = ev->_outbuf; - int bufsz = ev->_outbufsz + ev->_memchunk; - - while (size >= bufsz) - bufsz += ev->_memchunk; - - if ((buf = realloc(buf, bufsz)) == NULL) { - CORBA_exc_set(ev, CORBA_SYSTEM_EXCEPTION, NO_MEMORY, "End of heap memory while encoding"); - return -1; /* OUT OF MEMORY */ - } - - ev->_outbuf = buf; - ev->_outbufsz = bufsz; - } - } - - return ei_encode_atom_len(ev->_outbuf,&ev->_iout,p,len); -} - diff --git a/lib/ic/c_src/oe_ei_encode_char.c b/lib/ic/c_src/oe_ei_encode_char.c deleted file mode 100644 index 9079cb4ecc..0000000000 --- a/lib/ic/c_src/oe_ei_encode_char.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1998-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - - -int oe_ei_encode_char(CORBA_Environment *ev, char p) { - int size = ev->_iout + __OE_CHARSZ__; - - if (size >= ev->_outbufsz) { - char *buf = ev->_outbuf; - int bufsz = ev->_outbufsz + ev->_memchunk; - - if ((buf = realloc(buf,bufsz)) != NULL) { - ev->_outbuf = buf; - ev->_outbufsz += ev->_memchunk; - } - else { - CORBA_exc_set(ev, CORBA_SYSTEM_EXCEPTION, NO_MEMORY, "End of heap memory while encoding"); - return -1; /* OUT OF MEMORY */ - } - } - - return ei_encode_char(ev->_outbuf, &ev->_iout, p); -} - - - diff --git a/lib/ic/c_src/oe_ei_encode_double.c b/lib/ic/c_src/oe_ei_encode_double.c deleted file mode 100644 index 95fed6ff25..0000000000 --- a/lib/ic/c_src/oe_ei_encode_double.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1998-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - - -int oe_ei_encode_double(CORBA_Environment *ev, double p) { - int size = ev->_iout + __OE_DOUBLESZ__; - - if (size >= ev->_outbufsz) { - char *buf = ev->_outbuf; - int bufsz = ev->_outbufsz + ev->_memchunk; - - if ((buf = realloc(buf,bufsz)) != NULL) { - ev->_outbuf = buf; - ev->_outbufsz += ev->_memchunk; - } - else { - CORBA_exc_set(ev, CORBA_SYSTEM_EXCEPTION, NO_MEMORY, "End of heap memory while encoding"); - return -1; /* OUT OF MEMORY */ - } - } - - return ei_encode_double(ev->_outbuf, &ev->_iout, p); -} - - diff --git a/lib/ic/c_src/oe_ei_encode_list_header.c b/lib/ic/c_src/oe_ei_encode_list_header.c deleted file mode 100644 index 57a0fc0d0f..0000000000 --- a/lib/ic/c_src/oe_ei_encode_list_header.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1998-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - - -int oe_ei_encode_list_header(CORBA_Environment *ev, int arity) { - int size = ev->_iout + __OE_LISTHDRSZ__; - - if (size >= ev->_outbufsz) { - char *buf = ev->_outbuf; - int bufsz = ev->_outbufsz + ev->_memchunk; - - if ((buf = realloc(buf,bufsz)) != NULL) { - ev->_outbuf = buf; - ev->_outbufsz += ev->_memchunk; - } - else { - CORBA_exc_set(ev, CORBA_SYSTEM_EXCEPTION, NO_MEMORY, "End of heap memory while encoding"); - return -1; /* OUT OF MEMORY */ - } - } - - return ei_encode_list_header(ev->_outbuf, &ev->_iout, arity); -} diff --git a/lib/ic/c_src/oe_ei_encode_long.c b/lib/ic/c_src/oe_ei_encode_long.c deleted file mode 100644 index c0d8599b95..0000000000 --- a/lib/ic/c_src/oe_ei_encode_long.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1998-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - - -int oe_ei_encode_long(CORBA_Environment *ev, long p) { - int size = ev->_iout + __OE_LONGSZ__; - - if (size >= ev->_outbufsz) { - char *buf = ev->_outbuf; - int bufsz = ev->_outbufsz + ev->_memchunk; - - if ((buf = realloc(buf,bufsz)) != NULL) { - ev->_outbuf = buf; - ev->_outbufsz += ev->_memchunk; - } - else { - CORBA_exc_set(ev, CORBA_SYSTEM_EXCEPTION, NO_MEMORY, "End of heap memory while encoding"); - return -1; /* OUT OF MEMORY */ - } - } - - return ei_encode_long(ev->_outbuf, &ev->_iout, p); -} - - - diff --git a/lib/ic/c_src/oe_ei_encode_longlong.c b/lib/ic/c_src/oe_ei_encode_longlong.c deleted file mode 100644 index ac208f1982..0000000000 --- a/lib/ic/c_src/oe_ei_encode_longlong.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - - -int oe_ei_encode_longlong(CORBA_Environment *ev, CORBA_long_long p) { - int size = ev->_iout + __OE_LONGLONGSZ__; - - if (size >= ev->_outbufsz) { - char *buf = ev->_outbuf; - int bufsz = ev->_outbufsz + ev->_memchunk; - - if ((buf = realloc(buf,bufsz)) != NULL) { - ev->_outbuf = buf; - ev->_outbufsz += ev->_memchunk; - } - else { - CORBA_exc_set(ev, CORBA_SYSTEM_EXCEPTION, NO_MEMORY, "End of heap memory while encoding"); - return -1; /* OUT OF MEMORY */ - } - } - - /* CORBA_long_long = long because of erl_interface limitation */ - return ei_encode_long(ev->_outbuf, &ev->_iout, p); -} - - diff --git a/lib/ic/c_src/oe_ei_encode_pid.c b/lib/ic/c_src/oe_ei_encode_pid.c deleted file mode 100644 index ebd0d0b6ef..0000000000 --- a/lib/ic/c_src/oe_ei_encode_pid.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1998-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - - -int oe_ei_encode_pid(CORBA_Environment *ev, const erlang_pid *p) { - int size = ev->_iout; - - ei_encode_pid(NULL, &size, p); - - if (size >= ev->_outbufsz) { - char *buf = ev->_outbuf; - int bufsz = ev->_outbufsz + ev->_memchunk; - - while (size >= bufsz) - bufsz += ev->_memchunk; - - if ((buf = realloc(buf, bufsz)) == NULL) { - CORBA_exc_set(ev, CORBA_SYSTEM_EXCEPTION, NO_MEMORY, "End of heap memory while encoding"); - return -1; /* OUT OF MEMORY */ - } - - ev->_outbuf = buf; - ev->_outbufsz = bufsz; - } - - return ei_encode_pid(ev->_outbuf, &ev->_iout, p); -} diff --git a/lib/ic/c_src/oe_ei_encode_port.c b/lib/ic/c_src/oe_ei_encode_port.c deleted file mode 100644 index a4ecf846b7..0000000000 --- a/lib/ic/c_src/oe_ei_encode_port.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1998-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - - -int oe_ei_encode_port(CORBA_Environment *ev, const erlang_port *p) { - int size = ev->_iout; - - ei_encode_port(NULL, &size, p); - - if (size >= ev->_outbufsz) { - char *buf = ev->_outbuf; - int bufsz = ev->_outbufsz + ev->_memchunk; - - while (size >= bufsz) - bufsz += ev->_memchunk; - - if ((buf = realloc(buf, bufsz)) == NULL) { - CORBA_exc_set(ev, CORBA_SYSTEM_EXCEPTION, NO_MEMORY, "End of heap memory while encoding"); - return -1; /* OUT OF MEMORY */ - } - - ev->_outbuf = buf; - ev->_outbufsz = bufsz; - } - - return ei_encode_port(ev->_outbuf, &ev->_iout, p); -} - diff --git a/lib/ic/c_src/oe_ei_encode_ref.c b/lib/ic/c_src/oe_ei_encode_ref.c deleted file mode 100644 index 8dcbc3aeb7..0000000000 --- a/lib/ic/c_src/oe_ei_encode_ref.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1998-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - - -int oe_ei_encode_ref(CORBA_Environment *ev, const erlang_ref *p) { - int size = ev->_iout; - - ei_encode_ref(NULL, &size, p); - - if (size >= ev->_outbufsz) { - char *buf = ev->_outbuf; - int bufsz = ev->_outbufsz + ev->_memchunk; - - while (size >= bufsz) - bufsz += ev->_memchunk; - - if ((buf = realloc(buf, bufsz)) == NULL) { - CORBA_exc_set(ev, CORBA_SYSTEM_EXCEPTION, NO_MEMORY, "End of heap memory while encoding"); - return -1; /* OUT OF MEMORY */ - } - - ev->_outbuf = buf; - ev->_outbufsz = bufsz; - } - - return ei_encode_ref(ev->_outbuf, &ev->_iout, p); -} - diff --git a/lib/ic/c_src/oe_ei_encode_string.c b/lib/ic/c_src/oe_ei_encode_string.c deleted file mode 100644 index 8612835e2b..0000000000 --- a/lib/ic/c_src/oe_ei_encode_string.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1998-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - - -int oe_ei_encode_string(CORBA_Environment *ev, const char *p) { - int size = ev->_iout; - - ei_encode_string(0,&size,p); - - if (size >= ev->_outbufsz) { - char *buf = ev->_outbuf; - int bufsz = ev->_outbufsz + ev->_memchunk; - - while (size >= bufsz) - bufsz += ev->_memchunk; - - if ((buf = realloc(buf, bufsz)) == NULL) { - CORBA_exc_set(ev, CORBA_SYSTEM_EXCEPTION, NO_MEMORY, "End of heap memory while encoding"); - return -1; /* OUT OF MEMORY */ - } - - ev->_outbuf = buf; - ev->_outbufsz = bufsz; - } - - return ei_encode_string(ev->_outbuf,&ev->_iout,p); -} - - diff --git a/lib/ic/c_src/oe_ei_encode_term.c b/lib/ic/c_src/oe_ei_encode_term.c deleted file mode 100644 index c36edbf493..0000000000 --- a/lib/ic/c_src/oe_ei_encode_term.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1998-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - - -int oe_ei_encode_term(CORBA_Environment *ev, void *t) { - int size = ev->_iout; - - ei_encode_term(NULL, &size, t); - - if (size >= ev->_outbufsz) { - char *buf = ev->_outbuf; - int bufsz = ev->_outbufsz + ev->_memchunk; - - while (size >= bufsz) - bufsz += ev->_memchunk; - - if ((buf = realloc(buf, bufsz)) == NULL) { - CORBA_exc_set(ev, CORBA_SYSTEM_EXCEPTION, NO_MEMORY, "End of heap memory while encoding"); - return -1; /* OUT OF MEMORY */ - } - - ev->_outbuf = buf; - ev->_outbufsz = bufsz; - } - - return ei_encode_term(ev->_outbuf, &ev->_iout, t); -} - - - diff --git a/lib/ic/c_src/oe_ei_encode_tuple_header.c b/lib/ic/c_src/oe_ei_encode_tuple_header.c deleted file mode 100644 index 64f8b4b873..0000000000 --- a/lib/ic/c_src/oe_ei_encode_tuple_header.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1998-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - - -int oe_ei_encode_tuple_header(CORBA_Environment *ev, int arity) { - int size = ev->_iout + __OE_TUPLEHDRSZ__; - - if (size >= ev->_outbufsz) { - char *buf = ev->_outbuf; - int bufsz = ev->_outbufsz + ev->_memchunk; - - if ((buf = realloc(buf,bufsz)) != NULL) { - ev->_outbuf = buf; - ev->_outbufsz += ev->_memchunk; - } - else { - CORBA_exc_set(ev, CORBA_SYSTEM_EXCEPTION, NO_MEMORY, "End of heap memory while encoding"); - return -1; /* OUT OF MEMORY */ - } - } - - return ei_encode_tuple_header(ev->_outbuf, &ev->_iout, arity); -} - - - diff --git a/lib/ic/c_src/oe_ei_encode_ulong.c b/lib/ic/c_src/oe_ei_encode_ulong.c deleted file mode 100644 index 249235935e..0000000000 --- a/lib/ic/c_src/oe_ei_encode_ulong.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1998-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - - -int oe_ei_encode_ulong(CORBA_Environment *ev, unsigned long p) { - int size = ev->_iout + __OE_ULONGSZ__; - - if (size >= ev->_outbufsz) { - char *buf = ev->_outbuf; - int bufsz = ev->_outbufsz + ev->_memchunk; - - if ((buf = realloc(buf,bufsz)) != NULL) { - ev->_outbuf = buf; - ev->_outbufsz += ev->_memchunk; - } - else { - CORBA_exc_set(ev, CORBA_SYSTEM_EXCEPTION, NO_MEMORY, "End of heap memory while encoding"); - return -1; /* OUT OF MEMORY */ - } - } - - return ei_encode_ulong(ev->_outbuf, &ev->_iout, p); -} - - diff --git a/lib/ic/c_src/oe_ei_encode_ulonglong.c b/lib/ic/c_src/oe_ei_encode_ulonglong.c deleted file mode 100644 index 7997f4ea39..0000000000 --- a/lib/ic/c_src/oe_ei_encode_ulonglong.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - - -int oe_ei_encode_ulonglong(CORBA_Environment *ev, CORBA_unsigned_long_long p) { - int size = ev->_iout + __OE_ULONGLONGSZ__; - - if (size >= ev->_outbufsz) { - char *buf = ev->_outbuf; - int bufsz = ev->_outbufsz + ev->_memchunk; - - if ((buf = realloc(buf,bufsz)) != NULL) { - ev->_outbuf = buf; - ev->_outbufsz += ev->_memchunk; - } - else { - CORBA_exc_set(ev, CORBA_SYSTEM_EXCEPTION, NO_MEMORY, "End of heap memory while encoding"); - return -1; /* OUT OF MEMORY */ - } - } - - /* CORBA_long_long = long because of erl_interface limitation */ - return ei_encode_ulong(ev->_outbuf, &ev->_iout, p); -} - - diff --git a/lib/ic/c_src/oe_ei_encode_version.c b/lib/ic/c_src/oe_ei_encode_version.c deleted file mode 100644 index 4bc6256c32..0000000000 --- a/lib/ic/c_src/oe_ei_encode_version.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1998-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - - -int oe_ei_encode_version(CORBA_Environment *ev) { - int size = ev->_iout + __OE_VSNSZ__; - - if (size >= ev->_outbufsz) { - char *buf = ev->_outbuf; - int bufsz = ev->_outbufsz + ev->_memchunk; - - if ((buf = realloc(buf,bufsz)) != NULL) { - ev->_outbuf = buf; - ev->_outbufsz += ev->_memchunk; - } - else { - CORBA_exc_set(ev, CORBA_SYSTEM_EXCEPTION, NO_MEMORY, "End of heap memory while encoding"); - return -1; /* OUT OF MEMORY */ - } - } - - return ei_encode_version(ev->_outbuf, &ev->_iout); -} - diff --git a/lib/ic/c_src/oe_ei_encode_wchar.c b/lib/ic/c_src/oe_ei_encode_wchar.c deleted file mode 100644 index 0fd4027886..0000000000 --- a/lib/ic/c_src/oe_ei_encode_wchar.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - - -int oe_ei_encode_wchar(CORBA_Environment *ev, CORBA_wchar p) { - return oe_ei_encode_ulong(ev, p); -} - - diff --git a/lib/ic/c_src/oe_ei_encode_wstring.c b/lib/ic/c_src/oe_ei_encode_wstring.c deleted file mode 100644 index a799d475e7..0000000000 --- a/lib/ic/c_src/oe_ei_encode_wstring.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include - - -int oe_ei_encode_wstring(CORBA_Environment *ev, CORBA_wchar *p) { - - int len,wchar,size,tmp,error_code; - - len = ic_wstrlen(p); - size = ev->_iout + __OE_LISTHDRSZ__ +(len * __OE_WCHARSZ__); - - if (size >= ev->_outbufsz) { - char *buf = ev->_outbuf; - int bufsz = ev->_outbufsz + ev->_memchunk; - - while (size >= bufsz) - bufsz += ev->_memchunk; - - if ((buf = realloc(buf, bufsz)) == NULL) { - CORBA_exc_set(ev, CORBA_SYSTEM_EXCEPTION, NO_MEMORY, "End of heap memory while encoding"); - return -1; /* OUT OF MEMORY */ - } - - ev->_outbuf = buf; - ev->_outbufsz = bufsz; - } - - /* Encode the wide string */ - error_code = 0; - - if ((error_code = oe_ei_encode_list_header(ev, len)) < 0) - return error_code; - - for(tmp = 0; tmp < len; tmp++) - if ((error_code = oe_ei_encode_wchar(ev, p[tmp])) < 0) - return error_code; - - if ((error_code = oe_ei_encode_empty_list(ev)) < 0) - return error_code; - - return 0; -} - - diff --git a/lib/ic/doc/html/.gitignore b/lib/ic/doc/html/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/ic/doc/man1/.gitignore b/lib/ic/doc/man1/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/ic/doc/man3/.gitignore b/lib/ic/doc/man3/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/ic/doc/pdf/.gitignore b/lib/ic/doc/pdf/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/ic/doc/src/CORBA_Environment_alloc.xml b/lib/ic/doc/src/CORBA_Environment_alloc.xml deleted file mode 100644 index 357d9c2e8a..0000000000 --- a/lib/ic/doc/src/CORBA_Environment_alloc.xml +++ /dev/null @@ -1,143 +0,0 @@ - - - - -
- - 19982016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CORBA_Environment_alloc - - - - 1998-12-01 - A -
- CORBA_Environment_alloc - Allocation function for the CORBA_Environement struct - -

The CORBA_Environment_alloc() function is the - function used to allocate and initiate the CORBA_Environment - structure.

-
- - - CORBA_Environment *CORBA_Environment_alloc(inbufsz, outbufsz) - Initialize communication - - int inbufsz; - int outbufsz; - - -

This function is used to create and initiate the CORBA_Environment - structure. In particular, it is used to dynamically allocate a CORBA_Environment - structure and set the default values for the structure's fields.

-

inbufsize is the wished size of input buffer.

-

outbufsize is the wished size of output buffer.

-

CORBA_Environment is the CORBA 2.0 state structure used by the - generated stub.

-

This function will set all needed default values and allocate buffers equal - to the values passed, but will not allocate space for the _to_pid and _from_pid fields.

-

To free the space allocated by CORBA_Environment_alloc/2 :

- - -

First call CORBA_free for the input and output buffers.

-
- -

After freeing the buffer space, call CORBA_free for the CORBA_Environment space.

-
-
-
-
-
- -
- The CORBA_Environment structure -

Here is the complete definition of the CORBA_Environment structure, - defined in file ic.h :

- -/* Environment definition */ -typedef struct { - - /*----- CORBA compatibility part ------------------------*/ - /* Exception tag, initially set to CORBA_NO_EXCEPTION ---*/ - CORBA_exception_type _major; - - /*----- External Implementation part - initiated by the user ---*/ - /* File descriptor */ - int _fd; - /* Size of input buffer */ - int _inbufsz; - /* Pointer to always dynamically allocated buffer for input */ - char *_inbuf; - /* Size of output buffer */ - int _outbufsz; - /* Pointer to always dynamically allocated buffer for output */ - char *_outbuf; - /* Size of memory chunks in bytes, used for increasing the output - buffer, set to >= 32, should be around >= 1024 for performance - reasons */ - int _memchunk; - /* Pointer for registered name */ - char _regname[256]; - /* Process identity for caller */ - erlang_pid *_to_pid; - /* Process identity for callee */ - erlang_pid *_from_pid; - - /*- Internal Implementation part - used by the server/client ---*/ - /* Index for input buffer */ - int _iin; - /* Index for output buffer */ - int _iout; - /* Pointer for operation name */ - char _operation[256]; - /* Used to count parameters */ - int _received; - /* Used to identify the caller */ - erlang_pid _caller; - /* Used to identify the call */ - erlang_ref _unique; - /* Exception id field */ - CORBA_char *_exc_id; - /* Exception value field */ - void *_exc_value; - - -} CORBA_Environment; - - -

Remember to set the field values _fd , _regname , *_to_pid and/or - *_from_pid to the appropriate application values. These are not automatically - set by the stubs.

-
- -

Never assign static buffers to the buffer pointers, never set the _memchunk field to - a value less than 32.

-
-
- -
- SEE ALSO -

ic(3)

-
- -
- - diff --git a/lib/ic/doc/src/Makefile b/lib/ic/doc/src/Makefile deleted file mode 100644 index 118f42b605..0000000000 --- a/lib/ic/doc/src/Makefile +++ /dev/null @@ -1,227 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1998-2017. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../../vsn.mk -VSN=$(IC_VSN) -APPLICATION=ic - -# ---------------------------------------------------- -# Java specific -# ---------------------------------------------------- -JAVADOC=javadoc -JAVA_INCL_ROOT = $(ERL_TOP)/lib/jinterface/priv/ -JAVA_SRC_ROOT = $(ERL_TOP)/lib/ic/java_src/ -JAVA_CLASS_SUBDIR = com/ericsson/otp/ic/ - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN) - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -XML_APPLICATION_FILES = ref_man.xml -XML_REF3_FILES = ic.xml \ - ic_clib.xml \ - ic_c_protocol.xml - -XML_PART_FILES = part.xml - -XML_CHAPTER_FILES = \ - ch_introduction.xml \ - ch_basic_idl.xml \ - ch_ic_protocol.xml \ - ch_erl_plain.xml \ - ch_erl_genserv.xml \ - ch_c_mapping.xml \ - ch_c_client.xml \ - ch_c_server.xml \ - ch_c_corba_env.xml \ - ch_java.xml \ - notes.xml - -BOOK_FILES = book.xml - -XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \ - $(XML_PART_FILES) $(XML_CHAPTER_FILES) - -GIF_FILES = - -# ---------------------------------------------------- - -HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \ - $(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html) - -INFO_FILE = ../../info -EXTRA_FILES = \ - $(DEFAULT_GIF_FILES) \ - $(DEFAULT_HTML_FILES) \ - $(XML_REF3_FILES:%.xml=$(HTMLDIR)/%.html) \ - $(XML_CHAPTER_FILES:%.xml=$(HTMLDIR)/%.html) - -MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3) - -HTML_REF_MAN_FILE = $(HTMLDIR)/index.html - -TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf - -JAVA_SOURCE_FILES = \ - Holder.java \ - BooleanHolder.java \ - ByteHolder.java \ - CharHolder.java \ - DoubleHolder.java \ - FloatHolder.java \ - IntHolder.java \ - LongHolder.java \ - ShortHolder.java \ - StringHolder.java \ - Environment.java \ - Any.java \ - AnyHelper.java \ - AnyHolder.java \ - TypeCode.java \ - TCKind.java \ - Pid.java \ - PidHolder.java \ - PidHelper.java \ - Ref.java \ - RefHolder.java \ - RefHelper.java \ - Port.java \ - PortHolder.java \ - PortHelper.java \ - Term.java \ - TermHolder.java \ - TermHelper.java - - -JD_INDEX_HTML_FILES = \ - allclasses-frame.html \ - allclasses-noframe.html \ - deprecated-list.html \ - index-all.html \ - overview-tree.html \ - stylesheet.css \ - help-doc.html \ - index.html \ - package-list \ - serialized-form.html \ - constant-values.html - -JD_GIF_FILES = \ - ../html/java/resources/inherit.gif - - -PACK_DIR = com/ericsson/otp/ic -JAVA_SOURCE_DIR = ../../java_src/$(PACK_DIR) -JAVA_OUT_DIR = ../html/java - -JD_PACK_HTML_FILES = \ - package-frame.html \ - package-summary.html \ - package-tree.html - -JAVADOC_PACK_HTML_FILES = \ - $(JAVA_SOURCE_FILES:%.java=$(JAVA_OUT_DIR)/$(PACK_DIR)/%.html) \ - $(JD_PACK_HTML_FILES:%=$(JAVA_OUT_DIR)/$(PACK_DIR)/%) - -JAVADOC_INDEX_HTML_FILES = $(JD_INDEX_HTML_FILES:%=$(JAVA_OUT_DIR)/%) - -JAVADOC_GENERATED_FILES = $(JAVADOC_PACK_HTML_FILES) $(JAVADOC_INDEX_HTML_FILES) - - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -CLASSPATH = $(JAVA_SRC_ROOT):$(JAVA_INCL_ROOT) - -XML_FLAGS += -DVIPS_FLAGS += -JAVADOCFLAGS = \ - -classpath $(CLASSPATH) \ - -d ../doc/html/java \ - -windowtitle "Package com.ericsson.otp.ic version $(IC_VSN)" \ - -public \ - -footer "
Copyright © 1991-2007 Ericsson AB
" - - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -$(HTMLDIR)/%.gif: %.gif - $(INSTALL_DATA) $< $@ - -ifneq (,$(JAVA)) -docs: pdf html man $(JAVADOC_GENERATED_FILES) -else -docs: pdf html man -endif - -$(TOP_PDF_FILE): $(XML_FILES) - -pdf: $(TOP_PDF_FILE) - -html: gifs $(HTML_REF_MAN_FILE) - -clean clean_docs: - rm -rf $(HTMLDIR)/* - rm -f $(MAN3DIR)/* - rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) - rm -f errs core *~ - -$(JAVADOC_GENERATED_FILES): JAVADOC-GENERATED - -JAVADOC-GENERATED: $(JAVA_SOURCE_FILES:%=$(JAVA_SOURCE_DIR)/%) - @(cd ../../java_src; $(JAVADOC) $(JAVADOCFLAGS) com.ericsson.otp.ic) - >JAVADOC-GENERATED - -man: $(MAN3_FILES) - -gifs: $(GIF_FILES:%=$(HTMLDIR)/%) - -$(INDEX_TARGET): $(INDEX_SRC) ../../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ - -debug opt: - - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_docs_spec: docs - $(INSTALL_DIR) "$(RELSYSDIR)/doc/pdf" - $(INSTALL_DATA) $(TOP_PDF_FILE) "$(RELSYSDIR)/doc/pdf" - $(INSTALL_DATA) $(INFO_FILE) "$(RELSYSDIR)" - $(INSTALL_DIR) "$(RELSYSDIR)/doc/html" - ($(CP) -rf $(HTMLDIR) "$(RELSYSDIR)/doc") - $(INSTALL_DIR) "$(RELEASE_PATH)/man/man3" - $(INSTALL_DATA) $(MAN3_FILES) "$(RELEASE_PATH)/man/man3" - -release_spec: diff --git a/lib/ic/doc/src/book.xml b/lib/ic/doc/src/book.xml deleted file mode 100644 index f6ef824f63..0000000000 --- a/lib/ic/doc/src/book.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - -
- - 19982016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - ic - - - 1998-09-29 - 4.0.4 - book.sgml -
- - - ic - - - - - - - - - - - - - - -
- diff --git a/lib/ic/doc/src/c-part.xml b/lib/ic/doc/src/c-part.xml deleted file mode 100644 index 968dd3135f..0000000000 --- a/lib/ic/doc/src/c-part.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - -
- - 20022016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - IDL to C language Mapping - - - 2002-06-25 - A -
- -

IDL to C

-
- - - - -
- diff --git a/lib/ic/doc/src/ch_basic_idl.xml b/lib/ic/doc/src/ch_basic_idl.xml deleted file mode 100644 index 485a0c44e5..0000000000 --- a/lib/ic/doc/src/ch_basic_idl.xml +++ /dev/null @@ -1,164 +0,0 @@ - - - - -
- - 20022016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - OMG IDL - - - 2002-07-15 - - ch_basic_idl.xml -
- -
- OMG IDL - Overview -

The purpose of OMG IDL, Interface Definition Language, mapping - is to act as translator between platforms and languages. An IDL - specification is supposed to describe data types, object types etc.

-

Since the C and Java IC backends only supports a subset of the - IDL types supported by the other backends, the mapping is divided into - different parts. For more information about IDL to Erlang mapping, - i.e., CORBA, plain Erlang and generic Erlang Server, see the Orber - User's Guide. How to use the plain Erlang and generic Erlang Server is - found in this User's Guide.

- -
- Reserved Compiler Names and Keywords -

The use of some names is strongly discouraged due to - ambiguities. However, the use of some names is prohibited - when using the Erlang mapping , as they are strictly reserved for IC.

-

IC reserves all identifiers starting with OE_ and oe_ - for internal use.

-

Note also, that an identifier in IDL can contain alphabetic, - digits and underscore characters, but the first character - must be alphabetic. -

-

Using underscores in IDL names can lead to ambiguities - due to the name mapping described above. It is advisable to - avoid the use of underscores in identifiers.

-

The OMG defines a set of reserved words, shown below, for use as keywords. - These may not be used as, for example, identifiers.

- - - abstract - double - local - raises - typedef - - - any - exception - long - readonly - unsigned - - - attribute - enum - module - sequence - union - - - boolean - factory - native - short - ValueBase - - - case - FALSE - Object - string - valuetype - - - char - fixed - octet - struct - void - - - const - float - oneway - supports - wchar - - - context - in - out - switch - wstring - - - custom - inout - private - TRUE - - - - default - interface - public - truncatable - - - OMG IDL keywords -
-

The keywords listed above must be written exactly as shown. Any usage - of identifiers that collide with a keyword is illegal. For example, - long is a valid keyword; Long and LONG are - illegal as keywords and identifiers. But, since the OMG must be able - to expand the IDL grammar, it is possible to use Escaped Identifiers. For example, it is not unlikely that native - have been used in IDL-specifications as identifiers. One option is to - change all occurrences to myNative. Usually, it is necessary - to change programming language code that depends upon that IDL as well. - Since Escaped Identifiers just disable type checking (i.e. if it is a reserved - word or not) and leaves everything else unchanged, it is only necessary to - update the IDL-specification. To escape an identifier, simply prefix it - with _. The following IDL-code is illegal:

- -typedef string native; -interface i { - void foo(in native Arg); - }; -}; - -

With Escaped Identifiers the code will look like:

- -typedef string _native; -interface i { - void foo(in _native Arg); - }; -}; - -
-
-
- diff --git a/lib/ic/doc/src/ch_c_client.xml b/lib/ic/doc/src/ch_c_client.xml deleted file mode 100644 index e304c8acf4..0000000000 --- a/lib/ic/doc/src/ch_c_client.xml +++ /dev/null @@ -1,150 +0,0 @@ - - - - -
- - 19982016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - The C Client Back-end - - - 2004-01-14 - C - ch_c_client.xml -
- -
- Introduction -

With the option {be, c_client} the IDL Compiler generates - C client stubs according to the IDL to C mapping, on top of the - Erlang distribution and gen_server protocols.

-

The developer has to write additional code, that together with - the generated C client stubs, form a hidden Erlang node. That - additional code uses erl_interface functions for defining - the hidden node, and for establishing connections to other - Erlang nodes.

-
- -
- Generated Stub Files -

The generated stub files are:

- - -

For each IDL interface, a C source file, the name of which - is .c]]>. Each operation of the - IDL interface is mapped to a C function (with scoped name) - in that file;

-
- -

C source files that contain functions for type conversion, - memory allocation, and data encoding/decoding;

-
- -

C header files that contain function prototypes and type - definitions.

-
-
-

All C functions are exported (i.e. not declared static).

-
- -
- C Interface Functions -

For each IDL operation a C interface function is - generated, the prototype of which is:

-

( oe_obj, , CORBA_Environment *oe_env);]]>

-

where

- - -

]]> is the value to be returned as defined - by the IDL specification;

-
- -

oe_obj]]> is the client interface - object;

-
- -

]]> is a list of parameters of the - operation, defined in the same order as defined by the IDL - specification;

-
- -

CORBA_Environment *oe_env is a pointer to the current - client environment. It contains the current file descriptor, - the current input and output buffers, etc. For details see - CORBA_Environment C Structure.

-
-
-
- -
- Generating, Compiling and Linking -

To generate the C client stubs type the following in an - appropriate shell:

-

,

-

where ICROOT is the root of the IC application. The - -I ICROOT/include is only needed if File.idl - refers to erlang.idl.

-

When compiling a generated C stub file, the directories - ICROOT/include and EICROOT/include, have to be - specified as include directories, where EIROOT is the - root directory of the Erl_interface application.

-

When linking object files the EIROOT/lib and - ICROOT/priv/lib directories have to be specified.

-
- -
- An Example -

In this example the IDL specification file "random.idl" is used - for generating C client stubs (the file is contained in the IC - /examples/c-client directory):

- -

Generate the C client stubs:

- - - -

Six files are generated.

-

Compile the C client stubs:

-

Please read the ReadMe file att the - examples/c-client directory

-

In the same - directory you can find all the code for this example.

-

In particular you will find the client.c file that contains - all the additional code that must be written to obtain a complete - client.

-

In the examples/c-client directory you will also find - source code for an Erlang server, which can be used for testing - the C client.

-
-
- - diff --git a/lib/ic/doc/src/ch_c_corba_env.xml b/lib/ic/doc/src/ch_c_corba_env.xml deleted file mode 100644 index 1bd829307e..0000000000 --- a/lib/ic/doc/src/ch_c_corba_env.xml +++ /dev/null @@ -1,386 +0,0 @@ - - - - -
- - 19982016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CORBA_Environment C Structure - - - 2003-12-15 - PC1 - ch_c_corba_env.xml -
- -

This chapter describes the CORBA_Environment C structure.

- -
- C Structure -

Here is the complete definition of the CORBA_Environment - C structure, defined in file "ic.h" :

- -/* Environment definition */ -typedef struct { - - /*----- CORBA compatibility part ------------------------*/ - /* Exception tag, initially set to CORBA_NO_EXCEPTION ---*/ - CORBA_exception_type _major; - - /*----- External Implementation part - initiated by the user ---*/ - /* File descriptor */ - int _fd; - /* Size of input buffer */ - int _inbufsz; - /* Pointer to always dynamically allocated buffer for input */ - char *_inbuf; - /* Size of output buffer */ - int _outbufsz; - /* Pointer to always dynamically allocated buffer for output */ - char *_outbuf; - /* Size of memory chunks in bytes, used for increasing the output - buffer, set to >= 32, should be around >= 1024 for performance - reasons */ - int _memchunk; - /* Pointer for registered name */ - char _regname[256]; - /* Process identity for caller */ - erlang_pid *_to_pid; - /* Process identity for callee */ - erlang_pid *_from_pid; - - /*- Internal Implementation part - used by the server/client ---*/ - /* Index for input buffer */ - int _iin; - /* Index for output buffer */ - int _iout; - /* Pointer for operation name */ - char _operation[256]; - /* Used to count parameters */ - int _received; - /* Used to identify the caller */ - erlang_pid _caller; - /* Used to identify the call */ - erlang_ref _unique; - /* Exception id field */ - CORBA_char *_exc_id; - /* Exception value field */ - void *_exc_value; - - -} CORBA_Environment; - -

The structure is divided into three parts:

- - -

The CORBA Compatibility part, demanded by the standard OMG - IDL mapping v2.0.

-
- -

The external implementation part used for generated - client/server code.

-
- -

The internal part useful for those who wish to define their - own functions.

-
-
-
- -
- The CORBA Compatibility Part -

Contains only one field _major defined as a - CORBA_Exception_type. The CORBA_Exception type is an integer - which can be one of:

- - -

CORBA_NO_EXCEPTION, by default equal to 0, can be - set by the application programmer to another value.

-
- -

CORBA_SYSTEM_EXCEPTION, by default equal to -1, can - be set by the application programmer to another value.

-
-
-

The current definition of these values are:

- - #define CORBA_NO_EXCEPTION 0 - #define CORBA_SYSTEM_EXCEPTION -1 - -
- -
- The External Part -

This part contains the following fields:

- - -

int _fd - a file descriptor returned from - erl_connect. Used for connection setting.

-
- -

char* _inbuf - pointer to a buffer used for - input. Buffer size checks are done under runtime that - prevent buffer overflows. This is done by expanding the - buffer to fit the input message. In order to allow buffer - reallocation, the output buffer must always be dynamically - allocated. The pointer value can change under runtime in - case of buffer reallocation.

-
- -

int _inbufsz - start size of input buffer. Used - for setting the input buffer size under initialization of - the Erl_Interface function ei_receive_encoded/5. The value - of this field can change under runtime in case of input - buffer expansion to fit larger messages

-
- -

int _outbufsz - start size of output buffer. The - value of this field can change under runtime in case of - input buffer expansion to fit larger messages

-
- -

char* _outbuf - pointer to a buffer used for - output. Buffer size checks prevent buffer overflows under - runtime, by expanding the buffer to fit the output message - in cases of lack of space in buffer. In order to allow - buffer reallocation, the output buffer must always be - dynamically allocated. The pointer value can change under - runtime in case of buffer reallocation.

-
- -

int _memchunk - expansion unit size for the output - buffer. This is the size of memory chunks in bytes used for - increasing the output in case of buffer expansion. The value - of this field must be always set to >= 32, should be at - least 1024 for performance reasons.

-
- -

char regname[256] - a registered name for a process.

-
- -

erlang_pid* _to_pid - an Erlang process identifier, - is only used if the registered_name parameter is the empty - string.

-
- -

erlang_pid* _from_pid - your own process id so the - answer can be returned.

-
-
-
- -
- The Internal Part -

This part contains the following fields:

- - -

int _iin - Index for input buffer. Initially set - to zero. Updated to agree with the length of the received - encoded message.

-
- -

int _iout - Index for output buffer Initially set - to zero. Updated to agree with the length of the message - encoded to the communication counterpart.

-
- -

char _operation[256] - Pointer for operation name. - Set to the operation to be called.

-
- -

int _received - Used to count parameters. - Initially set to zero.

-
- -

erlang_pid _caller - Used to identify the caller. - Initiated to a value that identifies the caller.

-
- -

erlang_ref _unique - Used to identify the call. - Set to a default value in the case of generated functions.

-
- -

CORBA_char* _exc_id - Exception id field. - Initially set to NULL to agree with the initial value of - _major (CORBA_NO_EXCEPTION).

-
- -

void* _exc_value - Exception value field Initially - set to NULL to agree with the initial value of - _major (CORBA_NO_EXCEPTION).

-
-
-

The advanced user who defines his own functions has to - update/support these values in a way similar to how they are - updated in the generated code.

-
- -
- Creating and Initiating the CORBA_Environment Structure -

There are two ways to set the CORBA_Environment structure:

- - -

Manually

-

The following default values must be set to the - CORBA_Environment *ev fields, when buffers for - input/output should have the size inbufsz/ - outbufsz:

- - -

ev->_inbufsz = inbufsz;

-

The value for this field can be between 0 and maximum - size of a signed integer.

-
- -

ev->_inbuf = malloc(inbufsz);

-

The size of the allocated buffer must be equal to the - value of its corresponding index, _inbufsz.

-
- -

ev->_outbufsz = outbufsz;

-

The value for this field can be between 0 and maximum - size of a signed integer.

-
- -

ev->_outbuf = malloc(outbufsz);

-

The size of the allocated buffer must be equal to the - value of its corresponding index, _outbufsz.

-
- -

ev->_memchunk = __OE_MEMCHUNK__;

-

Please note that __OE_MEMCHUNK__ is equal to - 1024, you can set this value to a value bigger - than 32 yourself.

-
- -

ev->_to_pid = NULL;

-
- -

ev->_from_pid = NULL;

-
-
-

-
- -

By using the CORBA_Environment_alloc/2 function.

-

The CORBA_Environment_alloc function is defined as:

- - CORBA_Environment *CORBA_Environment_alloc(int inbufsz, - int outbufsz); - -

where:

- - -

inbufsz is the desired size of input buffer

-
- -

outbufsz is the desired size of output - buffer

-
- -

return value is a pointer to an allocated and - initialized CORBA_Environment structure.

-

-
-
-

This function will set all needed default values and - allocate buffers equal to the values passed, but will not - allocate space for the _to_pid and _from_pid fields.

-

To free the space allocated by CORBA_Environment_alloc/2:

- - -

First call CORBA_free for the input and output buffers.

-
- -

After freeing the buffer space, call CORBA_free for - the CORBA_Environment space.

-
-
-
-
- -

Remember to set the fields _fd, _regname, - *_to_pid and/or *_from_pid to the - appropriate application values. These are not automatically - set by the stubs.

-
- -

Never assign static buffers to the buffer pointers. Never set - the _memchunk field to a value less than - 32.

-
-
- -
- Setting System Exceptions -

If the user wishes to set own system exceptions at critical - positions on the code, it is strongly recommended to use one of - the current values:

- - -

CORBA_NO_EXCEPTION upon success. The value of the _exc_id - field should be then set to NULL. The value of the - _exc_value field should be then set to NULL.

-
- -

CORBA_SYSTEM_EXCEPTION upon system failure. The value of - the _exc_id field should be then set to one of the values - defined in "ic.h" :

- - #define UNKNOWN "UNKNOWN" - #define BAD_PARAM "BAD_PARAM" - #define NO_MEMORY "NO_MEMORY" - #define IMPL_LIMIT "IMP_LIMIT" - #define COMM_FAILURE "COMM_FAILURE" - #define INV_OBJREF "INV_OBJREF" - #define NO_PERMISSION "NO_PERMISSION" - #define INTERNAL "INTERNAL" - #define MARSHAL "MARSHAL" - #define INITIALIZE "INITIALIZE" - #define NO_IMPLEMENT "NO_IMPLEMENT" - #define BAD_TYPECODE "BAD_TYPECODE" - #define BAD_OPERATION "BAD_OPERATION" - #define NO_RESOURCES "NO_RESOURCES" - #define NO_RESPONSE "NO_RESPONSE" - #define PERSIST_STORE "PERSIST_STORE" - #define BAD_INV_ORDER "BAD_INV_ORDER" - #define TRANSIENT "TRANSIENT" - #define FREE_MEM "FREE_MEM" - #define INV_IDENT "INV_IDENT" - #define INV_FLAG "INV_FLAG" - #define INTF_REPOS "INTF_REPOS" - #define BAD_CONTEXT "BAD_CONTEXT" - #define OBJ_ADAPTER "OBJ_ADAPTER" - #define DATA_CONVERSION "DATA_CONVERSION" - #define OBJ_NOT_EXIST "OBJECT_NOT_EXIST" - -
-
-

The value of the _exc_value field should be then set to a string - that explains the problem in an informative way. The user - should use the functions CORBA_exc_set/4 and - CORBA_exception_free/1 to free the exception. - The user has to use CORBA_exception_id/1 and - CORBA_exception_value/1 to access exception information. - Prototypes for these functions are declared in "ic.h"

-
-
- - diff --git a/lib/ic/doc/src/ch_c_mapping.xml b/lib/ic/doc/src/ch_c_mapping.xml deleted file mode 100644 index 1ea0ace91f..0000000000 --- a/lib/ic/doc/src/ch_c_mapping.xml +++ /dev/null @@ -1,893 +0,0 @@ - - - - -
- - 19982016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - IDL to C mapping - - - 2002-08-06 - PB1 - ch_c_mapping.xml -
- -
- Introduction -

The IC C mapping (used by the C client and C server back-ends) follows - the OMG C Language Mapping Specification.

-

The C mapping supports the following:

- - -

All OMG IDL basic types except long double and any.

-
- -

All OMG IDL constructed types.

-
- -

OMG IDL constants.

-
- -

Operations with passing of parameters and receiving of - results. inout parameters are not supported.

-
-
-

The following is not supported: -

- - -

Access to attributes.

-
- -

User defined exceptions.

-

-
- -

User defined objects.

-

-
-
-
- -
- C Mapping Characteristics - -
- Reserved Names -

The IDL compiler reserves all identifiers starting with - OE_ and oe_ for internal use.

-
- -
- Scoped Names -

The C programmer must always use the global name for a type, - constant or operation. The C global name corresponding to an - OMG IDL global name is derived by converting occurrences of - "::" to underscore, and eliminating the leading "::". So, for - example, an operation op1 defined in interface - I1 which is defined in module M1 would be - written as M1::I1::op1 in IDL and as M1_I1_op1 - in C.

- -

If underscores are used in IDL names it can lead to - ambiguities due to the name mapping described above, - therefore it is advisable to avoid underscores in - identifiers.

-
-
- -
- Generated Files -

Two files will be generated for each scope. One set of files - will be generated for each module and each interface scope. - An extra set is generated for those definitions at top - level scope. One of the files is a header file(.h), and the - other file is a C source code file (.c). In addition to these - files a number of C source files will be generated for type encodings, - they are named according to the following template: - .c]]>.

-

For example:

- lseq; - - interface i1 { - ... - }; - ... -}; - ]]> -

XXX This is C client specific. - Will produce the files oe_spec.h and - oe_spec.c for the top scope level. Then the files - m1.h and m1.c for the module m1 and - files m1_i1.h and m1_i1.c for the interface - i1. The typedef will produce oe_code_m1_lseq.c.

-

The header file contains type definitions for all - struct types and sequences and constants in the IDL file. The - c file contains all operation stubs if the the scope is an interface.

-

In addition to the scope-related files a C source file will - be generated for encoding operations of all struct and - sequence types.

-
-
- -
- Basic OMG IDL Types -

The mapping of basic types is as follows.

- - - OMG IDL type - C type - Mapped to C type - - - float - CORBA_float - float - - - double - CORBA_double - double - - - short - CORBA_short - short - - - unsigned short - CORBA_unsigned_short - unsigned short - - - long - CORBA_long - long - - - long long - CORBA_long_long - long - - - unsigned long - CORBA_unsigned_long - unsigned long - - - unsigned long long - CORBA_unsigned_long_long - unsigned long - - - char - CORBA_char - char - - - wchar - CORBA_wchar - unsigned long - - - boolean - CORBA_boolean - unsigned char - - - octet - CORBA_octet - char - - - any - Not supported - - - - long double - Not supported - - - - Object - Not supported - - - - void - void - void - - OMG IDL Basic Types -
-

XXX Note that several mappings are not according to OMG C Language - mapping.

-
- -
- Constructed OMG IDL Types -

Constructed types have mappings as shown in the following table.

- - - OMG IDL type - Mapped to C type - - - string - CORBA_char* - - - wstring - CORBA_wchar* - - - struct - struct - - - union - union - - - enum - enum - - - sequence - struct (see below) - - - array - array - - OMG IDL Constructed Types -
-

An OMG IDL sequence (an array of variable length),

- NAME; - ]]> -

is mapped to a C struct as follows:

- -/* C */ -typedef struct { - CORBA_unsigned_long _maximum; - CORBA_unsigned_long _length; - C_TYPE* _buffer; -} C_NAME; - -

where C_TYPE is the mapping of IDL_TYPE, and where - C_NAME is the scoped name of NAME.

-
- -
- OMG IDL Constants -

An IDL constant is mapped to a C constant through a C - #define macro, where the name of the macro is scoped. - Example:

- -// IDL -module M1 { - const long c1 = 99; -}; - -

results in the following:

- -/* C */ -#define M1_c1 99 - -
- -
- OMG IDL Operations -

An OMG IDL operation is mapped to C function. Each C operation - function has two mandatory parameters: a first parameter of - interface object type, and a last parameter of - environment type.

-

-

In a C operation function the the in and out - parameters are located between the first and last parameters - described above, and they appear in the same order as in the IDL - operation declaration.

-

Notice that inout parameters are not supported.

-

-

The return value of an OMG IDL operation is mapped to a - corresponding return value of the C operation function.

-

Mandatory C operation function parameters:

- - CORBA_Object oe_obj - the first parameter of a C - operation function. This parameter is required by the OMG C Language Mapping Specification, but in the current - implementation there is no particular use for it. - -

CORBA_Environment* oe_env - the last parameter of a C - operation function. The parameter is defined in the C header - file ic.h and has the following public fields:

- - -

CORBA_Exception_type _major - indicates if an - operation invocation was successful which will be one of - the following:

- - CORBA_NO_EXCEPTION - CORBA_SYSTEM_EXCEPTION - -
- int _fd - a file descriptor returned from - erl_connect function. - int _inbufsz - size of input buffer. - char* _inbuf - pointer to a buffer used for - input. - int _outbufsz - size of output buffer. - char* _outbuf - pointer to a buffer used for - output. - -

int _memchunk - expansion unit size for the - output buffer. This is the size of memory chunks in - bytes used for increasing the output in case of buffer - expansion. The value of this field must be always set - to >= 32, should be at least 1024 for performance - reasons.

-
- char regname[256] - a registered name for a - process. - erlang_pid* _to_pid - an Erlang process - identifier, is only used if the registered_name parameter - is the empty string. - erlang_pid* _from_pid - your own process id so - the answer can be returned -
-

Beside the public fields, other private fields - are internally used but are not mentioned here.

-
-
-

Example:

- -// IDL -interface i1 { - long op1(in long a); - long op2(in string s, out long count); -}; - -

Is mapped to the following C functions

- -/* C */ -CORBA_long i1_op1(i1 oe_obj, CORBA_long a, CORBA_Environment* oe_env) -{ - ... -} -CORBA_long i1_op2(i1 oe_obj, CORBA_char* s, CORBA_long *count, -CORBA_Environment* oe_env) -{ - ... -} - - - -
- Operation Implementation -

There is no standard CORBA mapping for the C-server side, - as it is implementation-dependent but built in a similar way. - The current server side mapping is different from the client - side mapping in several ways:

- - Argument mappings - Result values - Structure - Usage - Exception handling - -
-
- -
- Exceptions -

Although exception mapping is not implemented, the stubs will - generate CORBA system exceptions in case of operation failure. - Thus, the only exceptions propagated by the system are built in - system exceptions.

-
- -
- Access to Attributes -

Not Supported

-
- -
- Summary of Argument/Result Passing for the C-client -

The user-defined parameters can only be in or out - parameters, as - inout parameters are not supported.

-

This table summarize the types a client passes as arguments to - a stub, and receives as a result.

- - - OMG IDL type - In - Out - Return - - - short - CORBA_short - CORBA_short* - CORBA_short - - - long - CORBA_long - CORBA_long* - CORBA_long - - - long long - CORBA_long_long - CORBA_long_long* - CORBA_long_long - - - unsigned short - CORBA_unsigned_short - CORBA_unsigned_short* - CORBA_unsigned_short - - - unsigned long - CORBA_unsigned_long - CORBA_unsigned_long* - CORBA_unsigned_long - - - unsigned long long - CORBA_unsigned_long_long - CORBA_unsigned_long_long* - CORBA_unsigned_long_long - - - float - CORBA_float - CORBA_float* - CORBA_float - - - double - CORBA_double - CORBA_double* - CORBA_double - - - boolean - CORBA_boolean - CORBA_boolean* - CORBA_boolean - - - char - CORBA_char - CORBA_char* - CORBA_char - - - wchar - CORBA_wchar - CORBA_wchar* - CORBA_wchar - - - octet - CORBA_octet - CORBA_octet* - CORBA_octet - - - enum - CORBA_enum - CORBA_enum* - CORBA_enum - - - struct, fixed - struct* - struct* - struct - - - struct, variable - struct* - struct** - struct* - - - union, fixed - union* - union* - union - - - union, variable - union* - union** - union* - - - string - CORBA_char* - CORBA_char** - CORBA_char* - - - wstring - CORBA_wchar* - CORBA_wchar** - CORBA_wchar* - - - sequence - sequence* - sequence** - sequence* - - - array, fixed - array - array - array_slice* - - - array, variable - array - array_slice** - array_slice* - - Basic Argument and Result passing -
-

A client is responsible for providing storage of all arguments passed - as in arguments.

- - - OMG IDL type - Out - Return - - - short - 1 - 1 - - - long - 1 - 1 - - - long long - 1 - 1 - - - unsigned short - 1 - 1 - - - unsigned long - 1 - 1 - - - unsigned long long - 1 - 1 - - - float - 1 - 1 - - - double - 1 - 1 - - - boolean - 1 - 1 - - - char - 1 - 1 - - - wchar - 1 - 1 - - - octet - 1 - 1 - - - enum - 1 - 1 - - - struct, fixed - 1 - 1 - - - struct, variable - 2 - 2 - - - string - 2 - 2 - - - wstring - 2 - 2 - - - sequence - 2 - 2 - - - array, fixed - 1 - 3 - - - array, variable - 3 - 3 - - Client argument storage responsibility -
- - - Case - Description - - - 1 - Caller allocates all necessary storage, except that which may be encapsulated and managed within the parameter itself. - - - 2 - The caller allocates a pointer and passes it by reference to the callee. The callee sets the pointer to point to a valid instance of the parameter's type. The caller is responsible for releasing the returned storage. Following completion of a request, the caller is not allowed to modify any values in the returned storage. To do so the caller must first copy the returned instance into a new instance, then modify the new instance. - - - 3 - The caller allocates a pointer to an array slice which has all the same dimensions of the original array except the first, and passes it by reference to the callee. The callee sets the pointer to point to a valid instance of the array. The caller is responsible for releasing the returned storage. Following completion of a request, the caller is not allowed to modify any values in the returned storage. To do so the caller must first copy the returned instance into a new instance, then modify the new instance. - - Argument passing cases -
-

The returned storage in case 2 and 3 is allocated as one block of memory - so it is possible to deallocate it with one call of CORBA_free.

-
- -
- Supported Memory Allocation Functions - - -

CORBA_Environment can be allocated from the user by calling - CORBA_Environment_alloc().

-

The interface for this function is

-

CORBA_Environment *CORBA_Environment_alloc(int inbufsz, int outbufsz);

-

where :

- - -

inbufsz is the desired size of input buffer

-
- -

outbufsz is the desired size of output buffer

-
- -

return value is a pointer to an allocated and initialized - CORBA_Environment structure

-

-
-
-
- -

Strings can be allocated from the user by calling CORBA_string_alloc().

-

The interface for this function is

-

CORBA_char *CORBA_string_alloc(CORBA_unsigned_long len);

-

where :

- - -

len is the length of the string to be allocated.

-
-
-
-
-

Thus far, no other type allocation function is supported.

-
- -
- Special Memory Deallocation Functions - - -

void CORBA_free(void *storage)

-

This function will free storage allocated by the stub.

-
- -

void CORBA_exception_free(CORBA_environment *ev)

-

This function will free storage allocated under exception propagation.

-
-
-
- -
- Exception Access Functions - - -

CORBA_char *CORBA_exception_id(CORBA_Environment *ev)

-

This function will return raised exception identity.

-
- -

void *CORBA_exception_value(CORBA_Environment *ev)

-

This function will return the value of a raised exception.

-
-
-
- -
- Special Types - - -

The erlang binary type has some special features.

-

-

While the erlang::binary idl type has the same C-definition as - a generated sequence of octets :

- binary; - - }; - ]]> -

it provides a way on sending trasparent data between C and Erlang.

-

The C-definition (ic.h) for an erlang binary is :

- - typedef struct { - CORBA_unsigned_long _maximum; - CORBA_unsigned_long _length; - CORBA_octet* _buffer; - } erlang_binary; /* ERLANG BINARY */ - -

The differences (between erlang::binary and ]]>) are :

- - -

on the erlang side the user is sending/receiving typical - built in erlang binaries, using term_to_binary() / binary_to_term() - to create / extract binary structures.

-
- -

no encoding/decoding functions are generated

-
- -

the underlying protocol is more efficient than usual sequences of - octets

-
-
-

The erlang binary IDL type is defined in erlang.idl, while its - C definition is located in the ic.h header file, both in the - /include]]> directory. - The user will have to include the file erlang.idl in order to use the - erlang::binary type.

-
-
-
- -
- A Mapping Example -

- - This is a small example of a simple stack. There are two - operations on the stack, push and pop. The example shows all - generated files as well as conceptual usage of the stack.

- -// The source IDL file: stack.idl - -struct s { - long l; - string s; -}; - -interface stack { - void push(in s val); - s pop(); -}; - -

When this file is compiled it produces four files, two for the - top scope and two for the stack interface scope. The important parts - of the generated C code for the stack API is shown below. -

-

stack.c

- - -void push(stack oe_obj, s val, CORBA_Environment* oe_env) { - ... -} - - -s* pop(stack oe_obj, CORBA_Environment* oe_env) { - ... -} - -

oe_stack.h

- -#ifndef OE_STACK_H -#define OE_STACK_H - - -/*------------------------------------------------------------ - * Struct definition: s - */ -typedef struct { - long l; - char *s; -} s; - - - -#endif - -

stack.h just contains an include statement of oe_stack.h.

-

oe_code_s.c

- - -int oe_sizecalc_s(CORBA_Environment - *oe_env, int* oe_size_count_index, int* oe_size) { - ... -} - -int oe_encode_s(CORBA_Environment *oe_env, s* oe_rec) { - ... -} - -int oe_decode_s(CORBA_Environment *oe_env, char *oe_first, - int* oe_outindex, s *oe_out) { - ... -} - -

The only files that are really important are the .h - files and the stack.c file.

-
-
- diff --git a/lib/ic/doc/src/ch_c_server.xml b/lib/ic/doc/src/ch_c_server.xml deleted file mode 100644 index df25927c90..0000000000 --- a/lib/ic/doc/src/ch_c_server.xml +++ /dev/null @@ -1,149 +0,0 @@ - - - - -
- - 19982016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - The C Server Back-end - - - 2004-01-14 - C - ch_c_server.xml -
- -
- Introduction -

With the option {be, c_server} the IDL Compiler generates - C server skeletons according to the IDL to C mapping, on top of - the Erlang distribution and gen_server protocols.

-

The developer has to write additional code, that together with - the generated C server skeletons, form a hidden Erlang - node. That additional code contains implementations of call-back - functions that implement the true server functionality, and also - code uses erl_interface functions for defining the hidden - node and for establishing connections to other Erlang nodes.

-
- -
- Generated Stub Files -

The generated stub files are:

- - -

For each IDL interface, a C source file, the name of which - is __s.c]]>. Each operation of the - IDL interface is mapped to a C function (with scoped name) - in that file;

-
- -

C source files that contain functions for type conversion, - memory allocation, and data encoding/decoding;

-
- -

C header files that contain function prototypes and type - definitions.

-
-
-

All C functions are exported (i.e. not declared static).

-
- -
- C Skeleton Functions -

For each IDL operation a C skeleton function is generated, the - prototype of which is __exec( oe_obj, CORBA_Environment *oe_env)]]>, where ]]>, and - CORBA_Environment are of the same type as for the - generated C client stubs code.

-

Each __exec()]]> function calls the - call-back function

-

_rs* __cb( oe_obj, , CORBA_Environment *oe_env)]]>

-

where the arguments are of the same type as those generated for - C client stubs.

-

The return value _rs* ]]> is a pointer - to a function with the same signature as the call-back function - _cb]]>, and is called after the call-back - function has been evaluated (provided that the pointer is not equal - to NULL).

-
- -
- The Server Loop -

The developer has to implement code for establishing connections - with other Erlang nodes, code for call-back functions and restore - functions.

-

-

In addition, the developer also has to implement code for a - server loop, that receives messages and calls the relevant - __exec function. For that purpose the IC library function - oe_server_receive() function can be used.

-
- -
- Generating, Compiling and Linking -

To generate the C server skeletons type the following in an - appropriate shell:

-

erlc -I ICROOT/include "+{be, c_server}" File.idl,

-

where ICROOT is the root of the IC application. The - -I ICROOT/include is only needed if File.idl - refers to erlang.idl.

-

When compiling a generated C skeleton file, the directories - ICROOT/include and EICROOT/include, have to be - specified as include directories, where EIROOT is the - root directory of the Erl_interface application.

-

When linking object files the EIROOT/lib and - ICROOT/priv/lib directories have to be specified.

-
- -
- An Example -

In this example the IDL specification file "random.idl" is used - for generating C server skeletons (the file is contained in the IC - /examples/c-server directory):

- -module rmod { - - interface random { - - double produce(); - - oneway void init(in long seed1, in long seed2, in long seed3); - - }; - -}; -

Generate the C server skeletons:

- -erlc '+{be, c_server}' random.idl -Erlang IDL compiler version X.Y.Z -

Six files are generated.

-

Compile the C server skeletons:

-

Please read the ReadMe file in the - examples/c-server directory.

-

In the same directory you can find all the code for this - example. In particular you will find the server.c file - that contains all the additional code that must be written to - obtain a complete server.

-

In the examples/c-server directory you will also find - source code for an Erlang client, which can be used for testing - the C server.

-
-
- - diff --git a/lib/ic/doc/src/ch_erl_genserv.xml b/lib/ic/doc/src/ch_erl_genserv.xml deleted file mode 100644 index aa162b3652..0000000000 --- a/lib/ic/doc/src/ch_erl_genserv.xml +++ /dev/null @@ -1,206 +0,0 @@ - - - - -
- - 19982016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Using the Erlang Generic Server Back-end - - - 98-08-06 - B - ch_erl_genserver.xml -
- -
- Introduction -

The mapping of OMG IDL to the Erlang programming language when Erlang - generic server is the back-end of choice is similar to the one used in - the chapter 'OMG IDL Mapping'. - The only difference is in the generated code, a client stub and - server skeleton to an Erlang gen_server. Orber's User's Guide - contain a more detailed description of IDL to Erlang mapping.

-
- -
- Compiling the Code -

The ic:gen/2 function can be called from the command - line as follows:

-

- -shell> erlc "+{be, erl_genserv}" MyFile.idl - -
- -
- Writing the Implementation File -

For each IDL interface ]]> defined in the IDL file :

- - Create the corresponding Erlang file that will hold the - Erlang implementation of the IDL definitions. - Call the implementation file after the scope of the IDL interface, - followed by the suffix _impl. - Export the implementation functions. - -

For each function defined in the IDL interface :

- - Implement an Erlang function that uses as arguments in the same - order, as the input arguments described in the IDL file, and returns - the value described in the interface. - When using the function, follow the mapping described in chapter 2. - -
- -
- An Example -

In this example, a file random.idl generates code for the Erlang - gen_server back-end:

- -// Filename random.idl -module rmod { - - interface random { - // Generate a new random number - double produce(); - // Initialize random generator - oneway void init(in long seed1, in long seed2, in long seed3); - - }; -}; - -

When the file "random.idl" is compiled (e.g., shell> erlc "+{be, erl_genserv}" random.idl) - five files are produced; two for the top scope, two for the interface scope, - and one for the module scope. The header files for top scope and interface - are empty and not shown here. In this case, the stub/skeleton file - rmod_random.erl is the most important. This module exports two kinds of - operations:

- - Administrative - used when, for example, creating and - terminating the server. - IDL dependent - operations defined in the IDL - specification. In this case, produce and init. - - -
- Administrative Operations -

To create a new server instance, one of the following functions should - be used:

- - oe_create/0/1/2 - create a new instance of the object. - Accepts Env and RegName, in that order, as parameters. - The former is passed uninterpreted to the initialization operation - of the call-back module, while the latter must be as the - gen_server parameter ServerName. If Env is - left out, an empty list will be passed. - oe_create_link/0/1/2 - similar to oe_create/0/1/2, - but create a linked server. - typeID/0 - returns the scooped id compliant with the - OMG standard. In this case the string - "IDL:rmod/random:1.0". - stop/1 - asynchronously terminate the server. The required - argument is the return value from any of the start functions. - -
- -
- IDL Dependent Operations -

Operations can either be synchronous or asynchronous - (i.e., oneway). These are, respectively, mapped to - gen_server:call/2/3 and gen_server:cast/2. - Consult the gen_server documentation for valid return values.

-

The IDL dependent operations in this example are listed below. - The first argument must be the whatever the create operation returned.

- - init(ServerReference, Seed1, Seed2, Seed3) - initialize - the random number generator. - produce(ServerReference) - generate a new random number. - -
-

If the compile option timeout is used a timeout must be added - (e.g., produce(ServerReference, 5000)). For more information, see - the gen_server documentation.

- -
- Implementation Module -

The implementation module shall, unless the compile option - impl is used, be named rmod_random_impl.erl. - and could look like this:

- --module('rmod_random_impl'). -%% Mandatory gen_server operations --export([init/1, terminate/2, code_change/3]). -%% Add if 'handle_info' compile option used --export([handle_info/2]). -%% API defined in IDL specification --export([produce/1,init/4]). - -%% Mandatory operations -init(Env) -> - {ok, []}. - -terminate(From, Reason) -> - ok. - -code_change(OldVsn, State, Extra) -> - {ok, State}. - -%% Optional -handle_info(Info, State) -> - {noreply, NewState}. - -%% IDL specification -produce(State) -> - case catch random:uniform() of - {'EXIT',_} -> - {stop, normal, "random:uniform/0 - EXIT", State}; - RUnif -> - {reply, RUnif, State} - end. - - -init(State, S1, S2, S3) -> - case catch random:seed(S1, S2, S3) of - {'EXIT',_} -> - {stop, normal, State}; - _ -> - {noreply, State} - end. - -

Compile the code and run the example:

- make:all(). -Recompile: rmod_random -Recompile: oe_random -Recompile: rmod_random_impl -up_to_date -2> {ok,R} = rmod_random:oe_create(). -{ok,<0.30.0>} -3> rmod_random:init(R, 1, 2, 3). -ok -4> rmod_random:produce(R). -1.97963e-4 -5> - ]]> -
-
-
- - diff --git a/lib/ic/doc/src/ch_erl_plain.xml b/lib/ic/doc/src/ch_erl_plain.xml deleted file mode 100644 index 27387d1624..0000000000 --- a/lib/ic/doc/src/ch_erl_plain.xml +++ /dev/null @@ -1,176 +0,0 @@ - - - - -
- - 19982016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Using the Plain Erlang Back-end - - - 98-05-06 - B - ch_erl_plain.xml -
- -
- Introduction -

The mapping of OMG IDL to the Erlang programming language when - Plain Erlang - is the back-end of choice is similar to the one used in pure Erlang IDL - mapping. The only difference is on the generated code and the extended - use of pragmas for code generation: IDL functions are translated - to Erlang - module function calls.

-
- -
- Compiling the Code -

In the Erlang shell type :

-

ic:gen(, [{be, erl_plain}])]]>.

-
- -
- Writing the Implementation File -

For each IDL interface ]]> defined in the IDL file:

- - Create the corresponding Erlang file that will hold the - Erlang implementation of the IDL definitions. - Call the implementation file after the scope of the IDL interface, - followed by the suffix _impl. - Export the implementation functions. - -

For each function defined in the IDL interface :

- - Implement an Erlang function that uses as arguments in the same - order, as the input arguments described in the IDL file, and returns - the value described in the interface. - When using the function, follow the mapping described in chapter 2. - -
- -
- An Example -

- - In this example, a file "random.idl" is generates code for the plain Erlang - back-end :

- - -

Main file : "plain.idl"

- - -module rmod { - - interface random { - - double produce(); - - oneway void init(in long seed1, in long seed2, in long seed3); - - }; - -}; - -
-
-

Compile the file :

- - Erlang (BEAM) emulator version 4.9 - - Eshell V4.9 (abort with ^G) - 1> ic:gen(random,[{be, erl_plain}]). - Erlang IDL compiler version 2.5.1 - ok - 2> - -

-

When the file "random.idl" is compiled it produces five files: two for - the top scope, two for the interface scope, and one for the module - scope. The header files for top scope and interface - are empty and not shown here. In this case only the file for the interface - rmod_random.erl is important :. - -

- - -

Erlang file for interface : "rmod_random.erl"

- - --module(rmod_random). - - - -%% Interface functions --export([produce/0, init/3]). - -%%------------------------------------------------------------ -%% Operation: produce -%% -%% Returns: RetVal -%% -produce() -> - rmod_random_impl:produce(). - -%%------------------------------------------------------------ -%% Operation: init -%% -%% Returns: RetVal -%% -init(Seed1, Seed2, Seed3) -> - rmod_random_impl:init(Seed1, Seed2, Seed3). - -
-
-

The implementation file should be called rmod_random_impl.erl - and could look like this:

- - -module('rmod_random_impl'). - - -export([produce/0,init/3]). - - - produce() -> - random:uniform(). - - - init(S1,S2,S3) -> - random:seed(S1,S2,S3). - -

Compiling the code :

- -2> make:all(). -Recompile: rmod_random -Recompile: oe_random -Recompile: rmod_random_impl -up_to_date - -

-

Running the example :

- -3> rmod_random:init(1,2,3). -ok -4> rmod_random:produce(). -1.97963e-4 -5> - -
-
- diff --git a/lib/ic/doc/src/ch_ic_protocol.xml b/lib/ic/doc/src/ch_ic_protocol.xml deleted file mode 100644 index cb64500f6e..0000000000 --- a/lib/ic/doc/src/ch_ic_protocol.xml +++ /dev/null @@ -1,234 +0,0 @@ - - - - -
- - 20032016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - IC Protocol - - - 2003-12-11 - PA1 - ch_ic_protocol.xml -
-

The purpose of this chapter is to explain the bits and bytes of the - IC protocol, which is a composition of the Erlang distribution protocol - and the Erlang/OTP gen_server protocol. If you do not intend to replace - the Erlang distribution protocol, or replace the gen_server protocol, - skip over this chapter. -

- -
- Introduction -

The IDL Compiler (IC) transforms Interface Definition Language - (IDL) specifications files to interface code for Erlang, C, and - Java. The Erlang language mapping is described in the Orber - documentation, while the other mappings are described in the IC - documentation (they are of course in accordance with the CORBA C - and Java language mapping specifications, with some restrictions). -

-

The most important parts of an IDL specification are the operation - declarations. An operation defines what information a client - provides to a server, and what information (if any) the client - gets back from the server. We consider IDL operations and language - mappings in section 2. -

-

What we here call the IC protocol, is the description of messages - exchanged between IC end-points (client and servers). It is valid - for all IC back-ends, except the 'erl_plain' and 'erl_corba' - back-ends. - The IC protocol is in turn embedded into the Erlang gen_server - protocol, which is described below. - Finally, the gen_server protocol is embedded in the Erlang - distribution protocol. Pertinent parts of that protocol is - described further below. -

-
- -
- Language mappings and IDL operations - -
- IDL Operations -

An IDL operation is declared as follows:

- - [oneway] RetType Op(in IType1 I1, in IType2 I2, ..., in ITypeN IN, - out OType1 O1, out OType2 O2, ..., out OTypeM OM) - N, M = 0, 1, 2, ... (2.1.1) - -

`Op' is the operation name, RetType is the return type, and ITypei, - i = 1, 2, ..., N, and OTypej, j = 1, 2, ..., M, are the `in' types - and `out' types, respectively. The values I1, I2, ..., IN are - provided by the caller, and the value of RetType, and the values - O1, O2, ..., OM, are provided as results to the caller. -

-

The types can be any basic types or derived types declared in the - IDL specification of which the operation declaration is a part. -

-

If the RetType has the special name `void' there is no return - value (but there might still be result values O1, 02, ..., OM). -

-

The `in' and `out' parameters can be declared in any order, but - for clarity we have listed all `in' parameters before the `out' - parameters in the declaration above. -

-

If the keyword `oneway' is present, the operation is a cast, i.e. - there is no confirmation of the operation, and consequently there - must be no result values: RetType must be equal to `void', and M = - 0 must hold. -

-

Otherwise the operation is a call, i.e. it is confirmed (or else - an exception is raised). -

-

Note carefully that an operation declared without `oneway' is - always a call, even if RetType is `void' and M = 0. -

-
- -
- Language Mappings -

There are several CORBA Language Mapping specifications. These are - about mapping interfaces to various programming languages. IC - supports the CORBA C and Java mapping specifications, and the - Erlang language mapping specified in the Orber documentation. -

-

Excerpt from "6.4 Basic OMG IDL Types" in the Orber User's Guide: -

- - -

Functions with return type void will return the atom ok.

-
-
-

Excerpt from "6.13 Invocations of Operations" in the Orber User's - Guide: -

- - -

A function call will invoke an operation. The first parameter - of the function should be the object reference and then all in - and inout parameters follow in the same order as specified in - the IDL specification. The result will be a return value - unless the function has inout or out parameters specified; in - which case, a tuple of the return value, followed by the - parameters will be returned.

-
-
-

Hence the function that is mapped from an IDL operation to Erlang - always have a return value (an Erlang function always has). That - fact has influenced the IC protocol, in that there is always a - return value (which is 'ok' if the return type was declared 'void').

-
-
- -
- IC Protocol -

Given the operation declaration (2.1.1) the IC protocol maps to - messages as follows, defined in terms of Erlang terms. -

- -
- Call (Request/Reply, i.e. not oneway) - - request: Op atom() N = 0 - {Op, I1, I2, ..., IN} tuple() N > 0 - (3.1.1) - - reply: Ret M = 0 - {Ret, O1, O2, ..., OM} M > 0 - (3.1.2) -

Notice: Even if the RetType of the operation Op is - declared to be 'void', a return value 'ok' is returned in - the reply message. That - return value is of no significance, and is therefore ignored (note - however that a C server back-end returns the atom 'void' instead - of 'ok'). -

-
- -
- Cast (oneway) - - - notification: Op atom() N = 0 - {Op, I1, I2, ..., IN} tuple() N > 0 - (3.2.1) -

(There is of course no return message). -

-
-
- -
- Gen_server Protocol -

Most of the IC generated code deals with encoding and decoding the - gen_server protocol. -

- -
- Call - - - request: {'$gen_call', {self(), Ref}, Request} (4.1.1) - - reply: {Ref, Reply} (4.1.2) -

where Request and Reply are the messages defined in the previous - chapter. -

-
- -
- Cast - - notification: {'$gen_cast', Notification} (4.2.1) -

where Notification is the message defined in the previous chapter. -

-
-
- -
- Erlang Distribution Protocol -

Messages (of interest here) between Erlang nodes are of the form:

- - Len(4), Type(1), CtrlBin(N), MsgBin(M) (5.1) -

Type is equal to 112 = PASS_THROUGH. -

-

CtrlBin and MsgBin are Erlang terms in binary form (as if created - by term_to_binary/1), whence for each of them the first byte is - equal to 131 = VERSION_MAGIC. -

-

CtrlBin (of interest here) contains the SEND and REG_SEND control - messages, which are binary forms of the Erlang terms

- - {2, Cookie, ToPid} , (5.2) -

and

- - {6, FromPid, Cookie, ToName} , (5.3) -

respectively. -

-

The CtrlBin(N) message is read and written by erl_interface code - (C), j_interface code (Java), or the Erlang distribution - implementation, which are invoked from IC generated code. -

-

The MsgBin(N) is the "real" message, i.e. of the form described - in the previous section. -

-
-
- diff --git a/lib/ic/doc/src/ch_introduction.xml b/lib/ic/doc/src/ch_introduction.xml deleted file mode 100644 index 9ac2f96a95..0000000000 --- a/lib/ic/doc/src/ch_introduction.xml +++ /dev/null @@ -1,149 +0,0 @@ - - - - -
- - 19982016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Using the IC Compiler - - - 2002-08-02 - PB1 - ch_introduction.xml -
- -
- Introduction -

The IC application is an IDL compiler implemented in Erlang. - The IDL compiler generates client stubs and server skeletons. - Several back-ends are supported, and they fall into three main - groups.

-

The first group consists of a CORBA back-end:

- - IDL to Erlang CORBA - -

This back-end is for CORBA communication and implementation, - and the generated code uses the CORBA specific protocol for - communication between clients and servers. See the - Orber application User's Guide and manuals for - further details.

-
-
-

The second group consists of a simple Erlang back-end:

- - IDL to plain Erlang - -

This back-end provides a very simple Erlang client - interface. It can only be used within an Erlang node, - and the communication between client and "server" is - therefore in terms of ordinary function calls.

-

This back-end can be considered a short-circuit version of - the IDL to Erlang gen_server back-end (see further below).

-
-
-

The third group consists of backends for Erlang, C, and - Java. The communication between clients and servers is by the - Erlang distribution protocol, facilitated by - erl_interface and jinterface for C and Java, - respectively.

-

All back-ends of the third group generate code compatible with - the Erlang gen_server behavior protocol. Thus generated client - code corresponds to call() or cast() of an Erlang - gen_server. Similarly, generated server code corresponds - to handle_call() or handle_cast() of an Erlang - gen_server.

-

The back-ends of the third group are: -

- - IDL to Erlang gen_server - -

Client stubs and server skeletons are generated. Data types - are mapped according to the IDL to Erlang mapping described - in the Orber User's Guide.

-

-
- IDL to C client - -

Client stubs are generated. The mapping of data types is - described further on in the C client part of this guide.

-
- IDL to C server - -

Server skeletons are generated. The mapping of data types is - described further on in the C server part of this guide.

-
- IDL to Java - -

Client stubs and server skeletons are generated. The mapping - of data types is described further on in the Java part of - this guide.

-
-
-
- -
- Compilation of IDL Files -

The IC compiler is invoked by executing the generic erlc - compiler from a shell:

- -%> erlc +'{be,BackEnd}' File.idl - -

where BackEnd is according to the table below, and - File.idl is the IDL file to be compiled.

- - - Back-end - BackEndoption - - - IDL to CORBA - erl_corba - - - IDL to CORBA template - erl_template - - - IDL to plain Erlang - erl_plain - - - IDL to Erlang gen_server - erl_genserv - - - IDL to C client - c_client - - - IDL to C server - c_server - - - IDL to Java - java - - Compiler back-ends and options -
-

For more details on IC compiler options consult the ic(3) manual page.

-
-
- diff --git a/lib/ic/doc/src/ch_java.xml b/lib/ic/doc/src/ch_java.xml deleted file mode 100644 index a733adaf65..0000000000 --- a/lib/ic/doc/src/ch_java.xml +++ /dev/null @@ -1,738 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - IDL to Java language Mapping - - - 98-09-24 - A - ch_java.xml -
- -
- Introduction -

This chapter describes the mapping of OMG IDL constructs to the Java - programming language for the generation of native Java - Erlang - communication.

-

This language mapping defines the following:

- - -

All OMG IDL basic types

-
- -

All OMG IDL constructed types

-
- -

References to constants defined in OMG IDL

-
- -

Invocations of operations, including passing of - parameters and receiving of result

-
- -

Access to attributes

-
-
-
- -
- Specialties in the Mapping - -
- Names Reserved by the Compiler -

The IDL compiler reserves all identifiers starting with - OE_ and oe_ for internal use.

-
-
- -
- Basic OMG IDL Types -

The mapping of basic types are according to the standard. All basic types have - a special Holder class.

- - - OMG IDL type - Java type - - - float - float - - - double - double - - - short - short - - - unsigned short - short - - - long - int - - - long long - long - - - unsigned long - long - - - unsigned long long - long - - - char - char - - - wchar - char - - - boolean - boolean - - - octet - octet - - - string - java.lang.String - - - wstring - java.lang.String - - - any - Any - - - long double - Not supported - - - Object - Not supported - - - void - void - - OMG IDL basic types -
-
- -
- Constructed OMG IDL Types -

All constructed types are according to the standard with three (3) major exceptions.

-

- - -

The IDL Exceptions are not implemented in this Java mapping.

-

-
- -

The functions used for read/write to streams, defined in Helper functions - are named unmarshal (instead for read) and marshal (instead for write).

-

-
- -

The streams used in Helper functions are OtpInputStream for - input and OtpOutputStream for output.

-

-
-
-
- -
- Mapping for Constants -

Constants are mapped according to the standard.

-
- -
- Invocations of Operations -

Operation invocation is implemented according to the standard. - The implementation is in the class Stub.java]]> which implements - the interface in .java]]>.

- -test._iStub client; - -client.op(10); - - -
- Operation Implementation -

The server is implemented through extension of the class - ImplBase.java]]> and implementation of all the methods in the - interface.

- -public class server extends test._iImplBase { - - public void op(int i) throws java.lang.Exception { - System.out.println("Received call op()"); - o.value = i; - return i; - } - -} - -
-
- -
- Exceptions -

While exception mapping is not implemented, the stubs will - generate some Java exceptions in case of operation failure. - No exceptions are propagated through the communication.

-
- -
- Access to Attributes -

Attributes are supported according to the standard.

-
- -
- Summary of Argument/Result Passing for Java -

All types (in, out or inout) of user defined parameters are supported - in the Java mapping. This is also the case in the Erlang mappings but not in the C - mapping. inout parameters are not supported in the C mapping so if you are going to - do calls to or from a C program inout cannot be used in the IDL specifications.

-

out and inout parameters must be of Holder types. There is a jar file ( ic.jar) - with Holder classes for the basic types in the ic application. This library is in the directory - /priv]]>.

-
- -
- Communication Toolbox -

The generated client and server stubs use the classes - defined in the jinterface package to communicate - with other nodes. - The most important classes are :

- - -

OtpInputStream which is the stream class used for incoming message storage

-

-
- -

OtpOutputStream which is the stream class used for outgoing message storage

-

-
- -

OtpErlangPid which is the process identification class used to identify processes inside - a java node.

-

The recommended constructor function for the OtpErlangPid is - OtpErlangPid(String node, int id, int serial, int creation) where :

-

- - -

String node, is the name of the node where this process runs.

-

-
- -

int id, is the identification number for this identity.

-

-
- -

int serial, internal information, must be an 18-bit integer.

-

-
- -

int creation, internal information, must have value in range 0..3.

-

-
-
-
- -

OtpConnection which is used to define a connection between nodes.

-

While the connection object is stub side constructed in client stubs, it is - returned after calling the accept function from an OtpErlangServer object - in server stubs. - The following methods used for node connection :

-

- - -

OtpInputStream receiveBuf(), which returns the incoming streams that - contain the message arrived.

-

-
- -

void sendBuf(OtpErlangPid client, OtpOutputStream reply), which sends - a reply message (in an OtpOutputStream form) to the client node.

-

-
- -

void close(), which closes a connection.

-

-
-
-
- -

OtpServer which is used to define a server node.

-

The recommended constructor function for the OtpServer is :

-

- - -

OtpServer(String node, String cookie). where :

-

- - -

node is the requested name for the new java node, - represented as a String object.

-

-
- -

cookie is the requested cookie name for the new java node, - represented as a String object.

-

-
-
-
-
-

The following methods used for node registration and connection acceptance :

-

- - -

boolean publishPort(), which registers the server node to epmd daemon.

-

-
- -

OtpConnection accept(), which waits for a connection and returns the - OtpConnection object which is unique for each client node.

-

-
-
-
-
-
- -
- The Package com.ericsson.otp.ic -

The package com.ericsson.otp.ic - contains a number of java classes specially designed for the IC generated java-back-ends :

- - -

Standard java classes defined through OMG-IDL java mapping :

- - -

BooleanHolder

-
- -

ByteHolder

-
- -

CharHolder

-
- -

ShortHolder

-
- -

IntHolder

-
- -

LongHolder

-
- -

FloatHolder

-
- -

DoubleHolder

-
- -

StringHolder

-
- -

Any, - AnyHelper, - AnyHolder

-
- -

TypeCode

-
- -

TCKind

-

-
-
-
- -

Implementation-dependant classes :

- - -

Environment

-
- -

Holder

-

-
-
-
- -

Erlang compatibility classes :

- - -

Pid, - PidHelper, - PidHolder

-

The Pid class originates from OtpErlangPid and is used to - represent the Erlang built-in pid type, a process's identity. - PidHelper and PidHolder are helper respectively holder classes for Pid.

-

-
- -

Ref, - RefHelper, - RefHolder

-

The Ref class originates from OtpErlangRef and is used to - represent the Erlang built-in ref type, an Erlang reference. - RefHelper and RefHolder are helper respectively holder classes for Ref.

-

-
- -

Port, - PortHelper, - PortHolder

-

The Port class originates from OtpErlangPort and is used to - represent the Erlang built-in port type, an Erlang port. - PortHelper and PortHolder are helper respectively holder classes for Port.

-

-
- -

Term, - TermHelper, - TermHolder

-

The Term class originates from Any and is used to - represent the Erlang built-in term type, an Erlang term. - TermHelper and TermHolder are helper respectively holder classes for Term.

-

-
-
-

To use the Erlang build-in classes, you will have to include the file erlang.idl - located under $OTPROOT/lib/ic/include.

-
-
-
- -
- The Term Class -

The Term class is intended to represent the Erlang term generic type. - It extends the Any class and it is basically used in the same way as - in the Any type.

-

The big difference between Term and Any is the use of guard methods - instead of TypeCode to determine the data included in the Term. - This is especially true when the Term's value class cannot be - determined at compilation time. The guard methods found in Term :

- - -

boolean isAtom() returns true if the Term is an OtpErlangAtom, false otherwise

-

-
- -

boolean isConstant() returns true if the Term is neither an OtpErlangList nor an OtpErlangTuple, false otherwise

-

-
- -

boolean isFloat() returns true if the Term is an OtpErlangFloat, false otherwise

-

-
- -

boolean isInteger() returns true if the Term is an OtpErlangInt, false otherwise

-

-
- -

boolean isList() returns true if the Term is an OtpErlangList, false otherwise

-

-
- -

boolean isString() returns true if the Term is an OtpErlangString, false otherwise

-

-
- -

boolean isNumber() returns true if the Term is an OtpErlangInteger or an OtpErlangFloat, false otherwise

-

-
- -

boolean isPid() returns true if the Term is an OtpErlangPid or Pid, false otherwise

-

-
- -

boolean isPort() returns true if the Term is an OtpErlangPort or Port, false otherwise

-

-
- -

boolean isReference() returns true if the Term is an OtpErlangRef, false otherwise

-

-
- -

boolean isTuple() returns true if the Term is an OtpErlangTuple, false otherwise

-

-
- -

boolean isBinary() returns true if the Term is an OtpErlangBinary, false otherwise

-

-
-
-
- -
- Stub File Types -

For each interface, three (3) stub/skeleton files are generated :

- - -

A java interface file, named after the idl interface.

-

-
- -

A client stub file, named after the convention Stub]]> - which implements the java interface. Example : _stackStub.java

-

-
- -

A server stub file, named after the convention ImplBase]]> - which implements the java interface. Example : _stackImplBase.java

-

-
-
-
- -
- Client Stub Initialization, Methods Exported -

The recommended constructor function for client stubs accepts four (4) parameters :

-

- - -

String selfNode, the node identification name to be used in the new - client node.

-

-
- -

String peerNode, the node identification name where the client process is running.

-

-
- -

String cookie, the cookie to be used.

-

-
- -

Object server, where the java Object can be one of:

-

- - -

OtpErlangPid, the server's process identity under the node where the server - process is running.

-

-
- -

String, the server's registered name under the node where the server - process is running.

-

-
-
-
-
-

The methods exported from the generated client stub are :

-

- - -

void __disconnect(), which disconnects the server connection.

-

-
- -

void __reconnect(), which disconnects the server connection if open, - and then connects to the same peer.

-

-
- -

void __stop(), which sends the standard stop termination call. - When connected to an Erlang server, the server will be terminated. - When connected to a java server, this will set a stop flag that - denotes that the server must be terminated.

-

-
- -

com.ericsson.otp.erlang.OtpErlangRef __getRef(), will return the message reference - received from a server that denotes which call it is referring to. - This is useful when building asynchronous clients.

-

-
- -

java.lang.Object __server(), which returns the server for the current connection.

-

-
-
-
- -
- Server Skeleton Initialization, Server Stub Implementation, Methods Exported -

The constructor function for server skeleton accepts no parameters.

-

The server skeleton file contains a server switch which - decodes messages from the input stream and calls implementation - (callback) functions. - As the server skeleton is declared abstract, the application - programmer will have to create a stub class that extends the - skeleton file. In this class, all operations defined in the interface - class, generated under compiling the idl file, are implemented.

-

The server skeleton file exports the following methods:

-

- - -

OtpOutputStrem invoke(OtpInputStream request), where the input - stream request is unmarshalled, the implementation function is called - and a reply stream is marshalled.

-

-
- -

boolean __isStopped(), which returns true if a stop message is received. - The implementation of the stub should always check if such a message is received - and terminate if so.

-

-
- -

boolean __isStopped(com.ericsson.otp.ic.Environment), which returns true if - a stop message is received for a certain Environment and Connection. - The implementation of the stub should always check if such a message is received - and terminate if so.

-

-
- -

OtpErlangPid __getCallerPid(), which returns the caller identity for the latest call.

-

-
- -

OtpErlangPid __getCallerPid(com.ericsson.otp.ic.Environment), which returns the caller - identity for the latest call on a certain Environment.

-

-
- -

java.util.Dictionary __operations(), which returns the operation dictionary which - holds all operations supported by the server skeleton.

-

-
-
-
- -
- A Mapping Example -

- - This is a small example of a simple stack. There are two - operations on the stack, push and pop. The example shows some of the - generated files.

- -// The source IDL file: stack.idl - -struct s { - long l; - string s; -}; - -interface stack { - void push(in s val); - s pop(); -}; - -

When this file is compiled it produces eight files. Three important files - are shown below. -

-

The public interface is in stack.java.

- - -public interface stack { - -/**** - * Operation "stack::push" interface functions - * - */ - - void push(s val) throws java.lang.Exception; - -/**** - * Operation "stack::pop" interface functions - * - */ - - s pop() throws java.lang.Exception; - -} - -

For the IDL struct s three files are generated, a public class in s.java.

- - -final public class s { - // instance variables - public int l; - public java.lang.String s; - - // constructors - public s() {}; - public s(int _l, java.lang.String _s) { - l = _l; - s = _s; - }; - -}; - -

A holder class in sHolder.java and a helper class in sHelper.java. - The helper class is used for marshalling.

- - -public class sHelper { - - // constructors - private sHelper() {}; - - // methods - public static s unmarshal(OtpInputStream in) - throws java.lang.Exception { - : - : - }; - - public static void marshal(OtpOutputStream out, s value) - throws java.lang.Exception { - : - : - }; - -}; - -
- -
- Running the Compiled Code -

When using the generated java code you must have added - /priv]]> and - /priv]]> to your - CLASSPATH variable to get - basic Holder types and the communication classes.

-
-
- diff --git a/lib/ic/doc/src/erl-part.xml b/lib/ic/doc/src/erl-part.xml deleted file mode 100644 index 9c9cb6a574..0000000000 --- a/lib/ic/doc/src/erl-part.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - -
- - 20022016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - IDL to Erlang language Mapping - - - 2002-06-25 - A -
- -

Tjosan Erlang

-
- - -
- diff --git a/lib/ic/doc/src/ic.xml b/lib/ic/doc/src/ic.xml deleted file mode 100644 index 98e8414a4e..0000000000 --- a/lib/ic/doc/src/ic.xml +++ /dev/null @@ -1,468 +0,0 @@ - - - - -
- - 19972016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - ic - - - - 2004-01-08 - B -
- ic - The Erlang IDL Compiler - -

The ic module is an Erlang implementation of an OMG IDL - compiler. Depending on the choice of back-end the code will map - to Erlang, C, or Java. The compiler generates client stubs and - server skeletons.

-

Two kinds of files are generated for each scope: Ordinary code - files and header files. The latter are used for defining record - definitions, while the ordinary files contain the object - interface functions.

-
- - - ic:gen(FileName) -> Result - ic:gen(FileName, [Option]) -> Result - Generate stub and server code according to the OMG CORBA standard. - - Result = ok | error | {ok, [Warning]} | {error, [Warning], [Error]} - - Option = [ GeneralOption | CodeOption | WarningOption | BackendOption] - - GeneralOption = - {outdir, String()} | {cfgfile, String()} | {use_preproc, bool()} | - {preproc_cmd, String()} | {preproc_flags, String()} - - CodeOption = - {gen_hrl, bool()} | {serv_last_call, exception | exit} | {{impl, String()}, String()} | {light_ifr, bool()} - this | {this, String()} | {{this, String()}, bool()} | - from | {from, String()} | {{from, String()}, bool()} | - handle_info | {handle_info, String()} | {{handle_info, String()}, bool()} | - timeout | {timeout, String()} | {{timeout, String()}, bool()} | - {scoped_op_calls, bool()} | {scl, bool()} | - {user_protocol, Prefix} | - {c_timeout, {SendTimeout, RecvTimeout}} | - {c_report, bool()} | - {precond, {atom(), atom()}} | {{precond, String()} {atom(), atom()}} | - {postcond, {atom(), atom()}} | {{postcond, String()} {atom(), atom()}} - - WarningOption = - {'Wall', bool()} | {maxerrs, int() | infinity} | - {maxwarns, int() | infinity} | {nowarn, bool()} | - {warn_name_shadow, bool()} | {pedantic, bool()} | - {silent, bool()} - - BackendOption = {be, Backend} - - Backend = erl_corba | erl_template | erl_plain | erl_genserv | c_client | c_server | java - - DirNAme = string() | atom() - FileName = string() | atom() - - -

The tuple {Option, true} can be replaced by - Option for boolean values.

-

The ic:gen/2 function can be called from the command - line as follows:

-

erlc "+Option" ... File.idl

-

Example:

-

erlc "+{be,c_client}" '+{outdir, "../out"}' File.idl

-
-
-
- -
- General options - - outdir - -

Places all output files in the directory given by the option. - The directory will be created if it does not already exist.

-

Example option: {outdir, "output/generated"}.

-
- cfgfile - -

Uses FileName as configuration file. Options will - override compiler defaults but can be overridden by command line - options. Default value is ".ic_config".

-

Example option: {cfgfile, "special.cfg"}.

-
- use_preproc - -

Uses a preprocessor. Default value is true.

-
- preproc_cmd - -

Command string to invoke the preprocessor. The actual - command will be built as - preproc_cmd++preproc_flags++FileName

-

Example option: {preproc_cmd, "erl"}).

-

Example option: {preproc_cmd, "gcc -x c++ -E"}.

-
- preproc_flags - -

Flags given to the preprocessor.

-

Example option: {preproc_flags, "-I../include"}.

-
-
-
- -
- Code options - - light_ifr - -

Currently, the default setting is false. To be able to - use this option Orber must be configured to use Light IFR (see - Orber's User's Guide). When this options is used, the size of the - generated files used to register the API in the IFR DB are minimized.

-

Example option: {light_ifr, true}.

-
- gen_hrl - -

Generate header files. Default is true.

-
- serv_last_call - -

Makes the last gen_server handle_call either raise a - CORBA exception or just exit plainly. Default is the exception. -

-
- {{impl, IntfName}, ModName} - -

Assumes that the interface with name IntfName is - implemented by the module with name ModName and - will generate calls to the ModName module in the - server behavior. Note that the IntfName must be a - fully scoped name as in "M1::I1".

-

-
- this - -

Adds the object reference as the first parameter to the - object implementation functions. This makes the - implementation aware of its own object reference. -

-The option - comes in three varieties: this which activates the - parameter for all interfaces in the source file, {this, IntfName} which activates the parameter for a specified - interface and {{this, IntfName}, false} which - deactivates the parameter for a specified - interface.

-

Example option: this) activates the parameter for - all interfaces.

-

Example option: {this, "M1::I1"} activates the - parameter for all functions of M1::I1.

-

Example options: [this, {{this, "M1::I2"}, false}] - activates the parameter for all interfaces except - M1::I2.

-
- from - -

Adds the invokers reference as the first parameter to the - object implementation two-way functions. If both - from and this options are used the invokers - reference parameter will be passed as the second - parameter. This makes it possible for the implementation to - respond to a request and continue executing - afterwards. Consult the gen_server and Orber - documentation how this option may be used.

-The option - comes in three varieties: from which activates the - parameter for all interfaces in the source file, {from, IntfName} which activates the parameter for a specified - interface and {{from, IntfName}, false} which - deactivates the parameter for a specified interface.

-

Example option: from) activates the parameter for - all interfaces.

-

Example options: [{from, "M1::I1"}] activates the - parameter for all functions of M1::I1.

-

Example options: [from, {{from, "M1::I2"}, false}] - activates the parameter for all interfaces except - M1::I2.

-
- handle_info - -

Makes the object server call a function handle_info - in the object implementation module on all unexpected - messages. Useful if the object implementation need to trap - exits.

-

Example option: handle_info will activates module - implementation handle_info for all interfaces in the - source file.

-

Example option: {{handle_info, "M1::I1"}, true} - will activates module implementation handle_info for - the specified interface.

-

Example options: [handle_info, {{handle_info, "M1::I1"}, false}] will generate the handle_info - call for all interfaces except M1::I1.

-
- timeout - -

Used to allow a server response time limit to be set by the user. - This should be a string that represents the scope for the interface - which should have an extra variable for wait time initialization.

-

Example option: {timeout,"M::I"}) produces server - stub which will has an extra timeout parameter in the initialization - function for that interface.

-

Example option: timeout produces server - stub which will has an extra timeout parameter in the initialization - function for all interfaces in the source file.

-

Example options: [timeout, {{timeout,"M::I"}, false}] - produces server stub which will has an extra timeout - parameter in the initialization function for all interfaces - except M1::I1.

-
- scoped_op_calls - -

Used to produce more refined request calls to server. When - this option is set to true, the operation name which was - mentioned in the call is scoped. This is essential to avoid - name clashes when communicating with c-servers. This option - is available for the c-client, c-server and the Erlang - gen_server back ends. All of the parts generated by ic - have to agree in the use of this option. Default is - false.

-

Example options: - [{be,c_genserv},{scoped_op_calls,true}]) produces - client stubs which sends "scoped" requests to a gen_server - or a c-server.

-
- user_protocol - -

Used to define a own protocol different from the default - Erlang distribution + gen_server protocol. Currently only - valid for C back-ends. For further details see IC C protocol.

-

Example options: - [{be,c_client},{user_protocol, "my_special"}]) produces - client stubs which use C protocol functions with the prefix - "my_special".

-
- c_timeout - -

Makes sends and receives to have timeouts (C back-ends only). These - timeouts are specified in milliseconds.

-

Example options: - [{be,c_client},{c_timeout, {10000, 20000}}]) produces - client stubs which use a 10 seconds send timeout, and a - 20 seconds receive timeout.

-
- c_report - -

Generates code for writing encode/decode errors to stderr (C back-ends only). - timeouts are specified in milliseconds.

-

Example options: - [{be,c_client}, c_report]).

-
- scl - -

Used for compatibility with previous compiler versions up - to 3.3. Due to better semantic checks on enumerants, - the compiler discovers name clashes between user defined - types and enumerant values in the same name space. By - enabling this option the compiler turns off the extended - semantic check on enumerant values. Default is - false.

-

Example option: {scl,true}

-
- precond - -

Adds a precondition call before the call to the operation - implementation on the server side.

-

The option comes in three varieties: {precond, {M, F}} which activates the call for operations in all - interfaces in the source file, {{precond, IntfName}, {M, F}} which activates the call for all operations in a - specific interface and {{precond, OpName}, {M, F}} - which activates the call for a specific operation.

-

The precondition function has the following signature - m:f(Module, Function, Args).

-

Example option: {precond, {mod, fun}} adds the call - of m:f for all operations in the idl file.

-

Example options: [{{precond, "M1::I"}, {mod, fun}}] - adds the call of m:f for all operations in the - interface M1::I1.

-

Example options: [{{precond, "M1::I::Op"}, {mod, fun}}] adds the call of m:f for the operation - M1::I::Op.

-
- postcond - -

Adds a postcondition call after the call to the operation - implementation on the server side.

-

The option comes in three varieties: {postcond, {M, F}} which activates the call for operations in all - interfaces in the source file, {{postcond, IntfName}, {M, F}} which activates the call for all operations in a - specific interface and {{postcond, OpName}, {M, F}} - which activates the call for a specific operation.

-

The postcondition function has the following signature - m:f(Module, Function, Args, Result).

-

Example option: {postcond, {mod, fun}} adds the call - of m:f for all operations in the idl file.

-

Example options: [{{postcond, "M1::I"}, {mod, fun}}] - adds the call of m:f for all operations in the - interface M1::I1.

-

Example options: [{{postcond, "M1::I::Op"}, {mod, fun}}] adds the call of m:f for the operation - M1::I::Op.

-
-
-
- -
- Warning options - - 'Wall' - -

The option activates all reasonable warning messages in - analogy with the gcc -Wall option. Default value is true.

-
- maxerrs - -

The maximum numbers of errors that can be detected before - the compiler gives up. The option can either have an integer - value or the atom infinity. Default number is 10.

-
- maxwarns - -

The maximum numbers of warnings that can be detected before - the compiler gives up. The option can either have an integer - value or the atom infinity. Default value is - infinity.

-
- nowarn - -

Suppresses all warnings. Default value is false.

-
- warn_name_shadow - -

Warning appears whenever names are shadowed due to - inheritance; for example, if a type name is redefined from a - base interface. Note that it is illegal to overload - operation and attribute names as this causes an error to be - produced. Default value is true.

-
- pedantic - -

Activates all warning options. Default value is false.

-
- silent - -

Suppresses compiler printed output. Default value is false.

-
-
-
- -
- Back-End options -

Which back-end IC will generate code for is determined by the supplied - {be,atom()} option. If left out, erl_corba is used. - Currently, IC support the following back-ends:

- - erl_corba - -

This option switches to the IDL generation for CORBA.

-
- erl_template - -

Generate CORBA call-back module templates for each interface in the target - IDL file. Note, will overwrite existing files.

-
- erl_plain - -

Will produce plain Erlang modules which contain functions that - map to the corresponding interface functions on the input file.

-
- erl_genserv - -

This is an IDL to Erlang generic server generation option.

-
- c_client - -

Will produce a C client to the generic Erlang server.

-
- c_server - -

Will produce a C server switch with functionality of a - generic Erlang server.

-
- java - -

Will produce Java client stubs and server skeletons with - functionality of a generic Erlang server.

-
- c_genserv - -

Deprecated. Use c_client instead.

-
-
-
- -
- Preprocessor -

The IDL compiler allows several preprocessors to be used, the - Erlang IDL preprocessor or other standard C preprocessors. - Options can be used to provide extra flags such as include - directories to the preprocessor. The build in the Erlang IDL - preprocessor is used by default, but any standard C preprocessor - such as gcc is adequate.

-

The preprocessor command is formed by appending the prepoc_cmd - to the preproc_flags option and then appending the input IDL - file name.

-
- -
- Configuration -

The compiler can be configured in two ways:

- - -

Configuration file

-
- -

Command line options

-
-
-

The configuration file is optional and overrides the compiler - defaults and is in turn overridden by the command line options. - The configuration file shall contain options in the form of - Erlang terms. The configuration file is read using - file:consult.

-

An example of a configuration file, note the "." after each - line.

- -{outdir, gen_dir}. -{{impl, "M1::M2::object"}, "obj"}. - -
- -
- Output files -

The compiler will produce output in several files depending on - scope declarations found in the IDL file. At most - three file types will be generated for each scope (including the top scope), - depending on the compiler back-end and the compiled interface. - Generally, the output per interface will be a header file (.hrl/ - .h) and one or more Erlang/C files (.erl/.c). - Please look at the language mapping for each back-end for details.

-

There will be at least one set of files for an IDL file, for the - file level scope. Modules and interfaces also have their own set - of generated files.

-
- -
- diff --git a/lib/ic/doc/src/ic_c_protocol.xml b/lib/ic/doc/src/ic_c_protocol.xml deleted file mode 100644 index ed4f21d661..0000000000 --- a/lib/ic/doc/src/ic_c_protocol.xml +++ /dev/null @@ -1,157 +0,0 @@ - - - - -
- - 20042016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - IC C Protocol Functions - - - 2004-04-06 - A -
- ic_c_protocol - IC C Protocol Functions - -

This manual page lists some of the functions of the IC C runtime - library that are used internally for the IC protocol. -

-

The listed functions are used internally by generated C client - and server code. They are documented here for the advanced user that want to replace the default protocol (Erlang - distribution + gen_server) by his own protocol, For each set of - client or sever functions below with prefix oe, the user - has to implement his own set of functions, the names of which - are obtained by replacing the oe prefix by Prefix. - The Prefix has to be set with the option - {user_protocol, Prefix} at compile time.

-

The following terminology is used (reflected in names of - functions): a notification is a message send from - client to server, without any reply back (i.e. a - oneway operation); a request is a message sent - from client to server, and where a reply message is - sent back from the server to the client.

-

In order to understand how the functions work and what they do - the user must study their implementation in the IC C - library (source file is ic.c), and also consider how they - are used in the C code of ordinary generated client stubs or - server skeletons.

-

-
- -
- Client Protocol Functions -

The following functions are used internally by generated C - client code.

-
- - - intoe_prepare_notification_encoding(CORBA_Environment *env) - Prepare client notification encoding. - -

The result of this function is the beginning of a binary of - in external format of the tuple {'$gen_cast', X} where - X is not yet filled in.

-

In generated client code this function is the first to be called - in the encoding function for each oneway operation.

-
-
- - intoe_send_notification(CORBA_Environment *env) - intoe_send_notification_tmo(CORBA_Environment *env, unsigned int send_ms) - Send client notification. - -

Sends a client notification to a server according to the - Erlang distribution + gen_server protocol.

-

The send_ms parameter specified a timeout in milliseconds.

-
-
- - intoe_prepare_request_encoding(CORBA_Environment *env) - Prepare client request encoding. - -

The result of this function is the beginning of a binary in - the external format of the tuple {'$gen_call', {Pid, Ref}, X} where X is not yet filled in.

-

In generated client code this function is the first to be called - in the encoding function for each twoway operation.

-
-
- - intoe_send_request_and_receive_reply(CORBA_Environment *env) - intoe_send_request_and_receive_reply_tmo(CORBA_Environment *env, unsigned int send_ms, unsigned int recv_ms) - Send client request and receive reply. - -

Sends a client request and receives the reply according to - the Erlang distribution + gen_server protocol. This function - calls the oe_prepare_reply_decoding function in order - to obtain the gen_server reply. -

-

send_ms and recv_ms specify timeouts for send - and receive, respectively, in milliseconds.

-
-
- - intoe_prepare_reply_decoding(CORBA_Environment *env) - Prepare client decoding of reply. - -

Decodes the binary version of the tuple {Ref, X}, - where X is to be decoded later by the specific client - decoding function.

-
-
-
- -
- Server Protocol Functions -

The following functions are used internally by generated C - server code.

-
- - - intoe_prepare_request_decoding(CORBA_Environment *env) - Prepare server decoding of request. - -

Decodes the binary version of the tuple {'$gen_cast', Op} (Op an atom), or the tuple {'$gen_cast', {Op, X}}, where Op is the operation name, and - where X is to be decoded later by the specific - operation decoding function; or

-

decodes the binary version of the tuple {'$gen_call', {Pid, Ref}, Op} (Op an atom), or the tuple - {'$gen_call', {Pid, Ref}, {Op, X}}, where Op> - is the operation name, and X is to be decode later by - the specific operation decoding function.

-
-
- - intoe_prepare_reply_encoding(CORBA_Environment *env) - Prepare server encoding of reply. - -

Encodes the beginning of the binary version of the tuple - {{Ref,X}, where X is to be filled in by the - specific server encoding function.

-
-
-
- -
- SEE ALSO -

ic(3), ic_clib(3), IC Protocol

-
- -
- diff --git a/lib/ic/doc/src/ic_clib.xml b/lib/ic/doc/src/ic_clib.xml deleted file mode 100644 index 50b20d2ca8..0000000000 --- a/lib/ic/doc/src/ic_clib.xml +++ /dev/null @@ -1,247 +0,0 @@ - - - - -
- - 20032016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - IC C Library Functions - - - 2003-12-16 - PB1 -
- ic_clib - IC C Library Functions - -

This manual page lists some of the functions in the IC C runtime - library.

-
- -
- Allocation and Deallocation Functions -

The following functions are used for allocating and - deallocating a CORBA_Environment structure.

-
- - - CORBA_Environment *CORBA_Environment_alloc(int inbufsz, int outbufsz) - Allocate environment data. - -

This function is used to allocate and initiate the - CORBA_Environment structure. In particular, it is used - to dynamically allocate a CORBA_Environment structure and set - the default values for the structure's fields.

-

inbufsize is the initial size of the input - buffer.

-

outbufsize is the initial size of the output - buffer.

-

CORBA_Environment is the CORBA 2.0 state structure - used by the generated stub.

-

This function will set all needed default values and - allocate buffers the lengths of which are equal to the - values passed, but will not allocate space for the _to_pid - and _from_pid fields.

-

To free the space allocated by CORBA_Environment_alloc() do - as follows.

- - -

First call CORBA_free for the input and output buffers.

-
- -

After freeing the buffer space, call CORBA_free for the - CORBA_Environment space.

-
-
-
-
- - voidCORBA_free(void *p) - Free any allocated data. - -

Frees allocated space pointed to by p.

-
-
- - CORBA_char *CORBA_string_alloc(CORBA_unsigned_long len) - Allocate a string. - -

Allocates a (simple) CORBA character string of length len + 1.

-
-
- - CORBA_wchar *CORBA_wstring_alloc(CORBA_unsigned_long len) - Allocate a wide string. - -

Allocates a CORBA wide string of length len + 1.

-
-
-
- -
- Exception Functions -

Functions for retrieving exception ids and values, and for setting - exceptions.

-
- - - CORBA_char *CORBA_exception_id(CORBA_Environment *env) - Get exception identity. - -

Returns the exception identity if an exception is set, otherwise - it returns NULL.

-
-
- - void *CORBA_exception_value(CORBA_Environment *env) - Get exception value. - -

Returns the exception value, if an exception is set, otherwise - it returns NULL.

-
-
- - voidCORBA_exc_set(CORBA_Environment *env, CORBA_exception_type Major, CORBA_char *Id, CORBA_char *Value) - Set exception. - -

Sets the exception type, exception identity, and exception value - in the environment pointed to by env.

-
-
-
- -
- Server Reception -

The following function is provided for convenience.

-
- - - intoe_server_receive(CORBA_Environment *env, oe_map_t *map) - intoe_server_receive_tmo(CORBA_Environment *env, oe_map_t *map, unsigned int send_ms, unsigned int recv_ms) - Server receive of notification or request, and sending of reply (in case of request). - -

Provides a loop that receives one message, executes the - operation in question, and in case of a two-way operation - sends a reply.

-

send_ms and recv_ms specify timeout values - in milliseconds for send and receive, respectively.

-
-
-
- -
- Generic Execution Switch and Map Merging -

Function for searching for server operation function, and for - calling it if found. Function for merging maps (see the include - file ic.h for definitions).

-
- - - intoe_exec_switch(CORBA_Object obj, CORBA_Environment *env, oe_map_t *map) - Search for server operation and execute it. - -

Search for server operation and execute it.

-
-
- - oe_map_t *oe_merge_maps(oe_map_t *maps, int size) - Merge an array of server maps to one single map. - -

Merge an array of server maps to one single map.

-
-
-
- -
- The CORBA_Environment structure -

Here is the complete definition of the CORBA_Environment structure, - defined in file ic.h:

- - /* Environment definition */ - typedef struct { - - /*----- CORBA compatibility part ------------------------*/ - /* Exception tag, initially set to CORBA_NO_EXCEPTION ---*/ - CORBA_exception_type _major; - - /*----- External Implementation part - initiated by the user ---*/ - /* File descriptor */ - int _fd; - /* Size of input buffer */ - int _inbufsz; - /* Pointer to always dynamically allocated buffer for input */ - char *_inbuf; - /* Size of output buffer */ - int _outbufsz; - /* Pointer to always dynamically allocated buffer for output */ - char *_outbuf; - /* Size of memory chunks in bytes, used for increasing the output - buffer, set to >= 32, should be around >= 1024 for performance - reasons */ - int _memchunk; - /* Pointer for registered name */ - char _regname[256]; - /* Process identity for caller */ - erlang_pid *_to_pid; - /* Process identity for callee */ - erlang_pid *_from_pid; - - /*- Internal Implementation part - used by the server/client ---*/ - /* Index for input buffer */ - int _iin; - /* Index for output buffer */ - int _iout; - /* Pointer for operation name */ - char _operation[256]; - /* Used to count parameters */ - int _received; - /* Used to identify the caller */ - erlang_pid _caller; - /* Used to identify the call */ - erlang_ref _unique; - /* Exception id field */ - CORBA_char *_exc_id; - /* Exception value field */ - void *_exc_value; - - - } CORBA_Environment; - - -

Always set the field values _fd, _regname, - _to_pid and/or *_from_pid to appropriate - application values. These are not automatically set by the - stubs.

-
- -

Never assign static buffers to the buffer pointers, and never - set the _memchunk field to a value less than - 32.

-
-
- -
- SEE ALSO -

ic(3), ic_c_protocol(3) -

-
- -
- diff --git a/lib/ic/doc/src/java-part.xml b/lib/ic/doc/src/java-part.xml deleted file mode 100644 index 14b58a1df5..0000000000 --- a/lib/ic/doc/src/java-part.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - -
- - 20022016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - IDL to Java language Mapping - - - 2002-06-25 - A -
- -

-
- -
- diff --git a/lib/ic/doc/src/notes.xml b/lib/ic/doc/src/notes.xml deleted file mode 100644 index 38cc77ca98..0000000000 --- a/lib/ic/doc/src/notes.xml +++ /dev/null @@ -1,806 +0,0 @@ - - - - -
- - 19982016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - IDL Compiler Release Notes - - - - 2004-04-06 - AC - notes.xml -
- -
IC 4.4.4 - -
Fixed Bugs and Malfunctions - - -

- Optimize encoding/decoding for pure 7-bit ascii atoms.

-

- Own Id: OTP-15023 Aux Id: ERIERL-150

-
-
-
- -
- -
IC 4.4.3 - -
Fixed Bugs and Malfunctions - - -

Removed all old unused files in the documentation. -

-

- Own Id: OTP-14475 Aux Id: ERL-409, PR-1493

-
-
-
- -
- -
IC 4.4.2 - -
Fixed Bugs and Malfunctions - - -

Correct bugs when path to mib or idl spec files - contains UTF-8 characters.

-

- Own Id: OTP-13718 Aux Id: ERL-179

-
- -

- Update build scripts to not make assumtions about where - env, cp and perl are located.

-

- Own Id: OTP-13800

-
-
-
- -
- -
IC 4.4.1 - -
Improvements and New Features - - -

- Internal changes

-

- Own Id: OTP-13551

-
-
-
- -
- -
IC 4.4 - -
Improvements and New Features - - -

- Change license text from Erlang Public License to Apache - Public License v2

-

- Own Id: OTP-12845

-
-
-
- -
- -
IC 4.3.6 - -
Fixed Bugs and Malfunctions - - -

- Fix compiler warnings reported by LLVM

-

- Own Id: OTP-12138

-
-
-
- -
- -
IC 4.3.5 - -
Fixed Bugs and Malfunctions - - -

Added Latin-1 code directive in the generated files - to keep old behaviour. Updated IC so it can handle - Unicode characters in the path.

-

- Own Id: OTP-11783

-
-
-
- -
- -
IC 4.3.4 - -
Fixed Bugs and Malfunctions - - -

- Fix two small silent rules omissions. Thanks to Anthony - Ramine.

-

- Own Id: OTP-11351

-
- -

- Silence warnings (Thanks to Anthony Ramine)

-

- Own Id: OTP-11517

-
-
-
- -
- -
IC 4.3.3 - -
Improvements and New Features - - -

- Header and library files from ic and erl_interface are - now installed into usr/{include,lib}. Note that these - directories are unversioned, so the latest installed - version will be the one in the directory.

-

- Own Id: OTP-11284

-
-
-
- -
- -
IC 4.3.2 - -
Fixed Bugs and Malfunctions - - -

- Fixed some compilation warnings on miscellaneous - platforms. Thanks to Anthony Ramine.

-

- Own Id: OTP-11086

-
-
-
- -
- -
IC 4.3.1 - -
Fixed Bugs and Malfunctions - - -

- Revert the structs erlang_pid, erlang_port - and erlang_ref as they were before R16A (without - node_org_enc) in order to be backward compatible - with user code that accesses the fields of these structs.

-

- Own Id: OTP-10885 Aux Id: seq12256

-
-
-
- -
- -
IC 4.3 - -
Improvements and New Features - - -

- Misc build updates

-

- Own Id: OTP-10784

-
- -

- Adapt ic for changes in erl_interface and jinterface due - to utf8 atom support. This change makes ic dependent on - erl_interface-3.7.10 (R16) or later in order to build.

-

- Own Id: OTP-10785

-
-
-
- -
- -
IC 4.2.31 - -
Fixed Bugs and Malfunctions - - -

- Fix bug where the ic pre-processor would ignore - whitespace quoting.

-

- Own Id: OTP-10109

-
- -

A bug regarding spaces in C function prototypes has - been fixed. (Thanks to Richard O'Keefe.)

-

- Own Id: OTP-10138

-
-
-
- -
- -
IC 4.2.30 - -
Improvements and New Features - - -

- Add generation of Erlang callback functions to generated - Erlang source code to avoid compiler warnings.

-

- Own Id: OTP-9998

-
-
-
- -
- -
IC 4.2.29 - -
Improvements and New Features - - -

Erlang/OTP can now be built using parallel make if you - limit the number of jobs, for instance using 'make - -j6' or 'make -j10'. 'make -j' does not - work at the moment because of some missing - dependencies.

-

- Own Id: OTP-9451

-
-
-
- -
- -
- IC 4.2.28 - -
- Fixed Bugs and Malfunctions - - -

- Incorrect use of ets:match changed to ets:match_object.

-

- Own Id: OTP-9630

-
-
-
-
- -
- IC 4.2.27 - -
- Improvements and New Features - - -

- Reduced compile overhead (Thanks to Haitao Li).

-

- Own Id: OTP-9460

-
-
-
-
- -
- IC 4.2.26 - -
- Improvements and New Features - - -

- Partial support for recursive structs and unions. Only available - for the erl_corba backend and requires that Light IFR is used. - I.e. the IC option {light_ifr, true} and that Orber is configured - in such a way that Light IFR is activated. Recursive TypeCode is - currently not supported.

-

- Own Id: OTP-8868 Aux Id: seq11633

-
-
-
-
- -
- IC 4.2.25 - -
- Improvements and New Features - - -

- The documentation can now be built and installed without Java.

-

- Own Id: OTP-8639 Aux Id:

-
-
-
-
- -
- IC 4.2.24 - -
- Fixed Bugs and Malfunctions - - -

Removed superfluous VT in the documentation.

-

Own id: OTP-8353 Aux Id:

-
- -

The option c_timeout was not correctly documented.

-

Own id: OTP-8307 Aux Id: seq11390

-
- -

Removed superfluous backslash in the documentation.

-

Own id: OTP-8354 Aux Id:

-
- -

The documentation EIX file was not generated.

-

Own id: OTP-8355 Aux Id:

-
-
-
-
- -
- IC 4.2.23 - -
- Improvements and New Features - - -

- The documentation is now built with open source tools (xsltproc and fop) - that exists on most platforms. One visible change is that the frames are removed.

-

- Own Id: OTP-8201 Aux Id:

-
-
-
-
- -
- IC 4.2.22 - -
- Fixed Bugs and Malfunctions - - -

The 64-bit version of libic was not compiled with the -fPIC flag.

-

Own id: OTP-8088

-
-
-
-
- -
- IC 4.2.21 - -
- Fixed Bugs and Malfunctions - - -

The function print_erlang_binary (oe_ei_code_erlang_binary.c) - updated to avoid compiler warning.

-

Own id: OTP-7982

-
-
-
-
- -
- IC 4.2.20 - -
- Improvements and New Features - - -

Updated file headers.

-

Own id: OTP-7837

-
-
-
-
- -
- IC 4.2.19 - -
- Improvements and New Features - - -

Documentation source included in open source releases.

-

Own id: OTP-7595

-
-
-
-
- -
- IC 4.2.18 - -
- Fixed Bugs and Malfunctions - - -

Insufficient buffer allocated when passing wide strings - using the C backend on a 64-bit architecture.

-

Own Id: OTP-7313 Aux Id:

-
-
-
-
- -
- IC 4.2.17 - -
- Improvements and New Features - - -

Updated file headers.

-

Own id: OTP-7011

-
- -

IC no longer use the obsolete function file:rawopen/2.

-

Own id: OTP-7182

-
-
-
-
- -
- IC 4.2.16 - -
- Improvements and New Features - - -

Added links to classes inherited from Jinterface in the - User's Guide.

-

Own Id: OTP-6965 Aux Id:

-
-
-
-
- -
- IC 4.2.15 - -
- Fixed Bugs and Malfunctions - - -

If an inherited function name begun with a capital letter - the generated stub/skeleton oe_tc/1 function was incorrect.

-

Own Id: OTP-6855 Aux Id:

-
-
-
-
- -
- IC 4.2.14 - -
- Improvements and New Features - - -

The documentation source has been converted from SGML to XML.

-

Own Id: OTP-6754 Aux Id:

-
-
-
-
- -
- IC 4.2.13 - -
- Improvements and New Features - - -

Minor Makefile changes.

-

Own Id: OTP-6701 Aux Id:

-
-
-
-
- -
- IC 4.2.12 - -
- Improvements and New Features - - -

Dead code was deleted from the following modules: - ic_cclient, ic_code, ic_cserver, ic_erlbe, ic_java_type, - ic_noc, ic_plainbe, ic_pp, ic_pragma, icscan, icstruct, - ictype, icunion.

-
-
-
-
- -
- IC 4.2.11 - -
- Improvements and New Features - - -

Changed code generation to avoid warnings such as unused - variables.

-

Own Id: OTP-5930 Aux Id:

-
-
-
-
- -
- IC 4.2.10 - -
- Fixed Bugs and Malfunctions - - -

The FD_SETSIZE limit has been increased to 2048 for - VxWorks/PPC603.

-

Own Id: OTP-5395 Aux Id: seq9751

-
-
-
-
- -
- IC 4.2.9 - -
- Fixed Bugs and Malfunctions - - -

In C back-ends, the compiler crashed when generating C code - for error reports when a scoped name was used as a type - in a union.

-

Own Id: OTP-5375 Aux Id: seq9740

-
-
-
-
- -
- IC 4.2.8 - -
- Fixed Bugs and Malfunctions - - -

In C back-ends, when decoding a sequence of "small" - integers, which from Erlang is sent as a string (i.e. - each element between 0 and 255), each string element was - considered to be of signed character type. Each such - element is now correctly treated as an unsigned character - type.

-

Own Id: OTP-5205 Aux Id: seq9241

-
-
-
-
- -
- IC 4.2.7 - -
- Improvements and New Features - - -

A new compiler option c_report has been introduced - for C back-ends (client and server). If that option is - set, encoding/decoding errors will be reported to - stderr.

-

Own Id: OTP-4977

-
-
-
-
- -
- IC 4.2.6 - -
- Improvements and New Features - - -

The size of modules, used then registering data in the - IFR DB (e.g., oe_MyModule:oe_register()), can be minimized - if the compile option light_ifr is used and Orber is - configured to use Light IFR. Requires that orber-3.5.1, or - later, is used.

-

Own Id: OTP-5036

-
-
-
- -
- Incompatibilities - - -

The compile option multiple_be is no longer supported.

-

Own Id: OTP-5049

-
-
-
-
- -
- IC 4.2.5 - -
- Improvements and New Features - - -

Send and receive functions with timeouts have been added - to the C back-ends for the standard protocol (i.e. Erlang - distribution + gen_server protocol).

-

Accordingly a new compiler option {c_timeout, {SendTimeout, RecvTimeout}} has been added. Timeouts - are specified in milliseconds.

-

A user that want to implement its own protocols with - function timeouts has to implement the following functions.

-

For C clients the functions int PFX_send_notification(CORBA_Environment *env, unsigned int send_ms), and int PFX_send_request_and_receive_reply(CORBA_Environment *env, unsigned int send_ms, unsigned int recv_ms) - have to be additionally implemented, where PFX is the - user defined prefix.

-

For C servers no additional functions have to be - implemented, but a clone of the int oe_server_receive_tmo(CORBA_Environment *env, oe_map_t *map, unsigned int send_ms, unsigned int recv_ms) - might be handy.

-

Own Id: OTP-4972

-
-
-
-
- -
- IC 4.2.4 - -
- Improvements and new features - - -

The C back-ends has been opened up, so that a user can - define his own protocol, differing from the Erlang - distribution + gen_server protocol.

- - For C clients it means to replace the library functions - int oe_prepare_notification_encoding(CORBA_Environment *env), int oe_send_notification(CORBA_Environment *env), int oe_prepare_request_encoding(CORBA_Environment *env), - int oe_send_request_and_receive_reply(CORBA_Environment *env), and int oe_prepare_reply_decoding(CORBA_Environment *env), - with functions of the same signature, but with the prefix - "oe" replaced by a user defined prefix. - For C servers the functions int oe_prepare_request_decoding(CORBA_Environment *env), - and int oe_prepare_reply_encoding(CORBA_Environment *env), are similarly replaced.

- - The new compiler option {user_protocol, Prefix} has - been added.

-

Own Id: OTP-4834

-
-
-
-
- -
- IC 4.2.3 - -
- Fixed Bugs and Malfunctions - - -

In generated code for the C server back-end, the naming scope - was in error for prototypes in C header files for interfaces - inheriting base interfaces.

-

Own Id: OTP-4881

-
-
-
-
- -
- IC 4.2.2 - -
- Fixed Bugs and Malfunctions - - -

IDL long long and unsigned long long could not - be used in a struct for the Java backend.

-

All unsigned integer types for the Java backend - had broken marshalling for large values.

-

Own Id: OTP-4763

-
-
-
-
- -
- IC 4.2.1 - -
- Fixed Bugs and Malfunctions - - -

A scoping problem (IC could not find typedefs contained - inherited interfaces) in the C-backend solved.

-

Own Id: OTP-4758

-
-
-
-
- -
- IC 4.2 - -
- Improvements and New Features - - -

The CORBA stub/skeleton-files generated by IC have been improved, - i.e., depending on the IDL-files, reduced the size of the - erl- and beam-files and decreased dependencies off Orber's - Interface Repository. It is necessary to re-compile all IDL-files - and use COS-applications, including Orber, compiled with - IC-4.2.

-

Own Id: OTP-4576

-
-
-
-
-
- diff --git a/lib/ic/doc/src/part.xml b/lib/ic/doc/src/part.xml deleted file mode 100644 index 0bb7858745..0000000000 --- a/lib/ic/doc/src/part.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - -
- - 19982016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - IC User's Guide - - - 1998-08-07 - 2.1 -
- -

The IC application is an Erlang implementation of an IDL - compiler.

-
- - - - - - - - - - -
- diff --git a/lib/ic/doc/src/ref_man.xml b/lib/ic/doc/src/ref_man.xml deleted file mode 100644 index a6a4f187b3..0000000000 --- a/lib/ic/doc/src/ref_man.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - -
- - 19982016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - IC Reference Manual - - - 2003-12-16 - PB1 -
- -

The IC application is an Erlang implementation of an IDL - compiler.

-
- - - -
- diff --git a/lib/ic/ebin/.gitignore b/lib/ic/ebin/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/ic/examples/all-against-all/Makefile b/lib/ic/examples/all-against-all/Makefile deleted file mode 100644 index e772cab94e..0000000000 --- a/lib/ic/examples/all-against-all/Makefile +++ /dev/null @@ -1,118 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -# Point this at your version of OTP -OTPROOT=/usr/local/otp/releases/otp_beam_sunos5_r7a - -# Type actual IC Version -ICVSN=4.0.4 - -# Type actual Erl Interface Vesrion -EIVSN=3.2.2 - -# Type actual Erl Interface Vesrion -JIVSN=1.2 - -# IDL file(s) -IDLS=random.idl - -# Own C-server files -CSRV=server callbacks - -# Own C-client files -CCL=client - -# Generated C-server files -GCSRVS=rmod_random__s - -# Generated C-server files -GCCLS=rmod_random - -# Includes -IFLAGS=-I$(OTPROOT)/lib/ic-$(ICVSN)/include \ - -I$(OTPROOT)/lib/erl_interface-$(EIVSN)/include - -LDFLAGS=-L$(OTPROOT)/lib/ic-$(ICVSN)/priv/lib \ - -L$(OTPROOT)/lib/erl_interface-$(EIVSN)/lib - -LDLIBS=-lic -lerl_interface -lei -lnsl -lsocket - - -# Erlang compiler -ERLC=$(OTPROOT)/bin/erlc - -# Erlang compiler flags. -EFLAGS='+{scoped_op_calls,true}' - -# C compiler -CC=gcc - -# C compiler flags -CFLAGS=-ggdb -O2 -Wall $(IFLAGS) - -# Java compiler -JAVAC=javac - -CLASSPATH= "./:$(OTPROOT)/lib/ic-$(ICVSN)/priv/ic.jar:$(OTPROOT)/lib/jinterface-$(JIVSN)/priv/OtpErlang.jar" -JFLAGS=-classpath $(CLASSPATH) -O - -JGENJFILES = \ - ./rmod/_randomImplBase.java \ - ./rmod/random.java \ - ./rmod/randomHolder.java \ - ./rmod/_randomStub.java \ - ./rmod/randomHelper.java - - -all: server client eall jall - - -server: - $(ERLC) $(EFLAGS) '+{be,c_server}' $(IDLS) - $(CC) $(IFLAGS) -c $(CSRV:=.c) $(GCSRVS:=.c) - $(CC) $(CSRV:=.o) $(GCSRVS:=.o) -o $@ $(LDFLAGS) $(LDLIBS) - -client: - $(ERLC) $(EFLAGS) '+{be,c_client}' $(IDLS) - $(CC) $(IFLAGS) -c $(CCL:=.c) $(GCCLS:=.c) - $(CC) $(CCL:=.o) $(GCCLS:=.o) -o $@ $(LDFLAGS) $(LDLIBS) - -eall: - $(ERLC) $(EFLAGS) '+{be,erl_genserv}' $(IDLS) - $(ERLC) *.erl - -jall: - $(ERLC) $(EFLAGS) '+{be,java}' $(IDLS) - $(JAVAC) $(JFLAGS) */*.java *.java - - -clean: - /bin/rm -rf $(GCCLS:=.o) $(GCCLS:=.c) $(GCSRVS:=.o) $(GCSRVS:=.c) $(CCL:=.o) $(CSRV:=.o) rmod.erl rmod_random.erl *.jam *.beam oe* *.h *.hrl *~ core server client *.class - - - - - - - - - - - diff --git a/lib/ic/examples/all-against-all/Makefile.win32 b/lib/ic/examples/all-against-all/Makefile.win32 deleted file mode 100644 index a8e480fd1f..0000000000 --- a/lib/ic/examples/all-against-all/Makefile.win32 +++ /dev/null @@ -1,139 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2000-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -# Point this at your version of OTP -OTPROOT=c:\Progra~1\erl5.0.1\ - -# Type actual IC Version -ICVSN=4.0.4 - -# Type actual Erl Interface Vesrion -EIVSN=3.2.2 - -# Type actual Erl Interface Vesrion -JIVSN=1.2 - -# IDL file(s) -IDLS=random.idl - -# Own C-server files -CSRV=server.c callbacks.c -CSRVO=server.obj callbacks.obj - -# Own C-client files -CCL=client.c -CCLO=client.obj - -# Generated C-server files -GCSRVS=rmod_random__s.c -GCSRVSO=rmod_random__s.obj - -# Generated C-client files -GCCLS=rmod_random.c -GCCLSO=rmod_random.obj - -# Includes -IFLAGS=-I"$(OTPROOT)\lib\ic-$(ICVSN)\include" \ - -I"$(OTPROOT)\lib\erl_interface-$(EIVSN)\include" - -LDFLAGS=/LIBPATH:"$(OTPROOT)\lib\ic-$(ICVSN)\priv\lib" \ - /LIBPATH:"$(OTPROOT)\lib\erl_interface-$(EIVSN)\lib" - -LDLIBS=ic.lib erl_interface.lib ei.lib ws2_32.lib - - -# Erlang compiler -ERLC=$(OTPROOT)\bin\erlc - -# Erlang compiler flags. -EFLAGS="+{scoped_op_calls,true}" - - -# C compiler -CC=cl - -# C compiler flags -CFLAGS=-MT -D__WIN32__ $(IFLAGS) - - -# Java compiler -JAVAC=c:\Progra~1\jdk1.3\bin\javac - -# Java -JAVA=c:\Progra~1\jdk1.3\bin\java - - -# Java compiler flags -CLASSPATH= ".;$(OTPROOT)\lib\ic-$(ICVSN)\priv\ic.jar;$(OTPROOT)\lib\jinterface-$(JIVSN)\priv\OtpErlang.jar" -JFLAGS=-classpath $(CLASSPATH) -O - - -all: server.exe client.exe client.beam client.class - - -server.exe: - $(ERLC) $(EFLAGS) "+{be,c_server}" $(IDLS) - $(CC) -c $(CFLAGS) $(CSRV) $(GCSRVS) - $(CC) -o server.exe $(CSRVO) $(GCSRVSO) -link $(LDFLAGS) $(LDLIBS) - - -client.exe: - $(ERLC) $(EFLAGS) "+{be,c_client}" $(IDLS) - $(CC) -c $(CFLAGS) $(CCL) $(GCCLS) - $(CC) -o client.exe $(CCLO) $(GCCLSO) -link $(LDFLAGS) $(LDLIBS) - -client.beam: - $(ERLC) $(EFLAGS) "+{be,erl_genserv}" $(IDLS) - $(ERLC) *.erl - -client.class: - $(ERLC) $(EFLAGS) "+{be,java}" $(IDLS) - $(JAVAC) $(JFLAGS) rmod/*.java - $(JAVAC) $(JFLAGS) *.java - -jclient.run: - $(JAVA) -classpath $(CLASSPATH) client - -jserver.run: - $(JAVA) -classpath $(CLASSPATH) server - - -clean: - -@del /f /q rmod - -@rmdir rmod - -@del *.jam - -@del *.beam - -@del oe* - -@del *.h - -@del *.hrl - -@del server.exe - -@del client.exe - -@del *.obj - -@del rmod_random*.c - -@del *~ - -@del *class - -@del rmod.erl - -@del rmod_random.erl - - - - - - diff --git a/lib/ic/examples/all-against-all/ReadMe b/lib/ic/examples/all-against-all/ReadMe deleted file mode 100644 index 7503291344..0000000000 --- a/lib/ic/examples/all-against-all/ReadMe +++ /dev/null @@ -1,122 +0,0 @@ -This is a short description on the use of Erlang,C or Java -client and servers against each other. -The base is a client that initiates and uses a random number -generator that lies on an server. - -There are two make files, one for Unix and one for Windows, -the Unix make file is just named "Makefile", while the Windows -is named "Makefile.win32". - -Instructions. - -1) On Makefile : - * Modify the OTPROOT variable on the Makefile to point - to the root for your erlang instalation. - * Modify IC and Erl_Interface versions to agree your - OTP version. - -2) Type "make" to build the example. - - -3) Start the empd deamon by using the command : - - epmd -daemon - - -4) Do this when you want to run : - - * an Erlang server. - - Start erlang with the options - - -setcookie -sname - - In this example you should use : - - erl -setcookie flash -sname babbis - - * a C server. - - Just type : - - server - - * a Java server. - - Set and export the CLASSPATH variable to - point to the java classes located in java development kit, - the Otp's classes and the current directory. - Your classpath should look like this : - - .:/lib/ic-3.8.1/priv/ic.jar:/lib/jinterface_0.9.2/priv/OtpErlang.jar - - where : - - is the location there OTP is installed - - Then type : - - java server - - -5) Do this when you want to run : - - * an Erlang client. - - ** If you have no valid named erlang node, - start erlang with the options - - -setcookie -sname - - In this example you should use : - - erl -setcookie flash -sname client - - On the erlang shell, type - - client:start(). - - ** If you have a valid named erlang node, started - whith the same "cookie", on the erlang shell, type - - client:start(). - - - * a C client, just type - - client - - - * a Java client. - - - Set and export the CLASSPATH variable to - point to the java classes located in java development kit, - the Otp's classes and the current directory. - Your classpath should look like this : - - .:/lib/ic-4.0/priv/ic.jar:/lib/jinterface_1.1/priv/OtpErlang.jar - - where : - - is the location there OTP is installed - - Then type : - - java client - - - -6) Please note that : - - * you must always have the same cookie in order to eastablish connection - between clients and servers. - - * you cannot start two servers with the same name. - In this example all servers share the same name in order to test - several constallations. Kill a server before starting another one. - - - - - diff --git a/lib/ic/examples/all-against-all/callbacks.c b/lib/ic/examples/all-against-all/callbacks.c deleted file mode 100644 index 4e6edeb5e0..0000000000 --- a/lib/ic/examples/all-against-all/callbacks.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ - -#include -#include "rmod_random__s.h" - - -rmod_random_produce__rs* -rmod_random_produce__cb(rmod_random oe_obj, double *rs, CORBA_Environment *oe_env) - -{ - *rs = (double) rand(); - - return (rmod_random_produce__rs*) NULL; -} - - -rmod_random_init__rs* -rmod_random_init__cb(rmod_random oe_obj, long* seed1, long* seed2, long* seed3, CORBA_Environment *oe_env) - -{ - srand(*seed1 * *seed2 * *seed3); - - return (rmod_random_init__rs*) NULL; -} - - - diff --git a/lib/ic/examples/all-against-all/client.c b/lib/ic/examples/all-against-all/client.c deleted file mode 100644 index 4f2f7e3eff..0000000000 --- a/lib/ic/examples/all-against-all/client.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ - -/* Just include the interface function */ -#include "rmod_random.h" - - -/* Assign your own node name here */ -#define CLNODENAME "c50" -#define SNODENAME "babbis" -#define SREGNAME "rmod_random_impl" -#define COOKIE "flash" -#define INBUFSZ 1024 -#define OUTBUFSZ 1024 -#define HOSTNAMESZ 256 - - - -/* Stopping node */ -void client_exit(CORBA_Environment *env) { - - /* Free env & buffers */ - CORBA_free(env->_inbuf); - CORBA_free(env->_outbuf); - CORBA_free(env); - - erl_close_connection(env->_fd); - exit(1); -} - - -int main(){ - - double result=0; - int i=0; - int error = 0; - erlang_pid pid; - char host[HOSTNAMESZ]; - char server_node[HOSTNAMESZ]; - char client_node[HOSTNAMESZ]; - CORBA_Environment *env; - - /* Initiate names */ -#ifdef __WIN32__ - WORD wVersionRequested; - WSADATA wsaData; - - wVersionRequested = MAKEWORD(1, 1); - if ((error = WSAStartup(wVersionRequested, &wsaData))) { - fprintf(stderr,"Can't initialize windows sockets: %d",error); - return 0; - } -#endif - error = gethostname(host,HOSTNAMESZ); - if (error) { -#ifdef __WIN32__ - fprintf(stderr,"can't find own hostname (error = %ld) !\n",WSAGetLastError()); -#else /* not __WIN32__ */ - fprintf(stderr,"can't find own hostname !\n"); -#endif - } - sprintf(client_node,"%s@%s",CLNODENAME,host); - sprintf(server_node,"%s@%s",SNODENAME,host); - - /* Create and init CORBA_Environment */ - env = CORBA_Environment_alloc(INBUFSZ,OUTBUFSZ); - - /* Initiating the connection */ - erl_init(NULL,0); - erl_connect_init(50,COOKIE,0); - - /* Initiating pid*/ - strcpy(pid.node,client_node); - pid.num = 99; - pid.serial = 0; - pid.creation = 0; - - /* Fixing environment variable */ - env->_fd=erl_connect(server_node); - strcpy(env->_regname,SREGNAME); - env->_to_pid = NULL; - env->_from_pid = &pid; - - if (env->_fd < 0) { - fprintf(stderr,"Error : Cannot connect to Server\n"); - - /* Free env & buffers */ - CORBA_free(env->_inbuf); - CORBA_free(env->_outbuf); - CORBA_free(env); - exit(1); - } - - /* Calling the init function */ - rmod_random_init(NULL, 1, 2, 3, env); - - switch(env->_major) { - case CORBA_NO_EXCEPTION: /* Success */ - printf("Init complete !\n"); - break; - case CORBA_SYSTEM_EXCEPTION: /* System exception */ - printf("Init call failure, reason : %s\n",(char *) CORBA_exception_value(env)); - CORBA_exception_free(env); - client_exit(env); - default: /* Should not come here */ - client_exit(env); - } - - /* Calling the produce function */ - for(i=1; i<=10; i++) { - result = rmod_random_produce(NULL, env); - - switch(env->_major) { - case CORBA_NO_EXCEPTION: /* Success */ - break; - case CORBA_SYSTEM_EXCEPTION: /* System exception */ - printf("Init call failure, reason : %s\n",(char *) CORBA_exception_value(env)); - CORBA_exception_free(env); - client_exit(env); - default: /* Should not come here */ - client_exit(env); - } - - printf("the random number nr%d is %f\n",i,result); - } - - /* Closing the connection */ - erl_close_connection(env->_fd); - - /* Free env & buffers */ - CORBA_free(env->_inbuf); - CORBA_free(env->_outbuf); - CORBA_free(env); - - return 0; -} diff --git a/lib/ic/examples/all-against-all/client.erl b/lib/ic/examples/all-against-all/client.erl deleted file mode 100644 index 3c147037a0..0000000000 --- a/lib/ic/examples/all-against-all/client.erl +++ /dev/null @@ -1,54 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : client.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module(client). - --export([produce/0,init/3,call/0]). - --define(SERVER,{rmod_random_impl, - list_to_atom("babbis@"++hd(tl(string:tokens(atom_to_list(node()),"@"))))}). --define(CLIENTMOD,'rmod_random'). - -produce() -> - ?CLIENTMOD:produce(?SERVER). - - -init(Seed1, Seed2, Seed3) -> - io:format("Init..."), - ?CLIENTMOD:init(?SERVER,Seed1, Seed2, Seed3), - io:format("ok\n"). - - -call() -> - init(1,2,3), - produce(0). - - -produce(10) -> - ok; -produce(Ctr) -> - N = produce(), - io:format("Random~p = ~p\n",[Ctr,N]), - produce(Ctr+1). diff --git a/lib/ic/examples/all-against-all/client.java b/lib/ic/examples/all-against-all/client.java deleted file mode 100644 index 48b5bc4f60..0000000000 --- a/lib/ic/examples/all-against-all/client.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -public class client { - - private static java.lang.String SNode = "client"; - private static java.lang.String PNode = "babbis"; - private static java.lang.String Cookie = "flash"; - private static java.lang.String Server = "rmod_random_impl"; - - private static rmod._randomStub stub; - - public static void main(String[] args) { - - try { - - stub = new rmod._randomStub(SNode,PNode,Cookie,Server); - int seed1 = 1; - int seed2 = 2; - int seed3 = 3; - double random = 0; - - System.out.print("\nClient initialization...."); - stub.init(seed1,seed2,seed3); - System.out.println("ok\n"); - - - for (int i = 0; i < 10; i++) { - random = stub.produce(); - System.out.println("Random" + i + " = " + random); - } - System.out.println("\nClient terminated.\n"); - - stub.__disconnect(); - - } catch( Exception e) { - System.out.println("Exception :"); - e.printStackTrace(); - } - - } - -} - diff --git a/lib/ic/examples/all-against-all/random.idl b/lib/ic/examples/all-against-all/random.idl deleted file mode 100644 index 3402dfee2c..0000000000 --- a/lib/ic/examples/all-against-all/random.idl +++ /dev/null @@ -1,51 +0,0 @@ -// ``Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// The Initial Developer of the Original Code is Ericsson Utvecklings AB. -// Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings -// AB. All Rights Reserved.'' -// -// $Id$ -// - -#ifndef _RANDOM_IDL -#define _RANDOM_IDL - -module rmod { - - interface random { - - double produce(); - - oneway void init(in long seed1, in long seed2, in long seed3); - - }; - -}; - - -#endif - - - - - - - - - - - - - - - diff --git a/lib/ic/examples/all-against-all/rmod_random_impl.erl b/lib/ic/examples/all-against-all/rmod_random_impl.erl deleted file mode 100644 index 36b280c0b2..0000000000 --- a/lib/ic/examples/all-against-all/rmod_random_impl.erl +++ /dev/null @@ -1,49 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(rmod_random_impl). --export([init/1, terminate/2]). --export([produce/1,init/4]). - - -init(Env) -> - {ok, []}. - -terminate(From, Reason) -> - ok. - - -produce(_Random) -> - case catch random:uniform() of - {'EXIT',_} -> - true; - RUnif -> - {reply,RUnif,[]} - end. - - -init(_Random,S1,S2,S3) -> - case catch random:seed(S1,S2,S3) of - {'EXIT',_} -> - true; - _ -> - {noreply,[]} - end. - diff --git a/lib/ic/examples/all-against-all/server.c b/lib/ic/examples/all-against-all/server.c deleted file mode 100644 index 6d46ea7673..0000000000 --- a/lib/ic/examples/all-against-all/server.c +++ /dev/null @@ -1,262 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ - -#include -#include -#include -#include -#ifdef __WIN32__ -#include -#include -#include -#include -#else /* not __WIN32__ */ -#include -#include -#include -#include -#include -#include -#endif -#include "rmod_random__s.h" - -/* Used functions */ -static int getport(int sockd); -static int getlisten(int port); -static int init(int *sd, int *portnr, int *epmd_fd); -void terminate(int *fd, int *sd, int *epmd_fd); -static void server_loop(int fd, int sd); - -/* change these, or even better, make command-line args to program... */ -#define COOKIE "flash" -#define SERVER "babbis" -#define NODENAMESZ 512 -#define HOSTNAMESZ 256 -#define INBUFSZ 1024 -#define OUTBUFSZ 1024 - - -int main(int argc, char **argv) -{ - int sd; - int portnr; - int epmd_fd; - - /* crate file descriptors */ - if (init(&sd, &portnr, &epmd_fd) < 0) - return -1; - - /* start server loop */ - server_loop(sd,epmd_fd); - - return 0; -} - - - -static void server_loop(int sd, int epmd_fd) -{ - ErlConnect conn; - erlang_msg msg; - int status=1; - CORBA_Environment *env; - - /* Create and init CORBA_Environment */ - env = CORBA_Environment_alloc(INBUFSZ,OUTBUFSZ); - - while (status >= 0) { - - status = 1; - - if ((env->_fd = erl_accept(sd,&conn)) < 0) { - /* error */ - fprintf(stderr,"Accept failed: %s\n",strerror(errno)); - } - else { - /* connection */ - fprintf(stderr,"Accepted connection from %s\n",conn.nodename); - - while (status >= 0) { - - /* write message to buffer */ - status = ei_receive_encoded(env->_fd, &env->_inbuf, &env->_inbufsz, &msg, &env->_iin); - switch(status) { - case ERL_SEND: - case ERL_REG_SEND : - /* do transaction with fd */ - rmod_random__switch(NULL,env); - - switch(env->_major) { - case CORBA_NO_EXCEPTION: /* Success */ - break; - case CORBA_SYSTEM_EXCEPTION: /* System exception */ - printf("Request failure, reason : %s\n",(char *) CORBA_exception_value(env)); - CORBA_exception_free(env); - break; - default: /* Should not come here */ - CORBA_exception_free(env); - break; - } - - /* send outdata */ - if (env->_iout > 0) - ei_send_encoded(env->_fd,&env->_caller,env->_outbuf,env->_iout); - break; - - case ERL_TICK : - break; - default : /* < 0 */ - printf("Connection terminated\n"); - break; - } - } - } - status=0; /* restart */ - } - - /* close file descriptors */ - terminate(&env->_fd, &sd, &epmd_fd); - - /* Free env & buffers */ - CORBA_free(env->_inbuf); - CORBA_free(env->_outbuf); - CORBA_free(env); -} - - - -static int init(int *sd, int *portnr, int *epmd_fd) -{ - char host[HOSTNAMESZ]; - char servernode[NODENAMESZ]; - struct hostent *h; - int error = 0; - -#ifdef __WIN32__ - WORD wVersionRequested; - WSADATA wsaData; - - wVersionRequested = MAKEWORD(1, 1); - if ((error = WSAStartup(wVersionRequested, &wsaData))) { - fprintf(stderr,"Can't initialize windows sockets: %d",error); - } -#endif - /* get the host name */ - error = gethostname(host,HOSTNAMESZ); - if (error) { -#ifdef __WIN32__ - fprintf(stderr,"can't find own hostname (error = %ld) !\n",WSAGetLastError()); -#else /* not __WIN32__ */ - fprintf(stderr,"can't find own hostname !\n"); -#endif - } - else { - /* identify host */ - if (!(h = erl_gethostbyname(host))) - fprintf(stdout,"can't find own ip address\n"); - else { - - /* get a listen port. 0 means let system choose port number */ - *sd = getlisten(0); - - /* what port did we get? */ - /* this call not necessary if we specified port in call to getlisten() */ - *portnr = getport(*sd); - - /* make the nodename server@host */ - sprintf(servernode,"%s@%s",SERVER,host); - - /* initiate */ - erl_init(NULL,0); - - /* host, alive, alive@host, addr, cookie, creation */ - erl_connect_xinit(host,SERVER,servernode,(Erl_IpAddr)(h->h_addr_list[0]),COOKIE,0); - - /* let epmd know we are here */ - *epmd_fd = erl_publish(*portnr); - - return 0; - } - } - return -1; -} - - -void terminate(int *fd, int *sd, int *epmd_fd) { - - close(*fd); - - /* remove info from epnd */ - close(*epmd_fd); - - /* return socket */ - close(*sd); - -} - - - -/* tells you what port you are using on given socket */ -static int getport(int sockd) -{ - struct sockaddr_in addr; - int namelen = sizeof(addr); - int i; - - memset(&addr,0,sizeof(addr)); - - if ((i = getsockname(sockd,(struct sockaddr *)&addr,&namelen))<0) - return i; - - return ntohs(addr.sin_port); -} - - - -/* return a listen socket, bound to given port */ -/* specify port = 0 to let system assign port */ -static int getlisten(int port) -{ - int sockd; - struct sockaddr_in inaddr; - int opt = 1; - int i; - - /* get listen socket */ - if ((sockd = socket(AF_INET,SOCK_STREAM,0)) < 0) return sockd; - - if ((i=setsockopt(sockd,SOL_SOCKET,SO_REUSEADDR,(void *)&opt,sizeof(opt)))<0) - return i; - - /* bind to requested port */ - memset(&inaddr,0,sizeof(inaddr)); - inaddr.sin_family = AF_INET; - inaddr.sin_addr.s_addr = htonl(INADDR_ANY); - inaddr.sin_port = htons(port); - - if ((i = bind(sockd,(struct sockaddr*) &inaddr, sizeof(inaddr))) < 0) - return i; - - listen(sockd,5); - - return sockd; -} - diff --git a/lib/ic/examples/all-against-all/server.erl b/lib/ic/examples/all-against-all/server.erl deleted file mode 100644 index c5fa2589ae..0000000000 --- a/lib/ic/examples/all-against-all/server.erl +++ /dev/null @@ -1,41 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(server). --export([start/0]). - - - -%% This starts up the random number server -start() -> - %% Start the gen server - {ok,Pid} = rmod_random:oe_create([],{local,'rmod_random_impl'}), - true. - - - - - - - - - - - diff --git a/lib/ic/examples/all-against-all/server.java b/lib/ic/examples/all-against-all/server.java deleted file mode 100644 index 79618ba8be..0000000000 --- a/lib/ic/examples/all-against-all/server.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -public class server { - - private static java.lang.String SNode = "babbis"; - private static java.lang.String Cookie = "flash"; - private static java.lang.String RegName = "rmod_random_impl"; - - public static void main(String[] args) { - - - System.out.println("\nServer running.\n"); - boolean serverState = true; - boolean recState = true; - - try { - - com.ericsson.otp.erlang.OtpServer self = new com.ericsson.otp.erlang.OtpServer(SNode, Cookie); - self.publishPort(); - - /* Server loop */ - while(serverState == true) { - - com.ericsson.otp.erlang.OtpConnection connection = self.accept(); - serverImpl srv = new serverImpl(); - com.ericsson.otp.erlang.OtpInputStream request; - com.ericsson.otp.erlang.OtpOutputStream reply; - com.ericsson.otp.erlang.OtpErlangPid client; - - /* Server loop */ - while(recState == true) { - - if (connection.isConnected() == true) - try { - - request = connection.receiveBuf(); - - reply = srv.invoke(request); - - if (reply != null) { - client = srv.__getCallerPid(); - - connection.sendBuf(client,reply); - } - - } catch( Exception e) { - System.out.println("Server terminated.\n\n"); - recState = false; - serverState = false; - } - } - - connection.close(); - } - - } catch( Exception e) { - System.out.println("Initialization exception :"); - e.printStackTrace(); - } - } -} - - - - diff --git a/lib/ic/examples/all-against-all/serverImpl.java b/lib/ic/examples/all-against-all/serverImpl.java deleted file mode 100644 index 336bc7e327..0000000000 --- a/lib/ic/examples/all-against-all/serverImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -public class serverImpl extends rmod._randomImplBase { - - java.util.Random random = null; - - - public void init(int seed1, int seed2, int seed3) throws java.lang.Exception { - - random = new java.util.Random(seed1+seed2+seed3); - }; - - - public double produce() throws java.lang.Exception { - - return random.nextDouble(); - } - -} - - - - - - diff --git a/lib/ic/examples/c-client/Makefile b/lib/ic/examples/c-client/Makefile deleted file mode 100644 index 1bfaaed477..0000000000 --- a/lib/ic/examples/c-client/Makefile +++ /dev/null @@ -1,87 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1998-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -# Point this at your version of OTP -OTPROOT=/usr/local/otp/daily_build/otp_beam_sunos5_r8a.latest - -# Type actual IC Version -ICVSN=4.1.1 - -# Type actual Erl Interface Vesrion -EIVSN=3.3.0 - -# IDL file(s) -IDLS=random.idl - -# Own C-client files -CCL=client - -# Generated C-server files -GCCLS=oe_code_seed rmod_random - -# Includes -IFLAGS=-I$(OTPROOT)/lib/ic-$(ICVSN)/include \ - -I$(OTPROOT)/lib/erl_interface-$(EIVSN)/include - -LDFLAGS=-L$(OTPROOT)/lib/ic-$(ICVSN)/priv/lib \ - -L$(OTPROOT)/lib/erl_interface-$(EIVSN)/lib - -LDLIBS=-lic -lerl_interface -lei -lnsl -lsocket - - -# Erlang compiler -ERLC=$(OTPROOT)/bin/erlc - -# Erlang compiler flags. -EFLAGS='+{preproc_flags,"-I $(OTPROOT)/usr/include"}' '+{scoped_op_calls,true}' - - -# C compiler -CC=gcc - -# C compiler flags -CFLAGS=-ggdb -O2 -Wall $(IFLAGS) - - -all: server client - - -server: - $(ERLC) $(EFLAGS) '+{be,erl_genserv}' $(IDLS) - $(ERLC) *.erl - -client: - $(ERLC) $(EFLAGS) '+{be,c_client}' $(IDLS) - $(CC) $(IFLAGS) -c $(CCL:=.c) $(GCCLS:=.c) - $(CC) $(CCL:=.o) $(GCCLS:=.o) -o $@ $(LDFLAGS) $(LDLIBS) - - - -clean: - /bin/rm -f $(GCCLS:=.o) $(GCCLS:=.c) $(CCL:=.o) *.jam *.beam oe* rmod_random.erl *.h *.hrl *~ core client - - - - - - - - - diff --git a/lib/ic/examples/c-client/ReadMe b/lib/ic/examples/c-client/ReadMe deleted file mode 100644 index 28372c3be2..0000000000 --- a/lib/ic/examples/c-client/ReadMe +++ /dev/null @@ -1,46 +0,0 @@ -This is a short description on the use of the c-client demo, -a client that initiates and uses a random number generator -that lies on an Erlang-genserver. - -Instructions. - -1) On Makefile : - * Modify the OTPROOT variable on the Makefile to point - to the root for your erlang instalation. - * Modify IC and Erl_Interface versions to agree your - OTP version. - -2) Type "make" to build the example. - - -3) Start erlang with the options - -setcookie -sname - - In this example you should use : - - erl -setcookie flash -sname babbis - - -4) On the erlang shell type : - -------------------------- - - rmod_random:oe_create([],{local,rmod_random_impl}). ( initializes the server ) - - or - - test:start(). - - - Then start a new terminal window and type : - ------------------------------------------- - - client ( calls the client ) - - - - - - - - - diff --git a/lib/ic/examples/c-client/client.c b/lib/ic/examples/c-client/client.c deleted file mode 100644 index 652d8376fd..0000000000 --- a/lib/ic/examples/c-client/client.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1998-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ - -/* Include the interface function and ei_connect */ -#include "rmod_random.h" -#include "ei_connect.h" - -/* Assign your own node name here */ -#define SNODE "babbis@balin" -#define SERVER "rmod_random_impl" -#define COOKIE "flash" -#define CLNODE "c47@balin" -#define INBUFSZ 1024 -#define OUTBUFSZ 1024 - -/* Stopping node */ -void client_exit(CORBA_Environment *env) { - - /* Free env & buffers */ - CORBA_free(env->_inbuf); - CORBA_free(env->_outbuf); - CORBA_free(env); - - close(env->_fd); - exit(1); -} - -int main() -{ - double result=0; - int i=0; - erlang_pid pid; - CORBA_Environment *env; - seed idata; - ei_cnode ec; - - /* Create and init CORBA_Environment */ - env = CORBA_Environment_alloc(INBUFSZ,OUTBUFSZ); - - /* Initialize seed */ - idata.seed1 = 1; - idata.seed2 = 2; - idata.seed3 = 3; - - /* Initiating the connection */ - ei_connect_init(&ec, "c47", COOKIE, 0); - - /* Initiating pid*/ - strcpy(pid.node,CLNODE); - pid.num = 99; - pid.serial = 0; - pid.creation = 0; - - /* Fixing environment variable */ - env->_fd = ei_connect(&ec, SNODE); - strcpy(env->_regname, SERVER); - env->_to_pid = NULL; - env->_from_pid = &pid; - - if (env->_fd < 0) { - fprintf(stderr,"Error : Cannot connect to Server\n"); - - /* Free env & buffers */ - CORBA_free(env->_inbuf); - CORBA_free(env->_outbuf); - CORBA_free(env); - exit(1); - } - - /* Calling the init function */ - rmod_random_init(NULL, &idata, env); - - switch(env->_major) { - case CORBA_NO_EXCEPTION: /* Success */ - printf("Init complete !\n"); - break; - case CORBA_SYSTEM_EXCEPTION: /* System exception */ - printf("Init call failure, reason : %s\n",(char *) CORBA_exception_value(env)); - CORBA_exception_free(env); - client_exit(env); - default: /* Should not come here */ - client_exit(env); - } - - /* Calling the produce function */ - for(i=1; i<=10; i++) { - result = rmod_random_produce(NULL, env); - - switch(env->_major) { - case CORBA_NO_EXCEPTION: /* Success */ - break; - case CORBA_SYSTEM_EXCEPTION: /* System exception */ - printf("Init call failure, reason : %s\n",(char *) CORBA_exception_value(env)); - CORBA_exception_free(env); - client_exit(env); - default: /* Should not come here */ - client_exit(env); - } - - printf("the random number nr%d is %f\n",i,result); - } - - /* Closing the connection */ - close(env->_fd); - - /* Free env & buffers */ - CORBA_free(env->_inbuf); - CORBA_free(env->_outbuf); - CORBA_free(env); - - return 0; -} - diff --git a/lib/ic/examples/c-client/random.idl b/lib/ic/examples/c-client/random.idl deleted file mode 100644 index 8f54058e2b..0000000000 --- a/lib/ic/examples/c-client/random.idl +++ /dev/null @@ -1,52 +0,0 @@ -// ``Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// The Initial Developer of the Original Code is Ericsson Utvecklings AB. -// Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings -// AB. All Rights Reserved.'' -// -// $Id$ -// -#ifndef _RANDOM_IDL -#define _RANDOM_IDL - -struct seed { - long seed1; - long seed2; - long seed3; -}; - -module rmod { - - interface random { - - double produce(); - - oneway void init(in seed idata); - - }; - -}; - -#endif - - - - - - - - - - - - diff --git a/lib/ic/examples/c-client/rmod_random_impl.erl b/lib/ic/examples/c-client/rmod_random_impl.erl deleted file mode 100644 index 2948115f8d..0000000000 --- a/lib/ic/examples/c-client/rmod_random_impl.erl +++ /dev/null @@ -1,53 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module('rmod_random_impl'). --include("oe_random.hrl"). --export([init/1, terminate/2]). --export([produce/1,init/2]). - - -init(Env) -> - {ok, []}. - -terminate(From, Reason) -> - ok. - - -produce(_Random) -> - case catch random:uniform() of - {'EXIT',_} -> - true; - RUnif -> - {reply,RUnif,[]} - end. - - -init(_Random,IData) -> - S1 = IData#seed.seed1, - S2 = IData#seed.seed2, - S3 = IData#seed.seed3, - case catch random:seed(S1,S2,S3) of - {'EXIT',_} -> - true; - _ -> - {noreply,[]} - end. - diff --git a/lib/ic/examples/c-client/test.erl b/lib/ic/examples/c-client/test.erl deleted file mode 100644 index d1fa40ff44..0000000000 --- a/lib/ic/examples/c-client/test.erl +++ /dev/null @@ -1,44 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -% Start Erlang with : erl -sname -setcookie - --module(test). - --export([start/0,exec/0]). - - -start() -> - io:format("Starting server~n"), - rmod_random:oe_create([],{local,'rmod_random_impl'}). - -exec() -> - io:format("Running client~n"), - OutPut = os:cmd("client"), - io:format("~s",[OutPut]). - - - - - - - - - diff --git a/lib/ic/examples/c-server/Makefile b/lib/ic/examples/c-server/Makefile deleted file mode 100644 index be23d3ddf9..0000000000 --- a/lib/ic/examples/c-server/Makefile +++ /dev/null @@ -1,90 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1998-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -# Point this at your version of OTP -OTPROOT=/usr/local/otp/daily_build/otp_beam_sunos5_r8a.latest - -# Type actual IC Version -ICVSN=4.1.1 - -# Type actual Erl Interface Vesrion -EIVSN=3.3.0 - -# IDL file(s) -IDLS=random.idl - -# Own C-server files -CSRV=server callbacks - -# Own C-client files -CCL=client - -# Generated C-server files -GCSRVS=rmod_random__s - -# Generated C-server files -GCCLS=rmod_random - -# Includes -IFLAGS=-I$(OTPROOT)/lib/ic-$(ICVSN)/include \ - -I$(OTPROOT)/lib/erl_interface-$(EIVSN)/include - -LDFLAGS=-L$(OTPROOT)/lib/ic-$(ICVSN)/priv/lib \ - -L$(OTPROOT)/lib/erl_interface-$(EIVSN)/lib - -LDLIBS=-lic -lerl_interface -lei -lnsl -lsocket - - -# Erlang compiler -ERLC=$(OTPROOT)/bin/erlc - -# Erlang compiler flags. -EFLAGS='+{preproc_flags,"-I $(OTPROOT)/usr/include"}' '+{scoped_op_calls,true}' - - -# C compiler -CC=gcc - -# C compiler flags -CFLAGS=-ggdb -O2 -Wall $(IFLAGS) - - -all: server client erlclient - - -server: - $(ERLC) $(EFLAGS) '+{be,c_server}' $(IDLS) - $(CC) $(IFLAGS) -c $(CSRV:=.c) $(GCSRVS:=.c) - $(CC) $(CSRV:=.o) $(GCSRVS:=.o) -o $@ $(LDFLAGS) $(LDLIBS) - -client: - $(ERLC) $(EFLAGS) '+{be,c_client}' $(IDLS) - $(CC) $(IFLAGS) -c $(CCL:=.c) $(GCCLS:=.c) - $(CC) $(CCL:=.o) $(GCCLS:=.o) -o $@ $(LDFLAGS) $(LDLIBS) - -erlclient: - $(ERLC) $(EFLAGS) '+{be,erl_genserv}' $(IDLS) - $(ERLC) *.erl - - -clean: - /bin/rm -f $(GCCLS:=.o) $(GCCLS:=.c) $(GCSRVS:=.o) $(GCSRVS:=.c) $(CCL:=.o) $(CSRV:=.o) *.jam *.beam oe* *.h *.hrl *~ core server client - - diff --git a/lib/ic/examples/c-server/ReadMe b/lib/ic/examples/c-server/ReadMe deleted file mode 100644 index 69fce4cd07..0000000000 --- a/lib/ic/examples/c-server/ReadMe +++ /dev/null @@ -1,45 +0,0 @@ -This is a short description on the use of the client demo, -a client that initiates and uses a random number generator -that lies on a C-server. - -Instructions. - -1) Modify the OTPROOT variable on the Makefile to point - to the root for your erlang instalation. - Modify IC and Erl_Interface versions to agree your - OTP version. - -2) - Type : - ------ - - make ( generates and compiles all code ) - - server ( starts the c-server ) - - - To test the c-client against the c-server start a new terminal window and type : - -------------------------------------------------------------------------------- - - client ( calls the server ) - - - To test the erlang-client against the c-server start a new terminal window and type : - ------------------------------------------------------------------------------------- - - - erl -sname client -setcookie flash ( start erlang ) - - client:init(1,2,3). ( initiates the random generator ) - - client:produce(). ( calls the random generator ) - - - - - - - - - - diff --git a/lib/ic/examples/c-server/callbacks.c b/lib/ic/examples/c-server/callbacks.c deleted file mode 100644 index 2deca145f4..0000000000 --- a/lib/ic/examples/c-server/callbacks.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1998-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ - -#include -#include "rmod_random__s.h" - - -rmod_random_produce__rs* -rmod_random_produce__cb(rmod_random oe_obj, double *rs, CORBA_Environment *oe_env) - -{ - *rs = (double) rand(); - - return (rmod_random_produce__rs*) NULL; -} - - -rmod_random_init__rs* -rmod_random_init__cb(rmod_random oe_obj, long* seed1, long* seed2, long* seed3, CORBA_Environment *oe_env) - -{ - srand(*seed1 * *seed2 * *seed3); - - return (rmod_random_init__rs*) NULL; -} - - - diff --git a/lib/ic/examples/c-server/client.c b/lib/ic/examples/c-server/client.c deleted file mode 100644 index c1d7a1c5a7..0000000000 --- a/lib/ic/examples/c-server/client.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1998-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ - -/* Include the interface function, and ei_connect */ -#include "rmod_random.h" -#include "ei_connect.h" - -/* Assign your own node name here */ -#define SNODE "babbis@balin" -#define SERVER "rmod_random_impl" -#define COOKIE "flash" -#define CLNODE "c47@balin" -#define INBUFSZ 1024 -#define OUTBUFSZ 1024 - -/* Stopping node */ -void client_exit(CORBA_Environment *env) { - - /* Free env & buffers */ - CORBA_free(env->_inbuf); - CORBA_free(env->_outbuf); - CORBA_free(env); - - close(env->_fd); - exit(1); -} - -int main() -{ - double result=0; - int i=0; - erlang_pid pid; - CORBA_Environment *env; - ei_cnode ec; - - /* Create and init CORBA_Environment */ - env = CORBA_Environment_alloc(INBUFSZ,OUTBUFSZ); - - /* Initiating the connection */ - ei_connect_init(&ec, "c47", COOKIE, 0); - - /* Initiating pid*/ - strcpy(pid.node, CLNODE); - pid.num = 99; - pid.serial = 0; - pid.creation = 0; - - /* Fixing environment variable */ - env->_fd = ei_connect(&ec, SNODE); - strcpy(env->_regname,SERVER); - env->_to_pid = NULL; - env->_from_pid = &pid; - - if (env->_fd < 0) { - fprintf(stderr,"Error : Cannot connect to Server\n"); - - /* Free env & buffers */ - CORBA_free(env->_inbuf); - CORBA_free(env->_outbuf); - CORBA_free(env); - exit(1); - } - - /* Calling the init function */ - rmod_random_init(NULL, 1, 2, 3, env); - - switch(env->_major) { - case CORBA_NO_EXCEPTION: /* Success */ - printf("Init complete !\n"); - break; - case CORBA_SYSTEM_EXCEPTION: /* System exception */ - printf("Init call failure, reason : %s\n",(char *) CORBA_exception_value(env)); - CORBA_exception_free(env); - client_exit(env); - default: /* Should not come here */ - client_exit(env); - } - - /* Calling the produce function */ - for(i=1; i<=10; i++) { - result = rmod_random_produce(NULL, env); - - switch(env->_major) { - case CORBA_NO_EXCEPTION: /* Success */ - break; - case CORBA_SYSTEM_EXCEPTION: /* System exception */ - printf("Init call failure, reason : %s\n",(char *) CORBA_exception_value(env)); - CORBA_exception_free(env); - client_exit(env); - default: /* Should not come here */ - client_exit(env); - } - - printf("the random number nr%d is %f\n",i,result); - } - - /* Closing the connection */ - close(env->_fd); - - /* Free env & buffers */ - CORBA_free(env->_inbuf); - CORBA_free(env->_outbuf); - CORBA_free(env); - - return 0; -} - diff --git a/lib/ic/examples/c-server/client.erl b/lib/ic/examples/c-server/client.erl deleted file mode 100644 index da28cd504b..0000000000 --- a/lib/ic/examples/c-server/client.erl +++ /dev/null @@ -1,45 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%%---------------------------------------------------------------------- -%%% File : client.erl -%%% Author : Babbis Xagorarakis -%%% Purpose : -%%% Created : 22 Oct 1998 by Babbis Xagorarakis -%%%---------------------------------------------------------------------- - --module(client). --author('babbis@balin'). - --export([produce/0,init/3]). - --define(SERVER,{rmod_random_impl,'babbis@balin'}). --define(CLIENTMOD,'rmod_random'). - -produce() -> - ?CLIENTMOD:produce(?SERVER). - - -init(Seed1, Seed2, Seed3) -> - ?CLIENTMOD:init(?SERVER, Seed1, Seed2, Seed3). - - - - diff --git a/lib/ic/examples/c-server/random.idl b/lib/ic/examples/c-server/random.idl deleted file mode 100644 index 7ce302a2e7..0000000000 --- a/lib/ic/examples/c-server/random.idl +++ /dev/null @@ -1,50 +0,0 @@ -// ``Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// The Initial Developer of the Original Code is Ericsson Utvecklings AB. -// Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings -// AB. All Rights Reserved.'' -// -// $Id$ -// - -#ifndef _RANDOM_IDL -#define _RANDOM_IDL - -module rmod { - - interface random { - - double produce(); - - oneway void init(in long seed1, in long seed2, in long seed3); - - }; - -}; - -#endif - - - - - - - - - - - - - - - diff --git a/lib/ic/examples/c-server/server.c b/lib/ic/examples/c-server/server.c deleted file mode 100644 index a04d60e9b1..0000000000 --- a/lib/ic/examples/c-server/server.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1998-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ - -#include -#include -#include -#include -#ifdef __WIN32__ -#include -#include -#include -#include -#else /* not __WIN32__ */ -#include -#include -#include -#include -#include -#include -#endif -#include "rmod_random__s.h" -#include "ei_connect.h" - -/* Used functions */ -extern int gethostname(char *buf, int buflen); -static int getport(int sockd); -static int getlisten(int port); -static int init(ei_cnode *ec, int *sd, int *portnr, int *epmd_fd); -void terminate(int *fd, int *sd, int *epmd_fd); -static void server_loop(ei_cnode *ec, int fd, int sd); - -/* change these, or even better, make command-line args to program... */ -#define COOKIE "flash" -#define SERVER "babbis" -#define NODENAMESZ 512 -#define HOSTNAMESZ 256 -#define INBUFSZ 1024 -#define OUTBUFSZ 1024 - - -int main(int argc, char **argv) -{ - int sd; - int portnr; - int epmd_fd; - ei_cnode ec; - - /* crate file descriptors */ - if (init(&ec, &sd, &portnr, &epmd_fd) < 0) - return -1; - - /* start server loop */ - server_loop(&ec, sd, epmd_fd); - - return 0; -} - - - -static void server_loop(ei_cnode *ec, int sd, int epmd_fd) -{ - ErlConnect conn; - erlang_msg msg; - int status=1; - CORBA_Environment *env; - - /* Create and init CORBA_Environment */ - env = CORBA_Environment_alloc(INBUFSZ,OUTBUFSZ); - - while (status >= 0) { - status = 1; - - if ((env->_fd = ei_accept(ec, sd, &conn)) < 0) { - /* error */ - fprintf(stderr,"Accept failed: %s\n",strerror(errno)); - } else { - /* connection */ - fprintf(stderr,"Accepted connection from %s\n",conn.nodename); - - while (status >= 0) { - - /* write message to buffer */ - status = ei_receive_encoded(env->_fd, &env->_inbuf, &env->_inbufsz, &msg, &env->_iin); - switch(status) { - case ERL_SEND: - case ERL_REG_SEND : - /* do transaction with fd */ - rmod_random__switch(NULL,env); - - switch(env->_major) { - case CORBA_NO_EXCEPTION: /* Success */ - break; - case CORBA_SYSTEM_EXCEPTION: /* System exception */ - printf("Request failure, reason : %s\n",(char *) CORBA_exception_value(env)); - CORBA_exception_free(env); - break; - default: /* Should not come here */ - CORBA_exception_free(env); - break; - } - - /* send outdata */ - if (env->_iout > 0) - ei_send_encoded(env->_fd,&env->_caller,env->_outbuf,env->_iout); - break; - - case ERL_TICK : - break; - default : /* < 0 */ - printf("Connection terminated\n"); - break; - } - } - } - status=0; /* restart */ - } - - /* close file descriptors */ - terminate(&env->_fd, &sd, &epmd_fd); - - /* Free env & buffers */ - CORBA_free(env->_inbuf); - CORBA_free(env->_outbuf); - CORBA_free(env); -} - - - -static int init(int *sd, int *portnr, int *epmd_fd) -{ - char host[HOSTNAMESZ]; - char servernode[NODENAMESZ]; - struct hostent *h; - - /* get the host name */ - if ((gethostname(host,HOSTNAMESZ))) - fprintf(stderr,"can't find own hostname\n"); - else { - /* identify host */ - if (!(h = erl_gethostbyname(host))) - fprintf(stdout,"can't find own ip address\n"); - else { - - /* get a listen port. 0 means let system choose port number */ - *sd = getlisten(0); - - /* what port did we get? */ - /* this call not necessary if we specified port in call to getlisten() */ - *portnr = getport(*sd); - - /* make the nodename server@host */ - sprintf(servernode,"%s@%s",SERVER,host); - - /* initiate */ - /* cnode, host, alive, alive@host, addr, cookie, creation */ - if (ei_connect_xinit(ec, host, SERVER, servernode, - (Erl_IpAddr)(h->h_addr_list[0]), - COOKIE, 0) == 0) { - /* let epmd know we are here */ - *epmd_fd = ei_publish(ec, *portnr); - if (*epmd_fd >= 0) - return 0; - } - } - } - return -1; -} - - -void terminate(int *fd, int *sd, int *epmd_fd) { - - close(*fd); - - /* remove info from epnd */ - close(*epmd_fd); - - /* return socket */ - close(*sd); - -} - - - -/* tells you what port you are using on given socket */ -static int getport(int sockd) -{ - struct sockaddr_in addr; - int namelen = sizeof(addr); - int i; - - memset(&addr,0,sizeof(addr)); - - if ((i = getsockname(sockd,(struct sockaddr *)&addr,&namelen))<0) - return i; - - return ntohs(addr.sin_port); -} - - - -/* return a listen socket, bound to given port */ -/* specify port = 0 to let system assign port */ -static int getlisten(int port) -{ - int sockd; - struct sockaddr_in inaddr; - int opt = 1; - int i; - - /* get listen socket */ - if ((sockd = socket(AF_INET,SOCK_STREAM,0)) < 0) return sockd; - - if ((i=setsockopt(sockd,SOL_SOCKET,SO_REUSEADDR,(void *)&opt,sizeof(opt)))<0) - return i; - - /* bind to requested port */ - memset(&inaddr,0,sizeof(inaddr)); - inaddr.sin_family = AF_INET; - inaddr.sin_addr.s_addr = htonl(INADDR_ANY); - inaddr.sin_port = htons(port); - - if ((i = bind(sockd,(struct sockaddr*) &inaddr, sizeof(inaddr))) < 0) - return i; - - listen(sockd,5); - - return sockd; -} diff --git a/lib/ic/examples/erl-genserv/ReadMe b/lib/ic/examples/erl-genserv/ReadMe deleted file mode 100644 index cde588e269..0000000000 --- a/lib/ic/examples/erl-genserv/ReadMe +++ /dev/null @@ -1,30 +0,0 @@ -This is a short description on the use of the c-client demo, -a client that initiates and uses a random number generator -that lies on an Erlang-genserver. - -Instructions. - - On the erlang shell type : - -------------------------- - - ic:gen(random,[{be,erl_genserv}]). ( generates the plain code ) - - make:all(). ( compiles the erlang code ) - - {ok,R} = rmod_random:oe_create(). ( initializes the server ) - - - Running the example : - --------------------- - - rmod_random:init(R,1,2,3). ( initializes the generator ) - - rmod_random:produce(R). ( generates a random number ) - - - - - - - - diff --git a/lib/ic/examples/erl-genserv/random.idl b/lib/ic/examples/erl-genserv/random.idl deleted file mode 100644 index 969b24b749..0000000000 --- a/lib/ic/examples/erl-genserv/random.idl +++ /dev/null @@ -1,51 +0,0 @@ -// ``Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// The Initial Developer of the Original Code is Ericsson Utvecklings AB. -// Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings -// AB. All Rights Reserved.'' -// -// $Id$ -// - -#ifndef _RANDOM_IDL -#define _RANDOM_IDL - - -module rmod { - - interface random { - - double produce(); - - oneway void init(in long seed1, in long seed2, in long seed3); - - }; - -}; - -#endif - - - - - - - - - - - - - - - diff --git a/lib/ic/examples/erl-genserv/rmod_random_impl.erl b/lib/ic/examples/erl-genserv/rmod_random_impl.erl deleted file mode 100644 index 9d9ca8afd4..0000000000 --- a/lib/ic/examples/erl-genserv/rmod_random_impl.erl +++ /dev/null @@ -1,64 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module('rmod_random_impl'). --export([init/1, terminate/2, start/0]). --export([produce/1,init/4]). - - -init(Env) -> - {ok, []}. - -terminate(From, Reason) -> - ok. - - -produce(_Random) -> - case catch random:uniform() of - {'EXIT',_} -> - true; - RUnif -> - {reply,RUnif,[]} - end. - - -init(_Random,S1,S2,S3) -> - case catch random:seed(S1,S2,S3) of - {'EXIT',_} -> - true; - _ -> - {noreply,[]} - end. - - -%% This starts up the random number server -start() -> - %% Start the gen server - {ok,Pid} = rmod_random:oe_create([],{local,'rmod_random_impl'}), - true. - - - - - - - - - diff --git a/lib/ic/examples/erl-plain/ReadMe b/lib/ic/examples/erl-plain/ReadMe deleted file mode 100644 index 26440b4d4f..0000000000 --- a/lib/ic/examples/erl-plain/ReadMe +++ /dev/null @@ -1,27 +0,0 @@ -This is a short description on the use of the erl-plain demo, -a client that initiates and uses a random number generator -that lies on an Erlang-genserver. - -Instructions. - - On the erlang shell type : - -------------------------- - - ic:gen(random,[{be,erl_plain}]). ( generates the plain code ) - - make:all(). ( compiles the erlang code ) - - - Running the example : - --------------------- - - rmod_random:init(1,2,3). ( initializes the generator ) - - rmod_random:produce(). ( generates a random number ) - - - - - - - diff --git a/lib/ic/examples/erl-plain/random.idl b/lib/ic/examples/erl-plain/random.idl deleted file mode 100644 index 606d91f6c5..0000000000 --- a/lib/ic/examples/erl-plain/random.idl +++ /dev/null @@ -1,53 +0,0 @@ -// ``Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// The Initial Developer of the Original Code is Ericsson Utvecklings AB. -// Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings -// AB. All Rights Reserved.'' -// -// $Id$ -// -#pragma CODEOPT "[{be,c_genserv}]" - - -#ifndef _RANDOM_IDL -#define _RANDOM_IDL - - -module rmod { - - interface random { - - double produce(); - - oneway void init(in long seed1, in long seed2, in long seed3); - - }; - -}; - -#endif - - - - - - - - - - - - - - - diff --git a/lib/ic/examples/erl-plain/rmod_random_impl.erl b/lib/ic/examples/erl-plain/rmod_random_impl.erl deleted file mode 100644 index ee8623f82d..0000000000 --- a/lib/ic/examples/erl-plain/rmod_random_impl.erl +++ /dev/null @@ -1,33 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module('rmod_random_impl'). - --export([produce/0,init/3]). - - -produce() -> - random:uniform(). - - -init(S1,S2,S3) -> - random:seed(S1,S2,S3), - ok. - diff --git a/lib/ic/examples/java-client-server/ReadMe b/lib/ic/examples/java-client-server/ReadMe deleted file mode 100644 index 9fde464e09..0000000000 --- a/lib/ic/examples/java-client-server/ReadMe +++ /dev/null @@ -1,69 +0,0 @@ -This is a short description on the use of the java demo, -a client that initiates and uses a random number generator -that lies on a java-server. You will be able to shift the -existing client/server with the ones refered to the other -examples. - -Instructions. - -1) Start erlang - - On the erlang shell type : - -------------------------- - - ic:gen(random,[{be,java}]). ( generates the java code ) - - -2) Modify the "SNode" string on file "server.java" to the server - node name thet suites for your machine. - - -3) Modify the "SNode" string on file "client.java" to the client - node for your machine and the "PNode" string for the server - node ( = the same as the SNode for the "server.java" file ). - - -4) Set and export the CLASSPATH variable to point to the - java classes located in java development kit, the - Otp's classes and the current directory. - Your classpath should look like this : - - .:/lib/ic-4.0/priv/ic.jar:/lib/jinterface_1.1/priv/OtpErlang.jar - - where : - - is the location there OTP is installed - - -5) Start the empd deamon by using the command : - - epmd -daemon - - -6) Compile the generated java code : - - javac rmod/*.java ( compiles all generated java code ) - - javac *.java ( compiles all manually writen java code ) - - -7) Start the java on an terminal window : - - java server ( starts the java-server ) - - -8) Start the client on an terminal window : - - java client ( calls the server ) - - - - - - - - - - - - diff --git a/lib/ic/examples/java-client-server/client.java b/lib/ic/examples/java-client-server/client.java deleted file mode 100644 index 48b5bc4f60..0000000000 --- a/lib/ic/examples/java-client-server/client.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -public class client { - - private static java.lang.String SNode = "client"; - private static java.lang.String PNode = "babbis"; - private static java.lang.String Cookie = "flash"; - private static java.lang.String Server = "rmod_random_impl"; - - private static rmod._randomStub stub; - - public static void main(String[] args) { - - try { - - stub = new rmod._randomStub(SNode,PNode,Cookie,Server); - int seed1 = 1; - int seed2 = 2; - int seed3 = 3; - double random = 0; - - System.out.print("\nClient initialization...."); - stub.init(seed1,seed2,seed3); - System.out.println("ok\n"); - - - for (int i = 0; i < 10; i++) { - random = stub.produce(); - System.out.println("Random" + i + " = " + random); - } - System.out.println("\nClient terminated.\n"); - - stub.__disconnect(); - - } catch( Exception e) { - System.out.println("Exception :"); - e.printStackTrace(); - } - - } - -} - diff --git a/lib/ic/examples/java-client-server/random.idl b/lib/ic/examples/java-client-server/random.idl deleted file mode 100644 index 7ce302a2e7..0000000000 --- a/lib/ic/examples/java-client-server/random.idl +++ /dev/null @@ -1,50 +0,0 @@ -// ``Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// The Initial Developer of the Original Code is Ericsson Utvecklings AB. -// Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings -// AB. All Rights Reserved.'' -// -// $Id$ -// - -#ifndef _RANDOM_IDL -#define _RANDOM_IDL - -module rmod { - - interface random { - - double produce(); - - oneway void init(in long seed1, in long seed2, in long seed3); - - }; - -}; - -#endif - - - - - - - - - - - - - - - diff --git a/lib/ic/examples/java-client-server/server.java b/lib/ic/examples/java-client-server/server.java deleted file mode 100644 index 79618ba8be..0000000000 --- a/lib/ic/examples/java-client-server/server.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -public class server { - - private static java.lang.String SNode = "babbis"; - private static java.lang.String Cookie = "flash"; - private static java.lang.String RegName = "rmod_random_impl"; - - public static void main(String[] args) { - - - System.out.println("\nServer running.\n"); - boolean serverState = true; - boolean recState = true; - - try { - - com.ericsson.otp.erlang.OtpServer self = new com.ericsson.otp.erlang.OtpServer(SNode, Cookie); - self.publishPort(); - - /* Server loop */ - while(serverState == true) { - - com.ericsson.otp.erlang.OtpConnection connection = self.accept(); - serverImpl srv = new serverImpl(); - com.ericsson.otp.erlang.OtpInputStream request; - com.ericsson.otp.erlang.OtpOutputStream reply; - com.ericsson.otp.erlang.OtpErlangPid client; - - /* Server loop */ - while(recState == true) { - - if (connection.isConnected() == true) - try { - - request = connection.receiveBuf(); - - reply = srv.invoke(request); - - if (reply != null) { - client = srv.__getCallerPid(); - - connection.sendBuf(client,reply); - } - - } catch( Exception e) { - System.out.println("Server terminated.\n\n"); - recState = false; - serverState = false; - } - } - - connection.close(); - } - - } catch( Exception e) { - System.out.println("Initialization exception :"); - e.printStackTrace(); - } - } -} - - - - diff --git a/lib/ic/examples/java-client-server/serverImpl.java b/lib/ic/examples/java-client-server/serverImpl.java deleted file mode 100644 index 336bc7e327..0000000000 --- a/lib/ic/examples/java-client-server/serverImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -public class serverImpl extends rmod._randomImplBase { - - java.util.Random random = null; - - - public void init(int seed1, int seed2, int seed3) throws java.lang.Exception { - - random = new java.util.Random(seed1+seed2+seed3); - }; - - - public double produce() throws java.lang.Exception { - - return random.nextDouble(); - } - -} - - - - - - diff --git a/lib/ic/examples/pre_post_condition/Makefile b/lib/ic/examples/pre_post_condition/Makefile deleted file mode 100644 index cd7e630724..0000000000 --- a/lib/ic/examples/pre_post_condition/Makefile +++ /dev/null @@ -1,135 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -# ``Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# The Initial Developer of the Original Code is Ericsson Utvecklings AB. -# Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings -# AB. All Rights Reserved.'' -# -# $Id$ -# -include $(ERL_TOP)/make/target.mk - -EBIN= ./ - -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../../vsn.mk -VSN=$(IC_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/ic-$(VSN) - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- - -IDL_FILES = \ - ex.idl - -GEN_ERL_MODULES = \ - oe_ex \ - m_i \ - m_NotAnInteger - -MODULES= \ - m_i_impl \ - tracer - -GEN_HRL_FILES = \ - oe_ex.hrl \ - m.hrl \ - m_i.hrl - -HRL_FILES = -TXT_FILES = ReadMe.txt - -ERL_FILES= $(MODULES:%=%.erl) - - -TARGET_FILES = \ - $(GEN_ERL_MODULES:%=$(EBIN)/%.$(EMULATOR)) \ - $(MODULES:%=$(EBIN)/%.$(EMULATOR)) - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_LOCAL_FLAGS += -pa $(ERL_TOP)/lib/orber/ebin -pa $(ERL_TOP)/lib/ic/ebin -# The -pa option is just used temporary until erlc can handle -# includes from other directories than ../include . -ERL_COMPILE_FLAGS += \ - $(ERL_LOCAL_FLAGS) \ - -pa $(ERL_TOP)/lib/orber -I$(ERL_TOP)/lib/orber -YRL_FLAGS = - - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -debug opt: $(TARGET_FILES) - -clean: - rm -f $(TARGET_FILES) $(GEN_ERL_MODULES:%=%.erl) $(GEN_HRL_FILES) $(CLASS_FILES) IDL-GENERATED - rm -f errs core *~ - -docs: - -test: $(TEST_TARGET_FILES) - - -IDL-GENERATED: ex.idl - $(gen_verbose)erlc $(ERL_LOCAL_FLAGS) +'{precond,{tracer,pre}}' \ - +'{{postcond,"m::i::f"},{tracer,post}}' ex.idl - $(V_at)>IDL-GENERATED - -$(GEN_ERL_MODULES:%=%.erl) $(GEN_HRL_FILES): IDL-GENERATED - -$(TARGET_FILES): IDL-GENERATED - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - - -release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)/examples/pre_post_condition" - $(INSTALL_DATA) $(ERL_FILES) $(IDL_FILES) $(TXT_FILES) "$(RELSYSDIR)/examples/pre_post_condition" - - -release_docs_spec: - - diff --git a/lib/ic/examples/pre_post_condition/ReadMe.txt b/lib/ic/examples/pre_post_condition/ReadMe.txt deleted file mode 100644 index 2fb3f0a04f..0000000000 --- a/lib/ic/examples/pre_post_condition/ReadMe.txt +++ /dev/null @@ -1,74 +0,0 @@ - ``Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson Utvecklings AB. - Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings - AB. All Rights Reserved.'' - - $Id$ - - -This example shows how pre and post condition can be used for a Corba server object. - - -The example consists of three files; - -ex.idl - the interface specification -m_i_impl.erl - the server implementation -tracer.erl - a module which contains a pre and a post condition - - -The IDL file can for example be compiled with the following options: - -ic:gen(ex, [{precond, {tracer, pre}},{{postcond, "m::i::f"}, {tracer, post}}]). - -The result is that the function m::i::f gets both a pre and post condition call while -the function m::i::g just get a pre condition call. - - -A pre/post condition function should always return the atom ok and if something is wrong -it should raise an exception ( ex: corba:raise(#userexception{}) ). - - - - -Compile all erlang files and test the application. - -First start an erlang node, then type the following commands in the erlang shell. - -1> mnesia:create_schema([]). -2> orber:install([]). -3> orber:start(). -3> -3> X = m_i:oe_create(). -4> catch m_i:f(X, 17). -Precond called in process <0.139.0>: m_i:f() [[],17] -f working .... -Postcond called in process <0.139.0>: m_i:f() [[],17] {reply,{17,17},[]} -17 -5> -5> catch m_i:f(X, q). -6> {'EXCEPTION',{m_NotAnInteger,"IDL:m/NotAnInteger:1.0"}} -7> -7>m_i:g(X, 17). -Precond called in process <0.139.0>: m_i:g() [[],17] -ok -g working .... -8> -8>corba_boa:dispose(X). -9> orber:stop(). -10> - - - - - diff --git a/lib/ic/examples/pre_post_condition/ex.idl b/lib/ic/examples/pre_post_condition/ex.idl deleted file mode 100644 index 29298c8efb..0000000000 --- a/lib/ic/examples/pre_post_condition/ex.idl +++ /dev/null @@ -1,30 +0,0 @@ -// ``Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// The Initial Developer of the Original Code is Ericsson Utvecklings AB. -// Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings -// AB. All Rights Reserved.'' -// -// $Id$ -// - -module m { - - exception NotAnInteger {}; - - interface i { - short f(in short i); - oneway void g(in long i); - }; - -}; - diff --git a/lib/ic/examples/pre_post_condition/m_i_impl.erl b/lib/ic/examples/pre_post_condition/m_i_impl.erl deleted file mode 100644 index fa6d9675a2..0000000000 --- a/lib/ic/examples/pre_post_condition/m_i_impl.erl +++ /dev/null @@ -1,50 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%------------------------------------------------------------ -%% -%% Example -%% -%%------------------------------------------------------------ --module(m_i_impl). - -%% Standard functions --export([init/1, terminate/2]). -%% Interface functions --export([f/2, g/2]). - -init(_Env) -> - {ok, []}. - -terminate(_From, _Reason) -> - ok. - -f(State, In) -> - io:format("f working ....\n", []), - {reply, In, State}. - -g(State, _In) -> - io:format("g working ....\n", []), - {noreply, State}. - - - - - diff --git a/lib/ic/examples/pre_post_condition/tracer.erl b/lib/ic/examples/pre_post_condition/tracer.erl deleted file mode 100644 index c64459f4fd..0000000000 --- a/lib/ic/examples/pre_post_condition/tracer.erl +++ /dev/null @@ -1,57 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: tracer.erl -%% -%% Description: -%% This file contains an example of pre and post conditions for -%% the corba backend. -%% -%%----------------------------------------------------------------- --module(tracer). --include("m.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([pre/3, post/4]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- -pre(M, F, [State, I]) when is_integer(I) -> - io:format("Precond called in process ~p: ~s:~s() ~p\n", [self(), M, F, [State, I]]), - ok; -pre(_M, _F, _A) -> %% Just an silly example to get an exception case - corba:raise(#'m_NotAnInteger'{}). - -post(M, F, A, R) -> - io:format("Postcond called in process ~p: ~s:~s() ~p ~p\n", [self(), M, F, A, R]), - ok. - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- diff --git a/lib/ic/include/erlang.idl b/lib/ic/include/erlang.idl deleted file mode 100644 index 87d1247b87..0000000000 --- a/lib/ic/include/erlang.idl +++ /dev/null @@ -1,58 +0,0 @@ -// ``Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// The Initial Developer of the Original Code is Ericsson Utvecklings AB. -// Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings -// AB. All Rights Reserved.'' -// -// $Id$ -// - -#ifndef _ERLANG_IDL_ -#define _ERLANG_IDL_ - -module erlang -{ - - // an erlang pid - struct pid { - string<256> node; - unsigned long num; - unsigned long serial; - unsigned long creation; - }; - - // an erlang port - struct port { - string<256> node; - unsigned long id; - unsigned long creation; - }; - - // port and ref have identical structure - struct ref { - string<256> node; - unsigned long id; - unsigned long creation; - }; - - - // an erlang term - typedef any term; - - - // an erlang binary - typedef sequence binary; - -}; - -#endif diff --git a/lib/ic/include/ic.h b/lib/ic/include/ic.h deleted file mode 100644 index 3dc5dbd4b5..0000000000 --- a/lib/ic/include/ic.h +++ /dev/null @@ -1,432 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1998-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include -#include -#include -#include -#include - -#ifdef __WIN32__ -/* Windows.h #defines interface to struct, get rid of it! */ -#ifdef interface -#undef interface -#endif -#endif - -#ifndef __IC_H__ -#define __IC_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Standard type mapping */ - -#ifndef __CORBA_SHORT__ -#define __CORBA_SHORT__ - typedef short CORBA_short; -#endif - -#ifndef __CORBA_LONG__ -#define __CORBA_LONG__ - typedef long CORBA_long; -#endif - -/* CORBA_long_long = long because of erl_interface limitation */ -#ifndef __CORBA_LONG_LONG__ -#define __CORBA_LONG_LONG__ - typedef long CORBA_long_long; /* LONG LONG */ -#endif - -#ifndef __CORBA_UNSIGNED_SHORT__ -#define __CORBA_UNSIGNED_SHORT__ - typedef unsigned short CORBA_unsigned_short; -#endif - -#ifndef __CORBA_UNSIGNED_LONG__ -#define __CORBA_UNSIGNED_LONG__ - typedef unsigned long CORBA_unsigned_long; -#endif - -/* CORBA_unsigned long_long = unsigned long because of erl_interface - limitation */ - -#ifndef __CORBA_UNSIGNED_LONG_LONG__ -#define __CORBA_UNSIGNED_LONG_LONG__ - typedef unsigned long CORBA_unsigned_long_long; -#endif - -#ifndef __CORBA_FLOAT__ -#define __CORBA_FLOAT__ - typedef float CORBA_float; -#endif - -#ifndef __CORBA_DOUBLE__ -#define __CORBA_DOUBLE__ - typedef double CORBA_double; -#endif - - -#ifndef __CORBA_LONG_DOUBLE__ -#define __CORBA_LONG_DOUBLE__ - typedef double CORBA_long_double; -#endif - -#ifndef __CORBA_CHAR__ -#define __CORBA_CHAR__ - typedef char CORBA_char; -#endif - -#ifndef __CORBA_WCHAR__ -#define __CORBA_WCHAR__ - typedef unsigned long CORBA_wchar; -#endif - -#ifndef __CORBA_BOOLEAN__ -#define __CORBA_BOOLEAN__ - typedef unsigned char CORBA_boolean; -#endif - -#ifndef __CORBA_OCTET__ -#define __CORBA_OCTET__ - typedef char CORBA_octet; -#endif - -#ifndef CORBA_enum -#define CORBA_enum enum -#endif - -#ifndef __ERLANG_BINARY__ -#define __ERLANG_BINARY__ - typedef struct { - CORBA_unsigned_long _maximum; - CORBA_unsigned_long _length; - CORBA_octet* _buffer; - } erlang_binary; -#endif - - -/* Object definition */ - typedef void* CORBA_Object; - - -/* Exception discriminators */ -#ifndef CORBA_NO_EXCEPTION -#define CORBA_NO_EXCEPTION 0 -#endif - -#ifndef CORBA_SYSTEM_EXCEPTION -#define CORBA_SYSTEM_EXCEPTION -1 -#endif - -#ifndef CORBA_USER_EXCEPTION -#define CORBA_USER_EXCEPTION -2 -#endif - -/* System exceptions */ - -#define UNKNOWN "UNKNOWN" -#define BAD_PARAM "BAD_PARAM" -#define NO_MEMORY "NO_MEMORY" -#define IMPL_LIMIT "IMP_LIMIT" -#define COMM_FAILURE "COMM_FAILURE" -#define INV_OBJREF "INV_OBJREF" -#define NO_PERMISSION "NO_PERMISSION" -#define INTERNAL "INTERNAL" -#define MARSHAL "MARSHAL" -#define INITIALIZE "INITIALIZE" -#define NO_IMPLEMENT "NO_IMPLEMENT" -#define BAD_TYPECODE "BAD_TYPECODE" -#define BAD_OPERATION "BAD_OPERATION" -#define NO_RESOURCES "NO_RESOURCES" -#define NO_RESPONSE "NO_RESPONSE" -#define PERSIST_STORE "PERSIST_STORE" -#define BAD_INV_ORDER "BAD_INV_ORDER" -#define TRANSIENT "TRANSIENT" -#define FREE_MEM "FREE_MEM" -#define INV_IDENT "INV_IDENT" -#define INV_FLAG "INV_FLAG" -#define INTF_REPOS "INTF_REPOS" -#define BAD_CONTEXT "BAD_CONTEXT" -#define OBJ_ADAPTER "OBJ_ADAPTER" -#define DATA_CONVERSION "DATA_CONVERSION" -#define OBJ_NOT_EXIST "OBJECT_NOT_EXIST" - - - -/* Exception type */ - typedef int CORBA_exception_type; - - -#ifndef __CORBA_ENVIRONMENT__ -#define __CORBA_ENVIRONMENT__ - -/* Environment definition */ - typedef struct { - - /*----- CORBA compatibility part ------------------------------------*/ - CORBA_exception_type _major; /* Exception tag, initially set - to CORBA_NO_EXCEPTION */ - - /*----- External Implementation part - initiated by the user --------*/ - int _fd; /* File descriptor */ - int _inbufsz; /* Size of input buffer */ - char *_inbuf; /* Pointer to always - dynamically allocated - buffer for input */ - int _outbufsz; /* Size of output buffer */ - char *_outbuf; /* Pointer to always - dynamically - allocated buffer - for output */ - int _memchunk; /* Size of memory - chunks in bytes, - used for increasing - the output buffer, - set to >= 32, - should be around >= - 1024 for - performance reasons */ - char _regname[256]; /* Pointer for - registered name */ - erlang_pid *_to_pid; /* Process identity - for caller */ - erlang_pid *_from_pid; /* Process identity - for callee */ - /*----- Internal Implementation part - used by the server/client ----*/ - int _iin; /* Index for input buffer */ - int _iout; /* Index for output buffer */ - char _operation[256]; /* Pointer for operation name*/ - int _received; /* Used to count parameters */ - erlang_pid _caller; /* Used to identify - the caller*/ - erlang_ref _unique; /* Used to identify the call */ - CORBA_char *_exc_id; /* Exception id field */ - void *_exc_value; /* Exception value field */ - - unsigned int _ref_counter_1; /* Counter for reference */ - unsigned int _ref_counter_2; /* Counter for reference */ - unsigned int _ref_counter_3; /* Counter for reference */ - - } CORBA_Environment; - -#endif - - -/* Corba standard functions */ - - void CORBA_free(void *); - CORBA_char *CORBA_string_alloc(CORBA_unsigned_long); - CORBA_wchar *CORBA_wstring_alloc(CORBA_unsigned_long); - CORBA_char *CORBA_exception_id(CORBA_Environment *env); - void *CORBA_exception_value(CORBA_Environment *env); - void CORBA_exception_free(CORBA_Environment *env); - void CORBA_exc_set(CORBA_Environment *env, - CORBA_exception_type Major, - CORBA_char *Id, - CORBA_char *Value); - CORBA_Environment *CORBA_Environment_alloc(int inbufsz, int outbufsz); - void ic_init_ref(CORBA_Environment *env, erlang_ref *ref); - int ic_compare_refs(erlang_ref *ref1, erlang_ref *ref2); - -/* Used internally */ - -#define __OE_MEMCHUNK__ 1024 -#define __OE_VSNSZ__ 1 -#define __OE_LONGSZ__ 7 -#define __OE_LONGLONGSZ__ 7 -#define __OE_ULONGSZ__ 7 -#define __OE_ULONGLONGSZ__ 7 -#define __OE_DOUBLESZ__ 32 -#define __OE_CHARSZ__ 2 -#define __OE_WCHARSZ__ 7 -#define __OE_TUPLEHDRSZ__ 5 -#define __OE_LISTHDRSZ__ 5 - -/* The actual size of a wide char (used to be #define __OE_WCHAR_SIZE_OF__ 4) */ -#define __OE_WCHAR_SIZE_OF__ sizeof(CORBA_wchar) - -/* Size check macro */ -#define OE_MALLOC_SIZE_CHECK(env,x) { \ - assert((x) > 0); \ - if (!((x) > 0)) { \ - CORBA_exc_set((env), CORBA_SYSTEM_EXCEPTION, INTERNAL, \ - "Bad malloc size calculation"); \ - return -1; \ - } \ -} - -/* Exec function -- probably not needed */ - typedef int oe_exec_function_t(CORBA_Object, CORBA_Environment*); -/* These are for backward compatibility */ - typedef oe_exec_function_t ___exec_function___; - typedef oe_exec_function_t ___generic___; - -/* Operation declaration */ - typedef struct { - char *interface; - char *name; - oe_exec_function_t *function; - } oe_operation_t; - -/* For backward compatibility */ - typedef oe_operation_t ___operation___; - -/* Map declaration */ - typedef struct { - int length; - oe_operation_t *operations; - } oe_map_t; -/* For backward compatibility */ - typedef oe_map_t ___map___; - -/* Align macro */ -#define OE_ALIGN(x) (((x) + sizeof(double) - 1) & ~(sizeof(double) - 1)) - -/* Encoders */ - int oe_ei_encode_version(CORBA_Environment *env); - int oe_ei_encode_long(CORBA_Environment *env, long p); - int oe_ei_encode_longlong(CORBA_Environment *env, CORBA_long_long p); - int oe_ei_encode_ulong(CORBA_Environment *env, unsigned long p); - int oe_ei_encode_ulonglong(CORBA_Environment *env, - CORBA_unsigned_long_long p); - int oe_ei_encode_double(CORBA_Environment *env, double p); - int oe_ei_encode_char(CORBA_Environment *env, char p); - int oe_ei_encode_wchar(CORBA_Environment *env, CORBA_wchar p); - int oe_ei_encode_string(CORBA_Environment *env, const char *p); - int oe_ei_encode_wstring(CORBA_Environment *env, CORBA_wchar *p); - int oe_ei_encode_atom(CORBA_Environment *env, const char *p); - int oe_ei_encode_pid(CORBA_Environment *env, const erlang_pid *p); - int oe_ei_encode_port(CORBA_Environment *env, const erlang_port *p); - int oe_ei_encode_ref(CORBA_Environment *env, const erlang_ref *p); - int oe_ei_encode_term(CORBA_Environment *env, void *t); - int oe_ei_encode_tuple_header(CORBA_Environment *env, int arity); - int oe_ei_encode_list_header(CORBA_Environment *env, int arity); - int oe_encode_erlang_binary(CORBA_Environment *env, erlang_binary *binary); - -#define oe_ei_encode_empty_list(ev) oe_ei_encode_list_header(ev,0) - -/* Decoders */ - int oe_ei_decode_wchar(const char *buf, int *index, CORBA_wchar *p); - int oe_ei_decode_wstring(const char *buf, int *index, CORBA_wchar *p); - int oe_ei_decode_longlong(const char *buf, int *index, CORBA_long_long *p); - int oe_ei_decode_ulonglong(const char *buf, int *index, - CORBA_unsigned_long_long *p); - int oe_decode_erlang_binary(CORBA_Environment *env, char *buf, int *index, - erlang_binary *binary); - -/* Generic client encoders (gen_server protocol) */ - int oe_prepare_notification_encoding(CORBA_Environment *env); - int oe_prepare_request_encoding(CORBA_Environment *env); - -/* Generic client decoders (gen_server protocol) */ - int oe_prepare_reply_decoding(CORBA_Environment *env); - -/* Generic client send and receive functions (Erlang distribution protocol) */ - int oe_send_notification(CORBA_Environment *env); - int oe_send_notification_tmo(CORBA_Environment *env, unsigned int send_ms); - int oe_send_request_and_receive_reply(CORBA_Environment *env); - int oe_send_request_and_receive_reply_tmo(CORBA_Environment *env, - unsigned int send_ms, - unsigned int recv_ms); - -/* Generic server decoder */ - int oe_prepare_request_decoding(CORBA_Environment *env); - -/* Generic server encoder */ - int oe_prepare_reply_encoding(CORBA_Environment *env); - -/* -------- */ - -/* Generic server receive (possibly send reply) */ - int oe_server_receive(CORBA_Environment *env, oe_map_t *map); - int oe_server_receive_tmo(CORBA_Environment *env, oe_map_t *map, - unsigned int send_ms, - unsigned int recv_ms); - -/* -------- */ - -/* Size calculators */ - int oe_sizecalc_erlang_binary(CORBA_Environment *env, int *index, - int *size); -/* Print functions */ - int print_erlang_binary(erlang_binary*); - -/* Length counter for wide strings */ - int ic_wstrlen(CORBA_wchar * p); - -/* Wide string comparison */ - int ic_wstrcmp(CORBA_wchar * ws1, CORBA_wchar * ws2); - -/* Put for 64-bits integer type */ -#define put64le(s,n) do { \ - (s)[0] = (n) & 0xff; \ - (s)[1] = ((n) >> 8) & 0xff; \ - (s)[2] = ((n) >> 16) & 0xff; \ - (s)[3] = ((n) >> 24) & 0xff; \ - (s)[4] = ((n) >> 32) & 0xff; \ - (s)[5] = ((n) >> 40) & 0xff; \ - (s)[6] = ((n) >> 48) & 0xff; \ - (s)[7] = ((n) >> 56) & 0xff; \ - (s)[8] = ((n) >> 64) & 0xff; \ - (s) += 8; \ -} while (0) - -/* Get for 64-bits integer type */ -#define get64le(s) \ - ((s) += 8, \ - ((((unsigned char *)(s))[-1] << 56) | \ - (((unsigned char *)(s))[-2] << 48) | \ - (((unsigned char *)(s))[-3] << 40) | \ - (((unsigned char *)(s))[-4] << 32) | \ - (((unsigned char *)(s))[-5] << 24) | \ - (((unsigned char *)(s))[-6] << 16) | \ - (((unsigned char *)(s))[-7] << 8) | \ - ((unsigned char *)(s))[-8])) - - - -/* Exec function switch */ - int oe_exec_switch(CORBA_Object, CORBA_Environment*, oe_map_t*); -/* For backward compatibility */ - int ___switch___(CORBA_Object, CORBA_Environment*, oe_map_t*); - -/* For backward compatibility -- replaced by oe_prepare_request_decoding() */ - int ___call_info___(CORBA_Object, CORBA_Environment*); - -/* Map merging */ - oe_map_t* oe_merge_maps(oe_map_t*, int); -/* For backward compatibility */ - oe_map_t* ___merge___(oe_map_t*, int); - -/* Macro for error reporting */ - -#ifdef OE_C_REPORT -#define OE_RPT_ERR(x) fprintf(stderr, (x)) -#else -#define OE_RPT_ERR(x) -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/lib/ic/info b/lib/ic/info deleted file mode 100644 index 96cb88d01f..0000000000 --- a/lib/ic/info +++ /dev/null @@ -1,2 +0,0 @@ -group: orb Object Request Broker & IDL Applications -short: IDL compiler diff --git a/lib/ic/internal_doc/c-improvements-1.txt b/lib/ic/internal_doc/c-improvements-1.txt deleted file mode 100644 index ccfdec7cbe..0000000000 --- a/lib/ic/internal_doc/c-improvements-1.txt +++ /dev/null @@ -1,84 +0,0 @@ -Peter Hogfeldt 2003-08-14 PA1 - -IC C BACK-ENDS IMPROVEMENTS - -1 C CLIENT - -1.1 Cast - - Each oneway operation roughly consists of the following code - parts: - - - encoding the cast message - - setting index of the out buffer to zero (1.1.1) - - encoding the magic (1.1.1) - - encoding a tuple header of size 2 (1.1.1) - - encoding '$gen_cast' (1.1.1) - - encoding the operation parameters (1.1.2) - - sending the cast message (1.1.3) - - Only (1.1.2) is unique for the operation in question. - -1.1.1 Todo - - Define functions: - - int oe_ei_encode_cast(CORBA_environment *) that performs (1.1.1) - - int oe_ei_cast(CORBA_environment *) that performs (1.1.3) - - This will reduce code size. - - As compiler options - - oe_ei_encode_cast(), and - oe_ei_cast() - - may be replaced by user defined functions. - -1.2 Call - - Each (non-oneway) operation roughly consists of the following code - parts: - - - encoding the call message - - setting index of the out buffer to zero (1.2.1) - - encoding the magic (1.2.1) - - encoding a tuple header of size 3 (1.2.1) - - encoding '$gen_call' (1.2.1) - - encoding a tuple header of size 2 (1.2.1) - - encoding the from pid (1.2.1) - - encoding the unique ref (1.2.1) - - encoding the operation parameters (1.2.2) - - sending the call message (1.2.3) - - receiving the reply message (1.2.3) - - decoding the reply parameters (1.2.4) - - Only (1.2.2) and (1.2.4) are unique for the operation in question. - -1.2.1 Todo - - Define functions: - - int oe_ei_encode_send(CORBA_environment *) that performs (1.2.1) - - int oe_ei_send_and_receive(CORBA_environment *) that performs (1.2.3) - - This will reduce code size. - - As compiler options - - oe_ei_encode_send(), and - oe_ei_send_and_receive() - - may be replaced by user defined function. - - -2 SERVER - - We do not provide any code for receiving operation messages, execute - operations, and send the result back. Should we not do that? - - - - \ No newline at end of file diff --git a/lib/ic/internal_doc/protocol.txt b/lib/ic/internal_doc/protocol.txt deleted file mode 100644 index 54e1ef55cf..0000000000 --- a/lib/ic/internal_doc/protocol.txt +++ /dev/null @@ -1,182 +0,0 @@ -Peter Hogfeldt 2003-08-18 PA3 - -THE IC PROTOCOL - -1 INTRODUCTION - - The IDL Compiler (IC) transforms Interface Definition Language - (IDL) specifications files to interface code for Erlang, C, and - Java. The Erlang language mapping is described in the Orber - documentation, while the other mappings are described in the IC - documentation (they are of course in accordance with the CORBA C - and Java language mapping specifications, with some restrictions). - - The most important parts of an IDL specification are the operation - declarations. An operation defines what information a client - provides to a server, and what information (if any) the client - gets back from the server. We consider IDL operations and language - mappings in section 2. - - What we here call the IC protocol, is the description of messages - exchanged between IC end-points (client and servers). It is valid - for all IC back-ends, except the 'erl_plain' and 'erl_corba' - back-ends. The protocol is described in section 3. - - The IC protocol is in turn embedded into the Erlang gen_server - protocol, which is described in section 4. - - Finally, the gen_server protocol is embedded in the Erlang - distribution protocol. Pertinent parts of that protocol is - described in section 5. - - -2 LANGUAGE MAPPINGS AND IDL OPERATIONS - -2.1 IDL Operations - - An IDL operation is declared as follows: - - [oneway] RetType Op(in IType1 I1, in IType2 I2, ..., in ITypeN IN, - out OType1 O1, out OType2 O2, ..., out OTypeM OM) - N, M = 0, 1, 2, ... (2.1.1) - - `Op' is the operation name, RetType is the return type, and ITypei, - i = 1, 2, ..., N, and OTypej, j = 1, 2, ..., M, are the `in' types - and `out' types, respectively. The values I1, I2, ..., IN are - provided by the caller, and the value of RetType, and the values - O1, O2, ..., OM, are provided as results to the caller. - - The types can be any basic types or derived types declared in the - IDL specification of which the operation declaration is a part. - - If the RetType has the special name `void' there is no return - value (but there might still be result values O1, 02, ..., OM). - - The `in' and `out' parameters can be declared in any order, but - for clarity we have listed all `in' parameters before the `out' - parameters in the declaration above. - - If the keyword `oneway' is present, the operation is a cast, i.e. - there is no confirmation of the operation, and consequently there - must be no result values: RetType must be equal to `void', and M = - 0 must hold. - - Otherwise the operation is a call, i.e. it is confirmed (or else - an exception is raised). - - Note carefully that an operation declared without `oneway' is - always a call, even if RetType is `void' and M = 0. - -2.2 Language Mappings - - There are several CORBA Language Mapping specifications. These are - about mapping interfaces to various programming languages. IC - supports the CORBA C and Java mapping specifications, and the - Erlang language mapping specified in the Orber documentation. - - Excerpt from "6.4 Basic OMG IDL Types" in the Orber User's Guide: - - Functions with return type void will return the atom ok. - - Excerpt from "6.13 Invocations of Operations" in the Orber User's Guide: - - A function call will invoke an operation. The first parameter - of the function should be the object reference and then all in - and inout parameters follow in the same order as specified in - the IDL specification. The result will be a return value - unless the function has inout or out parameters specified; in - which case, a tuple of the return value, followed by the - parameters will be returned. - - Hence the function that is mapped from an IDL operation to Erlang - always have a return value (an Erlang function always has). That - fact has influenced the IC protocol, in that there is always a - return value (which is 'ok' if the return type was declared 'void'). - - -3 IC PROTOCOL - - Given the operation declaration (2.1.1) the IC protocol maps to - messages as follows, defined in terms of Erlang terms. - -3.1 Call (Request/Reply, i.e. not oneway) - - request: Op atom() N = 0 - {Op, I1, I2, ..., IN} tuple() N > 0 - (3.1.1) - - reply: Ret M = 0 - {Ret, O1, O2, ..., OM} M > 0 - (3.1.2) - - Notice; Even if the RetType of the operation Op is declared to be - 'void', a return value 'ok' is returned in the reply message. That - return value is of no significance, and is therefore ignored (note - however that a C server back-end returns the atom 'void' instead - of 'ok'). - -3.2 Cast (oneway) - - notification: Op atom() N = 0 - {Op, I1, I2, ..., IN} tuple() N > 0 - (3.2.1) - (There is of course no return message). - -3.3 Propagation of Exceptions - - Currently there is no propagation of exceptions from the server to - the client. As it is now a an exception detected by the server - will hang the client in a receive. That is unacceptable. - - Exception propagation is only meaningful for Call (request/reply). - - -4 GEN_SERVER PROTOCOL - - Most of the IC generated code deals with encoding and decoding the - gen_server protocol. - -4.1 Call - - request: {'$gen_call', {self(), Ref}, Request} (4.1.1) - - reply: {Ref, Reply} (4.1.2) - - where Request and Reply are the messages defined in 3.1 Call. - -4.2 Cast - - notification: {'$gen_cast', Notification} (4.2.1) - - where Notification is the message defined in 3.2 Cast. - - -5 ERLANG DISTRIBUTION PROTOCOL - - Messages (of interest here) between Erlang nodes are of the form: - - Len(4), Type(1), CtrlBin(N), MsgBin(M) (5.1) - - Type is equal to 112 = PASS_THROUGH. - - CtrlBin and MsgBin are Erlang terms in binary form (as if created - by term_to_binary/1), whence for each of them the first byte is - equal to 131 = VERSION_MAGIC. - - CtrlBin (of interest here) contains the SEND and REG_SEND control - messages, which are binary forms of the Erlang terms - - {2, Cookie, ToPid} , (5.2) - - and - - {6, FromPid, Cookie, ToName} , (5.3) - - respectively. - - The CtrlBin(N) message is read and written by erl_interface code - (C), j_interface code (Java), or the Erlang distribution - implementation, which are invoked from IC generated code. - - The MsgBin(N) is the "real" message, i.e. of the form described - in section 4. diff --git a/lib/ic/java_src/Makefile b/lib/ic/java_src/Makefile deleted file mode 100644 index 86d1e54fff..0000000000 --- a/lib/ic/java_src/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(ORBER_VSN) - -# ---------------------------------------------------- -# Common Macros -# ---------------------------------------------------- - -SUB_DIRECTORIES = com/ericsson/otp/ic - -SPECIAL_TARGETS = - -# ---------------------------------------------------- -# Default Subdir Targets -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_subdir.mk - diff --git a/lib/ic/java_src/com/ericsson/otp/ic/Any.java b/lib/ic/java_src/com/ericsson/otp/ic/Any.java deleted file mode 100644 index d90b942877..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/Any.java +++ /dev/null @@ -1,1026 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -package com.ericsson.otp.ic; - - -/** - -The Any class is the java mapping of the any OMG-IDL type. - - -**/ - - -public class Any { - - // Typecode value holder - protected TypeCode tcV; - - // Primitive value holder - protected java.lang.String stringV; - protected byte byteV; - protected boolean booleanV; - protected char charV; - protected short shortV; - protected int intV; - protected long longV; - protected float floatV; - protected double doubleV; - - // Streams used for user defined types - protected com.ericsson.otp.erlang.OtpInputStream is; - protected com.ericsson.otp.erlang.OtpOutputStream os; - - - // Constructor - public Any() { - tcV = null; - } - - // Equal function - - /** - Any comparison method - @return true if the input Any is equal to the object, false otherwize - **/ - public boolean equal(com.ericsson.otp.ic.Any _any) { - - int _is1Len,_is2Len; - byte _compressed[]; - com.ericsson.otp.erlang.OtpInputStream _is1,_is2; - TypeCode _tc = _any.type(); - - if (!tcV.equal(_tc)) - return false; - - try { - - TCKind _tck = _tc.kind(); - - switch (_tck.value()) { - - case TCKind._tk_short: - return (_any.extract_short() == shortV); - - case TCKind._tk_ushort: - return (_any.extract_ushort() == shortV); - - case TCKind._tk_long: - return (_any.extract_long() == intV); - - case TCKind._tk_longlong: - return (_any.extract_longlong() == longV); - - case TCKind._tk_ulong: - return (_any.extract_ulong() == intV); - - case TCKind._tk_ulonglong: - return (_any.extract_ulonglong() == longV); - - case TCKind._tk_float: - return equal(_any.extract_float(),floatV); - - case TCKind._tk_double: - return equal(_any.extract_double(),doubleV); - - case TCKind._tk_boolean: - return (_any.extract_boolean() == booleanV); - - case TCKind._tk_char: - return (_any.extract_char() == charV); - - case TCKind._tk_wchar: - return (_any.extract_wchar() == charV); - - case TCKind._tk_octet: - return (_any.extract_octet() == byteV); - - case TCKind._tk_string: - return (_any.extract_string().compareTo(stringV) == 0); - - case TCKind._tk_wstring: - return (_any.extract_wstring().compareTo(stringV) == 0); - - case TCKind._tk_sequence: - - _is1 = new com.ericsson.otp.erlang.OtpInputStream(os.toByteArray()); - - _is2 = _any.extract_Streamable(); - - if (_is1.peek() != _is2.peek()) { - - // _is1's sequence is compressed to string - if(_is1.peek() == com.ericsson.otp.erlang.OtpExternal.stringTag) { - - _compressed = (_is1.read_string()).getBytes(); - _is1Len = _compressed.length; - - _is2.read_list_head(); - - for(int i = 0; i < _is1Len; i++) { - if ((long)(_compressed[i] & 0xff) != _is2.read_long()) - return false; - } - - _is2.read_nil(); - } - else { // _is2's sequence is compressed to string - - _compressed = (_is2.read_string()).getBytes(); - _is2Len = _compressed.length; - - _is1.read_list_head(); - - for(int i = 0; i < _is2Len; i++) - if ((long)(_compressed[i] & 0xff) != _is1.read_long()) - return false; - - _is1.read_nil(); - } - } - else { // None of them is compressed - - _is2Len = _is2.available(); - - if (_is1.available() != _is2Len) - return false; - - for(int i = 0; i < _is2Len; i++) { - if (_is1.read() != _is2.read()) - return false; - } - } - - return true; - - case TCKind._tk_struct: - case TCKind._tk_union: - case TCKind._tk_array: - case TCKind._tk_enum: - - _is1 = new com.ericsson.otp.erlang.OtpInputStream(os.toByteArray()); - - _is2 = _any.extract_Streamable(); - - _is2Len = _is2.available(); - - if (_is1.available() != _is2Len) - return false; - - for(int i = 0; i < _is2Len; i++) { - if (_is1.read() != _is2.read()) - return false; - } - - return true; - - // Not used in real - case TCKind._tk_any: - case TCKind._tk_void: - case TCKind._tk_atom: - case TCKind._tk_null: - case TCKind._tk_TypeCode: - case TCKind._tk_Principal: - case TCKind._tk_objref: - case TCKind._tk_alias: - case TCKind._tk_except: - case TCKind._tk_longdouble: - case TCKind._tk_fixed: - return true; - - default : - return false; - - } - } catch (Exception e) { - //e.printStackTrace(); - return false; - } - - } - - - /* Equal function for floats ( relative diff ) */ - boolean equal(float x, float y) { - - if (x != 0) - return (java.lang.Math.abs((x-y)/x) < 1.0E-15); - - if (y != 0) - return (java.lang.Math.abs((y-x)/y) < 1.0E-15); - - return (x==y); - } - - /* Equal function for doubles ( relative diff ) */ - boolean equal(double x, double y) { - - if (x != 0) - return (java.lang.Math.abs((x-y)/x) < 1.0E-15); - - if (y != 0) - return (java.lang.Math.abs((y-x)/y) < 1.0E-15); - - return (x==y); - } - - - - /** - TypeCode accessor method - @return the Any's TypeCode - **/ - public TypeCode type() { - return tcV; - } - - - /** - TypeCode insertion method - **/ - public void type(TypeCode _tc) { - tcV = _tc; - } - - - /* Value accessors */ - - /** - Reads a value from the stream, according to the inserted TypeCode - **/ - public void read_value(com.ericsson.otp.erlang.OtpInputStream _is, - TypeCode _tc) - throws java.lang.Exception { - - tcV = _tc; - - switch(tcV.kind().value()) { - - case TCKind._tk_short : - shortV = _is.read_short(); - break; - case TCKind._tk_ushort : - shortV = _is.read_ushort(); - break; - case TCKind._tk_long : - intV = _is.read_int(); - break; - case TCKind._tk_ulong : - intV = _is.read_uint(); - break; - case TCKind._tk_longlong : - longV = _is.read_long(); - break; - case TCKind._tk_ulonglong : - longV = _is.read_ulong(); - break; - case TCKind._tk_float : - floatV = _is.read_float(); - break; - case TCKind._tk_double : - doubleV = _is.read_double(); - break; - case TCKind._tk_boolean : - booleanV = _is.read_boolean(); - break; - case TCKind._tk_char : - case TCKind._tk_wchar : - charV = _is.read_char(); - break; - case TCKind._tk_octet : - byteV = _is.read_byte(); - break; - case TCKind._tk_string : - case TCKind._tk_wstring : - stringV = _is.read_string(); - break; - case TCKind._tk_atom : - stringV = _is.read_atom(); - break; - case TCKind._tk_void : - _is.read_atom(); - break; - - /* - * Not supported types - */ - case TCKind._tk_any : - case TCKind._tk_null : - case TCKind._tk_TypeCode : - case TCKind._tk_Principal : - case TCKind._tk_objref : - case TCKind._tk_alias : - case TCKind._tk_except : - case TCKind._tk_longdouble : - case TCKind._tk_fixed : - throw new java.lang.Exception("Unsupported type"); - - default: // User defined type - - if (os == null) - os = new com.ericsson.otp.erlang.OtpOutputStream(); - else - os.reset(); - - try { - read_user_defined(_is, _tc); - is = new com.ericsson.otp.erlang.OtpInputStream(os.toByteArray()); - } catch (Exception e) { - throw new java.lang.Exception("BAD VALUE"); - } - } - - } - - void read_user_defined(com.ericsson.otp.erlang.OtpInputStream _is, TypeCode _tc) - throws java.lang.Exception { - - TypeCode memberTC = null; - int len = -1; - int __tag; - - switch(_tc.kind().value()) { - - case TCKind._tk_short : - os.write_short(_is.read_short()); - break; - case TCKind._tk_ushort : - os.write_ushort(_is.read_ushort()); - break; - case TCKind._tk_long : - os.write_int(_is.read_int()); - break; - case TCKind._tk_longlong : - os.write_long(_is.read_long()); - break; - case TCKind._tk_ulong : - os.write_uint(_is.read_uint()); - break; - case TCKind._tk_ulonglong : - os.write_ulong(_is.read_ulong()); - break; - case TCKind._tk_float : - os.write_float(_is.read_float()); - break; - case TCKind._tk_double : - os.write_double(_is.read_double()); - break; - case TCKind._tk_boolean : - os.write_boolean(_is.read_boolean()); - break; - case TCKind._tk_char : - case TCKind._tk_wchar : - os.write_char(_is.read_char()); - break; - case TCKind._tk_octet : - os.write_byte(_is.read_byte()); - break; - case TCKind._tk_string : - case TCKind._tk_wstring : - os.write_string(_is.read_string()); - break; - - case TCKind._tk_struct: - len = _is.read_tuple_head(); - os.write_tuple_head(len); - os.write_atom(_is.read_atom()); - // Member list - len -=1; - for(int i=0; iInstead for write,read methods, the methods marshal respective -unmarshal are used to denote the implementation difference. - -**/ - - -public class AnyHelper { - - // Constructors - private AnyHelper() {} - - // Methods - /** - Marshal method for the Any class, encodes the Any object to the output stream. - **/ - public static void marshal(com.ericsson.otp.erlang.OtpOutputStream _out, Any _any) - throws java.lang.Exception { - - TypeCode _tc = _any.type(); - - _out.write_tuple_head(3); - _out.write_atom("any"); - - TypeCode.marshal(_out, _tc); - _any.write_value(_out); - - } - - /** - Unmarshal method for the Any class, decodes an Any object from the stream. - @return Any, read from the input stream - **/ - public static Any unmarshal(com.ericsson.otp.erlang.OtpInputStream _in) - throws java.lang.Exception { - - Any _value; - TypeCode _tc; - - _in.read_tuple_head(); - - if ((_in.read_atom()).compareTo("any") != 0) - throw new java.lang.Exception(""); - - _tc = TypeCode.unmarshal(_in); - _value = new Any(); - _value.read_value(_in,_tc); - - return _value; - } - -} - - - diff --git a/lib/ic/java_src/com/ericsson/otp/ic/AnyHolder.java b/lib/ic/java_src/com/ericsson/otp/ic/AnyHolder.java deleted file mode 100644 index e22876f51e..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/AnyHolder.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -package com.ericsson.otp.ic; - -/** - -Holder class for Any, according to OMG-IDL java mapping. -

Instead for _write,_read methods, the methods _marshal respective -_unmarshal are used to denote the implementation difference. - -**/ - -final public class AnyHolder { - - // Instance variables - public Any value; - - // Constructors - public AnyHolder() {} - - public AnyHolder(Any initial) { - value = initial; - } - - // Methods - /** - Marshal method for the Any class, encodes the Any object to the output stream. - **/ - public void _marshal(com.ericsson.otp.erlang.OtpOutputStream out) - throws java.lang.Exception { - AnyHelper.marshal(out, value); - } - - /** - Unmarshal method for the Any class, decodes an Any object from the stream and - assigns it to the Holder value. - **/ - public void _unmarshal(com.ericsson.otp.erlang.OtpInputStream in) - throws java.lang.Exception { - value = AnyHelper.unmarshal(in); - } - -} diff --git a/lib/ic/java_src/com/ericsson/otp/ic/BooleanHolder.java b/lib/ic/java_src/com/ericsson/otp/ic/BooleanHolder.java deleted file mode 100644 index b71da196de..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/BooleanHolder.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -/** - * A Holder class for IDL's out/inout argument passing modes for boolean - * - */ -package com.ericsson.otp.ic; - -/** - -Holder class for Boolean, according to OMG-IDL java mapping. - -**/ - - -final public class BooleanHolder implements Holder { - public boolean value; - - public BooleanHolder() {} - - public BooleanHolder(boolean initial) { - value = initial; - } - - /* Extra methods not in standard. */ - /** - Comparisson method for Booleans. - @return true if the input object equals the current object, false otherwize - **/ - public boolean equals( Object obj ) { - if( obj instanceof Boolean ) - return ( value == ((Boolean)obj).booleanValue()); - else - return false; - } - - /** - Comparisson method for Booleans. - @return true if the input boolean value equals the value of the current object, false otherwize - **/ - public boolean equals( boolean b ) { - return ( value == b ); - } - -} diff --git a/lib/ic/java_src/com/ericsson/otp/ic/ByteHolder.java b/lib/ic/java_src/com/ericsson/otp/ic/ByteHolder.java deleted file mode 100644 index 7c79e8f90d..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/ByteHolder.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -/** - * A Holder class for IDL's out/inout argument passing modes for byte - * - */ -package com.ericsson.otp.ic; - -/** - -Holder class for Byte, according to OMG-IDL java mapping. - -**/ - -final public class ByteHolder implements Holder { - public byte value; - - public ByteHolder() {} - - public ByteHolder(byte initial) { - value = initial; - } - - /* Extra methods not in standard. */ - /** - Comparisson method for Bytes. - @return true if the input object equals the current object, false otherwize - **/ - public boolean equals( Object obj ) { - if( obj instanceof Byte ) - return ( value == ((Byte)obj).byteValue()); - else - return false; - } - - /** - Comparisson method for Byte. - @return true if the input boolean value equals the value of the current object, false otherwize - **/ - public boolean equals( byte b ) { - return ( value == b); - } - -} diff --git a/lib/ic/java_src/com/ericsson/otp/ic/CharHolder.java b/lib/ic/java_src/com/ericsson/otp/ic/CharHolder.java deleted file mode 100644 index 81d8c6ac73..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/CharHolder.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -/** - * A Holder class for IDL's out/inout argument passing modes for char - * - */ -package com.ericsson.otp.ic; - - -/** - -Holder class for Char, according to OMG-IDL java mapping. - -**/ - - -final public class CharHolder implements Holder { - public char value; - - public CharHolder() {} - - public CharHolder(char initial) { - value = initial; - } - - /* Extra methods not in standard. */ - /** - Comparisson method for Chars. - @return true if the input object equals the current object, false otherwize - **/ - public boolean equals( Object obj ) { - if( obj instanceof Character ) - return ( value == ((Character)obj).charValue()); - else - return false; - } - - /** - Comparisson method for Chars. - @return true if the input char value equals the value of the current object, false otherwize - **/ - public boolean equals( char c ) { - return ( value == c); - } - -} diff --git a/lib/ic/java_src/com/ericsson/otp/ic/DoubleHolder.java b/lib/ic/java_src/com/ericsson/otp/ic/DoubleHolder.java deleted file mode 100644 index 6daaa25aa8..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/DoubleHolder.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -/** - * A Holder class for IDL's out/inout argument passing modes for double - * - */ -package com.ericsson.otp.ic; - -/** - -Holder class for Double, according to OMG-IDL java mapping. - -**/ - -final public class DoubleHolder implements Holder { - public double value; - - public DoubleHolder() {} - - public DoubleHolder(double initial) { - value = initial; - } - - /* Extra methods not in standard. */ - /** - Comparisson method for Doubles. - @return true if the input object equals the current object, false otherwize - **/ - public boolean equals( Object obj ) { - if( obj instanceof Double ) - return ( value == ((Double)obj).doubleValue()); - else - return false; - } - - /** - Comparisson method for Doubles. - @return true if the input double value equals the value of the current object, false otherwize - **/ - public boolean equals( double d ) { - return ( value == d); - } - -} diff --git a/lib/ic/java_src/com/ericsson/otp/ic/Environment.java b/lib/ic/java_src/com/ericsson/otp/ic/Environment.java deleted file mode 100644 index bffa0e27e6..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/Environment.java +++ /dev/null @@ -1,480 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -/** - * The Environment class for Java IDL - * - */ -package com.ericsson.otp.ic; - -/** - - The Environment class handles communication - setup and stub state. The methods of this class - are specially designed for the generated stubs. - This class must be used when designing asynchronous - message passing. - - **/ - - -public class Environment { - - // Private variables - private com.ericsson.otp.erlang.OtpSelf self; - private com.ericsson.otp.erlang.OtpPeer peer; - private java.lang.Object server; - private java.lang.String cookie; - private com.ericsson.otp.erlang.OtpConnection connection; - private com.ericsson.otp.erlang.OtpErlangRef send_ref; /* Client side send reference */ - private com.ericsson.otp.erlang.OtpErlangRef receive_ref; /* Client side received reference */ - private com.ericsson.otp.erlang.OtpErlangPid clientP; - private com.ericsson.otp.erlang.OtpErlangPid serverP; - private com.ericsson.otp.erlang.OtpOutputStream os; /* Output stream */ - private com.ericsson.otp.erlang.OtpInputStream is; /* Input stream */ - private boolean stopped; - - // Private variables used by server only - private int tag; - private java.lang.String operation; - private java.lang.String type; - private com.ericsson.otp.erlang.OtpErlangRef ref; /* Server side client reference */ - private com.ericsson.otp.erlang.OtpErlangPid caller; /* Server side client pid */ - - // Tags to distiguish client / server environments - private boolean clientT; - private boolean serverT; - - - /** - Client stub side constructor. - **/ - public Environment(com.ericsson.otp.erlang.OtpSelf _Self, - com.ericsson.otp.erlang.OtpPeer _Peer, - java.lang.Object _Server) throws java.lang.Exception { - - init(); - clientT = true; - self = _Self; - peer = _Peer; - server = _Server; - os = new com.ericsson.otp.erlang.OtpOutputStream(); - } - - - /** - Client stub side constructor. - **/ - public Environment(java.lang.String _SelfNode, - java.lang.String _PeerNode, - java.lang.String _Cookie, - java.lang.Object _Server) throws java.lang.Exception { - - init(); - clientT = true; - self = new com.ericsson.otp.erlang.OtpSelf(_SelfNode, _Cookie); - peer = new com.ericsson.otp.erlang.OtpPeer(_PeerNode); - cookie = _Cookie; - server = _Server; - os = new com.ericsson.otp.erlang.OtpOutputStream(); - } - - - /** - Client stub side constructor. - **/ - public Environment(com.ericsson.otp.erlang.OtpConnection _connection, - java.lang.Object _Server) throws java.lang.Exception { - - init(); - clientT = true; - self = _connection.self(); - peer = _connection.peer(); - connection = _connection; - server = _Server; - os = new com.ericsson.otp.erlang.OtpOutputStream(); - } - - - /** - Server skeleton side constructor. - **/ - public Environment() throws java.lang.Exception { - - init(); - serverT = true; - stopped = false; - os = new com.ericsson.otp.erlang.OtpOutputStream(); - - } - - - /* Communication toolbox */ - - /** - Client stub side connector. - **/ - public void connect() throws java.lang.Exception { - - if (connection == null) - connection = self.connect(peer); - - clientP = self.createPid(); /* This is not perfect */ - send_ref = self.createRef(); - - } - - /** - Reconnects a client by closing existing connection - and connecting. - **/ - public void reconnect() throws java.lang.Exception { - - if (connection.isConnected()) - connection.close(); - - connection = self.connect(peer); - - } - - /** - Closes the established connection. - **/ - public void disconnect() { - - connection.close(); - - } - - - /** - Client side message sender. - **/ - public void send() throws java.lang.Exception { - - if (server instanceof java.lang.String) - connection.sendBuf((java.lang.String)server, os); - else - connection.sendBuf((com.ericsson.otp.erlang.OtpErlangPid)server, os); - - } - - - /** - Client message receiver. - **/ - public void receive() throws java.lang.Exception { - - is = connection.receiveBuf(); - - if (clientT) { // If client, decode message reference too - is.read_tuple_head(); - receive_ref = is.read_ref(); - } - } - - - /** - Universal message receiver. - **/ - public void receive(com.ericsson.otp.erlang.OtpConnection _connection) throws java.lang.Exception { - - is = _connection.receiveBuf(); - - if (clientT) { // If client, decode message reference too - is.read_tuple_head(); - receive_ref = is.read_ref(); - } - } - - - /* Accessors */ - - /** - Server RegName/OtpErlangPid accessor. - Used to access the server Reg/Pid, which - initiated the connection. - @return java.lang.Object, the server for the active OtpConnection. - **/ - public java.lang.Object server() { - - return server; - - } - - /** - Caller identity accessor. Used by a server stub to access the - caller identity of the received message. - @return OtpErlangPid, the caller identity. - **/ - public com.ericsson.otp.erlang.OtpErlangPid caller_pid() { - - return clientP; - - } - - - /** - Received message reference accessor. Used by a server stub to access the - reference of the received message. - @return OtpErlangRef, the reference of the received message. - **/ - public com.ericsson.otp.erlang.OtpErlangRef received_ref() { - - return receive_ref; - - } - - - /* Encoders */ - - /** - Client Pid Encoder. Used by a server stub to encode the - enclosed client process identity. - **/ - public void write_client_pid() { - - os.write_pid(clientP.node(),clientP.id(),clientP.serial(),clientP.creation()); - - } - - /** - Client Ref Encoder. Used by a server stub to encode the - enclosed client message reference. - **/ - public void write_client_ref() { - - os.write_ref(send_ref.node(),send_ref.id(),send_ref.creation()); - - } - - - - /* Field access functions */ - - /** - Output Stream accessor. - @return OtpOutputStream, the enclosed output stream. - **/ - public com.ericsson.otp.erlang.OtpOutputStream getOs() { - return os; - } - - /** - Input Stream accessor. - @return OtpInputStream, the enclosed input stream. - **/ - public com.ericsson.otp.erlang.OtpInputStream getIs() { - return is; - } - - /** - Server skeleton side client (caller) pid accessor. - @return OtpErlangPid, the caller process identity. - **/ - public com.ericsson.otp.erlang.OtpErlangPid getScaller() { - return caller; - } - - /** - Server skeleton side client call reference accessor. - @return OtpErlangRef, the latest call message reference. - **/ - public com.ericsson.otp.erlang.OtpErlangRef getSref() { - return ref; - } - - - - /* Field modifiers */ - - - - /* Decoders */ - - /** - Decodes the message head from existing stream. - Assignes message data to private variables of the Environment Object. - **/ - public void uHead() throws java.lang.Exception { - uHead(is); - } - - /** - Decodes the message head and writes over input stream. - Assignes message data to private variables of the Environment Object. - **/ - public void uHead(com.ericsson.otp.erlang.OtpInputStream _is) throws java.lang.Exception { - - is = _is; - is.read_tuple_head(); - type = is.read_atom(); - - if (type.equals("$gen_call")) { // Call type operation - is.read_tuple_head(); - caller = is.read_pid(); - ref = is.read_ref(); - tag = is.peek(); - - switch (tag) { - case com.ericsson.otp.erlang.OtpExternal.atomTag: - case com.ericsson.otp.erlang.OtpExternal.atomUtf8Tag: - case com.ericsson.otp.erlang.OtpExternal.smallAtomUtf8Tag: - operation = is.read_atom(); - break; - default: - is.read_tuple_head(); - operation = is.read_atom(); - } - } else { // Cast type operation - tag = is.peek(); - switch (tag) { - case com.ericsson.otp.erlang.OtpExternal.atomTag: - case com.ericsson.otp.erlang.OtpExternal.atomUtf8Tag: - case com.ericsson.otp.erlang.OtpExternal.smallAtomUtf8Tag: - operation = is.read_atom(); - break; - default: - is.read_tuple_head(); - operation = is.read_atom(); - } - } - } - - /** - Operation label accessor. - @return int, the label hash value. - **/ - public int uLabel(java.util.Dictionary _operations) { - - java.lang.Integer __label = - (java.lang.Integer) _operations.get(operation); - - if(__label == null) - return -1; - - return __label.intValue(); - } - - - - /* Controllers */ - - /** - Operation controller. - @return boolean, true if the operation variable found in Environment class - is supported in the input operation dictionary, false otherwize. - **/ - public boolean validOp(java.util.Dictionary _operations) { - - if((_operations.get(operation)) == null) - return false; - - return true; - } - - - /** - Server stop request controller. - @return boolean, true if there is a client request for the server - to be stopped, false otherwize. - **/ - public boolean isStopped() { - return stopped; - }; - - - - /* Destroy functions */ - - /* - Creates and sends a stop message. - Called by client stub to terminate the server. - */ - public void client_stop_server() - throws java.lang.Exception { - - // Message header assembly - os.reset(); - os.write_tuple_head(2); - os.write_atom("$gen_cast"); - - os.write_atom("stop"); - - send(); - - } - - /* - Sets the stop flag for the server. - Called by server skeleton when stop message is received. - */ - public void server_stop_server() { - - // Note at server is dead ! - stopped = true; - } - - - /* Private methods */ - - /** - Private variable initialization. - **/ - public void init() { - - clientT = false; - serverT = false; - stopped = false; - self = null; - peer = null; - server = null; - cookie = null; - connection = null; - clientP = null; - serverP = null; - send_ref = null; - receive_ref = null; - os = null; - is = null; - - tag = -1; - operation = null; - type = null; - - }; - -} - - - - - - - - - - - - - - - - diff --git a/lib/ic/java_src/com/ericsson/otp/ic/FloatHolder.java b/lib/ic/java_src/com/ericsson/otp/ic/FloatHolder.java deleted file mode 100644 index c804973ad6..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/FloatHolder.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -/** - * A Holder class for IDL's out/inout argument passing modes for float - * - */ -package com.ericsson.otp.ic; - -/** - -Holder class for Float, according to OMG-IDL java mapping. - -**/ - - -final public class FloatHolder implements Holder { - public float value; - - public FloatHolder() {} - - public FloatHolder(float initial) { - value = initial; - } - - /* Extra methods not in standard. */ - /** - Comparisson method for Floats. - @return true if the input object equals the current object, false otherwize - **/ - public boolean equals( Object obj ) { - if( obj instanceof Float ) - return ( value == ((Float)obj).floatValue()); - else - return false; - } - - /** - Comparisson method for Floats. - @return true if the input float value equals the value of the current object, false otherwize - **/ - public boolean equals( float f ) { - return ( value == f); - } - -} diff --git a/lib/ic/java_src/com/ericsson/otp/ic/Holder.java b/lib/ic/java_src/com/ericsson/otp/ic/Holder.java deleted file mode 100644 index a2888539a9..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/Holder.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -/** - * Holder interface class. -*/ -package com.ericsson.otp.ic; -import java.io.Serializable; - -/** - Holder interface class. - **/ - -public interface Holder extends Serializable -{ - -} diff --git a/lib/ic/java_src/com/ericsson/otp/ic/IntHolder.java b/lib/ic/java_src/com/ericsson/otp/ic/IntHolder.java deleted file mode 100644 index 7327d03843..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/IntHolder.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -/** - * A Holder class for IDL's out/inout argument passing modes for long - * - */ -package com.ericsson.otp.ic; - -/** - -Holder class for Int, according to OMG-IDL java mapping. - -**/ - -final public class IntHolder implements Holder { - public int value; - - public IntHolder() {} - - public IntHolder(int initial) { - value = initial; - } - - /* Extra methods not in standard. */ - - /** - Comparisson method for Ints. - @return true if the input object equals the current object, false otherwize - **/ - public boolean equals( Object obj ) { - if( obj instanceof Integer ) - return ( value == ((Integer)obj).intValue()); - else - return false; - } - - /** - Comparisson method for Ints. - @return true if the input int value equals the value of the current object, false otherwize - **/ - public boolean equals( int i ) { - return ( value == i); - } - -} diff --git a/lib/ic/java_src/com/ericsson/otp/ic/LongHolder.java b/lib/ic/java_src/com/ericsson/otp/ic/LongHolder.java deleted file mode 100644 index 34af201b42..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/LongHolder.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -/** - * A Holder class for IDL's out/inout argument passing modes for long - * - */ -package com.ericsson.otp.ic; - -/** - -Holder class for Long, used by the Term class. - -**/ - -final public class LongHolder implements Holder { - public long value; - - public LongHolder() {} - - public LongHolder(long initial) { - value = initial; - } - - /** - Comparisson method for Longs. - @return true if the input object equals the current object, false otherwize - **/ - public boolean equals( Object obj ) { - if( obj instanceof Long ) - return ( value == ((Long)obj).longValue()); - else - return false; - } - - /** - Comparisson method for Longs. - @return true if the input long value equals the value of the current object, false otherwize - **/ - public boolean equals( long l ) { - return ( value == l); - } - -} diff --git a/lib/ic/java_src/com/ericsson/otp/ic/Makefile b/lib/ic/java_src/com/ericsson/otp/ic/Makefile deleted file mode 100644 index 21c38e54b5..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/Makefile +++ /dev/null @@ -1,122 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk - - -JAVA_DEST_ROOT = $(ERL_TOP)/lib/ic/priv/ -JAVA_SRC_ROOT = $(ERL_TOP)/lib/ic/java_src/ -JAVA_CLASS_SUBDIR = com/ericsson/otp/ic/ -JAVA_INCL_ROOT = $(ERL_TOP)/lib/jinterface/priv/ - -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include $(ERL_TOP)/lib/ic/vsn.mk -VSN=$(IC_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/ic-$(VSN) - -# -# JAVA macros -# -JAVA_CLASSES = \ - Holder \ - BooleanHolder \ - ByteHolder \ - CharHolder \ - DoubleHolder \ - FloatHolder \ - IntHolder \ - LongHolder \ - ShortHolder \ - StringHolder \ - Environment \ - Any \ - AnyHelper \ - AnyHolder \ - TypeCode \ - TCKind \ - Pid \ - PidHolder \ - PidHelper \ - Ref \ - RefHolder \ - RefHelper \ - Port \ - PortHolder \ - PortHelper \ - Term \ - TermHolder \ - TermHelper - -TARGET_FILES= $(JAVA_CLASSES:%=$(JAVA_DEST_ROOT)$(JAVA_CLASS_SUBDIR)%.class) -JAVA_FILES= $(JAVA_CLASSES:%=%.java) - -JARFILE= ic.jar - -# ---------------------------------------------------- -# Programs and Flags -# ---------------------------------------------------- -CLASSPATH = $(JAVA_SRC_ROOT):$(JAVA_INCL_ROOT) - -JAR= jar - -JAVADOCFLAGS=-d $(DOCDIR) -JAVAFLAGS=-d $(JAVA_DEST_ROOT) -JARFLAGS= -cf -ifneq ($(V),0) -JARFLAGS= -cfv -endif - -JAVA_OPTIONS = - -# ---------------------------------------------------- -# Make Rules -# ---------------------------------------------------- - -debug opt: $(JAVA_DEST_ROOT)$(JARFILE) - -$(JAVA_DEST_ROOT)$(JARFILE): $(TARGET_FILES) - @(cd $(JAVA_DEST_ROOT) ; $(JAR) $(JARFLAGS) $(JARFILE) $(JAVA_CLASS_SUBDIR)) - -clean: - rm -f $(TARGET_FILES) *~ - -docs: - -# ---------------------------------------------------- -# Release Targets -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)/java_src/com/ericsson/otp/ic" - $(INSTALL_DATA) $(JAVA_FILES) "$(RELSYSDIR)/java_src/com/ericsson/otp/ic" - $(INSTALL_DIR) "$(RELSYSDIR)/priv" - $(INSTALL_DATA) $(JAVA_DEST_ROOT)$(JARFILE) "$(RELSYSDIR)/priv" - -release_docs_spec: - diff --git a/lib/ic/java_src/com/ericsson/otp/ic/Pid.java b/lib/ic/java_src/com/ericsson/otp/ic/Pid.java deleted file mode 100644 index 0f26c32aef..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/Pid.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -package com.ericsson.otp.ic; - - -/** - -Pid class mapps the built-in erlang type pid, a process identity. - -**/ - - -final public class Pid extends com.ericsson.otp.erlang.OtpErlangPid { - - public Pid(com.ericsson.otp.erlang.OtpSelf self) { - super(self); - } - - public Pid(com.ericsson.otp.erlang.OtpInputStream buf) - throws com.ericsson.otp.erlang.OtpErlangDecodeException { - super(buf); - } - - - public Pid(String node, int id, int serial, int creation) { - super(node,id,serial,creation); - } - - - /** - Comparisson method for Pid. - @return true if the input Pid value equals the value of the current object, false otherwize - **/ - public boolean equal(Pid _pid) { - return super.equals(_pid); - } - -} diff --git a/lib/ic/java_src/com/ericsson/otp/ic/PidHelper.java b/lib/ic/java_src/com/ericsson/otp/ic/PidHelper.java deleted file mode 100644 index 4c51035738..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/PidHelper.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -package com.ericsson.otp.ic; - -/** - Helper class for Pid. - **/ - -public class PidHelper { - - // constructors - private PidHelper() {} - - // methods - /** - Marshal method for the Pid class, encodes the Pid object to the output stream. - **/ - public static void marshal(com.ericsson.otp.erlang.OtpOutputStream _out, Pid _value) - throws java.lang.Exception { - - _out.write_pid(_value.node(),_value.id(),_value.serial(),_value.creation()); - } - - /** - Unmarshal method for the Pid class, decodes a Pid object from the stream. - @return Pid, read from the input stream - **/ - public static Pid unmarshal(com.ericsson.otp.erlang.OtpInputStream _in) - throws java.lang.Exception { - - // Double job is done here, there should be - // a function returning a Pid instead of an - // OtpErlangPid - com.ericsson.otp.erlang.OtpErlangPid oep = _in.read_pid(); - - return new Pid(oep.node(),oep.id(),oep.serial(),oep.creation()); - } - - /** - Standard method that returns the interface repository identity. - @return String containing the interface repository identity of Pid - **/ - public static String id() { - return "IDL:com/ericsson/otp/ic/Pid:1.0"; - } - - /** - Standard method that returns the Pid class name. - @return String containing the class name of Pid - **/ - public static String name() { - return "Pid"; - } - - /** - Holds the TypeCode - **/ - private static com.ericsson.otp.ic.TypeCode _tc; - - /** - Standard TypeCode accessor method. - @return the TypeCode for Pid - **/ - synchronized public static com.ericsson.otp.ic.TypeCode type() { - - if (_tc != null) - return _tc; - - com.ericsson.otp.ic.TypeCode _tc0 = - new com.ericsson.otp.ic.TypeCode(); - _tc0.kind(com.ericsson.otp.ic.TCKind.tk_struct); - _tc0.id("IDL:com/ericsson/otp/ic/Pid:1.0"); - _tc0.name("Pid"); - _tc0.member_count(4); - _tc0.member_name(0,"node"); - com.ericsson.otp.ic.TypeCode _tc1 = - new com.ericsson.otp.ic.TypeCode(); - _tc1.kind(com.ericsson.otp.ic.TCKind.tk_string); - _tc1.length(256); - _tc0.member_type(0,_tc1); - _tc0.member_name(1,"num"); - com.ericsson.otp.ic.TypeCode _tc2 = - new com.ericsson.otp.ic.TypeCode(); - _tc2.kind(com.ericsson.otp.ic.TCKind.tk_ulong); - _tc0.member_type(1,_tc2); - _tc0.member_name(2,"serial"); - com.ericsson.otp.ic.TypeCode _tc3 = - new com.ericsson.otp.ic.TypeCode(); - _tc3.kind(com.ericsson.otp.ic.TCKind.tk_ulong); - _tc0.member_type(2,_tc3); - _tc0.member_name(3,"creation"); - com.ericsson.otp.ic.TypeCode _tc4 = - new com.ericsson.otp.ic.TypeCode(); - _tc4.kind(com.ericsson.otp.ic.TCKind.tk_ulong); - _tc0.member_type(3,_tc4); - - _tc = _tc0; - - return _tc0; - } - - - /** - Standard method for inserting a Pid to an Any. - **/ - public static void insert(com.ericsson.otp.ic.Any _any, Pid _this) - throws java.lang.Exception { - - com.ericsson.otp.erlang.OtpOutputStream _os = - new com.ericsson.otp.erlang.OtpOutputStream(); - - _any.type(type()); - marshal(_os, _this); - _any.insert_Streamable(_os); - } - - /** - Standard method for extracting a Pid from an Any. - @return Pid, the value found in an Any contained stream. - **/ - public static Pid extract(com.ericsson.otp.ic.Any _any) - throws java.lang.Exception { - - return unmarshal(_any.extract_Streamable()); - } - -} diff --git a/lib/ic/java_src/com/ericsson/otp/ic/PidHolder.java b/lib/ic/java_src/com/ericsson/otp/ic/PidHolder.java deleted file mode 100644 index f5dfd81576..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/PidHolder.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -package com.ericsson.otp.ic; - -/** - Holder class for Pid. - **/ - -final public class PidHolder { - - /** - Pid instance variable. - **/ - public Pid value; - - // constructors - public PidHolder() {} - public PidHolder(Pid initial) { - value = initial; - } - - // methods - /** - Marshal method for the PidHolder class, encodes the Pid object value to the output stream. - **/ - public void _marshal(com.ericsson.otp.erlang.OtpOutputStream out) throws java.lang.Exception { - PidHelper.marshal(out, value); - } - - /** - Unmarshal method for the PidHolder class, decodes a Pid object from the output stream - and assigns it to the Holder value field. - **/ - public void _unmarshal(com.ericsson.otp.erlang.OtpInputStream in) throws java.lang.Exception { - value = PidHelper.unmarshal(in); - } -} diff --git a/lib/ic/java_src/com/ericsson/otp/ic/Port.java b/lib/ic/java_src/com/ericsson/otp/ic/Port.java deleted file mode 100644 index 34edbea362..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/Port.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -package com.ericsson.otp.ic; - -/** - -Port class mapps the built-in erlang type port, a process port. - -**/ - -final public class Port extends com.ericsson.otp.erlang.OtpErlangPort { - - public Port(com.ericsson.otp.erlang.OtpInputStream buf) - throws com.ericsson.otp.erlang.OtpErlangDecodeException { - super(buf); - } - - public Port(String node, int id, int creation) { - super(node,id,creation); - } - - /** - Comparisson method for Port. - @return true if the input Port value equals the value of the current object, false otherwize - **/ - public boolean equal(Port _port) { - return super.equals(_port); - } - - -} diff --git a/lib/ic/java_src/com/ericsson/otp/ic/PortHelper.java b/lib/ic/java_src/com/ericsson/otp/ic/PortHelper.java deleted file mode 100644 index 3e74758739..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/PortHelper.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -package com.ericsson.otp.ic; - -/** - Helper class for Port. - **/ - -public class PortHelper { - - // constructors - private PortHelper() {} - - // methods - - /** - Marshal method for the Port class, encodes the Port object to the output stream. - **/ - public static void marshal(com.ericsson.otp.erlang.OtpOutputStream _out, Port _value) - throws java.lang.Exception { - - _out.write_port(_value.node(),_value.id(),_value.creation()); - } - - /** - Unmarshal method for the Port class, decodes a Port object from the stream. - @return Port, read from the input stream - **/ - public static Port unmarshal(com.ericsson.otp.erlang.OtpInputStream _in) - throws java.lang.Exception { - - // Double job is done here, there should be - // a function returning a Port instead of an - // OtpErlangPort - com.ericsson.otp.erlang.OtpErlangPort oep = _in.read_port(); - - return new Port(oep.node(),oep.id(),oep.creation()); - } - - /** - Standard method that returns the interface repository identity. - @return String containing the interface repository identity of Port - **/ - public static String id() { - return "IDL:com/ericsson/otp/ic/Port:1.0"; - } - - /** - Standard method that returns the Port class name. - @return String containing the class name of Port - **/ - public static String name() { - return "Port"; - } - - /** - Holds the TypeCode - **/ - private static com.ericsson.otp.ic.TypeCode _tc; - - /** - Standard TypeCode accessor method. - @return the TypeCode for Port - **/ - synchronized public static com.ericsson.otp.ic.TypeCode type() { - - if (_tc != null) - return _tc; - - com.ericsson.otp.ic.TypeCode _tc0 = - new com.ericsson.otp.ic.TypeCode(); - _tc0.kind(com.ericsson.otp.ic.TCKind.tk_struct); - _tc0.id("IDL:com/ericsson/otp/ic/Port:1.0"); - _tc0.name("Port"); - _tc0.member_count(3); - _tc0.member_name(0,"node"); - com.ericsson.otp.ic.TypeCode _tc1 = - new com.ericsson.otp.ic.TypeCode(); - _tc1.kind(com.ericsson.otp.ic.TCKind.tk_string); - _tc1.length(256); - _tc0.member_type(0,_tc1); - _tc0.member_name(1,"id"); - com.ericsson.otp.ic.TypeCode _tc2 = - new com.ericsson.otp.ic.TypeCode(); - _tc2.kind(com.ericsson.otp.ic.TCKind.tk_ulong); - _tc0.member_type(1,_tc2); - _tc0.member_name(2,"creation"); - com.ericsson.otp.ic.TypeCode _tc3 = - new com.ericsson.otp.ic.TypeCode(); - _tc3.kind(com.ericsson.otp.ic.TCKind.tk_ulong); - _tc0.member_type(2,_tc3); - - _tc = _tc0; - - return _tc0; - } - - - /** - Standard method for inserting a Port to an Any. - **/ - public static void insert(com.ericsson.otp.ic.Any _any, Port _this) - throws java.lang.Exception { - - com.ericsson.otp.erlang.OtpOutputStream _os = - new com.ericsson.otp.erlang.OtpOutputStream(); - - _any.type(type()); - marshal(_os, _this); - _any.insert_Streamable(_os); - } - - /** - Standard method for extracting a Port from an Any. - @return Port, the value found in an Any contained stream. - **/ - public static Port extract(com.ericsson.otp.ic.Any _any) - throws java.lang.Exception { - - return unmarshal(_any.extract_Streamable()); - } - -} diff --git a/lib/ic/java_src/com/ericsson/otp/ic/PortHolder.java b/lib/ic/java_src/com/ericsson/otp/ic/PortHolder.java deleted file mode 100644 index da0df3bbc7..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/PortHolder.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -package com.ericsson.otp.ic; - -/** - Holder class for Port. - **/ - -final public class PortHolder { - - /** - Port instance variable. - **/ - public Port value; - - // constructors - public PortHolder() {} - public PortHolder(Port initial) { - value = initial; - } - - // methods - /** - Marshal method for the PortHolder class, encodes the Port object value to the output stream. - **/ - public void _marshal(com.ericsson.otp.erlang.OtpOutputStream out) - throws java.lang.Exception { - PortHelper.marshal(out, value); - } - - /** - Unmarshal method for the PortHolder class, decodes a Port object from the output stream - and assigns it to the Holder value field. - **/ - public void _unmarshal(com.ericsson.otp.erlang.OtpInputStream in) - throws java.lang.Exception { - value = PortHelper.unmarshal(in); - } -} diff --git a/lib/ic/java_src/com/ericsson/otp/ic/Ref.java b/lib/ic/java_src/com/ericsson/otp/ic/Ref.java deleted file mode 100644 index a55da87d0d..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/Ref.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -package com.ericsson.otp.ic; - -/** - -Ref class mapps the built-in erlang type Ref, a message reference. - -**/ - -final public class Ref extends com.ericsson.otp.erlang.OtpErlangRef { - - public Ref(com.ericsson.otp.erlang.OtpSelf self) { - super(self); - } - - - public Ref(com.ericsson.otp.erlang.OtpInputStream buf) - throws com.ericsson.otp.erlang.OtpErlangDecodeException { - super(buf); - } - - /** - Old style Ref costructor. Costructs an Ref that coresponds to the - old erlang Ref type. - **/ - public Ref(String node, int id, int creation) { - super(node,id,creation); - } - - public Ref(String node, int[] ids, int creation) { - super(node,ids,creation); - } - - /** - Comparisson method for Ref. - @return true if the input Ref value equals the value of the current object, false otherwize - **/ - public boolean equal(Ref _ref) { - return super.equals(_ref); - } - -} diff --git a/lib/ic/java_src/com/ericsson/otp/ic/RefHelper.java b/lib/ic/java_src/com/ericsson/otp/ic/RefHelper.java deleted file mode 100644 index cb145bbbb2..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/RefHelper.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -package com.ericsson.otp.ic; - -/** - Helper class for Ref. - **/ - -public class RefHelper { - - // constructors - private RefHelper() {} - - // methods - /** - Marshal method for the Ref class, encodes the Ref object to the output stream. - **/ - public static void marshal(com.ericsson.otp.erlang.OtpOutputStream _out, Ref _value) - throws java.lang.Exception { - - _out.write_ref(_value.node(),_value.id(),_value.creation()); - } - - /** - Unmarshal method for the Ref class, decodes a Ref object from the stream. - @return Ref, read from the input stream - **/ - public static Ref unmarshal(com.ericsson.otp.erlang.OtpInputStream _in) - throws java.lang.Exception { - - // Double job is done here, there should be - // a function returning a Ref instead of an - // OtpErlangRef - com.ericsson.otp.erlang.OtpErlangRef oer = _in.read_ref(); - - if (oer.isNewRef()) - return new Ref(oer.node(),oer.ids(),oer.creation()); - else - return new Ref(oer.node(),oer.id(),oer.creation()); - } - - /** - Standard method that returns the interface repository identity. - @return String containing the interface repository identity of Ref - **/ - public static String id() { - return "IDL:com/ericsson/otp/ic/Ref:1.0"; - } - - /** - Standard method that returns the Ref class name. - @return String containing the class name of Ref - **/ - public static String name() { - return "Ref"; - } - - /** - Holds the TypeCode - **/ - private static com.ericsson.otp.ic.TypeCode _tc; - - /** - Standard TypeCode accessor method. - @return the TypeCode for Ref - **/ - synchronized public static com.ericsson.otp.ic.TypeCode type() { - - if (_tc != null) - return _tc; - - com.ericsson.otp.ic.TypeCode _tc0 = - new com.ericsson.otp.ic.TypeCode(); - _tc0.kind(com.ericsson.otp.ic.TCKind.tk_struct); - _tc0.id("IDL:com/ericsson/otp/ic/Ref:1.0"); - _tc0.name("Ref"); - _tc0.member_count(3); - _tc0.member_name(0,"node"); - com.ericsson.otp.ic.TypeCode _tc1 = - new com.ericsson.otp.ic.TypeCode(); - _tc1.kind(com.ericsson.otp.ic.TCKind.tk_string); - _tc1.length(256); - _tc0.member_type(0,_tc1); - _tc0.member_name(1,"id"); - com.ericsson.otp.ic.TypeCode _tc2 = - new com.ericsson.otp.ic.TypeCode(); - _tc2.kind(com.ericsson.otp.ic.TCKind.tk_ulong); - _tc0.member_type(1,_tc2); - _tc0.member_name(2,"creation"); - com.ericsson.otp.ic.TypeCode _tc3 = - new com.ericsson.otp.ic.TypeCode(); - _tc3.kind(com.ericsson.otp.ic.TCKind.tk_ulong); - _tc0.member_type(2,_tc3); - - _tc = _tc0; - - return _tc0; - } - - /** - Standard method for inserting a Ref to an Any. - **/ - public static void insert(com.ericsson.otp.ic.Any _any, Ref _this) - throws java.lang.Exception { - - com.ericsson.otp.erlang.OtpOutputStream _os = - new com.ericsson.otp.erlang.OtpOutputStream(); - - _any.type(type()); - marshal(_os, _this); - _any.insert_Streamable(_os); - } - - /** - Standard method for extracting a Ref from an Any. - @return Ref, the value found in an Any contained stream. - **/ - public static Ref extract(com.ericsson.otp.ic.Any _any) - throws java.lang.Exception { - - return unmarshal(_any.extract_Streamable()); - } - -} diff --git a/lib/ic/java_src/com/ericsson/otp/ic/RefHolder.java b/lib/ic/java_src/com/ericsson/otp/ic/RefHolder.java deleted file mode 100644 index 9ef2eacea1..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/RefHolder.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -package com.ericsson.otp.ic; - -/** - Holder class for Ref. - **/ - -final public class RefHolder { - - /** - Ref instance variable. - **/ - public Ref value; - - // constructors - public RefHolder() {} - public RefHolder(Ref initial) { - value = initial; - } - - // methods - /** - Marshal method for the RefHolder class, encodes the Ref object value to the output stream. - **/ - public void _marshal(com.ericsson.otp.erlang.OtpOutputStream out) throws java.lang.Exception { - RefHelper.marshal(out, value); - } - - /** - Unmarshal method for the RefHolder class, decodes a Ref object from the output stream - and assigns it to the Holder value field. - **/ - public void _unmarshal(com.ericsson.otp.erlang.OtpInputStream in) throws java.lang.Exception { - value = RefHelper.unmarshal(in); - } -} diff --git a/lib/ic/java_src/com/ericsson/otp/ic/ShortHolder.java b/lib/ic/java_src/com/ericsson/otp/ic/ShortHolder.java deleted file mode 100644 index 3b191dd633..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/ShortHolder.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -/** - * A Holder class for IDL's out/inout argument passing modes for long - * - */ -package com.ericsson.otp.ic; - -/** - -Holder class for Short, according to OMG-IDL java mapping. - -**/ - -final public class ShortHolder implements Holder { - public short value; - - public ShortHolder() {} - - public ShortHolder(short initial) { - value = initial; - } - - /* Extra methods not in standard. */ - /** - Comparisson method for Shorts. - @return true if the input object equals the current object, false otherwize - **/ - public boolean equals( Object obj ) { - if( obj instanceof Short ) - return ( value == ((Short)obj).shortValue()); - else - return false; - } - - /** - Comparisson method for Shorts. - @return true if the input short value equals the value of the current object, false otherwize - **/ - public boolean equals( short s ) { - return ( value == s); - } - -} diff --git a/lib/ic/java_src/com/ericsson/otp/ic/StringHolder.java b/lib/ic/java_src/com/ericsson/otp/ic/StringHolder.java deleted file mode 100644 index f4cd069148..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/StringHolder.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -/** - * A Holder class for IDL's out/inout argument passing modes for string - * - */ -package com.ericsson.otp.ic; - - -/** - -Holder class for String, according to OMG-IDL java mapping. - -**/ - -final public class StringHolder implements Holder { - public String value; - - public StringHolder() {} - - public StringHolder(String initial) { - value = initial; - } - - /* Extra methods not in standard. */ - /** - Comparisson method for Strings. - @return true if the input object equals the current object, false otherwize - **/ - public boolean equals( Object obj ) { - if( obj instanceof String ) - return ( value == obj); - else - return false; - } - - /** - Comparisson method for Strings. - @return true if the input String value equals the value of the current object, false otherwize - **/ - public boolean equals( String s ) { - return ( value == s); - } - -} diff --git a/lib/ic/java_src/com/ericsson/otp/ic/TCKind.java b/lib/ic/java_src/com/ericsson/otp/ic/TCKind.java deleted file mode 100644 index e6265ae586..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/TCKind.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -/** - * The TCKind class for Java IDL - * - */ -package com.ericsson.otp.ic; - -/** - The TCKind class is the implementation of the OMG-IDL enumerant type TCKind. - **/ - -final public class TCKind { - - // instance variables - public static final int _tk_null = 0, - _tk_void = 1, - _tk_short = 2, - _tk_long = 3, - _tk_ushort = 4, - _tk_ulong = 5, - _tk_float = 6, - _tk_double = 7, - _tk_boolean = 8, - _tk_char = 9, - _tk_octet = 10, - _tk_any = 11, - _tk_TypeCode = 12, - _tk_Principal = 13, - _tk_objref = 14, - _tk_struct = 15, - _tk_union = 16, - _tk_enum = 17, - _tk_string = 18, - _tk_sequence = 19, - _tk_array = 20, - _tk_alias = 21, - _tk_except = 22, - _tk_longlong = 23, - _tk_ulonglong = 24, - _tk_longdouble = 25, - _tk_wchar = 26, - _tk_wstring = 27, - _tk_fixed = 28, - _tk_atom = 20000, /* Used for union label default value only */ - _tk_pid = 20001, /* Used for special pid struct */ - _tk_port = 20002, /* Used for special port struct */ - _tk_ref = 20003, /* Used for special ref struct */ - _tk_term = 20004; /* Used for special term struct */ - - public static final TCKind tk_null = new TCKind(_tk_null); - public static final TCKind tk_void = new TCKind(_tk_void); - public static final TCKind tk_short = new TCKind(_tk_short); - public static final TCKind tk_long = new TCKind(_tk_long); - public static final TCKind tk_ushort = new TCKind(_tk_ushort); - public static final TCKind tk_ulong = new TCKind(_tk_ulong); - public static final TCKind tk_float = new TCKind(_tk_float); - public static final TCKind tk_double = new TCKind(_tk_double); - public static final TCKind tk_boolean = new TCKind(_tk_boolean); - public static final TCKind tk_char = new TCKind(_tk_char); - public static final TCKind tk_octet = new TCKind(_tk_octet); - public static final TCKind tk_any = new TCKind(_tk_any); - public static final TCKind tk_TypeCode = new TCKind(_tk_TypeCode); - public static final TCKind tk_Principal = new TCKind(_tk_Principal); - public static final TCKind tk_objref = new TCKind(_tk_objref); - public static final TCKind tk_struct = new TCKind(_tk_struct); - public static final TCKind tk_union = new TCKind(_tk_union); - public static final TCKind tk_enum = new TCKind(_tk_enum); - public static final TCKind tk_string = new TCKind(_tk_string); - public static final TCKind tk_sequence = new TCKind(_tk_sequence); - public static final TCKind tk_array = new TCKind(_tk_array); - public static final TCKind tk_alias = new TCKind(_tk_alias); - public static final TCKind tk_except = new TCKind(_tk_except); - public static final TCKind tk_longlong = new TCKind(_tk_longlong); - public static final TCKind tk_ulonglong = new TCKind(_tk_ulonglong); - public static final TCKind tk_longdouble = new TCKind(_tk_longdouble); - public static final TCKind tk_wchar = new TCKind(_tk_wchar); - public static final TCKind tk_wstring = new TCKind(_tk_wstring); - public static final TCKind tk_fixed = new TCKind(_tk_fixed); - protected static final TCKind tk_atom = new TCKind(_tk_atom); - protected static final TCKind tk_pid = new TCKind(_tk_pid); - protected static final TCKind tk_port = new TCKind(_tk_port); - protected static final TCKind tk_ref = new TCKind(_tk_ref); - protected static final TCKind tk_term = new TCKind(_tk_term); - private int _value; - - // constructors - private TCKind(int __value) { - _value = __value; - } - - // methods - - /** - Accessor method for the value of TCKind. - @return int, the value of TCKind object - **/ - public int value() { - return _value; - } - - /** - Translator method for TCKind. - Traslates the input integer value to a TCKind enumerant object. - @return TCKind, a TCKind object - **/ - public static final TCKind from_int(int __value) throws java.lang.Exception { - switch (__value) { - case _tk_null: - return tk_null; - case _tk_void: - return tk_void; - case _tk_short: - return tk_short; - case _tk_long: - return tk_long; - case _tk_ushort: - return tk_ushort; - case _tk_ulong: - return tk_ulong; - case _tk_float: - return tk_float; - case _tk_double: - return tk_double; - case _tk_boolean: - return tk_boolean; - case _tk_char: - return tk_char; - case _tk_octet: - return tk_octet; - case _tk_any: - return tk_any; - case _tk_TypeCode: - return tk_TypeCode; - case _tk_Principal: - return tk_Principal; - case _tk_objref: - return tk_objref; - case _tk_struct: - return tk_struct; - case _tk_union: - return tk_union; - case _tk_enum: - return tk_enum; - case _tk_string: - return tk_string; - case _tk_sequence: - return tk_sequence; - case _tk_array: - return tk_array; - case _tk_alias: - return tk_alias; - case _tk_except: - return tk_except; - case _tk_longlong: - return tk_longlong; - case _tk_ulonglong: - return tk_ulonglong; - case _tk_longdouble: - return tk_longdouble; - case _tk_wchar: - return tk_wchar; - case _tk_wstring: - return tk_wstring; - case _tk_fixed: - return tk_fixed; - case _tk_atom: - return tk_atom; - case _tk_pid: - return tk_pid; - case _tk_port: - return tk_port; - case _tk_ref: - return tk_ref; - case _tk_term: - return tk_term; - default: - throw new java.lang.Exception(""); - } - } - -} diff --git a/lib/ic/java_src/com/ericsson/otp/ic/Term.java b/lib/ic/java_src/com/ericsson/otp/ic/Term.java deleted file mode 100644 index 7a27905fcd..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/Term.java +++ /dev/null @@ -1,1113 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -package com.ericsson.otp.ic; - -/** - -The Term class is intended to represent the erlang term generic type. -It extends the Any class and is basically used the same way as the Any class. -

The main difference between Term and Any is the use of guard methods -instead for TypeCode to determine the data included in the Term. -This actual when cannot determine a Term's value class returned at compile time. - -**/ - -final public class Term extends Any { - - // Primitive value holder - protected java.lang.String atomV; - protected long longV; - protected Pid PidV; - protected Ref RefV; - protected Port PortV; - protected com.ericsson.otp.erlang.OtpErlangObject ObjV; - protected int tag; - - /** - Tag accessor method - @return int, the tag of the Object that denotes the erlang external format tag - **/ - public int tag() { - return tag; - } - - /* Guards */ - - /** - Guard method - @return true if the Term is an OtpErlangAtom, false otherwize - **/ - public boolean isAtom() { - - if (ObjV == null) { - if (tag == com.ericsson.otp.erlang.OtpExternal.atomTag || - tag == com.ericsson.otp.erlang.OtpExternal.atomUtf8Tag || - tag == com.ericsson.otp.erlang.OtpExternal.smallAtomUtf8Tag) - - return true; - - return false; - } - - return (ObjV instanceof com.ericsson.otp.erlang.OtpErlangAtom) ; - } - - /** - Guard method - @return true if the Term is not an OtpErlangList nor an OtpErlangTuple, false otherwize - **/ - public boolean isConstant() { - if (isList()) - return false; - - if (isTuple()) - return false; - - return true; - } - - /** - Guard method - @return true if the Term is an OtpErlangFloat, false otherwize - **/ - public boolean isFloat() { - if (tag == com.ericsson.otp.erlang.OtpExternal.floatTag) - return true; - - return false; - } - - /** - Guard method - @return true if the Term is an OtpErlangInt, false otherwize - **/ - public boolean isInteger() { - switch(tag) { - case com.ericsson.otp.erlang.OtpExternal.smallIntTag: - case com.ericsson.otp.erlang.OtpExternal.intTag: - case com.ericsson.otp.erlang.OtpExternal.smallBigTag: - return true; - default: - return false; - } - } - - /** - Guard method - @return true if the Term is an OtpErlangList, false otherwize - **/ - public boolean isList() { - - if (ObjV == null) { - switch(tag) { - case com.ericsson.otp.erlang.OtpExternal.listTag: - case com.ericsson.otp.erlang.OtpExternal.stringTag: - case com.ericsson.otp.erlang.OtpExternal.nilTag: - return true; - default: - return false; - } - } - - if (ObjV instanceof com.ericsson.otp.erlang.OtpErlangList) - return true; - - if (ObjV instanceof com.ericsson.otp.erlang.OtpErlangString) - return true; - - return false; - } - - - /** - Guard method - @return true if the Term is an OtpErlangString, false otherwize - **/ - public boolean isString() { - - if (ObjV == null) { - switch(tag) { - case com.ericsson.otp.erlang.OtpExternal.stringTag: - case com.ericsson.otp.erlang.OtpExternal.nilTag: - return true; - default: - try { - stringV = extract_string(); - return true; - } catch (Exception e) { - return false; - } - } - } - - if (ObjV instanceof com.ericsson.otp.erlang.OtpErlangString) - return true; - - try { - stringV = extract_string(); - return true; - } catch (Exception e) { - return false; - } - } - - /** - Guard method - @return true if the Term is an OtpErlangInteger or an OtpErlangFloat, false otherwize - **/ - public boolean isNumber() { - switch(tag) { - case com.ericsson.otp.erlang.OtpExternal.smallIntTag: - case com.ericsson.otp.erlang.OtpExternal.intTag: - case com.ericsson.otp.erlang.OtpExternal.smallBigTag: - case com.ericsson.otp.erlang.OtpExternal.floatTag: - return true; - default : - return false; - } - } - - - /** - Guard method - @return true if the Term is an OtpErlangPid or Pid, false otherwize - **/ - public boolean isPid() { - - if (ObjV == null) { - if (tag == com.ericsson.otp.erlang.OtpExternal.pidTag) - return true; - - return false; - } - - return (ObjV instanceof com.ericsson.otp.erlang.OtpErlangPid) ; - } - - - /** - Guard method - @return true if the Term is an OtpErlangPort or Port, false otherwize - **/ - public boolean isPort() { - if (ObjV == null) { - if (tag == com.ericsson.otp.erlang.OtpExternal.portTag) - return true; - - return false; - } - - return (ObjV instanceof com.ericsson.otp.erlang.OtpErlangPort); - } - - - /** - Guard method - @return true if the Term is an OtpErlangRef, false otherwize - **/ - public boolean isReference() { - if (ObjV == null) { - switch(tag) { - case com.ericsson.otp.erlang.OtpExternal.refTag: - case com.ericsson.otp.erlang.OtpExternal.newRefTag: - return true; - default : - return false; - } - } - - return (ObjV instanceof com.ericsson.otp.erlang.OtpErlangRef) ; - } - - - /** - Guard method - @return true if the Term is an OtpErlangTuple, false otherwize - **/ - public boolean isTuple() { - if (ObjV == null) { - switch(tag) { - case com.ericsson.otp.erlang.OtpExternal.smallTupleTag: - case com.ericsson.otp.erlang.OtpExternal.largeTupleTag: - return true; - default : - return false; - } - } - - return (ObjV instanceof com.ericsson.otp.erlang.OtpErlangTuple); - } - - - /** - Guard method - @return true if the Term is an OtpErlangBinary, false otherwize - **/ - public boolean isBinary() { - if (ObjV == null) { - if (tag == com.ericsson.otp.erlang.OtpExternal.binTag) - return true; - - return false; - } - - return (ObjV instanceof com.ericsson.otp.erlang.OtpErlangBinary); - } - - - - - // Equal function - /** - Term comparison method - @return true if the input Term is equal to the object, false otherwize - **/ - public boolean equal(Term _any) { - - try { - - /* Pids */ - if ((PidV != null) && (_any.PidV != null)) - if (PidV.equal(_any.PidV)) - return true; - - /* Refs */ - if ((RefV != null) && (_any.RefV != null)) - if (RefV.equal(_any.RefV)) - return true; - - /* Ports */ - if ((PortV != null) && (_any.PortV != null)) - if (PortV.equals(_any.PortV)) - return true; - - /* strings */ - if ((stringV != null) && (_any.stringV != null)) - if (stringV.equals(_any.stringV)) - return true; - - /* atoms and booleans */ - if ((atomV != null) && (_any.atomV != null)) - if (atomV.equals(_any.atomV)) - return true; - - /* booleans */ - if (atomV != null) - if (_any.booleanV == Boolean.valueOf(atomV).booleanValue()) - return true; - - if (_any.atomV != null) - if (booleanV == Boolean.valueOf(_any.atomV).booleanValue()) - return true; - - /* integer types plus floating point types */ - double _ownNS = - longV+doubleV; - - double _othersNS = - _any.longV+_any.doubleV; - - if ((equal(_ownNS,_othersNS)) && - (!equal(_ownNS,0))) - return true; - - /* All together, 0 or false */ - if ((equal(_ownNS,_othersNS)) && - booleanV == _any.booleanV) - return true; - - - return false; - - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - - /** - Writes the value of Term to a stream - **/ - public void write_value(com.ericsson.otp.erlang.OtpOutputStream _os) - throws java.lang.Exception { - - if ((tcV == null) && (ObjV != null)) - _os.write_any(ObjV); // Type not generated by IC - - else { - - switch(tcV.kind().value()) { - - case TCKind._tk_octet : - case TCKind._tk_char : - case TCKind._tk_wchar : - case TCKind._tk_short : - case TCKind._tk_ushort : - case TCKind._tk_long : - case TCKind._tk_longlong : - case TCKind._tk_ulong : - case TCKind._tk_ulonglong : - _os.write_long(longV); - break; - - case TCKind._tk_float : - _os.write_double(doubleV); - break; - - case TCKind._tk_double : - _os.write_double(doubleV); - break; - - case TCKind._tk_boolean : - _os.write_boolean(booleanV); - break; - - case TCKind._tk_string : - case TCKind._tk_wstring : - _os.write_string(stringV); - break; - - case TCKind._tk_atom : - _os.write_atom(stringV); - break; - - case TCKind._tk_struct: - if (isPid()) - PidHelper.marshal(_os, PidV); - else { - if (isReference()) - RefHelper.marshal(_os, RefV); - else { - if (isPort()) - PortHelper.marshal(_os, PortV); - else - _os.write(os.toByteArray()); - } - } - break; - - case TCKind._tk_union: - case TCKind._tk_array: - case TCKind._tk_sequence: - case TCKind._tk_enum: - _os.write(os.toByteArray()); - break; - - case TCKind._tk_void : - _os.write_atom("ok"); - break; - - /* - * Not supported types - */ - default: - throw new java.lang.Exception("BAD KIND"); - } - } - } - - - - /* - * Insert and extract each primitive type - */ - - - /* short */ - - /** - Short value extractor method - @return short, the value of Term - **/ - public short extract_short() - throws java.lang.Exception { - - if (tcV == null) - return (short) longV; - - if (tcV.kind() == TCKind.tk_short) - return (short) longV; - - throw new java.lang.Exception(""); - } - - /** - Short value insertion method - **/ - public void insert_short(short s) { - longV = s; - tag = com.ericsson.otp.erlang.OtpExternal.intTag; - tcV = new TypeCode(TCKind.tk_short); - }; - - /** - Short value insertion method - **/ - public void insert_short(long l) { - longV = l; - tag = com.ericsson.otp.erlang.OtpExternal.intTag; - tcV = new TypeCode(TCKind.tk_short); - }; - - - /* long */ - - /** - Long value extractor method - @return int, the value of Term - **/ - public int extract_long() - throws java.lang.Exception { - - if (tcV == null) - return (int) longV; - - if (tcV.kind() == TCKind.tk_long) - return (int) longV; - - throw new java.lang.Exception(""); - } - - /** - Long value insertion method - **/ - public void insert_long(int i){ - longV = i; - tag = com.ericsson.otp.erlang.OtpExternal.intTag; - tcV = new TypeCode(TCKind.tk_long); - } - - /** - Long value insertion method - **/ - public void insert_long(long l){ - longV = l; - tag = com.ericsson.otp.erlang.OtpExternal.intTag; - tcV = new TypeCode(TCKind.tk_long); - } - - - /* longlong */ - - /** - Long Long value extractor method - @return long, the value of Term - **/ - public long extract_longlong() - throws java.lang.Exception { - - if (tcV == null) - return longV; - - if (tcV.kind() == TCKind.tk_longlong) - return longV; - - throw new java.lang.Exception(""); - } - - - /** - Long Long value insertion method - **/ - public void insert_longlong(long l){ - longV = l; - tag = com.ericsson.otp.erlang.OtpExternal.intTag; - tcV = new TypeCode(TCKind.tk_longlong); - } - - - /* ushort */ - - /** - Unsigned Short value extractor method - @return short, the value of Term - **/ - public short extract_ushort() - throws java.lang.Exception { - - if (tcV == null) - return (short) longV; - - if (tcV.kind() == TCKind.tk_ushort) - return (short) longV; - - throw new java.lang.Exception(""); - } - - /** - Unsigned Short value insertion method - **/ - public void insert_ushort(short s){ - longV = s; - tag = com.ericsson.otp.erlang.OtpExternal.intTag; - tcV = new TypeCode(TCKind.tk_ushort); - } - - /** - Unsigned Short value insertion method - **/ - public void insert_ushort(long l){ - longV = l; - tag = com.ericsson.otp.erlang.OtpExternal.intTag; - tcV = new TypeCode(TCKind.tk_ushort); - } - - - /* ulong */ - - /** - Unsigned Long value extractor method - @return int, the value of Term - **/ - public int extract_ulong() - throws java.lang.Exception{ - - if (tcV == null) - return (int) longV; - - if (tcV.kind() == TCKind.tk_ulong) - return (int) longV; - - throw new java.lang.Exception(""); - } - - /** - Unsigned Long value insertion method - **/ - public void insert_ulong(int i){ - longV = i; - tag = com.ericsson.otp.erlang.OtpExternal.intTag; - tcV = new TypeCode(TCKind.tk_ulong); - } - - - /** - Unsigned Long value insertion method - **/ - public void insert_ulong(long l){ - longV = l; - tag = com.ericsson.otp.erlang.OtpExternal.intTag; - tcV = new TypeCode(TCKind.tk_ulong); - } - - - - /* ulonglong */ - - /** - Unsigned Long Long value extractor method - @return long, the value of Term - **/ - public long extract_ulonglong() - throws java.lang.Exception { - - if (tcV == null) - return longV; - - if (tcV.kind() == TCKind.tk_ulonglong) - return longV; - - throw new java.lang.Exception(""); - } - - - /** - Unsigned Long Long value insertion method - **/ - public void insert_ulonglong(long l){ - longV = l; - tag = com.ericsson.otp.erlang.OtpExternal.intTag; - tcV = new TypeCode(TCKind.tk_ulonglong); - } - - - - /* float */ - /** - Float value extractor method - @return float, the value of Term - **/ - public float extract_float() - throws java.lang.Exception{ - - if (tcV == null) - return (float) doubleV; - - if (tcV.kind() == TCKind.tk_float) - return (float) doubleV; - - throw new java.lang.Exception(""); - } - - - /** - Float value insertion method - **/ - public void insert_float(float f){ - doubleV = f; - tag = com.ericsson.otp.erlang.OtpExternal.floatTag; - tcV = new TypeCode(TCKind.tk_float); - } - - /** - Float value insertion method - **/ - public void insert_float(double f){ - doubleV = f; - tag = com.ericsson.otp.erlang.OtpExternal.floatTag; - tcV = new TypeCode(TCKind.tk_float); - } - - - /* double */ - /** - Double value extractor method - @return double, the value of Term - **/ - public double extract_double() - throws java.lang.Exception{ - - if (tcV == null) - return doubleV; - - if (tcV.kind() == TCKind.tk_double) - return doubleV; - - throw new java.lang.Exception(""); - } - - /** - Double value insertion method - **/ - public void insert_double(double d){ - doubleV = d; - tag = com.ericsson.otp.erlang.OtpExternal.floatTag; - tcV = new TypeCode(TCKind.tk_double); - } - - - /* boolean */ - /** - Boolean value extractor method - @return boolean, the value of Term - **/ - public boolean extract_boolean() - throws java.lang.Exception{ - - if ((tcV == null) && (atomV != null)) - return Boolean.valueOf(atomV).booleanValue(); - - if (tcV.kind() == TCKind.tk_boolean) - return booleanV; - - throw new java.lang.Exception(""); - } - - /** - Boolean value insertion method - **/ - public void insert_boolean(boolean b){ - booleanV = b; - tag = com.ericsson.otp.erlang.OtpExternal.atomTag; - tcV = new TypeCode(TCKind.tk_boolean); - } - - - /* char */ - /** - Char value extractor method - @return char, the value of Term - **/ - public char extract_char() - throws java.lang.Exception{ - - if (tcV == null) - return (char) longV; - - if (tcV.kind() == TCKind.tk_char) - return (char) longV; - - throw new java.lang.Exception(""); - } - - /** - Char value insertion method - **/ - public void insert_char(char c) { - longV = c; - tag = com.ericsson.otp.erlang.OtpExternal.smallIntTag; - tcV = new TypeCode(TCKind.tk_char); - } - - /** - Char value insertion method - **/ - public void insert_char(long l) { - longV = l; - tag = com.ericsson.otp.erlang.OtpExternal.smallIntTag; - tcV = new TypeCode(TCKind.tk_char); - } - - - - /* wchar */ - /** - Wchar value extractor method - @return char, the value of Term - **/ - public char extract_wchar() - throws java.lang.Exception{ - - if (tcV == null) - return (char) longV; - - if (tcV.kind() == TCKind.tk_wchar) - return (char) longV; - - throw new java.lang.Exception(""); - } - - /** - Wchar value insertion method - **/ - public void insert_wchar(char c) { - longV = c; - tag = com.ericsson.otp.erlang.OtpExternal.smallIntTag; - tcV = new TypeCode(TCKind.tk_wchar); - } - - /** - Wchar value insertion method - **/ - public void insert_wchar(long l) { - longV = l; - tag = com.ericsson.otp.erlang.OtpExternal.smallIntTag; - tcV = new TypeCode(TCKind.tk_wchar); - } - - - /* octet */ - /** - Octet value extractor method - @return byte, the value of Term - **/ - public byte extract_octet() - throws java.lang.Exception{ - - if (tcV == null) - return (byte) longV; - - if (tcV.kind() == TCKind.tk_octet) - return (byte) longV; - - throw new java.lang.Exception(""); - } - - /** - Octet value insertion method - **/ - public void insert_octet(byte b){ - longV = b; - tag = com.ericsson.otp.erlang.OtpExternal.smallIntTag; - tcV = new TypeCode(TCKind.tk_octet); - } - - /** - Octet value insertion method - **/ - public void insert_octet(long l){ - longV = l; - tag = com.ericsson.otp.erlang.OtpExternal.smallIntTag; - tcV = new TypeCode(TCKind.tk_octet); - } - - - - /* string */ - - /** - String value extractor method - @return String, the value of Term - **/ - public java.lang.String extract_string() - throws java.lang.Exception{ - - if (tcV == null) { - if (stringV != null) - return stringV; - else { - is = this.extract_Streamable(); - stringV = is.read_string(); - return stringV; - } - } - else - if (tcV.kind() == TCKind.tk_string) - return stringV; - - throw new java.lang.Exception(""); - } - - /** - String value insertion method - **/ - public void insert_string(java.lang.String s) { - stringV = s; - tag = com.ericsson.otp.erlang.OtpExternal.stringTag; - tcV = new TypeCode(TCKind.tk_string); - } - - - - /* wstring */ - /** - Wstring value extractor method - @return String, the value of Term - **/ - public java.lang.String extract_wstring() - throws java.lang.Exception{ - - if (tcV == null) { - if (stringV != null) - return stringV; - else { - is = this.extract_Streamable(); - stringV = is.read_string(); - return stringV; - } - } - else - if (tcV.kind() == TCKind.tk_wstring) - return stringV; - - throw new java.lang.Exception(""); - } - - /** - Wstring value insertion method - **/ - public void insert_wstring(java.lang.String s) { - stringV = s; - tag = com.ericsson.otp.erlang.OtpExternal.stringTag; - tcV = new TypeCode(TCKind.tk_wstring); - } - - - - /* atom */ - /** - Atom value extractor method - @return atom, the value of Term - **/ - public java.lang.String extract_atom() - throws java.lang.Exception{ - - if ((tcV == null) && (atomV != null)) - return atomV; - - if (tcV.kind() == TCKind.tk_atom) - return stringV; - - throw new java.lang.Exception(""); - } - - - /** - Atom value insertion method - **/ - public void insert_atom(java.lang.String s) { - stringV = s; - tag = com.ericsson.otp.erlang.OtpExternal.atomTag; - tcV = new TypeCode(TCKind.tk_atom); - } - - - /* Pid */ - /** - Pid value extractor method - @return Pid, the value of Term - **/ - public Pid extract_Pid() - throws java.lang.Exception{ - - if ((tcV == null) && (PidV != null)) - return PidV; - - if (tcV.equal(PidHelper.type())) - return PidV; - - throw new java.lang.Exception(""); - } - - - /** - Pid value insertion method - **/ - public void insert_Pid(Pid p) { - PidV = p; - tag = com.ericsson.otp.erlang.OtpExternal.pidTag; - tcV = PidHelper.type(); - } - - - - /* Ref */ - /** - Ref value extractor method - @return Ref, the value of Term - **/ - public Ref extract_Ref() - throws java.lang.Exception{ - - if ((tcV == null) && (RefV != null)) - return RefV; - - if (tcV.equal(RefHelper.type())) - return RefV; - - throw new java.lang.Exception(""); - } - - /** - Ref value insertion method - **/ - public void insert_Ref(Ref r) { - RefV = r; - - if (r.isNewRef()) - tag = com.ericsson.otp.erlang.OtpExternal.newRefTag; - else - tag = com.ericsson.otp.erlang.OtpExternal.refTag; - - tcV = RefHelper.type(); - } - - - - /* Port */ - /** - Port value extractor method - @return Port, the value of Term - **/ - public Port extract_Port() - throws java.lang.Exception{ - - if ((tcV == null) && (PortV != null)) - return PortV; - - if (tcV.equal(PortHelper.type())) - return PortV; - - throw new java.lang.Exception(""); - } - - /** - Port value insertion method - **/ - public void insert_Port(Port p) { - PortV = p; - tag = com.ericsson.otp.erlang.OtpExternal.portTag; - tcV = PortHelper.type(); - } - - - /** - Object Stream extractor method - @return OtpInputStream, the stream value of Term - **/ - public com.ericsson.otp.erlang.OtpInputStream extract_Streamable() { - - if (is == null) { - if (os == null) { - if (stringV == null) - return null; - else { - // A sequence that become a string ! - os = new com.ericsson.otp.erlang.OtpOutputStream(); - os.write_string(stringV); - is = new com.ericsson.otp.erlang.OtpInputStream(os.toByteArray()); - } - } - else { - is = new com.ericsson.otp.erlang.OtpInputStream(os.toByteArray()); - } - } - - is.reset(); - return is; - } - - /** - Inserts Objects to Term - **/ - public void insert_Object(com.ericsson.otp.erlang.OtpErlangObject o) { - ObjV = o; - } - - /** - Extract Object value from Term - @return OtpErlangObject, the Object value of Term - **/ - public com.ericsson.otp.erlang.OtpErlangObject extract_Object() { - return ObjV; - } - - -} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/ic/java_src/com/ericsson/otp/ic/TermHelper.java b/lib/ic/java_src/com/ericsson/otp/ic/TermHelper.java deleted file mode 100644 index 1a6271d9c0..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/TermHelper.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -package com.ericsson.otp.ic; - -/** - Helper class for Term. - **/ - -public class TermHelper { - - // Constructors - private TermHelper() {} - - // Methods - /** - Marshal method for the Term class, encodes the Term object to the output stream. - **/ - public static void marshal(com.ericsson.otp.erlang.OtpOutputStream _out, Term _any) - throws java.lang.Exception { - - _any.write_value(_out); - } - - /** - Unmarshal method for the Term class, decodes a Term object from the stream. - @return Term, read from the input stream - **/ - public static Term unmarshal(com.ericsson.otp.erlang.OtpInputStream _in) - throws java.lang.Exception { - - Term _value = new Term(); - - int tag = _in.peek(); - if (tag == com.ericsson.otp.erlang.OtpExternal.versionTag) { - _in.read1(); - tag = _in.peek(); - } - _value.tag = tag; - - - // Allways save the object in OtpErlangObject form - _in.mark(0); - com.ericsson.otp.erlang.OtpErlangObject _obj = _in.read_any(); - _value.insert_Object(_obj); - - switch (tag) { - case com.ericsson.otp.erlang.OtpExternal.smallIntTag: - case com.ericsson.otp.erlang.OtpExternal.intTag: - case com.ericsson.otp.erlang.OtpExternal.smallBigTag: - _in.reset(); - _value.longV = _in.read_long(); - break; - - case com.ericsson.otp.erlang.OtpExternal.atomTag: - case com.ericsson.otp.erlang.OtpExternal.atomUtf8Tag: - case com.ericsson.otp.erlang.OtpExternal.smallAtomUtf8Tag: - _in.reset(); - _value.atomV = _in.read_atom(); - break; - - case com.ericsson.otp.erlang.OtpExternal.floatTag: - _in.reset(); - _value.doubleV = _in.read_double(); - break; - - case com.ericsson.otp.erlang.OtpExternal.refTag: - case com.ericsson.otp.erlang.OtpExternal.newRefTag: - _in.reset(); - com.ericsson.otp.erlang.OtpErlangRef _eref = - _in.read_ref(); - - if (_eref.isNewRef()) - _value.RefV = new Ref(_eref.node(),_eref.ids(),_eref.creation()); - else - _value.RefV = new Ref(_eref.node(),_eref.id(),_eref.creation()); - - break; - - case com.ericsson.otp.erlang.OtpExternal.portTag: - _in.reset(); - com.ericsson.otp.erlang.OtpErlangPort _eport = - _in.read_port(); - - _value.PortV = new Port(_eport.node(),_eport.id(),_eport.creation()); - break; - - case com.ericsson.otp.erlang.OtpExternal.pidTag: - _in.reset(); - com.ericsson.otp.erlang.OtpErlangPid _epid = - _in.read_pid(); - - _value.PidV = new Pid(_epid.node(),_epid.id(),_epid.serial(),_epid.creation()); - break; - - case com.ericsson.otp.erlang.OtpExternal.stringTag: - _in.reset(); - _value.stringV = _in.read_string(); - break; - - case com.ericsson.otp.erlang.OtpExternal.listTag: - case com.ericsson.otp.erlang.OtpExternal.nilTag: - case com.ericsson.otp.erlang.OtpExternal.smallTupleTag: - case com.ericsson.otp.erlang.OtpExternal.largeTupleTag: - case com.ericsson.otp.erlang.OtpExternal.binTag: - - com.ericsson.otp.erlang.OtpOutputStream _os = - new com.ericsson.otp.erlang.OtpOutputStream(); - - _obj.encode(_os); - _value.insert_Streamable(_os); - break; - - case com.ericsson.otp.erlang.OtpExternal.largeBigTag: - default: - throw new com.ericsson.otp.erlang.OtpErlangDecodeException("Uknown data type: " + tag); - } - - return _value; - } - -} - - - diff --git a/lib/ic/java_src/com/ericsson/otp/ic/TermHolder.java b/lib/ic/java_src/com/ericsson/otp/ic/TermHolder.java deleted file mode 100644 index 6a30bad5ea..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/TermHolder.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -package com.ericsson.otp.ic; - -/** - Holder class for Term. - **/ - -final public class TermHolder { - - /** - Term instance variable. - **/ - public Term value; - - // Constructors - public TermHolder() {} - - public TermHolder(Term initial) { - value = initial; - } - - // Methods - /** - Marshal method for the TermHolder class, encodes the Term object value to the output stream. - **/ - public void _marshal(com.ericsson.otp.erlang.OtpOutputStream out) - throws java.lang.Exception { - TermHelper.marshal(out, value); - } - - /** - Unmarshal method for the TermHolder class, decodes a Term object from the output stream - and assigns it to the Holder value field. - **/ - public void _unmarshal(com.ericsson.otp.erlang.OtpInputStream in) - throws java.lang.Exception { - value = TermHelper.unmarshal(in); - } - -} diff --git a/lib/ic/java_src/com/ericsson/otp/ic/TypeCode.java b/lib/ic/java_src/com/ericsson/otp/ic/TypeCode.java deleted file mode 100644 index da036fea54..0000000000 --- a/lib/ic/java_src/com/ericsson/otp/ic/TypeCode.java +++ /dev/null @@ -1,883 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1999-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -/** - * The TypeCode class for Java IDL - * - */ -package com.ericsson.otp.ic; - -/** - The TypeCode class is the implementation of the OMG-IDL TypeCode type. - **/ - -public class TypeCode { - - private TCKind _kind; - private java.lang.String _id,_name; - private int _length,_member_count,_default_index; - private TypeCode _member_type,_discriminator_type,_content_type; - private Any _member_label; - private boolean extracted; - private TypeCode _members[]; - private java.lang.String _member_names[]; - private Any _member_labels[]; - - - - /* - * Constructors - */ - public TypeCode() { - extracted = false; - _members = null; - _member_names = null; - _member_labels = null; - _kind = null; - _id = null; - _name = null; - _length = -1; - _member_count = -1; - _default_index = -1; - _member_type = null; - _content_type = null; - _discriminator_type = null; - _member_label = null; - } - - public TypeCode(TCKind __kind) { - _kind = __kind; - } - - - /* - * Operation "TypeCode::equal" - */ - - /** - Comparisson method for TypeCode. - @return true if the input TypeCode value equals the value of the current object, false otherwize - **/ - public boolean equal(TypeCode tc) { - - try { - - TCKind tck = tc.kind(); - - switch (tck.value()) { - - case TCKind._tk_short: - case TCKind._tk_long: - case TCKind._tk_longlong: - case TCKind._tk_ushort: - case TCKind._tk_ulong: - case TCKind._tk_ulonglong: - case TCKind._tk_float: - case TCKind._tk_double: - case TCKind._tk_boolean: - case TCKind._tk_char: - case TCKind._tk_wchar: - case TCKind._tk_octet: - case TCKind._tk_string: - case TCKind._tk_wstring: - case TCKind._tk_any: - case TCKind._tk_void: - case TCKind._tk_atom: - - return (tck.value() == _kind.value()); - - case TCKind._tk_struct: - - if((tc.id().compareTo(_id) == 0) && - (tc.name().compareTo(_name) == 0) && - (tc.member_count() == _member_count)){ - - for (int i = 0; i < _member_count; i++) - if (!tc.member_type(i).equal(_members[i])) - return false; - - return true; - } - else - return false; - - case TCKind._tk_union: - - if((tc.id().compareTo(_id) == 0) && - (tc.name().compareTo(_name) == 0) && - (tc.member_count() == _member_count) && - (tc.discriminator_type().equal(_discriminator_type))){ - - for (int i = 0; i < _member_count; i++) - if ((!tc.member_type(i).equal(_members[i])) && - (tc.member_name(i).compareTo(_member_names[i]) != 0)) - return false; - - return true; - } - else - return false; - - case TCKind._tk_sequence: - case TCKind._tk_array: - - if((tck.value() == _kind.value()) && - (tc.content_type().equal(_content_type))) - return true; - else - return false; - - case TCKind._tk_enum: - if((tck.value() == _kind.value()) && - (tc.member_count() == _member_count)) { - - for (int i = 0; i < _member_count; i++) - if (tc.member_name(i).compareTo(_member_names[i]) != 0) - return false; - - return true; - } - else - return false; - - // Not used in real - case TCKind._tk_null: - case TCKind._tk_TypeCode: - case TCKind._tk_Principal: - case TCKind._tk_objref: - case TCKind._tk_alias: - case TCKind._tk_except: - case TCKind._tk_longdouble: - case TCKind._tk_fixed: - - return (tck.value() == _kind.value()); - - default : - return false; - - } - } catch (Exception e) { - return false; - } - - } - - - /* - * Operation "TypeCode::kind" - */ - - /** - Accessor method for the TCKind value of TypeCode. - @return TCKind, the TCKind value of the TypeCode object. - **/ - public TCKind kind() { - return _kind; - } - - /** - Insertion method for the TCKind value of TypeCode. - Sets the TCKind value of the object. - **/ - public void kind(TCKind __kind) { - _kind = __kind; - } - - /** - Insertion method for the TCKind value of TypeCode. - Sets the TCKind value of the object. - **/ - public static TCKind kind(java.lang.String atom) - throws java.lang.Exception { - - if (atom.equals("tk_null")) - return TCKind.tk_null; - else - if (atom.equals("tk_void")) - return TCKind.tk_void; - else - if (atom.equals("tk_short")) - return TCKind.tk_short; - else - if (atom.equals("tk_long")) - return TCKind.tk_long; - else - if (atom.equals("tk_ushort")) - return TCKind.tk_ushort; - else - if (atom.equals("tk_ulong")) - return TCKind.tk_ulong; - else - if (atom.equals("tk_float")) - return TCKind.tk_float; - else - if (atom.equals("tk_double")) - return TCKind.tk_double; - else - if (atom.equals("tk_boolean")) - return TCKind.tk_boolean; - else - if (atom.equals("tk_char")) - return TCKind.tk_char; - else - if (atom.equals("tk_octet")) - return TCKind.tk_octet; - else - if (atom.equals("tk_any")) - return TCKind.tk_any; - else - if (atom.equals("tk_TypeCode")) - return TCKind.tk_TypeCode; - else - if (atom.equals("tk_Principal")) - return TCKind.tk_Principal; - else - if (atom.equals("tk_objref")) - return TCKind.tk_objref; - else - if (atom.equals("tk_struct")) - return TCKind.tk_struct; - else - if (atom.equals("tk_union")) - return TCKind.tk_union; - else - if (atom.equals("tk_enum")) - return TCKind.tk_enum; - else - if (atom.equals("tk_string")) - return TCKind.tk_string; - else - if (atom.equals("tk_sequence")) - return TCKind.tk_sequence; - else - if (atom.equals("tk_array")) - return TCKind.tk_array; - else - if (atom.equals("tk_alias")) - return TCKind.tk_alias; - else - if (atom.equals("tk_except")) - return TCKind.tk_except; - else - if (atom.equals("tk_longlong")) - return TCKind.tk_longlong; - else - if (atom.equals("tk_ulonglong")) - return TCKind.tk_ulonglong; - else - if (atom.equals("tk_longdouble")) - return TCKind.tk_longdouble; - else - if (atom.equals("tk_wchar")) - return TCKind.tk_wchar; - else - if (atom.equals("tk_wstring")) - return TCKind.tk_wstring; - else - if (atom.equals("tk_fixed")) - return TCKind.tk_fixed; - else - if (atom.equals("tk_atom")) - return TCKind.tk_atom; - else - throw new java.lang.Exception("BAD KIND"); - - } - - - - /* - * Operation "TypeCode::id" - */ - - /** - Accessor method for the id value of TypeCode. - @return String, the id value of TypeCode object - **/ - public java.lang.String id() - throws java.lang.Exception{ - - if (_id == null) - throw new java.lang.Exception("BAD KIND"); - - return _id; - } - - - /** - Insertion method for the id value of TypeCode. - Sets the id value of the object. - **/ - public void id(java.lang.String __id) { - - _id = __id; - } - - - - /* - * Operation "TypeCode::name" - */ - - /** - Accessor method for the name value of TypeCode. - @return String, the name value of TypeCode object - **/ - public java.lang.String name() - throws java.lang.Exception{ - - if (_name == null) - throw new java.lang.Exception("BAD KIND"); - - return _name; - } - - /** - Insertion method for the name value of TypeCode. - Sets the name value of the object. - **/ - public void name(java.lang.String __name) { - _name = __name; - } - - - - /* - * Operation "TypeCode::member_count" - */ - - /** - Accessor method for the member number value of TypeCode. - @return int, the number of members of TypeCode object - **/ - public int member_count() - throws java.lang.Exception{ - - if (_member_count == -1) - throw new java.lang.Exception("BAD KIND"); - - return _member_count; - } - - /** - Insertion method for the member number value of TypeCode. - Sets the number of members value of the object. - **/ - public void member_count(int __member_count) { - - switch(_kind.value()) { - case TCKind._tk_struct: - _members = new TypeCode[__member_count]; - _member_names = new java.lang.String[__member_count]; - _member_count = __member_count; - break; - case TCKind._tk_union: - _members = new TypeCode[__member_count]; - _member_names = new java.lang.String[__member_count]; - _member_labels = new Any[__member_count]; - _member_count = __member_count; - break; - case TCKind._tk_enum: - _member_names = new java.lang.String[__member_count]; - _member_count = __member_count; - break; - default : - // Do nothing - } - } - - - /* - * Operation "TypeCode::member_name" - */ - - /** - Member name accessor method for TypeCode. - @return String, the name value of the member of the TypeCode object - on the selected index - **/ - public java.lang.String member_name(int __index) - throws java.lang.Exception{ - - return _member_names[__index]; - } - - /** - Insertion method for the indexed member name of TypeCode. - Sets the name of a member value of the object at the selected index.. - **/ - public void member_name(int __index, java.lang.String __member_name) { - _member_names[__index] = __member_name; - } - - - /* - * Operation "TypeCode::member_type" - */ - - /** - Member type accessor method for TypeCode. - @return TypeCOde, the type of the member of the TypeCode object - on the selected index - **/ - public TypeCode member_type(int __index) - throws java.lang.Exception{ - - return _members[__index]; - } - - /** - Insertion method for the indexed member type of TypeCode. - Sets the type of a member value of the object at the selected index.. - **/ - public void member_type(int __index, TypeCode __member_type) { - _members[__index] = __member_type; - } - - - /* - * Operation "TypeCode::member_label" - */ - - /** - Member label accessor method for TypeCode. - @return Any, the label of the member of the TypeCode object - on the selected index - **/ - public Any member_label(int __index) - throws java.lang.Exception{ - - return _member_labels[__index]; - } - - /** - Insertion method for the indexed member label of TypeCode. - Sets the label of a member value of the object at the selected index. - **/ - public void member_label(int __index, Any __member_label) { - _member_labels[__index] = __member_label; - } - - - /* - * Operation "TypeCode::discriminator_type" - */ - - /** - Discriminator type accessor method for TypeCode. - @return TypeCode, the type of the discriminator of the TypeCode object - **/ - public TypeCode discriminator_type() - throws java.lang.Exception{ - - if (_discriminator_type == null) - throw new java.lang.Exception("BAD KIND"); - - return _discriminator_type; - } - - /** - Insertion method for the type of the discriminator value of TypeCode. - Sets the discriminator type value of the object. - **/ - public void discriminator_type(TypeCode __discriminator_type) { - _discriminator_type = __discriminator_type; - } - - - /* - * Operation "TypeCode::default_index" - */ - - /** - Index accessor method for TypeCode. - @return int, the default index value of the member of the TypeCode object - **/ - public int default_index() - throws java.lang.Exception{ - - if (_default_index == -1) - throw new java.lang.Exception("BAD KIND"); - - return _default_index; - } - - /** - Insertion method for the default index value of TypeCode. - Sets the default index value of the object. - **/ - public void default_index(int __default_index) { - _default_index = __default_index; - } - - - /* - * Operation "TypeCode::length" - */ - - /** - Length accessor method for TypeCode. - @return int, the length of the TypeCode object - **/ - public int length() - throws java.lang.Exception{ - - if (_length == -1) - throw new java.lang.Exception("BAD KIND"); - - return _length; - } - - /** - Insertion method for the length value of TypeCode. - Sets the length value of the object. - **/ - public void length(int __length) { - _length = __length; - } - - - /* - * Operation "TypeCode::content_type" - */ - - /** - Content type accessor method for TypeCode. - @return TypeCode, the content type of the TypeCode object - **/ - public TypeCode content_type() - throws java.lang.Exception { - - if (_content_type == null) - throw new java.lang.Exception("BAD KIND"); - - return _content_type; - } - - /** - Insertion method for the content type value of TypeCode. - Sets the content type value of the object. - **/ - public void content_type(TypeCode __content_type) { - _content_type = __content_type; - } - - - /** - Marshal operation for TypeCode. - **/ - public static void marshal(com.ericsson.otp.erlang.OtpOutputStream _os, TypeCode _tc) - throws java.lang.Exception { - - TypeCode memberTC = null; - int len = -1; - - switch(_tc.kind().value()) { - - case TCKind._tk_short : - _os.write_atom("tk_short"); - break; - case TCKind._tk_ushort : - _os.write_atom("tk_ushort"); - break; - case TCKind._tk_long : - _os.write_atom("tk_long"); - break; - case TCKind._tk_longlong : - _os.write_atom("tk_longlong"); - break; - case TCKind._tk_ulong : - _os.write_atom("tk_ulong"); - break; - case TCKind._tk_ulonglong : - _os.write_atom("tk_ulonglong"); - break; - case TCKind._tk_float : - _os.write_atom("tk_float"); - break; - case TCKind._tk_double : - _os.write_atom("tk_double"); - break; - case TCKind._tk_boolean : - _os.write_atom("tk_boolean"); - break; - case TCKind._tk_char : - _os.write_atom("tk_char"); - break; - case TCKind._tk_wchar : - _os.write_atom("tk_wchar"); - break; - case TCKind._tk_octet : - _os.write_atom("tk_octet"); - break; - case TCKind._tk_string : - _os.write_tuple_head(2); - _os.write_atom("tk_string"); - _os.write_ulong(_tc.length()); - break; - case TCKind._tk_wstring : - _os.write_tuple_head(2); - _os.write_atom("tk_wstring"); - _os.write_ulong(_tc.length()); - break; - case TCKind._tk_struct: - len = _tc.member_count(); - _os.write_tuple_head(4); - _os.write_atom("tk_struct"); - _os.write_string(_tc.id()); - _os.write_string(_tc.name()); - // Member list - _os.write_list_head(len); - for(int i=0; i $@ - -docs: - -# ---------------------------------------------------- -# Special Build Targets -# ---------------------------------------------------- -../ebin/icparse.beam: icparse.erl - $(V_ERLC) $(ERL_COMPILE_FLAGS) +nowarn_unused_vars +nowarn_unused_function -o$(EBIN) +pj $< - -icparse.erl: icparse.yrl icyeccpre.hrl - -### $(ERLC) $(YRL_FLAGS) $< - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - - -release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)/ebin" - $(INSTALL_DATA) $(TARGET_FILES) $(APP_TARGET) "$(RELSYSDIR)/ebin" - $(INSTALL_DIR) "$(RELSYSDIR)/src" - $(INSTALL_DATA) $(ERL_FILES) $(YRL_FILE) $(INTERNAL_HRL_FILES) "$(RELSYSDIR)/src" - $(INSTALL_DIR) "$(RELSYSDIR)/examples" - $(INSTALL_DIR) "$(RELSYSDIR)/examples/c-client" - $(INSTALL_DATA) $(CCL_EX_FILES) "$(RELSYSDIR)/examples/c-client" - $(INSTALL_DIR) "$(RELSYSDIR)/examples/c-server" - $(INSTALL_DATA) $(CSRV_EX_FILES) "$(RELSYSDIR)/examples/c-server" - $(INSTALL_DIR) "$(RELSYSDIR)/examples/erl-plain" - $(INSTALL_DATA) $(EPL_EX_FILES) "$(RELSYSDIR)/examples/erl-plain" - $(INSTALL_DIR) "$(RELSYSDIR)/examples/erl-genserv" - $(INSTALL_DATA) $(ESRV_EX_FILES) "$(RELSYSDIR)/examples/erl-genserv" - $(INSTALL_DIR) "$(RELSYSDIR)/examples/java-client-server" - $(INSTALL_DATA) $(JAVA_EX_FILES) "$(RELSYSDIR)/examples/java-client-server" - $(INSTALL_DIR) "$(RELSYSDIR)/examples/all-against-all" - $(INSTALL_DATA) $(MIXED_EX_FILES) "$(RELSYSDIR)/examples/all-against-all" - -release_docs_spec: - diff --git a/lib/ic/src/ic.app.src b/lib/ic/src/ic.app.src deleted file mode 100644 index 7dd47ac9c6..0000000000 --- a/lib/ic/src/ic.app.src +++ /dev/null @@ -1,53 +0,0 @@ -{application, ic, - [{description, "The IDL Compiler"}, - {vsn, "%VSN%"}, - {modules, - [ - ic, - ic_cclient, - ic_cbe, - ic_cserver, - ic_erlbe, - ic_fetch, - ic_noc, - ic_plainbe, - ic_pp, - ic_pragma, - icenum, - iceval, - icparse, - icpreproc, - icscan, - icstruct, - ictk, - ictype, - ic_array_java, - ic_attribute_java, - ic_code, - ic_codegen, - ic_constant_java, - ic_enum_java, - ic_error, - ic_file, - ic_forms, - ic_genobj, - ic_java_type, - ic_jbe, - ic_options, - ic_sequence_java, - ic_struct_java, - ic_symtab, - ic_union_java, - ic_util, - icunion, - ic_erl_template - ] - }, - {registered, []}, - {applications, [stdlib, kernel]}, - {env, []}, - {mod, {ic, []}}, - {runtime_dependencies, ["stdlib-2.0","kernel-3.0","erts-6.0"]} -]}. - - diff --git a/lib/ic/src/ic.erl b/lib/ic/src/ic.erl deleted file mode 100644 index 062fbef435..0000000000 --- a/lib/ic/src/ic.erl +++ /dev/null @@ -1,415 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(ic). - - --export([sgen/1, gen/1, gen/2, help/0, compile/3]). - - -%%------------------------------------------------------------ -%% -%% Internal stuff -%% -%%------------------------------------------------------------ - --export([filter_params/2, handle_preproc/4, do_gen/4]). - --import(lists, [foldr/3]). - - --include("icforms.hrl"). --include("ic.hrl"). - --include_lib("stdlib/include/erl_compile.hrl"). - --export([make_erl_options/1]). % For erlc - --export([main/3, do_scan/1, do_parse/2, do_type/2]). - - -%%------------------------------------------------------------ -%% -%% Entry point -%% -%%------------------------------------------------------------ - -%% compile(AbsFileName, Outfile, Options) -%% Compile entry point for erl_compile. - -compile(File, _OutFile, Options) -> - case gen(File, make_erl_options(Options)) of - ok -> ok; - Other -> Other - end. - - -%% Entry for the -s switch -sgen(ArgList) -> -%%% io:format("sgen called w ~p~n", [ArgList]), - apply(?MODULE, gen, ArgList). - - -gen(File) -> - gen(File, []). - -gen(File, Opts) -> - G = ic_genobj:new(Opts), - IdlFile = ic_file:add_dot_idl(File), - case ic_options:get_opt(G, show_opts) of - true -> - io:format("Opts: ~p~n", [ic_options:which_opts(G)]); - _ -> ok - end, - ic_genobj:set_idlfile(G, IdlFile), - case catch gen2(G, File, Opts) of - {_, {'EXIT', R}} -> - ic_genobj:free_table_space(G), %% Free space for all ETS tables - io:format("Fatal error : ~p~n",[R]), - error; - {_, {'EXIT', _, R}} -> - ic_genobj:free_table_space(G), %% Free space for all ETS tables - io:format("Fatal error : ~p~n",[R]), - error; - {'EXIT', R} -> - ic_genobj:free_table_space(G), %% Free space for all ETS tables - io:format("Fatal error : ~p~n",[R]), - error; - {'EXIT', _, R} -> - ic_genobj:free_table_space(G), %% Free space for all ETS tables - io:format("Fatal error : ~p~n",[R]), - error; - %% In this case, the pragma registration - %% found errors so this should return error. - error -> - ic_genobj:free_table_space(G), %% Free space for all ETS tables - error; - _ -> - X = ic_error:return(G), - ic_genobj:free_table_space(G), %% Free space for all ETS tables - X - end. - - -gen2(G, File, Opts) -> - case ic_options:get_opt(G, time) of - true -> - time("TOTAL ", ic, main, [G, File, Opts]); - _ -> - case main(G, File, Opts) of - error -> - error; - _ -> - ok - end - end. - - - -do_gen(erl_corba, G, File, T) -> - ic_erlbe:do_gen(G, File, T); -do_gen(erl_template, G, File, T) -> - ic_erl_template:do_gen(G, File, T); -do_gen(erl_genserv, G, File, T) -> - ic_erlbe:do_gen(G, File, T); -do_gen(c_genserv, G, File, T) -> - ic_cclient:do_gen(G, File, T); -do_gen(noc, G, File, T) -> - ic_noc:do_gen(G, File, T); -do_gen(erl_plain, G, File, T) -> - ic_plainbe:do_gen(G, File, T); -do_gen(c_server, G, File, T) -> - ic_cserver:do_gen(G, File, T); -do_gen(c_client, G, File, T) -> - ic_cclient:do_gen(G, File, T); -%% Java backend -do_gen(java, G, File, T) -> - ic_jbe:do_gen(G, File, T); -%% No language choice -do_gen(_,_,_,_) -> - ok. - -do_scan(G) -> - icscan:scan(G, ic_genobj:idlfile(G)). - - -do_parse(G, Tokens) -> - case icparse:parse(Tokens) of - {ok, L} -> L; - X when element(1, X) == error -> - Err = element(2, X), - ic_error:fatal_error(G, {parse_error, element(1, Err), - element(3, Err)}); - X -> exit(X) - end. - - -do_type(G, Form) -> - ictype:type_check(G, Form). - -time(STR,M,F,A) -> - case timer:tc(M, F, A) of - {_, {'EXIT', R}} -> exit(R); - {_, {'EXIT', _, R}} -> exit(R); - {_, _X} when element(1, _X)==error -> throw(_X); - {_T, _R} -> - io:format("Time for ~s: ~10.2f~n", [STR, _T/1000000]), - _R - end. - - - -%% Filters parameters so that only those with certain attributes are -%% seen. The filter parameter is a list of attributes that will be -%% seen, ex. [in] or [inout, out] -filter_params(Filter, Params) -> - lists:filter(fun(P) -> - lists:member(get_param_attr(P#param.inout), Filter) end, - Params). - - -%% Access primitive to get the attribute name (and discard the line -%% number). -get_param_attr({A, _N}) -> A. - - -%% -%% Fixing the preproc directives -%% -handle_preproc(G, _N, line_nr, X) -> - Id = ic_forms:get_id2(X), - Flags = X#preproc.aux, - case Flags of - [] -> ic_genobj:push_file(G, Id); - _ -> - foldr(fun({_, _, "1"}, Gprim) -> ic_genobj:push_file(Gprim, Id); - ({_, _, "2"}, Gprim) -> ic_genobj:pop_file(Gprim, Id); - ({_, _, "3"}, Gprim) -> ic_genobj:sys_file(Gprim, Id) end, - G, Flags) - end; -handle_preproc(G, _N, _Other, _X) -> - G. - - - -%%------------------------------------------------------------ -%% -%% The help department -%% -%% -%% -%%------------------------------------------------------------ - -help() -> - io:format("No help available at the moment~n", []), - ok. - -print_version_str(G) -> - case {ic_options:get_opt(G, silent), ic_options:get_opt(G, silent2)} of - {true, _} -> ok; - {_, true} -> ok; - _ -> - io:format("Erlang IDL compiler version ~s~n", [?COMPILERVSN]) - end. - - - -%% -%% Converts generic compiler options to specific options. -%% -%% Used by erlc -%% - -make_erl_options(Opts) -> - - %% This way of extracting will work even if the record passed - %% has more fields than known during compilation. - - Includes1 = Opts#options.includes, - Defines = Opts#options.defines, - Outdir = Opts#options.outdir, - Warning = Opts#options.warning, - Verbose = Opts#options.verbose, - Specific = Opts#options.specific, - Optimize = Opts#options.optimize, - PreProc = - lists:flatten( - lists:map(fun(D) -> io_lib:format("-I\"~ts\" ", [ic_util:to_list(D)]) end, - Includes1)++ - lists:map( - fun ({Name, Value}) -> - io_lib:format("-D~s=~s ", [ic_util:to_list(Name), ic_util:to_list(Value)]); - (Name) -> - io_lib:format("-D~s ", [ic_util:to_list(Name)]) - end, - Defines)), - Options = - case Verbose of - true -> []; - false -> [] - end ++ - case Warning of - 0 -> [nowarn]; - _ -> ['Wall'] - end ++ - case Optimize of - 0 -> []; - _ -> [] - end, - - Options++[{outdir, Outdir}, {preproc_flags, PreProc}]++Specific. - - -%%% -%%% NEW main, avoids memory fragmentation -%%% -main(G, File, _Opts) -> - print_version_str(G), - ?ifopt(G, time, io:format("File ~p compilation started : ~p/~p/~p ~p:~2.2.0p~n", - [ic_genobj:idlfile(G), - element(1,date()), - element(2, date()), - element(3, date()), - element(1, time()), - element(2, time())])), - - case ic_options:get_opt(G, help) of - true -> help(); - - _ -> - scanning(G, File) - end. - - - -scanning(G, File) -> - S = ?ifopt2(G, time, - time("input file scanning ", ic, do_scan, [G]), - ic:do_scan(G)), - ?ifopt2(G, tokens, io:format("TOKENS: ~p~n", [S]), - parsing(G, File, S)). - -parsing(G, File, S) -> - T = ?ifopt2(G, - time, - time("input file parsing ", ic, do_parse, [G,S]), - ic:do_parse(G,S)), - ?ifopt2(G, form, io:format("PARSE FORM: ~p~n", [T]), - pragma(G, File, T)). - - - -pragma(G, File, T) -> - case ?ifopt2(G, - time, - time("pragma registration ", ic_pragma, pragma_reg, [G,T]), - ic_pragma:pragma_reg(G,T)) of - %% All pragmas were successfully applied - {ok,Clean} -> - typing(G, File, Clean); - - error -> - error - end. - - -typing(G, File, Clean) -> - case catch ?ifopt2(G, - time, - time("type code appliance ", ic, do_type, [G,Clean]), - ic:do_type(G,Clean)) of - {'EXIT',Reason} -> - io:format("Error under type appliance : ~p~n",[Reason]), - error; - - T2 -> - ?ifopt2(G, tform, io:format("TYPE FORM: ~p~n", [T2]), - generation(G, File, T2)) - end. - - - -generation(G, File, T2) -> - case ic_options:get_opt(G, multiple_be) of - false -> - single_generation(G, File, T2); - List -> - OutDir = - case ic_options:get_opt(G, outdir) of - false -> - []; - Dir -> - Dir - end, - - case ic_options:get_opt(G, be) of - false -> - ok; - Be -> - %% Generate this first - ic_options:add_opt(G,[{outdir,OutDir++atom_to_list(Be)}],true), - single_generation(G, File, T2) - end, - multiple_generation(G, File, T2, OutDir, List) - end. - -multiple_generation(_G, _File, _T2, _RootDir, []) -> - ok; -multiple_generation(G, File, T2, RootDir, [Be|Bes]) -> - ic_options:add_opt(G,[{outdir,RootDir++atom_to_list(Be)}],true), - ic_options:add_opt(G,[{be,Be}],true), - single_generation(G, File, T2), - - case ic_error:get_error_count(G) of - 0 -> - multiple_generation(G,File,T2,RootDir,Bes); - _ -> - %% Errors reported, abort - ok - end. - - -single_generation(G, File, T2) -> - case ic_error:get_error_count(G) of - 0 -> - %% Check if user has sett backend option - case ic_options:get_opt(G, be) of - false -> - %% Use default backend option - DefaultBe = ic_options:defaultBe(), - ic_options:add_opt(G,[{be,DefaultBe}],true), - - ?ifopt2(G, - time, - time("code generation ", ic, do_gen, [DefaultBe, G, File, T2]), - ic:do_gen(DefaultBe, G, File, T2)); - Be -> - %% Use user defined backend - ?ifopt2(G, - time, - time("code generation ", ic, do_gen, [Be, G, File, T2]), - ic:do_gen(Be, G, File, T2)) - end; - _ -> - ok %% Does not matter - end. - - - diff --git a/lib/ic/src/ic.hrl b/lib/ic/src/ic.hrl deleted file mode 100644 index cf4b6a50d6..0000000000 --- a/lib/ic/src/ic.hrl +++ /dev/null @@ -1,159 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - - -%%------------------------------------------------------------ -%% Configuration macros --define(CORBAMOD, corba). --define(ORBNAME, orber). --define(CORBAHRL, "corba.hrl"). --define(CALL, "call"). --define(CAST, "cast"). --define(IFRREGID, "register"). --define(IFRTYPESHRL, "ifr_types.hrl"). - --define(GENSERVMOD, gen_server). - -%%------------------------------------------------------------ -%% Flags. NOTE! Once assigned value may NOT be changed. Deprecate ok. -%% Default flags. Can be changed if we change the default behavior. --define(IC_FLAG_TEMPLATE_1, 16#01). --define(IC_FLAG_TEMPLATE_2, 16#02). - --define(IC_INIT_FLAGS, 16#00). - -%% Flag operations -%% USAGE: Boolean = ?IC_FLAG_TEST(Flags, ?IC_ATTRIBUTE) --define(IC_FLAG_TEST(_F1, _I1), ((_F1 band _I1) == _I1)). - -%% USAGE: NewFlags = ?IC_SET_TRUE(Flags, ?IC_ATTRIBUTE) --define(IC_SET_TRUE(_F2, _I2), (_I2 bor _F2)). - -%% USAGE: NewFlags = ?IC_SET_FALSE(Flags, ?IC_ATTRIBUTE) --define(IC_SET_FALSE(_F3, _I3), ((_I3 bxor 16#ff) band _F3)). - -%% USAGE: NewFlags = ?IC_SET_FALSE_LIST(Flags, [?IC_SEC_ATTRIBUTE, ?IC_SOME]) --define(IC_SET_FALSE_LIST(_F4, _IList1), - lists:foldl(fun(_I4, _F5) -> - ((_I4 bxor 16#ff) band _F5) - end, - _F4, _IList1)). - -%% USAGE: NewFlags = ?IC_SET_TRUE_LIST(Flags, [?IC_ATTRIBUTE, ?IC_SOME]) --define(IC_SET_TRUE_LIST(_F6, _IList2), - lists:foldl(fun(_I6, _F7) -> - (_I6 bor _F7) - end, - _F6, _IList2)). - -%% USAGE: Boolean = ?IC_FLAG_TEST_LIST(Flags, [?IC_CONTEXT, ?IC_THING]) --define(IC_FLAG_TEST_LIST(_F8, _IList3), - lists:all(fun(_I7) -> - ((_F8 band _I7) == _I7) - end, - _IList3)). - - -%%------------------------------------------------------------ -%% Usefull macros - --define(ifthen(P,ACTION), if P -> ACTION; true->true end). - - -%%------------------------------------------------------------ -%% Option macros - --define(ifopt(G,OPT,ACTION), - case ic_options:get_opt(G,OPT) of true -> ACTION; _ -> ok end). - --define(ifopt2(G,OPT,ACT1,ACT2), - case ic_options:get_opt(G,OPT) of true -> ACT1; _ -> ACT2 end). - --define(ifnopt(G,OPT,ACTION), - case ic_options:get_opt(G,OPT) of false -> ACTION; _ -> ok end). - - -%% Internal record --record(id_of, {id, type, tk}). - -%%-------------------------------------------------------------------- -%% The generator object definition - --record(genobj, {symtab, impl, options, warnings, auxtab, - tktab, pragmatab, c_typedeftab, - skelfile=[], skelfiled=[], skelscope=[], - stubfile=[], stubfiled=[], stubscope=[], - includefile=[], includefiled=[], - interfacefile=[],interfacefiled=[], - helperfile=[],helperfiled=[], - holderfile=[],holderfiled=[], - filestack=0, do_gen=true, sysfile=false}). - -%%-------------------------------------------------------------------- -%% The scooped id definition --record(scoped_id, {type=local, line=-1, id=""}). - - - - - - - - -%%-------------------------------------------------------------------- -%% Secret macros -%% -%% NOTE these macros are not general, they cannot be used -%% everywhere. -%% --define(lookup(T,K), case ets:lookup(T, K) of [{_X, _Y}] -> _Y; _->[] end). --define(insert(T,K,V), ets:insert(T, {K, V})). - - -%%--------------------------------------------------------------------- -%% -%% Java specific macros -%% -%% --define(ERLANGPACKAGE,"com.ericsson.otp.erlang."). --define(ICPACKAGE,"com.ericsson.otp.ic."). - - -%% -%% Macros for reporting encode/decode errors in C back-ends. -%% -%% - --define(emit_c_enc_rpt(Fd, Fill, Fmt, Vals), - begin - CType = ic_cbe:mk_c_type2(G, N, T), - ic_codegen:emit_c_enc_rpt(Fd, Fill, "~s : " ++ Fmt, [CType| Vals]) - end). --define(emit_c_dec_rpt(Fd, Fill, Fmt, Vals), - begin - CType = ic_cbe:mk_c_type2(G, N, T), - ic_codegen:emit_c_dec_rpt(Fd, Fill, "~s : " ++ Fmt, [CType| Vals]) - end). - - - - - diff --git a/lib/ic/src/ic_array_java.erl b/lib/ic/src/ic_array_java.erl deleted file mode 100644 index 64d1b8a9ba..0000000000 --- a/lib/ic/src/ic_array_java.erl +++ /dev/null @@ -1,296 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(ic_array_java). - --export([gen/4]). - --include("ic.hrl"). --include("icforms.hrl"). - - -gen(G, N, X, Array) when is_record(X, member) -> - ArrayName = ic_forms:get_java_id(Array), - ArrayElement = ic_forms:get_type(X), - emit_holder_class(G, N, X, Array, ArrayName, ArrayElement), - emit_helper_class(G, N, X, Array, ArrayName, ArrayElement); -gen(G, N, X, Array) when is_record(X, case_dcl) -> - ArrayName = ic_forms:get_java_id(Array), - ArrayElement = ic_forms:get_type(X), - emit_holder_class(G, N, X, Array, ArrayName, ArrayElement), - emit_helper_class(G, N, X, Array, ArrayName, ArrayElement); -gen(G, N, X, Array) -> - ArrayName = ic_forms:get_java_id(Array), - ArrayElement = ic_forms:get_body(X), - emit_holder_class(G, N, X, Array, ArrayName, ArrayElement), - emit_helper_class(G, N, X, Array, ArrayName, ArrayElement). - - - -%%----------------------------------------------------------------- -%% Func: emit_holder_class/4 -%%----------------------------------------------------------------- -emit_holder_class(G, N, _X, Array, ArrayName, ArrayElement) -> - SName = string:concat(ArrayName, "Holder"), - {Fd, _}= ic_file:open_java_file(G, N, SName), - - ArrayElementName = ic_java_type:getType(G, N, ArrayElement), - EmptyDim = arrayEmptyDim(Array), - - ic_codegen:emit(Fd, "final public class ~sHolder {\n",[ArrayName]), - - ic_codegen:emit(Fd, " // instance variables\n", []), - ic_codegen:emit(Fd, " public ~s~s value;\n\n", - [ArrayElementName,EmptyDim]), - - ic_codegen:emit(Fd, " // constructors\n", []), - ic_codegen:emit(Fd, " public ~sHolder() {}\n", [ArrayName]), - ic_codegen:emit(Fd, " public ~sHolder(~s~s initial) {\n", - [ArrayName,ArrayElementName,EmptyDim]), - ic_codegen:emit(Fd, " value = initial;\n", []), - ic_codegen:emit(Fd, " }\n", []), - ic_codegen:nl(Fd), - - ic_codegen:emit(Fd, " // methods\n", []), - - ic_codegen:emit(Fd, " public void _marshal(~sOtpOutputStream out)\n", [?ERLANGPACKAGE]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n"), - ic_codegen:emit(Fd, " ~sHelper.marshal(out, value);\n", [ArrayName]), - ic_codegen:emit(Fd, " }\n"), - ic_codegen:nl(Fd), - ic_codegen:emit(Fd, " public void _unmarshal(~sOtpInputStream in)\n", [?ERLANGPACKAGE]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n"), - ic_codegen:emit(Fd, " value = ~sHelper.unmarshal(in);\n", [ArrayName]), - ic_codegen:emit(Fd, " }\n", []), - ic_codegen:nl(Fd), - - ic_codegen:emit(Fd, "}\n", []), - file:close(Fd). - - -%%----------------------------------------------------------------- -%% Func: emit_helper_class/4 -%%----------------------------------------------------------------- -emit_helper_class(G, N, X, Array, ArrayName, ArrayElement) -> - SName = string:concat(ArrayName, "Helper"), - {Fd, _}= ic_file:open_java_file(G, N, SName), - - ArrayElementName = ic_java_type:getType(G, N, ArrayElement), - EmptyDim = arrayEmptyDim(Array), -% Dim = arrayDim(G,N,Array), - - ic_codegen:emit(Fd, "public class ~sHelper {\n",[ArrayName]), - - ic_codegen:emit(Fd, " // constructors\n"), - ic_codegen:emit(Fd, " private ~sHelper() {}\n\n", [ArrayName]), - - ic_codegen:emit(Fd, " // methods\n"), - - ic_codegen:emit(Fd, " public static void marshal(~sOtpOutputStream _out, ~s~s _value)\n", - [?ERLANGPACKAGE,ArrayElementName,EmptyDim]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n\n"), - emit_array_marshal_loop(G,N,X,Array,ArrayElement,Fd), - ic_codegen:emit(Fd, " }\n"), - ic_codegen:nl(Fd), - ic_codegen:emit(Fd, " public static ~s~s unmarshal(~sOtpInputStream _in)\n", - [ArrayElementName,EmptyDim,?ERLANGPACKAGE]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n\n"), - ic_codegen:emit(Fd, " ~s~s _value = new ~s;\n\n", - [ArrayElementName,EmptyDim,ic_java_type:getFullType(G, N, X, Array)]), - emit_array_unmarshal_loop(G,N,X,Array,ArrayElement,Fd), - ic_codegen:emit(Fd, " return _value;\n"), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " public static String id() {\n", []), - ic_codegen:emit(Fd, " return ~p;\n",[ictk:get_IR_ID(G, N, Array)]), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " public static String name() {\n", []), - ic_codegen:emit(Fd, " return ~p;\n",[ArrayName]), - ic_codegen:emit(Fd, " }\n\n"), - - ic_jbe:emit_type_function(G, N, X, Fd), - - ic_codegen:emit(Fd, " public static void insert(~sAny _any, ~s~s _this)\n", - [?ICPACKAGE,ArrayElementName,EmptyDim]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n\n"), - - ic_codegen:emit(Fd, " ~sOtpOutputStream _os = \n",[?ERLANGPACKAGE]), - ic_codegen:emit(Fd, " new ~sOtpOutputStream();\n\n",[?ERLANGPACKAGE]), - - ic_codegen:emit(Fd, " _any.type(type());\n"), - ic_codegen:emit(Fd, " marshal(_os, _this);\n"), - ic_codegen:emit(Fd, " _any.insert_Streamable(_os);\n"), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " public static ~s~s extract(~sAny _any)\n", - [ArrayElementName,EmptyDim,?ICPACKAGE]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n\n"), - - ic_codegen:emit(Fd, " return unmarshal(_any.extract_Streamable());\n"), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, "}\n"), - file:close(Fd). - - - - -emit_array_marshal_loop(G,N,X,Array,AEl,Fd) -> - DimList = mk_array_dim_list(G,N,Array), - emit_array_marshal_loop_1(G,N,X,Array,AEl,DimList,0,Fd). - - -emit_array_marshal_loop_1(G,N,X,Array,AEl,[D],C,Fd) -> - - DimList = mk_array_dim_list(G,N,Array), - - ic_codegen:emit(Fd, " _out.write_tuple_head(~s);\n\n",[D]), - - ic_codegen:emit(Fd, " for(int _tmp~p = 0; _tmp~p < ~s; _tmp~p++)\n",[C,C,D,C]), - - case ic_java_type:isBasicType(G, N, AEl) of - true -> - ic_codegen:emit(Fd, " _out~s(_value", - [ic_java_type:marshalFun(G, N, X, AEl)]); - false -> - ic_codegen:emit(Fd, " ~s(_out, _value", - [ic_java_type:marshalFun(G, N, X, AEl)]) - end, - - emit_array_dimensions(DimList,0,Fd), - - ic_codegen:emit(Fd, ");\n\n"); - -emit_array_marshal_loop_1(G,N,X,Array,AEl,[D|Ds],C,Fd) -> -% DimList = mk_array_dim_list(G,N,Array), - - ic_codegen:emit(Fd, " _out.write_tuple_head(~s);\n\n",[D]), - - ic_codegen:emit(Fd, " for(int _tmp~p = 0; _tmp~p < ~s; _tmp~p++) {\n",[C,C,D,C]), - - emit_array_marshal_loop_1(G,N,X,Array,AEl,Ds,C+1,Fd), - - ic_codegen:emit(Fd, " }\n\n"). - - - - - -emit_array_unmarshal_loop(G,N,X,Array,AEl,Fd) -> - DimList = mk_array_dim_list(G,N,Array), - case length(DimList) > 0 of - true -> - ic_codegen:emit(Fd, " _in.read_tuple_head();\n\n"), - - ic_codegen:emit(Fd, " for(int _tmp0 = 0; _tmp0 < ~s; _tmp0++) {\n\n",[hd(DimList)]), - emit_array_unmarshal_loop_1(G,N,X,Array,AEl,tl(DimList),1,Fd), - ic_codegen:emit(Fd, " }\n\n"); - false -> - emit_array_unmarshal_loop_1(G,N,X,Array,AEl,DimList,0,Fd) - end. - -emit_array_unmarshal_loop_1(G,N,X,_Array,AEl,[],1,Fd) -> %% One dimensional array - case ic_java_type:isBasicType(G, N, AEl) of - true -> - ic_codegen:emit(Fd, " _value[_tmp0] = _in~s;\n", - [ic_java_type:unMarshalFun(G, N, X, AEl)]); - false -> - ic_codegen:emit(Fd, " _value[_tmp0] = ~s.unmarshal(_in);\n\n", - [ic_java_type:getUnmarshalType(G, N, X, AEl)]) - end; -emit_array_unmarshal_loop_1(G,N,X,Array,AEl,[],_C,Fd) -> - DimList = mk_array_dim_list(G,N,Array), - ic_codegen:emit(Fd, " _value"), - emit_array_dimensions(DimList,0,Fd), - case ic_java_type:isBasicType(G,N,AEl) of - true -> - ic_codegen:emit(Fd, " = _in~s;\n", - [ic_java_type:unMarshalFun(G, N, X, AEl)]); - false -> - ic_codegen:emit(Fd, " = ~s.unmarshal(_in);\n", - [ic_java_type:getUnmarshalType(G, N, X, AEl)]) - end; -emit_array_unmarshal_loop_1(G,N,X,Array,AEl,[D|Ds],C,Fd) -> - ic_codegen:emit(Fd, " _in.read_tuple_head();\n\n"), - - ic_codegen:emit(Fd, " for(int _tmp~p = 0; _tmp~p < ~s; _tmp~p++) {\n\n",[C,C,D,C]), - emit_array_unmarshal_loop_1(G,N,X,Array,AEl,Ds,C+1,Fd), - ic_codegen:emit(Fd, " }\n"). - - - - - -%%--------------------------------------------------- -%% Utilities -%%--------------------------------------------------- - -mk_array_dim_list(G,N,Array) -> - mk_array_dim_list2(G,N,Array#array.size). - - -mk_array_dim_list2(_G,_N,[]) -> - []; - -mk_array_dim_list2(G,N,[D |Ds]) when is_record(D,scoped_id) -> - {FSN, _, _, _} = ic_symtab:get_full_scoped_name(G, N, D), - [ ic_util:to_dot(G,FSN) | mk_array_dim_list2(G,N,Ds)]; - -mk_array_dim_list2(G,N,[D |Ds]) -> - [ic_util:eval_java(G,N,D) | mk_array_dim_list2(G,N,Ds)]. - - - -%% Array dimension string -%arrayDim(G,N,X) -> -% arrayDim2(G,N,X#array.size). - -%arrayDim2(_G,_N,[]) -> -% ""; -%arrayDim2(G,N,[D|Ds]) when record(D,scoped_id) -> -% {FSN, _, _, _} = ic_symtab:get_full_scoped_name(G, N, D), -% "[" ++ ic_util:to_dot(G,FSN) ++ "]" ++ arrayDim2(G,N,Ds); -%arrayDim2(G,N,[D|Ds]) -> -% "[" ++ ic_util:eval_java(G,N,D) ++ "]" ++ arrayDim2(G,N,Ds). - - -%% Array Empty dimension string -arrayEmptyDim(X) -> - arrayEmptyDim2(X#array.size). - -arrayEmptyDim2([_D]) -> - "[]"; -arrayEmptyDim2([_D |Ds]) -> - "[]" ++ arrayEmptyDim2(Ds). - - -emit_array_dimensions([_D],C,Fd) -> - ic_codegen:emit(Fd, "[_tmp~p]",[C]); -emit_array_dimensions([_D|Ds],C,Fd) -> - ic_codegen:emit(Fd, "[_tmp~p]",[C]), - emit_array_dimensions(Ds,C+1,Fd). - - - - - - diff --git a/lib/ic/src/ic_attribute_java.erl b/lib/ic/src/ic_attribute_java.erl deleted file mode 100644 index ddbc6d24f5..0000000000 --- a/lib/ic/src/ic_attribute_java.erl +++ /dev/null @@ -1,413 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(ic_attribute_java). - --include("icforms.hrl"). --include("ic.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([emit_attribute_prototype/4, - emit_attribute_stub_code/4, - emit_atrribute_on_dictionary/5, - emit_attribute_switch_case/5]). - - - - - -%%%----------------------------------------------------- -%%% -%%% Generates operation in interface -%%% -%%%----------------------------------------------------- -emit_attribute_prototype(G, N, X, Fd) -> - emit_attribute_prototype(G, N, X, Fd, ic_forms:get_idlist(X)). - -emit_attribute_prototype(_G, _N, _X, _Fd, []) -> - ok; -emit_attribute_prototype(G, N, X, Fd, [V|Vs]) -> - WireAttrName = ic_forms:get_id(V), - AttrName = ic_forms:get_java_id(WireAttrName), - emit_attr_prototype(G, N, X, Fd, AttrName,WireAttrName), - emit_attribute_prototype(G, N, X, Fd, Vs). - - -emit_attr_prototype(G, N, X, Fd, OpName, WireOpName) -> - - ic_codegen:emit(Fd, "/****\n"), - ic_codegen:emit(Fd, " * Attribute ~p interface functions \n", [ic_util:to_colon([WireOpName|N])]), - ic_codegen:emit(Fd, " *\n"), - ic_codegen:emit(Fd, " */\n\n"), - - AT = ic_forms:get_type(X), - Type = ic_java_type:getType(G, N, AT), -% HolderType = ic_java_type:getHolderType(G, N, AT), - - ic_codegen:emit(Fd, " ~s ~s() throws java.lang.Exception;\n\n",[Type, OpName]), - - case X#attr.readonly of - {readonly, _} -> - ok; - _ -> - ic_codegen:emit(Fd, " void ~s(~s _value) throws java.lang.Exception;\n\n",[OpName, Type]) - end. - - - -%%%----------------------------------------------------- -%%% -%%% Generates attribute insertion in dictionary -%%% -%%%----------------------------------------------------- -emit_atrribute_on_dictionary(G, N, X, Fd, C) -> - emit_atrribute_on_dictionary(G, N, X, Fd, C, ic_forms:get_idlist(X)). - -emit_atrribute_on_dictionary(_G, _N, _X, _Fd, C, []) -> - C; -emit_atrribute_on_dictionary(G, N, X, Fd, C, [V|Vs]) -> - - WireAttrName = ic_forms:get_id(V), - - ic_codegen:emit(Fd, " _operations.put(\"_get_~s\", new java.lang.Integer(~p));\n", - [WireAttrName,C]), - - case X#attr.readonly of - {readonly, _} -> - - emit_atrribute_on_dictionary(G, N, X, Fd, C+1, Vs); - - _ -> - - ic_codegen:emit(Fd, " _operations.put(\"_set_~s\", new java.lang.Integer(~p));\n", - [WireAttrName,C+1]), - - emit_atrribute_on_dictionary(G, N, X, Fd, C+2, Vs) - end. - - - -%%%----------------------------------------------------- -%%% -%%% Generates attribute case in server switch -%%% -%%%----------------------------------------------------- -emit_attribute_switch_case(G, N, X, Fd, C) -> - Tk = ic_forms:get_tk(X), - emit_attribute_switch_case(G, N, X, Fd, Tk, C, ic_forms:get_idlist(X)). - -emit_attribute_switch_case(_G, _N, _X, _Fd, _Tk, C, []) -> - C; -emit_attribute_switch_case(G, N, X, Fd, Tk, C, [V|Vs]) -> - AttrName = ic_forms:get_java_id(V), - - emit_attribute_switch_case1(G,N,X,Fd,"_get_",AttrName,Tk,C), - - case X#attr.readonly of - {readonly, _} -> - emit_attribute_switch_case(G, N, X, Fd, Tk, C+1, Vs); - - _ -> - emit_attribute_switch_case1(G,N,X,Fd,"_set_",AttrName,Tk,C+1), - emit_attribute_switch_case(G, N, X, Fd, Tk, C+2, Vs) - end. - - -emit_attribute_switch_case1(G, N, X, Fd, "_get_", Name, _Tk, C) -> - - R = ic_forms:get_type(X), - RT = ic_java_type:getParamType(G,N,R,ret), - - ic_codegen:emit(Fd, " case ~p: { // Get operation for attribute ~s\n\n",[C,ic_util:to_dot([Name|N])]), - - ic_codegen:emit(Fd, " // Calling implementation function\n"), - ic_codegen:emit(Fd, " ~s _result = this.~s();\n\n", [RT, Name]), - - ic_codegen:emit(Fd, " // Marshalling output\n"), - ic_codegen:emit(Fd, " ~sOtpErlangRef __ref = __env.getSref();\n",[?ERLANGPACKAGE]), - ic_codegen:emit(Fd, " __os.write_tuple_head(2);\n"), - ic_codegen:emit(Fd, " __os.write_ref(__ref.node(),__ref.id(),__ref.creation()); // Call reference\n"), - - case ic_java_type:isBasicType(G,N,R) of - true -> - ic_codegen:emit(Fd, " __os~s(_result); // Return value\n\n", - [ic_java_type:marshalFun(G,N,X,R)]); - false -> - ic_codegen:emit(Fd, " ~s(__os,_result); // Return value\n\n", - [ic_java_type:marshalFun(G,N,X,R)]) - end, - - ic_codegen:emit(Fd, " } break;\n\n"); - - -emit_attribute_switch_case1(G, N, X, Fd, "_set_", Name, _Tk, C) -> - ic_codegen:emit(Fd, " case ~p: { // Set operation for attribute ~s\n\n",[C,ic_util:to_dot([Name|N])]), - - Type = ic_forms:get_type(X), - - ic_codegen:emit(Fd, " // Preparing input\n"), - ic_codegen:emit(Fd, " ~sOtpInputStream __is = __env.getIs();\n",[?ERLANGPACKAGE]), - - case ic_java_type:isBasicType(G,N,Type) of - true -> - ic_codegen:emit(Fd, " ~s _value = __is~s; // In value\n\n", - [ic_java_type:getParamType(G,N,Type,in), - ic_java_type:unMarshalFun(G,N,X,Type)]); - false -> - ic_codegen:emit(Fd, " ~s _value = ~s.unmarshal(__is); // In value\n\n", - [ic_java_type:getParamType(G,N,Type,in), - ic_java_type:getUnmarshalType(G,N,X,Type)]) - end, - - - ic_codegen:emit(Fd, " // Calling implementation function\n"), - ic_codegen:emit(Fd, " this.~s(_value);\n\n", [Name]), - - ic_codegen:emit(Fd, " // Marshalling output\n"), - ic_codegen:emit(Fd, " ~sOtpErlangRef __ref = __env.getSref();\n",[?ERLANGPACKAGE]), - ic_codegen:emit(Fd, " __os.write_tuple_head(2);\n"), - ic_codegen:emit(Fd, " __os.write_ref(__ref.node(),__ref.id(),__ref.creation()); // Call reference\n"), - ic_codegen:emit(Fd, " __os.write_atom(\"ok\");\n\n"), - - ic_codegen:emit(Fd, " } break;\n\n"). - - - - - - - -%%%----------------------------------------------------- -%%% -%%% Generates attribute function in stub -%%% -%%%----------------------------------------------------- -emit_attribute_stub_code(G, N, X, Fd) -> - emit_attribute_stub_code(G, N, X, Fd, ic_forms:get_idlist(X)). - -emit_attribute_stub_code(_G, _N, _X, _Fd, []) -> - ok; -emit_attribute_stub_code(G, N, X, Fd, [V|Vs]) -> - WireAttrName = ic_forms:get_id(V), - AttrName = ic_forms:get_java_id(WireAttrName), - - emit_attribute_stub_code1(G,N,X,Fd,"_get_",AttrName,WireAttrName), - - case X#attr.readonly of - {readonly, _} -> - emit_attribute_stub_code(G, N, X, Fd, Vs); - - _ -> - emit_attribute_stub_code1(G,N,X,Fd,"_set_",AttrName,WireAttrName), - emit_attribute_stub_code(G, N, X, Fd, Vs) - end. - - -emit_attribute_stub_code1(G,N,X,Fd,"_get_",Name,WireName) -> - - Type = ic_forms:get_type(X), - RT = ic_java_type:getType(G,N,Type), - - %% - %% Main get operation - %% - ic_codegen:emit(Fd, " // Attribute ~p get operation implementation\n", [ic_util:to_colon([WireName|N])]), - ic_codegen:emit(Fd, " public ~s ~s() throws java.lang.Exception {\n\n", [RT, Name]), - - %% Function marshal call - ic_codegen:emit(Fd, " // Calling the marshal function\n"), - ic_codegen:emit(Fd, " _~s_marshal(_env);\n\n", [Name]), - - %% Sending call - ic_codegen:emit(Fd, " // Message send\n"), - ic_codegen:emit(Fd, " _env.send();\n\n"), - - %% Receiving return value - ic_codegen:emit(Fd, " // Message receive\n"), - ic_codegen:emit(Fd, " _env.receive();\n\n"), - - ic_codegen:emit(Fd, " // Calling the unmarshal function\n"), - ic_codegen:emit(Fd, " return _~s_get_unmarshal(_env);\n", [Name]), - ic_codegen:emit(Fd, " }\n\n"), - - - %% - %% Marshal get operation - %% - ic_codegen:emit(Fd, " // Marshal operation for get attribute ~p\n", [Name]), - ic_codegen:emit(Fd, " public static void _~s_marshal(~sEnvironment __env)\n", - [Name, ?ICPACKAGE]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n\n"), - - ic_codegen:emit(Fd, " // Get output stream\n"), - ic_codegen:emit(Fd, " ~sOtpOutputStream __os = __env.getOs();\n\n",[?ERLANGPACKAGE]), - - %% Initiating Message header - ic_codegen:emit(Fd, " // Message header assembly\n"), - ic_codegen:emit(Fd, " __os.reset();\n"), - ic_codegen:emit(Fd, " __os.write_tuple_head(3);\n"), - ic_codegen:emit(Fd, " __os.write_atom(\"$gen_call\");\n\n"), - - - %% Creating call identity tuple - ic_codegen:emit(Fd, " // Message identity part creation\n"), - ic_codegen:emit(Fd, " __os.write_tuple_head(2);\n"), - ic_codegen:emit(Fd, " __env.write_client_pid();\n"), - ic_codegen:emit(Fd, " __env.write_client_ref();\n\n"), - - OpCallName = case ic_options:get_opt(G, scoped_op_calls) of - true -> - ic_util:to_undersc(["_get_"++WireName|N]); - false -> - "_get_"++WireName - end, - - %% Creating operation identity - ic_codegen:emit(Fd, " // Message operation part creation\n"), - ic_codegen:emit(Fd, " __os.write_atom(~p);\n\n",[OpCallName]), - - ic_codegen:emit(Fd, " }\n\n"), - - - %% - %% Unmarshal get operation - %% - MRT = ic_java_type:getParamType(G,N,Type,ret), - - ic_codegen:emit(Fd, " // Unmarshal operation for get attribute ~p\n", [Name]), - ic_codegen:emit(Fd, " public static ~s _~s_get_unmarshal(~sEnvironment __env)\n", - [MRT, Name, ?ICPACKAGE]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n\n"), - - - ic_codegen:emit(Fd, " // Get input stream\n"), - ic_codegen:emit(Fd, " ~sOtpInputStream __is = __env.getIs();\n\n",[?ERLANGPACKAGE]), - - ic_codegen:emit(Fd, " // Extracting return value\n"), - case ic_java_type:isBasicType(G, N, Type) of - true -> - ic_codegen:emit(Fd, " return __is~s;\n", - [ic_java_type:unMarshalFun(G, N, X, Type)]); - false -> - ic_codegen:emit(Fd, " return ~s.unmarshal(__is);\n", - [ic_java_type:getUnmarshalType(G, N, X, Type)]) - end, - - ic_codegen:emit(Fd, " }\n\n"); - - -emit_attribute_stub_code1(G,N,X,Fd,"_set_",Name,WireName) -> - - Type = ic_forms:get_type(X), - - %% - %% Main set operation - %% - IT = ic_java_type:getType(G,N,Type), - - ic_codegen:emit(Fd, " // Attribute ~p set operation implementation\n", [ic_util:to_colon([WireName|N])]), - ic_codegen:emit(Fd, " public void ~s(~s _value) throws java.lang.Exception {\n\n", [Name,IT]), - - %% Function marshal call - ic_codegen:emit(Fd, " // Calling the marshal function\n"), - ic_codegen:emit(Fd, " _~s_marshal(_env, _value);\n\n", [Name]), - - %% Sending call - ic_codegen:emit(Fd, " // Message send\n"), - ic_codegen:emit(Fd, " _env.send();\n\n"), - - %% Receiving return value - ic_codegen:emit(Fd, " // Message receive\n"), - ic_codegen:emit(Fd, " _env.receive();\n\n"), - - ic_codegen:emit(Fd, " // Calling the unmarshal function\n"), - ic_codegen:emit(Fd, " _~s_set_unmarshal(_env);\n", [Name]), - - ic_codegen:emit(Fd, " }\n\n"), - - - %% - %% Marshal set operation - %% - IP = ic_java_type:getParamType(G, N, Type, in), - OpCallName = case ic_options:get_opt(G, scoped_op_calls) of - true -> - ic_util:to_undersc(["_set_"++WireName|N]); - false -> - "_set_"++WireName - end, - - ic_codegen:emit(Fd, " // Marshal operation for set attribute ~p\n", [Name]), - ic_codegen:emit(Fd, " public static void _~s_marshal(~sEnvironment __env, ~s _value)\n", - [Name, ?ICPACKAGE, IP]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n\n"), - - ic_codegen:emit(Fd, " // Get output stream\n"), - ic_codegen:emit(Fd, " ~sOtpOutputStream __os = __env.getOs();\n\n",[?ERLANGPACKAGE]), - - %% Initiating Message header - ic_codegen:emit(Fd, " // Message header assembly\n"), - ic_codegen:emit(Fd, " __os.reset();\n"), - ic_codegen:emit(Fd, " __os.write_tuple_head(3);\n"), - ic_codegen:emit(Fd, " __os.write_atom(\"$gen_call\");\n\n"), - - - %% Creating call identity tuple - ic_codegen:emit(Fd, " // Message identity part creation\n"), - ic_codegen:emit(Fd, " __os.write_tuple_head(2);\n"), - ic_codegen:emit(Fd, " __env.write_client_pid();\n"), - ic_codegen:emit(Fd, " __env.write_client_ref();\n\n"), - - - %% Creating operation identity - ic_codegen:emit(Fd, " // Message operation part creation\n"), - ic_codegen:emit(Fd, " __os.write_tuple_head(2);\n"), - ic_codegen:emit(Fd, " __os.write_atom(~p);\n",[OpCallName]), - - case ic_java_type:isBasicType(G, N, Type) of - true -> - ic_codegen:emit(Fd, " __os~s(_value);\n\n", - [ic_java_type:marshalFun(G, N, X, Type)]); - false -> - ic_codegen:emit(Fd, " ~s(__os, _value);\n\n", - [ic_java_type:marshalFun(G, N, X, Type)]) - end, - ic_codegen:emit(Fd, " }\n\n"), - - - ic_codegen:emit(Fd, " // Unmarshal operation for set attribute ~p\n", [Name]), - ic_codegen:emit(Fd, " public static void _~s_set_unmarshal(~sEnvironment __env)\n", - [Name, ?ICPACKAGE]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n\n"), - - ic_codegen:emit(Fd, " // Get input stream\n"), - ic_codegen:emit(Fd, " ~sOtpInputStream __is = __env.getIs();\n\n",[?ERLANGPACKAGE]), - - ic_codegen:emit(Fd, " __is.read_atom();\n"), - ic_codegen:emit(Fd, " }\n\n"). - - - - - - diff --git a/lib/ic/src/ic_cbe.erl b/lib/ic/src/ic_cbe.erl deleted file mode 100644 index f6e64d23a0..0000000000 --- a/lib/ic/src/ic_cbe.erl +++ /dev/null @@ -1,1307 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - -%%------------------------------------------------------------ -%% -%% This module is a main module for generation of C code, both -%% for ic_cclient and ic_cserver. -%% -%% The former role of this module (ic_cbe) was to generate client -%% code only. -%% --module(ic_cbe). - --export([emit_malloc_size_stmt/7, emit_encoding_stmt/6, - emit_encoding_stmt/7, emit_decoding_stmt/10, - emit_decoding_stmt/11, emit_dealloc_stmts/3, - mk_variable_name/1, mk_c_type/3, mk_c_type/4, mk_c_type2/3, - is_variable_size/1, is_variable_size/3, mk_dim/1, - mk_slice_dim/1, emit_tmp_variables/1, store_tmp_decl/2, - extract_info/3, normalize_type/1]). - -%%------------------------------------------------------------ -%% -%% Internal stuff -%% -%%------------------------------------------------------------ - --import(ic_codegen, [emit/2, emit/3, emit/4, emit_c_enc_rpt/4, emit_c_dec_rpt/4]). - --include("icforms.hrl"). --include ("ic.hrl"). - -%%------------------------------------------------------------ -%% ENCODING -%%------------------------------------------------------------ - -emit_encoding_stmt(G, N, Fd, T, LName, OutBuffer) when element(1, T) == scoped_id -> - case mk_c_type(G, N, T, evaluate_not) of - "erlang_pid" -> - %% Note prefix: oe_ei - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_pid(oe_env, ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"); - "erlang_port" -> - %% Note prefix: oe_ei - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_port(oe_env, ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n} \n"); - "erlang_ref" -> - %% Note prefix: oe_ei - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_ref(oe_env, ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"); - "ETERM*" -> - %% Note prefix: oe_ei - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_term(oe_env, ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"); - {enum, FSN} -> - emit_encoding_stmt(G, N, Fd, FSN, LName, OutBuffer); - FSN -> - emit_encoding_stmt(G, N, Fd, FSN, LName, OutBuffer) - end; - -%% XXX T is a string -emit_encoding_stmt(G, N, Fd, T, LName, _OutBuffer) when is_list(T) -> - %% Already a fullscoped name - Type = ictype:name2type(G,T), - case ictype:isBasicType(Type) of - true -> - emit_encoding_stmt_for_basic_type(G, N, T, Fd, Type, LName); - false -> - emit(Fd, " if ((oe_error_code = ~s~s(oe_env, ~s))" - " < 0) {\n", - [ic_util:mk_oe_name(G, "encode_"), T, LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), % XXX list - emit(Fd, " return oe_error_code;\n }\n") - end; -emit_encoding_stmt(G, N, Fd, T, LName, _OutBuffer) when is_record(T, string) -> - %% Note prefix: oe_ei - emit(Fd, " if ((oe_error_code = oe_ei_encode_string(oe_env, " - " ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"); -emit_encoding_stmt(G, N, Fd, T, LName, _OutBuffer) when is_record(T, wstring) -> - %% Note prefix: oe_ei - emit(Fd, " if ((oe_error_code = oe_ei_encode_wstring(oe_env, " - "~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"); -emit_encoding_stmt(G, N, Fd, T, LName, _OutBuffer) -> - case normalize_type(T) of - {basic, Type} -> - emit_encoding_stmt_for_basic_type(G, N, T, Fd, Type, LName); - %% XXX Why only returns? - {void, _} -> - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"); - {sequence, _, _} -> - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"); - {_ArrayType, {array, _, _}} -> - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"); - {union, _, _, _, _} -> - %% Union as a member in struct ! - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"); - {struct, _, _, _} -> - %% Struct as a member in struct ! - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"); - _ -> - ic_error:fatal_error(G, {illegal_typecode_for_c, T, N}) - end. - -%% Arity = 7. -%% -emit_encoding_stmt(G, N, X, Fd, T, LName, OutBuffer) when element(1, T) == scoped_id -> - case mk_c_type(G, N, T, evaluate_not) of - "erlang_pid" -> - %% Note prefix: oe_ei - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_pid(oe_env, ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"); - "erlang_port" -> - %% Note prefix: oe_ei - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_port(oe_env, ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"); - "erlang_ref" -> - %% Note prefix: oe_ei - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_ref(oe_env, ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"); - "ETERM*" -> - %% Note prefix: oe_ei - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_term(oe_env, ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"); - {enum, FSN} -> - emit_encoding_stmt(G, N, X, Fd, FSN, LName, OutBuffer); - FSN -> - emit_encoding_stmt(G, N, X, Fd, FSN, LName, OutBuffer) - end; - -%% XXX T is a string -emit_encoding_stmt(G, N, X, Fd, T, LName, _OutBuffer) when is_list(T) -> - %% Already a fullscoped name - case get_param_tk(LName,X) of - error -> - emit(Fd, " if ((oe_error_code = " - "~s~s(oe_env, ~s)) < 0) {\n", - [ic_util:mk_oe_name(G, "encode_"), T, LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"); - ParamTK -> - case is_variable_size(ParamTK) of - true -> - if is_tuple(ParamTK) -> - case element(1,ParamTK) of - tk_array -> - %% Array of dynamic data - emit(Fd, - " if ((oe_error_code = " - "~s~s(oe_env, ~s)) < 0) {\n", - [ic_util:mk_oe_name(G, - "encode_"), - T, LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, - " return " - "oe_error_code;\n }\n"); - _ -> - emit(Fd, - " if ((oe_error_code = " - "~s~s(oe_env, ~s)) < 0) {\n", - [ic_util:mk_oe_name(G, - "encode_"), - T, LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return " - "oe_error_code;\n }\n") - end; - true -> - emit(Fd, - " if ((oe_error_code = " - "~s~s(oe_env, ~s)) < 0) {\n", - [ic_util:mk_oe_name(G, "encode_"), - T, LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n") - end; - false -> - if is_atom(ParamTK) -> - case normalize_type(ParamTK) of - {basic, Type} -> - emit_encoding_stmt_for_basic_type(G, N, T, Fd, - Type, - LName); - _ -> - %% Why only return? - ?emit_c_enc_rpt(Fd, " ", "~/slist/~s", [T, LName]), - emit(Fd, " return oe_error_code;\n }\n"), - ok - end; - true -> - case element(1,ParamTK) of - tk_enum -> - emit(Fd, " if ((oe_error_code = " - "~s~s(oe_env, ~s)) < 0) {\n", - [ic_util:mk_oe_name(G, "encode_"), - T, LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"); - tk_array -> - emit(Fd, " if ((oe_error_code = " - "~s~s(oe_env, ~s)) < 0) {\n", - [ic_util:mk_oe_name(G, "encode_"), - T, LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"); - tk_struct -> - emit(Fd, " if ((oe_error_code = " - "~s~s(oe_env, ~s)) < 0) {\n", - [ic_util:mk_oe_name(G, "encode_"), - T, LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"); - tk_union -> - emit(Fd, " if ((oe_error_code = " - "~s~s(oe_env, ~s)) < 0) {\n", - [ic_util:mk_oe_name(G, "encode_"), - T, LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"); - _ -> - emit(Fd, " if ((oe_error_code = " - "~s~s(oe_env, &~s)) < 0) {\n", - [ic_util:mk_oe_name(G, "encode_"), - T, LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n") - end - end - end - end; -emit_encoding_stmt(G, N, _X, Fd, T, LName, _OutBuffer) when is_record(T, string) -> - %% Note prefix: oe_ei - emit(Fd, " if ((oe_error_code = oe_ei_encode_string(oe_env, ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"); -emit_encoding_stmt(G, N, _X, Fd, T, LName, _OutBuffer) when is_record(T, wstring) -> - %% Note prefix: oe_ei - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_wstring(oe_env, ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"); -emit_encoding_stmt(G, N, _X, Fd, T, LName, _OutBuffer) -> - case normalize_type(T) of - {basic, Type} -> - emit_encoding_stmt_for_basic_type(G, N, T, Fd, Type, LName); - {void, _} -> - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"), - ok; - {sequence, _, _} -> - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"), - ok; - {_ArrayType, {array, _, _}} -> - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"), - ok; - {struct, _, _, _} -> %% Struct as a member in struct ! - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"), - ok; - _ -> - %%io:format("2 ------------> ~p~n", [T]), - ic_error:fatal_error(G, {illegal_typecode_for_c, T, N}) - end. - -%%------------------------------------------------------------ -emit_encoding_stmt_for_basic_type(G, N, T, Fd, Type, LName) -> - {Cast, DecType} = - case Type of - ushort -> {"(unsigned long) ", "ulong"}; - ulong -> {"", "ulong"}; - ulonglong -> {"", "ulonglong"}; - short -> {"(long) ", "long"}; - long -> {"", "long"}; - longlong -> {"", "longlong"}; - float -> {"(double) ", "double"}; - double -> {"", "double"}; - boolean -> {"", "atom"}; - char -> {"", "char"}; - wchar -> {"", "wchar"}; - octet -> {"", "char"}; - any -> {"", "long"} % Fix for any - end, - case Type of - boolean -> - %% Note prefix: oe_ei - emit(Fd, " switch(~s) {\n",[LName]), - emit(Fd, " case 0 :\n"), - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_atom(oe_env, " - "\"false\")) < 0) {\n"), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " break;\n"), - emit(Fd, " case 1 :\n"), - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_atom(oe_env, " - "\"true\")) < 0) {\n"), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " break;\n"), - emit(Fd, " default :\n"), - emit(Fd, " return -1;\n"), - emit(Fd, " }\n\n"); - _ -> - Fmt = - " if ((oe_error_code = oe_ei_encode_~s(oe_env, ~s~s)) < 0) {\n", - emit(Fd, Fmt, [DecType, Cast, LName]), - ?emit_c_enc_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n }\n") - end. - - -%%------------------------------------------------------------ -%% MALLOC SIZE (for Decode) -%%------------------------------------------------------------ - -emit_malloc_size_stmt(G, N, Fd, T, InBuffer, - Align, CalcType) when element(1, T) == scoped_id -> - case mk_c_type(G, N, T, evaluate_not) of - "erlang_pid" -> - emit(Fd, " oe_malloc_size += sizeof(erlang_pid);\n\n"), - emit(Fd, " if ((oe_error_code = ei_decode_pid(~s, " - "oe_size_count_index, NULL)) < 0) {\n", [InBuffer]), - ?emit_c_dec_rpt(Fd, " ", "erlang_pid", []), - emit(Fd, " return oe_error_code;\n }\n"); - "erlang_port" -> - emit(Fd, " oe_malloc_size += sizeof(erlang_port);\n\n"), - emit(Fd, " if ((oe_error_code = ei_decode_port(~s, " - "oe_size_count_index, NULL)) < 0) {\n", [InBuffer]), - ?emit_c_dec_rpt(Fd, " ", "erlang_port", []), - emit(Fd, " return oe_error_code;\n }\n"); - "erlang_ref" -> - emit(Fd, " oe_malloc_size += sizeof(erlang_ref);\n\n"), - emit(Fd, " if ((oe_error_code = ei_decode_ref(~s, " - "oe_size_count_index, NULL)) < 0) {\n", [InBuffer]), - ?emit_c_dec_rpt(Fd, " ", "erlang_ref", []), - emit(Fd, " return oe_error_code;\n }\n"); - "ETERM*" -> - emit(Fd, " oe_malloc_size += sizeof(char*);\n\n"), - emit(Fd, " if ((oe_error_code = ei_decode_term(~s, " - "oe_size_count_index, NULL)) < 0) {\n", [InBuffer]), - ?emit_c_dec_rpt(Fd, " ", "ETERM*", []), - emit(Fd, " return oe_error_code;\n }\n"); - {enum, FSN} -> - emit_malloc_size_stmt(G, N, Fd, FSN, InBuffer, Align, CalcType); - FSN -> - %% io:format("emit_malloc_size_stmt: ~p ~p~n",[FSN, - %% CalcType]), - emit_malloc_size_stmt(G, N, Fd, FSN, InBuffer, Align, CalcType) - end; - -%% XXX T is a string -emit_malloc_size_stmt(G, N, Fd, T, InBuffer, - _Align, CalcType) when is_list(T) -> - %% Already a fullscoped name - Type = ictype:name2type(G,T), - case ictype:isBasicType(Type) of - true -> - emit_malloc_size_stmt_for_basic_type(G, N, T, Fd, Type, InBuffer); - false -> - case CalcType of - generator -> - emit(Fd, " if ((oe_error_code = ~s~s(oe_env, " - "oe_size_count_index, &oe_malloc_size)) < 0) {\n", - [ic_util:mk_oe_name(G, "sizecalc_"), T]), - ?emit_c_dec_rpt(Fd, " ", "~s", [T]), - emit(Fd, " return oe_error_code;\n }\n"); - _ -> - emit(Fd, " if ((oe_error_code = ~s~s(oe_env, " - "&oe_size_count_index, &oe_malloc_size)) < 0) {\n", - [ic_util:mk_oe_name(G, "sizecalc_"), T]), - ?emit_c_dec_rpt(Fd, " ", "~s", [T]), - emit(Fd, " return oe_error_code;\n }\n") - end - end; -emit_malloc_size_stmt(G, N, Fd, T, InBuffer, _Align, - CalcType) when is_record(T, string) -> - Tname = mk_variable_name(op_variable_count), - store_tmp_decl(" int ~s = 0;\n",[Tname]), - case CalcType of - generator -> - emit(Fd, " if ((oe_error_code = ei_get_type(~s, " - "oe_size_count_index, &oe_type, &~s)) < 0) {\n", - [InBuffer, Tname]); - _ -> - emit(Fd, " int oe_type = 0;\n"), - emit(Fd, " int oe_temp = 0;\n\n"), - emit(Fd, " if ((oe_error_code = ei_get_type(~s, " - "&oe_size_count_index, &oe_type, &oe_temp)) < 0) {\n", - [InBuffer]) - end, - ?emit_c_dec_rpt(Fd, " ", "ei_get_type", []), - emit(Fd, " return oe_error_code;\n }\n"), - if - T#string.length == 0 -> - ok; - true -> - Length = ic_util:eval_c(G, N, T#string.length), - case CalcType of - generator -> - emit(Fd, " if (~s > ~s)\n",[Tname, Length]), - emit(Fd, " return -1;\n\n"); - _ -> - emit(Fd, " if (oe_temp > ~s)\n",[Length]), - emit(Fd, " return -1;\n\n") - end - end, - case CalcType of - generator -> - emit(Fd, " if ((oe_error_code = ei_decode_string(~s, " - "oe_size_count_index, NULL)) < 0) {\n", [InBuffer]); - _ -> - emit(Fd, " if ((oe_error_code = ei_decode_string(~s, " - "&oe_size_count_index, NULL)) < 0) {\n", [InBuffer]) - end, - ?emit_c_dec_rpt(Fd, " ", "ei_decode_string", []), - emit(Fd, " return oe_error_code;\n }\n"), - case CalcType of - generator -> - emit(Fd, " oe_malloc_size = ~s;\n\n", - [ic_util:mk_align("oe_malloc_size + " ++ Tname ++"+1")]); - _ -> - emit(Fd, " oe_malloc_size = ~s;\n\n", - [ic_util:mk_align("oe_malloc_size + oe_temp+1")]) - end; -emit_malloc_size_stmt(G, N, Fd, T, InBuffer, _Align, - CalcType) when is_record(T, wstring) -> - Tname = mk_variable_name(op_variable_count), - store_tmp_decl(" int ~s = 0;\n",[Tname]), - case CalcType of - generator -> - emit(Fd, " if ((oe_error_code = ei_get_type(~s, " - "oe_size_count_index, &oe_type, &~s)) < 0) {\n", - [InBuffer, Tname]); - _ -> - emit(Fd, " int oe_type = 0;\n"), - emit(Fd, " int oe_temp = 0;\n\n"), - emit(Fd, " if ((oe_error_code = ei_get_type(~s, " - "&oe_size_count_index, &oe_type, &oe_temp)) < 0) {\n", - [InBuffer]) - end, - ?emit_c_dec_rpt(Fd, " ", "ei_get_type", []), - emit(Fd, " return oe_error_code;\n }\n"), - if - T#wstring.length == 0 -> - ok; - true -> - Length = ic_util:eval_c(G, N, T#wstring.length), - case CalcType of - generator -> - emit(Fd, " if (~s > ~s)\n",[Tname, Length]), - emit(Fd, " return -1;\n\n"); - _ -> - emit(Fd, " if (oe_temp > ~s)\n",[Length]), - emit(Fd, " return -1;\n\n") - end - end, - case CalcType of - generator -> - %% Note prefix: oe_ei - emit(Fd, " if ((oe_error_code = oe_ei_decode_wstring(~s, " - "oe_size_count_index, NULL)) < 0) {\n", [InBuffer]); - _ -> - %% Note prefix: oe_ei - emit(Fd, " if ((oe_error_code = oe_ei_decode_wstring(~s, " - "&oe_size_count_index, NULL)) < 0) {\n", [InBuffer]) - end, - ?emit_c_dec_rpt(Fd, " ", "oe_ei_decode_wstring", []), - emit(Fd, " return oe_error_code;\n }\n"), - case CalcType of - generator -> - emit(Fd, " oe_malloc_size =\n ~s;\n\n", - [ic_util:mk_align("oe_malloc_size + ((" - ++ Tname - ++"+ 1) * __OE_WCHAR_SIZE_OF__)")]); - _ -> - emit(Fd, " oe_malloc_size =\n ~s;\n\n", - [ic_util:mk_align("oe_malloc_size + ((" - "oe_temp + 1) * __OE_WCHAR_SIZE_OF__)")]) - end; -emit_malloc_size_stmt(G, N, Fd, T, InBuffer, Align, CalcType) -> - case Align of - 0 -> - emit(Fd, " oe_malloc_size += sizeof(~s);\n\n", - [mk_c_type(G, N, T)]); - _ -> - ok - end, - case normalize_type(T) of - {basic, Type} -> - emit_malloc_size_stmt_for_basic_type(G, N, T, Fd, Type, InBuffer); - {void, _} -> - ok; - {sequence, _, _} -> - ok; - {_, {array, SId, _}} -> - case CalcType of - generator -> - emit(Fd, " if ((oe_error_code = ~s~s(oe_env, " - "oe_size_count_index, &oe_malloc_size)) < 0) {\n", - [ic_util:mk_oe_name(G, "sizecalc_"), - ic_forms:get_id2(SId)]), - ?emit_c_dec_rpt(Fd, " ", "array1", []), - emit(Fd, " return oe_error_code;\n\n"); - _ -> - emit(Fd, " if ((oe_error_code = ~s~s(oe_env, " - "&oe_size_count_index, &oe_malloc_size)) < 0) {\n", - [ic_util:mk_oe_name(G, "sizecalc_"), - ic_forms:get_id2(SId)]), - ?emit_c_dec_rpt(Fd, " ", "array2", []), - emit(Fd, " return oe_error_code;\n\n") - end; - {union, UId, _, _, _} -> - case CalcType of - generator -> - emit(Fd, " if ((oe_error_code = ~s~s(oe_env, " - "oe_size_count_index, &oe_malloc_size)) < 0) {\n", - [ic_util:mk_oe_name(G, "sizecalc_"), - ic_forms:get_id2(UId)]), - ?emit_c_dec_rpt(Fd, " ", "union1", []), - emit(Fd, " return oe_error_code;\n\n"); - _ -> - emit(Fd, " if ((oe_error_code = ~s~s(oe_env, " - "&oe_size_count_index, &oe_malloc_size)) < 0) {\n", - [ic_util:mk_oe_name(G, "sizecalc_"), - ic_forms:get_id2(UId)]), - ?emit_c_dec_rpt(Fd, " ", "union2", []), - emit(Fd, " return oe_error_code;\n\n") - end; - {struct, UId, _, _} -> %% Struct as a member in struct ! - case CalcType of - generator -> - emit(Fd, " if ((oe_error_code = ~s~s(oe_env, " - "oe_size_count_index, &oe_malloc_size)) < 0) {\n", - [ic_util:mk_oe_name(G, "sizecalc_"), - ic_forms:get_id2(UId)]), - ?emit_c_dec_rpt(Fd, " ", "struct1", []), - emit(Fd, " return oe_error_code;\n\n"); - _ -> - emit(Fd, " if ((oe_error_code = ~s~s(oe_env, " - "&oe_size_count_index, &oe_malloc_size)) < 0) {\n", - [ic_util:mk_oe_name(G, "sizecalc_"), - ic_forms:get_id2(UId)]), - ?emit_c_dec_rpt(Fd, " ", "struct2", []), - emit(Fd, " return oe_error_code;\n\n") - end; - {any, _} -> %% Fix for any type - emit(Fd, " if ((oe_error_code = ei_decode_long(~s, " - "oe_size_count_index, NULL)) < 0) {\n", - [InBuffer]), - ?emit_c_dec_rpt(Fd, " ", "any", []), - emit(Fd, " return oe_error_code;\n }\n"); - _ -> - ic_error:fatal_error(G, {illegal_typecode_for_c, T, N}) - end. - -%%------------------------------------------------------------ - -emit_malloc_size_stmt_for_basic_type(G, N, T, Fd, Type, InBuffer) -> - {Pre, DecType} = - case Type of - ushort -> {"", "ulong"}; - ulong -> {"", "ulong"}; - ulonglong -> {"oe_", "ulonglong"}; - short -> {"", "long"}; - long -> {"", "long"}; - longlong -> {"oe_", "longlong"}; - float -> {"", "double"}; - double -> {"", "double"}; - boolean -> {"", "atom"}; - char -> {"", "char"}; - wchar -> {"oe_", "wchar"}; - octet -> {"", "char"}; - any -> {"", "long"} - end, - Fmt = - " if ((oe_error_code = ~sei_decode_~s(~s, oe_size_count_index, " - "NULL)) < 0) {\n", - emit(Fd, Fmt, [Pre, DecType, InBuffer]), - ?emit_c_dec_rpt(Fd, " ", "~s", [DecType]), - emit(Fd, " return oe_error_code;\n }\n"). - -%%------------------------------------------------------------ -%% DECODING -%%------------------------------------------------------------ - -emit_decoding_stmt(G, N, Fd, T, LName, IndOp, InBuffer, Align, - NextPos, DecType) -> - emit_decoding_stmt(G, N, Fd, T, LName, IndOp, InBuffer, Align, - NextPos, DecType, []). - -emit_decoding_stmt(G, N, Fd, T, LName, IndOp, InBuffer, Align, NextPos, - DecType, AllocedPars) when element(1, T) == scoped_id -> - Fmt = - " if ((oe_error_code = ei_decode_~s(~s, &oe_env->_iin, ~s~s)) < 0)" - " {\n", - Emit = fun(Type) -> - emit(Fd, Fmt, [Type, InBuffer, IndOp, LName]), - emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n") - end, - case mk_c_type(G, N, T, evaluate_not) of - "erlang_pid" -> - Emit("pid"); - "erlang_port" -> - Emit("port"); - "erlang_ref" -> - Emit("ref"); - "ETERM*" -> - Emit("term"); - {enum, FSN} -> - emit_decoding_stmt(G, N, Fd, FSN, LName, IndOp, InBuffer, - Align, NextPos, DecType, AllocedPars); - FSN -> - emit_decoding_stmt(G, N, Fd, FSN, LName, IndOp, InBuffer, - Align, NextPos, DecType, AllocedPars) - end; - -%% XXX T is a string -emit_decoding_stmt(G, N, Fd, T, LName, IndOp, InBuffer, _Align, NextPos, - DecType, AllocedPars) when is_list(T) -> - %% Already a fullscoped name - Type = ictype:name2type(G,T), - case ictype:isBasicType(Type) of - true -> - emit_decoding_stmt_for_basic_type(G, N, T, Fd, Type, InBuffer, IndOp, - LName, AllocedPars); - false -> - case DecType of - generator -> - emit(Fd, " if ((oe_error_code = ~s~s(oe_env, oe_first, " - "~s, ~s)) < 0) {\n", - [ic_util:mk_oe_name(G, "decode_"), - T, NextPos, LName]), - emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n"); - caller -> %% No malloc used, define oe_first - emit(Fd, " {\n"), - emit(Fd, " void *oe_first = NULL;\n"), - emit(Fd, " int oe_outindex = 0;\n\n"), - emit(Fd, " if ((oe_error_code = ~s~s(oe_env, " - "oe_first, ~s, ~s)) < 0) {\n", - [ic_util:mk_oe_name(G, "decode_"), - T, NextPos, LName]), - emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n"), - emit(Fd, " }\n"); - caller_dyn -> %% Malloc used - emit(Fd, " {\n"), - emit(Fd, " int oe_outindex = 0;\n\n"), - emit(Fd, " if ((oe_error_code = ~s~s(oe_env, " - "oe_first, ~s, ~s)) < 0) {\n", - [ic_util:mk_oe_name(G, "decode_"), - T, NextPos, LName]), - emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n"), - emit(Fd, " }\n"); - array_dyn -> %% Malloc used - emit(Fd, " {\n"), - emit(Fd, " int oe_outindex = 0;\n\n"), - emit(Fd, " if ((oe_error_code = ~s~s(oe_env, " - "oe_first, ~s, ~s)) < 0) {\n", - [ic_util:mk_oe_name(G, "decode_"), - T, NextPos, LName]), - emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n"), - emit(Fd, " }\n"); - array_fix_ret -> - emit(Fd, " {\n"), - emit(Fd, " int oe_outindex = 0;\n\n"), - emit(Fd, " if ((oe_error_code = ~s~s(oe_env, " - "oe_first, ~s,*~s)) < 0) {\n", - [ic_util:mk_oe_name(G, "decode_"), - T, NextPos, LName]), - emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n"), - emit(Fd, " }\n"); - array_fix_out -> %% No malloc used, define oe_first - emit(Fd, " {\n"), - emit(Fd, " void *oe_first = NULL;\n"), - emit(Fd, " int oe_outindex = 0;\n\n"), - emit(Fd, " if ((oe_error_code = ~s~s(oe_env, " - "oe_first, ~s, ~s)) < 0) {\n", - [ic_util:mk_oe_name(G, "decode_"), - T, NextPos, LName]), - emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n"), - emit(Fd, " }\n") - end - end; -emit_decoding_stmt(G, N, Fd, T, LName, IndOp, InBuffer, _Align, _NextPos, - DecType, AllocedPars) when is_record(T, string) -> - case DecType of - caller_dyn -> - emit(Fd, " if ((oe_error_code = ei_decode_string(~s, " - "&oe_env->_iin, ~s~s)) < 0) {\n", - [InBuffer, IndOp, LName]), - emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n"); - _ -> - emit(Fd, " ~s~s = oe_first + *oe_outindex;\n\n", - [IndOp, LName]), - emit(Fd, " {\n"), - emit(Fd, " int oe_type=0;\n"), - emit(Fd, " int oe_string_ctr=0;\n\n"), - - emit(Fd, " (int) ei_get_type(~s, " - "&oe_env->_iin, &oe_type, &oe_string_ctr);\n\n", - [InBuffer]), - - emit(Fd, " if ((oe_error_code = ei_decode_string(~s, " - "&oe_env->_iin, ~s~s)) < 0) {\n", - [InBuffer, IndOp, LName]), - emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n"), - emit(Fd, " *oe_outindex = ~s;\n", - [ic_util:mk_align("*oe_outindex+oe_string_ctr+1")]), - emit(Fd, " }\n\n") - end; -emit_decoding_stmt(G, N, Fd, T, LName, IndOp, InBuffer, _Align, _NextPos, - DecType, AllocedPars) when is_record(T, wstring) -> - case DecType of - caller_dyn -> - %% Note prefix: oe_ei - emit(Fd, " if ((oe_error_code = oe_ei_decode_wstring(~s, " - "&oe_env->_iin, ~s~s)) < 0) {\n", - [InBuffer, IndOp, LName]), - emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }/* --- */\n"); % XXX - _ -> - emit(Fd, " ~s~s = oe_first + *oe_outindex;\n\n", - [IndOp, LName]), - - emit(Fd, " {\n"), - emit(Fd, " int oe_type=0;\n"), - emit(Fd, " int oe_string_ctr=0;\n\n"), - emit(Fd, " (int) ei_get_type(~s, " - "&oe_env->_iin, &oe_type, &oe_string_ctr);\n\n", - [InBuffer]), - %% Note prefix: oe_ei - emit(Fd, " if ((oe_error_code = oe_ei_decode_wstring(~s, " - "&oe_env->_iin, ~s~s)) < 0) {\n", - [InBuffer, IndOp, LName]), - emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n"), - emit(Fd, " *oe_outindex = ~s;\n", - [ic_util:mk_align("*oe_outindex+oe_string_ctr+1")]), - emit(Fd, " }\n") - end; -emit_decoding_stmt(G, N, Fd, T, LName, IndOp, InBuffer, _Align, NextPos, - _DecType, AllocedPars) -> - case normalize_type(T) of - {basic, Type} -> - emit_decoding_stmt_for_basic_type(G, N, T, Fd, Type, InBuffer, IndOp, - LName, AllocedPars); - {void, _} -> - emit(Fd, " if ((oe_error_code = ei_decode_atom(~s, " - "&oe_env->_iin, NULL)) < 0) {\n", - [InBuffer]), - emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n"); - {sequence, _, _} -> - ok; - {_, {array, SId, Dims}} -> - AName = ic_forms:get_id2({array, SId, Dims}), - Ptr = "oe_out->"++AName, - emit(Fd, " if ((oe_error_code = ~s~s(oe_env, " - "oe_first, ~s, ~s)) < 0) {\n", - [ic_util:mk_oe_name(G, "decode_"), - ic_forms:get_id2(SId), - NextPos, Ptr]), - emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n"); - {struct, _, _, _} -> %% Struct as a member in struct ! - ok; - _ -> - %%io:format("3 ------------> ~p~n", [T]), - ic_error:fatal_error(G, {illegal_typecode_for_c, T, N}) - end. - -%% XXX DecType used in two senses in this file. -emit_decoding_stmt_for_basic_type(G, N, T, Fd, Type, InBuffer, IndOp, - LName, AllocedPars) -> - Fmt = - " if ((oe_error_code = ~sei_decode_~s(~s, &oe_env->_iin, " - "~s~s)) < 0) {\n", - Ret = - " return oe_error_code;\n" - "}\n", - - {Pre, DecType} = - case Type of - ushort -> {"", "ulong"}; - ulong -> {"", "ulong"}; - ulonglong -> {"oe_", "ulonglong"}; - short -> {"", "long"}; - long -> {"", "long"}; - longlong -> {"oe_", "longlong"}; - float -> {"", "double"}; - double -> {"", "double"}; - boolean -> {"", "atom"}; - char -> {"", "char"}; - wchar -> {"oe_", "wchar"}; - octet -> {"", "char"}; - any -> {"", "long"} - end, - case Type of - ushort -> - emit(Fd, " {\n"), - emit(Fd, " unsigned long oe_ulong;\n"), - emit(Fd, " if ((oe_error_code = ei_decode_ulong(~s, " - "&oe_env->_iin, &oe_ulong)) < 0) {\n", - [InBuffer]), - emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, "}\n"), - emit(Fd, " *(~s) = (unsigned short) oe_ulong;\n\n", - [LName]), - emit(Fd, " if (*(~s) != oe_ulong){\n", - [LName]), - emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return -1;\n"), - emit(Fd, " }\n"), - emit(Fd, " }\n\n"); - short -> - emit(Fd, " {\n"), - emit(Fd, " long oe_long;\n"), - emit(Fd, " if ((oe_error_code = ei_decode_long(~s, " - "&oe_env->_iin, &oe_long)) < 0){\n", - [InBuffer]), - emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n\n"), - emit(Fd, "}\n"), - emit(Fd, " *(~s) = (short) oe_long;\n\n",[LName]), - emit(Fd, " if (*(~s) != oe_long){\n", [LName]), - emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return -1;\n"), - emit(Fd, " }\n"), - emit(Fd, " }\n"); - float -> - emit(Fd, " {\n"), - emit(Fd, " double oe_double;\n"), - emit(Fd, " if ((oe_error_code = ei_decode_double(~s, " - "&oe_env->_iin, &oe_double)) < 0){\n", - [InBuffer]), - emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n\n"), - emit(Fd, "}\n"), - emit(Fd, " *(~s) = (float) oe_double;\n",[LName]), - emit(Fd, " }\n"); - boolean -> - emit(Fd, " {\n"), - emit(Fd, " char oe_bool[25];\n\n"), - emit(Fd, " if ((oe_error_code = ei_decode_atom(~s, " - "&oe_env->_iin, oe_bool)) < 0){\n",[InBuffer]), - emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, "}\n"), - emit(Fd, " if (strcmp(oe_bool, \"false\") == 0) {\n"), - emit(Fd, " *(~s) = 0;\n",[LName]), - emit(Fd, " }\n"), - emit(Fd, " else if (strcmp(oe_bool, \"true\") == 0)" - " {\n"), - emit(Fd, " *(~s) = 1;\n",[LName]), - emit(Fd, " }\n"), - emit(Fd, " else {\n"), - emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "~s", [LName]), - emit(Fd, " return -1;\n"), - emit(Fd, " }\n"), - emit(Fd, " }\n"); - _ -> - emit(Fd, Fmt, [Pre, DecType, InBuffer, IndOp, LName]), - ?emit_c_dec_rpt(Fd, " ", "~s", [LName]), - emit_dealloc_stmts(Fd, " ", AllocedPars), - emit(Fd, Ret) - end. - -%%------------------------------------------------------------ -%% -%%------------------------------------------------------------ -emit_dealloc_stmts(Fd, Prefix, AllocedPars) -> - Fmt = Prefix ++ "CORBA_free(~s);\n", - lists:foreach( - fun(Par) -> emit(Fd, Fmt, [Par]) end, - AllocedPars). - - -%%------------------------------------------------------------ -%% -%%------------------------------------------------------------ - -mk_variable_name(Var) -> - Nr = get(Var), - put(Var, Nr + 1), - "oe_tmp" ++ integer_to_list(Nr). - -%% IDL to C type conversion -%%------------------------------------------------------------ -mk_c_type(G, N, S) -> - mk_c_type(G, N, S, evaluate). - -mk_c_type(G, N, S, evaluate) when element(1, S) == scoped_id -> - {FullScopedName, _T, _TK, _} = ic_symtab:get_full_scoped_name(G, N, S), - BT = ic_code:get_basetype(G, ic_util:to_undersc(FullScopedName)), - case BT of - "erlang_binary" -> - "erlang_binary"; - "erlang_pid" -> - "erlang_pid"; - "erlang_port" -> - "erlang_port"; - "erlang_ref" -> - "erlang_ref"; - "erlang_term" -> - "ETERM*"; - {enum, Type} -> - mk_c_type(G, N, Type, evaluate); - Type -> - mk_c_type(G, N, Type, evaluate) - end; - -mk_c_type(G, N, S, evaluate_not) when element(1, S) == scoped_id -> - {FullScopedName, _T, _TK, _} = ic_symtab:get_full_scoped_name(G, N, S), - BT = ic_code:get_basetype(G, ic_util:to_undersc(FullScopedName)), - case BT of - "erlang_binary" -> - "erlang_binary"; - "erlang_pid" -> - "erlang_pid"; - "erlang_port" -> - "erlang_port"; - "erlang_ref" -> - "erlang_ref"; - "erlang_term" -> - "ETERM*"; - Type -> - Type - end; -mk_c_type(_G, _N, S, _) when is_list(S) -> - S; -mk_c_type(_G, _N, S, _) when is_record(S, string) -> - "CORBA_char *"; -mk_c_type(_G, _N, S, _) when is_record(S, wstring) -> - "CORBA_wchar *"; -mk_c_type(_G, _N, {boolean, _}, _) -> - "CORBA_boolean"; -mk_c_type(_G, _N, {octet, _}, _) -> - "CORBA_octet"; -mk_c_type(_G, _N, {void, _}, _) -> - "void"; -mk_c_type(_G, _N, {unsigned, U}, _) -> - case U of - {short,_} -> - "CORBA_unsigned_short"; - {long,_} -> - "CORBA_unsigned_long"; - {'long long',_} -> - "CORBA_unsigned_long_long" - end; - -mk_c_type(_G, _N, {'long long', _}, _) -> - "CORBA_long_long"; - -mk_c_type(_G, _N, S, _) when is_record(S, union)-> - ic_forms:get_id2(S); - -mk_c_type(_G, N, S, _) when is_record(S, struct) -> %% Locally defined member - Fullname = [ic_forms:get_id2(S) | N], - ic_util:to_undersc(Fullname); - -mk_c_type(_G, _N, {'any', _}, _) -> %% Fix for any type - "CORBA_long"; - -mk_c_type(_G, _N, {T, _}, _) -> - "CORBA_" ++ atom_to_list(T). - -%%------------------------------------------------------------------- -%% IDL to C type conversion used by the emit_c_*_rpt macros. -%%------------------------------------------------------------------- -mk_c_type2(G, N, S) when element(1, S) == scoped_id -> - {FullScopedName, _T, _TK, _} = ic_symtab:get_full_scoped_name(G, N, S), - BT = ic_code:get_basetype(G, ic_util:to_undersc(FullScopedName)), - case BT of - "erlang_binary" -> - "erlang_binary"; - "erlang_pid" -> - "erlang_pid"; - "erlang_port" -> - "erlang_port"; - "erlang_ref" -> - "erlang_ref"; - "erlang_term" -> - "ETERM*"; - {enum, Type} -> - mk_c_type2(G, N, Type); - Type -> - mk_c_type2(G, N, Type) - end; - -mk_c_type2(_G, _N, S) when is_list(S) -> - S; -mk_c_type2(_G, _N, S) when is_record(S, string) -> - "CORBA_char *"; -mk_c_type2(_G, _N, S) when is_record(S, wstring) -> - "CORBA_wchar *"; -mk_c_type2(_G, _N, {boolean, _}) -> - "CORBA_boolean"; -mk_c_type2(_G, _N, {octet, _}) -> - "CORBA_octet"; -mk_c_type2(_G, _N, {void, _}) -> - "void"; -mk_c_type2(_G, _N, {unsigned, U}) -> - case U of - {short,_} -> - "CORBA_unsigned_short"; - {long,_} -> - "CORBA_unsigned_long"; - {'long long',_} -> - "CORBA_unsigned_long_long" - end; - -mk_c_type2(_G, _N, {'long long', _}) -> - "CORBA_long_long"; - -mk_c_type2(_G, _N, S) when is_record(S, union)-> - ic_forms:get_id2(S); - -mk_c_type2(_G, N, S) when is_record(S, struct) -> - Fullname = [ic_forms:get_id2(S) | N], - ic_util:to_undersc(Fullname); - -mk_c_type2(_G, _N, S) when is_record(S, sequence) -> - mk_c_type2(_G, _N, S#sequence.type); - -mk_c_type2(_G, _N, {'any', _}) -> %% Fix for any type - "CORBA_long"; - -mk_c_type2(_G, _N, {T, _}) -> - "CORBA_" ++ atom_to_list(T). - -%%----- - -is_variable_size_rec(Es) -> - lists:any( - fun({_N, T}) -> is_variable_size(T); - ({_, _N, T}) -> is_variable_size(T) - end, Es). - -is_variable_size({'tk_struct', _IFRId, "port", _ElementList}) -> - false; -is_variable_size({'tk_struct', _IFRId, "pid", _ElementList}) -> - false; -is_variable_size({'tk_struct', _IFRId, "ref", _ElementList}) -> - false; -is_variable_size({'tk_struct', _IFRId, "term", _ElementList}) -> - false; -is_variable_size({'tk_struct', _IFRId, _Name, ElementList}) -> - is_variable_size_rec(ElementList); -is_variable_size({'tk_array', ElemTC, _Length}) -> - is_variable_size(ElemTC); -is_variable_size({'tk_string', _}) -> - true; -is_variable_size({'tk_wstring', _}) -> - true; -is_variable_size({'tk_sequence', _ElemTC, _MaxLsextractength}) -> - true; -is_variable_size({'tk_union', _IFRId, _Name, _, _, ElementList}) -> - is_variable_size_rec(ElementList); -is_variable_size(_Other) -> - false. - - -is_variable_size(_G, _N, T) when is_record(T, string) -> - true; -is_variable_size(_G, _N, T) when is_record(T, wstring) -> - true; -is_variable_size(_G, _N, T) when is_record(T, sequence) -> - true; -is_variable_size(G, N, T) when is_record(T, union) -> - %%io:format("~n~p = ~p~n",[ic_forms:get_id2(T),ictype:fetchTk(G, N, T)]), - is_variable_size(ictype:fetchTk(G, N, T)); -is_variable_size(G, N, T) when is_record(T, struct) -> - is_variable_size(ictype:fetchTk(G, N, T)); -is_variable_size(G, N, T) when element(1, T) == scoped_id -> - case ic_symtab:get_full_scoped_name(G, N, T) of - {_FullScopedName, _, TK, _} -> - is_variable_size(TK); - _ -> - ic_error:fatal_error(G, {name_not_found, T}) - end; -is_variable_size(_G, _N, _Other) -> - false. - -%% mk_dim produces -mk_dim([Arg | Args]) -> - "[" ++ Arg ++ "]" ++ mk_dim(Args); -mk_dim([]) -> []. - -mk_slice_dim(Args) -> - mk_dim(tl(Args)). - - -emit_tmp_variables(Fd) -> - DeclList = get(tmp_declarations), - emit_tmp_variables(Fd, DeclList), - ok. - -emit_tmp_variables(Fd, [Decl |Rest]) -> - emit_tmp_variables(Fd, Rest), - emit(Fd, "~s", [Decl]); -emit_tmp_variables(_Fd, []) -> - ok. - -store_tmp_decl(Format, Args) -> - Decl = io_lib:format(Format, Args), - DeclList = get(tmp_declarations), - put(tmp_declarations, [Decl |DeclList]). - -%%------------------------------------------------------------ -%% -%% Parser utilities -%% -%% Called from the yecc parser. Expands the identifier list of an -%% attribute so that the attribute generator never has to handle -%% lists. -%% -%%------------------------------------------------------------ - -extract_info(_G, N, X) when is_record(X, op) -> - Name = ic_util:to_undersc([ic_forms:get_id2(X) | N]), - Args = X#op.params, - ArgNames = mk_c_vars(Args), - TypeList = {ic_forms:get_type(X), - lists:map(fun(Y) -> ic_forms:get_type(Y) end, Args), - [] - }, - {Name, ArgNames, TypeList}; -extract_info(_G, N, X) -> - Name = ic_util:to_undersc([ic_forms:get_id2(X) | N]), - {Name, [], []}. - - - -%% Usefull functions -get_param_tk(Name, Op) -> - case get_param(Name, Op) of - error -> - error; - Param -> - ic_forms:get_tk(Param) - end. - -get_param(Name, Op) when is_record(Op, op) -> - get_param_loop(Name, Op#op.params); -get_param(_Name, _Op) -> - error. - -get_param_loop(Name,[Param|Params]) -> - case ic_forms:get_id2(Param) of - Name -> - Param; - _ -> - get_param_loop(Name,Params) - end; -get_param_loop(_Name, []) -> - error. - - -%% Input is a list of parameters (in parse form) and output is a list -%% of parameter attribute and variable names. -mk_c_vars(Params) -> - lists:map(fun(P) -> {A, _} = P#param.inout, - {A, ic_forms:get_id(P#param.id)} - end, - Params). - -normalize_type({unsigned, {short, _}}) -> {basic, ushort}; -normalize_type({unsigned, {long, _}}) -> {basic, ulong}; -normalize_type({unsigned, {'long long', _}}) -> {basic, ulonglong}; -normalize_type({short,_}) -> {basic, short}; -normalize_type({long, _}) -> {basic, long}; -normalize_type({'long long', _}) -> {basic, longlong}; -normalize_type({float,_}) -> {basic, float}; -normalize_type({double, _}) -> {basic, double}; -normalize_type({boolean, _}) -> {basic, boolean}; -normalize_type({char, _}) -> {basic, char}; -normalize_type({wchar, _}) -> {basic, wchar}; -normalize_type({octet, _}) -> {basic, octet}; -normalize_type({any, _}) -> {basic, any}; -normalize_type(tk_ushort) -> {basic, ushort}; -normalize_type(tk_ulong) -> {basic, ulong}; -normalize_type(tk_ulonglong) -> {basic, ulonglong}; -normalize_type(tk_short) -> {basic, short}; -normalize_type(tk_long) -> {basic, long}; -normalize_type(tk_longlong) -> {basic, longlong}; -normalize_type(tk_float) -> {basic, float}; -normalize_type(tk_double) -> {basic, double}; -normalize_type(tk_boolean) -> {basic, boolean}; -normalize_type(tk_char) -> {basic, char}; -normalize_type(tk_wchar) -> {basic, wchar}; -normalize_type(tk_octet) -> {basic, octet}; -normalize_type(tk_any) -> {basic, any}; -normalize_type(ushort) -> {basic, ushort}; -normalize_type(ulong) -> {basic, ulong}; -normalize_type(ulonglong) -> {basic, ulonglong}; -normalize_type(short) -> {basic, short}; -normalize_type(long) -> {basic, long}; -normalize_type(longlong) -> {basic, longlong}; -normalize_type(float) -> {basic, float}; -normalize_type(double) -> {basic, double}; -normalize_type(boolean) -> {basic, boolean}; -normalize_type(char) -> {basic, char}; -normalize_type(wchar) -> {basic, wchar}; -normalize_type(octet) -> {basic, octet}; -normalize_type(any) -> {basic, any}; -normalize_type(Type) -> Type. - diff --git a/lib/ic/src/ic_cclient.erl b/lib/ic/src/ic_cclient.erl deleted file mode 100644 index 8591acf33f..0000000000 --- a/lib/ic/src/ic_cclient.erl +++ /dev/null @@ -1,1210 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2002-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(ic_cclient). - -%% This module implements generation of C client code, where the -%% client acts as an Erlang C-node, and where the communication thus -%% is according to the Erlang distribution protocol. -%% - --export([do_gen/3]). - -%%------------------------------------------------------------ -%% IMPLEMENTATION CONVENTIONS -%%------------------------------------------------------------ -%% Functions: -%% -%% mk_* returns things to be used. No side effects. -%% emit_* Writes to file. Has Fd in arguments. -%% gen_* Same, but has no Fd. Usually for larger things. -%% -%% Terminology for generating C: -%% -%% par_list list of identifiers with types, types only, or with -%% parameters (arguments) only. -%% arg_list list of identifiers only (for function calls) -%% - -%%------------------------------------------------------------ -%% Internal stuff -%%------------------------------------------------------------ - --import(lists, [foreach/2, foldl/3, foldr/3]). --import(ic_codegen, [emit/2, emit/3, emit/4, emit_c_enc_rpt/4, emit_c_dec_rpt/4]). - --include("icforms.hrl"). --include("ic.hrl"). --include_lib("stdlib/include/erl_compile.hrl"). - --define(IC_HEADER, "ic.h"). --define(ERL_INTERFACEHEADER, "erl_interface.h"). --define(EICONVHEADER, "ei.h"). --define(ERLANGATOMLENGTH, "256"). - - -%%------------------------------------------------------------ -%% ENTRY POINT -%%------------------------------------------------------------ -do_gen(G, File, Form) -> - OeName = ic_util:mk_oe_name(G, remove_ext(ic_util:to_list(File))), - G2 = ic_file:filename_push(G, [], OeName, c), - gen_headers(G2, [], Form), - R = gen(G2, [], Form), - ic_file:filename_pop(G2, c), - R. - -remove_ext(File) -> - filename:rootname(filename:basename(File)). - -%%------------------------------------------------------------ -%% -%% Generate client side C stubs. -%% -%% - each module definition results in a separate file. -%% - each interface definition results in a separate file. -%% -%% G = record(genobj) (see ic.hrl) -%% N = scoped names in reverse -%% X = current form to consider. -%%------------------------------------------------------------ - -gen(G, N, [X| Xs]) when is_record(X, preproc) -> - G1 = change_file_stack(G, N, X), - gen(G1, N, Xs); - -gen(G, N, [X| Xs]) when is_record(X, module) -> - CD = ic_code:codeDirective(G, X), - G2 = ic_file:filename_push(G, N, X, CD), - N2 = [ic_forms:get_id2(X)| N], - gen_headers(G2, N2, X), - gen(G2, N2, ic_forms:get_body(X)), - G3 = ic_file:filename_pop(G2, CD), - gen(G3, N, Xs); - -gen(G, N, [X| Xs]) when is_record(X, interface) -> - - G2 = ic_file:filename_push(G, N, X, c), - N2 = [ic_forms:get_id2(X)| N], - - %% Sets the temporary variable counter. - put(op_variable_count, 0), - put(tmp_declarations, []), - - gen_headers(G2, N2, X), - - gen(G2, N2, ic_forms:get_body(X)), - - lists:foreach( - fun({_Name, Body}) -> - gen(G2, N2, Body) end, - X#interface.inherit_body), - - %% Generate Prototypes - gen_prototypes(G2, N2, X), - - %% Generate generic preparation for decoding - gen_receive_info(G2, N2, X), - - G3 = ic_file:filename_pop(G2, c), - - gen(G3, N, Xs); - -gen(G, N, [X| Xs]) when is_record(X, const) -> - emit_constant(G, N, X), - gen(G, N, Xs); - -gen(G, N, [X| Xs]) when is_record(X, op) -> - {OpName, ArgNames, RetParTypes} = ic_cbe:extract_info(G, N, X), - %% XXX Note: N is the list of scoped ids of the *interface*. - gen_operation(G, N, X, OpName, ArgNames, RetParTypes), - gen_encoder(G, N, X, OpName, ArgNames, RetParTypes), - gen_decoder(G, N, X, OpName, ArgNames, RetParTypes), - gen(G, N, Xs); - -gen(G, N, [X| Xs]) when is_record(X, attr) -> - gen(G, N, Xs); - -gen(G, N, [X| Xs]) when is_record(X, except) -> - icstruct:except_gen(G, N, X, c), - gen(G, N, Xs); - -gen(G, N, [X| Xs]) when is_record(X, enum) -> - icenum:enum_gen(G, N, X, c), - gen(G, N, Xs); - -gen(G, N, [X| Xs]) when is_record(X, typedef) -> - icstruct:struct_gen(G, N, X, c), - gen(G, N, Xs); - -gen(G, N, [X| Xs]) when is_record(X, struct) -> - icstruct:struct_gen(G, N, X, c), - gen(G, N, Xs); - -gen(G, N, [X| Xs]) when is_record(X, union) -> - icstruct:struct_gen(G, N, X, c), - gen(G, N, Xs); - -gen(G, N, [_X| Xs]) -> - %% XXX Should have debug message here. - gen(G, N, Xs); - -gen(_G, _N, []) -> - ok. - -%%------------------------------------------------------------ -%% Change file stack -%%------------------------------------------------------------ - -change_file_stack(G, _N, X) when X#preproc.cat == line_nr -> - Id = ic_forms:get_id2(X), - Flags = X#preproc.aux, - case Flags of - [] -> - ic_genobj:push_file(G, Id); - _ -> - foldr( - fun({_, _, "1"}, G1) -> - ic_genobj:push_file(G1, Id); - ({_, _, "2"}, G1) -> - ic_genobj:pop_file(G1, Id); - ({_, _, "3"}, G1) -> - ic_genobj:sys_file(G1, Id) - end, G, Flags) - end; -change_file_stack(G, _N, _X) -> - G. - -%%------------------------------------------------------------ -%% Generate headers in stubfiles and header files -%%------------------------------------------------------------ - -gen_headers(G, N, X) when is_record(X, interface) -> - case ic_genobj:is_hrlfile_open(G) of - true -> - %% Set the temporary variable counter - put(op_variable_count, 0), - put(tmp_declarations, []), - HFd = ic_genobj:hrlfiled(G), - IncludeFileStack = ic_genobj:include_file_stack(G), - L = length(N), - Filename = - if - L < 2 -> - lists:nth(L + 1, IncludeFileStack); - true -> - lists:nth(2, IncludeFileStack) - end, - emit(HFd, "#include \"~s\"\n", [filename:basename(Filename)]), - ic_code:gen_includes(HFd, G, X, c_client), - - IfName = ic_util:to_undersc(N), - IfNameUC = ic_util:to_uppercase(IfName), - emit(HFd, "\n#ifndef __~s__\n", [IfNameUC]), - emit(HFd, "#define __~s__\n", [IfNameUC]), - LCmt = io_lib:format("Interface object definition: ~s", [IfName]), - ic_codegen:mcomment_light(HFd, [LCmt], c), - case get_c_timeout(G, "") of - "" -> - ok; - {SendTmo, RecvTmo} -> - emit(HFd, "#define OE_~s_SEND_TIMEOUT ~s\n", - [IfNameUC, SendTmo]), - emit(HFd, "#define OE_~s_RECV_TIMEOUT ~s\n", - [IfNameUC, RecvTmo]), - emit(HFd, "#ifndef EI_HAVE_TIMEOUT\n"), - emit(HFd, "#error Functions for send and receive with " - "timeout not defined in erl_interface\n"), - emit(HFd, "#endif\n\n") - end, - - emit(HFd, "typedef CORBA_Object ~s;\n", [IfName]), - emit(HFd, "#endif\n\n"); - - false -> ok - end, - case ic_genobj:is_stubfile_open(G) of - true -> - Fd = ic_genobj:stubfiled(G), - ic_codegen:nl(Fd), - emit(Fd, "#include \n"), - emit(Fd, "#include \n"), - case ic_options:get_opt(G, c_report) of - true -> - emit(Fd, "#ifndef OE_C_REPORT\n"), - emit(Fd, "#define OE_C_REPORT\n"), - emit(Fd, "#include \n"), - emit(Fd, "#endif\n"); - _ -> - ok - end, - emit(Fd, "#include \"~s\"\n", [?IC_HEADER]), - emit(Fd, "#include \"~s\"\n", [?ERL_INTERFACEHEADER]), - emit(Fd, "#include \"~s\"\n", [?EICONVHEADER]), - emit(Fd, "#include \"~s\"\n", - [filename:basename(ic_genobj:include_file(G))]), - ic_codegen:nl(Fd), ic_codegen:nl(Fd), - Fd; % XXX ?? - false -> - ok - end; - -%% Some items have extra includes -gen_headers(G, N, X) when is_record(X, module) -> - case ic_genobj:is_hrlfile_open(G) of - true -> - HFd = ic_genobj:hrlfiled(G), - IncludeFileStack = ic_genobj:include_file_stack(G), - Filename = lists:nth(length(N) + 1, IncludeFileStack), - emit(HFd, "#include \"~s\"\n", [filename:basename(Filename)]), - ic_code:gen_includes(HFd, G, X, c_client); - false -> ok - end; -gen_headers(G, [], _X) -> - case ic_genobj:is_hrlfile_open(G) of - true -> - HFd = ic_genobj:hrlfiled(G), - case ic_options:get_opt(G, c_report) of - true -> - emit(HFd, "#ifndef OE_C_REPORT\n"), - emit(HFd, "#define OE_C_REPORT\n"), - emit(HFd, "#include \n"), - emit(HFd, "#endif\n"); - _ -> - ok - end, - emit(HFd, "#include \"~s\"\n", [?IC_HEADER]), - emit(HFd, "#include \"~s\"\n", [?ERL_INTERFACEHEADER]), - emit(HFd, "#include \"~s\"\n", [?EICONVHEADER]), - ic_code:gen_includes(HFd, G, c_client); - false -> ok - end; -gen_headers(_G, _N, _X) -> - ok. - - -%%------------------------------------------------------------ -%% Generate all prototypes (for interface) -%%------------------------------------------------------------ -gen_prototypes(G, N, X) -> - case ic_genobj:is_hrlfile_open(G) of - false -> - ok; - true -> - HFd = ic_genobj:hrlfiled(G), - IfName = ic_util:to_undersc(N), - - %% Emit generated function prototypes - emit(HFd, "\n/* Operation functions */\n"), - lists:foreach(fun({_Name, Body}) -> - emit_operation_prototypes(G, HFd, N, Body) - end, [{x, ic_forms:get_body(X)}| - X#interface.inherit_body]), - - UserProto = get_user_proto(G, false), - %% Emit generic function prototypes - case UserProto of - false -> - ok; - UserProto -> - emit(HFd, - "\n/* Generic user defined encoders */\n"), - emit(HFd, - "int ~s_prepare_notification_encoding(" - "CORBA_Environment*);" - "\n", [UserProto]), - emit(HFd, - "int ~s_prepare_request_encoding(CORBA_Environment*);" - "\n", [UserProto]) - end, - %% Emit encoding function prototypes - emit(HFd, "\n/* Input encoders */\n"), - lists:foreach(fun({_Name, Body}) -> - emit_encoder_prototypes(G, HFd, N, Body) - end, - [{x, ic_forms:get_body(X)}| - X#interface.inherit_body]), - - %% Emit generic function prototypes - emit(HFd, "\n/* Generic decoders */\n"), - emit(HFd, "int ~s__receive_info(~s, CORBA_Environment*);\n", - [IfName, IfName]), - - case UserProto of - false -> - ok; - UserProto -> - emit(HFd, "\n/* Generic user defined decoders */\n"), - emit(HFd, - "int ~s_prepare_reply_decoding(CORBA_Environment*);" - "\n", [UserProto]) - end, - %% Emit decode function prototypes - emit(HFd, "\n/* Result decoders */\n"), - lists:foreach(fun({_Name, Body}) -> - emit_decoder_prototypes(G, HFd, N, Body) - end, [{x, ic_forms:get_body(X)}| - X#interface.inherit_body]), - case UserProto of - false -> - ok; - UserProto -> - %% Emit generic send and receive_prototypes - {Sfx, TmoType} = case get_c_timeout(G, "") of - "" -> - {"", ""}; - _ -> - {"_tmo", ", unsigned int"} - end, - emit(HFd, - "\n/* Generic user defined send and receive " - "functions */\n"), - emit(HFd, - "int ~s_send_notification~s(CORBA_Environment*~s);\n", - [UserProto, Sfx, TmoType]), - emit(HFd, - "int ~s_send_request_and_receive_reply~s(" - "CORBA_Environment*~s~s);\n", - [UserProto, Sfx, TmoType, TmoType]) - end - end. - -%%------------------------------------------------------------ -%% Generate receive_info() (generic part for message reception) -%% (for interface). For backward compatibility only. -%%------------------------------------------------------------ - -gen_receive_info(G, N, _X) -> - case ic_genobj:is_stubfile_open(G) of - false -> - ok; - true -> - Fd = ic_genobj:stubfiled(G), - IfName = ic_util:to_undersc(N), - UserProto = get_user_proto(G, oe), - Code = - " -/* - * Generic function, used to return received message information. - * Not used by oneways. Always generated. For backward compatibility only. - */ - -int ~s__receive_info(~s oe_obj, CORBA_Environment *oe_env) -{ - return ~s_prepare_reply_decoding(oe_env); -}\n", - emit(Fd, Code, [IfName, IfName, UserProto]) -end. - -%%------------------------------------------------------------ -%% Emit constant -%%------------------------------------------------------------ - -emit_constant(G, N, ConstRecord) -> - case ic_genobj:is_hrlfile_open(G) of - false -> ok; - true -> - Fd = ic_genobj:hrlfiled(G), - CName = ic_util:to_undersc( - [ic_forms:get_id(ConstRecord#const.id)| N]), - UCName = ic_util:to_uppercase(CName), - - emit(Fd, "\n#ifndef __~s__\n", [UCName]), - emit(Fd, "#define __~s__\n", [UCName]), - - emit(Fd, "/* Constant: ~s */\n", [CName]), - - if is_record(ConstRecord#const.type, wstring) -> - %% If wstring, add 'L' - emit(Fd, "#define ~s L~p\n", - [CName, ConstRecord#const.val]); - true -> - emit(Fd, "#define ~s ~p\n", - [CName, ConstRecord#const.val]) - end, - emit(Fd, "#endif\n\n") - end. - -%%------------------------------------------------------------ -%% Generate operation (for interface) -%%------------------------------------------------------------ - -%% N is the list of scoped ids of the *interface*. -%% X is the operation -gen_operation(G, N, X, OpName, ArgNames, RetParTypes) -> - case ic_genobj:is_stubfile_open(G) of - true -> - do_gen_operation(G, N, X, OpName, ArgNames, RetParTypes); - false -> - ok - end. - -do_gen_operation(G, N, X, OpName, ArgNames, RetParTypes) -> - Fd = ic_genobj:stubfiled(G), - IfName = ic_util:to_undersc(N), - IfNameUC = ic_util:to_uppercase(IfName), - - {R, ParTypes, _} = RetParTypes, - - IsOneway = ic_forms:is_oneway(X), - - emit(Fd, "\n" - "/***\n" - " *** Operation function \"~s\" ~s\n" - " ***/\n\n", - [OpName, ifelse(IsOneway, "(oneway)", "")]), - - RV = element(1, R), - Ret = case IsOneway of - false -> - if RV /= void -> - mk_ret_type(G, N, R); - true -> - "void" - end; - true -> - "void" - end, - ParListStr = ic_util:chain(mk_par_type_list(G, N, X, [in, out], - [types, args], - ParTypes, ArgNames), ", "), - emit(Fd, - "~s ~s(~s, ~sCORBA_Environment *oe_env)\n{\n", - [Ret, OpName, [IfName, " ", "oe_obj"], ParListStr]), - - case IsOneway of - true -> - ok; - false -> - case ictype:isArray(G, N, R) of - true -> - emit(Fd, " ~s oe_return = NULL;\n\n", - [mk_ret_type(G, N, R)]); - false -> - if RV /= void -> - emit(Fd, " ~s oe_return;\n\n", - [Ret]); - true -> - ok - end - end, - emit(Fd, - " /* Initiating the message reference */\n" - " ic_init_ref(oe_env, &oe_env->_unique);\n") - end, - - emit(Fd, - " /* Initiating exception indicator */ \n" - " oe_env->_major = CORBA_NO_EXCEPTION;\n"), - - %% XXX Add pointer checks: checks of in-parameter - %% pointers, and non-variable out-parameter pointers. - - emit(Fd," /* Creating ~s message */ \n", - [ifelse(IsOneway, "cast", "call")]), - - EncParListStr = ic_util:chain(mk_arg_list_for_encoder(G, N, X, - ParTypes, ArgNames), - ", "), - emit(Fd, - " if (~s__client_enc(oe_obj, ~s""oe_env) < 0) {\n", - [OpName, EncParListStr]), - emit(Fd, - " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "DATA_CONVERSION, \"Cannot encode message\");\n"), - - RetVar = ifelse(RV /= void, " oe_return", ""), - emit_c_enc_rpt(Fd, " ", "client operation ~s\\n====\\n", [OpName]), - - emit(Fd, " return~s;\n }\n", [RetVar]), - - emit(Fd," /* Sending ~s message */ \n", - [ifelse(IsOneway, "cast", "call")]), - - UserProto = get_user_proto(G, oe), - {Sfx, SendTmo, RecvTmo} = case get_c_timeout(G, "") of - "" -> - {"", "", ""}; - _ -> - {"_tmo", - [", OE_", IfNameUC, "_SEND_TIMEOUT"], - [", OE_", IfNameUC, "_RECV_TIMEOUT"]} - end, - - case IsOneway of - true -> - emit(Fd, - " if (~s_send_notification~s(oe_env~s) < 0)\n" - " return~s;\n", [UserProto, Sfx, SendTmo, RetVar]); - false -> - emit(Fd, - " if (~s_send_request_and_receive_reply~s(oe_env~s~s) < 0)\n" - " return~s;\n", - [UserProto, Sfx, SendTmo, RecvTmo, RetVar]), - - DecParList0 = mk_arg_list_for_decoder(G, N, X, - ParTypes, ArgNames), - DecParList1 = case mk_ret_type(G, N, R) of - "void" -> - DecParList0; - _ -> - ["&oe_return"| DecParList0] - end, - - DecParListStr = ic_util:chain(DecParList1, ", "), - %% YYY Extracting results - emit(Fd, - " /* Extracting result value(s) */ \n" - " if (~s__client_dec(oe_obj, ~s""oe_env) < 0) {\n", - [OpName, DecParListStr]), - emit(Fd, - " CORBA_exc_set(oe_env, " - "CORBA_SYSTEM_EXCEPTION, DATA_CONVERSION, " - "\"Bad result value(s)\");\n"), - emit_c_dec_rpt(Fd, " ", "client operation ~s\\n=====\\n", [OpName]), - emit(Fd, - " return~s;\n" - " }\n", [RetVar]) - end, - emit(Fd, " return~s;\n", [RetVar]), - emit(Fd, "}\n\n\n"). - -%%------------------------------------------------------------ -%% Generate encoder -%%------------------------------------------------------------ -%% N is the list of scoped ids of the *interface*. -%% X is the operation -gen_encoder(G, N, X, OpName, ArgNames, RetParTypes)-> - case ic_genobj:is_stubfile_open(G) of - true -> - Fd = ic_genobj:stubfiled(G), - IfName = ic_util:to_undersc(N), - {_R, ParTypes, _} = RetParTypes, - TypeAttrArgs = mk_type_attr_arg_list(ParTypes, ArgNames), - emit(Fd, "/*\n * Encode operation input for \"~s\"\n */\n\n", - [OpName]), - ParList = ic_util:chain( - mk_par_type_list(G, N, X, [in], [types, args], - ParTypes, ArgNames), ", "), - emit(Fd, - "int ~s__client_enc(~s oe_obj, ~s" - "CORBA_Environment *oe_env)\n{\n", - [OpName, IfName, ParList]), - - InTypeAttrArgs = lists:filter(fun({_, in, _}) -> true; - ({_, _, _}) -> false - end, TypeAttrArgs), - case InTypeAttrArgs of - [] -> - ok; - _ -> - emit(Fd, - " int oe_error_code = 0;\n\n") - end, - - emit_encodings(G, N, Fd, X, InTypeAttrArgs, - ic_forms:is_oneway(X)), - emit(Fd, " return 0;\n}\n\n"), - ok; - - false -> - ok - end. - -%%------------------------------------------------------------ -%% Generate decoder -%%------------------------------------------------------------ -%% N is the list of scoped ids of the *interface*. -%% X is the operation -gen_decoder(G, N, X, OpName, ArgNames, RetParTypes)-> - case ic_forms:is_oneway(X) of - true -> - ok; - false -> - case ic_genobj:is_stubfile_open(G) of - true -> - Fd = ic_genobj:stubfiled(G), - IfName = ic_util:to_undersc(N), - {R, ParTypes, _} = RetParTypes, - TypeAttrArgs = mk_type_attr_arg_list(ParTypes, ArgNames), - emit(Fd, "/*\n * Decode operation results for " - "\"~s\"\n */\n\n", [OpName]), - ParList0 = mk_par_type_list(G, N, X, [out], - [types, args], - ParTypes, ArgNames), - PARLIST = case mk_ret_type(G, N, R) of - "void" -> - ParList0; - Else -> - [Else ++ "* oe_return"| ParList0] - end, - PLFCD = ic_util:chain(PARLIST, ", "), - emit(Fd, - "int ~s__client_dec(~s oe_obj, ~s" - "CORBA_Environment *oe_env)\n{\n", - [OpName, IfName, PLFCD]), - emit(Fd, " int oe_error_code = 0;\n"), - OutTypeAttrArgs = lists:filter(fun({_, out, _}) -> true; - ({_, _, _}) -> false - end, TypeAttrArgs), - emit_decodings(G, N, Fd, R, OutTypeAttrArgs), - emit(Fd, " return 0;\n}\n\n"), - ok; - - false -> - ok - end - end. - -%%------------------------------------------------------------ -%% EMIT ENCODINGS/DECODINGS -%%------------------------------------------------------------ -%%------------------------------------------------------------ -%% Emit encodings -%%------------------------------------------------------------ -%% N is the list of scoped ids of the *interface*. -%% X is the operation -%% emit_encodings(G, N, Fd, X, TypeAttrArgs, IsOneWay) -%% -emit_encodings(G, N, Fd, X, TypeAttrArgs, true) -> - %% Cast - UserProto = get_user_proto(G, oe), - emit(Fd, - " if (~s_prepare_notification_encoding(oe_env) < 0)\n" - " return -1;\n", [UserProto]), - emit_encodings_1(G, N, Fd, X, TypeAttrArgs); -emit_encodings(G, N, Fd, X, TypeAttrArgs, false) -> - %% Call - UserProto = get_user_proto(G, oe), - emit(Fd, - " if (~s_prepare_request_encoding(oe_env) < 0)\n" - " return -1;\n", [UserProto]), - emit_encodings_1(G, N, Fd, X, TypeAttrArgs). - -emit_encodings_1(G, N, Fd, X, TypeAttrArgs) -> - {ScopedName, _, _} = ic_cbe:extract_info(G, N, X), - Name = case ic_options:get_opt(G, scoped_op_calls) of - true -> - ScopedName; - false -> - ic_forms:get_id2(X) - end, - if - TypeAttrArgs /= [] -> - emit(Fd, " if (oe_ei_encode_tuple_header(oe_env, ~p) < 0) {\n", - [length(TypeAttrArgs) + 1]), - emit_c_enc_rpt(Fd, " ", "ei_encode_tuple_header", []), - emit(Fd, " return -1;\n }\n"); - true -> - ok - end, - emit(Fd, " if (oe_ei_encode_atom(oe_env, ~p) < 0) {\n", [Name]), - emit_c_enc_rpt(Fd, " ", "oe_ei_encode_atom", []), - emit(Fd, " return -1;\n }\n"), - - foreach(fun({{'void', _}, _, _}) -> - ok; - ({T1, A1, N1}) -> - IndOp = mk_ind_op(A1), - emit_coding_comment(G, N, Fd, "Encode", IndOp, - T1, N1), - ic_cbe:emit_encoding_stmt(G, N, X, Fd, T1, IndOp ++ N1, - "oe_env->_outbuf") - end, TypeAttrArgs), - ok. - -%%------------------------------------------------------------ -%% Emit dedodings -%%------------------------------------------------------------ -%% XXX Unfortunately we have to retain the silly `oe_first' variable, -%% since its name is hardcoded in other modules (icstruct, icunion, -%% etc). -%% N is the list of scoped ids of the *interface*. -%% X is the operation -emit_decodings(G, N, Fd, RetType, TypeAttrArgs) -> - if - TypeAttrArgs /= [] -> - %% Only if there are out parameters - emit(Fd, " if ((oe_error_code = ei_decode_tuple_header(" - "oe_env->_inbuf, &oe_env->_iin, " - "&oe_env->_received)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "ei_decode_tuple_header", []), - emit(Fd, " return oe_error_code;\n }\n"), - Len = length(TypeAttrArgs) + 1, - emit(Fd, " if (oe_env->_received != ~p) {\n", [Len]), - emit_c_dec_rpt(Fd, " ", "tuple header size != ~p", [Len]), - emit(Fd, " return -1;\n }\n"); - true -> - ok - end, - - %% Fetch the return value - emit_coding_comment(G, N, Fd, "Decode return value", "*", RetType, "oe_return"), - APars = - case ic_cbe:is_variable_size(G, N, RetType) of - true -> - emit(Fd, - " {\n" - " int oe_size_count_index = oe_env->_iin;\n" - " int oe_malloc_size = 0;\n" - " void *oe_first = NULL;\n"), - ic_cbe:emit_malloc_size_stmt(G, N, Fd, RetType, - "oe_env->_inbuf", - 1, caller), - %% XXX Add malloc prefix from option - emit(Fd, - " OE_MALLOC_SIZE_CHECK(oe_env, oe_malloc_size);\n" - " if ((*oe_return = oe_first = " - "malloc(oe_malloc_size)) == NULL) {\n" - " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "NO_MEMORY, \"Cannot malloc\");\n" - " return -1;\n" - " }\n"), - Pars = ["*oe_return"], - DecType = case ictype:isArray(G, N, RetType) of - true -> array_dyn; - false -> caller_dyn - end, - ic_cbe:emit_decoding_stmt(G, N, Fd, RetType, - "(*oe_return)", - "", "oe_env->_inbuf", 1, - "&oe_outindex", DecType, - Pars), - emit(Fd, " }\n"), - Pars; - false -> - case ictype:isArray(G, N, RetType) of - true -> - Pars = ["*oe_return"], - emit(Fd, - " {\n" - " int oe_size_count_index = oe_env->_iin;\n" - " int oe_malloc_size = 0;\n" - " void *oe_first = NULL;\n"), - ic_cbe:emit_malloc_size_stmt(G, N, Fd, RetType, - "oe_env->_inbuf", - 1, caller), - %% XXX Add malloc prefix from option - emit(Fd, - " OE_MALLOC_SIZE_CHECK(oe_env, " - "oe_malloc_size);\n" - " if ((*oe_return = oe_first = " - "malloc(oe_malloc_size)) == NULL) {\n" - " CORBA_exc_set(oe_env, " - "CORBA_SYSTEM_EXCEPTION, NO_MEMORY, " - "\"Cannot malloc\");\n" - " return -1;" - " }\n"), - ic_cbe:emit_decoding_stmt(G, N, Fd, RetType, - "oe_return", "", - "oe_env->_inbuf", 1, - "&oe_outindex", - array_fix_ret, - Pars), - emit(Fd, " }\n"), - Pars; - false -> - Pars = [], - %% The last parameter "oe_outindex" is not interesting - %% in the static case. - ic_cbe:emit_decoding_stmt(G, N, Fd, RetType, - "oe_return", "", - "oe_env->_inbuf", 1, - "&oe_outindex", - caller, Pars), - ic_codegen:nl(Fd), - Pars - end - end, - - foldl(fun({{'void', _}, _, _}, Acc) -> - Acc; - ({T, A, N1}, Acc) -> - emit_one_decoding(G, N, Fd, T, A, N1, Acc) - end, APars, TypeAttrArgs), - ok. - -emit_one_decoding(G, N, Fd, T, A, N1, Acc) -> - IndOp = mk_ind_op(A), - case ic_cbe:is_variable_size(G, N, T) of - true -> - emit_coding_comment(G, N, Fd, "Decode", IndOp, - T, N1), - emit(Fd, - " {\n" - " int oe_size_count_index = oe_env->_iin;\n" - " int oe_malloc_size = 0;\n" - " void *oe_first = NULL;\n"), - ic_cbe:emit_malloc_size_stmt(G, N, Fd, T, - "oe_env->_inbuf", - 1, caller), - %% XXX Add malloc prefix from option - emit(Fd, - " OE_MALLOC_SIZE_CHECK(oe_env, oe_malloc_size);\n" - " if ((~s~s = oe_first = " - "malloc(oe_malloc_size)) == NULL) {\n", [IndOp, N1]), - ic_cbe:emit_dealloc_stmts(Fd, " ", Acc), - emit(Fd, - " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "NO_MEMORY, \"Cannot malloc\");\n" - " return -1;\n" - " }\n"), - NAcc = [IndOp ++ N1| Acc], - DecType = case ictype:isArray(G, N, T) of - true -> - array_dyn; - false -> - caller_dyn - end, - ic_cbe:emit_decoding_stmt(G, N, Fd, T, - "(" ++ IndOp - ++ N1 ++ ")", "", - "oe_env->_inbuf", 1, - "&oe_outindex", - DecType, NAcc), - emit(Fd, " }\n"), - NAcc; - false -> - case ictype:isArray(G, N, T) of - true -> - emit_coding_comment(G, N, Fd, "Decode", "", - T, N1), - ic_cbe:emit_decoding_stmt(G, N, Fd, T, N1, - "", "oe_env->_inbuf", - 1, "&oe_outindex", - array_fix_out, Acc), - ic_codegen:nl(Fd), - [N1| Acc]; - false -> - %% The last parameter "oe_outindex" is - %% not interesting in the static case, but - %% must be present anyhow. - emit_coding_comment(G, N, Fd, "Decode", - IndOp, T, N1), - ic_cbe:emit_decoding_stmt(G, N, Fd, T, N1, - "", "oe_env->_inbuf", - 1, "&oe_outindex", - caller, Acc), - ic_codegen:nl(Fd), - Acc - end - end. - -%%------------------------------------------------------------ -%% GENERATE PROTOTYPES -%%------------------------------------------------------------ -%%------------------------------------------------------------ -%% Generate operation prototypes -%%------------------------------------------------------------ -emit_operation_prototypes(G, Fd, N, Xs) -> - lists:foreach( - fun(X) when is_record(X, op) -> - {ScopedName, ArgNames, RetParTypes} = - ic_cbe:extract_info(G, N, X), - {R, ParTypes, _} = RetParTypes, - IfName = ic_util:to_undersc(N), - RT = mk_ret_type(G, N, R), - ParList = - ic_util:chain( - mk_par_type_list(G, N, X, [in, out], [types], - ParTypes, ArgNames), - ", "), - emit(Fd, "~s ~s(~s, ~sCORBA_Environment*);\n", - [RT, ScopedName, IfName, ParList]); - (_) -> - ok - end, Xs). - -%%------------------------------------------------------------ -%% Generate encoder prototypes -%%------------------------------------------------------------ -emit_encoder_prototypes(G, Fd, N, Xs) -> - lists:foreach( - fun(X) when is_record(X, op) -> - {ScopedName, ArgNames, RetParTypes} = - ic_cbe:extract_info(G, N, X), - {_R, ParTypes, _} = RetParTypes, - IfName = ic_util:to_undersc(N), - ParList = ic_util:chain( - mk_par_type_list(G, N, X, [in], [types], - ParTypes, ArgNames), - ", "), - emit(Fd, "int ~s__client_enc(~s, ~sCORBA_Environment*);\n", - [ScopedName, IfName, ParList]); - (_) -> - ok - end, Xs). - -%%------------------------------------------------------------ -%% Generate decoder prototypes -%%------------------------------------------------------------ -emit_decoder_prototypes(G, Fd, N, Xs) -> - lists:foreach( - fun(X) when is_record(X, op) -> - case ic_forms:is_oneway(X) of - true -> - true; - false -> - IfName = ic_util:to_undersc(N), - {ScopedName, ArgNames, RetParTypes} = - ic_cbe:extract_info(G, N, X), - {R, ParTypes, _} = RetParTypes, - ParList0 = - mk_par_type_list(G, N, X, [out], [types], - ParTypes, ArgNames), - PARLIST = case mk_ret_type(G, N, R) of - "void" -> - ParList0; - Else -> - [Else ++ "*"| ParList0] - end, - ParList = ic_util:chain(PARLIST, ", "), - emit(Fd, "int ~s__client_dec(~s, ~s" - "CORBA_Environment*);\n", - [ScopedName, IfName, ParList]) - end; - (_) -> - ok - end, Xs). - -%%------------------------------------------------------------ -%% PARAMETER TYPE LISTS -%%------------------------------------------------------------ -%%------------------------------------------------------------ -%% Make parameter type list -%% -%% InOrOut = in | out | [in | out] -%% TypesOrArgs = types | args | [types | args] -%%------------------------------------------------------------ -mk_par_type_list(G, N, X, InOrOut, TypesOrArgs, Types, Args) -> - TypeAttrArgs = - filterzip( - fun(_, {inout, Arg}) -> - ic_error:error(G, {inout_spec_for_c, X, Arg}), - false; - (Type, {Attr, Arg}) -> - case lists:member(Attr, InOrOut) of - true -> - {true, {Type, Attr, Arg}}; - false -> - false - end - end, Types, Args), - lists:map( - fun({Type, Attr, Arg}) -> - Ctype = ic_cbe:mk_c_type(G, N, Type), - IsArray = ictype:isArray(G, N, Type), - IsStruct = ictype:isStruct(G, N, Type), - IsUnion = ictype:isUnion(G, N, Type), - Dyn = - case ic_cbe:is_variable_size(G, N, Type) of - true -> - if - is_record(Type, string) -> ""; - Ctype == "CORBA_char *" -> ""; - is_record(Type, wstring) -> ""; - Ctype == "CORBA_wchar *" -> ""; - true -> - case IsArray of - true -> - "_slice*"; - false -> - "*" - end - end; - false -> - if - Attr == in, Ctype == "erlang_pid" -> - "*"; - Attr == in, Ctype == "erlang_port" -> - "*"; - Attr == in, Ctype == "erlang_ref" -> - "*"; - Attr == in, IsStruct == true -> - "*"; - Attr == in, IsUnion == true -> - "*"; - Attr == in, IsArray == true -> - "_slice*"; - Attr == out, IsArray == true -> - "_slice"; - true -> - "" - end - end, - IndOp = mk_ind_op(Attr), - case {lists:member(types, TypesOrArgs), - lists:member(args, TypesOrArgs)} of - {true, true} -> - Ctype ++ Dyn ++ IndOp ++ " " ++ Arg; - {true, false} -> - Ctype ++ Dyn ++ IndOp; - {false, true} -> - Arg; - {false, false} -> - "" - end - end, TypeAttrArgs). - -%%------------------------------------------------------------ -%% ENCODER ARG LIST -%%------------------------------------------------------------ -%%------------------------------------------------------------ -%% Make encoder argument list XXX -%%------------------------------------------------------------ -mk_arg_list_for_encoder(G, _N, X, Types, Args) -> - filterzip( - fun(_, {out, _}) -> - false; - (_, {inout, Arg}) -> - ic_error:error(G, {inout_spec_for_c, X, Arg}), - false; - (_Type, {in, Arg}) -> - {true, Arg} - end, Types, Args). - -%%------------------------------------------------------------ -%% DECODER ARG LIST -%%------------------------------------------------------------ -%%------------------------------------------------------------ -%% Make decoder argument list XXX -%%------------------------------------------------------------ -mk_arg_list_for_decoder(G, _N, X, Types, Args) -> - filterzip(fun(_, {in, _}) -> - false; - (_, {inout, Arg}) -> - ic_error:error(G, {inout_spec_for_c, X, Arg}), - false; - (_, {out, Arg}) -> - {true, Arg} - end, Types, Args). - -%%------------------------------------------------------------ -%% MISC -%%------------------------------------------------------------ -%%------------------------------------------------------------ -%% Make list of {Type, Attr, Arg} -%%------------------------------------------------------------ -mk_type_attr_arg_list(Types, Args) -> - filterzip(fun(Type, {Attr, Arg}) -> - {true, {Type, Attr, Arg}} - end, Types, Args). - -%%------------------------------------------------------------ -%% Make return type -%%------------------------------------------------------------ -mk_ret_type(G, N, Type) -> - Ctype = ic_cbe:mk_c_type(G, N, Type), - Dyn = case ic_cbe:is_variable_size(G, N, Type) of - true -> - if - is_record(Type, string) -> - ""; - Ctype == "CORBA_char *" -> - ""; - is_record(Type, wstring) -> - ""; - Ctype == "CORBA_wchar *" -> - ""; - true -> - case ictype:isArray(G, N, Type) of - true -> - "_slice*"; - false -> - "*" - end - end; - false -> - case ictype:isArray(G, N, Type) of - true -> - "_slice*"; - false -> - "" - end - end, - Ctype ++ Dyn. - - -%%------------------------------------------------------------ -%% Make indirection operator (to "*" or not to "*"). -%%------------------------------------------------------------ -mk_ind_op(in) -> - ""; -mk_ind_op(inout) -> - error; -mk_ind_op(out) -> - "*". - -%%------------------------------------------------------------ -%% Emit encoding/decoding comment -%%------------------------------------------------------------ -emit_coding_comment(G, N, Fd, String, RefOrVal, Type, Name) -> - emit(Fd, " /* ~s parameter: ~s~s ~s */\n", - [String, ic_cbe:mk_c_type(G, N, Type), RefOrVal, Name]). - -%%------------------------------------------------------------ -%% User protocol prefix for generic functions -%%------------------------------------------------------------ -get_user_proto(G, Default) -> - case ic_options:get_opt(G, user_protocol) of - false -> - Default; - Pfx -> - Pfx - end. - -%%------------------------------------------------------------ -%% Timeout. Returns a string (or Default). -%%------------------------------------------------------------ -get_c_timeout(G, Default) -> - case ic_options:get_opt(G, c_timeout) of - Tmo when is_integer(Tmo) -> - TmoStr = integer_to_list(Tmo), - {TmoStr, TmoStr}; - {SendTmo, RecvTmo} when is_integer(SendTmo) andalso is_integer(RecvTmo) -> - {integer_to_list(SendTmo), integer_to_list(RecvTmo)}; - false -> - Default - end. - -%%------------------------------------------------------------ -%% ZIPPERS (merging of successive elements of two lists). -%%------------------------------------------------------------ - -%% zip([H1| T1], [H2| T2]) -> -%% [{H1, H2}| zip(T1, T2)]; -%% zip([], []) -> -%% []. - -filterzip(F, [H1| T1], [H2| T2]) -> - case F(H1, H2) of - false -> - filterzip(F, T1, T2); - {true, Val} -> - [Val| filterzip(F, T1, T2)] - end; -filterzip(_, [], []) -> - []. - - -ifelse(true, A, _) -> - A; -ifelse(false, _, B) -> - B. diff --git a/lib/ic/src/ic_code.erl b/lib/ic/src/ic_code.erl deleted file mode 100644 index 98d57db93b..0000000000 --- a/lib/ic/src/ic_code.erl +++ /dev/null @@ -1,585 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(ic_code). - - --include_lib("ic/src/ic.hrl"). --include_lib("ic/src/icforms.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([get_basetype/2, insert_typedef/3, codeDirective/2]). --export([gen_includes/3, gen_includes/4, mk_list/1]). - --export([type_expand_op/4, type_expand_handle_op/4]). --export([ type_expand_op_exec/4, type_expand_all/6, type_expand/7]). - --export([type_expand_null/3, type_expand_void/3, type_expand_float/3, type_expand_double/3]). --export([type_expand_short/3, type_expand_ushort/3, type_expand_long/3, type_expand_ulong/3]). --export([type_expand_longlong/3, type_expand_ulonglong/3]). --export([type_expand_char/3, type_expand_wchar/3, type_expand_boolean/3]). --export([type_expand_octet/3, type_expand_any/3, type_expand_wstring/3]). --export([type_expand_object/3, type_expand_string/3, type_expand_struct/7, type_expand_union/7]). --export([type_expand_enum/4, type_expand_sequence/7, type_expand_array/7, type_expand_error/3]). - --export([type_expand_struct_rule/3, type_expand_union_rule/2, type_expand_enum_rule/4]). --export([type_expand_enum_elements/3, type_expand_longdouble/3, type_expand_typecode/3]). --export([type_expand_principal/3, type_expand_exception/7]). - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- - -%%------------------------------------------------------------------------------------- -%% -%% Trackrecording of generated sequence type structs, thist is just used for C today. -%% -%%------------------------------------------------------------------------------------- - -get_basetype(G, MyId) -> - case ?lookup(ic_genobj:typedeftab(G), MyId) of - [] -> - MyId; - X -> - get_basetype(G, X) - end. - -insert_typedef(_G, "erlang_term", _) -> - ok; -insert_typedef(G, MyId, DefinedAsId) -> - ?insert(ic_genobj:typedeftab(G), MyId, DefinedAsId). - -codeDirective(G,X) -> - case produceCode(X) of - true -> - case ic_options:get_opt(G, be) of - c_genserv -> - c; - c_client -> - c; - c_server -> - c_server; - _ -> - erlang - end; - false -> - case ic_options:get_opt(G, be) of - c_genserv -> - c_no_stub; - c_client -> - c_no_stub; - c_server -> - c_server_no_stub; - _ -> - erlang_no_stub - end - end. - -%% Checks if X should produce code -produceCode(X) when is_record(X, module) -> - case ic_forms:get_body(X) of - [] -> - true; - List -> - produceModuleCode(List) - end; -produceCode(_X) -> - false. - -produceModuleCode([]) -> - false; -produceModuleCode([X|_Xs]) when is_record(X, const) -> - true; -produceModuleCode([_X|Xs]) -> - produceModuleCode(Xs). - -%% Includes needed c file headers for included idl files -gen_includes(Fd,G,Type) -> - case Type of - c_client -> - IncludeList = - ic_pragma:get_included_c_headers(G), - gen_includes_loop(Fd,IncludeList,Type); - c_server -> - IncludeList = - ic_pragma:get_included_c_headers(G), - gen_includes_loop(Fd,IncludeList,Type); - _ -> - ok - end, - ic_codegen:nl(Fd), - ic_codegen:emit(Fd, "#ifdef __cplusplus\n"), - ic_codegen:emit(Fd, "extern \"C\" {\n"), - ic_codegen:emit(Fd, "#endif\n\n"). - - -%% Includes needed c file headers for local interfaces -gen_includes(Fd,G,X,Type) -> - case Type of - c_client -> - IncludeList = - ic_pragma:get_local_c_headers(G,X), - gen_includes_loop(Fd,IncludeList,Type); - c_server -> - IncludeList = - ic_pragma:get_local_c_headers(G,X), - gen_includes_loop(Fd,IncludeList,Type); - _ -> - ok - end, - ic_codegen:nl(Fd), - ic_codegen:emit(Fd, "#ifdef __cplusplus\n"), - ic_codegen:emit(Fd, "extern \"C\" {\n"), - ic_codegen:emit(Fd, "#endif\n\n"). - - -gen_includes_loop(_,[],_) -> - ok; -gen_includes_loop(Fd,[I|Is],Type) -> - L = string:tokens(I,"/"), - File = lists:last(L), - case File of - "erlang" -> % Erlang is NOT generated that way ! - gen_includes_loop(Fd,Is,Type); - "oe_erlang" -> % Erlang is NOT generated that way ! - gen_includes_loop(Fd,Is,Type); - _ -> - case Type of - c_client -> - ic_codegen:emit(Fd, "#include \"~s.h\"\n", [File]); - c_server -> - ic_codegen:emit(Fd, "#include \"~s__s.h\"\n", [File]) - end, - gen_includes_loop(Fd,Is,Type) - end. - - - - -%% -%% Used in NOC only -%% - - -%% -%% Type expand on function head comments -%% -type_expand_op(G,N,X,Fd) -> - case catch type_expand_op_exec(G,N,X,Fd) of - {'EXIT',_Reason} -> - ic_codegen:nl(Fd), - ic_codegen:emit(Fd,"%% Error under type expansion, does not affect generated code.~n",[]), - ic_codegen:emit(Fd,"%%------------------------------------------------------------~n",[]); - _ -> - ic_codegen:emit(Fd,"%%------------------------------------------------------------~n",[]) - end. - - -type_expand_op_exec(G,N,X,Fd) -> - InArgs = ic:filter_params([in,inout], X#op.params), - OutArgs = ic:filter_params([out,inout], X#op.params), - ParamNr = length(InArgs)+1, - Tabs = "", - - ic_codegen:nl(Fd), - ic_codegen:emit(Fd,"%%------------------------------------------------------------~n",[]), - - case ic_forms:is_oneway(X) of - false -> - ic_codegen:emit(Fd,"%% Operation: ~s/~p~n",[ic_forms:get_id2(X),ParamNr]); - true -> - ic_codegen:emit(Fd,"%% Operation: ~s/~p (oneway)~n",[ic_forms:get_id2(X),ParamNr]) - end, - - if X#op.raises == [] -> []; - true -> - ic_codegen:emit(Fd,"%%~n",[]), - RaisesList=["%% Raises: " ++ - mk_list(lists:map(fun(E) -> ic_util:to_colon(E) end, - X#op.raises))], - ic_codegen:emit(Fd,RaisesList,[]), - ic_codegen:nl(Fd) - end, - - %% Print argument names - ic_codegen:emit(Fd,"%%\n",[]), - InArgNames = ["OE_Ref"]++[ic_util:mk_var(ic_forms:get_id(InArg#param.id)) || InArg <- InArgs ], - OutArgNames = ["Ret"]++[ic_util:mk_var(ic_forms:get_id(OutArg#param.id)) || OutArg <- OutArgs ], - case length(InArgNames) > 1 of - true -> - ic_codegen:emit(Fd,"%% Input value(s) : ~s~n",[mk_list(InArgNames)]); - false -> - ic_codegen:emit(Fd,"%% Input value : ~s~n",[mk_list(InArgNames)]) - end, - case length(OutArgNames) > 1 of - true -> - ic_codegen:emit(Fd,"%% Return value(s) : ~s~n",[mk_list(OutArgNames)]); - false -> - ic_codegen:emit(Fd,"%% Return value : ~s~n",[mk_list(OutArgNames)]) - end, - ic_codegen:emit(Fd,"%%\n",[]), - - InArgsTypeList = - [{ic_util:mk_var(ic_forms:get_id(InArg#param.id)),ic_forms:get_tk(InArg)} || InArg <- InArgs ], - case InArgsTypeList of - [] -> %% no input parameters - ok; - _ -> - ic_codegen:emit(Fd,"%% --input-params-~n",[]), - type_expand_all(G,N,X,Fd,Tabs,InArgsTypeList) - end, - - ReturnTypeList =[{"Ret",X#op.tk}], - ic_codegen:emit(Fd,"%% --return-value-~n",[]), - type_expand_all(G,N,X,Fd,Tabs,ReturnTypeList), - - OutArgsTypeList = - [{ic_util:mk_var(ic_forms:get_id(OutArg#param.id)),ic_forms:get_tk(OutArg)} || OutArg <- OutArgs ], - case OutArgsTypeList of - [] -> %% no input parameters - ok; - _ -> - ic_codegen:emit(Fd,"%% -output-values-~n",[]), - type_expand_all(G,N,X,Fd,Tabs,OutArgsTypeList) - end. - - - - -type_expand_handle_op(G,N,X,Fd) -> - case catch type_expand_handle_op_exec(G,N,X,Fd) of - {'EXIT',_Reason} -> - ic_codegen:nl(Fd), - ic_codegen:emit(Fd,"%% Error under type expansion, does not affect generated code.~n",[]), - ic_codegen:emit(Fd,"%%------------------------------------------------------------~n",[]); - _ -> - ic_codegen:emit(Fd,"%%------------------------------------------------------------~n",[]) - end. - - -type_expand_handle_op_exec(_G,_N,X,Fd) -> - InArgs = ic:filter_params([in,inout], X#op.params), - ParamNr = length(InArgs)+1, - - ic_codegen:nl(Fd), - ic_codegen:emit(Fd,"%%------------------------------------------------------------~n",[]), - - case ic_forms:is_oneway(X) of - false -> - ic_codegen:emit(Fd,"%% Handle operation: handle_call/3~n",[]); - true -> - ic_codegen:emit(Fd,"%% Handle operation: handle_cast/3~n",[]) - end, - ic_codegen:emit(Fd,"%%~n",[]), - ic_codegen:emit(Fd,"%% Used for operation ~s/~p implementation~n",[ic_forms:get_id2(X),ParamNr]). - - - -type_expand_all(_G,_N,_X,_Fd,_Tabs,[]) -> - ok; -type_expand_all(G,N,X,Fd,Tabs,[{ArgName,Type}|Rest]) -> - type_expand(G,N,X,Fd,Tabs,ArgName,Type), - type_expand_all(G,N,X,Fd,Tabs,Rest); -type_expand_all(G,N,X,Fd,Tabs,[{default,_ArgName,Type}|Rest]) -> - type_expand(G,N,X,Fd,Tabs,"Def",Type), - type_expand_all(G,N,X,Fd,Tabs,Rest); -type_expand_all(G,N,X,Fd,Tabs,[{LabelNr,_ArgName,Type}|Rest]) when is_integer(LabelNr) -> - type_expand(G,N,X,Fd,Tabs,"V" ++ integer_to_list(LabelNr),Type), - type_expand_all(G,N,X,Fd,Tabs,Rest); -type_expand_all(G,N,X,Fd,Tabs,[{Label,_ArgName,Type}|Rest]) -> - type_expand(G,N,X,Fd,Tabs,Label,Type), - type_expand_all(G,N,X,Fd,Tabs,Rest). - - - -type_expand(_G,_N,_X,Fd,Tabs,Name,tk_null) -> - type_expand_null(Fd,Tabs,Name); -type_expand(_G,_N,_X,Fd,Tabs,Name,tk_void) -> - type_expand_void(Fd,Tabs,Name); -type_expand(_G,_N,_X,Fd,Tabs,Name,tk_float) -> - type_expand_float(Fd,Tabs,Name); -type_expand(_G,_N,_X,Fd,Tabs,Name,tk_double) -> - type_expand_double(Fd,Tabs,Name); -type_expand(_G,_N,_X,Fd,Tabs,Name,tk_longdouble) -> - type_expand_longdouble(Fd,Tabs,Name); -type_expand(_G,_N,_X,Fd,Tabs,Name,tk_short) -> - type_expand_short(Fd,Tabs,Name); -type_expand(_G,_N,_X,Fd,Tabs,Name,tk_ushort) -> - type_expand_ushort(Fd,Tabs,Name); -type_expand(_G,_N,_X,Fd,Tabs,Name,tk_long) -> - type_expand_long(Fd,Tabs,Name); -type_expand(_G,_N,_X,Fd,Tabs,Name,tk_longlong) -> - type_expand_longlong(Fd,Tabs,Name); -type_expand(_G,_N,_X,Fd,Tabs,Name,tk_ulong) -> - type_expand_ulong(Fd,Tabs,Name); -type_expand(_G,_N,_X,Fd,Tabs,Name,tk_ulonglong) -> - type_expand_ulonglong(Fd,Tabs,Name); -type_expand(_G,_N,_X,Fd,Tabs,Name,tk_char) -> - type_expand_char(Fd,Tabs,Name); -type_expand(_G,_N,_X,Fd,Tabs,Name,tk_wchar) -> - type_expand_wchar(Fd,Tabs,Name); -type_expand(_G,_N,_X,Fd,Tabs,Name,tk_boolean) -> - type_expand_boolean(Fd,Tabs,Name); -type_expand(_G,_N,_X,Fd,Tabs,Name,tk_octet) -> - type_expand_octet(Fd,Tabs,Name); -type_expand(_G,_N,_X,Fd,Tabs,Name,tk_any) -> - type_expand_any(Fd,Tabs,Name); -type_expand(_G,_N,_X,Fd,Tabs,Name,tk_TypeCode) -> - type_expand_typecode(Fd,Tabs,Name); -type_expand(_G,_N,_X,Fd,Tabs,Name,tk_Principal) -> - type_expand_principal(Fd,Tabs,Name); -type_expand(G, N, X,Fd,Tabs,Name, {tk_except, Id, ExcName, ElementList}) -> - type_expand_exception(G, N, X, Fd,Tabs,Name, - {tk_except, Id, ExcName, ElementList}); -type_expand(_G,_N,_X,Fd,Tabs,Name,{tk_fixed, _Digits, _Scale}) -> - type_expand_fixed(Fd,Tabs,Name); -type_expand(_G,_N,_X,Fd,Tabs,Name,{tk_objref, _IFRId, _ObjTabs, _ObjName}) -> - type_expand_object(Fd,Tabs,Name); -type_expand(_G,_N,_X,Fd,Tabs,Name,{tk_objref, _IFRId, _ObjName}) -> - type_expand_object(Fd,Tabs,Name); -type_expand(_G,_N,_X,Fd,Tabs,Name,{tk_string, _Length}) -> - type_expand_string(Fd,Tabs,Name); -type_expand(_G,_N,_X,Fd,Tabs,Name,{tk_wstring, _Length}) -> - type_expand_wstring(Fd,Tabs,Name); -type_expand(G,N,X,Fd,Tabs,Name,{tk_union, IFRId, UnionName, DTC, DNr, LblList}) -> - type_expand_union(G,N,X,Fd,Tabs,Name,{tk_union, IFRId, UnionName, DTC, DNr, LblList}); -type_expand(_G,_N,_X,Fd,Tabs,Name,{tk_enum, IFRId, EnumName, ElemNameList}) -> - type_expand_enum(Fd,Tabs,Name,{tk_enum, IFRId, EnumName, ElemNameList}); -type_expand(G,N,X,Fd,Tabs,Name,{tk_sequence, ElemTC, Length}) -> - type_expand_sequence(G,N,X,Fd,Tabs,Name,{tk_sequence, ElemTC, Length}); -type_expand(G,N,X,Fd,Tabs,Name,{tk_array, ElemTC, Length}) -> - type_expand_array(G,N,X,Fd,Tabs,Name,{tk_array, ElemTC, Length}); -type_expand(G,N,X,Fd,Tabs,Name,{tk_struct, IFRId, StructName, TcList}) -> - type_expand_struct(G,N,X,Fd,Tabs,Name,{tk_struct, IFRId, StructName, TcList}); -type_expand(_G,_N,_X,Fd,Tabs,Name,_) -> - type_expand_error(Fd,Tabs,Name). - - -%% Basic OMG IDL types - -type_expand_null(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = null()~n",[Tabs,Name]). - -type_expand_void(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = void()~n",[Tabs,Name]). - -type_expand_float(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = float()~n",[Tabs,Name]). - -type_expand_double(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = double()~n",[Tabs,Name]). - -type_expand_longdouble(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = long_double()~n",[Tabs,Name]). - -type_expand_short(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = short()~n",[Tabs,Name]). - -type_expand_ushort(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = unsigned_Short()~n",[Tabs,Name]). - -type_expand_long(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = long()~n",[Tabs,Name]). - -type_expand_longlong(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = long_Long()~n",[Tabs,Name]). - -type_expand_ulong(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = unsigned_Long()~n",[Tabs,Name]). - -type_expand_ulonglong(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = unsigned_Long_Long()~n",[Tabs,Name]). - -type_expand_char(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = char()~n",[Tabs,Name]). - -type_expand_wchar(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = wchar()~n",[Tabs,Name]). - -type_expand_boolean(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = boolean()~n",[Tabs,Name]). - -type_expand_octet(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = octet()~n",[Tabs,Name]). - -type_expand_any(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = any()~n",[Tabs,Name]). - -type_expand_typecode(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = TypeCode()~n",[Tabs,Name]). - -type_expand_principal(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = principal()~n",[Tabs,Name]). - - -type_expand_fixed(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = fixed()~n",[Tabs,Name]). - -type_expand_object(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = Object_Ref()~n",[Tabs,Name]). - - -%% Constructed OMG IDL types - -type_expand_string(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = String()~n",[Tabs,Name]). - -type_expand_wstring(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = WString()~n",[Tabs,Name]). - -type_expand_exception(G, N, X, Fd, Tabs, Name, {tk_except, Id, ExcName, ElementList}) -> - ScopedStructName = getScopedName(G, N, ExcName, Id), - ic_codegen:emit(Fd,"%%~s ~s = ",[Tabs, Name]), - type_expand_exception_rule(Fd, ScopedStructName, ElementList), - type_expand_all(G, N, X, Fd, Tabs, ElementList). - -type_expand_struct(G,N,X,Fd,Tabs,Name,{tk_struct, IFRId, StructName, TcList}) -> - ScopedStructName = getScopedName(G,N,StructName,IFRId), - ic_codegen:emit(Fd,"%%~s ~s = ",[Tabs,Name]), - type_expand_struct_rule(Fd,ScopedStructName,TcList), - type_expand_all(G,N,X,Fd,Tabs,TcList). - -type_expand_union(G,N,X,Fd,Tabs,Name,{tk_union, IFRId, UnionName, DTC, _DNr, LblList}) -> - ScopedUnionName = getScopedName(G,N,UnionName,IFRId), - ic_codegen:emit(Fd,"%%~s ~s = #'~s'{label, value}\n",[Tabs,Name,ScopedUnionName]), - type_expand(G,N,X,Fd,Tabs,"label",DTC), - ic_codegen:emit(Fd,"%%~s value = ",[Tabs]), - type_expand_union_rule(Fd,LblList), - type_expand_all(G,N,X,Fd,Tabs,LblList). - -type_expand_enum(Fd,Tabs,Name,{tk_enum, _IFRId, EnumName, ElemNameList}) -> - ic_codegen:emit(Fd,"%%~s ~s = ~s~n",[Tabs,Name,EnumName]), - type_expand_enum_rule(Fd,Tabs,EnumName,ElemNameList). - -type_expand_sequence(G,N,X,Fd,Tabs,Name,{tk_sequence, ElemTC, _Length}) -> - ic_codegen:emit(Fd,"%%~s ~s = [ ~sElem ]~n",[Tabs,Name,Name]), - type_expand(G,N,X,Fd,Tabs,Name++"Elem",ElemTC). - -type_expand_array(G,N,X,Fd,Tabs,Name,{tk_array, ElemTC, _Length}) -> - ic_codegen:emit(Fd,"%%~s ~s = { ~sElem[,..~sElem] }~n",[Tabs,Name,Name,Name]), - type_expand(G,N,X,Fd,Tabs,Name++"Elem",ElemTC). - -type_expand_error(Fd,Tabs,Name) -> - ic_codegen:emit(Fd,"%%~s ~s = ????~n",[Tabs,Name]). - - -type_expand_exception_rule(Fd,_Name,[]) -> - ic_codegen:emit(Fd," ???? "); -type_expand_exception_rule(Fd,Name,TcList) -> - ic_codegen:emit(Fd,"#'~s'{",[Name]), - type_expand_exception_rule(Fd,TcList). - -type_expand_exception_rule(Fd,[{Name,_TC}]) -> - ic_codegen:emit(Fd,"~s}~n",[Name]); -type_expand_exception_rule(Fd,[{Name,_TC}|Rest]) -> - ic_codegen:emit(Fd,"~s,",[Name]), - type_expand_exception_rule(Fd,Rest). - -type_expand_struct_rule(Fd,_Name,[]) -> - ic_codegen:emit(Fd," ???? "); -type_expand_struct_rule(Fd,Name,TcList) -> - ic_codegen:emit(Fd,"#'~s'{",[Name]), - type_expand_struct_rule(Fd,TcList). - -type_expand_struct_rule(Fd,[{Name,_TC}]) -> - ic_codegen:emit(Fd,"~s}~n",[Name]); -type_expand_struct_rule(Fd,[{Name,_TC}|Rest]) -> - ic_codegen:emit(Fd,"~s,",[Name]), - type_expand_struct_rule(Fd,Rest). - - -type_expand_union_rule(Fd,[]) -> - ic_codegen:emit(Fd," ????"); -type_expand_union_rule(Fd,[{default,_Name,_TC}]) -> - ic_codegen:emit(Fd,"Def~n",[]); -type_expand_union_rule(Fd,[{LNr,_Name,_TC}]) when is_integer(LNr)-> - ic_codegen:emit(Fd,"V~p~n",[LNr]); -type_expand_union_rule(Fd,[{Label,_Name,_TC}]) -> - ic_codegen:emit(Fd,"~s~n",[Label]); -type_expand_union_rule(Fd,[{default,_Name,_TC}|Rest]) -> - ic_codegen:emit(Fd,"Default | "), - type_expand_union_rule(Fd,Rest); -type_expand_union_rule(Fd,[{LNr,_Name,_TC}|Rest]) when is_integer(LNr) -> - ic_codegen:emit(Fd,"V~p | ",[LNr]), - type_expand_union_rule(Fd,Rest); -type_expand_union_rule(Fd,[{Label,_Name,_TC}|Rest]) -> - ic_codegen:emit(Fd,"~s | ",[Label]), - type_expand_union_rule(Fd,Rest). - - -type_expand_enum_rule(Fd,Tabs,Name,[]) -> - ic_codegen:emit(Fd,"%%~s ~s = ????",[Tabs,Name]); -type_expand_enum_rule(Fd,Tabs,Name,ElList) -> - ic_codegen:emit(Fd,"%%~s ~s = ",[Tabs,Name]), - type_expand_enum_rule(Fd,ElList). - -type_expand_enum_rule(Fd,[ElName]) -> - ic_codegen:emit(Fd,"'~s' ~n",[ElName]); -type_expand_enum_rule(Fd,[First|Rest]) -> - ic_codegen:emit(Fd,"'~s' | ",[First]), - type_expand_enum_rule(Fd,Rest). - -type_expand_enum_elements(_Fd,_Tabs,[]) -> - ok; -type_expand_enum_elements(Fd,Tabs,[Elem|Elems]) -> - ic_codegen:emit(Fd,"%%~s ~s = Atom()~n",[Tabs,Elem]), - type_expand_enum_elements(Fd,Tabs,Elems). - - - -%% Returns the right scoped name to be used -%% along with the expansion comments -getScopedName(G,N,Name,IfrId) -> - PTab = ic_genobj:pragmatab(G), - case ets:match(PTab,{alias,'$0',IfrId}) of - [] -> %% No Alias - should never happen - ic_util:to_undersc(ic_pragma:mk_scope(IfrId)); - [[[_S|N]]] -> %% An alias - ic_util:to_undersc([Name|N]); - [[[S|FoundScope]]] -> %% Maybe inherited - case ic_pragma:is_inherited_by(FoundScope,N,PTab) of - false -> %% Not inherited - ic_util:to_undersc([S|FoundScope]); - true -> %% inherited - ic_util:to_undersc([Name|N]) - end - end. - - -%% mk_list produces a nice comma separated -%% string of variable names -mk_list([]) -> []; -mk_list([Arg | Args]) -> - Arg ++ mk_list2(Args). -mk_list2([Arg | Args]) -> - ", " ++ Arg ++ mk_list2(Args); -mk_list2([]) -> []. - - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- - - - diff --git a/lib/ic/src/ic_codegen.erl b/lib/ic/src/ic_codegen.erl deleted file mode 100644 index a3f141f606..0000000000 --- a/lib/ic/src/ic_codegen.erl +++ /dev/null @@ -1,423 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(ic_codegen). - --include_lib("ic/src/ic.hrl"). --include_lib("ic/src/icforms.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([emit/2, emit/3]). --export([emit_c_enc_rpt/4, emit_c_dec_rpt/4]). --export([comment/2, comment/3, comment/4, comment_inlined/5, comment_prefixed/4]). --export([mcomment/2, mcomment/3, mcomment_inlined/5, mcomment_prefixed/3]). --export([mcomment_light/2, mcomment_light/3, mcomment_light_inlined/5, mcomment_light_prefixed/3]). --export([nl/1, export/2]). --export([record/5]). --export([emit_stub_head/4, emit_hrl_head/4, emit_hrl_foot/2]). -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- - -%%-------------------------------------------------------------------- -%% Emit output as a formatted string, (old emit) -%%-------------------------------------------------------------------- -emit(nil, _) -> ok; -emit(Fd, Str) -> - file:write(Fd, Str). - -emit(nil, _, _) -> ok; -emit(Fd, Fmt, Args) -> - file:write(Fd, io_lib:format(Fmt, Args)). - -emit_c_enc_rpt(Fd, Prefix, Fmt, Args) -> - emit(Fd, Prefix ++ "OE_RPT_ERR(\"Encode error: " ++ Fmt ++ "\");\n", Args). - -emit_c_dec_rpt(Fd, Prefix, Fmt, Args) -> - emit(Fd, Prefix ++ "OE_RPT_ERR(\"Decode error: " ++ Fmt ++ "\");\n", Args). - -%%-------------------------------------------------------------------- -%% Emit comments -%%-------------------------------------------------------------------- -comment(Fd, C) -> - comment_prefixed(Fd, C, [], "%%"). - -comment(Fd, C, A) -> - comment_prefixed(Fd, C, A, "%%"). - -comment(Fd, C, A, c) -> - comment_inlined(Fd, C, A, "/*", "*/"); -comment(Fd, C, A, erl) -> - comment_prefixed(Fd, C, A, "%%"); -comment(Fd, C, A, java) -> - comment_prefixed(Fd, C, A, "//"); -%% Should be removed after a check if it's used !!!!! (LTH) -comment(Fd, C, A, CommentSequence) when is_list(CommentSequence) -> - comment_prefixed(Fd, C, A, CommentSequence). - -comment_inlined(Fd, C, A, Start, End) -> - emit(Fd, Start ++ " " ++ C ++ " " ++ End ++"\n", A). - -comment_prefixed(Fd, C, A, Prefix) -> - emit(Fd, Prefix ++ " " ++ C ++ "\n", A). - -%%-------------------------------------------------------------------- -%% Emit multiline comments with nice delimiters -%%-------------------------------------------------------------------- -mcomment(Fd, List) -> - mcomment_prefixed(Fd, List, "%%"). - -mcomment(Fd, List, c) -> - mcomment_inlined(Fd, List, "/*", "*/", " *"); -mcomment(Fd, List, erl) -> - mcomment_prefixed(Fd, List, "%%"); -mcomment(Fd, List, java) -> - mcomment_prefixed(Fd, List, "//"). - -mcomment_inlined(Fd, List, Start, End, Intermediate) -> - emit(Fd, Start ++ - "------------------------------------------------------------\n"), - emit(Fd, Intermediate ++ "\n"), - lists:foreach(fun(C) -> comment(Fd, C, [], Intermediate) end, List), - emit(Fd, Intermediate ++ "\n"), - emit(Fd, Intermediate ++ - "------------------------------------------------------------" ++ End ++ "\n"), - ok. -mcomment_prefixed(Fd, List, Prefix) -> - emit(Fd, Prefix ++ - "------------------------------------------------------------\n"), - emit(Fd, Prefix ++ "\n"), - lists:foreach(fun(C) -> comment(Fd, C, [], Prefix) end, List), - emit(Fd, Prefix ++ "\n"), - emit(Fd, Prefix ++ - "------------------------------------------------------------\n"), - ok. - - -%%-------------------------------------------------------------------- -%% Emit multiline comments with nice delimiters as above but a -%% little lighter -%%-------------------------------------------------------------------- -mcomment_light(Fd, List) -> - mcomment_light_prefixed(Fd, List, "%%"). - -mcomment_light(Fd, List, c) -> - mcomment_light_inlined(Fd, List, "/*", " */", " *"); -mcomment_light(Fd, List, erl) -> - mcomment_light_prefixed(Fd, List, "%%"); -mcomment_light(Fd, List, java) -> - mcomment_light_prefixed(Fd, List, "//"); -%% Should be removed after a check if it's used !!!!! (LTH) -mcomment_light(Fd, List, Prefix) when is_list(Prefix) -> - mcomment_light_prefixed(Fd, List, Prefix). - -mcomment_light_inlined(Fd, List, Start, End, Intermediate) -> - emit(Fd, "\n" ++ Start ++ "\n"), - lists:foreach(fun(C) -> comment(Fd, C, [], Intermediate) end, List), - emit(Fd, End ++ "\n"), - ok. - -mcomment_light_prefixed(Fd, List, Prefix) -> - emit(Fd, Prefix), - lists:foreach(fun(C) -> comment(Fd, C, [], Prefix) end, List), - emit(Fd, Prefix ++ "\n"), - ok. - -%%-------------------------------------------------------------------- -%% New line -%%-------------------------------------------------------------------- -nl(Fd) -> - emit(Fd, "\n"). - - -%%-------------------------------------------------------------------- --define(IFRIDFIELD(G), ic_util:mk_name(G, "ID")). - -%%-------------------------------------------------------------------- -%% Emit record definitions for erlang -%%-------------------------------------------------------------------- -record(G, X, Name, _IFRID, Recs) when is_record(X, struct) -> - F = ic_genobj:hrlfiled(G), - emit(F, "-record(~p, {~p", [ic_util:to_atom(Name),hd(Recs)]), - lists:foreach(fun(Y) -> emit(F, ", ~p", [Y]) end, tl(Recs)), - emit(F, "}).\n"); -record(G, X, Name, _IFRID, _Recs) when is_record(X, union) -> - F = ic_genobj:hrlfiled(G), - emit(F, "-record(~p, {label, value}).\n",[ic_util:to_atom(Name)]); -record(G, _X, Name, IFRID, Recs) when length(Recs) > 3 -> - F = ic_genobj:hrlfiled(G), - emit(F, "-record(~p,~n {~p=~p", - [ic_util:to_atom(Name), ic_util:to_atom(?IFRIDFIELD(G)), IFRID]), - rec2(F, "", ", ", Recs), - emit(F, "}).\n"); -record(G, _X, Name, IFRID, Recs) -> - F = ic_genobj:hrlfiled(G), - emit(F, "-record(~p, {~p=~p", [ic_util:to_atom(Name), - ic_util:to_atom(?IFRIDFIELD(G)), - IFRID]), - lists:foreach(fun(Y) -> emit(F, ", ~p", [Y]) end, Recs), - emit(F, "}).\n"). - - -rec2(F, Align, Delim, [M1 , M2, M3 | Ms]) -> - emit(F, "~s~s~p, ~p, ~p", [Delim, Align, M1, M2, M3]), - rec2(F, " ", ",\n", Ms); -rec2(F, Align, Delim, [M1 , M2]) -> - emit(F, "~s~s~p, ~p", [Delim, Align, M1, M2]); -rec2(F, Align, Delim, [M]) -> - emit(F, "~s~s~p", [Delim, Align, M]); -rec2(_F, _Align, _Delim, []) -> - ok. - - -%%-------------------------------------------------------------------- -%% Emit export lists for erlang -%%-------------------------------------------------------------------- -export(F, [E1, E2, E3 | Exports]) -> - emit(F, "-export([~s]).\n", [exp_list([E1, E2, E3])]), - export(F, Exports); -export(_F, []) -> ok; -export(F, Exports) -> - emit(F, "-export([~s]).\n", [exp_list(Exports)]). - -exp_list([E1 | L]) -> - exp_to_string(E1) ++ - lists:map(fun(E) -> ", " ++ exp_to_string(E) end, L). - - -exp_to_string({F,N}) -> io_lib:format("~p/~p", [ic_util:to_atom(F), N]). - - -%%-------------------------------------------------------------------- -%% Emit Stub file header -%%-------------------------------------------------------------------- -emit_stub_head(_G, ignore, _Name, _) -> ignore; -emit_stub_head(G, F1, Name, erlang) -> - comment(F1, " coding: latin-1", []), - mcomment(F1, stub_header(G, Name)), - nl(F1), - emit(F1, "-module(~p).\n", [list_to_atom(Name)]), - emit(F1, "-ic_compiled(~p).\n", [compiler_vsn(?COMPILERVSN)]), - emit(F1, "\n\n"), F1; -emit_stub_head(G, F1, Name, erlang_template) -> - comment(F1, " coding: latin-1", []), - ic_erl_template:emit_header(G, F1, Name), - F1; -emit_stub_head(_G, F1, _Name, erlang_template_no_gen) -> - F1; -emit_stub_head(G, F1, Name, c) -> - mcomment(F1, stub_header(G, Name), c), - emit(F1, "int ic_compiled_~s_~s;\n", [compiler_vsn(?COMPILERVSN), Name]), - emit(F1, "\n\n"), F1; -emit_stub_head(G, F1, Name, c_server) -> - CSName = [Name, "__s"], - mcomment(F1, stub_header(G, CSName), c), - emit(F1, "int ic_compiled_~s_~s;\n", [compiler_vsn(?COMPILERVSN), CSName]), - emit(F1, "\n\n"), F1; -emit_stub_head(G, F1, Name, java) -> - mcomment(F1, stub_header(G, Name), java), - emit(F1, "\n\n"), F1. - -stub_header(G, Name) -> - ["Implementation stub file", - "", - io_lib:format("Target: ~ts", [Name]), - io_lib:format("Source: ~ts", [ic_genobj:idlfile(G)]), - io_lib:format("IC vsn: ~s", [?COMPILERVSN]), - "", - "This file is automatically generated. DO NOT EDIT IT."]. - -compiler_vsn(Vsn) -> - lists:map(fun($.) -> $_; - (C) -> C - end, Vsn). - -%%-------------------------------------------------------------------- -%% Emit include file header -%%-------------------------------------------------------------------- -%% Name is Fully scoped (undescore) name of interface or module -emit_hrl_head(_G, ignore, _Name, _) -> ignore; -emit_hrl_head(G, Fd, Name, erlang) -> - comment(Fd, " coding: latin-1", []), - mcomment(Fd, ["Erlang header file" | - hrl_header(G, Name)]), - nl(Fd), - nl(Fd), - IfdefName = ic_util:to_uppercase(Name++"_HRL"), - emit(Fd, "-ifndef(~s).~n", [IfdefName]), - emit(Fd, "-define(~s, true).~n", [IfdefName]), - nl(Fd), - nl(Fd), - Fd; -emit_hrl_head(G, Fd, Name, c) -> - mcomment(Fd, ["C header file" | - hrl_header(G, Name)], c), - nl(Fd), - nl(Fd), - IfdefName = ic_util:to_uppercase(Name++"_H"), - emit(Fd, "#ifndef ~s~n", [IfdefName]), - emit(Fd, "#define ~s ~n", [IfdefName]), - nl(Fd), - nl(Fd), - Fd; -emit_hrl_head(G, Fd, Name, c_server) -> - mcomment(Fd, ["C header file" | - hrl_header(G, [Name, "__s"])], c), - nl(Fd), - nl(Fd), - IfdefName = ic_util:to_uppercase(Name++"__S_H"), - emit(Fd, "#ifndef ~s~n", [IfdefName]), - emit(Fd, "#define ~s ~n", [IfdefName]), - nl(Fd), - nl(Fd), - Fd. - -hrl_header(G, Name) -> - ["", - io_lib:format("Target: ~ts", [Name]), - io_lib:format("Source: ~ts", [ic_genobj:idlfile(G)]), - io_lib:format("IC vsn: ~s", [?COMPILERVSN]), - "", - "This file is automatically generated. DO NOT EDIT IT."]. - - - - -%%-------------------------------------------------------------------- -%% Emit include file footer -%%-------------------------------------------------------------------- -emit_hrl_foot(_G, erlang_template) -> - ok; -emit_hrl_foot(_G, erlang_template_no_gen) -> - ok; -emit_hrl_foot(G, erlang) -> - case ic_genobj:is_hrlfile_open(G) of - true -> - Fd = ic_genobj:hrlfiled(G), - nl(Fd), - nl(Fd), - emit(Fd, "-endif.\n"), - nl(Fd), - nl(Fd), - Fd; - false -> - ok - end; -emit_hrl_foot(G, erlang_no_stub) -> - case ic_genobj:is_hrlfile_open(G) of - true -> - Fd = ic_genobj:hrlfiled(G), - nl(Fd), - nl(Fd), - emit(Fd, "-endif.\n"), - nl(Fd), - nl(Fd), - Fd; - false -> - ok - end; -emit_hrl_foot(G, c) -> - case ic_genobj:is_hrlfile_open(G) of - true -> - Fd = ic_genobj:hrlfiled(G), - nl(Fd), - nl(Fd), - emit(Fd, "#ifdef __cplusplus\n"), - emit(Fd, "}\n"), - emit(Fd, "#endif\n"), - nl(Fd), - emit(Fd, "#endif\n"), - nl(Fd), - nl(Fd), - Fd; - false -> - ok - end; -emit_hrl_foot(G, c_server) -> - case ic_genobj:is_hrlfile_open(G) of - true -> - Fd = ic_genobj:hrlfiled(G), - nl(Fd), - nl(Fd), - emit(Fd, "#ifdef __cplusplus\n"), - emit(Fd, "}\n"), - emit(Fd, "#endif\n"), - nl(Fd), - emit(Fd, "#endif\n"), - nl(Fd), - nl(Fd), - Fd; - false -> - ok - end; -emit_hrl_foot(G, c_no_stub) -> - case ic_genobj:is_hrlfile_open(G) of - true -> - Fd = ic_genobj:hrlfiled(G), - nl(Fd), - nl(Fd), - emit(Fd, "#ifdef __cplusplus\n"), - emit(Fd, "}\n"), - emit(Fd, "#endif\n"), - nl(Fd), - emit(Fd, "#endif\n"), - nl(Fd), - nl(Fd), - Fd; - false -> - ok - end; -emit_hrl_foot(G, c_server_no_stub) -> - case ic_genobj:is_hrlfile_open(G) of - true -> - Fd = ic_genobj:hrlfiled(G), - nl(Fd), - nl(Fd), - emit(Fd, "#ifdef __cplusplus\n"), - emit(Fd, "}\n"), - emit(Fd, "#endif\n"), - nl(Fd), - emit(Fd, "#endif\n"), - nl(Fd), - nl(Fd), - Fd; - false -> - ok - end. - - - - - - - - - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- diff --git a/lib/ic/src/ic_constant_java.erl b/lib/ic/src/ic_constant_java.erl deleted file mode 100644 index 49150f96ac..0000000000 --- a/lib/ic/src/ic_constant_java.erl +++ /dev/null @@ -1,100 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(ic_constant_java). - - --include("icforms.hrl"). --include("ic.hrl"). --include("ic_debug.hrl"). -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([gen/3]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- - -%%----------------------------------------------------------------- -%% Func: gen/3 -%%----------------------------------------------------------------- -gen(G, N, X) when is_record(X, const) -> - ConstantName = ic_forms:get_java_id(X), - case inInterface(G, N) of - true -> - emit_constant(G, N, X, ConstantName); - false -> - emit_constant_interface(G, N, X, ConstantName) - end; -gen(_G, _N, _X) -> - ok. - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- - -%%----------------------------------------------------------------- -%% Func: emit_constant/4 -%%----------------------------------------------------------------- -emit_constant(G, N, X, ConstantName) -> - Fd = ic_genobj:interfacefiled(G), - %%?PRINTDEBUG2("~p", [Fd]), - Type = ic_java_type:getType(G, N, ic_forms:get_type(X)), - ic_codegen:emit(Fd, " public static final ~s ~s = (~s) ~p;\n", - [Type, ConstantName, Type, X#const.val]), - ic_codegen:nl(Fd). - -%%----------------------------------------------------------------- -%% Func: emit_constant_interface/4 -%%----------------------------------------------------------------- -emit_constant_interface(G, N, X, ConstantName) -> - {Fd, _} = ic_file:open_java_file(G, N, ConstantName), - - ic_codegen:emit(Fd, "final public class ~s {\n",[ConstantName]), - - Type = ic_java_type:getType(G, N, ic_forms:get_type(X)), - ic_codegen:emit(Fd, " public static final ~s value = (~s) ~p;\n", - [Type, Type, X#const.val]), - ic_codegen:emit(Fd, "}\n", []), - file:close(Fd). - -%%----------------------------------------------------------------- -%% Func: emit_constant_interface/4 -%%----------------------------------------------------------------- -inInterface(_G, []) -> % Global constant - false; -inInterface(G, N) -> - [N1 |Ns] = N, - {_FullScopedName, T, _TK, _} = - ic_symtab:get_full_scoped_name(G, Ns, ic_symtab:scoped_id_new(N1)), - case T of - interface -> % Constant declare in an interface - true; - _ -> % Constant declared in a module - false - end. - diff --git a/lib/ic/src/ic_cserver.erl b/lib/ic/src/ic_cserver.erl deleted file mode 100644 index 7c7506367e..0000000000 --- a/lib/ic/src/ic_cserver.erl +++ /dev/null @@ -1,2420 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(ic_cserver). - -%% This module implements generation of C server code, where the -%% server acts as an Erlang C-node, where the functionality is that of -%% a gen_server (in C), and where the communication thus is according -%% to the Erlang distribution protocol. -%% - --export([do_gen/3]). - -%% Silly dialyzer. --export([filterzip/3]). - -%%------------------------------------------------------------ -%% -%% Internal stuff -%% -%%------------------------------------------------------------ - --import(lists, [foreach/2, foldl/3, foldr/3, map/2]). --import(ic_codegen, [emit/2, emit/3, emit/4, emit_c_enc_rpt/4, emit_c_dec_rpt/4]). - --include("icforms.hrl"). --include("ic.hrl"). --include_lib("stdlib/include/erl_compile.hrl"). - --define(IC_HEADER, "ic.h"). --define(ERL_INTERFACEHEADER, "erl_interface.h"). --define(EICONVHEADER, "ei.h"). --define(OE_MSGBUFSIZE, "OE_MSGBUFSIZE"). --define(ERLANGATOMLENGTH, "256"). - -%%------------------------------------------------------------ -%% -%% Entry point -%% -%%------------------------------------------------------------ -do_gen(G, File, Form) -> - OeName = ic_util:mk_oe_name(G, remove_ext(ic_util:to_list(File))), - G2 = ic_file:filename_push(G, [], OeName, c_server), - gen_headers(G2, [], Form), - R = gen(G2, [], Form), - ic_file:filename_pop(G2, c), - R. - -remove_ext(File) -> - filename:rootname(filename:basename(File)). - -%%------------------------------------------------------------ -%% -%% Generate the server side C stub and header files. -%% -%% For each module a separate file is generated. -%% -%% -%%------------------------------------------------------------ - -gen(G, N, [X| Xs]) when is_record(X, preproc) -> - NewG = change_file_stack(G, N, X#preproc.cat, X), - gen(NewG, N, Xs); - -gen(G, N, [X| Xs]) when is_record(X, module) -> - CD = ic_code:codeDirective(G, X), - G2 = ic_file:filename_push(G, N, X, CD), - N2 = [ic_forms:get_id2(X)| N], - gen_headers(G2, N2, X), - gen(G2, N2, ic_forms:get_body(X)), - G3 = ic_file:filename_pop(G2, CD), - gen(G3, N, Xs); - -gen(G, N, [X| Xs]) when is_record(X, interface) -> - G2 = ic_file:filename_push(G, N, X, c_server), - N2 = [ic_forms:get_id2(X)| N], - gen_prototypes(G2, N2, X), - gen_serv(G2, N2, X), - G3 = ic_file:filename_pop(G2, c), - gen(G3, N, Xs); - -gen(G, N, [X| Xs]) when is_record(X, const) -> - emit_constant(G, N, X), - gen(G, N, Xs); - -gen(G, N, [X| Xs]) when is_record(X, op) -> - gen(G, N, Xs); - -gen(G, N, [X| Xs]) when is_record(X, attr) -> - gen(G, N, Xs); - -gen(G, N, [X| Xs]) when is_record(X, except) -> - icstruct:except_gen(G, N, X, c), - gen(G, N, Xs); - -gen(G, N, [X| Xs]) when is_record(X, enum) -> - icenum:enum_gen(G, N, X, c), - gen(G, N, Xs); - -gen(G, N, [X| Xs]) when is_record(X, typedef) -> - icstruct:struct_gen(G, N, X, c), - gen(G, N, Xs); - -gen(G, N, [X| Xs]) when is_record(X, struct) -> - icstruct:struct_gen(G, N, X, c), - gen(G, N, Xs); - -gen(G, N, [X| Xs]) when is_record(X, union) -> - icstruct:struct_gen(G, N, X, c), - gen(G, N, Xs); - -gen(G, N, [_| Xs]) -> - gen(G, N, Xs); - -gen(_G, _N, []) -> - ok. - -%%------------------------------------------------------------ -%% Change file stack -%%------------------------------------------------------------ - -change_file_stack(G, _N, line_nr, X) -> - Id = ic_forms:get_id2(X), - Flags = X#preproc.aux, - case Flags of - [] -> ic_genobj:push_file(G, Id); - _ -> - foldr( - fun({_, _, "1"}, G1) -> ic_genobj:push_file(G1, Id); - ({_, _, "2"}, G1) -> ic_genobj:pop_file(G1, Id); - ({_, _, "3"}, G1) -> ic_genobj:sys_file(G1, Id) - end, G, Flags) - end; -change_file_stack(G, _N, _Other, _X) -> - G. - -%%------------------------------------------------------------ -%% Generate headers -%%------------------------------------------------------------ - -%% Some items have extra includes -gen_headers(G, N, X) when is_record(X, module) -> - case ic_genobj:is_hrlfile_open(G) of - true -> - HFd = ic_genobj:hrlfiled(G), - IncludeFileStack = ic_genobj:include_file_stack(G), - Filename = lists:nth(length(N) + 1, IncludeFileStack), - emit(HFd, "#include \"~s\"\n", [filename:basename(Filename)]), - ic_code:gen_includes(HFd, G, X, c_server); - false -> ok - end; -gen_headers(G, [], _X) -> - case ic_genobj:is_hrlfile_open(G) of - true -> - HFd = ic_genobj:hrlfiled(G), - emit(HFd, "#include \n"), - case ic_options:get_opt(G, c_report) of - true -> - emit(HFd, "#ifndef OE_C_REPORT\n"), - emit(HFd, "#define OE_C_REPORT\n"), - emit(HFd, "#include \n"), - emit(HFd, "#endif\n"); - _ -> - ok - end, - emit(HFd, "#include \"~s\"\n", [?IC_HEADER]), - emit(HFd, "#include \"~s\"\n", [?ERL_INTERFACEHEADER]), - emit(HFd, "#include \"~s\"\n", [?EICONVHEADER]), - ic_code:gen_includes(HFd, G, c_server); - false -> ok - end; -gen_headers(_G, _N, _X) -> - ok. - -%%------------------------------------------------------------ -%% Generate prototypes -%%------------------------------------------------------------ - -gen_prototypes(G, N, X) -> - case ic_genobj:is_hrlfile_open(G) of - true -> - HFd = ic_genobj:hrlfiled(G), - IncludeFileStack = ic_genobj:include_file_stack(G), - L = length(N), - Filename = - if - L < 2 -> - lists:nth(L + 1, IncludeFileStack); - true -> - lists:nth(2, IncludeFileStack) - end, - - IName = ic_util:to_undersc(N), - INameUC = ic_util:to_uppercase(IName), - - emit(HFd, "#include \"~s\"\n", [filename:basename(Filename)]), - ic_code:gen_includes(HFd, G, X, c_server), - ic_codegen:nl(HFd), - - emit(HFd, "\n#ifndef __~s__\n", [ic_util:to_uppercase(IName)]), - emit(HFd, "#define __~s__\n", [ic_util:to_uppercase(IName)]), - ic_codegen:mcomment_light(HFd, - [io_lib:format("Interface " - "object " - "definition: ~s", - [IName])], c), - case get_c_timeout(G, "") of - "" -> - ok; - {SendTmo, RecvTmo} -> - emit(HFd, "#define OE_~s_SEND_TIMEOUT ~s\n", - [INameUC, SendTmo]), - emit(HFd, "#define OE_~s_RECV_TIMEOUT ~s\n", - [INameUC, RecvTmo]), - emit(HFd, "#ifndef EI_HAVE_TIMEOUT\n"), - emit(HFd, "#error Functions for send and receive with " - "timeout not defined in erl_interface\n"), - emit(HFd, "#endif\n\n") - end, - - emit(HFd, "typedef CORBA_Object ~s;\n\n", [IName]), - emit(HFd, "#endif\n\n"), - - Bodies = [{N, ic_forms:get_body(X)}| X#interface.inherit_body], - - emit(HFd, "\n/* Structure definitions */\n", []), - foreach(fun({N2, Body}) -> - emit_structs_inside_module(G, HFd, N2, Body) end, - Bodies), - - emit(HFd, "\n/* Switch and exec functions */\n", []), - emit(HFd, "int ~s__switch(~s oe_obj, CORBA_Environment " - "*oe_env);\n", [IName, IName]), - foreach(fun({_N2, Body}) -> - emit_exec_prototypes(G, HFd, N, Body) end, - Bodies), - - emit(HFd, "\n/* Generic decoder */\n", []), - emit(HFd, "int ~s__call_info(~s oe_obj, CORBA_Environment " - "*oe_env);\n", [IName, IName]), - - emit(HFd, "\n/* Restore function typedefs */\n", []), - foreach(fun({_N2, Body}) -> - emit_restore_typedefs(G, HFd, N, Body) end, - Bodies), - - emit(HFd, "\n/* Callback functions */\n", []), - foreach(fun({_N2, Body}) -> - emit_callback_prototypes(G, HFd, N, Body) end, - Bodies), - - emit(HFd, "\n/* Parameter decoders */\n", []), - foreach(fun({_N2, Body}) -> - emit_decoder_prototypes(G, HFd, N, Body) end, - Bodies), - - emit(HFd, "\n/* Message encoders */\n", []), - foreach(fun({_N2, Body}) -> - emit_encoder_prototypes(G, HFd, N, Body) end, - Bodies), - - %% Emit operation mapping structures - emit_operation_mapping_declaration(G, HFd, N, Bodies), - - ok; - - false -> - ok - end. - -%%------------------------------------------------------------ -%% Generate the server encoding/decoding function -%%------------------------------------------------------------ - - -gen_serv(G, N, X) -> - case ic_genobj:is_stubfile_open(G) of - true -> - Fd = ic_genobj:stubfiled(G), - - emit_switch(G, Fd, N, X), - emit_server_generic_decoding(G, Fd, N), - - %% Sets the temporary variable counter. - put(op_variable_count, 0), - put(tmp_declarations, []), - - %% Generate exec, decode and encoding functions, and - %% table of exec functions. - Bodies = [{N, ic_forms:get_body(X)}| - X#interface.inherit_body], - - foreach(fun({_N2, Body}) -> - emit_dispatch(G, Fd, N, Body) end, - Bodies), - emit_operation_mapping(G, Fd, N, Bodies); - false -> - ok - end. - -%%------------------------------------------------------------ -%% Emit structs inside module -%%------------------------------------------------------------ - -emit_structs_inside_module(G, _Fd, N, Xs)-> - lists:foreach( - fun(X) when is_record(X, enum) -> - icenum:enum_gen(G, N, X, c); - (X) when is_record(X, typedef) -> - icstruct:struct_gen(G, N, X, c); - (X) when is_record(X, struct) -> - icstruct:struct_gen(G, N, X, c); - (X) when is_record(X, union) -> - icstruct:struct_gen(G, N, X, c); - (_) -> - ok - end, Xs). - -%%------------------------------------------------------------ -%% Emit exec prototypes -%%------------------------------------------------------------ - -emit_exec_prototypes(G, Fd, N, Xs) -> - lists:foreach( - fun(X) when is_record(X, op) -> - {ScopedName, _, _} = ic_cbe:extract_info(G, N, X), - emit(Fd, - "int ~s__exec(~s oe_obj, CORBA_Environment *oe_env);\n", - [ScopedName, ic_util:to_undersc(N)]); - (X) when is_record(X, const) -> - emit_constant(G, N, X); - (_) -> - ok - end, Xs). - -%%------------------------------------------------------------ -%% Emit restore typedefs -%%------------------------------------------------------------ - -emit_restore_typedefs(G, Fd, N, [X| Xs]) when is_record(X, op) -> - %% Check if to use scoped call names - {ScopedName, ArgNames, Types} = ic_cbe:extract_info(G, N, X), - {RetType, ParTypes, _} = Types, - TypeAttrArgs = mk_type_attr_arg_list(ParTypes, ArgNames), - RT = mk_c_ret_type(G, N, RetType), - - PL = ic_util:mk_list(mk_par_list_for_callback_prototypes(G, N, X, - TypeAttrArgs)), - RPL = case PL of - "" -> - ""; - _PL -> - ", " ++ PL - end, - - case RT of - "void" -> - case PL of - "" -> - emit(Fd, "typedef void (*~s__rs(~s oe_obj, " - "CORBA_Environment *oe_env));\n", - [ScopedName, ic_util:to_undersc(N)]); - _ -> - emit(Fd, "typedef void (*~s__rs(~s oe_obj, ~s, " - "CORBA_Environment *oe_env));\n", - [ScopedName, ic_util:to_undersc(N), PL]) - end; - - "erlang_port*" -> - emit(Fd, "typedef void (*~s__rs(~s oe_obj, ~s~s, " - "CORBA_Environment *oe_env));\n", - [ScopedName, ic_util:to_undersc(N), RT, RPL]); - - "erlang_pid*" -> - emit(Fd, "typedef void (*~s__rs(~s oe_obj, ~s~s, " - "CORBA_Environment *oe_env));\n", - [ScopedName, ic_util:to_undersc(N), RT, RPL]); - - "erlang_ref*" -> - emit(Fd, "typedef void (*~s__rs(~s oe_obj, ~s~s, " - "CORBA_Environment *oe_env));\n", - [ScopedName, ic_util:to_undersc(N), RT, RPL]); - - _ -> - case ictype:isArray(G, N, RetType) of - true -> - emit(Fd, "typedef void (*~s__rs(~s oe_obj, ~s~s, " - "CORBA_Environment *oe_env));\n", - [ScopedName, ic_util:to_undersc(N), RT, RPL]); - false -> - emit(Fd, "typedef void (*~s__rs(~s oe_obj, ~s*~s, " - "CORBA_Environment *oe_env));\n", - [ScopedName, ic_util:to_undersc(N), RT, RPL]) - end - end, - emit_restore_typedefs(G, Fd, N, Xs); -emit_restore_typedefs(G, Fd, N, [X| Xs]) when is_record(X, attr) -> - emit_restore_typedefs(G, Fd, N, Xs); -emit_restore_typedefs(G, Fd, N, [_X| Xs]) -> - emit_restore_typedefs(G, Fd, N, Xs); -emit_restore_typedefs(_G, _Fd, _N, []) -> ok. - - -%%------------------------------------------------------------ -%% Emit call-back prototypes -%%------------------------------------------------------------ - -emit_callback_prototypes(G, Fd, N, [X| Xs]) when is_record(X, op) -> - %% Check scoped names XXX - {ScopedName, ArgNames, Types} = ic_cbe:extract_info(G, N, X), - {RetType, ParTypes, _} = Types, - TypeAttrArgs = mk_type_attr_arg_list(ParTypes, ArgNames), - RT = mk_c_ret_type(G, N, RetType), - - PL = ic_util:mk_list(mk_par_list_for_callback_prototypes(G, N, X, - TypeAttrArgs)), - CBPL = case PL of - "" -> - ""; - _PL -> - ", " ++ PL - end, - case RT of - "void" -> - case PL of - "" -> - emit(Fd, "~s__rs* ~s__cb(~s oe_obj, " - "CORBA_Environment *oe_env);\n", - [ScopedName, ScopedName, ic_util:to_undersc(N)]); - _ -> - emit(Fd, "~s__rs* ~s__cb(~s oe_obj, ~s, " - "CORBA_Environment *oe_env);\n", - [ScopedName, ScopedName, ic_util:to_undersc(N), PL]) - end; - "erlang_port*" -> - emit(Fd, "~s__rs* ~s__cb(~s oe_obj, ~s~s, " - "CORBA_Environment *oe_env);\n", - [ScopedName, ScopedName, ic_util:to_undersc(N), RT, CBPL]); - - "erlang_pid*" -> - emit(Fd, "~s__rs* ~s__cb(~s oe_obj, ~s~s, " - "CORBA_Environment *oe_env);\n", - [ScopedName, ScopedName, ic_util:to_undersc(N), RT, CBPL]); - - "erlang_ref*" -> - emit(Fd, "~s__rs* ~s__cb(~s oe_obj, ~s~s, " - "CORBA_Environment *oe_env);\n", - [ScopedName, ScopedName, ic_util:to_undersc(N), RT, CBPL]); - - _ -> - case ictype:isArray(G, N, RetType) of - true -> - emit(Fd, "~s__rs* ~s__cb(~s oe_obj, ~s~s, " - "CORBA_Environment *oe_env);\n", - [ScopedName, ScopedName, ic_util:to_undersc(N), RT, - CBPL]); - false -> - emit(Fd, "~s__rs* ~s__cb(~s oe_obj, ~s*~s, " - "CORBA_Environment *oe_env);\n", - [ScopedName, ScopedName, ic_util:to_undersc(N), RT, - CBPL]) - end - end, - emit_callback_prototypes(G, Fd, N, Xs); -emit_callback_prototypes(G, Fd, N, [X| Xs]) when is_record(X, attr) -> - emit_callback_prototypes(G, Fd, N, Xs); -emit_callback_prototypes(G, Fd, N, [_X| Xs]) -> - emit_callback_prototypes(G, Fd, N, Xs); -emit_callback_prototypes(_G, _Fd, _N, []) -> ok. - -%%------------------------------------------------------------ -%% Emit decoder prototypes -%%------------------------------------------------------------ - -emit_decoder_prototypes(G, Fd, N, [X| Xs]) when is_record(X, op) -> - %% Check if to use scoped call names - {ScopedName, ArgNames, Types} = ic_cbe:extract_info(G, N, X), - {_RetType, ParTypes, _} = Types, - TypeAttrArgs = mk_type_attr_arg_list(ParTypes, ArgNames), - case ic_util:mk_list(mk_par_list_for_decoder_prototypes(G, N, X, - TypeAttrArgs)) of - "" -> - ok; - PLFDP -> - emit(Fd, "int ~s__dec(~s oe_obj, ~s, CORBA_Environment " - "*oe_env);\n", - [ScopedName, ic_util:to_undersc(N), PLFDP]) - end, - emit_decoder_prototypes(G, Fd, N, Xs); -emit_decoder_prototypes(G, Fd, N, [X| Xs]) when is_record(X, attr) -> - emit_decoder_prototypes(G, Fd, N, Xs); -emit_decoder_prototypes(G, Fd, N, [_X| Xs]) -> - emit_decoder_prototypes(G, Fd, N, Xs); -emit_decoder_prototypes(_G, _Fd, _N, []) -> ok. - - -%%------------------------------------------------------------ -%% Emit encoder prototypes -%%------------------------------------------------------------ - -emit_encoder_prototypes(G, Fd, N, [X| Xs]) when is_record(X, op) -> - case ic_forms:is_oneway(X) of - true -> - emit_encoder_prototypes(G, Fd, N, Xs); - false -> - %% Check if to use scoped call names - {ScopedName, ArgNames, Types} = ic_cbe:extract_info(G, N, X), - {RetType, ParTypes, _} = Types, - TypeAttrArgs = mk_type_attr_arg_list(ParTypes, ArgNames), - RType = mk_c_ret_type(G, N, RetType), - case ic_util:mk_list(mk_par_list_for_encoder_prototypes( - G, N, X, TypeAttrArgs)) of - "" -> - case RType of - "void" -> - emit(Fd, "int ~s__enc(~s oe_obj, " - "CORBA_Environment *oe_env);\n", - [ScopedName, ic_util:to_undersc(N)]); - _ -> - emit(Fd, "int ~s__enc(~s oe_obj, ~s, " - "CORBA_Environment *oe_env);\n", - [ScopedName, ic_util:to_undersc(N), RType]) - end; - PLFEP -> - case RType of - "void" -> - emit(Fd, "int ~s__enc(~s oe_obj, ~s, " - "CORBA_Environment *oe_env);\n", - [ScopedName, ic_util:to_undersc(N), PLFEP]); - _ -> - emit(Fd, "int ~s__enc(~s oe_obj, ~s, ~s, " - "CORBA_Environment *oe_env);\n", - [ScopedName, ic_util:to_undersc(N), RType, - PLFEP]) - end - end, - emit_encoder_prototypes(G, Fd, N, Xs) - end; -emit_encoder_prototypes(G, Fd, N, [X| Xs]) when is_record(X, attr) -> - emit_encoder_prototypes(G, Fd, N, Xs); -emit_encoder_prototypes(G, Fd, N, [_X| Xs]) -> - emit_encoder_prototypes(G, Fd, N, Xs); -emit_encoder_prototypes(_G, _Fd, _N, []) -> ok. - -%%------------------------------------------------------------ -%% Emit operation mapping declaration -%%------------------------------------------------------------ - -emit_operation_mapping_declaration(G, Fd, N, Bodies) -> - Interface = ic_util:to_undersc(N), - Length = erlang:length(get_all_opnames(G, N, Bodies)), - emit(Fd, "\n/* Operation mapping */\n", []), - emit(Fd, "extern oe_map_t oe_~s_map;\n", [Interface]), - emit(Fd, "/* For backward compatibility */\n"), - emit(Fd, "#define ___~s_map___ oe_~s_map\n", - [Interface, Interface]), - case Length of - 0 -> - ok; - _ -> - emit(Fd, "extern oe_operation_t oe_~s_operations[];\n", - [Interface]), - emit(Fd, "/* For backward compatibility */\n"), - emit(Fd, "#define ___~s_operations___ oe_~s_operations\n", - [Interface, Interface]) - end. - - -%% Returns a list of {OpName, ScopedOpName} for all operations, where -%% OpName == ScopedOpName in case the `scoped_op_calls' option has -%% been set. -%% -get_all_opnames(G, N, Bodies) -> - ScNF = fun(X) -> - {ScName, _, _} = ic_cbe:extract_info(G, N, X), - ScName - end, - NF = case ic_options:get_opt(G, scoped_op_calls) of - true -> - ScNF; - false -> - fun(X) -> ic_forms:get_id2(X) end - end, - Filter = fun(X) when is_record(X, op) -> - {true, {NF(X), ScNF(X)}}; - (_) -> - false - end, - %% zf == filtermap - lists:flatmap(fun({_, Xs}) -> lists:zf(Filter, Xs) end, Bodies). - -%%------------------------------------------------------------ -%% Emit switch -%%------------------------------------------------------------ - -emit_switch(G, Fd, N, _X) -> - emit(Fd, "#include \n"), - case ic_options:get_opt(G, c_report) of - true -> - emit(Fd, "#ifndef OE_C_REPORT\n"), - emit(Fd, "#define OE_C_REPORT\n"), - emit(Fd, "#include \n"), - emit(Fd, "#endif\n"); - _ -> - ok - end, - StartCode = - "#include \"ic.h\"\n" - "#include \"erl_interface.h\"\n" - "#include \"ei.h\"\n" - "#include \"~s__s.h\"\n\n" - "/*\n" - " * Main switch\n" - " */\n\n" - "int ~s__switch(~s oe_obj, CORBA_Environment *oe_env)\n" - "{\n" - " return oe_exec_switch(oe_obj, oe_env, &oe_~s_map);\n" - "}\n\n", - ScopedName = ic_util:to_undersc(N), - emit(Fd, StartCode, [ScopedName, ScopedName, ScopedName, ScopedName]). - -%%------------------------------------------------------------ -%% Emit server generic decoding. -%%------------------------------------------------------------ - -emit_server_generic_decoding(G, Fd, N) -> - UserProto = get_user_proto(G, oe), - Code = - "/*\n" - " * Returns call identity (left only for backward compatibility)\n" - " */\n\n" - "int ~s__call_info(~s oe_obj, CORBA_Environment *oe_env)\n" - "{\n" - " return ~s_prepare_request_decoding(oe_env);\n" - "}\n\n", - IName = ic_util:to_undersc(N), - emit(Fd, Code, [IName, IName, UserProto]). - -%%------------------------------------------------------------ -%% Emit dispatch -%%------------------------------------------------------------ - -emit_dispatch(G, Fd, N, Xs) -> - lists:foreach( - fun(X) when is_record(X, op) -> - {Name, ArgNames, Types} = ic_cbe:extract_info(G, N, X), - {RetType, ParTypes, _} = Types, - TypeAttrArgs = mk_type_attr_arg_list(ParTypes, ArgNames), - emit_exec_function(G, Fd, N, X, Name, RetType, TypeAttrArgs), - emit_parameter_decoder(G, Fd, N, X, Name, RetType, TypeAttrArgs), - emit_message_encoder(G, Fd, N, X, Name, RetType, TypeAttrArgs); - (_) -> - ok - end, Xs). - -%%------------------------------------------------------------ -%% Emit operation mapping -%%------------------------------------------------------------ - -emit_operation_mapping(G, Fd, N, Bodies) -> - OpNames = get_all_opnames(G, N, Bodies), - Interface = ic_util:to_undersc(N), - Length = erlang:length(OpNames), - emit(Fd, "\n/* Operation mapping */\n\n", []), - case Length of - 0 -> - emit(Fd, "oe_map_t oe_~s_map = { 0, NULL };\n\n", [Interface]); - _ -> - emit(Fd, "\noe_operation_t oe_~s_operations[~p] = {\n", - [Interface, Length]), - Members = lists:map( - fun({OpN, ScOpN}) -> - Name = ic_util:to_undersc([OpN]), - ScName = ic_util:to_undersc([ScOpN]), - io_lib:fwrite(" {~p, ~p, ~s__exec}", - [Interface, Name, ScName]) - end, OpNames), - emit(Fd, ic_util:join(Members, ",\n")), - emit(Fd, "};\n\n", []), - emit(Fd, "oe_map_t oe_~s_map = " - "{~p, oe_~s_operations};\n\n", - [Interface, Length, Interface]) - end. - -%%------------------------------------------------------------ -%% Emit constant -%%------------------------------------------------------------ - -emit_constant(G, N, ConstRecord) -> - case ic_genobj:is_hrlfile_open(G) of - false -> ok; - true -> - Fd = ic_genobj:hrlfiled(G), - CName = ic_util:to_undersc( - [ic_forms:get_id(ConstRecord#const.id)| N]), - UCName = ic_util:to_uppercase(CName), - - emit(Fd, "\n#ifndef __~s__\n", [UCName]), - emit(Fd, "#define __~s__\n\n", [UCName]), - - emit(Fd, "/* Constant: ~s */\n", [CName]), - - if is_record(ConstRecord#const.type, wstring) -> - %% If wstring, add 'L' - emit(Fd, "#define ~s L~p\n\n", [CName, - ConstRecord#const.val]); - true -> - emit(Fd, "#define ~s ~p\n\n", [CName, - ConstRecord#const.val]) - end, - - emit(Fd, "#endif\n\n") - end. - -%%------------------------------------------------------------ -%% Emit exec function -%%------------------------------------------------------------ - -emit_exec_function(G, Fd, N, X, Name, RetType, TypeAttrArgs) -> - %% Decoding operation specific part - InTypeAttrArgs = lists:filter(fun({_, in, _}) -> true; - ({_, _, _}) -> false - end, TypeAttrArgs), - ic_codegen:nl(Fd), - - emit(Fd, - "int ~s__exec(~s oe_obj, CORBA_Environment *oe_env)\n" - "{\n", - [Name, ic_util:to_undersc(N)]), - - emit(Fd, " if (oe_env->_received != ~p) {\n", [length(InTypeAttrArgs)]), - emit(Fd, " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, BAD_PARAM, " - "\"Wrong number of operation parameters\");\n"), - emit_c_dec_rpt(Fd, " ", "wrong number of parameters", []), - emit_c_dec_rpt(Fd, " ", "server exec ~s\\n====\\n", [Name]), - emit(Fd, " return -1;\n", []), - emit(Fd, " }\n"), - emit(Fd, " else {\n", []), - - case InTypeAttrArgs of - [] -> - true; - _ -> - emit(Fd, " int oe_error_code = 0;\n") - end, - - %% Callback variable definition - emit_variable_defs(G, Fd, N, X, Name, RetType, TypeAttrArgs), - - %% Call to parameter decoder - emit_parameter_decoder_call(G, Fd, N, X, Name, RetType, TypeAttrArgs), - - %% Callback to user code - emit_callback(G, Fd, N, X, Name, RetType, TypeAttrArgs), - - %% Call to return message encoder - case ic_forms:is_oneway(X) of - true -> - true; - false -> - emit_message_encoder_call(G, Fd, N, X, Name, RetType, TypeAttrArgs) - end, - - %% Restore function call - emit_restore(G, Fd, N, X, Name, RetType, TypeAttrArgs), - - emit(Fd, " }\n return 0;\n}\n\n"). - -%%------------------------------------------------------------ -%% Emit parameter decoder -%%------------------------------------------------------------ - -emit_parameter_decoder(G, Fd, N, X, Name, _RetType, TypeAttrArgs) -> - %% Decoding operation specific part - InTypeAttrArgs = - lists:filter(fun({_, in, _}) -> true; - ({_, _, _}) -> false - end, TypeAttrArgs), - case InTypeAttrArgs of - [] -> - ok; - _ -> - case ic_util:mk_list(mk_par_list_for_decoder(G, N, X, - TypeAttrArgs)) of - "" -> - emit(Fd, "int ~s__dec(~s oe_obj, CORBA_Environment " - "*oe_env)\n{\n int oe_error_code;\n\n", - [Name, ic_util:to_undersc(N)]); - PLFD -> - emit(Fd, "int ~s__dec(~s oe_obj, ~s, CORBA_Environment " - "*oe_env)\n{\n", - [Name, ic_util:to_undersc(N), PLFD]), - emit(Fd, " int oe_error_code;\n\n") - end, - - APars = [], % XXX Alloced parameters - foldl( - fun({{'void', _}, _, _}, _Acc) -> - ok; - ({T1, A1, N1}, Acc) -> - emit_one_decoding(G, N, Fd, T1, A1, N1, Acc) - end, APars, InTypeAttrArgs), - - emit(Fd, " return 0;\n}\n\n") - end. - -%%------------------------------------------------------------ -%% Emit one decoding -%%------------------------------------------------------------ - -emit_one_decoding(G, N, Fd, T1, A1, N1, AllocedPars) -> - IndOp = mk_ind_op(A1), - case ic_cbe:is_variable_size(G, N, T1) of - false -> - %% The last parameter "oe_outindex" is not used in - %% the static case but must be there anyhow. - emit_decoding_stmt(G, N, Fd, T1, - N1, "", "oe_env->_inbuf", 1, "&oe_outindex", - caller, AllocedPars), - ic_codegen:nl(Fd), - AllocedPars; - true -> - emit_encoding_comment(G, N, Fd, "Decode", IndOp, T1, N1), - emit(Fd, " {\n"), - emit(Fd, " int oe_size_count_index = oe_env->_iin;\n"), - emit(Fd, " int oe_malloc_size = 0;\n"), - emit(Fd, " void *oe_first = NULL;\n"), - ic_cbe:emit_malloc_size_stmt(G, N, Fd, T1, - "oe_env->_inbuf", 1, caller), - %% This is the only malloc call in this file - emit(Fd, - " OE_MALLOC_SIZE_CHECK(oe_env, oe_malloc_size);\n" - " if ((*~s = oe_first = " - "malloc(oe_malloc_size)) == NULL) {\n", [N1]), - ic_cbe:emit_dealloc_stmts(Fd, " ", AllocedPars), - emit(Fd, - " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "NO_MEMORY, \"Cannot malloc\");\n" - " return -1;\n" - " }\n"), - ParName = "*" ++ N1, % XXX Why not IndOp? - NAllocedPars = [ParName| AllocedPars], - case ictype:isArray(G, N, T1) of - true -> - emit_decoding_stmt(G, N, Fd, T1, - "(*" ++ IndOp ++ N1 ++ ")", "", - "oe_env->_inbuf", 1, "&oe_outindex", - array_dyn, NAllocedPars); - false -> - emit_decoding_stmt(G, N, Fd, T1, - "(*" ++ IndOp ++ N1 ++ ")", "", - "oe_env->_inbuf", 1, "&oe_outindex", - caller_dyn, NAllocedPars) - end, - emit(Fd, " }\n\n"), - NAllocedPars - end. - -%%------------------------------------------------------------ -%% Emit message encoder -%%------------------------------------------------------------ - -emit_message_encoder(G, Fd, N, X, Name, RetType, TypeAttrArgs) -> - case ic_forms:is_oneway(X) of - false -> - %% Encoding operation specific part - emit(Fd, - "\nint ~s__enc(~s oe_obj", - [Name, ic_util:to_undersc(N)]), - RType = mk_c_ret_type(G, N, RetType), - ParList = mk_par_list_for_encoder(G, N, X, TypeAttrArgs), - case ic_util:mk_list(ParList) of - "" -> - case RType of - "void" -> - emit(Fd, ", CORBA_Environment *oe_env)\n{"); - _ -> - emit(Fd, ", ~s oe_return, CORBA_Environment " - "*oe_env)\n{", [RType]) - end; - PLFD -> - case RType of - "void" -> - emit(Fd, ", ~s, CORBA_Environment " - "*oe_env)\n{", [PLFD]); - _ -> - emit(Fd, ", ~s oe_return~s, CORBA_Environment " - "*oe_env)\n{", [RType, ", " ++ PLFD]) - end - end, - - - emit(Fd, "\n"), - emit(Fd, " int oe_error_code;\n\n"), - UserProto = get_user_proto(G, oe), - emit(Fd, " ~s_prepare_reply_encoding(oe_env);\n", [UserProto]), - - OutTypeAttrArgs = - lists:filter(fun({_, out, _}) -> true; - ({_, _, _}) -> false - end, TypeAttrArgs), - - OutLength = length(OutTypeAttrArgs), - case OutLength > 0 of - false -> - ic_codegen:nl(Fd); - true -> - emit(Fd, " oe_ei_encode_tuple_header(oe_env, ~p);\n\n", - [OutLength+1]) - - end, - - emit_encoding_comment(G, N, Fd, "Encode", "", RetType, - "oe_return"), - emit_encoding_stmt(G, N, X, Fd, RetType, "oe_return"), - - foreach(fun({T1, _A1, N1}) -> - case T1 of - {'void', _} -> - ok; - _ -> - emit_encoding_comment(G, N, Fd, "Encode", - "", T1, N1), - emit_encoding_stmt(G, N, X, Fd, T1, N1) - end - end, OutTypeAttrArgs), - emit(Fd, " return 0;\n}\n\n"); - _ -> - %% Oneway - ok - end. - -%%------------------------------------------------------------ -%% Emit message encoder call -%%------------------------------------------------------------ - -emit_message_encoder_call(G, Fd, N, X, Name, RetType, TypeAttrArgs) -> - emit(Fd, " /* Encoding reply message */\n"), - RType = mk_c_ret_type(G, N, RetType), - case ic_util:mk_list(mk_enc_par_list(G, N, X, TypeAttrArgs)) of - "" -> - case RType of - "void" -> - emit(Fd, " ~s(oe_obj, oe_env);\n", - [Name ++ "__enc"]); - "erlang_pid*" -> - emit(Fd, " ~s(oe_obj, &oe_return, oe_env);\n", - [Name ++ "__enc"]); - "erlang_port*" -> - emit(Fd, " ~s(oe_obj, &oe_return, oe_env);\n", - [Name ++ "__enc"]); - "erlang_ref*" -> - emit(Fd, " ~s(oe_obj, &oe_return, oe_env);\n", - [Name ++ "__enc"]); - _ -> - emit(Fd, " ~s(oe_obj, oe_return, oe_env);\n", - [Name ++ "__enc"]) - end; - - PLFE -> - case RType of - "void" -> - emit(Fd, " ~s(oe_obj, ~s, oe_env);\n", - [Name ++ "__enc", PLFE]); - "erlang_pid*" -> - emit(Fd, " ~s(oe_obj, &oe_return, ~s, oe_env);\n", - [Name ++ "__enc", PLFE]); - "erlang_port*" -> - emit(Fd, " ~s(oe_obj, &oe_return, ~s, oe_env);\n", - [Name ++ "__enc", PLFE]); - "erlang_ref*" -> - emit(Fd, " ~s(oe_obj, &oe_return, ~s, oe_env);\n", - [Name ++ "__enc", PLFE]); - _ -> - emit(Fd, " ~s(oe_obj, oe_return, ~s, oe_env);\n", - [Name ++ "__enc", PLFE]) - end - end, - ic_codegen:nl(Fd). - -%%------------------------------------------------------------ -%% Emit parameter decoding call -%%------------------------------------------------------------ - -emit_parameter_decoder_call(G, Fd, N, X, Name, _R, TypeAttrArgs) -> - case ic_util:mk_list(mk_dec_par_list(G, N, X, TypeAttrArgs)) of - "" -> %% No parameters ! skip it ! - ok; - PLFDC -> - ParDecName = Name ++ "__dec", - emit(Fd, - " /* Decode parameters */\n" - " if((oe_error_code = ~s(oe_obj, ~s, oe_env)) < 0) {\n", - [ParDecName, PLFDC]), - emit_c_dec_rpt(Fd, " ", "parmeters", []), - emit(Fd, - " if(oe_env->_major == CORBA_NO_EXCEPTION)\n" - " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad parameter on decode\");\n" - " return oe_error_code;\n }\n\n") - end. - -%%------------------------------------------------------------ -%% Emit call-back -%%------------------------------------------------------------ - -emit_callback(G, Fd, N, X, Name, RetType, TypeAttrArgs) -> - CallBackName = Name ++ "__cb", - emit(Fd, " /* Callback function call */\n"), - PL = ic_util:mk_list(mk_cb_par_list(G, N, X, TypeAttrArgs)), - case ic_forms:is_oneway(X) of - true -> - case PL of - "" -> - emit(Fd, " oe_restore = ~s(oe_obj, oe_env);\n\n", - [CallBackName]); - _ -> - emit(Fd, " oe_restore = ~s(oe_obj, ~s, oe_env);\n\n", - [CallBackName, PL]) - end; - false -> - CBPL = case PL of - "" -> - ""; - _PL -> - ", " ++ PL - end, - case mk_c_ret_type(G, N, RetType) of - "void" -> - case PL of - "" -> - emit(Fd, " oe_restore = ~s(oe_obj, oe_env);" - "\n\n", [CallBackName]); - _ -> - emit(Fd, " oe_restore = ~s(oe_obj, ~s, oe_env);" - "\n\n", [CallBackName, PL]) - end; - _ -> - case ictype:isArray(G, N, RetType) of - true -> - emit(Fd, - " oe_restore = ~s(oe_obj, oe_return~s, " - " oe_env);\n\n", [CallBackName, CBPL]); - false -> - emit(Fd, " oe_restore = ~s(oe_obj, " - "&oe_return~s, oe_env);\n\n", - [CallBackName, CBPL]) - end - end - end. - -%%------------------------------------------------------------ -%% Emit restore -%%------------------------------------------------------------ - -emit_restore(G, Fd, N, X, _Name, RetType, TypeAttrArgs) -> - emit(Fd, " /* Restore function call */\n"), - emit(Fd, " if (oe_restore != NULL)\n"), - PL = ic_util:mk_list(mk_cb_par_list(G, N, X, TypeAttrArgs)), - case ic_forms:is_oneway(X) of - true -> - case PL of - "" -> - emit(Fd, " (*oe_restore)(oe_obj, oe_env);\n\n"); - _ -> - emit(Fd, " (*oe_restore)(oe_obj, ~s, oe_env);\n\n", - [PL]) - end; - false -> - RPL = case PL of - "" -> - ""; - _PL -> - ", " ++ PL - end, - case mk_c_ret_type(G, N, RetType) of - "void" -> - case PL of - "" -> - emit(Fd, " (*oe_restore)(oe_obj, oe_env);" - "\n\n"); - _ -> - emit(Fd, " (*oe_restore)(oe_obj, ~s, oe_env);" - "\n\n", [PL]) - end; - _ -> - case ictype:isArray(G, N, RetType) of - true -> - emit(Fd, - " (*oe_restore)(oe_obj, oe_return~s, " - " oe_env);\n\n", [RPL]); - false -> - emit(Fd, " (*oe_restore)(oe_obj, " - "&oe_return~s, oe_env);\n\n", [RPL]) - end - end - end. - -%%------------------------------------------------------------ -%% Emit variable defs -%%------------------------------------------------------------ - -emit_variable_defs(G, Fd, N, X, _Name, RetType, TypeAttrArgs) -> - {ScopedName, _, _} = ic_cbe:extract_info(G, N, X), - emit(Fd, " ~s__rs* oe_restore = NULL;\n", [ScopedName]), - RestVars = mk_var_list(mk_var_decl_list(G, N, X, TypeAttrArgs)), - case ic_forms:is_oneway(X) of - true -> - emit(Fd, "~s\n\n", [RestVars]); - false -> - RType = mk_c_ret_type(G, N, RetType), - case RType of - "void" -> - emit(Fd, "~s\n\n", [RestVars]); - "CORBA_unsigned_long" -> - emit(Fd, "~s ~s oe_return = 0;\n\n", [RestVars, RType]); - "CORBA_unsigned_long_long" -> - emit(Fd, "~s ~s oe_return = 0;\n\n", [RestVars, RType]); - "CORBA_unsigned_short" -> - emit(Fd, "~s ~s oe_return = 0;\n\n", [RestVars, RType]); - "CORBA_short" -> - emit(Fd, "~s ~s oe_return = 0;\n\n", [RestVars, RType]); - "CORBA_long" -> - emit(Fd, "~s ~s oe_return = 0;\n\n", [RestVars, RType]); - "CORBA_long_long" -> - emit(Fd, "~s ~s oe_return = 0;\n\n", [RestVars, RType]); - "CORBA_float" -> - emit(Fd, "~s ~s oe_return = 0;\n\n", [RestVars, RType]); - "CORBA_double" -> - emit(Fd, "~s ~s oe_return = 0;\n\n", [RestVars, RType]); - "CORBA_char" -> - emit(Fd, "~s ~s oe_return = 0;\n\n", [RestVars, RType]); - "CORBA_wchar" -> %% WCHAR - emit(Fd, "~s ~s oe_return = 0;\n\n", [RestVars, RType]); - "CORBA_boolean" -> - emit(Fd, "~s ~s oe_return = 0;\n\n", [RestVars, RType]); - "CORBA_octet" -> - emit(Fd, "~s ~s oe_return = 0;\n\n", [RestVars, RType]); - _ -> - case ic_cbe:is_variable_size(G, N, RetType) of - true -> - emit(Fd, "~s ~s oe_return;\n\n", - [RestVars, RType]); - false -> - TK = ic_forms:get_tk(X), - case TK of - {tk_enum, _, _, _List} -> - emit(Fd, "~s ~s oe_return;\n\n", - [RestVars, RType]); - _ -> - case RType of - "erlang_binary*" -> - emit(Fd, "~s erlang_binary " - "oe_return;\n\n", [RestVars]); - "erlang_pid*" -> - emit(Fd, "~s erlang_pid " - "oe_return;\n\n", [RestVars]); - "erlang_port*" -> - emit(Fd, "~s erlang_port " - "oe_return;\n\n", [RestVars]); - "erlang_ref*" -> - emit(Fd, "~s erlang_ref " - "oe_return;\n\n", [RestVars]); - _ -> - %% Structures are - %% initiated by memset - emit(Fd, "~s ~s " - "oe_return;\n\n", - [RestVars, RType]) - end, - emit(Fd, " memset(&oe_return, 0, " - "sizeof(oe_return));\n\n") - end - end - end - end. - -%%------------------------------------------------------------ -%% Make variable list -%%------------------------------------------------------------ - -%% XXX Modify -mk_var_list([]) -> - ""; -mk_var_list([Arg| Args]) -> - " " ++ Arg ++ ";\n" ++ mk_var_list(Args). - -%%------------------------------------------------------------ -%% Make return type -%%------------------------------------------------------------ - -mk_c_ret_type(G, N, Type) -> - Ctype = mk_c_type(G, N, Type), - Dyn = case ic_cbe:is_variable_size(G, N, Type) of - true -> - if - is_record(Type, string) -> - "*"; - Ctype == "CORBA_char *" -> - ""; - is_record(Type, wstring) -> %% WSTRING - "*"; - Ctype == "CORBA_wchar *" -> %% WSTRING - ""; - true -> - case ictype:isArray(G, N, Type) of - true -> - ""; - _ -> - "*" - end - end; - false -> - if - Ctype == "erlang_pid" -> - "*"; - Ctype == "erlang_port" -> - "*"; - Ctype == "erlang_ref" -> - "*"; - true -> - "" - end - end, - Ctype ++ Dyn. - -%%------------------------------------------------------------ -%% Make call-back parameter list -%%------------------------------------------------------------ - -mk_cb_par_list(G, N, X, TypeAttrArgs0) -> - TypeAttrArgs1 = filter_type_attr_arg_list(G, X, [in, out], TypeAttrArgs0), - lists:map( - fun({Type, Attr, Arg}) -> - case ic_cbe:is_variable_size(G, N, Type) of - true -> - case Attr of - in -> - Arg; - out -> - case ictype:isArray(G, N, Type) of - true -> - Arg; - _ -> - "&" ++ Arg - end - end; - false -> - case ictype:isArray(G, N, Type) of - true -> - Arg; - _ -> - "&" ++ Arg - end - end - end, TypeAttrArgs1). - -%%------------------------------------------------------------ -%% Make decoder parameter list -%%------------------------------------------------------------ - -mk_dec_par_list(G, N, X, TypeAttrArgs0) -> - TypeAttrArgs1 = filter_type_attr_arg_list(G, X, [in], - TypeAttrArgs0), - lists:map( - fun({Type, _Attr, Arg}) -> - Ctype = mk_c_type(G, N, Type), - case ic_cbe:is_variable_size(G, N, Type) of - true -> - if - is_record(Type, string) -> - "&" ++ Arg; - Ctype == "CORBA_char *" -> - Arg; - is_record(Type, wstring) -> - "&" ++ Arg; - Ctype == "CORBA_wchar *" -> - Arg; - true -> - "&" ++ Arg - end; - false -> - case ictype:isArray(G, N, Type) of - true -> - Arg; - _ -> - "&" ++ Arg - end - end - end, TypeAttrArgs1). - -%%------------------------------------------------------------ -%% Make encoder parameter list -%%------------------------------------------------------------ - -mk_enc_par_list(G, N, X, TypeAttrArgs0) -> - TypeAttrArgs1 = filter_type_attr_arg_list(G, X, [out], - TypeAttrArgs0), - lists:map( - fun({Type, _Attr, Arg}) -> - Ctype = mk_c_type(G, N, Type), - case Ctype of - "erlang_pid" -> - "&" ++ Arg; - "erlang_port" -> - "&" ++ Arg; - "erlang_ref" -> - "&" ++ Arg; - _ -> - Arg - end - end, TypeAttrArgs1). - -%%------------------------------------------------------------ -%% Make type argument list -%%------------------------------------------------------------ - -mk_type_attr_arg_list(Types, Args) -> - filterzip( - fun(Type, {Attr, Arg}) -> - {true, {Type, Attr, Arg}} - end, Types, Args). - -%%------------------------------------------------------------ -%% Filter type argument list -%%------------------------------------------------------------ - -filter_type_attr_arg_list(G, X, InOrOut, TypeAttrArgs) -> - lists:filter( - - fun({_Type, inout, Arg}) -> - ic_error:error(G, {inout_spec_for_c, X, Arg}), - false; - ({_Type, Attr, _Arg}) -> - lists:member(Attr, InOrOut) - end, TypeAttrArgs). - -%%------------------------------------------------------------ -%% Make indirection operator -%%------------------------------------------------------------ - -mk_ind_op(in) -> - ""; -mk_ind_op(inout) -> - error; -mk_ind_op(_) -> - "*". - -%%------------------------------------------------------------ -%% Make parameter list for decoder -%%------------------------------------------------------------ - -mk_par_list_for_decoder(G, N, X, TypeAttrArgs0) -> - TypeAttrArgs1 = filter_type_attr_arg_list(G, X, [in], TypeAttrArgs0), - lists:map( - fun({Type, Attr, Arg}) -> - Ctype = mk_c_type(G, N, Type), - Dyn = case ic_cbe:is_variable_size(G, N, Type) of - true -> - if - is_record(Type, string) -> - "**"; - Ctype == "CORBA_char *" -> - ""; - is_record(Type, wstring) -> %% WSTRING - "**"; - Ctype == "CORBA_wchar *" -> %% WSTRING - ""; - true -> - case ictype:isArray(G, N, Type) of - true -> - slice(Attr) ++ "*"; - _ -> - "**" - end - end; - false -> - case ictype:isArray(G, N, Type) of - true -> - ""; - _ -> - "*" - end - end, - Ctype ++ Dyn ++ " " ++ Arg - end, TypeAttrArgs1). - -%%------------------------------------------------------------ -%% Make parameter list for encoder -%%------------------------------------------------------------ - -mk_par_list_for_encoder(G, N, X, TypeAttrArgs0) -> - TypeAttrArgs1 = filter_type_attr_arg_list(G, X, [out], TypeAttrArgs0), - lists:map( - fun({Type, _Attr, Arg}) -> - Ctype = mk_c_type(G, N, Type), - Dyn = case ic_cbe:is_variable_size(G, N, Type) of - true -> - if - is_record(Type, string) -> - "*"; - Ctype == "CORBA_char *" -> - ""; - is_record(Type, wstring) -> %% WSTRING - "*"; - Ctype == "CORBA_wchar *" -> %% WSTRING - ""; - true -> - case ictype:isArray(G, N, Type) of - true -> - ""; - _ -> - "*" - end - end; - false -> - if - Ctype == "erlang_pid" -> - "*"; - Ctype == "erlang_port" -> - "*"; - Ctype == "erlang_ref" -> - "*"; - true -> - "" - end - end, - Ctype ++ " " ++ Dyn ++ Arg - end, TypeAttrArgs1). - -%%------------------------------------------------------------ -%% Make parameter list for decoder prototypes -%%------------------------------------------------------------ - -mk_par_list_for_decoder_prototypes(G, N, X, TypeAttrArgs0) -> - TypeAttrArgs1 = filter_type_attr_arg_list(G, X, [in], TypeAttrArgs0), - lists:map( - fun({Type, Attr, _Arg}) -> - Ctype = mk_c_type(G, N, Type), - Dyn = case ic_cbe:is_variable_size(G, N, Type) of - true -> - if - is_record(Type, string) -> - "**"; - Ctype == "CORBA_char *" -> - ""; - is_record(Type, wstring) -> %% WSTRING - "**"; - Ctype == "CORBA_wchar *" -> %% WSTRING - ""; - true -> - case ictype:isArray(G, N, Type) of - true -> - slice(Attr) ++ "*"; - _ -> - "**" - end - end; - false -> - case ictype:isArray(G, N, Type) of - true -> - ""; - _ -> - "*" - end - end, - Ctype ++ Dyn - end, TypeAttrArgs1). - -%%------------------------------------------------------------ -%% Make parameter list for encoder prototypes -%%------------------------------------------------------------ - -mk_par_list_for_encoder_prototypes(G, N, X, TypeAttrArgs0) -> - TypeAttrArgs1 = filter_type_attr_arg_list(G, X, [out], TypeAttrArgs0), - lists:map( - fun({Type, _Attr, _Arg}) -> - Ctype = mk_c_type(G, N, Type), - Dyn = case ic_cbe:is_variable_size(G, N, Type) of - true -> - if - is_record(Type, string) -> - "*"; - Ctype == "CORBA_char *" -> - ""; - is_record(Type, wstring) -> %% WSTRING - "*"; - Ctype == "CORBA_wchar *" -> %% WSTRING - ""; - true -> - case ictype:isArray(G, N, Type) of - true -> - ""; - _ -> - "*" - end - end; - false -> - if - Ctype == "erlang_pid" -> - "*"; - Ctype == "erlang_port" -> - "*"; - Ctype == "erlang_ref" -> - "*"; - true -> - "" - end - end, - Ctype ++ Dyn - end, TypeAttrArgs1). - -%%------------------------------------------------------------ -%% Make parameter list for call-back prototypes -%%------------------------------------------------------------ - -mk_par_list_for_callback_prototypes(G, N, X, TypeAttrArgs0) -> - TypeAttrArgs1 = filter_type_attr_arg_list(G, X, [in, out], - TypeAttrArgs0), - lists:map( - fun({Type, Attr, _Arg}) -> - IndOp = mk_ind_op(Attr), - Ctype = mk_c_type(G, N, Type), - Dyn = case ic_cbe:is_variable_size(G, N, Type) of - true -> - if - is_record(Type, string) -> - "*" ++ IndOp; - Ctype == "CORBA_char *" -> - "" ++ IndOp; - is_record(Type, wstring) -> %% WSTRING - "*" ++ IndOp; - Ctype == "CORBA_wchar *" -> %% WSTRING - "" ++ IndOp; - true -> - case ictype:isArray(G, N, Type) of - true -> - ""; - _ -> - "*" ++ IndOp - end - end; - false -> - case ictype:isArray(G, N, Type) of - true -> - ""; - _ -> - case Attr of %% Should just be IndOp - in -> - "*" ++ IndOp; - out -> - IndOp - end - end - end, - Ctype ++ Dyn - end, TypeAttrArgs1). - -%%------------------------------------------------------------ -%% Make variable declaration list -%%------------------------------------------------------------ - -mk_var_decl_list(G, N, X, TypeAttrArgs0) -> - TypeAttrArgs1 = filter_type_attr_arg_list(G, X, [in, out], - TypeAttrArgs0), - lists:map( - fun({Type, Attr, Arg}) -> - Ctype = mk_c_type(G, N, Type), - VarDecl = case ic_cbe:is_variable_size(G, N, Type) of - true -> - if - is_record(Type, string) -> - Ctype ++ "* " ++ Arg ++ " = NULL"; - Ctype == "CORBA_char *" -> - Ctype ++ " " ++ Arg ++ " = NULL"; - is_record(Type, wstring) -> %% WSTRING - Ctype ++ "* " ++ Arg ++ " = NULL"; - Ctype == "CORBA_wchar *" -> %% WSTRING - Ctype ++ " " ++ Arg ++ " = NULL"; - true -> - case ictype:isArray(G, N, Type) of - true -> - Ctype ++ slice(Attr) ++ " " ++ - Arg; - _ -> - Ctype ++ "* " ++ Arg - end - end; - false -> - Ctype ++ " " ++ Arg - end, - - VarDecl - end, TypeAttrArgs1). - -%%------------------------------------------------------------ -%% Slice -%%------------------------------------------------------------ - -slice(in) -> - "_slice*"; -slice(_) -> - "". - -%%------------------------------------------------------------ -%% Special comment functions -%%------------------------------------------------------------ - -emit_encoding_comment(G, N, F, String, RefOrVal, Type, Name) -> - emit(F, [io_lib:format(" /* ~s parameter: ~s~s ~s */\n", - [String, mk_c_type(G, N, Type), - RefOrVal, Name])]). - - -%%------------------------------------------------------------ -%% Make C type -%%------------------------------------------------------------ - -%% -%% Warning this is NOT identical to mk_c_type in ic_cbe.erl -%% -mk_c_type(G, N, S) -> - mk_c_type(G, N, S, evaluate). - -mk_c_type(G, N, S, evaluate) when element(1, S) == scoped_id -> - {FullScopedName, _T, _TK, _} = ic_symtab:get_full_scoped_name(G, N, S), - BT = ic_code:get_basetype(G, ic_util:to_undersc(FullScopedName)), - case BT of - "erlang_binary" -> - "erlang_binary"; - "erlang_pid" -> - "erlang_pid"; - "erlang_port" -> - "erlang_port"; - "erlang_ref" -> - "erlang_ref"; - "erlang_term" -> - "ETERM*"; - {enum, Type} -> - mk_c_type(G, N, Type, evaluate); - Type -> - mk_c_type(G, N, Type, evaluate) - end; -mk_c_type(G, N, S, evaluate_not) when element(1, S) == scoped_id -> - {FullScopedName, _T, _TK, _} = ic_symtab:get_full_scoped_name(G, N, S), - BT = ic_code:get_basetype(G, ic_util:to_undersc(FullScopedName)), - case BT of - "erlang_binary" -> - "erlang_binary"; - "erlang_pid" -> - "erlang_pid"; - "erlang_port" -> - "erlang_port"; - "erlang_ref" -> - "erlang_ref"; - "erlang_term" -> - "ETERM*"; - Type -> - Type - end; -mk_c_type(_G, _N, S, _) when is_list(S) -> - S; -mk_c_type(_G, _N, S, _) when is_record(S, string) -> - "CORBA_char"; -mk_c_type(_G, _N, S, _) when is_record(S, wstring) -> %% WSTRING - "CORBA_wchar"; -mk_c_type(_G, _N, {boolean, _}, _) -> - "CORBA_boolean"; -mk_c_type(_G, _N, {octet, _}, _) -> - "CORBA_octet"; -mk_c_type(_G, _N, {void, _}, _) -> - "void"; -mk_c_type(_G, _N, {unsigned, U}, _) -> - case U of - {short, _} -> - "CORBA_unsigned_short"; - {long, _} -> - "CORBA_unsigned_long"; - {'long long', _} -> - "CORBA_unsigned_long_long" - end; -mk_c_type(_G, _N, {'long long', _}, _) -> - "CORBA_long_long"; -mk_c_type(_G, _N, {'any', _}, _) -> %% Fix for any type - "CORBA_long"; -mk_c_type(_G, _N, {T, _}, _) -> - "CORBA_" ++ atom_to_list(T). - -%%------------------------------------------------------------ -%% Emit encoding statement -%%------------------------------------------------------------ - -%% emit_encoding_stmt(G, N, X, Fd, T, LName) -%% -%% -emit_encoding_stmt(G, N, X, Fd, T, LName) when element(1, T) == scoped_id -> - case mk_c_type(G, N, T, evaluate_not) of - "erlang_pid" -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_pid(oe_env, ~s)) < 0) {\n", - [LName]), - emit_c_enc_rpt(Fd, " ", "oe_ei_encode_pid", []), - emit(Fd, " return oe_error_code;\n }\n"); - "erlang_port" -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_port(oe_env, ~s)) < 0) {\n", - [LName]), - emit_c_enc_rpt(Fd, " ", "oe_ei_encode_port", []), - emit(Fd, " return oe_error_code;\n }\n"); - "erlang_ref" -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_ref(oe_env, ~s)) < 0) {\n", - [LName]), - emit_c_enc_rpt(Fd, " ", "oe_ei_encode_ref", []), - emit(Fd, " return oe_error_code;\n }\n"); - "ETERM*" -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_term(oe_env, ~s)) < 0) {\n", - [LName]), - emit_c_enc_rpt(Fd, " ", "oe_ei_encode_term", []), - emit(Fd, " return oe_error_code;\n }\n"); - {enum, FSN} -> - emit_encoding_stmt(G, N, X, Fd, FSN, LName); - FSN -> - emit_encoding_stmt(G, N, X, Fd, FSN, LName) - end; -emit_encoding_stmt(G, N, X, Fd, T, LName) when is_list(T) -> - %% Already a fullscoped name - case get_param_tk(LName, X) of - error -> - emit(Fd, " if ((oe_error_code = ~s~s(oe_env, ~s)) < 0) {\n", - [ic_util:mk_oe_name(G, "encode_"), T, LName]); - ParamTK -> - case ic_cbe:is_variable_size(ParamTK) of - true -> - emit(Fd, " if ((oe_error_code = ~s~s(oe_env, ~s)) < 0)" - " {\n", - [ic_util:mk_oe_name(G, "encode_"), T, LName]), - emit(Fd, " CORBA_exc_set(oe_env, " - "CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation parameter on encode\");" - "\n"), - ?emit_c_enc_rpt(Fd, " ", "", []), - emit(Fd, " return oe_error_code;\n }\n\n"); - false -> - if is_atom(ParamTK) -> - case ParamTK of - tk_ushort -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_ulong(oe_env, " - "(unsigned long) ~s)) < 0) {\n", - [LName]), - emit(Fd, " CORBA_exc_set(oe_env, " - "CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation " - "parameter on encode\");\n"), - ?emit_c_enc_rpt(Fd, " ", "ushort", []), - emit(Fd, " return " - "oe_error_code;\n }\n\n"); - tk_ulong -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_ulong(oe_env, " - "~s)) < 0) {\n", [LName]), - emit(Fd, " CORBA_exc_set(oe_env, " - "CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation " - "parameter on encode\");\n"), - ?emit_c_enc_rpt(Fd, " ", "ulong", []), - emit(Fd, " return " - "oe_error_code;\n }\n\n"); - tk_ulonglong -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_ulonglong(oe_env, " - "~s)) < 0) {\n", [LName]), - emit(Fd, " CORBA_exc_set(oe_env, " - "CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation " - "parameter on encode\");\n"), - ?emit_c_enc_rpt(Fd, " ", "ulonglong", []), - emit(Fd, " return " - "oe_error_code;\n }\n\n"); - tk_short -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_long(oe_env, " - "(long) ~s)) < 0) {\n", [LName]), - emit(Fd, " CORBA_exc_set(oe_env, " - "CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation " - "parameter on encode\");\n"), - ?emit_c_enc_rpt(Fd, " ", "short", []), - emit(Fd, " return " - "oe_error_code;\n }\n\n"); - tk_long -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_long(oe_env, " - "~s)) < 0) {\n", [LName]), - emit(Fd, " CORBA_exc_set(oe_env, " - "CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation " - "parameter on encode\");\n"), - ?emit_c_enc_rpt(Fd, " ", "long", []), - emit(Fd, " return " - "oe_error_code;\n }\n\n"); - tk_longlong -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_longlong(oe_env, " - "~s)) < 0) {\n", [LName]), - emit(Fd, " CORBA_exc_set(oe_env, " - "CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation " - "parameter on encode\");\n"), - ?emit_c_enc_rpt(Fd, " ", "longlong", []), - emit(Fd, " return " - "oe_error_code;\n }\n\n"); - tk_float -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_double(oe_env, " - "(double) ~s)) < 0) {\n", [LName]), - emit(Fd, " CORBA_exc_set(oe_env, " - "CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation " - "parameter on encode\");\n"), - ?emit_c_enc_rpt(Fd, " ", "float", []), - emit(Fd, " return " - "oe_error_code;\n }\n\n"); - tk_double -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_double(oe_env, " - "~s)) < 0) {\n", [LName]), - emit(Fd, " CORBA_exc_set(oe_env, " - "CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation " - "parameter on encode\");\n"), - ?emit_c_enc_rpt(Fd, " ", "double", []), - emit(Fd, " return " - "oe_error_code;\n }\n\n"); - tk_boolean -> - emit(Fd, " switch(~s) {\n", [LName]), - emit(Fd, " case 0 :\n"), - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_atom(oe_env, " - "\"false\")) < 0) {\n"), - emit(Fd, " CORBA_exc_set(oe_env, " - "CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation " - "parameter on encode\");\n"), - ?emit_c_enc_rpt(Fd, " ", "boolean", []), - emit(Fd, " return " - "oe_error_code;\n }\n"), - emit(Fd, " break;\n"), - emit(Fd, " case 1 :\n"), - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_atom(oe_env, " - "\"true\")) < 0) {\n"), - emit(Fd, " CORBA_exc_set(oe_env, " - "CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation " - "parameter on encode\");\n"), - ?emit_c_enc_rpt(Fd, " ", "boolean", []), - emit(Fd, " return " - "oe_error_code;\n }\n"), - emit(Fd, " break;\n"), - emit(Fd, " default :\n"), - emit(Fd, " CORBA_exc_set(oe_env, " - "CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation " - "parameter on encode\");\n"), - ?emit_c_enc_rpt(Fd, " ", "boolean", []), - emit(Fd, " return -1;\n"), - emit(Fd, " }\n\n"); - tk_char -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_char(oe_env, " - "~s)) < 0) {\n", [LName]), - emit(Fd, " CORBA_exc_set(oe_env, " - "CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation " - "parameter on encode\");\n"), - ?emit_c_enc_rpt(Fd, " ", "char", []), - emit(Fd, " return " - "oe_error_code;\n }\n\n"); - tk_wchar -> %% WCHAR - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_wchar(oe_env, " - "~s)) < 0) {\n", [LName]), - emit(Fd, " CORBA_exc_set(oe_env, " - "CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation " - "parameter on encode\");\n"), - ?emit_c_enc_rpt(Fd, " ", "wchar", []), - emit(Fd, " return " - "oe_error_code;\n }\n\n"); - tk_octet -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_char(oe_env, " - "~s)) < 0) {\n", [LName]), - emit(Fd, " CORBA_exc_set(oe_env, " - "CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation " - "parameter on encode\");\n"), - ?emit_c_enc_rpt(Fd, " ", "octet", []), - emit(Fd, " return " - "oe_error_code;\n }\n\n"); - tk_any -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_long(oe_env, " - "~s)) < 0) {\n", [LName]), - emit(Fd, " CORBA_exc_set(oe_env, " - "CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation " - "parameter on encode\");\n"), - ?emit_c_enc_rpt(Fd, " ", "any", []), - emit(Fd, " return " - "oe_error_code;\n }\n\n"); - _ -> - emit(Fd, " CORBA_exc_set(oe_env, " - "CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation " - "parameter on encode\");\n"), - ?emit_c_enc_rpt(Fd, " ", "tk_unknown", []), - emit(Fd, " return " - "oe_error_code;\n }\n\n"), - ok - end; - true -> - case element(1, ParamTK) of - tk_enum -> - emit(Fd, " if ((oe_error_code = " - "~s~s(oe_env, ~s)) < 0) {\n", - [ic_util:mk_oe_name(G, "encode_"), - T, LName]), - ?emit_c_enc_rpt(Fd, " ", "enum", []); - tk_array -> - emit(Fd, " if ((oe_error_code = " - "~s~s(oe_env, ~s)) < 0) {\n", - [ic_util:mk_oe_name(G, "encode_"), - T, LName]), - ?emit_c_enc_rpt(Fd, " ", "array", []); - _ -> - emit(Fd, " if ((oe_error_code = " - "~s~s(oe_env, &~s)) < 0) {\n", - [ic_util:mk_oe_name(G, "encode_"), - T, LName]), - ?emit_c_enc_rpt(Fd, " ", "", []) - end, - emit(Fd, " CORBA_exc_set(oe_env, " - "CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation " - "parameter on encode\");\n"), - emit(Fd, " return oe_error_code;\n }\n\n") - end - end - end; -emit_encoding_stmt(G, N, _X, Fd, T, LName) when is_record(T, string) -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_string(oe_env, (const char*) ~s)) < 0) {\n", - [LName]), - emit(Fd, " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Cannot encode string\");\n"), - ?emit_c_enc_rpt(Fd, " ", "string", []), - emit(Fd, " return oe_error_code;\n }\n\n"); -emit_encoding_stmt(G, N, _X, Fd, T, LName) when is_record(T, wstring) -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_wstring(oe_env, ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "wstring", []), - emit(Fd, " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Cannot encode string\");\n"), - emit(Fd, " return oe_error_code;\n }\n\n"); -emit_encoding_stmt(G, N, _X, Fd, T, LName) -> - case T of - {unsigned, {short, _}} -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_ulong(oe_env, (unsigned long) ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "ushort", []), - emit(Fd, " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation parameter on encode\");\n"), - emit(Fd, " return oe_error_code;\n }\n\n"); - {unsigned, {long, _}} -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_ulong(oe_env, ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "ulong", []), - emit(Fd, " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation parameter on encode\");\n"), - emit(Fd, " return oe_error_code;\n }\n\n"); - {unsigned, {'long long', _}} -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_ulonglong(oe_env, ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "ulonglong", []), - emit(Fd, " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation parameter on encode\");\n"), - emit(Fd, " return oe_error_code;\n }\n\n"); - {short, _} -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_long(oe_env, (long) ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "short", []), - emit(Fd, " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation parameter on encode\");\n"), - emit(Fd, " return oe_error_code;\n }\n\n"); - {long, _} -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_long(oe_env, ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "long", []), - emit(Fd, " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation parameter on encode\");\n"), - emit(Fd, " return oe_error_code;\n }\n\n"); - {'long long', _} -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_longlong(oe_env, ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "longlong", []), - emit(Fd, " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation parameter on encode\");\n"), - emit(Fd, " return oe_error_code;\n }\n\n"); - {float, _} -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_double(oe_env, (double) ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "float", []), - emit(Fd, " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation parameter on encode\");\n"), - emit(Fd, " return oe_error_code;\n }\n\n"); - {double, _} -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_double(oe_env, ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "double", []), - emit(Fd, " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation parameter on encode\");\n"), - emit(Fd, " return oe_error_code;\n }\n\n"); - {boolean, _} -> - emit(Fd, " switch(~s) {\n", [LName]), - emit(Fd, " case 0 :\n"), - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_atom(oe_env, \"false\")) < 0) {\n"), - ?emit_c_enc_rpt(Fd, " ", "boolean", []), - emit(Fd, " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation parameter on encode\");\n"), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " break;\n"), - emit(Fd, " case 1 :\n"), - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_atom(oe_env, \"true\")) < 0) {\n"), - ?emit_c_enc_rpt(Fd, " ", "boolean", []), - emit(Fd, " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation parameter on encode\");\n"), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " break;\n"), - emit(Fd, " default :\n"), - ?emit_c_enc_rpt(Fd, " ", "boolean", []), - emit(Fd, " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation parameter on encode\");\n"), - emit(Fd, " return -1;\n"), - emit(Fd, " }\n\n"); - {char, _} -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_char(oe_env, ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "char", []), - emit(Fd, " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation parameter on encode\");\n"), - emit(Fd, " return oe_error_code;\n }\n\n"); - {wchar, _} -> %% WCHAR - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_wchar(oe_env, ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "wchar", []), - emit(Fd, " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation parameter on encode\");\n"), - emit(Fd, " return oe_error_code;\n }\n\n"); - {octet, _} -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_char(oe_env, ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "octet", []), - emit(Fd, " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation parameter on encode\");\n"), - emit(Fd, " return oe_error_code;\n }\n\n"); - {void, _} -> - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_atom(oe_env, \"void\")) < 0) {\n"), - ?emit_c_enc_rpt(Fd, " ", "void", []), - emit(Fd, " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation parameter on encode\");\n"), - emit(Fd, " return oe_error_code;\n }\n\n"); - {sequence, _, _} -> - ?emit_c_enc_rpt(Fd, " ", "sequence", []), - emit(Fd, " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation parameter on encode\");\n"), - emit(Fd, " return oe_error_code;\n }\n\n"); - {any, _} -> %% Fix for any type - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_long(oe_env, ~s)) < 0) {\n", - [LName]), - ?emit_c_enc_rpt(Fd, " ", "any", []), - emit(Fd, " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "BAD_PARAM, \"Bad operation parameter on encode\");\n"), - emit(Fd, " return oe_error_code;\n }\n\n"); - _ -> - ic_error:fatal_error(G, {illegal_typecode_for_c, T, N}) - end. - -%%------------------------------------------------------------ -%% Get type kind parameter -%%------------------------------------------------------------ - -%% Useful functions -get_param_tk("oe_return", Op) -> - ic_forms:get_tk(Op); -get_param_tk(Name, Op) -> - case get_param(Name, Op) of - error -> - error; - Param -> - ic_forms:get_tk(Param) - end. - -%%------------------------------------------------------------ -%% Get parameter (for what? XXX) -%%------------------------------------------------------------ - -get_param(Name, Op) when is_record(Op, op) -> - get_param_loop(Name, Op#op.params); -get_param(_Name, _Op) -> - error. - -get_param_loop(_Name, []) -> - error; -get_param_loop(Name, [Param| Params]) -> - case ic_forms:get_id2(Param) of - Name -> - Param; - _ -> - get_param_loop(Name, Params) - end. - -%%------------------------------------------------------------ -%% Emit decoding statement -%%------------------------------------------------------------ - -emit_decoding_stmt(G, N, Fd, T, LName, IndOp, InBuffer, Align, NextPos, - DecType, AllocedPars) when element(1, T) == scoped_id -> - case mk_c_type(G, N, T, evaluate_not) of - "erlang_pid" -> - emit(Fd, " if ((oe_error_code = ei_decode_pid(~s, " - "&oe_env->_iin, ~s~s)) < 0) {\n", - [InBuffer, IndOp, LName]), - ic_cbe:emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "", []), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n\n"); - "erlang_port" -> - emit(Fd, " if ((oe_error_code = ei_decode_port(~s, " - "&oe_env->_iin, ~s~s)) < 0) {\n", - [InBuffer, IndOp, LName]), - ic_cbe:emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "", []), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n\n"); - "erlang_ref" -> - emit(Fd, " if ((oe_error_code = ei_decode_ref(~s, " - "&oe_env->_iin, ~s~s)) < 0) {\n", - [InBuffer, IndOp, LName]), - ic_cbe:emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "", []), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n\n"); - "ETERM*" -> - emit(Fd, " if ((oe_error_code = ei_decode_term(~s, " - "&oe_env->_iin, (void**)~s~s)) < 0) {\n", - [InBuffer, IndOp, LName]), - ic_cbe:emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "", []), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n\n"); - {enum, FSN} -> - emit_decoding_stmt(G, N, Fd, FSN, LName, IndOp, - InBuffer, Align, NextPos, DecType, AllocedPars); - FSN -> - emit_decoding_stmt(G, N, Fd, FSN, LName, IndOp, - InBuffer, Align, NextPos, DecType, AllocedPars) - end; -emit_decoding_stmt(G, N, Fd, T, LName, IndOp, InBuffer, _Align, NextPos, - DecType, AllocedPars) when is_list(T) -> - %% Already a fullscoped name - Type = ictype:name2type(G, T), - case ictype:isBasicType(Type) of - true -> - emit_decoding_stmt_for_basic_type(Fd, Type, InBuffer, IndOp, - LName, AllocedPars); - false -> - emit(Fd, " {\n"), - case DecType of - caller -> %% No malloc used, define oe_first anyhow. - emit(Fd, " void *oe_first = NULL;\n"), - emit(Fd, " int oe_outindex = 0;\n\n"); - array_dyn -> %% Malloc used - emit(Fd, " int oe_outindex = 0;\n\n"); - %% [ic_util:mk_align(io_lib:format("sizeof(~s)", [T]))]); - caller_dyn -> %% Malloc used - emit(Fd, " int oe_outindex = 0;\n\n") - end, - emit(Fd, " if ((oe_error_code = ~s~s(oe_env, oe_first, " - "~s, ~s)) < 0) {\n", - [ic_util:mk_oe_name(G, "decode_"), - T, NextPos, LName]), - ic_cbe:emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "", []), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n"), - emit(Fd, " }\n") - end; -emit_decoding_stmt(G, N, Fd, T, LName, IndOp, InBuffer, _Align, _NextPos, - _DecType, AllocedPars) when is_record(T, string) -> - emit(Fd, " if ((oe_error_code = ei_decode_string(~s, " - "&oe_env->_iin, ~s~s)) < 0) {\n", - [InBuffer, IndOp, LName]), - ic_cbe:emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "", []), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n"); -emit_decoding_stmt(G, N, Fd, T, LName, IndOp, InBuffer, _Align, _NextPos, - _DecType, AllocedPars) when is_record(T, wstring) -> - %% WSTRING - emit(Fd, " if ((oe_error_code = " - "oe_ei_decode_wstring(~s, " - "&oe_env->_iin, ~s~s)) < 0) {\n", - [InBuffer, IndOp, LName]), - ic_cbe:emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "", []), - emit(Fd, " return oe_error_code;\n\n"), - emit(Fd, " }\n"); -emit_decoding_stmt(G, N, Fd, T, LName, IndOp, InBuffer, _Align, _NextPos, - _DecType, AllocedPars) -> - case ic_cbe:normalize_type(T) of - {basic, Type} -> - emit_decoding_stmt_for_basic_type(Fd, Type, InBuffer, IndOp, - LName, AllocedPars); - _ -> - case T of - {void, _} -> - emit(Fd, - " if ((oe_error_code = ei_decode_atom(~s, " - "&oe_env->_iin, 0)) < 0) {\n", - [InBuffer]), - ic_cbe:emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "", []), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n"); - {sequence, _, _} -> - %% XXX XXX Why? - ?emit_c_dec_rpt(Fd, " ", "", []), - emit(Fd, " return oe_error_code;\n\n"); - {any, _} -> %% Fix for any type - emit(Fd, - " if ((oe_error_code = ei_decode_long(~s, " - "&oe_env->_iin, ~s~s)) < 0) {\n", - [InBuffer, IndOp, LName]), - ic_cbe:emit_dealloc_stmts(Fd, " ", AllocedPars), - ?emit_c_dec_rpt(Fd, " ", "", []), - emit(Fd, " return oe_error_code;\n\n"), - emit(Fd, " }\n"); - _ -> - ic_error:fatal_error(G, {illegal_typecode_for_c, T, N}) - end - end. - -emit_decoding_stmt_for_basic_type(Fd, Type, InBuffer, IndOp, - LName, AllocedPars) -> - Fmt = - " if ((oe_error_code = ~sei_decode_~s(~s, &oe_env->_iin, " - "~s~s)) < 0) {\n", - Ret = - " return oe_error_code;\n" - "}\n", - - {Pre, DecType} = - case Type of - ushort -> {"", "ulong"}; - ulong -> {"", "ulong"}; - ulonglong -> {"oe_", "ulonglong"}; - short -> {"", "long"}; - long -> {"", "long"}; - longlong -> {"oe_", "longlong"}; - float -> {"", "double"}; - double -> {"", "double"}; - boolean -> {"", "atom"}; - char -> {"", "char"}; - wchar -> {"oe_", "wchar"}; - octet -> {"", "char"}; - any -> {"", "long"} - end, - case Type of - ushort -> - emit(Fd, " {\n"), - emit(Fd, " unsigned long oe_ulong;\n"), - emit(Fd, " if ((oe_error_code = ei_decode_ulong(~s, " - "&oe_env->_iin, &oe_ulong)) < 0) {\n", [InBuffer]), - ic_cbe:emit_dealloc_stmts(Fd, " ", AllocedPars), - emit_c_dec_rpt(Fd, " ", "ushort", []), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n"), - emit(Fd, " *~s = (unsigned short) oe_ulong;\n", [LName]), - emit(Fd, " }\n\n"); - short -> - emit(Fd, " {\n"), - emit(Fd, " long oe_long;\n"), - emit(Fd, " if ((oe_error_code = ei_decode_long(~s, " - "&oe_env->_iin, &oe_long)) < 0) {\n", [InBuffer]), - ic_cbe:emit_dealloc_stmts(Fd, " ", AllocedPars), - emit_c_dec_rpt(Fd, " ", "short", []), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n"), - emit(Fd, " *~s = (short) oe_long;\n", [LName]), - emit(Fd, " }\n\n"); - float -> - emit(Fd, " {\n"), - emit(Fd, " double oe_double;\n"), - emit(Fd, " if ((oe_error_code = ei_decode_double(~s, " - "&oe_env->_iin, &oe_double)) < 0) {\n", [InBuffer]), - ic_cbe:emit_dealloc_stmts(Fd, " ", AllocedPars), - emit_c_dec_rpt(Fd, " ", "float", []), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n"), - emit(Fd, " *~s = (float) oe_double;\n", [LName]), - emit(Fd, " }\n\n"); - boolean -> - emit(Fd, " {\n"), - emit(Fd, " char oe_bool[25];\n\n"), - emit(Fd, " if ((oe_error_code = ei_decode_atom(~s, " - "&oe_env->_iin, oe_bool)) < 0) {\n", [InBuffer]), - ic_cbe:emit_dealloc_stmts(Fd, " ", AllocedPars), - emit_c_dec_rpt(Fd, " ", "boolean", []), - emit(Fd, " return oe_error_code;\n"), - emit(Fd, " }\n"), - emit(Fd, " if (strcmp(oe_bool, \"false\") == 0) {\n"), - emit(Fd, " *(~s) = 0;\n", [LName]), - emit(Fd, " }\n"), - emit(Fd, " else if (strcmp(oe_bool, \"true\") == 0) {\n"), - emit(Fd, " *(~s) = 1;\n", [LName]), - emit(Fd, " } else {\n"), - ic_cbe:emit_dealloc_stmts(Fd, " ", AllocedPars), - emit_c_dec_rpt(Fd, " ", "boolean", []), - emit(Fd, " return -1;\n"), - emit(Fd, " }\n"), - emit(Fd, " }\n\n"); - _ -> - emit(Fd, Fmt, [Pre, DecType, InBuffer, IndOp, LName]), - ic_cbe:emit_dealloc_stmts(Fd, " ", AllocedPars), - emit(Fd, Ret) - end. - - -%%------------------------------------------------------------ -%% Prefix for generic functions -%%------------------------------------------------------------ -get_user_proto(G, Default) -> - case ic_options:get_opt(G, user_protocol) of - false -> - Default; - Pfx -> - Pfx - end. - -%%------------------------------------------------------------ -%% Timeout. Returns a string (or Default). -%%------------------------------------------------------------ -get_c_timeout(G, Default) -> - case ic_options:get_opt(G, c_timeout) of - Tmo when is_integer(Tmo) -> - TmoStr = integer_to_list(Tmo), - {TmoStr, TmoStr}; - {SendTmo, RecvTmo} when is_integer(SendTmo) andalso is_integer(RecvTmo) -> - {integer_to_list(SendTmo), integer_to_list(RecvTmo)}; - false -> - Default - end. - -%%------------------------------------------------------------ -%% ZIPPERS (merging of successive elements of two lists). -%%------------------------------------------------------------ - -%% zip([H1| T1], [H2| T2]) -> -%% [{H1, H2}| zip(T1, T2)]; -%% zip([], []) -> -%% []. - -filterzip(F, [H1| T1], [H2| T2]) -> - case F(H1, H2) of - false -> - filterzip(F, T1, T2); - {true, Val} -> - [Val| filterzip(F, T1, T2)] - end; -filterzip(_, [], []) -> - []. - - diff --git a/lib/ic/src/ic_debug.hrl b/lib/ic/src/ic_debug.hrl deleted file mode 100644 index 97a56743d8..0000000000 --- a/lib/ic/src/ic_debug.hrl +++ /dev/null @@ -1,38 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - -%%---------------------------------------------------------------------- -%% Debug macro -%%---------------------------------------------------------------------- --ifndef(ic_debug_hrl). --define(ic_debug_hrl, true). - --ifdef(debug). - -define(PRINTDEBUG(Msg), - io:format("~p :~p ~p~n", [Msg, ?FILE, ?LINE])). - -define(PRINTDEBUG2(F, A), - io:format(F ++ ":~p ~p~n", A ++ [?FILE, ?LINE])). --else. - -define(PRINTDEBUG(Msg), ok). - -define(PRINTDEBUG2(F, A), ok). --endif. - --endif. diff --git a/lib/ic/src/ic_enum_java.erl b/lib/ic/src/ic_enum_java.erl deleted file mode 100644 index dbfa110089..0000000000 --- a/lib/ic/src/ic_enum_java.erl +++ /dev/null @@ -1,313 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(ic_enum_java). - --include("icforms.hrl"). --include("ic.hrl"). --include("ic_debug.hrl"). -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([gen/3]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- - -%%----------------------------------------------------------------- -%% Func: gen/3 -%%----------------------------------------------------------------- -gen(G, N, X) when is_record(X, enum) -> - %%?PRINTDEBUG2("enum: ~p", [X]), - EnumName = ic_forms:get_java_id(X), - N2 = ["_" ++ EnumName |N], - ic_jbe:gen(G, N2, ic_forms:get_body(X)), - - emit_enum_class(G, N, X, EnumName), - emit_holder_class(G, N, X, EnumName), - emit_helper_class(G, N, X, EnumName); -gen(_G, _N, _X) -> - ok. - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- - -%%----------------------------------------------------------------- -%% Func: emit_enum_class/4 -%%----------------------------------------------------------------- -emit_enum_class(G, N, X, EnumName) -> - {Fd, _} = ic_file:open_java_file(G, N, EnumName), - - EList = enum_member_name_list(G, N, X), - %%?PRINTDEBUG2("EList: ~p", [EList]), - ic_codegen:emit(Fd, ["final public class ",EnumName," {\n\n" - - " // instance variables\n"]), - - emit_enum_member_int_values_initialization(G, N, X, Fd, EList), - emit_enum_public_instance_variables(G, N, X, Fd, EnumName, EList), - - ic_codegen:emit(Fd, [" private int _value;\n\n" - - " // constructors\n" - " private ",EnumName,"(int __value) {\n" - " _value = __value;\n" - " }\n\n" - - " // methods\n" - " public int value() {\n" - " return _value;\n" - " }\n"]), - - emit_enum_from_int_function(G, N, X, Fd, EnumName, EList), - - ic_codegen:emit(Fd, "\n}\n"), - file:close(Fd). - -%%----------------------------------------------------------------- -%% Func: emit_holder_class/4 -%%----------------------------------------------------------------- -emit_holder_class(G, N, _X, EnumName) -> - EName = string:concat(EnumName, "Holder"), - {Fd, _} = ic_file:open_java_file(G, N, EName), - - ic_codegen:emit(Fd, ["final public class ",EnumName,"Holder {\n\n" - - " // instance variables\n" - " public ",EnumName," value;\n\n" - - " // constructors\n" - " public ",EnumName,"Holder() {}\n\n" - - " public ",EnumName,"Holder(",EnumName," initial) {\n" - " value = initial;\n" - " }\n\n" - - " // methods\n" - " public void _marshal(",?ERLANGPACKAGE,"OtpOutputStream out) throws java.lang.Exception {\n" - " ",EnumName,"Helper.marshal(out, value);\n" - " }\n\n" - - " public void _unmarshal(",?ERLANGPACKAGE,"OtpInputStream in) throws java.lang.Exception {\n" - " value = ",EnumName,"Helper.unmarshal(in);\n" - " }\n\n" - "}\n"]), - file:close(Fd). - - -%%----------------------------------------------------------------- -%% Func: emit_helper_class/4 -%%----------------------------------------------------------------- -emit_helper_class(G, N, X, EnumName) -> - EName = string:concat(EnumName, "Helper"), - WEList = enum_member_atom_list(G, N, X), - {Fd, _} = ic_file:open_java_file(G, N, EName), - - ic_codegen:emit(Fd, ["public class ",EnumName,"Helper {\n\n" - - " // constructors\n" - " private ",EnumName,"Helper() {}\n\n" - - " // methods\n" - - " public static void marshal(",?ERLANGPACKAGE,"OtpOutputStream _out, ",EnumName," _value)\n" - " throws java.lang.Exception {\n\n"]), - - emit_enum_write_function(G, N, X, Fd, EnumName), - - ic_codegen:emit(Fd, [" }\n\n" - - " public static ",EnumName," unmarshal(",?ERLANGPACKAGE,"OtpInputStream _in)\n" - " throws java.lang.Exception {\n\n"]), - - emit_enum_read_function(G, N, X, Fd, EnumName), - - ic_codegen:emit(Fd, "\n }\n\n"), - - emit_enum_private_member_variables(Fd, WEList), - - ic_codegen:emit(Fd, ["\n // Get integer value of enum from string\n" - " private static int _getIntFromName(String name) throws java.lang.Exception {\n" - " for(int i = 0; i < _memberCount; i++) {\n" - " if (name.equals(_members[i]))\n" - " return i;\n" - " }\n" - " throw new java.lang.Exception(\"\");\n" - " }\n\n" - - " public static String id() {\n" - " return \"",ictk:get_IR_ID(G, N, X),"\";\n" - " }\n\n" - - " public static String name() {\n" - " return \"",EnumName,"\";\n" - " }\n\n"]), - - ic_jbe:emit_type_function(G, N, X, Fd), - - ic_codegen:emit(Fd, [" public static void insert(",?ICPACKAGE,"Any _any, ",EnumName," _this)\n" - " throws java.lang.Exception {\n\n" - - " ",?ERLANGPACKAGE,"OtpOutputStream _os = \n" - " new ",?ERLANGPACKAGE,"OtpOutputStream();\n\n" - - " _any.type(type());\n" - " marshal(_os, _this);\n" - " _any.insert_Streamable(_os);\n" - " }\n\n" - - " public static ",EnumName," extract(",?ICPACKAGE,"Any _any)\n" - " throws java.lang.Exception {\n\n" - - " return unmarshal(_any.extract_Streamable());\n" - " }\n\n" - - "}\n"]), - file:close(Fd). - -%%----------------------------------------------------------------- -%% Func: emit_enum_public_instance_variables/6 -%%----------------------------------------------------------------- -emit_enum_public_instance_variables(_G, _N, _X, _Fd, _EnumName, []) -> - ok; -emit_enum_public_instance_variables(G, N, X, Fd, EnumName, [Enumerator |EList]) -> - ic_codegen:emit(Fd, [" public static final ",EnumName," ",Enumerator," = new ",EnumName,"(_",Enumerator,");\n"]), - emit_enum_public_instance_variables(G, N, X, Fd, EnumName, EList). - -%%----------------------------------------------------------------- -%% Func: emit_enum_member_int_values_initialization/5 -%%----------------------------------------------------------------- -emit_enum_member_int_values_initialization(G, N, X, Fd, EList) -> - InitString = emit_enum_member_int_values_initialization_1(G, N, X, Fd, EList, 0), - ic_codegen:emit(Fd, [" public static final int ",InitString,";\n"]). - - -%%----------------------------------------------------------------- -%% Func: emit_enum_member_int_values_initialization_1/6 -%%----------------------------------------------------------------- -emit_enum_member_int_values_initialization_1(_G, _N, _X, _Fd, [Enumerator], Num) -> - " _" ++ Enumerator ++ " = " ++ ic_util:to_list(Num); -emit_enum_member_int_values_initialization_1(G, N, X, Fd, [Enumerator |EList], Num) -> - Spaces = if - Num == 0 -> - ""; - true -> - " " - end, - Spaces ++ "_" ++ Enumerator ++ " = " ++ ic_util:to_list(Num) ++ ",\n" ++ - emit_enum_member_int_values_initialization_1(G, N, X, Fd, EList, Num + 1). - -%%----------------------------------------------------------------- -%% Func: emit_enum_from_int_function/6 -%%----------------------------------------------------------------- -emit_enum_from_int_function(_G, _N, _X, Fd, EnumName, EList) -> - ic_codegen:emit(Fd, - [" public static final ",EnumName," from_int(int __value) throws java.lang.Exception {\n" - " switch (__value) {\n"]), - emit_enum_from_int_function_switchbody(Fd, EList), - ic_codegen:emit(Fd, [" }\n" - " }\n"]). - -%%----------------------------------------------------------------- -%% Func: emit_enum_from_int_function_switchbody/2 -%%----------------------------------------------------------------- -emit_enum_from_int_function_switchbody(Fd, []) -> - ic_codegen:emit(Fd, [" default:\n" - " throw new java.lang.Exception(\"\");\n"]); -emit_enum_from_int_function_switchbody(Fd, [Enumerator |EList]) -> - ic_codegen:emit(Fd, [" case _",Enumerator,":\n" - " return ",Enumerator,";\n"]), - emit_enum_from_int_function_switchbody(Fd, EList). - -%%----------------------------------------------------------------- -%% Func: emit_enum_private_member_variables/2 -%%----------------------------------------------------------------- -emit_enum_private_member_variables(Fd, EList) -> - ic_codegen:emit(Fd, [" private static final int _memberCount = ",integer_to_list(length(EList)),";\n" - " private static String[] _members = {\n"]), - emit_enum_private_member_variables_1(Fd, EList), - ic_codegen:emit(Fd, " };\n"). - -%%----------------------------------------------------------------- -%% Func: emit_enum_private_member_variables_1/2 -%%----------------------------------------------------------------- -emit_enum_private_member_variables_1(Fd, [Enumerator]) -> - ic_codegen:emit(Fd, [" \"",Enumerator,"\"\n"]); -emit_enum_private_member_variables_1(Fd, [Enumerator |EList]) -> - ic_codegen:emit(Fd, [" \"",Enumerator,"\",\n"]), - emit_enum_private_member_variables_1(Fd, EList). - -%%----------------------------------------------------------------- -%% Func: emit_enum_read_function/5 -%%----------------------------------------------------------------- -emit_enum_read_function(_G, _N, _X, Fd, EnumName) -> - ic_codegen:emit(Fd, [" return ",EnumName,".from_int(_getIntFromName(_in.read_atom()));"]). - -%%----------------------------------------------------------------- -%% Func: emit_enum_write_function/5 -%%----------------------------------------------------------------- -emit_enum_write_function(_G, _N, _X, Fd, _EnumName) -> - ic_codegen:emit(Fd, " _out.write_atom(_members[_value.value()]);\n"). - - -%%----------------------------------------------------------------- -%% Func: enum_member_name_list/3 -%% -%% Note: The names generated are checked for name coalition -%% with java keywords. If so the name is always prefixed -%% by "_" -%%----------------------------------------------------------------- -enum_member_name_list(_G, _N, X) -> - lists:map( - fun(Enumerator) -> - ic_forms:get_java_id(Enumerator) - end, - ic_forms:get_body(X)). - -%%----------------------------------------------------------------- -%% Func: enum_member_atom_list/3 -%% -%% Note : Similar to the emit_member_list/3 but does not -%% solves name coalitions with java keywords. -%% Used for wire encoding only -%%----------------------------------------------------------------- -enum_member_atom_list(_G, _N, X) -> - lists:map( - fun(Enumerator) -> - ic_forms:get_id2(Enumerator) - end, - ic_forms:get_body(X)). - - - - - - - - diff --git a/lib/ic/src/ic_erl_template.erl b/lib/ic/src/ic_erl_template.erl deleted file mode 100644 index 0839577701..0000000000 --- a/lib/ic/src/ic_erl_template.erl +++ /dev/null @@ -1,640 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(ic_erl_template). - - --export([do_gen/3, emit_header/3]). - --import(ic_codegen, [emit/2, emit/3, nl/1]). - --include("icforms.hrl"). --include("ic.hrl"). - --include_lib("stdlib/include/erl_compile.hrl"). - --define(TAB, " "). --define(TAB2, "% "). - --define(TEMPLATE_1_A, - "%%----------------------------------------------------------------------\n" - "%% \n" - "%% \n" - "%% $Id$\n" - "%%\n" - "%%----------------------------------------------------------------------\n" - "%% Module : ~s.erl\n" - "%% \n" - "%% Source : ~s\n" - "%% \n" - "%% Description : \n" - "%% \n" - "%% Creation date: ~s\n" - "%%\n" - "%%----------------------------------------------------------------------\n" - "-module(~p).\n\n"). - --define(TEMPLATE_1_B, - "%%----------------------------------------------------------------------\n" - "%% Internal Exports\n" - "%%----------------------------------------------------------------------\n" - "-export([init/1,\n" - " terminate/2,\n" - " code_change/3,\n" - " handle_info/2]).\n\n" - "%%----------------------------------------------------------------------\n" - "%% Include Files\n" - "%%----------------------------------------------------------------------\n" - "\n\n" - "%%----------------------------------------------------------------------\n" - "%% Macros\n" - "%%----------------------------------------------------------------------\n" - "\n\n" - "%%----------------------------------------------------------------------\n" - "%% Records\n" - "%%----------------------------------------------------------------------\n" - "-record(state, {}).\n\n" - "%%======================================================================\n" - "%% API Functions\n" - "%%======================================================================\n"). - --define(TEMPLATE_1_C, - "%%======================================================================\n" - "%% Internal Functions\n" - "%%======================================================================\n" - "%%----------------------------------------------------------------------\n" - "%% Function : init/1\n" - "%% Arguments : Env = term()\n" - "%% Returns : {ok, State} |\n" - "%% {ok, State, Timeout} |\n" - "%% ignore |\n" - "%% {stop, Reason}\n" - "%% Raises : -\n" - "%% Description: Initiates the server\n" - "%%----------------------------------------------------------------------\n" - "init(_Env) ->\n" - "\t{ok, #state{}}.\n\n\n" - "%%----------------------------------------------------------------------\n" - "%% Function : terminate/2\n" - "%% Arguments : Reason = normal | shutdown | term()\n" - "%% State = term()\n" - "%% Returns : ok\n" - "%% Raises : -\n" - "%% Description: Invoked when the object is terminating.\n" - "%%----------------------------------------------------------------------\n" - "terminate(_Reason, _State) ->\n" - "\tok.\n\n\n" - "%%----------------------------------------------------------------------\n" - "%% Function : code_change/3\n" - "%% Arguments : OldVsn = undefined | term()\n" - "%% State = NewState = term()\n" - "%% Extra = term()\n" - "%% Returns : {ok, NewState}\n" - "%% Raises : -\n" - "%% Description: Invoked when the object should update its internal state\n" - "%% due to code replacement.\n" - "%%----------------------------------------------------------------------\n" - "code_change(_OldVsn, State, _Extra) ->\n" - "\t{ok, State}.\n\n\n" - "%%----------------------------------------------------------------------\n" - "%% Function : handle_info/2\n" - "%% Arguments : Info = normal | shutdown | term()\n" - "%% State = NewState = term()\n" - "%% Returns : {noreply, NewState} |\n" - "%% {noreply, NewState, Timeout} |\n" - "%% {stop, Reason, NewState}\n" - "%% Raises : -\n" - "%% Description: Invoked when, for example, the server traps exits.\n" - "%%----------------------------------------------------------------------\n" - "handle_info(_Info, State) ->\n" - "\t{noreply, State}.\n\n\n"). - --define(TEMPLATE_2_A, - "%%% #0. BASIC INFORMATION\n" - "%%% ----------------------------------------------------------------------\n" - "%%% %CCaseFile : ~s.erl %\n" - "%%% Author : \n" - "%%% Description : \n" - "%%%\n" - "%%% Modules used: \n" - "%%%\n" - "%%%\n" - "%%% ----------------------------------------------------------------------\n" - "-module(~p).\n" - "-author('unknown').\n" - "-id('').\n" - "-vsn('').\n" - "-date('~s').\n\n" - "%%% ----------------------------------------------------------------------\n" - "%%% Template Id: \n" - "%%%\n" - "%%% #Copyright (C) 2004\n" - "%%% by \n" - "%%%

\n" - "%%% \n" - "%%% \n" - "%%% \n" - "%%% \n" - "%%% \n" - "%%% ----------------------------------------------------------------------\n" - "%%% #1. REVISION LOG\n" - "%%% ----------------------------------------------------------------------\n" - "%%% Rev Date Name What\n" - "%%% ----- ------- -------- --------------------------\n" - "%%% \n" - "%%% ----------------------------------------------------------------------\n" - "%%%\n" - "%%% \n" - "%%% #2. EXPORT LISTS\n" - "%%% ----------------------------------------------------------------------\n" - "%%% #2.1 EXPORTED INTERFACE FUNCTIONS\n" - "%%% ----------------------------------------------------------------------\n"). - --define(TEMPLATE_2_B, - "%%% ----------------------------------------------------------------------\n" - "%%% #2.2 EXPORTED INTERNAL FUNCTIONS\n" - "%%% ----------------------------------------------------------------------\n" - "-export([init/1,\n" - " terminate/2,\n" - " code_change/3,\n" - " handle_info/2]).\n\n" - "%%% ----------------------------------------------------------------------\n" - "%%% #2.3 INCLUDE FILES\n" - "%%% ----------------------------------------------------------------------\n" - "\n\n" - "%%% ----------------------------------------------------------------------\n" - "%%% #2.4 MACROS\n" - "%%% ----------------------------------------------------------------------\n" - "\n\n" - "%%% ----------------------------------------------------------------------\n" - "%%% #2.5 RECORDS\n" - "%%% ----------------------------------------------------------------------\n" - "-record(state, {}).\n\n" - "%%% ----------------------------------------------------------------------\n" - "%%% #3. CODE\n" - "%%% #---------------------------------------------------------------------\n" - "%%% #3.1 CODE FOR EXPORTED INTERFACE FUNCTIONS\n" - "%%% #---------------------------------------------------------------------\n"). - --define(TEMPLATE_2_C, - "%%% ----------------------------------------------------------------------\n" - "%%% #3.3 CODE FOR INTERNAL FUNCTIONS\n" - "%%% ----------------------------------------------------------------------\n" - "%%% ----------------------------------------------------------------------\n" - "%%% # init/1\n" - "%%% Input : Env = term()\n" - "%%% Output : {ok, State} |\n" - "%%% {ok, State, Timeout} |\n" - "%%% ignore |\n" - "%%% {stop, Reason}\n" - "%%% Exceptions : -\n" - "%%% Description: Initiates the server\n" - "%%% ----------------------------------------------------------------------\n" - "init(_Env) ->\n" - "\t{ok, #state{}}.\n\n\n" - "%%% ----------------------------------------------------------------------\n" - "%%% # terminate/2\n" - "%%% Input : Reason = normal | shutdown | term()\n" - "%%% State = term()\n" - "%%% Output : ok\n" - "%%% Exceptions : -\n" - "%%% Description: Invoked when the object is terminating.\n" - "%%% ----------------------------------------------------------------------\n" - "terminate(_Reason, _State) ->\n" - "\tok.\n\n\n" - "%%% ----------------------------------------------------------------------\n" - "%%% # code_change/3\n" - "%%% Input : OldVsn = undefined | term()\n" - "%%% State = NewState = term()\n" - "%%% Extra = term()\n" - "%%% Output : {ok, NewState}\n" - "%%% Exceptions : -\n" - "%%% Description: Invoked when the object should update its internal state\n" - "%%% due to code replacement.\n" - "%%% ----------------------------------------------------------------------\n" - "code_change(_OldVsn, State, _Extra) ->\n" - "\t{ok, State}.\n\n\n" - "%%% ----------------------------------------------------------------------\n" - "%%% # handle_info/2\n" - "%%% Input : Info = normal | shutdown | term()\n" - "%%% State = NewState = term()\n" - "%%% Output : {noreply, NewState} |\n" - "%%% {noreply, NewState, Timeout} |\n" - "%%% {stop, Reason, NewState}\n" - "%%% Exceptions : -\n" - "%%% Description: Invoked when, for example, the server traps exits.\n" - "%%% ----------------------------------------------------------------------\n" - "handle_info(_Info, State) ->\n" - "\t{noreply, State}.\n\n\n" - "%%% ----------------------------------------------------------------------\n" - "%%% #4 CODE FOR TEMPORARY CORRECTIONS\n" - "%%% ----------------------------------------------------------------------\n\n"). - - -%%------------------------------------------------------------ -%% -%% Generate the client side Erlang stubs. -%% -%% Each module is generated to a separate file. -%% -%% Export declarations for all interface functions must be -%% generated. Each function then needs to generate a function head and -%% a body. IDL parameters must be converted into Erlang parameters -%% (variables, capitalised) and a type signature list must be -%% generated (for later encode/decode). -%% -%%------------------------------------------------------------ -do_gen(G, _File, Form) -> - gen_head(G, [], Form), - gen(G, [], Form). - - -gen(G, N, [X|Xs]) when is_record(X, preproc) -> - NewG = ic:handle_preproc(G, N, X#preproc.cat, X), - gen(NewG, N, Xs); -gen(G, N, [X|Xs]) when is_record(X, module) -> - G2 = ic_file:filename_push(G, N, X, erlang_template_no_gen), - N2 = [ic_forms:get_id2(X) | N], - gen_head(G2, N2, X), - gen(G2, N2, ic_forms:get_body(X)), - G3 = ic_file:filename_pop(G2, erlang_template_no_gen), - gen(G3, N, Xs); -gen(G, N, [X|Xs]) when is_record(X, interface) -> - G2 = ic_file:filename_push(G, N, X, erlang_template), - N2 = [ic_forms:get_id2(X) | N], - gen_head(G2, N2, X), - gen(G2, N2, ic_forms:get_body(X)), - lists:foreach(fun({_Name, Body}) -> gen(G2, N2, Body) end, - X#interface.inherit_body), - Fd = ic_genobj:stubfiled(G2), - case get_template_version(G2) of - ?IC_FLAG_TEMPLATE_2 -> - emit(Fd, ?TEMPLATE_2_C, []); - _ -> - emit(Fd, ?TEMPLATE_1_C, []) - end, - G3 = ic_file:filename_pop(G2, erlang_template), - gen(G3, N, Xs); -gen(G, N, [X|Xs]) when is_record(X, op) -> - {Name, InArgNames, OutArgNames, Reply} = extract_info(X), - emit_function(G, N, X, ic_genobj:is_stubfile_open(G), - ic_forms:is_oneway(X), Name, InArgNames, OutArgNames, Reply), - gen(G, N, Xs); -gen(G, N, [X|Xs]) when is_record(X, attr) -> - emit_attr(G, N, X, ic_genobj:is_stubfile_open(G), fun emit_function/9), - gen(G, N, Xs); -gen(G, N, [_X|Xs]) -> - gen(G, N, Xs); -gen(_G, _N, []) -> - ok. - -%% Module Header -emit_header(G, Fd, Name) -> - Date = get_date(), - case get_template_version(G) of - ?IC_FLAG_TEMPLATE_2 -> - emit(Fd, ?TEMPLATE_2_A, [Name, list_to_atom(Name), Date]); - _ -> - IDLFile = ic_genobj:idlfile(G), - emit(Fd, ?TEMPLATE_1_A, [Name, IDLFile, Date, list_to_atom(Name)]) - end. - - -emit_attr(G, N, X, Open, F) -> - XX = #id_of{type=X}, - lists:foreach(fun(Id) -> - X2 = XX#id_of{id=Id}, - IsOneWay = ic_forms:is_oneway(X2), - {Get, Set} = mk_attr_func_names(N, ic_forms:get_id(Id)), - F(G, N, X2, Open, IsOneWay, Get, [], [], - [{ic_util:mk_var(ic_forms:get_id(Id)), - ic_forms:get_tk(X)}]), - case X#attr.readonly of - {readonly, _} -> - ok; - _ -> - F(G, N, X2, Open, IsOneWay, Set, - [{ic_util:mk_var(ic_forms:get_id(Id)), - ic_forms:get_tk(X)}], [], ["ok"]) - end - end, ic_forms:get_idlist(X)). - - -%% The automaticly generated get and set operation names for an -%% attribute. -mk_attr_func_names(_Scope, Name) -> - {"_get_" ++ Name, "_set_" ++ Name}. - - -extract_info(X) when is_record(X, op) -> - Name = ic_forms:get_id2(X), - InArgs = ic:filter_params([in,inout], X#op.params), - OutArgs = ic:filter_params([out,inout], X#op.params), - Reply = case ic_forms:get_tk(X) of - tk_void -> - ["ok"]; - Type -> - [{"OE_Reply", Type}] - end, - InArgsTypeList = - [{ic_util:mk_var(ic_forms:get_id(InArg#param.id)), - ic_forms:get_tk(InArg)} || InArg <- InArgs ], - OutArgsTypeList = - [{ic_util:mk_var(ic_forms:get_id(OutArg#param.id)), - ic_forms:get_tk(OutArg)} || OutArg <- OutArgs ], - {Name, InArgsTypeList, OutArgsTypeList, Reply}. - -get_template_version(G) -> - case ic_options:get_opt(G, flags) of - Flags when is_integer(Flags) -> - case ?IC_FLAG_TEST(Flags, ?IC_FLAG_TEMPLATE_2) of - true -> - ?IC_FLAG_TEMPLATE_2; - false -> - ?IC_FLAG_TEMPLATE_1 - end; - _ -> - ?IC_FLAG_TEMPLATE_1 - end. - - -get_date() -> - {{Y,M,D}, _} = calendar:now_to_datetime(now()), - if - M < 10, D < 10 -> - lists:concat([Y, "-0", M, "-0",D]); - M < 10 -> - lists:concat([Y, "-0", M, "-", D]); - D < 10 -> - lists:concat([Y, "-", M, "-0", D]); - true -> - lists:concat([Y, "-", M, "-", D]) - end. - - -%%------------------------------------------------------------ -%% -%% Export stuff -%% -%% Gathering of all names that should be exported from a stub -%% file. -%% - - -gen_head_special(G, N, X) when is_record(X, interface) -> - Fd = ic_genobj:stubfiled(G), - lists:foreach(fun({_Name, Body}) -> - ic_codegen:export(Fd, exp_top(G, N, Body, [])) - end, X#interface.inherit_body), - nl(Fd), - ok; -gen_head_special(_G, _N, _X) -> - ok. - - -%% Generate all export declarations -gen_head(G, N, X) -> - case ic_genobj:is_stubfile_open(G) of - true -> - Fd = ic_genobj:stubfiled(G), - ic_codegen:export(Fd, exp_top(G, N, X, [])), - gen_head_special(G, N, X), - case get_template_version(G) of - ?IC_FLAG_TEMPLATE_2 -> - emit(Fd, ?TEMPLATE_2_B, []); - _ -> - emit(Fd, ?TEMPLATE_1_B, []) - end; - false -> - ok - end. - -exp_top(_G, _N, X, Acc) when element(1, X) == preproc -> - Acc; -exp_top(G, N, L, Acc) when is_list(L) -> - exp_list(G, N, L, Acc); -exp_top(G, N, M, Acc) when is_record(M, module) -> - exp_list(G, N, ic_forms:get_body(M), Acc); -exp_top(G, N, I, Acc) when is_record(I, interface) -> - exp_list(G, N, ic_forms:get_body(I), Acc); -exp_top(G, N, X, Acc) -> - exp3(G, N, X, Acc). - -exp3(G, N, Op, Acc) when is_record(Op, op) -> - FuncName = ic_forms:get_id(Op#op.id), - Arity = length(ic:filter_params([in, inout], Op#op.params)) + 1 + - count_extras(G, N, Op), - [{FuncName, Arity} | Acc]; -exp3(G, N, A, Acc) when is_record(A, attr) -> - Extra = count_extras(G, N, A), - lists:foldr(fun(Id, Acc2) -> - {Get, Set} = mk_attr_func_names([], ic_forms:get_id(Id)), - case A#attr.readonly of - {readonly, _} -> - [{Get, 1 + Extra} | Acc2]; - _ -> - [{Get, 1 + Extra}, {Set, 2 + Extra} | Acc2] - end - end, Acc, ic_forms:get_idlist(A)); -exp3(_G, _N, _X, Acc) -> - Acc. - -exp_list(G, N, L, OrigAcc) -> - lists:foldr(fun(X, Acc) -> - exp3(G, N, X, Acc) - end, OrigAcc, L). - -count_extras(G, N, Op) -> - case {use_this(G, N, Op), use_from(G, N, Op)} of - {[], []} -> - 0; - {[], _} -> - 1; - {_, []} -> - 1; - _ -> - 2 - end. - -%%------------------------------------------------------------ -%% -%% Emit stuff -%% -%% Low level generation primitives -%% - -emit_function(_G, _N, _X, false, _, _, _, _, _) -> - ok; -emit_function(G, N, X, true, false, Name, InArgs, OutArgs, Reply) -> - Fd = ic_genobj:stubfiled(G), - This = use_this(G, N, Name), - From = use_from(G, N, Name), - State = ["State"], - Vers = get_template_version(G), - case OutArgs of - [] -> - ReplyString = create_string(Reply), - emit_function_header(G, Fd, X, N, Name, create_extra(This, From, Vers), - InArgs, length(InArgs), OutArgs, Reply, - ReplyString, Vers), - emit(Fd, "~p(~s) ->\n\t{reply, ~s, State}.\n\n", - [ic_util:to_atom(Name), create_string(This ++ From ++ State ++ InArgs), - ReplyString]); - _ -> - ReplyString = "{" ++ create_string(Reply ++ OutArgs) ++ "}", - emit_function_header(G, Fd, X, N, Name, create_extra(This, From, Vers), - InArgs, length(InArgs), OutArgs, Reply, - ReplyString, Vers), - emit(Fd, "~p(~s) ->\n\t{reply, ~s, State}.\n\n", - [ic_util:to_atom(Name), create_string(This ++ From ++ State ++ InArgs), - ReplyString]) - end; -emit_function(G, N, X, true, true, Name, InArgs, _OutArgs, _Reply) -> - Fd = ic_genobj:stubfiled(G), - This = use_this(G, N, Name), - State = ["State"], - Vers = get_template_version(G), - emit_function_header(G, Fd, X, N, Name, create_extra(This, [], Vers), - InArgs, length(InArgs), "", "", "", Vers), - emit(Fd, "~p(~s) ->\n\t{noreply, State}.\n\n", - [ic_util:to_atom(Name), create_string(This ++ State ++ InArgs)]). - -create_string([]) -> - ""; -create_string([{Name, _Type}|T]) -> - Name ++ create_string2(T); -create_string([Name|T]) -> - Name ++ create_string2(T). - -create_string2([{Name, _Type}|T]) -> - ", " ++ Name ++ create_string2(T); -create_string2([Name|T]) -> - ", " ++ Name ++ create_string2(T); -create_string2([]) -> - "". - -create_extra([], [], _Vers) -> - {"State - term()", 1}; -create_extra([], _From, ?IC_FLAG_TEMPLATE_2) -> - {"OE_From - term()\n%%% " ++ ?TAB ++ "State - term()", 2}; -create_extra([], _From, _Vers) -> - {"OE_From - term()\n%% " ++ ?TAB ++ "State - term()", 2}; -create_extra(_This, [], ?IC_FLAG_TEMPLATE_2) -> - {"OE_This - #objref{} (i.e., self())\n%%% " ++ ?TAB ++ "State - term()", 2}; -create_extra(_This, [], _Vers) -> - {"OE_This - #objref{} (i.e., self())\n%% " ++ ?TAB ++ "State - term()", 2}; -create_extra(_This, _From, ?IC_FLAG_TEMPLATE_2) -> - {"OE_This - #objref{} (i.e., self())\n%%% " ++ ?TAB ++ - "OE_From - term()\n%%% " ++ ?TAB ++ "State - term()", 3}; -create_extra(_This, _From, _Vers) -> - {"OE_This - #objref{} (i.e., self())\n%% " ++ ?TAB ++ - "OE_From - term()\n%% " ++ ?TAB ++ "State - term()", 3}. - -use_this(G, N, OpName) -> - FullOp = ic_util:to_colon([OpName|N]), - FullIntf = ic_util:to_colon(N), - case {ic_options:get_opt(G, {this, FullIntf}), - ic_options:get_opt(G, {this, FullOp}), - ic_options:get_opt(G, {this, true})} of - {_, force_false, _} -> - []; - {force_false, false, _} -> - []; - {false, false, false} -> - []; - _ -> - ["OE_This"] - end. - -use_from(G, N, OpName) -> - FullOp = ic_util:to_colon([OpName|N]), - FullIntf = ic_util:to_colon(N), - case {ic_options:get_opt(G, {from, FullIntf}), - ic_options:get_opt(G, {from, FullOp}), - ic_options:get_opt(G, {from, true})} of - {_, force_false, _} -> - []; - {force_false, false, _} -> - []; - {false, false, false} -> - []; - _ -> - ["OE_From"] - end. - - -emit_function_header(G, Fd, X, N, Name, {Extra, ExtraNo}, InP, Arity, OutP, - Reply, ReplyString, ?IC_FLAG_TEMPLATE_2) -> - emit(Fd, - "%%% ----------------------------------------------------------------------\n" - "%%% # ~p/~p\n" - "%%% Input : ~s\n", - [ic_util:to_atom(Name), (ExtraNo+Arity), Extra]), - ic_code:type_expand_all(G, N, X, Fd, ?TAB2, InP), - case Reply of - ["ok"] -> - emit(Fd, "%%% Output : ReturnValue = ~s\n", [ReplyString]); - _ -> - emit(Fd, "%%% Output : ReturnValue = ~s\n", [ReplyString]), - ic_code:type_expand_all(G, N, X, Fd, "% ", Reply) - end, - ic_code:type_expand_all(G, N, X, Fd, ?TAB2, OutP), - emit(Fd, - "%%% Exceptions : ~s\n" - "%%% Description: \n" - "%%% ----------------------------------------------------------------------\n", - [get_raises(X, ?IC_FLAG_TEMPLATE_2)]); -emit_function_header(G, Fd, X, N, Name, {Extra, ExtraNo}, InP, Arity, OutP, - Reply, ReplyString, Vers) -> - emit(Fd, - "%%----------------------------------------------------------------------\n" - "%% Function : ~p/~p\n" - "%% Arguments : ~s\n", - [ic_util:to_atom(Name), (ExtraNo+Arity), Extra]), - ic_code:type_expand_all(G, N, X, Fd, ?TAB, InP), - case Reply of - ["ok"] -> - emit(Fd, "%% Returns : ReturnValue = ~s\n", [ReplyString]); - _ -> - emit(Fd, "%% Returns : ReturnValue = ~s\n", [ReplyString]), - ic_code:type_expand_all(G, N, X, Fd, " ", Reply) - end, - ic_code:type_expand_all(G, N, X, Fd, ?TAB, OutP), - emit(Fd, - "%% Raises : ~s\n" - "%% Description: \n" - "%%----------------------------------------------------------------------\n", - [get_raises(X, Vers)]). - -get_raises(#op{raises = []}, _Vers) -> - ""; -get_raises(#op{raises = ExcList}, Vers) -> - get_raises2(ExcList, [], Vers); -get_raises(_X, _Vers) -> - []. - -get_raises2([H], Acc, _Vers) -> - lists:flatten(lists:reverse([ic_util:to_colon(H)|Acc])); -get_raises2([H|T], Acc, ?IC_FLAG_TEMPLATE_2) -> - get_raises2(T, ["\n%%% ", ic_util:to_colon(H) |Acc], - ?IC_FLAG_TEMPLATE_2); -get_raises2([H|T], Acc, _Vers) -> - get_raises2(T, ["\n%% ", ic_util:to_colon(H) |Acc], _Vers). - diff --git a/lib/ic/src/ic_erlbe.erl b/lib/ic/src/ic_erlbe.erl deleted file mode 100644 index d315a17e7c..0000000000 --- a/lib/ic/src/ic_erlbe.erl +++ /dev/null @@ -1,1142 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(ic_erlbe). - - --export([do_gen/3]). -%%------------------------------------------------------------ -%% -%% Internal stuff -%% -%%------------------------------------------------------------ - --export([unfold/1, mk_attr_func_names/2]). - - --import(ic_util, [mk_name/2, mk_var/1, mk_oe_name/2, to_atom/1, to_list/1]). --import(ic_forms, [get_id/1, get_id2/1, get_body/1, is_oneway/1]). --import(ic_codegen, [emit/2, emit/3, nl/1]). --import(ic_options, [get_opt/2]). - --import(lists, [foreach/2, foldr/3, map/2]). - - --include("icforms.hrl"). --include("ic.hrl"). - --include_lib("stdlib/include/erl_compile.hrl"). - - -%%------------------------------------------------------------ -%% -%% Generate the client side Erlang stubs. -%% -%% Each module is generated to a separate file. -%% -%% Export declarations for all interface functions must be -%% generated. Each function then needs to generate a function head and -%% a body. IDL parameters must be converted into Erlang parameters -%% (variables, capitalised) and a type signature list must be -%% generated (for later encode/decode). -%% -%%------------------------------------------------------------ -do_gen(G, File, Form) -> - GT = get_opt(G, be), - G2 = ic_file:filename_push(G, [], mk_oe_name(G, - ic_file:remove_ext(to_list(File))), - erlang), - Light = ic_options:get_opt(G, light_ifr), - R = if - GT == erl_corba, Light == false -> - case ic_genobj:is_stubfile_open(G2) of - true -> - emit(ic_genobj:stubfiled(G2), "-include_lib(\"~s/include/~s\").\n\n", - [?ORBNAME, ?IFRTYPESHRL]); - false -> ok - end, - gen_head(G2, [], Form), - ic_codegen:export(ic_genobj:stubfiled(G2), - [{ictk:register_name(G2), 0}, - {ictk:unregister_name(G2), 0}, - {oe_get_module,5}, - {oe_dependency,0}]), - R0= gen(G2, [], Form), - ictk:reg_gen(G2, [], Form), - ictk:unreg_gen(G2, [], Form), % "new" unreg_gen/3 - genDependency(G2), % creates code for dependency list - R0; - GT == erl_corba, Light == true -> - case ic_genobj:is_stubfile_open(G2) of - true -> - emit(ic_genobj:stubfiled(G2), "-include_lib(\"~s/include/~s\").\n\n", - [?ORBNAME, ?IFRTYPESHRL]); - false -> ok - end, - gen_head(G2, [], Form), - ic_codegen:export(ic_genobj:stubfiled(G2), - [{ictk:register_name(G2), 0}, - {ictk:register_name(G2), 1}, - {ictk:unregister_name(G2), 0}, - {ictk:unregister_name(G2), 1}]), - R0= gen(G2, [], Form), - ictk:reg_gen(G2, [], Form), - ictk:unreg_gen(G2, [], Form), % "new" unreg_gen/3 - R0; - true -> - gen_head(G2, [], Form), - gen(G2, [], Form) - end, - ic_file:filename_pop(G2, erlang), - R. - - -gen(G, N, [X|Xs]) when is_record(X, preproc) -> - NewG = ic:handle_preproc(G, N, X#preproc.cat, X), - gen(NewG, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, module) -> - CD = ic_code:codeDirective(G,X), - G2 = ic_file:filename_push(G, N, X, CD), - N2 = [get_id2(X) | N], - gen_head(G2, N2, X), - gen(G2, N2, get_body(X)), - G3 = ic_file:filename_pop(G2, CD), - gen(G3, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, interface) -> - G2 = ic_file:filename_push(G, N, X, erlang), - N2 = [get_id2(X) | N], - gen_head(G2, N2, X), - gen(G2, N2, get_body(X)), - foreach(fun({_Name, Body}) -> gen(G2, N2, Body) end, - X#interface.inherit_body), - gen_serv(G2, N, X), - G3 = ic_file:filename_pop(G2, erlang), - gen(G3, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, const) -> -% N2 = [get_id2(X) | N], - emit_constant_func(G, X#const.id, X#const.val), - gen(G, N, Xs); %% N2 or N? - -gen(G, N, [X|Xs]) when is_record(X, op) -> - {Name, ArgNames, TypeList, OutArgs} = extract_info(G, N, X), - emit_stub_func(G, N, X, Name, ArgNames, TypeList, OutArgs, - is_oneway(X), get_opt(G, be)), - gen(G, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, attr) -> - emit_attr(G, N, X, fun emit_stub_func/9), - gen(G, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, except) -> - icstruct:except_gen(G, N, X, erlang), - gen(G, N, Xs); - -gen(G, N, [X|Xs]) -> - case may_contain_structs(X) of - true -> icstruct:struct_gen(G, N, X, erlang); - false -> ok - end, - gen(G, N, Xs); - -gen(_G, _N, []) -> ok. - - -may_contain_structs(X) when is_record(X, typedef) -> true; -may_contain_structs(X) when is_record(X, struct) -> true; -may_contain_structs(X) when is_record(X, union) -> true; -may_contain_structs(_X) -> false. - - - -%%-------------------------------------------------------------------- -%% -%% Generate the server side (handle_call and handle_cast) -%% - -gen_serv(G, N, X) -> - case ic_genobj:is_stubfile_open(G) of - true -> - GT = get_opt(G, be), - gen_oe_is_a(G, N, X, GT), - N2 = [get_id2(X) | N], - gen_oe_tc(G, N2, X, GT), - - emit_serv_std(GT, G, N, X), - - gen_calls(G, N2, get_body(X)), - lists:foreach(fun({_Name, Body}) -> - gen_calls(G, N2, Body) end, - X#interface.inherit_body), - gen_end_of_call(GT, G), - - gen_casts(G, N2, get_body(X)), - lists:foreach(fun({_Name, Body}) -> - gen_casts(G, N2, Body) end, - X#interface.inherit_body), - gen_end_of_cast(GT, G), - emit_skel_footer(GT, G, N, X); % Note N instead of N2 - false -> - ok - end. - -gen_oe_is_a(G, N, X, erl_corba) when is_record(X, interface) -> - Fd = ic_genobj:stubfiled(G), - ic_codegen:mcomment(Fd, ["Inherited Interfaces"]), - emit(Fd, "oe_is_a(~p) -> true;\n", [ictk:get_IR_ID(G, N, X)]), - lists:foreach(fun(ScopedName) -> - emit(Fd, "oe_is_a(~p) -> true;\n", - [ic_pragma:scope2id(G, ScopedName)]) - end, X#interface.inherit), - emit(Fd, "oe_is_a(_) -> false.\n"), - nl(Fd), - ok; -gen_oe_is_a(_G, _N, _X, _BE) -> ok. - - -%% Generates the oe_tc function -gen_oe_tc(G, N, X, erl_corba) -> - Fd = ic_genobj:stubfiled(G), - ic_codegen:mcomment(Fd, ["Interface TypeCode"]), - LocalInterface = gen_oe_tc2(G, N, get_body(X), Fd, []), - CompleteInterface = - lists:foldl(fun({Name, Body}, FunAcc) -> - AName = ic_util:to_atom(ic_util:to_undersc(Name)), - gen_oe_tc3(G, AName, Body, Fd, FunAcc) - end, LocalInterface, X#interface.inherit_body), - emit(Fd, "oe_tc(_) -> undefined.\n"), - nl(Fd), - emit(Fd, "oe_get_interface() -> \n\t["), - emit_oe_get_interface(Fd, CompleteInterface), - nl(Fd), - ok; -gen_oe_tc(_, _, _, _) -> - ok. - -emit_oe_get_interface(Fd, []) -> - emit(Fd, "].\n"); -emit_oe_get_interface(Fd, [Item]) -> - emit(Fd, "~s].\n", [lists:flatten(Item)]); -emit_oe_get_interface(Fd, [H|T]) -> - emit(Fd, "~s,\n\t", [lists:flatten(H)]), - emit_oe_get_interface(Fd, T). - -gen_oe_tc2(_,_,[],_, Acc) -> - Acc; -gen_oe_tc2(G, N, [X|Rest], Fd, Acc) when is_record(X, op) -> - R = ic_forms:get_tk(X), - IN = lists:map(fun(P) -> ic_forms:get_tk(P) end, - ic:filter_params([in, inout], X#op.params)), - OUT = lists:map(fun(P) -> ic_forms:get_tk(P) end, - ic:filter_params([out, inout], X#op.params)), - Function = get_id2(X), - FunctionAtom = ic_util:to_atom(Function), - emit(Fd, "oe_tc(~p) -> \n\t~p;\n",[FunctionAtom, {R, IN, OUT}]), - GI = io_lib:format("{~p, oe_tc(~p)}",[Function, FunctionAtom]), - gen_oe_tc2(G, N, Rest, Fd, [GI|Acc]); - -gen_oe_tc2(G, N, [X|Rest], Fd, Acc) when is_record(X, attr) -> - {GetT, SetT} = mk_attr_func_types([], X), - NewAcc = - lists:foldl(fun(Id, FunAcc) -> - {Get, Set} = mk_attr_func_names([], get_id(Id)), - GetAttrAtom = ic_util:to_atom(Get), - emit(Fd, "oe_tc(~p) -> \n\t~p;\n", - [GetAttrAtom, GetT]), - case X#attr.readonly of - {readonly, _} -> - GI = io_lib:format("{~p, oe_tc(~p)}", - [Get, GetAttrAtom]), - [GI|FunAcc]; - _ -> - SetAttrAtom = ic_util:to_atom(Set), - - emit(Fd, "oe_tc(~p) -> \n\t~p;\n", - [SetAttrAtom, SetT]), - GetGI = io_lib:format("{~p, oe_tc(~p)}", - [Get, GetAttrAtom]), - SetGI = io_lib:format("{~p, oe_tc(~p)}", - [Set, SetAttrAtom]), - [GetGI, SetGI|FunAcc] - end - end, Acc, ic_forms:get_idlist(X)), - gen_oe_tc2(G, N, Rest, Fd, NewAcc); - -gen_oe_tc2(G,N,[_X|Rest], Fd, Acc) -> - gen_oe_tc2(G,N,Rest, Fd, Acc). - - -gen_oe_tc3(_,_,[],_, Acc) -> - Acc; -gen_oe_tc3(G, N, [X|Rest], Fd, Acc) when is_record(X, op) -> - Function = get_id2(X), - FunctionAtom = ic_util:to_atom(get_id2(X)), - GI = io_lib:format("{~p, ~p:oe_tc(~p)}",[Function, N, FunctionAtom]), - emit(Fd, "oe_tc(~p) -> ~p:oe_tc(~p);\n", - [FunctionAtom, N, FunctionAtom]), - gen_oe_tc3(G, N, Rest, Fd, [GI|Acc]); - -gen_oe_tc3(G, N, [X|Rest], Fd, Acc) when is_record(X, attr) -> - NewAcc = lists:foldl(fun(Id, FunAcc) -> - {Get, Set} = mk_attr_func_names([], get_id(Id)), - GetAttrAtom = ic_util:to_atom(Get), - emit(Fd, "oe_tc(~p) -> ~p:oe_tc(~p);\n", - [GetAttrAtom, N, GetAttrAtom]), - case X#attr.readonly of - {readonly, _} -> - [io_lib:format("{~p, ~p:oe_tc(~p)}", - [Get, N, GetAttrAtom])|FunAcc]; - _ -> - SetAttrAtom = ic_util:to_atom(Set), - emit(Fd, "oe_tc(~p) -> ~p:oe_tc(~p);\n", - [SetAttrAtom, N, SetAttrAtom]), - [io_lib:format("{~p, ~p:oe_tc(~p)}", - [Get, N, GetAttrAtom]), - io_lib:format("{~p, ~p:oe_tc(~p)}", - [Set, N, SetAttrAtom])|FunAcc] - end - end, Acc, ic_forms:get_idlist(X)), - gen_oe_tc3(G, N, Rest, Fd, NewAcc); - -gen_oe_tc3(G,N,[_X|Rest], Fd, Acc) -> - gen_oe_tc3(G,N,Rest, Fd, Acc). - -gen_calls(G, N, [X|Xs]) when is_record(X, op) -> - case is_oneway(X) of - false -> - {Name, ArgNames, TypeList, OutArgs} = extract_info(G, N, X), - emit_skel_func(G, N, X, Name, ArgNames, TypeList, OutArgs, false, - get_opt(G, be)), - gen_calls(G, N, Xs); - true -> - gen_calls(G, N, Xs) - end; - -gen_calls(G, N, [X|Xs]) when is_record(X, attr) -> - emit_attr(G, N, X, fun emit_skel_func/9), - gen_calls(G, N, Xs); - -gen_calls(G, N, [_X|Xs]) -> gen_calls(G, N, Xs); -gen_calls(_G, _N, []) -> ok. - -gen_casts(G, N, [X|Xs]) when is_record(X, op) -> - case is_oneway(X) of - true -> - {Name, ArgNames, TypeList, OutArgs} = extract_info(G, N, X), - emit_skel_func(G, N, X, Name, ArgNames, TypeList, OutArgs, true, - get_opt(G, be)), - gen_casts(G, N, Xs); - false -> - gen_casts(G, N, Xs) - end; - -gen_casts(G, N, [_X|Xs]) -> gen_casts(G, N, Xs); -gen_casts(_G, _N, []) -> ok. - -emit_attr(G, N, X, F) -> - XX = #id_of{type=X}, - BE = get_opt(G, be), - {GetType, SetType} = mk_attr_func_types(N, X), - lists:foreach(fun(Id) -> - X2 = XX#id_of{id=Id}, - {Get, Set} = mk_attr_func_names(N, get_id(Id)), - F(G, N, X2, Get, [], GetType, [], - is_oneway(X2), BE), - case X#attr.readonly of - {readonly, _} -> ok; - _ -> - F(G, N, X2, Set, [mk_name(G, "Value")], - SetType, [], - is_oneway(X2), BE) - end end, ic_forms:get_idlist(X)). - - -extract_info(G, _N, X) when is_record(X, op) -> - Name = get_id2(X), - InArgs = ic:filter_params([in,inout], X#op.params), - OutArgs = ic:filter_params([out,inout], X#op.params), - ArgNames = mk_erl_vars(G, InArgs), - TypeList = {ic_forms:get_tk(X), - map(fun(Y) -> ic_forms:get_tk(Y) end, InArgs), - map(fun(Y) -> ic_forms:get_tk(Y) end, OutArgs) - }, - {Name, ArgNames, TypeList, OutArgs}. - - - -%% This function generates the standard functions of an object -%% gen_server -emit_serv_std(erl_corba, G, N, X) -> - Fd = ic_genobj:stubfiled(G), - Impl = ic_genobj:impl(G), - TypeID = ictk:get_IR_ID(G, N, X), - - nl(Fd), nl(Fd), nl(Fd), - ic_codegen:mcomment(Fd, ["Object server implementation."]), - nl(Fd), nl(Fd), - ic_codegen:mcomment(Fd, ["Function for fetching the interface type ID."]), - nl(Fd), - emit(Fd, "typeID() ->\n"), - emit(Fd, " \"~s\".\n", [TypeID]), - nl(Fd), nl(Fd), - ic_codegen:mcomment(Fd, ["Object creation functions."]), - nl(Fd), - emit(Fd, "oe_create() ->\n"), - emit(Fd, " corba:create(?MODULE, \"~s\").\n", [TypeID]), - nl(Fd), - emit(Fd, "oe_create_link() ->\n"), - emit(Fd, " corba:create_link(?MODULE, \"~s\").\n", [TypeID]), - nl(Fd), - emit(Fd, "oe_create(Env) ->\n"), - emit(Fd, " corba:create(?MODULE, \"~s\", Env).\n", [TypeID]), - nl(Fd), - emit(Fd, "oe_create_link(Env) ->\n"), - emit(Fd, " corba:create_link(?MODULE, \"~s\", Env).\n", [TypeID]), - nl(Fd), - emit(Fd, "oe_create(Env, RegName) ->\n"), - emit(Fd, " corba:create(?MODULE, \"~s\", Env, RegName).\n", [TypeID]), - nl(Fd), - emit(Fd, "oe_create_link(Env, RegName) ->\n"), - emit(Fd, " corba:create_link(?MODULE, \"~s\", Env, RegName).\n", [TypeID]), - nl(Fd), - ic_codegen:mcomment(Fd, ["Init & terminate functions."]), - nl(Fd), - emit(Fd, "init(Env) ->\n"), - ic_codegen:comment(Fd, "Call to implementation init"), - emit(Fd, " corba:handle_init(~p, Env).\n", [to_atom(Impl)]), - nl(Fd), - emit(Fd, "terminate(Reason, State) ->\n"), - emit(Fd, " corba:handle_terminate(~p, Reason, State).\n", - [to_atom(Impl)]), - nl(Fd), nl(Fd), - Fd; -emit_serv_std(erl_genserv, G, N, X) -> - Fd = ic_genobj:stubfiled(G), - Impl = ic_genobj:impl(G), - TypeID = ictk:get_IR_ID(G, N, X), - - nl(Fd), nl(Fd), nl(Fd), - ic_codegen:mcomment(Fd, ["Server implementation."]), - nl(Fd), nl(Fd), - ic_codegen:mcomment(Fd, ["Function for fetching the interface type ID."]), - nl(Fd), - emit(Fd, "typeID() ->\n"), - emit(Fd, " \"~s\".\n", [TypeID]), - nl(Fd), nl(Fd), - ic_codegen:mcomment(Fd, ["Server creation functions."]), - nl(Fd), - emit(Fd, "oe_create() ->\n"), - emit(Fd, " start([], []).\n", []), - nl(Fd), - emit(Fd, "oe_create_link() ->\n"), - emit(Fd, " start_link([], []).\n", []), - nl(Fd), - emit(Fd, "oe_create(Env) ->\n"), - emit(Fd, " start(Env, []).\n", []), - nl(Fd), - emit(Fd, "oe_create_link(Env) ->\n"), - emit(Fd, " start_link(Env, []).\n", []), - nl(Fd), - emit(Fd, "oe_create(Env, RegName) ->\n"), - emit(Fd, " start(RegName, Env, []).\n", []), - nl(Fd), - emit(Fd, "oe_create_link(Env, RegName) ->\n"), - emit(Fd, " start_link(RegName, Env, []).\n", []), - nl(Fd), - ic_codegen:mcomment(Fd, ["Start functions."]), - nl(Fd), - emit(Fd, "start(Env, Opt) ->\n"), - emit(Fd, " gen_server:start(?MODULE, Env, Opt).\n"), - nl(Fd), - emit(Fd, "start_link(Env, Opt) ->\n"), - emit(Fd, " gen_server:start_link(?MODULE, Env, Opt).\n"), - nl(Fd), - emit(Fd, "start(RegName, Env, Opt) ->\n"), - emit(Fd, " gen_server:start(RegName, ?MODULE, Env, Opt).\n"), - nl(Fd), - emit(Fd, "start_link(RegName, Env, Opt) ->\n"), - emit(Fd, " gen_server:start_link(RegName, ?MODULE, Env, Opt).\n"), - nl(Fd), - ic_codegen:comment(Fd, "Standard gen_server termination"), - emit(Fd, "stop(OE_THIS) ->\n"), - emit(Fd, " gen_server:cast(OE_THIS,stop).\n"), - nl(Fd), - ic_codegen:comment(Fd, "Call to implementation init"), - emit(Fd, "init(Env) ->\n"), - emit(Fd, " ~p:~p(Env).\n", [to_atom(Impl), init]), - nl(Fd), - emit(Fd, "terminate(Reason, State) ->\n"), - emit(Fd, " ~p:~p(Reason, State).\n", - [to_atom(Impl), terminate]), - nl(Fd), nl(Fd), - Fd. - -gen_end_of_call(erl_corba, G) -> - Fd = ic_genobj:stubfiled(G), - nl(Fd), nl(Fd), - ic_codegen:mcomment_light(Fd, ["Standard gen_server call handle"]), - emit(Fd, "handle_call(stop, _, State) ->\n"), - emit(Fd, " {stop, normal, ok, State}"), - case get_opt(G, serv_last_call) of - exception -> - emit(Fd, ";\n"), - nl(Fd), - emit(Fd, "handle_call(_, _, State) ->\n"), - emit(Fd, " {reply, catch corba:raise(#'BAD_OPERATION'{minor=1163001857, completion_status='COMPLETED_NO'}), State}.\n"); - exit -> - emit(Fd, ".\n"), - nl(Fd), - nl(Fd) - end, - ok; -gen_end_of_call(erl_genserv, G) -> - Fd = ic_genobj:stubfiled(G), - nl(Fd), nl(Fd), - ic_codegen:mcomment_light(Fd, ["Standard gen_server call handle"]), - emit(Fd, "handle_call(stop, _, State) ->\n"), - emit(Fd, " {stop, normal, ok, State}"), - emit(Fd, ".\n"), - nl(Fd), nl(Fd), - ok. - -gen_end_of_cast(erl_corba, G) -> - Fd = ic_genobj:stubfiled(G), - nl(Fd), nl(Fd), - ic_codegen:mcomment_light(Fd, ["Standard gen_server cast handle"]), - emit(Fd, "handle_cast(stop, State) ->\n"), - emit(Fd, " {stop, normal, State}"), - case get_opt(G, serv_last_call) of - exception -> - emit(Fd, ";\n"), - nl(Fd), - emit(Fd, "handle_cast(_, State) ->\n"), - emit(Fd, " {noreply, State}.\n"); - exit -> - emit(Fd, ".\n"), - nl(Fd), nl(Fd) - end, - ok; -gen_end_of_cast(erl_genserv, G) -> - Fd = ic_genobj:stubfiled(G), - nl(Fd), nl(Fd), - ic_codegen:mcomment_light(Fd, ["Standard gen_server cast handle"]), - emit(Fd, "handle_cast(stop, State) ->\n"), - emit(Fd, " {stop, normal, State}"), - emit(Fd, ".\n"), - nl(Fd), nl(Fd), - ok. - -emit_skel_footer(erl_corba, G, N, X) -> - Fd = ic_genobj:stubfiled(G), - nl(Fd), nl(Fd), - ic_codegen:mcomment_light(Fd, ["Standard gen_server handles"]), - case use_impl_handle_info(G, N, X) of - true -> - emit(Fd, "handle_info(Info, State) ->\n"), - emit(Fd, " corba:handle_info(~p, Info, State).\n\n", - [list_to_atom(ic_genobj:impl(G))]); - false -> - emit(Fd, "handle_info(_, State) ->\n"), - emit(Fd, " {noreply, State}.\n\n") - end, - nl(Fd), - case get_opt(G, no_codechange) of - false -> - emit(Fd, "code_change(OldVsn, State, Extra) ->\n"), - emit(Fd, " corba:handle_code_change(~p, OldVsn, State, Extra).\n\n", - [list_to_atom(ic_genobj:impl(G))]); - true -> - emit(Fd, "code_change(_, State, _) ->\n"), - emit(Fd, " {ok, State}.\n\n") - end, - ok; -emit_skel_footer(erl_genserv, G, N, X) -> - Fd = ic_genobj:stubfiled(G), - nl(Fd), nl(Fd), - ic_codegen:mcomment_light(Fd, ["Standard gen_server handles"]), - case use_impl_handle_info(G, N, X) of - true -> - emit(Fd, "handle_info(Info, State) ->\n"), - emit(Fd, " ~p:handle_info(Info, State).\n\n", - [list_to_atom(ic_genobj:impl(G))]); - false -> - emit(Fd, "handle_info(_, State) ->\n"), - emit(Fd, " {noreply, State}.\n\n") - end, - nl(Fd), nl(Fd), - case get_opt(G, no_codechange) of - false -> - emit(Fd, "code_change(OldVsn, State, Extra) ->\n"), - emit(Fd, " ~p:code_change(OldVsn, State, Extra).\n\n", - [list_to_atom(ic_genobj:impl(G))]); - true -> - emit(Fd, "code_change(_, State, _) ->\n"), - emit(Fd, " {ok, State}.\n\n") - end, - ok. - - -use_impl_handle_info(G, N, X) -> - FullName = ic_util:to_colon([get_id2(X) | N]), - case {get_opt(G, {handle_info, true}), get_opt(G, {handle_info, FullName})} of - {_, force_false} -> false; - {false, false} -> false; - _ -> true - end. - -use_timeout(G, N, _X) -> - FullName = ic_util:to_colon(N), - case {get_opt(G, {timeout, true}), get_opt(G, {timeout, FullName})} of - {_, force_false} -> false; - {false, false} -> false; - _ -> true - end. - -use_precond(G, N, X) -> - FullName = ic_util:to_colon([get_id2(X) | N]), - case get_opt(G, {precond, FullName}) of - false -> - InterfaceName = ic_util:to_colon(N), - case get_opt(G, {precond, InterfaceName}) of - false -> - case get_opt(G, precond) of - false -> false; - V2 -> V2 - end; - V2 -> V2 - end; - V1 -> V1 - end. - -use_postcond(G, N, X) -> - FullName = ic_util:to_colon([get_id2(X) | N]), - case get_opt(G, {postcond, FullName}) of - false -> - InterfaceName = ic_util:to_colon(N), - case get_opt(G, {postcond, InterfaceName}) of - false -> - case get_opt(G, postcond) of - false -> false; - V3 -> V3 - end; - V2 -> V2 - end; - V1 -> V1 - end. - - -%%------------------------------------------------------------ -%% -%% Export stuff -%% -%% Gathering of all names that should be exported from a stub -%% file. -%% - - -gen_head_special(G, N, X) when is_record(X, interface) -> - Fd = ic_genobj:stubfiled(G), - - foreach(fun({Name, Body}) -> - ic_codegen:comment(Fd, "Exports from ~p", - [ic_util:to_colon(Name)]), - ic_codegen:export(Fd, exp_top(G, N, Body, [], get_opt(G, be))), - nl(Fd) - end, X#interface.inherit_body), - - ic_codegen:comment(Fd, "Type identification function"), - ic_codegen:export(Fd, [{typeID, 0}]), - nl(Fd), - ic_codegen:comment(Fd, "Used to start server"), - ic_codegen:export(Fd, [{oe_create, 0}, {oe_create_link, 0}, {oe_create, 1}, {oe_create_link, 1}, - {oe_create, 2}, {oe_create_link, 2}]), - nl(Fd), - case get_opt(G, be) of - erl_corba -> - ic_codegen:comment(Fd, "TypeCode Functions and inheritance"), - ic_codegen:export(Fd, [{oe_tc, 1}, {oe_is_a, 1}, {oe_get_interface, 0}]); - _ -> - ic_codegen:export(Fd, [{start, 2}, {start_link, 3}]) - end, - nl(Fd), - ic_codegen:comment(Fd, "gen server export stuff"), - emit(Fd, "-behaviour(gen_server).\n"), - - case get_opt(G, be) of - erl_genserv -> %% stop/1 is only for erl_genserv backend - ic_codegen:export(Fd, [{stop, 1}, {init, 1}, {terminate, 2}, {handle_call, 3}, - {handle_cast, 2}, {handle_info, 2}, {code_change, 3}]); - _ -> - ic_codegen:export(Fd, [{init, 1}, {terminate, 2}, {handle_call, 3}, - {handle_cast, 2}, {handle_info, 2}, {code_change, 3}]) - end, - - case get_opt(G, be) of - erl_corba -> - nl(Fd), - emit(Fd, "-include_lib(\"~s/include/~s\").\n", [?ORBNAME, ?CORBAHRL]); - _ -> - ok - end, - nl(Fd), nl(Fd), - ic_codegen:mcomment(Fd, ["Object interface functions."]), - nl(Fd), nl(Fd), nl(Fd), - Fd; -gen_head_special(_G, _N, _X) -> ok. - - - -%% Shall generate all export declarations -gen_head(G, N, X) -> - case ic_genobj:is_stubfile_open(G) of - true -> - F = ic_genobj:stubfiled(G), - ic_codegen:comment(F, "Interface functions"), - ic_codegen:export(F, exp_top(G, N, X, [], get_opt(G, be))), - nl(F), - gen_head_special(G, N, X); - false -> ok - end. - -exp_top(_G, _N, X, Acc, _) when element(1, X) == preproc -> - Acc; -exp_top(G, N, L, Acc, BE) when is_list(L) -> - exp_list(G, N, L, Acc, BE); -exp_top(G, N, M, Acc, BE) when is_record(M, module) -> - exp_list(G, N, get_body(M), Acc, BE); -exp_top(G, N, I, Acc, BE) when is_record(I, interface) -> - exp_list(G, N, get_body(I), Acc, BE); -exp_top(G, N, X, Acc, BE) -> - exp3(G, N, X, Acc, BE). - -exp3(_G, _N, C, Acc, _BE) when is_record(C, const) -> - [{get_id(C#const.id), 0} | Acc]; -exp3(_G, _N, Op, Acc, erl_corba) when is_record(Op, op) -> - FuncName = get_id(Op#op.id), - Arity = length(ic:filter_params([in, inout], Op#op.params)) + 1, - [{FuncName, Arity}, {FuncName, Arity+1} | Acc]; -exp3(G, N, Op, Acc, _BE) when is_record(Op, op) -> - FuncName = get_id(Op#op.id), - Arity = - case use_timeout(G,N,Op) of - true -> - %% NO TimeOut on ONEWAYS here !!!! - case is_oneway(Op) of - true -> - length(ic:filter_params([in, inout], Op#op.params)) + 1; - false -> - length(ic:filter_params([in, inout], Op#op.params)) + 2 - end; - false -> - length(ic:filter_params([in, inout], Op#op.params)) + 1 - end, - [{FuncName, Arity} | Acc]; - -exp3(_G, _N, A, Acc, erl_corba) when is_record(A, attr) -> - lists:foldr(fun(Id, Acc2) -> - {Get, Set} = mk_attr_func_names([], get_id(Id)), - case A#attr.readonly of - {readonly, _} -> [{Get, 1}, {Get, 2} | Acc2]; - _ -> [{Get, 1}, {Get, 2}, - {Set, 2}, {Set, 3} | Acc2] - end end, Acc, ic_forms:get_idlist(A)); -exp3(_G, _N, A, Acc, _BE) when is_record(A, attr) -> - lists:foldr(fun(Id, Acc2) -> - {Get, Set} = mk_attr_func_names([], get_id(Id)), - case A#attr.readonly of - {readonly, _} -> [{Get, 1} | Acc2]; - _ -> [{Get, 1}, {Set, 2} | Acc2] - end end, Acc, ic_forms:get_idlist(A)); - -exp3(_G, _N, _X, Acc, _BE) -> Acc. - -exp_list(G, N, L, OrigAcc, BE) -> - lists:foldr(fun(X, Acc) -> exp3(G, N, X, Acc, BE) end, OrigAcc, L). - - - - -%%------------------------------------------------------------ -%% -%% Emit stuff -%% -%% Low level generation primitives -%% - -emit_stub_func(G, N, X, Name, ArgNames, _TypeList, OutArgs, Oneway, Backend) -> - case ic_genobj:is_stubfile_open(G) of - false -> - ok; - true -> - Fd = ic_genobj:stubfiled(G), - StubName = list_to_atom(Name), - UsingTimeout = use_timeout(G, N, X), - Timeout = case UsingTimeout of - true -> - mk_name(G, "Timeout"); - false -> - "infinity" - end, - Options = mk_name(G, "Options"), - This = mk_name(G, "THIS"), - CallOrCast = - case is_oneway(X) of - true -> ?CAST; - _ -> ?CALL - end, - emit_op_comment(G, Fd, X, StubName, ArgNames, OutArgs), - case Backend of - erl_corba -> - emit(Fd, "~p(~s) ->\n", - [StubName, mk_list([This | ArgNames])]), - emit(Fd, " ~s:~s(~s, ~p, [~s], ?MODULE).\n\n", - [?CORBAMOD, CallOrCast, This, StubName, mk_list(ArgNames)]), - emit(Fd, "~p(~s) ->\n", - [StubName, mk_list([This, Options| ArgNames])]), - emit(Fd, " ~s:~s(~s, ~p, [~s], ?MODULE, ~s).\n\n", - [?CORBAMOD, CallOrCast, This, StubName, mk_list(ArgNames), - Options]); - _ -> - FunName = case ic_options:get_opt(G, scoped_op_calls) of - true -> - list_to_atom(ic_util:to_undersc([Name | N])); - false -> - StubName - end, - %% NO TimeOut on ONEWAYS here !!!! - case Oneway of - true -> - emit(Fd, "~p(~s) ->\n", - [StubName, mk_list([This | ArgNames])]); - false -> - case UsingTimeout of - true -> - emit(Fd, "~p(~s) ->\n", - [StubName, mk_list([This, Timeout| ArgNames])]); - false -> - emit(Fd, "~p(~s) ->\n", - [StubName, mk_list([This | ArgNames])]) - end - end, - - %% NO TimeOut on ONEWAYS here !!!! - if - length(ArgNames) == 0 -> - case is_oneway(X) of - true -> - emit(Fd, " ~s:~s(~s, ~p).\n\n", - [?GENSERVMOD, CallOrCast, This, FunName]); - false -> - emit(Fd, " ~s:~s(~s, ~p, ~s).\n\n", - [?GENSERVMOD, CallOrCast, This, FunName, Timeout]) - end; - true -> - case is_oneway(X) of - true -> - emit(Fd, " ~s:~s(~s, {~p, ~s}).\n\n", - [?GENSERVMOD, CallOrCast, This, FunName, - mk_list(ArgNames)]); - false -> - emit(Fd, " ~s:~s(~s, {~p, ~s}, ~s).\n\n", - [?GENSERVMOD, CallOrCast, This, FunName, - mk_list(ArgNames), Timeout]) - end - end - end - end. - -emit_skel_func(G, N, X, OpName, ArgNames, TypeList, OutArgs, Oneway, Backend) -> - case ic_genobj:is_stubfile_open(G) of - false -> - ok; - true -> - emit_skel_func_helper(G, N, X, OpName, ArgNames, TypeList, OutArgs, - Oneway, Backend) - end. - -emit_skel_func_helper(G, N, X, OpName, ArgNames, _TypeList, OutArgs, Oneway, - erl_corba) -> - Fd = ic_genobj:stubfiled(G), - Name = list_to_atom(OpName), - ImplF = Name, - ImplM = list_to_atom(ic_genobj:impl(G)), - ThisStr = mk_name(G, "THIS"), - FromStr = mk_name(G, "From"), - State = mk_name(G, "State"), - Context = mk_name(G, "Context"), - - {UseFrom, From} = - case Oneway of - false -> - case use_from(G, N, OpName) of - true -> - {FromStr, FromStr}; - false -> - {"false", "_"} - end; - true -> - {"false", "_"} - end, - {UseThis, This} = - case use_this(G, N, OpName) of - true -> - {ThisStr, ThisStr}; - false -> - {"false", "_"} - end, - %% Create argument list string - CallArgs = mk_list(ArgNames), - emit_op_comment(G, Fd, X, Name, ArgNames, OutArgs), - - %% Check if pre and post conditions are specified for this operation - Precond = use_precond(G, N, X), - Postcond = use_postcond(G, N, X), - - case Oneway of - true -> - emit(Fd, "handle_cast({~s, ~s, ~p, [~s]}, ~s) ->\n", - [This, Context, Name, CallArgs, State]), - case {Precond, Postcond} of - {false, false} -> - emit(Fd, " corba:handle_cast(~p, ~p, [~s], ~s, ~s, ~s);\n\n", - [ImplM, ImplF, CallArgs, State, Context, UseThis]); - _ -> - emit(Fd, " corba:handle_cast(~p, ~p, [~s], ~s, ~s, ~s, ~p, ~p, ?MODULE);\n\n", - [ImplM, ImplF, CallArgs, State, Context, UseThis, - Precond, Precond]) - end; - false -> - emit(Fd, "handle_call({~s, ~s, ~p, [~s]}, ~s, ~s) ->\n", - [This, Context, Name, CallArgs, From, State]), - case {Precond, Postcond} of - {false, false} -> - emit(Fd, " corba:handle_call(~p, ~p, [~s], ~s, ~s, ~s, ~s);\n\n", - [ImplM, ImplF, CallArgs, State, Context, UseThis, UseFrom]); - _-> - emit(Fd, " corba:handle_call(~p, ~p, [~s], ~s, ~s, ~s, ~s, ~p, ~p, ?MODULE);\n\n", - [ImplM, ImplF, CallArgs, State, Context, UseThis, UseFrom, - Precond, Postcond]) - end - end; -emit_skel_func_helper(G, N, X, OpName, ArgNames, _TypeList, OutArgs, Oneway, - _Backend) -> - Fd = ic_genobj:stubfiled(G), - Name = list_to_atom(OpName), - ImplF = Name, - ImplM = list_to_atom(ic_genobj:impl(G)), - FromStr = mk_name(G, "From"), - State = mk_name(G, "State"), - - %% Create argument list - CallArgs1 = [State | ArgNames], - {CallArgs2, From} = - case is_oneway(X) of - false -> - case use_from(G, N, OpName) of - true -> - {[FromStr | CallArgs1], FromStr}; - false -> - {CallArgs1, "_"} - end; - true -> - {CallArgs1, "_"} - end, - %% Create argument list string - CallArgs = mk_list(CallArgs2), - emit_op_comment(G, Fd, X, Name, ArgNames, OutArgs), - FunName = case ic_options:get_opt(G, scoped_op_calls) of - true -> - list_to_atom(ic_util:to_undersc([OpName | N])); - false -> - list_to_atom(OpName) - end, - case Oneway of - true -> - if - length(ArgNames) == 0 -> - emit(Fd, "handle_cast(~p, ~s) ->\n", [FunName, State]); - true -> - emit(Fd, "handle_cast({~p, ~s}, ~s) ->\n", - [FunName, mk_list(ArgNames), State]) - end, - emit(Fd, " ~p:~p(~s);\n\n", [ImplM, ImplF, CallArgs]); - false -> - if - length(ArgNames) == 0 -> - emit(Fd, "handle_call(~p, ~s, ~s) ->\n", - [FunName, From, State]); - true -> - emit(Fd, "handle_call({~p, ~s}, ~s, ~s) ->\n", - [FunName, mk_list(ArgNames), From, State]) - end, - emit(Fd, " ~p:~p(~s);\n\n", [ImplM, ImplF, CallArgs]) - end. - -use_this(G, N, OpName) -> - FullOp = ic_util:to_colon([OpName|N]), - FullIntf = ic_util:to_colon(N), - case {get_opt(G, {this, FullIntf}), get_opt(G, {this, FullOp}), - get_opt(G, {this, true})} of - {_, force_false, _} -> false; - {force_false, false, _} -> false; - {false, false, false} -> false; - _ -> true - end. - -use_from(G, N, OpName) -> - FullOp = ic_util:to_colon([OpName|N]), - FullIntf = ic_util:to_colon(N), - case {get_opt(G, {from, FullIntf}), get_opt(G, {from, FullOp}), - get_opt(G, {from, true})} of - {_, force_false, _} -> false; - {force_false, false, _} -> false; - {false, false, false} -> false; - _ -> true - end. - - -emit_constant_func(G, Id, Val) -> - case ic_genobj:is_stubfile_open(G) of - false -> ok; - true -> - Fd = ic_genobj:stubfiled(G), - N = list_to_atom(get_id(Id)), - emit_const_comment(G, Fd, Id, N), - emit(Fd, "~p() -> ~p.\n\n", [N, Val]) - end. - - - -emit_const_comment(_G, F, _X, Name) -> - ic_codegen:mcomment_light(F, - [io_lib:format("Constant: ~p", [Name])]). - - -emit_op_comment(G, F, X, Name, InP, OutP) -> - ic_codegen:mcomment_light(F, - [io_lib:format("~s: ~p", [get_title(X), Name]), - "", - get_returns(G, X, InP, OutP) | - get_raises(X)]). - -get_title(X) when is_record(X, attr) -> "Attribute Operation"; -get_title(_X) -> "Operation". - -get_raises(X) when is_record(X, op) -> - if X#op.raises == [] -> []; - true -> - [" Raises: " ++ - mk_list(lists:map(fun(E) -> ic_util:to_colon(E) end, - X#op.raises))] - end; -get_raises(_X) -> []. - -get_returns(_G, _X, _InP, []) -> - " Returns: RetVal"; -get_returns(G, _X, _InP, OutP) -> - " Returns: "++mk_list(["RetVal" | mk_erl_vars(G, OutP)]). - - - - -%%------------------------------------------------------------ -%% -%% Utilities -%% -%% Convenient little go-get functions -%% -%%------------------------------------------------------------ - -%% The automaticly generated get and set operation names for an -%% attribute. -mk_attr_func_names(_Scope, Name) -> - {"_get_" ++ Name, "_set_" ++ Name}. -%% {scoped_name(Scope, "_get_"++Name), scoped_name(Scope, "_set_"++Name)}. - -%% Returns TK of the Get and Set attribute functions. -mk_attr_func_types(_N, X) -> - TK = ic_forms:get_tk(X), - {{TK, [], []}, {tk_void, [TK], []}}. - - - -%%------------------------------------------------------------ -%% -%% Generation utilities and common stuff -%% -%% Convenient stuff for generation -%% -%%------------------------------------------------------------ - - -%% Input is a list of parameters (in parse form) and output is a list -%% of capitalised variable names. mk_var is in icgen -mk_erl_vars(_G, Params) -> - map(fun(P) -> mk_var(get_id(P#param.id)) end, Params). - - -%% mk_list produces a nice comma separated string of variable names -mk_list([]) -> []; -mk_list([Arg | Args]) -> - Arg ++ mk_list2(Args). -mk_list2([Arg | Args]) -> - ", " ++ Arg ++ mk_list2(Args); -mk_list2([]) -> []. - - -%%------------------------------------------------------------ -%% -%% Parser utilities -%% -%% Called from the yecc parser. Expands the identifier list of an -%% attribute so that the attribute generator never has to handle -%% lists. -%% -%%------------------------------------------------------------ - - -%% Unfold identifier lists or nested lists. Note that many records -%% contain an entry named id that is a list before unfold and a single -%% id afterwards. -unfold(L) when is_list(L) -> - lists:flatten(map(fun(X) -> unfold2(X) end, L)); -unfold(X) -> unfold2(X). - -unfold2(A) when is_record(A, attr) -> - map(fun(Id) -> A#attr{id=Id} end, A#attr.id); -unfold2(M) when is_record(M, member) -> - map(fun(Id) -> M#member{id=Id} end, M#member.id); -unfold2(M) when is_record(M, case_dcl) -> - map(fun(Id) -> M#case_dcl{label=Id} end, M#case_dcl.label); -unfold2(T) when is_record(T, typedef) -> - map(fun(Id) -> T#typedef{id=Id} end, T#typedef.id). - - - - -%% Code produce for dependency function -genDependency(G) -> - Fd = ic_genobj:stubfiled(G), - nl(Fd),nl(Fd), - ic_codegen:comment(Fd, "Idl file dependency list function"), - emit(Fd, "oe_dependency() ->\n\n", []), - emit(Fd, " ~p.\n\n", [ic_pragma:get_dependencies(G)]). diff --git a/lib/ic/src/ic_error.erl b/lib/ic/src/ic_error.erl deleted file mode 100644 index 790e1f0539..0000000000 --- a/lib/ic/src/ic_error.erl +++ /dev/null @@ -1,376 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(ic_error). - --include_lib("ic/src/ic.hrl"). --include_lib("ic/src/ic_debug.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([error/2, - fatal_error/2, - init_errors/1, - return/1, - warn/2, - get_error_count/1]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- - -%%-------------------------------------------------------------------- -%% -%% Error and warning utilities. -%% -%% Note that errors are somewhat brutal and that warnings are kept in -%% a list for the user to extract at a later stage. The handling of -%% warnings is entirely up to the user while handling of errors is -%% never left to the user. -%% -%%-------------------------------------------------------------------- - -return(G) -> - case ic_options:get_opt(G, silent2) of - true -> - case get_error_count(G) of - 0 -> {ok, get_list(G, warn_list)}; - _X -> {error, get_list(G, warn_list), get_list(G, error_list)} - end; - false -> - case get_error_count(G) of - 0 -> ok; - X -> print_error(G, {error, g, ic_genobj:idlfile(G), {error_count, X}}), - error - end - end. - - -get_list(G, ListName) -> - ?lookup(G#genobj.options, ListName). - - -%% Public function for reporting an error -error(G, Err) -> - Error = {error, g, ic_genobj:idlfile(G), Err}, - case insert_in_list(G, Error, error_list) of - new -> - print_error(G, Error), - MaxErrs = ic_options:get_opt(G, maxerrs), - case incr_counter(G, error_count) of - X when X >= MaxErrs -> - fatal_error(G, {error_count_exceeded, X}); - _ -> Error - end; - old -> - Error - end. - -%% Public function for reporting an error. NOTE: also stops execution -fatal_error(G, Err) -> - Error = {error, g, ic_genobj:idlfile(G), Err}, - insert_in_list(G, Error, error_list), - incr_counter(G, error_count), - print_error(G, Error), - throw(Error). - - -%% Public function for reporting a warning -warn(G, Warn) -> - Warning = {warn, g, ic_genobj:idlfile(G), Warn}, - case insert_in_list(G, Warning, warn_list) of - new -> - print_warn(G, Warning), - MaxErrs = ic_options:get_opt(G, maxwarns), - case incr_counter(G, warn_count) of - X when X >= MaxErrs -> - fatal_error(G, {warn_count_exceeded, X}); - _ -> ok - end; - old -> ok -end. - - -%% Initialisation of all counters and lists associated with errors and -%% warnings. -init_errors(G) -> - reset_counter(G, error_count), - reset_counter(G, warn_count), - reset_list(G, error_list), - reset_list(G, warn_list), - ok. - - - -%%-------------------------------------------------------------------- -%% Counter and list (warn and error) handling -%% - -incr_counter(G, Counter) -> - Num = ?lookup(G#genobj.options, Counter) + 1, - ?insert(G#genobj.options, Counter, Num), - Num. - -reset_counter(G, Counter) -> - ?insert(G#genobj.options, Counter, 0). - -get_error_count(G) -> - ?lookup(G#genobj.options, error_count). - -reset_list(G, ListName) -> - ?insert(G#genobj.options, ListName, []). - -insert_in_list(G, Item, ListName) -> - List = ?lookup(G#genobj.options, ListName), - case lists:member(Item, List) of - true -> old; - false -> - ?insert(G#genobj.options, ListName, [Item| List]), - new - end. - - -%%-------------------------------------------------------------------- -%% -%% Nice printouts of errors and warnings -%% - - -%% Errors - -print_error(G, Error) -> - case {ic_options:get_opt(G, silent), ic_options:get_opt(G, silent2)} of - {true, _} -> ok; - {_, true} -> ok; - _ -> format_error(Error) - end, - error. - -format_error({error, _, File, {parse_error, Line, Args}}) -> - Fmt = lists:foldl(fun(_, Acc) -> [$~, $s | Acc] end, [], Args), - display(File, Line, Fmt, Args); -format_error({error, _, File, {error_count, X}}) -> - display(File, "~p errors found", [X]); -format_error({error, _, File, {error_count_exceeded, X}}) -> - display(File, "too many errors found (~p)", [X]); -format_error({error, _, File, {warn_count_exceeded, X}}) -> - display(File, "too many warnings found (~p)", [X]); -format_error({error, _, File, {inherit_name_collision, - {Orig, Item}, {Base, NewItem}}}) -> - display(File, ic_forms:get_line(Item), "~s collides with ~s", - [pp([ic_forms:get_id2(Item) | Orig]), pp([ic_forms:get_id2(NewItem) | Base])]); -format_error({error, _, File, {unsupported_op, {'~', Line}}}) -> - display(File, Line, "unsupported unary operation ~~", []); -format_error({error, _, File, {multiply_defined, X}}) -> - display(File, ic_forms:get_line(X), "multiple defined identifier ~p", [ic_forms:get_id2(X)]); -format_error({error, _, File, {illegal_spelling, X}}) -> - display(File, ic_forms:get_line(X), -% "illegal spelling of identifier ~s (capitalisation?)", - "identifier ~p multiply declared - differs in case only", - [ic_forms:get_id2(X)]); -format_error({error, _, File, {illegal_enumerant_value, X}}) -> - display(File, ic_forms:get_line(X), - "Enumerant ~s's value collide by name with other type", - [ic_forms:get_id2(X)]); -format_error({error, _, File, {illegal_forward, X}}) -> - display(File, ic_forms:get_line(X), - "cannot inherit from forwarded interface ~s", [ic_forms:get_id2(X)]); -format_error({error, _, File, {illegal_const_t, X, Type}}) -> - display(File, ic_forms:get_line(X), - "Illegal constant type ~s of ~s", [pp(Type), ic_forms:get_id2(X)]); -format_error({error, _, File, {multiple_cases, X}}) -> - display(File, ic_forms:get_line(X), "multiple case values ~s", [pp(X)]); -format_error({error, _, File, {symtab_not_found, X}}) -> - display(File, ic_forms:get_line(X), "undeclared identifier ~s", [ic_forms:get_id2(X)]); -format_error({error, _, File, {preproc, Lines}}) -> - display(File, "preprocessor error: ~s", [hd(Lines)]); -format_error({error, _, File, {ic_pp_error, Lines}}) -> - display(File, "preprocessor error: ~s", [Lines]); -format_error({error, _, File, {illegal_float, Line}}) -> - display(File, Line, "illegal floating point number", []); -format_error({error, _, File, {bad_type_combination, E, V1, V2}}) -> - display(File, ic_forms:get_line(E), "incompatible types, ~p and ~p", [V1, V2]); -format_error({error, _, File, {bad_oneway_type, X, _TK}}) -> - display(File, ic_forms:get_line(X), "oneway operations must be declared void", []); -format_error({error, _, File, {inout_spec_for_c, X, Arg}}) -> - display(File, ic_forms:get_line(X), "inout parameter ~s specified in native c mode", - [Arg]); -format_error({error, _, File, {sequence_not_defined, X, Arg}}) -> - display(File, ic_forms:get_line(X), "sequence ~s not defined", [Arg]); -format_error({error, _, File, {illegal_typecode_for_c, Arg}}) -> - display(File, not_specified, "illegal typecode ~s used in native c mode", - [Arg]); -format_error({error, _, File, {name_not_found, N}}) -> - display(File, not_specified, "name ~s not found", [N]); -format_error({error, _, File, {illegal_typecode_for_c, Arg, N}}) -> - display(File, not_specified, "illegal typecode ~p used for ~p in native c mode", [Arg, N]); -format_error({error, _, File, {oneway_outparams, X}}) -> - display(File, ic_forms:get_line(X), - "oneway operations may not have out or inout parameters", []); -format_error({error, _, File, {oneway_raises, X}}) -> - display(File, ic_forms:get_line(X), "oneway operations may not raise exceptions", - []); -format_error({error, _, File, {bad_tk_match, T, TK, V}}) -> - display(File, ic_forms:get_line(T), - "value ~p does not match declared type ~s", [V, pp(TK)]); -format_error({error, _, File, {bad_scope_enum_case, ScopedId}}) -> - display(File, ic_forms:get_line(ScopedId), - "scoped enum identifiers not allowed as case (~s)", - [pp(ScopedId)]); -format_error({error, _, File, {bad_type, Expr, Op, _TypeList, V}}) -> - display(File, ic_forms:get_line(Expr), - "parameter value ~p to ~s is of illegal type", [V, pp(Op)]); -format_error({error, _, File, {bad_case_type, TK, X, Val}}) -> - display(File, ic_forms:get_line(X), - "case value ~s does not match discriminator type ~s", - [case_pp(X, Val), pp(TK)]); -format_error({error, _, File, {tk_not_found, X}}) -> - display(File, ic_forms:get_line(X), "undeclared identifier ~s", [pp(X)]); -%%% New format_errors -format_error({error, _, File, {bad_fixed, Format, Args, Line}}) -> - display(File, Line, Format, Args); -format_error({error, _, File, {illegal_switch_t, Arg, _N}}) -> - display(File, ic_forms:get_line(Arg), "illegal switch", []); -format_error({error, _, File, {inherit_resolve, Arg, N}}) -> - display(File, ic_forms:get_line(Arg), "cannot resolve ~s", [N]); -format_error({error, _, File, {bad_escape_character, Line, Char}}) -> - display(File, Line, "bad escape character \"~c\"", [Char]); -format_error({error, _, File, {pragma_code_opt_bad_option_list, Line}}) -> - display(File, Line, "bad option list on pragma \"CODEOPT\"", []); -format_error({error, _, File, {bad_string, Line}}) -> - display(File, Line, "bad string", []); -format_error({error, _, File, {create_dir, Path, Reason}}) -> - display(File, not_specified, "couldn't create directory ~p due to ~p", [Path, Reason]); -format_error({error, _, File, {open_file, Path, Reason}}) -> - display(File, not_specified, "couldn't open ~p due to ~p", [Path, Reason]); -format_error({error, _, File, {plain_error_string, ErrString}}) -> - display(File, not_specified, "~s", [ErrString]); -format_error({error, _, File, {plain_error_string, T, ErrString}}) -> - display(File, ic_forms:get_line(T), "~s", [ErrString]); -format_error({error, _, File, {ErrString, Line}}) -> - display(File, Line, ErrString, []). - - -%% Warnings -print_warn(G, Warn) -> - case {ic_options:get_opt(G, silent), ic_options:get_opt(G, silent2)} of - {true, _} -> ok; - {_, true} -> ok; - _ -> format_warn(Warn) - end. - -format_warn({warn, _, File, {ic_pp_warning, Lines}}) -> - display(File, "preprocessor warning: ~s", [Lines]); -format_warn({warn, _, _File, {cfg_open, _Reason, File}}) -> - display(File, "warning: could not open file: ~p", [File]); -format_warn({warn, _, _File, {cfg_read, File}}) -> - display(File, "warning: syntax error in configuration file", []); -format_warn({warn, _, File, {multi_modules, Id}}) -> - display(File, ic_forms:get_line(Id), "warning: multiple modules in file", []); -format_warn({warn, _, File, {illegal_opt, Opt}}) -> - display(File, "warning: unrecognised option: ~p", [Opt]); -format_warn({warn, _, File, {nested_mod, Id}}) -> - display(File, ic_forms:get_line(Id), "warning: nested module: ~s", [ic_forms:get_id(Id)]); -format_warn({warn, _, File, {inherit_name_shadow, {Orig, Item}, - {Base, NewItem}}}) -> - display(File, ic_forms:get_line(Item), - "warning: ~s shadows ~s", [pp([ic_forms:get_id2(Item) | Orig]), - pp([ic_forms:get_id2(NewItem) | Base])]); -format_warn({warn, _, File, {internal_307, X, Y}}) -> - %% If global Scope variable is not [] at top level constant - display(File, ic_forms:get_line(X), "warning: internal 307: ~p ~p", [X, Y]); -format_warn({warn, _, File, {WarnString, Line}}) -> - display(File, Line, WarnString, []). - -%% Display an error or warning -display(File, not_specified, F, A) -> - io:format("~p : ~s~n", [File, io_lib:format(F, A)]); -display(File, Line, F, A) -> - io:format("~p on line ~p: ~s~n", [File, Line, io_lib:format(F, A)]). -display(File, F, A) -> - io:format("~p: ~s~n", [File, io_lib:format(F, A)]). - - - -%%format_warn2(G, WarnStr) -> -%% case {ic_options:get_opt(G, silent), ic_options:get_opt(G, silent2), -%% ic_options:get_opt(G, nowarn)} of -%% {false, false, false} -> -%% io:format("~p: warning: ~s~n", [ic_genobj:idlfile(G), WarnStr]); -%% _ -> ok -%% end. - -%%format_warn2(G, Line, WarnStr) -> -%% case {ic_options:get_opt(G, silent), ic_options:get_opt(G, silent2), -%% ic_options:get_opt(G, nowarn)} of -%% {false, false, false} -> -%% io:format("~p on line ~p: warning: ~s~n", -%% [ic_genobj:idlfile(G), Line, WarnStr]); -%% _ -> ok -%% end. - - - - -%% pretty print various stuff - -pp({tk_string, _}) -> "string"; -pp({tk_wstring, _}) -> "wstring"; -pp(tk_long) -> "long"; -pp(tk_short) -> "short"; -pp(tk_ushort) -> "unsigned short"; -pp(tk_ulong) -> "unsigned long"; -pp(tk_float) -> "float"; -pp(tk_double) -> "double"; -pp(tk_boolean) -> "boolean"; -pp(tk_char) -> "char"; -pp(tk_wchar) -> "wchar"; -pp(tk_octet) -> "octet"; -pp(tk_null) -> "null"; -pp(tk_void) -> "void"; -pp(tk_any) -> "any"; -pp({tk_fixed, _, _}) -> "fixed"; -pp({tk_objref, _, _}) -> "object reference"; -pp(rshift) -> ">>"; -pp(lshift) -> "<<"; -pp(X) when element(1, X) == tk_enum -> "enum"; -pp(X) when is_record(X, scoped_id) -> ic_util:to_colon(X); -pp(X) when element(1, X) == '' -> ic_forms:get_id(X); -pp(X) when is_list(X) andalso is_list(hd(X)) -> ic_util:to_colon(X); -pp({_, Num, Beef}) when is_integer(Num) -> Beef; -pp({Beef, Num}) when is_integer(Num) -> ic_util:to_list(Beef); -pp(X) -> ic_util:to_list(X). - -%% special treatment of case label names -case_pp(X, _Val) when is_record(X, scoped_id) -> pp(X); -case_pp(_X, Val) -> pp(Val). - - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- diff --git a/lib/ic/src/ic_fetch.erl b/lib/ic/src/ic_fetch.erl deleted file mode 100644 index 59f21711ec..0000000000 --- a/lib/ic/src/ic_fetch.erl +++ /dev/null @@ -1,389 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(ic_fetch). - --include("icforms.hrl"). - --export([member2type/3]). - --export([fetchTk/3, isArray/3, isBasicType/1, isBasicType/2, - isBasicType/3, isBasicTypeOrEterm/3, isEterm/3, isString/3, - isStruct/3, isUnion/3, name2type/2, searchIncludedTk/2, - searchInsideTks/2, searchTk/2, searchTk/3]). - -name2type(G, Name) -> - S = ic_genobj:tktab(G), - ScopedName = lists:reverse(string:tokens(Name,"_")), - InfoList = ets:lookup( S, ScopedName ), - filter( InfoList ). - - - -%% This is en overloaded function, -%% differs in input on unions -member2type(_G, X, I) when is_record(X, union)-> - Name = ic_forms:get_id2(I), - case lists:keysearch(Name,2,element(6,X#union.tk)) of - false -> - error; - {value,Rec} -> - fetchType(element(3,Rec)) - end; -member2type( G, SName, MName ) -> - - S = ic_genobj:tktab( G ), - SNList = lists:reverse(string:tokens(SName,"_")), - ScopedName = [MName | SNList], - InfoList = ets:lookup( S, ScopedName ), - - case filter( InfoList ) of - error -> - %% Try a little harder, seeking inside tktab - case lookup_member_type_in_tktab(S, ScopedName, MName) of - error -> - %% Check if this is the "return to return1" case - case MName of - "return1" -> - %% Do it all over again ! - ScopedName2 = ["return" | SNList], - InfoList2 = ets:lookup( S, ScopedName2 ), - case filter( InfoList2 ) of - error -> - %% Last resort: seek in pragma table - lookup_type_in_pragmatab(G, SName); - - Other -> - Other - end; - _ -> - %% Last resort: seek in pragma table - lookup_type_in_pragmatab(G, SName) - end; - Other -> - Other - end; - Other -> - Other - end. - - -lookup_member_type_in_tktab(S, ScopedName, MName) -> - case ets:match_object(S, {'_',member,{MName,'_'},nil}) of - [] -> - error; - [{_FullScopedName,member,{MName,TKInfo},nil}]-> - fetchType( TKInfo ); - List -> - lookup_member_type_in_tktab(List,ScopedName) - end. - -lookup_member_type_in_tktab([],_ScopedName) -> - error; -lookup_member_type_in_tktab([{FullScopedName,_,{_,TKInfo},_}|Rest],ScopedName) -> - case lists:reverse(string:tokens(ic_util:to_undersc(FullScopedName),"_")) of - ScopedName -> - fetchType(TKInfo); - _ -> - lookup_member_type_in_tktab(Rest,ScopedName) - end. - - -lookup_type_in_pragmatab(G, SName) -> - S = ic_genobj:pragmatab(G), - - %% Look locally first - case ets:match(S,{file_data_local,'_','_','$2','_','_',SName,'_','_'}) of - [] -> - %% No match, seek included - case ets:match(S,{file_data_included,'_','_','$2','_','_',SName,'_','_'}) of - - [] -> - error; - [[Type]] -> - io:format("1 Found(~p) : ~p~n",[SName,Type]), - Type - end; - - [[Type]] -> - io:format("2 Found(~p) : ~p~n",[SName,Type]), - Type - end. - - - - -filter( [] ) -> - error; -filter( [I | Is ] ) -> - case I of - { _, member, { _, TKINFO }, _ } -> - fetchType( TKINFO ); - - { _, struct, _, _ } -> - struct; - - { _, typedef, TKINFO, _ } -> - fetchType( TKINFO ); - - { _, module, _, _ } -> - module; - - { _, interface, _, _ } -> - interface; - - { _, op, _, _ } -> - op; - - { _,enum, _, _ } -> - enum; - - { _, spellcheck } -> - filter( Is ); - - _ -> - error - end. - - -fetchType( { tk_sequence, _, _ } ) -> - sequence; -fetchType( { tk_array, _, _ } ) -> - array; -fetchType( { tk_struct, _, _, _} ) -> - struct; -fetchType( { tk_string, _} ) -> - string; -fetchType( tk_short ) -> - short; -fetchType( tk_long ) -> - long; -fetchType( tk_ushort ) -> - ushort; -fetchType( tk_ulong ) -> - ulong; -fetchType( tk_float ) -> - float; -fetchType( tk_double ) -> - double; -fetchType( tk_boolean ) -> - boolean; -fetchType( tk_char ) -> - char; -fetchType( tk_octet ) -> - octet; -fetchType( { tk_enum, _, _, _ } ) -> - enum; -fetchType( { tk_union, _, _, _, _, _ } ) -> - union; -fetchType( tk_any ) -> - any; -fetchType( _ ) -> - error. - -isBasicTypeOrEterm(G, N, S) -> - case isBasicType(G, N, S) of - true -> - true; - false -> - isEterm(G, N, S) - end. - - -isEterm(G, N, S) when element(1, S) == scoped_id -> - {FullScopedName, _, _TK, _} = ic_symtab:get_full_scoped_name(G, N, S), - case ic_code:get_basetype(G, ic_util:to_undersc(FullScopedName)) of - "erlang_term" -> - true; - "ETERM*" -> - true; - _X -> - false - end; -isEterm(_G, _Ni, _X) -> - false. - -isBasicType(G, N, S) when element(1, S) == scoped_id -> - {_, _, TK, _} = ic_symtab:get_full_scoped_name(G, N, S), - isBasicType(fetchType(TK)); -isBasicType(_G, _N, {string, _} ) -> - false; -isBasicType(_G, _N, {Type, _} ) -> - isBasicType(Type). - - -isBasicType(G, Name) -> - isBasicType(name2type(G, Name )). - - -isBasicType(Type) -> - lists:member(Type, - [tk_short,short, - tk_long,long, - tk_ushort,ushort, - tk_ulong,ulong, - tk_float,float, - tk_double,double, - tk_boolean,boolean, - tk_char,char, - tk_octet,octet]). - - - -isString(G, N, T) when element(1, T) == scoped_id -> - case ic_symtab:get_full_scoped_name(G, N, T) of - {_FullScopedName, _, {'tk_string',_}, _} -> - true; - _ -> - false - end; -isString(_G, _N, T) when is_record(T, string) -> - true; -isString(_G, _N, _Other) -> - false. - - -isArray(G, N, T) when element(1, T) == scoped_id -> - case ic_symtab:get_full_scoped_name(G, N, T) of - {_FullScopedName, _, {'tk_array', _, _}, _} -> - true; - _ -> - false - end; -isArray(_G, _N, T) when is_record(T, array) -> - true; -isArray(_G, _N, _Other) -> - false. - - - -isStruct(G, N, T) when element(1, T) == scoped_id -> - case ic_symtab:get_full_scoped_name(G, N, T) of - {_FullScopedName, _, {'tk_struct', _, _, _}, _} -> - true; - _ -> - false - end; -isStruct(_G, _N, T) when is_record(T, struct) -> - true; -isStruct(_G, _N, _Other) -> - false. - - - -isUnion(G, N, T) when element(1, T) == scoped_id -> - case ic_symtab:get_full_scoped_name(G, N, T) of - {_FullScopedName, _, {'tk_union', _, _, _,_,_}, _} -> - true; - _Other -> - false - end; -isUnion(_G, _N, T) when is_record(T, union) -> - true; -isUnion(_G, _N, _Other) -> - false. - - - -%%------------------------------------------------------------ -%% -%% Always fetchs TK of a record. -%% -%%------------------------------------------------------------ -fetchTk(G,N,X) -> - case ic_forms:get_tk(X) of - undefined -> - searchTk(G,ictk:get_IR_ID(G, N, X)); - TK -> - TK - end. - - -%%------------------------------------------------------------ -%% -%% seek type code when not accessible by get_tk/1 -%% -%%------------------------------------------------------------ -searchTk(G,IR_ID) -> - S = ic_genobj:tktab(G), - case catch searchTk(S,IR_ID,typedef) of - {value,TK} -> - TK; - _ -> %% false / exit - case catch searchTk(S,IR_ID,struct) of - {value,TK} -> - TK; - _ -> %% false / exit - case catch searchTk(S,IR_ID,union) of - {value,TK} -> - TK; - _ -> - undefined - end - end - end. - - -searchTk(S,IR_ID,Type) -> - L = lists:flatten(ets:match(S,{'_',Type,'$1','_'})), - case lists:keysearch(IR_ID,2,L) of - {value,TK} -> - {value,TK}; - false -> - searchInsideTks(L,IR_ID) - end. - - -searchInsideTks([],_IR_ID) -> - false; -searchInsideTks([{tk_array,TK,_}|Xs],IR_ID) -> - case searchIncludedTk(TK,IR_ID) of - {value,TK} -> - {value,TK}; - false -> - searchInsideTks(Xs,IR_ID) - end. - - -searchIncludedTk({tk_array,TK,_},IR_ID) -> - searchIncludedTk(TK,IR_ID); -searchIncludedTk({tk_sequence,TK,_},IR_ID) -> - searchIncludedTk(TK,IR_ID); -searchIncludedTk(TK,_IR_ID) when is_atom(TK) -> - false; -searchIncludedTk(TK,IR_ID) -> - case element(2,TK) == IR_ID of - true -> - {value,TK}; - false -> - false - end. - - - - - - - - - - - diff --git a/lib/ic/src/ic_file.erl b/lib/ic/src/ic_file.erl deleted file mode 100644 index 688a777400..0000000000 --- a/lib/ic/src/ic_file.erl +++ /dev/null @@ -1,448 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(ic_file). - --include_lib("ic/src/ic.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([filename_push/4, filename_pop/2, open/2, close/1, remove_ext/1, join/2, - add_dot_erl/1, add_dot_hrl/1, add_dot_c/1, add_dot_h/1, add_dot_java/1, - add_dot_idl/1, javaInterfaceFilePush/3, javaInterfaceFilePop/1, - createDirectory/2, createJavaDirectory/2, open_java_file/3]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- - -%%----------------------------------------------------------------- -%% Func: filename_push -%% -%% Pushes a file name, can also push ignore in which case means that -%% no files should ever be opened at this scope. Note that empty in -%% the file descriptor entries means that the file just isn't open -%% yet. -%%----------------------------------------------------------------- -filename_push(G, _N, ignore, _) -> - G#genobj{stubfile=[ignore | G#genobj.stubfile], - stubfiled=[ignore | G#genobj.stubfiled], - skelfile=[ignore | G#genobj.skelfile], - skelfiled=[ignore | G#genobj.skelfiled], - includefile=[ignore | G#genobj.includefile], - includefiled=[ignore | G#genobj.includefiled]}; - -filename_push(G, N, X, Lang) -> - Fullname = [ic_forms:get_id2(X) | N], - EName0 = ic_util:to_undersc(Fullname), - - DoGen = ic_genobj:do_gen(G), - - ImplName = find_impl_name(G, Fullname), - - {StubName, EName} = - case Lang of - erlang -> - {join(ic_options:get_opt(G, stubdir), add_dot_erl(EName0)), - EName0}; - erlang_template -> - {join(ic_options:get_opt(G, stubdir), add_dot_erl(ImplName)), - ImplName}; - c -> - {join(ic_options:get_opt(G, stubdir), add_dot_c(EName0)), - EName0}; - c_server -> - {join(ic_options:get_opt(G, stubdir), add_dot_c(EName0++"__s")), - EName0}; - erlang_template_no_gen -> - {undefined, EName0}; - erlang_no_stub -> - {undefined, EName0}; - c_no_stub -> - {undefined, EName0}; - c_server_no_stub -> - {undefined, EName0} - end, - Stub = if DoGen==true -> - case StubName of - undefined -> - ignore; - _ -> - ic_codegen:emit_stub_head(G, open(empty, StubName), EName, Lang) - end; - true -> ignore end, - - HrlName = case Lang of - erlang_template -> - ignore; - erlang_template_no_gen -> - ignore; - erlang -> - ?ifopt2(G, gen_hrl, - join(ic_options:get_opt(G, stubdir), add_dot_hrl(EName)), - ignore); - c -> - ?ifopt2(G, gen_hrl, - join(ic_options:get_opt(G, stubdir), add_dot_h(EName)), - ignore); - c_server -> - ?ifopt2(G, gen_hrl, - join(ic_options:get_opt(G, stubdir), - add_dot_h(EName++"__s")), - ignore); - erlang_no_stub -> - ?ifopt2(G, gen_hrl, - join(ic_options:get_opt(G, stubdir), add_dot_hrl(EName)), - ignore); - c_no_stub -> - ?ifopt2(G, gen_hrl, - join(ic_options:get_opt(G, stubdir), add_dot_h(EName)), - ignore); - c_server_no_stub -> - ?ifopt2(G, gen_hrl, - join(ic_options:get_opt(G, stubdir), - add_dot_h(EName++"__s")), - ignore) - end, - Hrl = if DoGen==true -> - case Lang of - erlang_template -> - ignore; - erlang_template_no_gen -> - ignore; - erlang_no_stub -> - ic_codegen:emit_hrl_head(G, open(empty, HrlName), - EName, erlang); - c_no_stub -> - ic_codegen:emit_hrl_head(G, open(empty, HrlName), - EName, c); - c_server_no_stub -> - ic_codegen:emit_hrl_head(G, open(empty, HrlName), - EName, c_server); - _ -> - ic_codegen:emit_hrl_head(G, open(empty, HrlName), - EName, Lang) - end; - true -> ignore end, - - G#genobj{impl=ImplName, - stubfile=[StubName | G#genobj.stubfile], - stubfiled=[Stub | G#genobj.stubfiled], - includefile=[HrlName | G#genobj.includefile], - includefiled=[Hrl | G#genobj.includefiled]}. - -%%----------------------------------------------------------------- -%% Func: join/2 -%% -%% Special version of filename join. -%%----------------------------------------------------------------- -join([], File) -> - File; -join(Path, File) -> - filename:join(Path, File). - - -%%----------------------------------------------------------------- -%% Func: filename_pop/2 -%%----------------------------------------------------------------- -filename_pop(G, Lang) -> -%% io:format("Popped file names: ~p~n", [hd(G#genobj.stubfile)]), -%% case is_skelfile_open(G) of -%% true -> emit_skel_footer(G); -%% false -> ok end, -%% close(hd(G#genobj.skelfiled)), - close(hd(G#genobj.stubfiled)), - ic_codegen:emit_hrl_foot(G, Lang), - close(hd(G#genobj.includefiled)), - G#genobj{stubfile=tl(G#genobj.stubfile), - stubfiled=tl(G#genobj.stubfiled), -%% skelfile=tl(G#genobj.skelfile), -%% skelfiled=tl(G#genobj.skelfiled), - includefile=tl(G#genobj.includefile), - includefiled=tl(G#genobj.includefiled)}. - - - -%%----------------------------------------------------------------- -%% Func: javaInterfaceFilePush/3 -%%----------------------------------------------------------------- -javaInterfaceFilePush(G, N, X) -> - Name = ic_forms:get_java_id(X), - {InterfaceFd, InterfaceFileName} = open_java_file(G, N, Name), - - StubClassName = "_" ++ Name ++ "Stub", - {StubFd, StubFileName} = open_java_file(G, N, StubClassName), - - SkelClassName = "_" ++ Name ++ "ImplBase", - {SkelFd, SkelFileName} = open_java_file(G, N, SkelClassName), - - HelperClassName = Name ++ "Helper", - {HelperFd, HelperFileName} = open_java_file(G, N, HelperClassName), - - HolderClassName = Name ++ "Holder", - {HolderFd, HolderFileName} = open_java_file(G, N, HolderClassName), - - G#genobj{ - interfacefile=[InterfaceFileName | G#genobj.interfacefile], - interfacefiled=[InterfaceFd | G#genobj.interfacefiled], - stubfile=[StubFileName | G#genobj.stubfile], - stubfiled=[StubFd | G#genobj.stubfiled], - skelfile=[SkelFileName | G#genobj.skelfile], - skelfiled=[SkelFd | G#genobj.skelfiled], - helperfile=[HelperFileName | G#genobj.helperfile], - helperfiled=[HelperFd | G#genobj.helperfiled], - holderfile=[HolderFileName | G#genobj.holderfile], - holderfiled=[HolderFd | G#genobj.holderfiled]}. - - - - - -%%----------------------------------------------------------------- -%% Func: javaInterfaceFilePop/1 -%%----------------------------------------------------------------- -javaInterfaceFilePop(G) -> - close(hd(G#genobj.interfacefiled)), - close(hd(G#genobj.stubfiled)), - close(hd(G#genobj.skelfiled)), - close(hd(G#genobj.helperfiled)), - close(hd(G#genobj.holderfiled)), - G#genobj{ - interfacefile=tl(G#genobj.interfacefile), - interfacefiled=tl(G#genobj.interfacefiled), - stubfile=tl(G#genobj.stubfile), - stubfiled=tl(G#genobj.stubfiled), - skelfile=tl(G#genobj.skelfile), - skelfiled=tl(G#genobj.skelfiled), - helperfile=tl(G#genobj.helperfile), - helperfiled=tl(G#genobj.helperfiled), - holderfile=tl(G#genobj.holderfile), - holderfiled=tl(G#genobj.holderfiled)}. - -%%----------------------------------------------------------------- -%% Func: createDirectory/2 -%%----------------------------------------------------------------- -createDirectory(_G, []) -> - ok; -createDirectory(G, Scope) -> - Path = ic_file:join(ic_options:get_opt(G, stubdir), ic_pragma:slashify(Scope)), - case file:make_dir(Path) of - ok -> - ok; - {error, eexist} -> - ok; - {error, Reason} -> - ic_error:fatal_error(G, {create_dir, Path, Reason}) - end. - - -%%----------------------------------------------------------------- -%% Func: createJavaDirectory/2 -%%----------------------------------------------------------------- -createJavaDirectory(_G, []) -> - ok; -createJavaDirectory(G, Scope) -> - JavaScope = ic_util:adjustScopeToJava(G,Scope), - Path = ic_file:join(ic_options:get_opt(G, stubdir), ic_pragma:slashify(JavaScope)), - case file:make_dir(Path) of - ok -> - ok; - {error, eexist} -> - ok; - {error, Reason} -> - ic_error:fatal_error(G, {create_dir, Path, Reason}) - end. - - - - -%%----------------------------------------------------------------- -%% Func: createJavaFileName/3 -%%----------------------------------------------------------------- -createJavaFileName(G, Scope, FName) -> - JavaScope = ic_util:adjustScopeToJava(G,Scope), - join(ic_options:get_opt(G, stubdir), - ic_pragma:slashify([FName++".java"|JavaScope])). - -%%----------------------------------------------------------------- -%% Func: close/2 (used to be file_close) -%%----------------------------------------------------------------- -close(empty) -> ok; -close(ignore) -> ok; -close(Fd) -> - file:close(Fd). - -%%----------------------------------------------------------------- -%% Func: remove_ext/1 -%%----------------------------------------------------------------- -remove_ext(File) -> - filename:rootname(filename:basename(File)). - -%%----------------------------------------------------------------- -%% Func: open/2 (used to be file_open) -%%----------------------------------------------------------------- -open(_, ignore) -> ignore; -open(empty, Name) -> - case file:open(Name, [raw, binary, write]) of - {ok, Fd} -> - Fd; - {error, Reason} -> - exit({error, Reason}) -%% ic_error:fatal_error(G, {open_file, Name, Reason}) - end. - -%%----------------------------------------------------------------- -%% Func: open_java_file/3 -%%----------------------------------------------------------------- -open_java_file(G, N, Name) -> - createJavaDirectory(G, N), - FName = createJavaFileName(G, N, Name), - case file:open(FName, [raw, binary, write]) of - {ok, Fd} -> - ic_codegen:emit_stub_head(G, Fd, Name, java), - emit_package(G, N, Fd), - {Fd, FName}; - {error, Reason} -> - ic_error:fatal_error(G, {open_file, FName, Reason}) - end. - -%%----------------------------------------------------------------- -%% Func: emit_package/3 -%%----------------------------------------------------------------- -emit_package(_G, [], _Fd) -> - ok; -emit_package(G, N, Fd) -> - ic_codegen:emit(Fd, "package ~s;\n", [ic_util:to_dot(G,N)]), - ic_codegen:nl(Fd). - -%%----------------------------------------------------------------- -%% Func: add_dot_erl/1 -%%----------------------------------------------------------------- -add_dot_erl(F) -> - File = ic_util:to_list(F), - F2 = lists:reverse(File), - case F2 of - [$l, $r, $e, $. | _Rest] -> - File; - _ -> - File ++ ".erl" - end. - -%%----------------------------------------------------------------- -%% Func: add_dot_hrl/1 -%%----------------------------------------------------------------- -add_dot_hrl(F) -> - File = ic_util:to_list(F), - F2 = lists:reverse(File), - case F2 of - [$l, $r, $h, $. | _Rest] -> - File; - _ -> - File ++ ".hrl" - end. - -%%----------------------------------------------------------------- -%% Func: add_dot_c/1 -%%----------------------------------------------------------------- -add_dot_c(F) -> - File = ic_util:to_list(F), - F2 = lists:reverse(File), - case F2 of - [$c, $. | _Rest] -> - File; - _ -> - File ++ ".c" - end. - -%%----------------------------------------------------------------- -%% Func: add_dot_h/1 -%%----------------------------------------------------------------- -add_dot_h(F) -> - File = ic_util:to_list(F), - F2 = lists:reverse(File), - case F2 of - [$h, $. | _Rest] -> - File; - _ -> - File ++ ".h" - end. - -%%----------------------------------------------------------------- -%% Func: add_dot_java/1 -%%----------------------------------------------------------------- -add_dot_java(F) -> - File = ic_util:to_list(F), - F2 = lists:reverse(File), - case F2 of - [$a, $v, $a, $j, $. | _Rest] -> - File; - _ -> - File ++ ".java" - end. - -%%----------------------------------------------------------------- -%% Func: add_dot_idl/1 -%%----------------------------------------------------------------- -add_dot_idl(F) -> - File = ic_util:to_list(F), - F2 = lists:reverse(File), - case F2 of - [$l, $d, $i, $. | _Rest] -> - File; - _ -> - File ++ ".idl" - end. - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- - -%%-------------------------------------------------------------------- -%% -%% File handling stuff -%% -%% -%% Shall open a file for writing. Also sets up the generator with -%% usefull bits of information -%% -%%-------------------------------------------------------------------- -find_impl_name(G, Name) -> - N1 = ic_util:to_colon(Name), - N2 = ic_util:to_undersc(Name), - case {ic_options:get_opt(G, {impl, N1}), - ic_options:get_opt(G, {impl, N2})} of - {false, false} -> - case {ic_options:get_opt(G, {impl, "::"++N1}), - ic_options:get_opt(G, {impl, N2})} of - {false, false} -> N2 ++ "_impl"; - {X, _Y} when X /= false -> ic_util:to_list(X); - {_X, Y} when Y /= false -> ic_util:to_list(Y) - end; - {X, _Y} when X /= false -> ic_util:to_list(X); - {_X, Y} when Y /= false -> ic_util:to_list(Y) - end. diff --git a/lib/ic/src/ic_forms.erl b/lib/ic/src/ic_forms.erl deleted file mode 100644 index ed4b3e9a22..0000000000 --- a/lib/ic/src/ic_forms.erl +++ /dev/null @@ -1,442 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(ic_forms). - --include_lib("ic/src/ic.hrl"). --include_lib("ic/src/icforms.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([get_id/1, get_id2/1, get_java_id/1, get_line/1]). --export([get_type_code/3, search_tk/2, clean_up_scope/1]). --export([get_body/1, get_dimension/1, get_idlist/1, get_type/1, get_tk/1, is_oneway/1]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- - -%%-------------------------------------------------------------------- -%% -%% Generation go-get utilities -%% -%% Feeble attempt at virtual funtions. -%% -%%-------------------------------------------------------------------- - -get_dimension(X) when is_record(X, array) -> - [element(3, L) || L <- X#array.size]. - -%% Should find the name hidden in constructs -get_id( [{'', _LineNo, Id}] ) -> Id; -get_id( {'', _LineNo, Id} ) -> Id; -get_id(Id) when is_list(Id) andalso is_integer(hd(Id)) -> Id; -get_id(X) when is_record(X, scoped_id) -> X#scoped_id.id; -get_id(X) when is_record(X, array) -> get_id(X#array.id); -get_id( {'', _LineNo, Id} ) -> Id; -get_id( {'', _LineNo, Id} ) -> Id. - -get_line([{'', LineNo, _Id}]) -> LineNo; -get_line({'', LineNo, _Id}) -> LineNo; -get_line(X) when is_record(X, scoped_id) -> X#scoped_id.line; -get_line(X) when is_record(X, module) -> get_line(X#module.id); -get_line(X) when is_record(X, interface) -> get_line(X#interface.id); -get_line(X) when is_record(X, forward) -> get_line(X#forward.id); -get_line(X) when is_record(X, constr_forward) -> get_line(X#constr_forward.id); -get_line(X) when is_record(X, const) -> get_line(X#const.id); -get_line(X) when is_record(X, typedef) -> get_line(X#typedef.id); -get_line(X) when is_record(X, struct) -> get_line(X#struct.id); -get_line(X) when is_record(X, member) -> get_line(X#member.id); -get_line(X) when is_record(X, union) -> get_line(X#union.id); -get_line(X) when is_record(X, case_dcl) -> get_line(X#case_dcl.id); -get_line(X) when is_record(X, enum) -> get_line(X#enum.id); -get_line(X) when is_record(X, enumerator) -> get_line(X#enumerator.id); -get_line(X) when is_record(X, array) -> get_line(X#array.id); -get_line(X) when is_record(X, attr) -> get_line(X#attr.id); -get_line(X) when is_record(X, except) -> get_line(X#except.id); -get_line(X) when is_record(X, op) -> get_line(X#op.id); -get_line(X) when is_record(X, param) -> get_line(X#param.id); -get_line(X) when is_record(X, id_of) -> get_line(X#id_of.id); - -get_line({'or', T1, _T2}) -> get_line(T1); -get_line({'xor', T1, _T2}) -> get_line(T1); -get_line({'and', T1, _T2}) -> get_line(T1); -get_line({'rshift', T1, _T2}) ->get_line(T1); -get_line({'lshift', T1, _T2}) ->get_line(T1); -get_line({'+', T1, _T2}) -> get_line(T1); -get_line({'-', T1, _T2}) -> get_line(T1); -get_line({'*', T1, _T2}) -> get_line(T1); -get_line({'/', T1, _T2}) -> get_line(T1); -get_line({'%', T1, _T2}) -> get_line(T1); -get_line({{'-', _Line}, T}) -> get_line(T); -get_line({{'+', _Line}, T}) -> get_line(T); -get_line({{'~', _Line}, T}) -> get_line(T); -get_line({_, X, _}) when is_integer(X) -> X; -get_line({_A, N}) when is_integer(N) -> N; -get_line(_) -> -1. - - -%%-------------------------------------------------------------------- -%% -%% High level get functions. -%% -%% These are highly polymorphic functions that will get the id, -%% body and type of a record (those records output from the -%% parser). -%% -%% NOTE: The typedef node (the alias) is special, because the type -%% field is a type definition and therefore considered a body, -%% and the type of a typedef is its name. -%% - -get_id2(X) when is_record(X, module) -> get_id(X#module.id); -get_id2(X) when is_record(X, interface) -> get_id(X#interface.id); -get_id2(X) when is_record(X, forward) -> get_id(X#forward.id); -get_id2(X) when is_record(X, constr_forward) -> get_id(X#constr_forward.id); -get_id2(X) when is_record(X, const) -> get_id(X#const.id); -get_id2(X) when is_record(X, typedef) -> get_id(hd(X#typedef.id)); -get_id2(X) when is_record(X, struct) -> get_id(X#struct.id); -get_id2(X) when is_record(X, member) -> get_id(hd(X#member.id)); -get_id2(X) when is_record(X, union) -> get_id(X#union.id); -get_id2(X) when is_record(X, case_dcl) -> get_id(X#case_dcl.id); -get_id2(X) when is_record(X, enum) -> get_id(X#enum.id); -get_id2(X) when is_record(X, enumerator) -> get_id(X#enumerator.id); -get_id2(X) when is_record(X, array) -> get_id(X#array.id); -get_id2(X) when is_record(X, attr) -> get_id(X#attr.id); -get_id2(X) when is_record(X, except) -> get_id(X#except.id); -get_id2(X) when is_record(X, op) -> get_id(X#op.id); -get_id2(X) when is_record(X, param) -> get_id(X#param.id); -get_id2(X) when is_record(X, type_dcl) -> get_id2(X#type_dcl.type); -get_id2(X) when is_record(X, scoped_id) -> ic_symtab:scoped_id_strip(X); -get_id2(X) when is_record(X, preproc) -> get_id(X#preproc.id); -get_id2(X) when is_record(X, id_of) -> get_id2(X#id_of.id); -get_id2(X) -> get_id(X). - -get_body(X) when is_record(X, module) -> X#module.body; -get_body(X) when is_record(X, interface) -> X#interface.body; -get_body(X) when is_record(X, struct) -> X#struct.body; -get_body(X) when is_record(X, union) -> X#union.body; -get_body(X) when is_record(X, enum) -> X#enum.body; -get_body(X) when is_record(X, typedef) -> X#typedef.type; % See Note -get_body(X) when is_record(X, except) -> X#except.body. - -get_type(X) when is_record(X, const) -> X#const.type; -get_type(X) when is_record(X, type_dcl) -> X#type_dcl.type; -get_type(X) when is_record(X, typedef) -> X#typedef.id; % See Note -get_type(X) when is_record(X, member) -> X#member.type; -get_type(X) when is_record(X, union) -> X#union.type; -get_type(X) when is_record(X, case_dcl) -> X#case_dcl.type; -get_type(X) when is_record(X, sequence) -> X#sequence.type; -get_type(X) when is_record(X, attr) -> X#attr.type; -get_type(X) when is_record(X, op) -> X#op.type; -get_type(X) when is_record(X, param) -> X#param.type. -%%get_type(X) when record(X, id_of) -> get_type(X#id_of.type). - -%% Temporary place -get_tk(X) when is_record(X, interface) -> X#interface.tk; -get_tk(X) when is_record(X, forward) -> X#forward.tk; -get_tk(X) when is_record(X, constr_forward) -> X#constr_forward.tk; -get_tk(X) when is_record(X, const) -> X#const.tk; -get_tk(X) when is_record(X, type_dcl) -> X#type_dcl.tk; -get_tk(X) when is_record(X, typedef) -> X#typedef.tk; -get_tk(X) when is_record(X, struct) -> X#struct.tk; -get_tk(X) when is_record(X, union) -> X#union.tk; -get_tk(X) when is_record(X, enum) -> X#enum.tk; -get_tk(X) when is_record(X, attr) -> X#attr.tk; -get_tk(X) when is_record(X, except) -> X#except.tk; -get_tk(X) when is_record(X, op) -> X#op.tk; -get_tk(X) when is_record(X, id_of) -> X#id_of.tk; -get_tk(X) when is_record(X, param) -> X#param.tk. - - -%% Get idlist returns the list of identifiers found in typedefs, case -%% dcls etc. -get_idlist(X) when is_record(X, typedef) -> X#typedef.id; -get_idlist(X) when is_record(X, member) -> X#member.id; -get_idlist(X) when is_record(X, case_dcl) -> X#case_dcl.label; -get_idlist(X) when is_record(X, attr) -> X#attr.id. - - -is_oneway(X) when is_record(X, op) -> - case X#op.oneway of - {oneway, _} -> true; - _ -> false - end; -is_oneway(_X) -> false. - - - - - -%%------------------------------------------------------------ -%% -%% Analyze the record and seek the correct type code. -%% -%% NOT equal to get_tk, this will always succed ! -%% -%%------------------------------------------------------------ -get_type_code(G, N, X) -> - case get_type_code2(G, N, X) of - undefined -> - %% Remove "Package" suffix from scope - N2 = clean_up_scope(N), - search_tk(G,ictk:get_IR_ID(G, N2, X)); - TC -> - TC - end. - -clean_up_scope(N) -> - clean_up_scope(N,[]). - -clean_up_scope([],N) -> - lists:reverse(N); -clean_up_scope([N|Ns],Found) -> - case lists:suffix("Package",N) of - true -> - Len = length(N), - case Len > 7 of - true -> - N2 = string:substr(N,1,Len-7), - clean_up_scope(Ns,[N2|Found]); - false -> - clean_up_scope(Ns,[N|Found]) - end; - false -> - clean_up_scope(Ns,[N|Found]) - end. - - -get_type_code2(_, _, X) when is_record(X, interface) -> X#interface.tk; -get_type_code2(_, _, X) when is_record(X, forward) -> X#forward.tk; -get_type_code2(_, _, X) when is_record(X, constr_forward) -> X#constr_forward.tk; -get_type_code2(_, _, X) when is_record(X, const) -> X#const.tk; -get_type_code2(_, _, X) when is_record(X, type_dcl) -> X#type_dcl.tk; -get_type_code2(_, _, X) when is_record(X, typedef) -> - Id = X#typedef.id, - ET = X#typedef.tk, - if is_list(Id) -> - Head = hd(Id), - if is_tuple(Head) -> - case element(1,Head) of - array -> - get_array_tc(ET, element(3,Head)); - _ -> - ET - end; - true -> - ET - end; - true -> - ET - end; - -get_type_code2(_, _, X) when is_record(X, struct) -> X#struct.tk; -get_type_code2(_, _, X) when is_record(X, union) -> X#union.tk; -get_type_code2(_, _, X) when is_record(X, enum) -> X#enum.tk; -get_type_code2(_, _, X) when is_record(X, attr) -> X#attr.tk; -get_type_code2(_, _, X) when is_record(X, except) -> X#except.tk; -get_type_code2(_, _, X) when is_record(X, op) -> X#op.tk; -get_type_code2(_, _, X) when is_record(X, id_of) -> X#id_of.tk; -get_type_code2(_, _, X) when is_record(X, param) -> X#param.tk; - -get_type_code2(G, N, X) when is_record(X, member) -> - ET = get_type_code(G, N, element(2,X)), - Id = element(3,X), - - if is_list(Id) -> - Head = hd(Id), - if is_tuple(Head) -> - case element(1,Head) of - array -> - get_array_tc(ET, element(3,Head)); - _ -> - ET - end; - true -> - ET - end; - true -> - ET - end; - -get_type_code2(G, N, X) when is_record(X, scoped_id) -> - element(3,ic_symtab:get_full_scoped_name(G, N, X)); - -get_type_code2(G, N, X) when is_record(X, sequence) -> - if is_tuple(X#sequence.length) -> - {tk_sequence, - get_type_code(G, N, X#sequence.type), - list_to_integer(element(3,X#sequence.length))}; - true -> - {tk_sequence, - get_type_code(G, N, X#sequence.type), - X#sequence.length} - end; - -get_type_code2(_G, _N, {unsigned,{short,_}}) -> tk_ushort; - -get_type_code2(_G, _N, {unsigned,{long,_}}) -> tk_ulong; - -get_type_code2(_G, _N, {unsigned,{'long long',_}}) -> tk_ulonglong; - -get_type_code2(_G, _N, X) when is_record(X, fixed) -> - {tk_fixed, X#fixed.digits, X#fixed.scale}; - -get_type_code2(G, N, {X,_}) -> - get_type_code2(G, N, X); - -get_type_code2(_, _, short) -> tk_short; -get_type_code2(_, _, long) -> tk_long; -get_type_code2(_, _, 'long long') -> tk_longlong; -get_type_code2(_, _, float) -> tk_float; -get_type_code2(_, _, double) -> tk_double; -get_type_code2(_, _, boolean) -> tk_boolean; -get_type_code2(_, _, char) -> tk_char; -get_type_code2(_, _, wchar) -> tk_wchar; -get_type_code2(_, _, octet) -> tk_octet; -get_type_code2(_, _, string) -> tk_string; -get_type_code2(_, _, wstring) -> tk_wstring; -get_type_code2(_, _, any) -> tk_any. - - -get_array_tc(ET, []) -> - ET; -get_array_tc(ET, [L|Ls]) -> - {tk_array, - get_array_tc(ET,Ls), - list_to_integer(element(3,L))}. - - - - -%%------------------------------------------------------------ -%% -%% seek type code when not accessible by ic_forms:get_tk/1 ( should be -%% a part of "do_gen" related functions later ) -%% -%%------------------------------------------------------------ -search_tk(G, IR_ID) -> - S = ic_genobj:tktab(G), - case catch search_tk(S,IR_ID,typedef) of - {value,TK} -> - TK; - _ -> %% false / exit - case catch search_tk(S,IR_ID,struct) of - {value,TK} -> - TK; - _ -> %% false / exit - case catch search_tk(S,IR_ID,union) of - {value,TK} -> - TK; - _ -> - undefined - end - end - end. - - -search_tk(S, IR_ID, Type) -> - L = lists:flatten(ets:match(S,{'_',Type,'$1','_'})), - case lists:keysearch(IR_ID,2,L) of - {value,TK} -> - {value,TK}; - false -> - search_inside_tks(L,IR_ID) - end. - - -search_inside_tks([],_IR_ID) -> - false; -search_inside_tks([{tk_array,TK,_}|Xs],IR_ID) -> - case search_included_tk(TK,IR_ID) of - {value,TK} -> - {value,TK}; - false -> - search_inside_tks(Xs,IR_ID) - end. - - -search_included_tk({tk_array,TK,_}, IR_ID) -> - search_included_tk(TK,IR_ID); -search_included_tk({tk_sequence,TK,_}, IR_ID) -> - search_included_tk(TK,IR_ID); -search_included_tk(TK, _IR_ID) when is_atom(TK) -> - false; -search_included_tk(TK, IR_ID) -> - case element(2,TK) == IR_ID of - true -> - {value,TK}; - false -> - false - end. - - - - -%% This is similar to get_id2 but in everything else -%% than a module it will generate an id prefixed -get_java_id(Id) when is_list(Id) -> - case java_keyword_coalition(Id) of - true -> - "_" ++ Id; - false -> - Id - end; -get_java_id(Id_atom) when is_atom(Id_atom) -> - Id = atom_to_list(Id_atom), - case java_keyword_coalition(Id) of - true -> - "_" ++ Id; - false -> - Id - end; -get_java_id(X) -> - Id = get_id2(X), - case java_keyword_coalition(Id) of - true -> - "_" ++ Id; - false -> - Id - end. - -java_keyword_coalition(Id) -> - lists:member(list_to_atom(Id), - [abstract, default, 'if', private, throw, boolean, - do, implements, protected, throws, break, - double, import, public, transient, byte, - else, instanceof, return, 'try', 'case', extends, - int, short, void, 'catch', final, interface, static, - volatile, char, finally, long, super, while, class, - float, native, switch, const, for, new, synchronized, - continue, goto, package, this, true, false]). - - - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- diff --git a/lib/ic/src/ic_genobj.erl b/lib/ic/src/ic_genobj.erl deleted file mode 100644 index eb2c24c000..0000000000 --- a/lib/ic/src/ic_genobj.erl +++ /dev/null @@ -1,245 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(ic_genobj). - - --include_lib("ic/src/ic.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([new/1, free_table_space/1, process_space/0]). --export([skelfiled/1, stubfiled/1, hrlfiled/1, includefiled/1]). --export([interfacefiled/1, helperfiled/1, holderfiled/1]). --export([is_skelfile_open/1, is_stubfile_open/1, is_hrlfile_open/1]). --export([include_file/1, include_file_stack/1]). --export([push_file/2, pop_file/2, sys_file/2]). - --export([skelscope/1, stubscope/1, impl/1, do_gen/1]). --export([symtab/1, auxtab/1, tktab/1, pragmatab/1, optiontab/1, typedeftab/1]). --export([idlfile/1, module/1, set_idlfile/2, set_module/2]). - - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- - -%%-------------------------------------------------------------------- -%% -%% Initialisation stuff -%% -%% -%% -%%-------------------------------------------------------------------- - - -new(Opts) -> - OptDB = ets:new(options, [set, public]), - Warns = ets:new(warnings, [set, public]), - Aux = ets:new(aux, [set, public]), - Tk = ets:new(tktab, [set, public]), - PragmaTab = ets:new(pragmatab, [bag, public]), - TypeDefTab = ets:new(c_typedeftab, [set, public]), - G = #genobj{options=OptDB, - warnings=Warns, - symtab=ic_symtab:new(), - auxtab=Aux, - tktab=Tk, - pragmatab=PragmaTab, - c_typedeftab=TypeDefTab}, - ic_error:init_errors(G), - ic_options:add_opt(G, default_opts, true), - ic_options:read_cfg(G, Opts), % Read any config files - ic_options:add_opt(G, Opts, true), - ic_symtab:symtab_add_faked_included_types(G), % Add CORBA:: that as if they - % were defined in an included file - case ic_options:get_opt(G, be) of - false -> - DefBE = ic_options:defaultBe(), - case ic_options:get_opt(G, multiple_be) of - false -> - ic_options:add_opt(G, be, DefBE), - G; - List -> - case lists:member(DefBE, List) of - true -> - %% Delete the default be from the list to avoid - %% generating it twice. - NewList = lists:delete(DefBE, List), - ic_options:add_opt(G, multiple_be, NewList), - ic_options:add_opt(G, be, DefBE), - G; - false -> - G - end - end; - _ -> - G - end. - - -%%-------------------------------------------------------------------- -%% -%% Table removal -%% -%% -%% -%%-------------------------------------------------------------------- - - -free_table_space(G) -> - %% Free ets tables - ets:delete(G#genobj.options), - ets:delete(G#genobj.symtab), - ets:delete(G#genobj.warnings), - ets:delete(G#genobj.auxtab), - ets:delete(G#genobj.tktab), - ets:delete(G#genobj.pragmatab), - ets:delete(G#genobj.c_typedeftab), - %% Close file descriptors - close_fd(G#genobj.skelfiled), - close_fd(G#genobj.stubfiled), - close_fd(G#genobj.interfacefiled), - close_fd(G#genobj.helperfiled), - close_fd(G#genobj.holderfiled), - close_fd(G#genobj.includefiled). - -close_fd([]) -> - ok; -close_fd([Fd|Fds]) -> - file_close(Fd), - close_fd(Fds). - -file_close(empty) -> ok; -file_close(ignore) -> ok; -file_close(Fd) -> - file:close(Fd). - - -%%-------------------------------------------------------------------- -%% -%% Process memory usage -%% -%% -%% -%%-------------------------------------------------------------------- - -process_space() -> - Pheap=4*element(2,element(2,lists:keysearch(heap_size,1,process_info(self())))), - Pstack=4*element(2,element(2,lists:keysearch(stack_size,1,process_info(self())))), - io:format("Process current heap = ~p bytes\n",[Pheap]), - io:format("Symbol current stack = ~p bytes\n",[Pstack]), - io:format("-----------------------------------------------\n"), - io:format("Totally used ~p bytes\n\n",[Pheap+Pstack]). - - - - - - -skelfiled(G) -> hd(G#genobj.skelfiled). -stubfiled(G) -> hd(G#genobj.stubfiled). -includefiled(G) -> hd(G#genobj.includefiled). -hrlfiled(G) -> hd(G#genobj.includefiled). -interfacefiled(G) -> hd(G#genobj.interfacefiled). -helperfiled(G) -> hd(G#genobj.helperfiled). -holderfiled(G) -> hd(G#genobj.holderfiled). - -include_file(G) -> hd(G#genobj.includefile). -include_file_stack(G) -> G#genobj.includefile. - -is_skelfile_open(G) -> - if hd(G#genobj.skelfiled) /= empty, hd(G#genobj.skelfiled) /= ignore - -> true; - true -> false - end. -is_stubfile_open(G) -> - if hd(G#genobj.stubfiled) /= empty, hd(G#genobj.stubfiled) /= ignore - -> true; - true -> false - end. - -is_hrlfile_open(G) -> - if hd(G#genobj.includefiled) /= empty, hd(G#genobj.includefiled) /= ignore - -> true; - true -> false - end. - -%%-------------------------------------------------------------------- -%% -%% Handling of pre processor file commands -%% -%%-------------------------------------------------------------------- - -push_file(G, Id) -> - New = G#genobj.filestack+1, - set_idlfile(G, Id), - G#genobj{filestack=New, do_gen=true_or_not(New)}. -pop_file(G, Id) -> - New = G#genobj.filestack-1, - set_idlfile(G, Id), - G#genobj{filestack=New, do_gen=true_or_not(New)}. -sys_file(G, _Id) -> G#genobj{sysfile=true}. - - -do_gen(G) -> G#genobj.do_gen. - -%%-------------------------------------------------------------------- -%% -%% Storage routines -%%i -%% The generator object G is used to store many usefull bits of -%% information so that the information doesn't need to get passed -%% around everywhere. -%% -%%-------------------------------------------------------------------- - - -skelscope(G) -> G#genobj.skelscope. -stubscope(G) -> G#genobj.stubscope. -symtab(G) -> G#genobj.symtab. -auxtab(G) -> G#genobj.auxtab. -tktab(G) -> G#genobj.tktab. -impl(G) -> G#genobj.impl. -pragmatab(G) -> G#genobj.pragmatab. -optiontab(G) -> G#genobj.options. -typedeftab(G) -> G#genobj.c_typedeftab. - -idlfile(G) -> ?lookup(G#genobj.options, idlfile). -module(G) -> ?lookup(G#genobj.options, module). - -set_idlfile(G, X) -> ?insert(G#genobj.options, idlfile, X). -set_module(G, X) -> ?insert(G#genobj.options, module, ic_forms:get_id(X)). - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- -true_or_not(X) when X < 2 -> - true; -true_or_not(_) -> - false. diff --git a/lib/ic/src/ic_java_type.erl b/lib/ic/src/ic_java_type.erl deleted file mode 100644 index 931aa92a8e..0000000000 --- a/lib/ic/src/ic_java_type.erl +++ /dev/null @@ -1,1214 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(ic_java_type). - - --include("icforms.hrl"). --include("ic.hrl"). --include("ic_debug.hrl"). -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([getType/3, getHolderType/3, - getParamType/4, inlinedTypes/2, - marshalFun/4, unMarshalFun/4, getFullType/4, - getFullType/3, getMarshalType/4, getUnmarshalType/4, - getdim/1]). --export([isBasicType/3, isBasicType/1]). --export([isIntegerType/3, isIntegerType/1]). --export([isTermType/3]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: getType/3 -%%----------------------------------------------------------------- -getType(G, N, T) when is_record(T, scoped_id) -> - {FullScopedName, _, TK, _} = ic_symtab:get_full_scoped_name(G, N, T), - BT = ic_code:get_basetype(G, ic_util:to_dot(G,FullScopedName)), - case BT of - "erlang.pid" -> - ?ICPACKAGE ++ "Pid"; - "erlang.port" -> - ?ICPACKAGE ++ "Port"; - "erlang.ref" -> - ?ICPACKAGE ++ "Ref"; - "erlang.term" -> - ?ICPACKAGE ++ "Term"; - {enum, Type} -> - getType(G, N, Type); - Type -> - case TK of - {tk_array,_,_} -> - tk2type(G,N,T,TK); - {tk_sequence,_,_} -> - tk2type(G,N,T,TK); - tk_any -> - ?ICPACKAGE ++ "Any"; - _ -> - case isBasicType(G,N,TK) of - true -> - tk2type(G,N,T,TK); - false -> - Type %% Other types - end - end - end; - -getType(_G, _N, S) when is_list(S) -> - S; - -getType(_G, _N, T) when is_record(T, string) -> - "java.lang.String"; - -getType(_G, _N, T) when is_record(T, wstring) -> %% WSTRING - "java.lang.String"; - -getType(G, N, T) when is_record(T, struct) -> - ic_util:to_dot(G,[ic_forms:get_id2(T)|N]); - -getType(G, N, T) when is_record(T, union) -> - ic_util:to_dot(G,[ic_forms:get_id2(T)|N]); - -getType(G, N, T) when is_record(T, sequence) -> - getType(G, N, ic_forms:get_type(T)) ++ "[]"; - -getType(G, N, T) when is_record(T, enum) -> - ic_util:to_dot(G,[ic_forms:get_id2(T)|N]); - -%% NOTE i am using the new isJavaElementaryType -%% to avoid members declared as keywords (except -%% all java elementary types) to be used as a -%% class -getType(G, N, T) when is_record(T, member) -> - Type = tk2type(G,N,T,ic_forms:get_type_code(G, N, T)), - case isJavaElementaryType(list_to_atom(Type)) of - true -> - Type; - false -> - Prefix = list_to_atom(lists:flatten(string:tokens(Type,"[]"))), - case isJavaElementaryType(Prefix) of %% Checks if Type is an array - %% of elementary java types - true -> - Type; - false -> - ic_forms:get_java_id(getType(G,N,ic_forms:get_type(T))) ++ - if is_record(hd(T#member.id),array) -> - arrayEmptyDim(hd(T#member.id)); - true -> - "" - end - end - end; - -getType(_G, _N, {boolean, _}) -> - "boolean"; - -getType(_G, _N, {octet, _}) -> - "byte"; - -getType(_G, _N, {void, _}) -> - "void"; - -getType(_G, _N, {unsigned, U}) -> - case U of - {short,_} -> - "short"; - {long,_} -> - "int"; - {'long long',_} -> - "long" - end; - -getType(_G, _N, {char, _}) -> - "char"; - -getType(_G, _N, {wchar, _}) -> %% WCHAR - "char"; - -getType(_G, _N, {short, _}) -> - "short"; - -getType(_G, _N, {long, _}) -> - "int"; - -getType(_G, _N, {'long long', _}) -> - "long"; - -getType(_G, _N, {float, _}) -> - "float"; - -getType(_G, _N, {double, _}) -> - "double"; - -getType(_G, _N, {any, _}) -> - ?ICPACKAGE ++ "Any". - - - - - - -%%----------------------------------------------------------------- -%% Func: getHolderType/3 -%%----------------------------------------------------------------- -getHolderType(G, N, T) when element(1, T) == scoped_id -> - {FullScopedName, _, TK, _} = ic_symtab:get_full_scoped_name(G, N, T), - BT = ic_code:get_basetype(G, ic_util:to_dot(G,FullScopedName)), - case BT of - "erlang.pid" -> - ?ICPACKAGE ++ "PidHolder"; - "erlang.port" -> - ?ICPACKAGE ++ "PortHolder"; - "erlang.ref" -> - ?ICPACKAGE ++ "RefHolder"; - "erlang.term" -> - ?ICPACKAGE ++ "TermHolder"; - {enum, Type} -> - getHolderType(G, N, Type); - - Type -> - case TK of - {'tk_struct', _, _, _} -> - Type ++ "Holder"; - - {'tk_union', _, _, _, _, _} -> - Type ++ "Holder"; - - {'tk_array', _ , _} -> - Type ++ "Holder"; - - {'tk_sequence', _ , _} -> - Type ++ "Holder"; - - {'tk_string', _} -> - ?ICPACKAGE ++ "StringHolder"; - - {'tk_wstring', _} -> %% WSTRING - ?ICPACKAGE ++ "StringHolder"; - - {'tk_enum', _, _, _} -> - Type ++ "Holder"; - - 'tk_boolean' -> - ?ICPACKAGE ++ "BooleanHolder"; - - 'tk_octet' -> - ?ICPACKAGE ++ "ByteHolder"; - - 'tk_ushort' -> - ?ICPACKAGE ++ "ShortHolder"; - - 'tk_ulong' -> - ?ICPACKAGE ++ "IntHolder"; - - 'tk_ulonglong' -> %% ULLONG - ?ICPACKAGE ++ "LongHolder"; - - 'tk_short' -> - ?ICPACKAGE ++ "ShortHolder"; - - 'tk_long' -> - ?ICPACKAGE ++ "IntHolder"; - - 'tk_longlong' -> - ?ICPACKAGE ++ "LongHolder"; %% LLONG - - 'tk_float' -> - ?ICPACKAGE ++ "FloatHolder"; - - 'tk_double' -> - ?ICPACKAGE ++ "DoubleHolder"; - - 'tk_char' -> - ?ICPACKAGE ++ "CharHolder"; - - 'tk_wchar' -> %% WCHAR - ?ICPACKAGE ++ "CharHolder"; - - 'tk_any' -> - ?ICPACKAGE ++ "AnyHolder"; - - _ -> - case isBasicType(G,N,TK) of - true -> - %% Faked the type ! - getHolderType(G, N, {list_to_atom(tk2type(G,N,T,TK)), -1}); - false -> - %%io:format("TK = ~p, Type = ~p\n",[TK,Type]), - ic_util:to_dot(G,FullScopedName) ++ "Holder" - end - end - end; - -getHolderType(G, N, S) when is_list(S) -> - ic_util:to_dot(G,[S|N]) ++ "Holder"; - -getHolderType(_G, _N, T) when is_record(T, string) -> - ?ICPACKAGE ++"StringHolder"; - -getHolderType(_G, _N, T) when is_record(T, wstring) -> %% WSTRING - ?ICPACKAGE ++"StringHolder"; - -getHolderType(G, N, T) when is_record(T, struct) -> - ic_util:to_dot(G,[ic_forms:get_id2(T)|N]) ++ "Holder"; - -getHolderType(G, N, T) when is_record(T, union) -> - ic_util:to_dot(G,[ic_forms:get_id2(T)|N]) ++ "Holder"; - -getHolderType(G, N, T) when is_record(T, array) -> - ic_util:to_dot(G,[ic_forms:get_id2(T)|N]) ++ "Holder"; - -getHolderType(G, N, T) when is_record(T, sequence) -> - getType(G, N, ic_forms:get_type(T)) ++ "Holder[]"; - -getHolderType(G, N, T) when is_record(T, enum) -> - ic_util:to_dot(G,[ic_forms:get_id2(T)|N]) ++ "Holder"; - -getHolderType(_G, _N, {boolean, _}) -> - ?ICPACKAGE ++"BooleanHolder"; - -getHolderType(_G, _N, {octet, _}) -> - ?ICPACKAGE ++"ByteHolder"; - -getHolderType(_G, _N, {void, _}) -> - "void"; - -getHolderType(_G, _N, {unsigned, U}) -> - case U of - {short,_} -> - ?ICPACKAGE ++"ShortHolder"; - {long,_} -> - ?ICPACKAGE ++"IntHolder"; - {'long long',_} -> - ?ICPACKAGE ++"LongHolder" - end; - -getHolderType(_G, _N, {char, _}) -> - ?ICPACKAGE ++"CharHolder"; - -getHolderType(_G, _N, {wchar, _}) -> %% WCHAR - ?ICPACKAGE ++"CharHolder"; - -getHolderType(_G, _N, {short, _}) -> - ?ICPACKAGE ++"ShortHolder"; - -getHolderType(_G, _N, {long, _}) -> - ?ICPACKAGE ++"IntHolder"; - -getHolderType(_G, _N, {'long long', _}) -> - ?ICPACKAGE ++"LongHolder"; - -getHolderType(_G, _N, {float, _}) -> - ?ICPACKAGE ++"FloatHolder"; - -getHolderType(_G, _N, {double, _}) -> - ?ICPACKAGE ++"DoubleHolder"; - -getHolderType(_G, _N, {any,_}) -> - ?ICPACKAGE ++ "AnyHolder". - - -%%----------------------------------------------------------------- -%% Func: getParamType/4 -%%----------------------------------------------------------------- -getParamType(G, N, S, in) -> - getType(G, N, S); -getParamType(G, N, S, ret) -> - getType(G, N, S); -getParamType(G, N, S, out) -> - getHolderType(G, N, S); -getParamType(G, N, S, inout) -> - getHolderType(G, N, S). - - -%%----------------------------------------------------------------- -%% Func: getUnmarshalType/4 -%%----------------------------------------------------------------- -getUnmarshalType(G, N, X, T) when element(1, T) == scoped_id -> - {FullScopedName, _, TK, _} = ic_symtab:get_full_scoped_name(G, N, T), - BT = ic_code:get_basetype(G, ic_util:to_dot(G,FullScopedName)), - case BT of - "erlang.pid" -> - ?ICPACKAGE ++ "PidHelper"; - "erlang.port" -> - ?ICPACKAGE ++ "PortHelper"; - "erlang.ref" -> - ?ICPACKAGE ++ "RefHelper"; - "erlang.term" -> - ?ICPACKAGE ++ "TermHelper"; - {enum, Type} -> - getUnmarshalType(G, N, X, Type); - Type -> - case TK of - {'tk_struct', _, _, _} -> - Type ++ "Helper"; - - {'tk_union', _, _, _, _, _} -> - Type ++ "Helper"; - - {'tk_sequence', _ , _} -> - Type ++ "Helper"; - - {'tk_array', _ , _} -> - Type ++ "Helper"; - - {'tk_enum', _, _, _} -> - Type ++ "Helper"; - - {'tk_string',_} -> - ?ERLANGPACKAGE ++ "OtpErlangString"; - - {'tk_wstring',_} -> %% WSTRING - ?ERLANGPACKAGE ++ "OtpErlangString"; - - 'tk_char' -> - ?ERLANGPACKAGE ++ "OtpErlangLong"; - - 'tk_wchar' -> %% WCHAR - ?ERLANGPACKAGE ++ "OtpErlangLong"; - - 'tk_octet' -> - ?ERLANGPACKAGE ++ "OtpErlangLong"; - - 'tk_ushort' -> - ?ERLANGPACKAGE ++ "OtpErlangLong"; - - 'tk_ulong' -> - ?ERLANGPACKAGE ++ "OtpErlangLong"; - - 'tk_ulonglong' -> %% ULLONG - ?ERLANGPACKAGE ++ "OtpErlangLong"; - - 'tk_short' -> - ?ERLANGPACKAGE ++ "OtpErlangLong"; - - 'tk_long' -> - ?ERLANGPACKAGE ++ "OtpErlangLong"; - - 'tk_longlong' -> %% LLONG - ?ERLANGPACKAGE ++ "OtpErlangLong"; - - 'tk_float' -> - ?ERLANGPACKAGE ++ "OtpErlangDouble"; - - 'tk_double' -> - ?ERLANGPACKAGE ++ "OtpErlangDouble"; - - 'tk_boolean' -> - ?ERLANGPACKAGE ++ "OtpErlangAtom"; - - 'tk_void' -> - ?ERLANGPACKAGE ++ "OtpErlangAtom"; - - 'tk_any' -> - ?ICPACKAGE ++ "AnyHelper"; - - _ -> - case isBasicType(G,N,TK) of - true -> - %% Faked the type ! - getUnmarshalType(G, N, X, {list_to_atom(tk2type(G,N,T,TK)), -1}); - false -> - ic_util:to_dot(G,FullScopedName) ++ "Helper" - end - end - end; - -getUnmarshalType(_G, _N, _X, S) when is_list(S) -> - S ++ "Helper"; - -getUnmarshalType(_G, _N, _X, T) when is_record(T, string) -> - ?ERLANGPACKAGE ++ "OtpErlangString"; - -getUnmarshalType(_G, _N, _X, T) when is_record(T, wstring) -> %% WSTRING - ?ERLANGPACKAGE ++ "OtpErlangString"; - -getUnmarshalType(G, N, _X, T) when is_record(T, struct) -> - ic_util:to_dot(G,[ic_forms:get_id2(T)|N]) ++ "Helper"; - -getUnmarshalType(G, N, _X, T) when is_record(T, union) -> - ic_util:to_dot(G,[ic_forms:get_id2(T)|N]) ++ "Helper"; - -getUnmarshalType(G, N, X, T) when is_record(T, sequence) andalso - is_record(X, member) -> - ic_util:to_dot(G,[ic_forms:get_id2(X)|N]) ++ "Helper"; - -getUnmarshalType(G, N, X, T) when is_record(T, sequence) andalso - is_record(X, case_dcl) -> - ic_util:to_dot(G,[ic_forms:get_id2(X)|N]) ++ "Helper"; - -getUnmarshalType(G, N, X, T) when is_record(T, sequence) -> - getUnmarshalType(G, N, X, ic_forms:get_type(T)) ++ "Helper"; - -getUnmarshalType(G, N, X, T) when is_record(T, array) andalso - is_record(X, case_dcl) -> - ic_util:to_dot(G,[ic_forms:get_id2(T)|N]) ++ "Helper"; - -getUnmarshalType(G, N, _X, T) when is_record(T, enum) -> - ic_util:to_dot(G,[ic_forms:get_id2(T)|N]) ++ - "Helper"; - -getUnmarshalType(_G, _N, _X, {boolean, _}) -> - ?ERLANGPACKAGE ++ "OtpErlangAtom"; - -getUnmarshalType(_G, _N, _X, {octet, _}) -> - ?ERLANGPACKAGE ++ "OtpErlangLong"; - -getUnmarshalType(_G, _N, _X, {void, _}) -> - ?ERLANGPACKAGE ++ "OtpErlangAtom"; - -getUnmarshalType(_G, _N, _X, {unsigned, U}) -> - case U of - {short,_} -> - ?ERLANGPACKAGE ++ "OtpErlangLong"; - {long,_} -> - ?ERLANGPACKAGE ++ "OtpErlangLong"; - {'long long',_} -> - ?ERLANGPACKAGE ++ "OtpErlangLong" - end; - -getUnmarshalType(_G, _N, _X, {char, _}) -> - ?ERLANGPACKAGE ++ "OtpErlangLong"; - -getUnmarshalType(_G, _N, _X, {wchar, _}) -> %% WCHAR - ?ERLANGPACKAGE ++ "OtpErlangLong"; - -getUnmarshalType(_G, _N, _X, {short, _}) -> - ?ERLANGPACKAGE ++ "OtpErlangLong"; - -getUnmarshalType(_G, _N, _X, {long, _}) -> - ?ERLANGPACKAGE ++ "OtpErlangLong"; - -getUnmarshalType(_G, _N, _X, {'long long', _}) -> - ?ERLANGPACKAGE ++ "OtpErlangLong"; - -getUnmarshalType(_G, _N, _X, {float, _}) -> - ?ERLANGPACKAGE ++ "OtpErlangDouble"; - -getUnmarshalType(_G, _N, _X, {double, _}) -> - ?ERLANGPACKAGE ++ "OtpErlangDouble"; - -getUnmarshalType(_G, _N, _X, {any, _}) -> - ?ICPACKAGE ++ "AnyHelper". - -%%----------------------------------------------------------------- -%% Func: getMarshalType/4 -%%----------------------------------------------------------------- -getMarshalType(G, N, X, T) when element(1, T) == scoped_id -> - {FullScopedName, _, TK, _} = ic_symtab:get_full_scoped_name(G, N, T), - BT = ic_code:get_basetype(G, ic_util:to_dot(G,FullScopedName)), - case BT of - "erlang.pid" -> - ?ICPACKAGE ++ "PidHelper"; - "erlang.port" -> - ?ICPACKAGE ++ "PortHelper"; - "erlang.ref" -> - ?ICPACKAGE ++ "RefHelper"; - "erlang.term" -> - ?ICPACKAGE ++ "TermHelper"; - {enum, Type} -> - getMarshalType(G, N, X, Type); - Type -> - case TK of - {'tk_struct', _, _, _} -> - Type ++ "Helper"; - - {'tk_union', _, _, _, _, _} -> - Type ++ "Helper"; - - {'tk_array', _ , _} -> - Type ++ "Helper"; - - {'tk_sequence', _ , _} -> - Type ++ "Helper"; - - {'tk_enum', _, _, _} -> - Type ++ "Helper"; - - {'tk_string',_} -> - "string"; - - {'tk_wstring',_} -> %% WSTRING - "string"; - - 'tk_char' -> - "char"; - - 'tk_wchar' -> %% WCHAR - "char"; - - 'tk_octet' -> - "byte"; - - 'tk_ushort' -> - "ushort"; - - 'tk_ulong' -> - "uint"; - - 'tk_ulonglong' -> %% ULLONG - "ulong"; - - 'tk_short' -> - "short"; - - 'tk_long' -> - "int"; - - 'tk_longlong' -> %% LLONG - "long"; - - 'tk_float' -> - "float"; - - 'tk_double' -> - "double"; - - 'tk_boolean' -> - "boolean"; - - 'tk_void' -> - "atom"; - - 'tk_any' -> - ?ICPACKAGE ++ "AnyHelper"; - - _ -> - case isBasicType(G,N,TK) of - true -> - %% Faked the type ! - getMarshalType(G, N, X, {list_to_atom(tk2type(G,N,T,TK)), -1}); - false -> - ic_util:to_dot(G,FullScopedName) ++ "Helper" - end - end - end; - -getMarshalType(_G, _N, _X, S) when is_list(S) -> - S ++ "Helper"; - -getMarshalType(_G, _N, _X, T) when is_record(T, string) -> - "string"; - -getMarshalType(_G, _N, _X, T) when is_record(T, wstring) -> %% WSTRING - "string"; - -getMarshalType(G, N, _X, T) when is_record(T, struct) -> - ic_util:to_dot(G,[ic_forms:get_id2(T)|N]) ++ - "Helper"; - -getMarshalType(G, N, _X, T) when is_record(T, union) -> - ic_util:to_dot(G,[ic_forms:get_id2(T)|N]) ++ - "Helper"; - -getMarshalType(G, N, X, T) when is_record(T, array) andalso - is_record(X, case_dcl) -> - ic_util:to_dot(G,[ic_forms:get_id2(T)|N]) ++ - "Helper"; - -getMarshalType(G, N, X, T) when is_record(T, sequence) andalso - is_record(X, member) -> - ic_util:to_dot(G,[ic_forms:get_id2(X)|N]) ++ - "Helper"; - -getMarshalType(G, N, _X, T) when is_record(T, sequence) -> - getType(G, N, ic_forms:get_type(T)) ++ - "Helper"; - -getMarshalType(G, N, _X, T) when is_record(T, enum) -> - ic_util:to_dot(G,[ic_forms:get_id2(T)|N]) ++ - "Helper"; - -getMarshalType(_G, _N, _X, {boolean, _}) -> - "boolean"; - -getMarshalType(_G, _N, _X, {octet, _}) -> - "byte"; - -getMarshalType(_G, _N, _X, {void, _}) -> - ""; % <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - -getMarshalType(_G, _N, _X, {unsigned, U}) -> - case U of - {short,_} -> - "ushort"; - {long,_} -> - "uint"; - {'long long',_} -> - "ulong" - end; - -getMarshalType(_G, _N, _X, {short, _}) -> - "short"; -getMarshalType(_G, _N, _X, {long, _}) -> - "int"; -getMarshalType(_G, _N, _X, {'long long', _}) -> - "long"; -getMarshalType(_G, _N, _X, {float, _}) -> - "float"; -getMarshalType(_G, _N, _X, {double, _}) -> - "double"; -getMarshalType(_G, _N, _X, {char, _}) -> - "char"; -getMarshalType(_G, _N, _X, {wchar, _}) -> %% WCHAR - "char"; -getMarshalType(_G, _N, _X, {any, _}) -> - ?ICPACKAGE ++ "AnyHelper". - - - - -%%----------------------------------------------------------------- -%% Func: unMarshalFun/4 -%%----------------------------------------------------------------- -unMarshalFun(G, N, X, T) when element(1, T) == scoped_id -> - {FullScopedName, _, TK, _} = ic_symtab:get_full_scoped_name(G, N, T), - BT = ic_code:get_basetype(G, ic_util:to_dot(G,FullScopedName)), - case BT of - "erlang.pid" -> - ".read_pid()"; - "erlang.port" -> - ".read_port()"; - "erlang.ref" -> - ".read_ref()"; - "erlang.term" -> - ".read_term()"; - {enum, Type} -> - unMarshalFun(G, N, X, Type); - _Type -> - case isBasicType(G,N,TK) of - true -> - case TK of - {'tk_string',_} -> - ".read_string()"; - - {'tk_wstring',_} -> %% WSTRING - ".read_string()"; - - 'tk_boolean' -> - ".read_boolean()"; - - 'tk_octet' -> - ".read_byte()"; - - 'tk_ushort' -> - ".read_ushort()"; - - 'tk_ulong' -> - ".read_uint()"; - - 'tk_ulonglong' -> %% ULLONG - ".read_ulong()"; - - 'tk_short' -> - ".read_short()"; - - 'tk_long' -> - ".read_int()"; - - 'tk_longlong' -> %% LLONG - ".read_long()"; - - 'tk_float' -> - ".read_float()"; - - 'tk_double' -> - ".read_double()"; - - 'tk_char' -> - ".read_char()"; - - 'tk_wchar' -> %% WCHAR - ".read_char()"; - - _ -> - %% Faked the type ! - unMarshalFun(G, N, X, {list_to_atom(tk2type(G,N,X,TK)), -1}) - end; - false -> - ".unmarshal()" - end - end; - -unMarshalFun(_G, _N, _X, S) when is_list(S) -> - ".unmarshal()"; - -unMarshalFun(_G, _N, _X, T) when is_record(T, string) -> - ".read_string()"; - -unMarshalFun(_G, _N, _X, T) when is_record(T, wstring) -> %% WSTRING - ".read_string()"; - -unMarshalFun(_G, _N, _X, T) when is_record(T, struct) -> - ".unmarshal((" ++ ?ERLANGPACKAGE ++ "OtpErlangTuple)"; - -unMarshalFun(_G, _N, _X, T) when is_record(T, union) -> - ".unmarshal((" ++ ?ERLANGPACKAGE ++ "OtpErlangTuple)"; - -unMarshalFun(_G, _N, _X, T) when is_record(T, sequence) -> - ".unmarshal((" ++ ?ERLANGPACKAGE ++ "OtpErlanglist)"; - -unMarshalFun(_G, _N, _X, T) when is_record(T, enum) -> - ".unmarshal((" ++ ?ERLANGPACKAGE ++ "OtpErlangAtom)"; - -unMarshalFun(_G, _N, _X, {boolean, _}) -> - ".read_boolean()"; - -unMarshalFun(_G, _N, _X, {octet, _}) -> - ".read_byte()"; - -unMarshalFun(_G, _N, _X, {void, _}) -> - ""; - -unMarshalFun(_G, _N, _X, {unsigned, U}) -> - case U of - {short,_} -> - ".read_ushort()"; - {long,_} -> - ".read_uint()"; - {'long long',_} -> - ".read_ulong()" - end; - -unMarshalFun(_G, _N, _X, {short, _}) -> - ".read_short()"; -unMarshalFun(_G, _N, _X, {long, _}) -> - ".read_int()"; -unMarshalFun(_G, _N, _X, {'long long', _}) -> - ".read_long()"; -unMarshalFun(_G, _N, _X, {float, _}) -> - ".read_float()"; -unMarshalFun(_G, _N, _X, {double, _}) -> - ".read_double()"; -unMarshalFun(_G, _N, _X, {char, _}) -> - ".read_char()"; -unMarshalFun(_G, _N, _X, {wchar, _}) -> %% WCHAR - ".read_char()". - - - - - -%%----------------------------------------------------------------- -%% Func: getFullType/4 - /3 -%% -%% Note : Similar to the getType/3 with the major difference -%% thet on arrays and sequences it will also declare -%% their sizes. Used for "new" declarations -%% -%%----------------------------------------------------------------- - - -getFullType(G, N, X, T) when is_record(X, typedef) andalso is_record(T, array) -> - FullDim = - tk2FullType(G,N,X,ic_forms:get_tk(X)) ++ - getFullDim(G,N,T#array.size), - fixArrayDims(FullDim); - -getFullType(G, N, X, T) when is_record(X, member) andalso is_record(T, array) -> - FullDim = - getFullType(G, N, ic_forms:get_type(X)) ++ - getFullDim(G,N,T#array.size), - fixArrayDims(FullDim); - -getFullType(G, N, X, T) when is_record(X, case_dcl) andalso is_record(T, array) -> - FullDim = - getFullType(G, N, ic_forms:get_type(X)) ++ - getFullDim(G,N,T#array.size), - fixArrayDims(FullDim); - -getFullType(G, N, _X, T) -> - getFullType(G, N, T). - - - -getFullType(G, N, T) when is_record(T, scoped_id) -> - {FullScopedName, _, TK, _} = ic_symtab:get_full_scoped_name(G, N, T), - case TK of - {tk_array,_,_} -> - tk2FullType(G,N,T,TK); - {tk_sequence,_,_} -> - tk2FullType(G,N,T,TK); - _ -> - case isBasicType(G,N,TK) of - true -> - tk2FullType(G,N,T,TK); - false -> - %% Other types - ic_code:get_basetype(G, ic_util:to_dot(G,FullScopedName)) - end - end; - -getFullType(G, N, T) when is_record(T, sequence) -> - fixSeqDims(getType(G,N,T),"_length"); - -getFullType(G, N, T) -> - getType(G, N, T). - - - -%% In order to make a legal declaration -%% of an assignable array, the dimensions -%% of empty array sequences are swifted to -%% the end of the type -fixArrayDims(Cs) -> - fixArrayDims(Cs,[],[]). - -fixArrayDims([],Fulls,Emptys) -> - lists:reverse(Fulls) ++ Emptys; -fixArrayDims([91,93|Rest],Fulls,Emptys) -> - fixArrayDims(Rest,Fulls,[91,93|Emptys]); -fixArrayDims([C|Rest],Fulls,Emptys) -> - fixArrayDims(Rest,[C|Fulls],Emptys). - - -%% In order to make a legal declaration -%% of an assignable array, the dimensions -%% of empty array of sequences are swifted -%% to the end of the type -fixSeqDims(Cs,Length) -> - fixSeqDims(Cs,Length,[]). - -fixSeqDims([],_Length,Found) -> - lists:reverse(Found); -fixSeqDims([91,93|Rest],Length,Found) when is_list(Length) -> - lists:reverse([93|lists:reverse(Length)] ++ - [91|Found]) ++ Rest; -fixSeqDims([C|Rest],Length,Found) -> - fixSeqDims(Rest,Length,[C|Found]). - - - -%%----------------------------------------------------------------- -%% Func: inlinedTypes/2 -%%----------------------------------------------------------------- -inlinedTypes(PkgName, Type) when is_record(Type, struct) -> - "_" ++ PkgName ++ "."; -inlinedTypes(PkgName, Type) when is_record(Type, union) -> - "_" ++ PkgName ++ "."; -inlinedTypes(PkgName, Type) when is_record(Type, enum) -> - "_" ++ PkgName ++ "."; -inlinedTypes(_, _) -> - "". - -%%----------------------------------------------------------------- -%% Func: marshalFun/4 -%%----------------------------------------------------------------- -marshalFun(G, N, X, Type) -> - case isBasicType(G, N, Type) of - true -> - ".write_" ++ getMarshalType(G, N, X, Type); - _ -> - getMarshalType(G, N, X, Type) ++ ".marshal" - end. - - -%%----------------------------------------------------------------- -%% Func: isBasicType/3 -%%----------------------------------------------------------------- -isBasicType(G, N, S) when element(1, S) == scoped_id -> - {_, _, TK, _} = ic_symtab:get_full_scoped_name(G, N, S), - isBasicType(ictype:fetchType(TK)); - -isBasicType(G, N, X) when is_record(X, member) -> - if is_record(hd(element(3,X)), array) -> - false; - true -> - isBasicType(G, N, element(2,X)) - end; - -isBasicType(_G, _N, {unsigned, {long, _}} ) -> - true; - -isBasicType(_G, _N, {unsigned, {short, _}} ) -> - true; - -isBasicType(_G, _N, {unsigned, {'long long', _}} ) -> - true; - -isBasicType(_G, _N, {'long long', _} ) -> - true; - -isBasicType(_G, _N, {Type, _} ) -> - isBasicType(Type); - -isBasicType(_G, _N, Type) -> - isBasicType(Type). - - -%%----------------------------------------------------------------- -%% Func: isBasicType/1 -%%----------------------------------------------------------------- - -isBasicType( Type ) -> - lists:member(Type, - [tk_short,short, - tk_long,long, - tk_longlong,longlong, %% LLONG - tk_ushort,ushort, - tk_ulong,ulong, - tk_ulonglong,ulonglong, %% ULLONG - tk_float,float, - tk_double,double, - tk_boolean,boolean, - tk_char,char, - tk_wchar,wchar, %% WCHAR - tk_octet,octet, - tk_wstring,wstring, %% WSTRING - tk_string,string]). - -%% returns true if the Type is a java elementary type -isJavaElementaryType( Type ) -> - lists:member(Type, - [byte, char, wchar, boolean, - int, short, long, 'long long', float, double]). - -%%----------------------------------------------------------------- -%% Func: isIntegerType/3 -%%----------------------------------------------------------------- -isIntegerType(G, N, S) when element(1, S) == scoped_id -> - {_, _, TK, _} = ic_symtab:get_full_scoped_name(G, N, S), - isIntegerType(ictype:fetchType(TK)); -isIntegerType(_G, _N, {unsigned, {long, _}} ) -> - true; -isIntegerType(_G, _N, {unsigned, {short, _}} ) -> - true; -isIntegerType(_G, _N, {unsigned, {'long long', _}} ) -> - true; -isIntegerType(_G, _N, {'long long', _} ) -> - true; -isIntegerType(_G, _N, {Type, _} ) -> - isIntegerType(Type); -isIntegerType(_G, _N, Type) -> - isIntegerType(Type). - -%%----------------------------------------------------------------- -%% Func: isIntegerType/1 -%%----------------------------------------------------------------- - -isIntegerType( Type ) -> - lists:member(Type, - [tk_short,short, - tk_long,long, - tk_longlong,longlong, %% LLONG - tk_ushort,ushort, - tk_ulong,ulong, - tk_ulonglong,ulonglong, %% ULLONG - tk_char,char, - tk_wchar,wchar, %% WCHAR - tk_octet,octet]). - - - -%%----------------------------------------------------------------- -%% Func: isTerm/3 -%%----------------------------------------------------------------- -isTermType(G, N, T) -> - case getType(G,N,T) of - "com.ericsson.otp.ic.Term" -> - true; - _ -> - false - end. - - - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- - - -%% Changes the typecode to the -%% corresponding "basic" type -tk2type(_G,_N,_X,{'tk_struct', _IFRId, "port", _ElementList}) -> - ?ICPACKAGE ++ "Port"; -tk2type(_G,_N,_X,{'tk_struct', _IFRId, "pid", _ElementList}) -> - ?ICPACKAGE ++ "Pid"; -tk2type(_G,_N,_X,{'tk_struct', _IFRId, "ref", _ElementList}) -> - ?ICPACKAGE ++ "Ref"; -tk2type(_G,_N,_X,{'tk_struct', _IFRId, "term", _ElementList}) -> - ?ICPACKAGE ++ "Term"; -tk2type(_G,_N,_X,{'tk_string', _}) -> - "java.lang.String"; -tk2type(_G,_N,_X,{'tk_wstring', _}) -> %% WSTRING - "java.lang.String"; -tk2type(G,N,X,{'tk_array', ElemTC, Dim}) -> - tkarr2decl(G,N,X,{'tk_array', ElemTC, Dim}); -tk2type(G,N,X,{'tk_sequence', ElemTC, MaxLsextractength}) -> - tkseq2decl(G,N,X,{'tk_sequence', ElemTC, MaxLsextractength}); -tk2type(G,N,_X,{'tk_struct', IFRId, Name, _ElementList}) -> - ScopedId= - lists:reverse(string:tokens(lists:nth(2,string:tokens(IFRId,":")),"/")), - - case ic_forms:clean_up_scope([Name|N]) of - ScopedId -> - %% Right path, use N instead - ic_util:to_dot(G,[Name|N]); - _ -> - %% Ugly work arround - ic_util:to_dot(G,ScopedId) - end; -tk2type(G,N,_X,{'tk_union', IFRId, Name, _, _, _ElementList}) -> - ScopedId= - lists:reverse(string:tokens(lists:nth(2,string:tokens(IFRId,":")),"/")), - - case ic_forms:clean_up_scope([Name|N]) of - ScopedId -> - %% Right path, use N instead - ic_util:to_dot(G,[Name|N]); - _ -> - %% Ugly work arround - ic_util:to_dot(G,ScopedId) - end; -tk2type(_G,_N,_X,{'tk_enum', _Id, Name, _ElementList}) -> - Name; -tk2type(_G,_N,_X,tk_void) -> - "void"; -tk2type(_G,_N,_X,tk_long) -> - "int"; -tk2type(_G,_N,_X,tk_longlong) -> %% LLONG - "long"; -tk2type(_G,_N,_X,tk_short) -> - "short"; -tk2type(_G,_N,_X,tk_ulong) -> - "int"; -tk2type(_G,_N,_X,tk_ulonglong) -> %% ULLONG - "long"; -tk2type(_G,_N,_X,tk_ushort) -> - "short"; -tk2type(_G,_N,_X,tk_float) -> - "float"; -tk2type(_G,_N,_X,tk_double) -> - "double"; -tk2type(_G,_N,_X,tk_boolean) -> - "boolean"; -tk2type(_G,_N,_X,tk_char) -> - "char"; -tk2type(_G,_N,_X,tk_wchar) -> %% WCHAR - "char"; -tk2type(_G,_N,_X,tk_octet) -> - "byte"; -tk2type(_G,_N,_X,tk_string) -> - "java.lang.String"; -tk2type(_G,_N,_X,tk_wstring) -> %% WSTRING - "java.lang.String"; -tk2type(_G,_N,_X,tk_any) -> - ?ICPACKAGE ++ "Any"; -tk2type(_G,_N,_X,tk_term) -> %% Term - ?ICPACKAGE ++ "Term". - -%% Changes the sequence typecode to the -%% corresponding "basic" structure -tkseq2decl(G,N,X,TKSeq) -> - tkseq2decl2(G,N,X,TKSeq,[],[]). - -tkseq2decl2(G,N,X,{tk_sequence,E,D},[],Ds) -> - tkseq2decl2(G,N,X,E,[],[D|Ds]); -tkseq2decl2(G,N,X,TkEl,[],Ds) -> - ElName = tk2type(G,N,X,TkEl), - ElName ++ getdim(Ds). - -%% Changes the array typecode to the -%% corresponding "basic" structure -tkarr2decl(G,N,X,TKArr) -> - tkarr2decl2(G,N,X,TKArr,[],[]). - -tkarr2decl2(G,N,X,{tk_array,E,D},[],Ds) -> - tkarr2decl2(G,N,X,E,[],[D|Ds]); -tkarr2decl2(G,N,X,TkEl,[],Ds) -> - ElName = tk2type(G,N,X,TkEl), - ElName ++ getdim(Ds). - -getdim([]) -> - ""; -getdim([_D|Ds]) -> - getdim(Ds) ++ "[]". - - - -%% Changes the typecode to the corresponding "basic" type -%% used for variable declarations where arrays and sequences -%% are declared with there full dimensions -tk2FullType(G,N,X,{'tk_array', ElemTC, Dim}) -> - tkarr2FullDecl(G,N,X,{'tk_array', ElemTC, Dim}); -tk2FullType(G,N,X,{'tk_sequence', ElemTC, MaxLsextractength}) -> - tkseq2FullDecl(G,N,X,{'tk_sequence', ElemTC, MaxLsextractength}); -tk2FullType(G,N,X,TK) -> - tk2type(G,N,X,TK). - - -%% Changes the sequence typecode to the -%% corresponding "basic" structure here -%% arrays and sequences are declared with -%% their full dimensions -tkseq2FullDecl(G,N,X,TKSeq) -> - tkseq2FullDecl2(G,N,X,TKSeq,[],[]). - -tkseq2FullDecl2(G,N,X,{tk_sequence,E,D},[],Ds) -> - tkseq2FullDecl2(G,N,X,E,[],[D|Ds]); -tkseq2FullDecl2(G,N,X,TkEl,[],Ds) -> - ElName = tk2FullType(G,N,X,TkEl), - ElName ++ getdim(Ds). - -%% Changes the array typecode to the -%% corresponding "basic" structure -tkarr2FullDecl(G,N,X,TKArr) -> - tkarr2FullDecl2(G,N,X,TKArr,[],[]). - -tkarr2FullDecl2(G,N,X,{tk_array,E,D},[],Ds) -> - tkarr2FullDecl2(G,N,X,E,[],[D|Ds]); -tkarr2FullDecl2(G,N,X,TkEl,[],Ds) -> - ElName = tk2FullType(G,N,X,TkEl), - ElName ++ getFullDim(G,N,Ds). - -getFullDim(_G,_N,[]) -> - ""; -getFullDim(G,N,[D|Ds]) when is_record(D,scoped_id) -> - {FSN, _, _, _} = ic_symtab:get_full_scoped_name(G, N, D), - "[" ++ ic_util:to_dot(G,FSN) ++ "]" ++ getFullDim(G,N,Ds); -getFullDim(G,N,[D|Ds]) when is_integer(D) -> - "[" ++ integer_to_list(D) ++ "]" ++ getFullDim(G,N,Ds); -getFullDim(G,N,[D|Ds]) when is_tuple(D) -> - "[" ++ ic_util:eval_java(G,N,D) ++ "]" ++ getFullDim(G,N,Ds). - - - -%% Constructs an array empty dimension string -%% used for array variable declaration -arrayEmptyDim(X) -> - arrayEmptyDim2(X#array.size). - -arrayEmptyDim2([_D]) -> - "[]"; -arrayEmptyDim2([_D |Ds]) -> - "[]" ++ arrayEmptyDim2(Ds). - - - diff --git a/lib/ic/src/ic_jbe.erl b/lib/ic/src/ic_jbe.erl deleted file mode 100644 index 56518a681b..0000000000 --- a/lib/ic/src/ic_jbe.erl +++ /dev/null @@ -1,1488 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - - --module(ic_jbe). - - --export([do_gen/3, gen/3, emit_type_function/4]). - - - --include("icforms.hrl"). --include("ic.hrl"). --include("ic_debug.hrl"). --include_lib("stdlib/include/erl_compile.hrl"). - - - -%%------------------------------------------------------------ -%% -%% Entry point -%% -%%------------------------------------------------------------ - -do_gen(G, _File, Form) -> - gen(G, [], Form). - - -%%------------------------------------------------------------ -%% -%% Generate the client side C stubs. -%% -%% Each module is generated to a separate file. -%% -%% Each function needs to generate a function head and -%% a body. IDL parameters must be converted into C parameters. -%% -%%------------------------------------------------------------ - -gen(G, N, [X|Xs]) when is_record(X, preproc) -> - NewG = handle_preproc(G, N, X#preproc.cat, X), - gen(NewG, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, module) -> - gen_module(G, N, X), - gen(G, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, interface) -> - gen_interface(G, N, X), - gen(G, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, const) -> - ic_constant_java:gen(G, N, X), - gen(G, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, op) -> - gen(G, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, attr) -> - gen(G, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, except) -> - gen_exception(G, N, X), - gen(G, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, enum) -> - ic_enum_java:gen(G, N, X), - gen(G, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, struct) -> - ic_struct_java:gen(G, N, X), - gen(G, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, union) -> - ic_union_java:gen(G, N, X), - gen(G, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, typedef) -> - gen_typedef(G, N, X), - gen(G, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, member) -> - %%?PRINTDEBUG2("gen member: ~p\n",[ic_forms:get_type(X)]), - gen_member(G, N, X), - gen(G, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, case_dcl) -> - %%?PRINTDEBUG2("gen case decl: ~p\n",[ic_forms:get_type(X)]), - gen(G, N, [ic_forms:get_type(X)]), - gen(G, N, Xs); - -gen(G, N, [_|Xs]) -> - gen(G, N, Xs); - -gen(_G, _N, []) -> - ok. - - -%%%-------------------------------------------- -%%% -%%% Just generates the directory to host -%%% the module files -%%% -%%%-------------------------------------------- - -gen_module(G, N, X) -> - case ic_genobj:do_gen(G) of - - true -> %% Generate & register - N1 = [ic_forms:get_id2(X) | N], - %% Create directory - ic_file:createJavaDirectory(G, N1), - gen(G, N1, ic_forms:get_body(X)); - - false -> %% Register only - N1 = [ic_forms:get_id2(X) | N], - reg(G, N1, ic_forms:get_body(X)) - end. - -reg(G, N, [X|_Xs]) when is_record(X, module) -> - reg(G, [ic_forms:get_id2(X) | N], ic_forms:get_body(X)); - -reg(G, N, [X|_Xs]) when is_record(X, interface) -> - reg(G, [ic_forms:get_id2(X) | N], ic_forms:get_body(X)); - -reg(G, N, [X|Xs]) when is_record(X, typedef) -> - Name = ic_util:to_dot(G,[ic_forms:get_java_id(X) | N]), - case X#typedef.type of - {scoped_id,_,_,_} -> - {FullScopedName, _, _, _} = - ic_symtab:get_full_scoped_name(G, N, X#typedef.type), - Type = ic_code:get_basetype(G, ic_util:to_dot(G,FullScopedName)), - ic_code:insert_typedef(G, Name, Type); - _ -> - ok - end, - reg(G, N, Xs); - -reg(G, N, [_|Xs]) -> - reg(G, N, Xs); - -reg(_G, _N, []) -> - ok. - - - - -%%%---------------------------------------------- -%%% -%%% Generates the interface code -%%% -%%%---------------------------------------------- - -gen_interface(G, N, X) -> - case ic_genobj:do_gen(G) of - true -> - G1 = ic_file:javaInterfaceFilePush(G, N, X), - - %% Generate Interface file - InterfaceFd = ic_genobj:interfacefiled(G1), - emit_interface(G1, N, X, InterfaceFd), - - %% Generate Helper file - HelperFd = ic_genobj:helperfiled(G1), - emit_helper(G1, N, X, HelperFd), - - %% Generate Holder file - HolderFd = ic_genobj:holderfiled(G1), - emit_holder(G1, N, X, HolderFd), - - %% Generate Stub file - StubFd = ic_genobj:stubfiled(G1), - emit_stub(G1,N,X,StubFd), %<--------------------------------------------------- 1 - - %% Generate Skeleton file - SkelFd = ic_genobj:skelfiled(G1), - emit_skel(G1, N, X, SkelFd), - - ic_file:javaInterfaceFilePop(G1); - false -> - ok - end. - - - - -%%%-------------------------------------------- -%%% -%%% Typedef redirection -%%% -%%%-------------------------------------------- - -gen_typedef(G, N, X) -> - Name = ic_util:to_dot(G,[ic_forms:get_java_id(X) | N]), - case X#typedef.type of - {scoped_id,_,_,_} -> - {FullScopedName, _, _, _} = - ic_symtab:get_full_scoped_name(G, N, X#typedef.type), - Type = ic_code:get_basetype(G, ic_util:to_dot(G,FullScopedName)), - ic_code:insert_typedef(G, Name, Type); - _ -> - ok - end, - gen_typedef_1(G, N, X, ic_forms:get_body(X)). - -gen_typedef_1(G, N, X, Type) when is_record(Type, sequence) -> - ic_sequence_java:gen(G, N, Type, ic_forms:get_java_id(X)); -gen_typedef_1(G, N, X, Type) when is_record(Type, array) -> - ic_array_java:gen(G, N, X, Type); -gen_typedef_1(G, N, X, _Type) -> - gen_typedef_2(G, N, X, X#typedef.id), - ok. - -gen_typedef_2(G, N, X, Type) when is_record(Type, array) -> - gen_typedef_1(G, N, X, Type); -gen_typedef_2(G, N, X, Type) when is_list(Type) -> - case Type of - [] -> - ok; - _ -> - gen_typedef_2(G, N, X, hd(Type)), - gen_typedef_2(G, N, X, tl(Type)) - end; -%gen_typedef_2(G, N, X, Type) -> %% Generating Helpers for typedef -% %% Stoped due to compatibility problems -% %% with erl_genserv backend -% case ic_java_type:isBasicType(G,N,X#typedef.type) of -% true -> -% ok; -% false -> -% case ic_forms:get_type_code(G,N,X#typedef.type) of -% {'tk_struct', _, _, _} -> -% ic_struct_java:gen(G, N, X); -% {'tk_sequence',_,_} -> -% ic_sequence_java:gen(G, N, X, ic_forms:get_java_id(X)), -% ok; -% _ -> -% ok -% end -% end; -gen_typedef_2(_G, _N, _X, _Type) -> - ok. - - - -%%%-------------------------------------------- -%%% -%%% Member redirection -%%% -%%%-------------------------------------------- - -gen_member(G, N, X) -> - gen_member_1(G, N, X, [X#member.type]), - gen_member_2(G, N, X, X#member.id). - - -gen_member_1(_G, _N, _X, []) -> - ok; - -gen_member_1(G, N, X, [T|Ts]) when is_record(T, sequence) -> - ic_sequence_java:gen(G, N, T, ic_forms:get_java_id(X)), - gen_member_1(G, N, X, Ts); - -gen_member_1(G, N, X, [T|Ts]) -> - gen(G,N,[T]), - gen_member_1(G,N,X,Ts). - - -gen_member_2(_G, _N, _X, []) -> - ok; - -gen_member_2(G, N, X, [T|Ts]) when is_record(T, array) -> %% BUG ! - ic_array_java:gen(G, N, X, T), - gen_member_2(G, N, X, Ts); - -gen_member_2(G, N, X, [_T|Ts]) -> - gen_member_2(G, N, X, Ts). - - - -gen_exception(_G, N, X) -> - io:format("Warning : Exceptions not supported for java mapping, ~p ignored\n", - [ic_util:to_colon([ic_forms:get_java_id(X)|N])]), - ok. - - - -%%%----------------------------------------------------- -%%% -%%% Interface file generation -%%% -%%%----------------------------------------------------- - -emit_interface(G, N, X, Fd) -> - Interface = ic_forms:get_java_id(X), %% Java Interface Name - IFCName = ic_forms:get_id2(X), %% Internal Interface Name - - ic_codegen:emit(Fd, "public interface ~s {\n\n",[Interface]), - Body = ic_forms:get_body(X), - - %% Generate type declarations inside interface - gen(G, [IFCName |N], Body), - - lists:foreach(fun({_Name, Body1}) -> - emit_interface_prototypes(G, [IFCName|N], Body1, Fd) end, - [{x, Body} | X#interface.inherit_body]), - - ic_codegen:emit(Fd, "}\n\n"). - - -emit_interface_prototypes(G, N, [X |Xs], Fd) when is_record(X, op) -> - - {_, ArgNames, TypeList} = extract_info(G, N, X), - {R, ParameterTypes, _} = TypeList, - - OpName = ic_forms:get_java_id(X), - RT = ic_java_type:getParamType(G,N,R,ret), - PL = ic_util:mk_list(gen_par_list(G, N, X, ParameterTypes,ArgNames)), - - ic_codegen:emit(Fd, "/*\n"), - ic_codegen:emit(Fd, " * Operation ~p interface functions \n", [ic_util:to_colon([OpName|N])]), - ic_codegen:emit(Fd, " */\n\n"), - - ic_codegen:emit(Fd, "~s ~s(~s)\n",[RT, OpName, PL]), - ic_codegen:emit(Fd, " throws java.lang.Exception;\n\n\n"), - - emit_interface_prototypes(G, N, Xs, Fd); -emit_interface_prototypes(G, N, [X |Xs], Fd) when is_record(X, attr) -> - ic_attribute_java:emit_attribute_prototype(G, N, X, Fd), - emit_interface_prototypes(G, N, Xs, Fd); -emit_interface_prototypes(G, N, [_X|Xs], Fd) -> - emit_interface_prototypes(G, N, Xs, Fd); -emit_interface_prototypes(_G, _N, [], _Fd) -> ok. - - - - -%%%----------------------------------------------------- -%%% -%%% Holder file generation -%%% -%%%----------------------------------------------------- - -emit_holder(_G, N, X, Fd) -> - InterfaceName = ic_forms:get_java_id(X), - FullInterfaceName = ic_util:to_dot([InterfaceName|N]), - - ic_codegen:emit(Fd, "public final class ~sHolder {\n\n",[InterfaceName]), - - ic_codegen:emit(Fd, " // Instance variable\n"), - ic_codegen:emit(Fd, " public ~s value;\n\n",[FullInterfaceName]), - - ic_codegen:emit(Fd, " // Constructors\n"), - ic_codegen:emit(Fd, " public ~sHolder() {\n",[InterfaceName]), - ic_codegen:emit(Fd, " this(null);\n"), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " public ~sHolder(~s _arg) {\n",[InterfaceName, FullInterfaceName]), - ic_codegen:emit(Fd, " value = _arg;\n"), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " public void _marshal() {\n"), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " public void _unmarshal() {\n"), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, "}\n\n"). - - - - -%%%----------------------------------------------------- -%%% -%%% Helper file generation -%%% -%%%----------------------------------------------------- -emit_helper(G, N, X, Fd) -> - InterfaceName = ic_forms:get_java_id(X), - FullInterfaceName = ic_util:to_dot([InterfaceName|N]), - - ic_codegen:emit(Fd, "public final class ~sHelper {\n\n",[InterfaceName]), - - ic_codegen:emit(Fd, " // Constructor\n"), - ic_codegen:emit(Fd, " public ~sHelper() {\n",[InterfaceName]), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " public static void _marshal() {\n"), - ic_codegen:emit(Fd, " // Writing the object to the message\n"), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " public static ~s _unmarshal() {\n",[FullInterfaceName]), - ic_codegen:emit(Fd, " // Reading the object from the message\n"), - ic_codegen:emit(Fd, " return null;\n"), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " public static java.lang.String id() {\n"), - ic_codegen:emit(Fd, " return ~p;\n",[ictk:get_IR_ID(G, N, X)]), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, "}\n\n"). - - - - -%%%----------------------------------------------------- -%%% -%%% Stub file generation -%%% -%%%----------------------------------------------------- - -emit_stub(G, N, X, Fd) -> - InterfaceName = ic_forms:get_java_id(X), %% Java Interface Name - IFCName = ic_forms:get_id2(X), %% Internal Interface Name - - FullInterfaceName = ic_util:to_dot([InterfaceName|N]), - Body = ic_forms:get_body(X), - - ic_codegen:emit(Fd, "public class _~sStub implements ~s {\n\n", - [InterfaceName,FullInterfaceName]), - - ic_codegen:emit(Fd, " // Client data\n"), - ic_codegen:emit(Fd, " public ~sEnvironment _env;\n\n",[?ICPACKAGE]), - - ic_codegen:emit(Fd, " // Constructors\n"), - ic_codegen:emit(Fd, " public _~sStub(~sOtpSelf _self,\n",[InterfaceName,?ERLANGPACKAGE]), - ic_codegen:emit(Fd, " ~sOtpPeer _peer,\n",[?ERLANGPACKAGE]), - ic_codegen:emit(Fd, " java.lang.Object _server) throws java.lang.Exception {\n\n"), - - ic_codegen:emit(Fd, " _env =\n"), - ic_codegen:emit(Fd, " new ~sEnvironment(_self, _peer, _server);\n",[?ICPACKAGE]), - ic_codegen:emit(Fd, " _env.connect();\n"), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " public _~sStub(java.lang.String _selfN,\n",[InterfaceName]), - ic_codegen:emit(Fd, " java.lang.String _peerN,\n"), - ic_codegen:emit(Fd, " java.lang.String _cookie,\n"), - ic_codegen:emit(Fd, " java.lang.Object _server) throws java.lang.Exception {\n\n"), - ic_codegen:emit(Fd, " _env =\n"), - ic_codegen:emit(Fd, " new ~sEnvironment(_selfN, _peerN, _cookie, _server);\n",[?ICPACKAGE]), - ic_codegen:emit(Fd, " _env.connect();\n"), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " public _~sStub(~sOtpConnection _connection,\n",[InterfaceName, ?ERLANGPACKAGE]), - ic_codegen:emit(Fd, " java.lang.Object _server) throws java.lang.Exception {\n\n"), - ic_codegen:emit(Fd, " _env =\n"), - ic_codegen:emit(Fd, " new ~sEnvironment(_connection, _server);\n",[?ICPACKAGE]), - ic_codegen:emit(Fd, " _env.connect();\n"), - ic_codegen:emit(Fd, " }\n\n"), - - emit_message_reference_extraction(Fd), - - emit_servers_object_access(Fd), - - emit_client_connection_close(Fd), - - emit_client_connection_reconnect(Fd), - - emit_client_destroy(Fd), - - lists:foreach(fun({_Name, Body1}) -> - emit_op_implementation(G, [IFCName|N], Body1, Fd) end, - [{x, Body} | X#interface.inherit_body]), - - ic_codegen:emit(Fd, "}\n\n"). - - -emit_op_implementation(G, N, [X |Xs], Fd) when is_record(X, op) -> - - WireOpName = ic_forms:get_id2(X), - OpName = ic_forms:get_java_id(WireOpName), - {_, ArgNames, TypeList} = extract_info(G, N, X), - {R, ParamTypes, _} = TypeList, - - RT = ic_java_type:getParamType(G,N,R,ret), - PL = ic_util:mk_list(gen_par_list(G, N, X, ParamTypes, ArgNames)), - CMCPL = ic_util:mk_list(gen_client_marshal_call_par_list(ArgNames)), - - ic_codegen:emit(Fd, " // Operation ~p implementation\n", [ic_util:to_colon([WireOpName|N])]), - ic_codegen:emit(Fd, " public ~s ~s(~s)\n", [RT, OpName, PL]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n\n"), - - %% Function marshal call - ic_codegen:emit(Fd, " // Calling the marshal function\n"), - - case CMCPL of - "" -> - ic_codegen:emit(Fd, " _~s_marshal(_env);\n\n",[OpName]); - _ -> - ic_codegen:emit(Fd, " _~s_marshal(_env, ~s);\n\n",[OpName, CMCPL]) - end, - - %% Sending call - ic_codegen:emit(Fd, " // Message send\n"), - ic_codegen:emit(Fd, " _env.send();\n\n"), - - case ic_forms:is_oneway(X) of - true -> - ok; - false -> - %% Receiving return values - ic_codegen:emit(Fd, " // Message receive\n"), - ic_codegen:emit(Fd, " _env.receive();\n\n"), - - %% Function unmarshal call - case RT of - "void" -> - case ic_util:mk_list(gen_client_unmarshal_call_par_list(ArgNames)) of - "" -> - ic_codegen:emit(Fd, " // Calling the unmarshal function\n"), - ic_codegen:emit(Fd, " _~s_unmarshal(_env);\n", - [OpName]); - UMCPL -> - ic_codegen:emit(Fd, " // Calling the unmarshal function\n"), - ic_codegen:emit(Fd, " _~s_unmarshal(_env, ~s);\n", - [OpName,UMCPL]) - end; - _ -> - ic_codegen:emit(Fd, " // Calling the unmarshal function\n"), - case ic_util:mk_list(gen_client_unmarshal_call_par_list(ArgNames)) of - "" -> - ic_codegen:emit(Fd, " return _~s_unmarshal(_env);\n", - [OpName]); - UMCPL -> - ic_codegen:emit(Fd, " return _~s_unmarshal(_env, ~s);\n", - [OpName,UMCPL]) - end - end - end, - ic_codegen:emit(Fd, " }\n\n"), - - %% Marshalling - emit_op_marshal(G, N, X, Fd), - - %% UnMarshalling - emit_op_unmarshal(G, N, X, Fd), - ic_codegen:emit(Fd, "\n"), - - emit_op_implementation(G, N, Xs, Fd); -emit_op_implementation(G, N, [X |Xs], Fd) when is_record(X, attr) -> - ic_attribute_java:emit_attribute_stub_code(G, N, X, Fd), - emit_op_implementation(G, N, Xs, Fd); -emit_op_implementation(G, N, [_X|Xs], Fd) -> - emit_op_implementation(G, N, Xs, Fd); -emit_op_implementation(_G, _N, [], _Fd) -> ok. - - - - - -%%--------------------------------------- -%% -%% Marshal operation generation -%% -%%--------------------------------------- - -emit_op_marshal(G, N, X, Fd) -> - WireOpName = ic_forms:get_id2(X), - OpName = ic_forms:get_java_id(WireOpName), - {_, ArgNames, TypeList} = extract_info(G, N, X), - {_R, ParamTypes, _} = TypeList, - - PL = ic_util:mk_list(gen_marshal_par_list(G, N, X, ParamTypes, ArgNames)), - - ic_codegen:emit(Fd, " // Marshal operation for ~p\n", [OpName]), - case PL of - "" -> - ic_codegen:emit(Fd, " public static void _~s_marshal(~sEnvironment __env)\n", - [OpName, ?ICPACKAGE]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n\n"); - _ -> - ic_codegen:emit(Fd, " public static void _~s_marshal(~sEnvironment __env, ~s)\n", - [OpName, ?ICPACKAGE, PL]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n\n") - end, - %% Message encoding - emit_op_encode(G, N, X, OpName, WireOpName, ParamTypes, ArgNames, Fd), - - ic_codegen:emit(Fd, " }\n\n"). - - -emit_op_encode(G, N, X, _OpN, WOpN, ParamTypes, ArgNames, Fd) -> - - OpCallName = case ic_options:get_opt(G, scoped_op_calls) of - true -> - ic_util:to_undersc([WOpN|N]); - false -> - WOpN - end, - - SendParamNr = count_client_send(ArgNames), - - ic_codegen:emit(Fd, " ~sOtpOutputStream __os = __env.getOs();\n\n", - [?ERLANGPACKAGE]), - - case ic_forms:is_oneway(X) of - true -> - %% Initiating call tuple - ic_codegen:emit(Fd, " // Message header assembly\n"), - ic_codegen:emit(Fd, " __os.reset();\n"), - ic_codegen:emit(Fd, " __os.write_tuple_head(2);\n"), - ic_codegen:emit(Fd, " __os.write_atom(\"$gen_cast\");\n\n"); - false -> - %% Initiating call tuple - ic_codegen:emit(Fd, " // Message header assembly\n"), - ic_codegen:emit(Fd, " __os.reset();\n"), - ic_codegen:emit(Fd, " __os.write_tuple_head(3);\n"), - ic_codegen:emit(Fd, " __os.write_atom(\"$gen_call\");\n\n"), - - %% Initiating call identity tuple - ic_codegen:emit(Fd, " // Message identity part creation\n"), - ic_codegen:emit(Fd, " __os.write_tuple_head(2);\n"), - ic_codegen:emit(Fd, " __env.write_client_pid();\n"), - ic_codegen:emit(Fd, " __env.write_client_ref();\n\n") - end, - - %% Operation part initializations - case SendParamNr > 0 of - true -> - ic_codegen:emit(Fd, " // Operation attribute creation\n"), - ic_codegen:emit(Fd, " __os.write_tuple_head(~p);\n", [SendParamNr+1]), - ic_codegen:emit(Fd, " __os.write_atom(~p);\n", [OpCallName]), - emit_op_encode_loop(G, N, X, ParamTypes, ArgNames, 1, Fd); - false -> %% No in/inout paramaters - ic_codegen:emit(Fd, " __os.write_atom(~p);\n", [OpCallName]) - end. - - - -emit_op_encode_loop(_,_,_,_,[],_,_Fd) -> - ok; -emit_op_encode_loop(G, N, X, [_Type|Types],[{out, _Arg}|Args], Counter, Fd) -> - emit_op_encode_loop(G, N, X, Types, Args, Counter, Fd); -emit_op_encode_loop(G, N, X, [Type|Types], [{inout, Arg}|Args], Counter, Fd) -> - case ic_java_type:isBasicType(G, N, Type) of - true -> - ic_codegen:emit(Fd, " __os~s(~s.value);\n", - [ic_java_type:marshalFun(G, N, X, Type),Arg]); - false -> - ic_codegen:emit(Fd, " ~s(__os, ~s.value);\n", - [ic_java_type:marshalFun(G, N, X, Type),Arg]) - end, - emit_op_encode_loop(G, N, X, Types, Args, Counter+1, Fd); -emit_op_encode_loop(G, N, X, [Type|Types], [{in, Arg}|Args], Counter, Fd) -> - case ic_java_type:isBasicType(G, N, Type) of - true -> - ic_codegen:emit(Fd, " __os~s(~s);\n", - [ic_java_type:marshalFun(G, N, X, Type),Arg]); - false -> - ic_codegen:emit(Fd, " ~s(__os, ~s);\n", - [ic_java_type:marshalFun(G, N, X, Type),Arg]) - end, - emit_op_encode_loop(G, N, X, Types, Args, Counter+1, Fd). - - - - - - -%%------------------------------------- -%% -%% UnMarshal operation generation -%% -%%------------------------------------- - -emit_op_unmarshal(G, N, X, Fd) -> - case ic_forms:is_oneway(X) of - true -> - ok; - false -> - OpName = ic_forms:get_java_id(X), - {_, ArgNames, TypeList} = extract_info(G, N, X), - {R, ParamTypes, _} = TypeList, - - RT = ic_java_type:getParamType(G,N,R,ret), - PL = ic_util:mk_list(gen_unmarshal_par_list(G, N, X, ParamTypes, ArgNames)), - - case PL of - "" -> - case RT of - "void" -> - ic_codegen:emit(Fd, " // Unmarshal operation for ~p\n", [OpName]), - ic_codegen:emit(Fd, " public static void _~s_unmarshal(~sEnvironment __env)\n", - [OpName, ?ICPACKAGE]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n\n"), - ic_codegen:emit(Fd, " __env.getIs().read_atom();\n"), - ic_codegen:emit(Fd, " }\n\n"); - _ -> - ic_codegen:emit(Fd, " // Unmarshal operation for ~p\n", [OpName]), - ic_codegen:emit(Fd, " public static ~s _~s_unmarshal(~sEnvironment __env)\n", - [RT, OpName, ?ICPACKAGE]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n\n"), - - ic_codegen:emit(Fd, " // Get input stream\n"), - ic_codegen:emit(Fd, " ~sOtpInputStream __is = __env.getIs();\n\n", - [?ERLANGPACKAGE]), - - emit_op_decode(G, N, X, R, RT, ParamTypes, ArgNames, Fd), - ic_codegen:emit(Fd, " }\n\n") - end; - _ -> - ic_codegen:emit(Fd, " // Unmarshal operation for ~p\n", [OpName]), - ic_codegen:emit(Fd, " public static ~s _~s_unmarshal(~sEnvironment __env, ~s)\n", - [RT, OpName, ?ICPACKAGE, PL]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n\n"), - - ic_codegen:emit(Fd, " // Get input stream\n"), - ic_codegen:emit(Fd, " ~sOtpInputStream __is = __env.getIs();\n\n", - [?ERLANGPACKAGE]), - - emit_op_decode(G, N, X, R, RT, ParamTypes, ArgNames, Fd), - ic_codegen:emit(Fd, " }\n\n") - end - end. - - -emit_op_decode(G, N, X, R, RT, ParamTypes, ArgNames, Fd) -> - ReceiveNr = count_client_receive(ArgNames), - - case RT of - "void" -> - case ReceiveNr > 0 of - true -> - ic_codegen:emit(Fd, " // Extracting output values\n"), - ic_codegen:emit(Fd, " __is.read_tuple_head();\n"), - ic_codegen:emit(Fd, " __is.read_atom();\n"), - emit_op_decode_loop(G, N, X, ParamTypes, ArgNames, 1, Fd); - false -> - ic_codegen:emit(Fd, " __is.read_atom();\n") - end; - _ -> - case ReceiveNr > 0 of - true -> - ic_codegen:emit(Fd, " // Extracting return/output values\n"), - ic_codegen:emit(Fd, " __is.read_tuple_head();\n"), - case ic_java_type:isBasicType(G,N,R) of - true -> - ic_codegen:emit(Fd, " ~s _result = __is~s;\n", - [RT,ic_java_type:unMarshalFun(G, N, X, R)]); - false -> - ic_codegen:emit(Fd, " ~s _result = ~s.unmarshal(__is);\n", - [RT, ic_java_type:getUnmarshalType(G,N,X,R)]) - end, - emit_op_decode_loop(G, N, X, ParamTypes, ArgNames, 1, Fd), - - ic_codegen:nl(Fd), - ic_codegen:emit(Fd, " return _result;\n"); - false -> - ic_codegen:emit(Fd, " // Extracting return value\n"), - case ic_java_type:isBasicType(G,N,R) of - true -> - ic_codegen:emit(Fd, " return __is~s;\n", - [ic_java_type:unMarshalFun(G, N, X, R)]); - false -> - ic_codegen:emit(Fd, " return ~s.unmarshal(__is);\n", - [ic_java_type:getUnmarshalType(G,N,X,R)]) - end - end - end. - -emit_op_decode_loop(_,_,_,_,[],_,_Fd) -> - ok; -emit_op_decode_loop(G, N, X, [_Type|Types], [{in, _Arg}|Args], Counter, Fd) -> - emit_op_decode_loop(G, N, X, Types, Args, Counter, Fd); -emit_op_decode_loop(G, N, X, [Type|Types], [{_, Arg}|Args], Counter, Fd) -> - case ic_java_type:isBasicType(G,N,Type) of - true -> - ic_codegen:emit(Fd, " ~s.value = __is~s;\n", - [Arg, - ic_java_type:unMarshalFun(G, N, X, Type)]); - false -> - ic_codegen:emit(Fd, " ~s.value = ~s.unmarshal(__is);\n", - [Arg, - ic_java_type:getUnmarshalType(G, N, X, Type)]) - end, - emit_op_decode_loop(G, N, X, Types, Args, Counter+1, Fd). - - - -emit_message_reference_extraction(Fd) -> - ic_codegen:emit(Fd, " // Returns call reference\n"), - ic_codegen:emit(Fd, " public ~sOtpErlangRef __getRef()\n", - [?ERLANGPACKAGE]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n"), - ic_codegen:emit(Fd, " return _env.received_ref();\n"), - ic_codegen:emit(Fd, " }\n\n"). - -emit_servers_object_access(Fd) -> - ic_codegen:emit(Fd, " // Returns the server\n"), - ic_codegen:emit(Fd, " public java.lang.Object __server() {\n"), - ic_codegen:emit(Fd, " return _env.server();\n"), - ic_codegen:emit(Fd, " }\n\n"). - -emit_client_connection_close(Fd) -> - ic_codegen:emit(Fd, " // Closes connection\n"), - ic_codegen:emit(Fd, " public void __disconnect() {\n"), - ic_codegen:emit(Fd, " _env.disconnect();\n"), - ic_codegen:emit(Fd, " }\n\n"). - -emit_client_connection_reconnect(Fd) -> - ic_codegen:emit(Fd, " // Reconnects client\n"), - ic_codegen:emit(Fd, " public void __reconnect()\n"), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n"), - ic_codegen:emit(Fd, " _env.reconnect();\n"), - ic_codegen:emit(Fd, " }\n\n"). - -emit_client_destroy(Fd) -> - ic_codegen:emit(Fd, " // Destroy server\n"), - ic_codegen:emit(Fd, " public void __stop()\n"), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n"), - ic_codegen:emit(Fd, " _env.client_stop_server();\n"), - ic_codegen:emit(Fd, " }\n\n"). - - - -%%%---------------------------------------------------- -%%% -%%% Generates the server code -%%% -%%%---------------------------------------------------- - -emit_skel(G, N, X, Fd) -> - InterfaceName = ic_forms:get_java_id(X), - FullInterfaceName = ic_util:to_dot([InterfaceName|N]), - - ic_codegen:emit(Fd, "public abstract class _~sImplBase implements ~s {\n\n", - [InterfaceName,FullInterfaceName]), - - ic_codegen:emit(Fd, " // Server data\n"), - ic_codegen:emit(Fd, " protected ~sEnvironment _env = null;\n\n",[?ICPACKAGE]), - - ic_codegen:emit(Fd, " // Constructors\n"), - ic_codegen:emit(Fd, " public _~sImplBase() {\n",[InterfaceName]), - ic_codegen:emit(Fd, " }\n\n"), - - emit_caller_pid(G, N, X, Fd), - - %% Emit operation dictionary - emit_dictionary(G, N, X, Fd), - - %% Emit server switch - emit_server_switch(G, N, X, Fd), - - ic_codegen:emit(Fd, "}\n"). - - -emit_server_switch(G, N, X, Fd) -> - - IFCName = ic_forms:get_id2(X), %% Internal Interface Name - Body = ic_forms:get_body(X), - Counter = 0, - - ic_codegen:emit(Fd, " // Operation invokation\n"), - ic_codegen:emit(Fd, " public ~sOtpOutputStream invoke(~sOtpInputStream _in)\n", - [?ERLANGPACKAGE,?ERLANGPACKAGE]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n\n"), - - ic_codegen:emit(Fd, " // Create a new environment if needed\n"), - ic_codegen:emit(Fd, " if (_env == null)\n"), - ic_codegen:emit(Fd, " _env = new com.ericsson.otp.ic.Environment();\n\n"), - - ic_codegen:emit(Fd, " // Unmarshal head\n"), - ic_codegen:emit(Fd, " _env.uHead(_in);\n\n"), - - ic_codegen:emit(Fd, " // Switch over operation\n"), - ic_codegen:emit(Fd, " return __switch(_env);\n"), - - ic_codegen:emit(Fd, " }\n\n"), - - - ic_codegen:emit(Fd, " // Operation switch\n"), - ic_codegen:emit(Fd, " public ~sOtpOutputStream __switch(~sEnvironment __env)\n", [?ERLANGPACKAGE,?ICPACKAGE]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n\n"), - - ic_codegen:emit(Fd, " // Setup streams and operation label\n"), - ic_codegen:emit(Fd, " ~sOtpOutputStream __os = __env.getOs();\n",[?ERLANGPACKAGE]), - ic_codegen:emit(Fd, " __os.reset();\n"), - ic_codegen:emit(Fd, " int __label = __env.uLabel(__operations);\n\n"), - - ic_codegen:emit(Fd, " // Switch over operation\n"), - ic_codegen:emit(Fd, " switch(__label) {\n\n"), - - OpNr = emit_server_op_switch_loop(G, - [IFCName|N], - [{x, Body} | X#interface.inherit_body], - Counter, - Fd), - - ic_codegen:emit(Fd, " case ~p: { // Standard stop operation\n\n",[OpNr]), - ic_codegen:emit(Fd, " __env.server_stop_server();\n\n"), - ic_codegen:emit(Fd, " } break;\n\n"), - - ic_codegen:emit(Fd, " default: // It will never come down here \n"), - ic_codegen:emit(Fd, " throw new java.lang.Exception(\"BAD OPERATION\");\n\n", []), - - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " if(__os.count() > 0)\n"), - ic_codegen:emit(Fd, " return __os;\n\n"), - - ic_codegen:emit(Fd, " return null;\n"), - ic_codegen:emit(Fd, " }\n\n"). - - - -emit_server_op_switch_loop(_G, _N, [], C, _Fd) -> - C; -emit_server_op_switch_loop(G, N, [{_,X}|Xs], C, Fd) -> - C1 = emit_server_op_switch(G, N, X, C, Fd), - emit_server_op_switch_loop(G, N, Xs, C1, Fd). - - -emit_server_op_switch(G, N, [X|Xs], C, Fd) when is_record(X, op) -> - - OpName = ic_forms:get_java_id(X), - - ic_codegen:emit(Fd, " case ~p: { // Operation ~s\n\n",[C,ic_util:to_dot([OpName|N])]), - - emit_invoke(G, N, X, Fd), - - ic_codegen:emit(Fd, " } break;\n\n"), - - emit_server_op_switch(G, N, Xs, C+1, Fd); -emit_server_op_switch(G, N, [X |Xs], C, Fd) when is_record(X, attr) -> - C1 = ic_attribute_java:emit_attribute_switch_case(G,N,X,Fd,C), - emit_server_op_switch(G, N, Xs, C1, Fd); -emit_server_op_switch(G, N, [_X|Xs], C, Fd) -> - emit_server_op_switch(G, N, Xs, C, Fd); -emit_server_op_switch(_G, _N, [], C, _Fd) -> - C. - - -emit_caller_pid(_G, _N, _X, Fd) -> - ic_codegen:emit(Fd, " // Extracts caller identity\n"), - ic_codegen:emit(Fd, " public ~sOtpErlangPid __getCallerPid() {\n", [?ERLANGPACKAGE]), - ic_codegen:emit(Fd, " return _env.getScaller();\n"), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " public ~sOtpErlangPid __getCallerPid(~sEnvironment __env) {\n", - [?ERLANGPACKAGE, ?ICPACKAGE]), - ic_codegen:emit(Fd, " return __env.getScaller();\n"), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " public boolean __isStopped() {\n"), - ic_codegen:emit(Fd, " return _env.isStopped();\n"), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " public boolean __isStopped(~sEnvironment __env) {\n", - [?ICPACKAGE]), - ic_codegen:emit(Fd, " return __env.isStopped();\n"), - ic_codegen:emit(Fd, " }\n\n"). - - - -%% Creates an operation dictionary -emit_dictionary(G, N, X, Fd) -> - - Counter = 0, - Body = ic_forms:get_body(X), - - ic_codegen:emit(Fd, " // Operation dictionary\n"), - ic_codegen:emit(Fd, " private static java.util.Dictionary __operations = new java.util.Hashtable();\n"), - ic_codegen:emit(Fd, " static {\n"), - - emit_dictionary_loop(G, - [ic_forms:get_id2(X)|N], - [{x, Body} | X#interface.inherit_body], - Counter, - Fd), - - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " // Operation dictionary access\n"), - ic_codegen:emit(Fd, " public static java.util.Dictionary __operations() {\n"), - ic_codegen:emit(Fd, " return __operations;\n"), - ic_codegen:emit(Fd, " }\n\n"). - - - - -emit_dictionary_loop(_G, _N, [], C, Fd) -> - ic_codegen:emit(Fd, " __operations.put(~p, new java.lang.Integer(~p));\n", - ["stop",C]); -emit_dictionary_loop(G, N, [{_,X}|Xs], C, Fd) -> - C1 = emit_dictionary(G, N, X, C, Fd), - emit_dictionary_loop(G, N, Xs, C1, Fd). - - -emit_dictionary(G, N, [X|Xs], C, Fd) when is_record(X, op) -> - - OpName = case ic_options:get_opt(G, scoped_op_calls) of - true -> - ic_util:to_undersc([ic_forms:get_id2(X)|N]); - false -> - ic_forms:get_id2(X) - end, - - ic_codegen:emit(Fd, " __operations.put(~p, new java.lang.Integer(~p));\n", - [OpName,C]), - emit_dictionary(G, N, Xs, C+1, Fd); - -emit_dictionary(G, N, [X |Xs], C, Fd) when is_record(X, attr) -> - C1 = ic_attribute_java:emit_atrribute_on_dictionary(G, N, X, Fd, C), - emit_dictionary(G, N, Xs, C1, Fd); - -emit_dictionary(G, N, [_X|Xs], C, Fd) -> - emit_dictionary(G, N, Xs, C, Fd); - -emit_dictionary(_G, _N, [], C, _Fd) -> - C. - - - -emit_invoke(G, N, X, Fd) -> - - {_, ArgNames, TypeList} = extract_info(G, N, X), - {R, ParamTypes, _} = TypeList, - OpName = ic_forms:get_java_id(X), - RT = ic_java_type:getParamType(G,N,R,ret), - PL = ic_util:mk_list(gen_cb_arg_list(ArgNames)), - OutParamNr = count_server_send(ArgNames), - - case count_server_receive(ArgNames) of - 0 -> - ok; - _C -> - ic_codegen:emit(Fd, " // Preparing input\n"), - ic_codegen:emit(Fd, " ~sOtpInputStream __is = __env.getIs();\n", - [?ERLANGPACKAGE]), - emit_server_unmarshal_loop(G, N, X, ParamTypes, ArgNames, 1, Fd) - end, - - ic_codegen:emit(Fd, " // Calling implementation function\n"), - case RT of - "void" -> - ic_codegen:emit(Fd, " this.~s(~s);\n\n", - [OpName,PL]); - _ -> - ic_codegen:emit(Fd, " ~s _result = this.~s(~s);\n\n", - [RT, OpName, PL]) - end, - - case ic_forms:is_oneway(X) of - true -> - ok; - false -> - ic_codegen:emit(Fd, " // Marshaling output\n"), - ic_codegen:emit(Fd, " ~sOtpErlangRef __ref = __env.getSref();\n",[?ERLANGPACKAGE]), - - case RT of - "void" -> - case OutParamNr > 0 of - true -> - ic_codegen:emit(Fd, " __os.write_tuple_head(2);\n"), - ic_codegen:emit(Fd, " __os.write_ref(__ref.node(),__ref.ids(),__ref.creation()); // Call reference\n"), - ic_codegen:emit(Fd, " __os.write_tuple_head(~p);\n",[OutParamNr+1]), - ic_codegen:emit(Fd, " __os.write_atom(\"ok\");\n"), - emit_server_marshal_loop(G, N, X, ParamTypes,ArgNames,1,Fd); - false -> - ic_codegen:emit(Fd, " __os.write_tuple_head(2);\n"), - ic_codegen:emit(Fd, " __os.write_ref(__ref.node(),__ref.ids(),__ref.creation()); // Call reference\n"), - ic_codegen:emit(Fd, " __os.write_atom(\"ok\");\n\n") - end; - _ -> - case OutParamNr > 0 of - true -> - ic_codegen:emit(Fd, " __os.write_tuple_head(2);\n"), - ic_codegen:emit(Fd, " __os.write_ref(__ref.node(),__ref.ids(),__ref.creation()); // Call reference\n"), - ic_codegen:emit(Fd, " __os.write_tuple_head(~p);\n",[OutParamNr+1]), - - case ic_java_type:isBasicType(G,N,R) of - true -> - ic_codegen:emit(Fd, " __os~s(_result); // Return value\n", - [ic_java_type:marshalFun(G,N,X,R)]); - false -> - ic_codegen:emit(Fd, " ~s(__os,_result); // Return value\n", - [ic_java_type:marshalFun(G,N,X,R)]) - end, - emit_server_marshal_loop(G, N, X, ParamTypes,ArgNames,1,Fd); - false -> - ic_codegen:emit(Fd, " __os.write_tuple_head(2);\n"), - ic_codegen:emit(Fd, " __os.write_ref(__ref.node(),__ref.ids(),__ref.creation()); // Call reference\n"), - - case ic_java_type:isBasicType(G,N,R) of - true -> - ic_codegen:emit(Fd, " __os~s(_result); // Return value\n\n", - [ic_java_type:marshalFun(G,N,X,R)]); - false -> - ic_codegen:emit(Fd, " ~s(__os,_result); // Return value\n\n", - [ic_java_type:marshalFun(G,N,X,R)]) - end - end - end, - ic_codegen:nl(Fd) - end. - - -emit_server_unmarshal_loop(_,_,_,_,[],_,Fd) -> - ic_codegen:nl(Fd); -emit_server_unmarshal_loop(G, N, X, [Type|Types], [{in, Arg}|Args], Counter, Fd) -> - case ic_java_type:isBasicType(G,N,Type) of - true -> - ic_codegen:emit(Fd, " ~s ~s = __is~s; // In value\n", - [ic_java_type:getType(G,N,Type), - Arg, - ic_java_type:unMarshalFun(G,N,X,Type)]); - false -> - ic_codegen:emit(Fd, " ~s ~s = ~s.unmarshal(__is); // In value\n", - [ic_java_type:getType(G,N,Type), - Arg, - ic_java_type:getUnmarshalType(G,N,X,Type)]) - end, - emit_server_unmarshal_loop(G, N, X, Types, Args, Counter+1, Fd); -emit_server_unmarshal_loop(G, N, X, [Type|Types],[{inout, Arg}|Args], Counter, Fd) -> - Holder = ic_java_type:getHolderType(G,N,Type), - case ic_java_type:isBasicType(G,N,Type) of - true -> -% OtpEncVar = ic_java_type:getUnmarshalType(G,N,X,Type), - ic_codegen:emit(Fd, " ~s _~s = __is~s;\n", - [ic_java_type:getType(G,N,Type), - Arg, - ic_java_type:unMarshalFun(G,N,X,Type)]), - ic_codegen:emit(Fd, " ~s ~s = new ~s(_~s); // InOut value\n", - [Holder, - Arg, - Holder, - Arg]); - false -> - ic_codegen:emit(Fd, " ~s ~s = new ~s(); // InOut value\n", - [Holder, - Arg, - Holder]), - ic_codegen:emit(Fd, " ~s._unmarshal(__is);\n", - [Arg]) - end, - emit_server_unmarshal_loop(G, N, X, Types, Args, Counter+1, Fd); -emit_server_unmarshal_loop(G, N, X, [Type|Types],[{out, Arg}|Args], Counter, Fd) -> - Holder = ic_java_type:getHolderType(G,N,Type), - ic_codegen:emit(Fd, " ~s ~s = new ~s(); // Out value\n", [Holder, Arg, Holder]), - emit_server_unmarshal_loop(G, N, X, Types, Args, Counter, Fd). - - -emit_server_marshal_loop(_,_,_,_,[],_,_Fd) -> - ok; -emit_server_marshal_loop(G, N, X, [_Type|Types],[{in, _Arg}|Args], Counter, Fd) -> - emit_server_marshal_loop(G, N, X, Types, Args, Counter, Fd); -emit_server_marshal_loop(G, N, X, [Type|Types],[{_, Arg}|Args], Counter, Fd) -> -% Holder = ic_java_type:getHolderType(G,N,Type), - case ic_java_type:isBasicType(G,N,Type) of - true -> - ic_codegen:emit(Fd, " __os~s(~s.value); // Out/InOut value\n", - [ic_java_type:marshalFun(G,N,X,Type),Arg]); - false -> - ic_codegen:emit(Fd, " ~s._marshal(__os); // Out/InOut value\n", - [Arg]) - end, - emit_server_marshal_loop(G, N, X, Types, Args, Counter+1, Fd). - - - - - -%%%---------------------------------------------------- -%%% -%%% Utilities -%%% -%%%---------------------------------------------------- - -extract_info(_G, N, X) when is_record(X, op) -> - Name = ic_util:to_undersc([ic_forms:get_id2(X) | N]), - Args = X#op.params, - ArgNames = mk_c_vars(Args), - TypeList = {ic_forms:get_type(X), - lists:map(fun(Y) -> ic_forms:get_type(Y) end, Args), - [] - }, - {Name, ArgNames, TypeList}; -extract_info(_G, N, X) -> - Name = ic_util:to_undersc([ic_forms:get_id2(X) | N]), - {Name, [], []}. - -%% Input is a list of parameters (in parse form) and output is a list -%% of parameter attribute and variable names. -mk_c_vars(Params) -> - lists:map(fun(P) -> {A, _} = P#param.inout, - {A, ic_forms:get_id(P#param.id)} - end, - Params). - -%% -handle_preproc(G, _N, line_nr, X) -> - Id = ic_forms:get_java_id(X), - Flags = X#preproc.aux, - case Flags of - [] -> ic_genobj:push_file(G, Id); - _ -> - lists:foldr(fun({_, _, "1"}, Gprim) -> ic_genobj:push_file(Gprim, Id); - ({_, _, "2"}, Gprim) -> ic_genobj:pop_file(Gprim, Id); - ({_, _, "3"}, Gprim) -> ic_genobj:sys_file(Gprim, Id) end, - G, Flags) - end; -handle_preproc(G, _N, _Other, _X) -> - G. - - -%% -gen_par_list(_, _, _, [], []) -> - []; -gen_par_list(G, N, X, [Type |Types], [{Attr, Arg}|Args]) -> - JType = ic_java_type:getParamType(G, N, Type, Attr), - [JType ++ " " ++ Arg | - gen_par_list(G, N, X, Types, Args)]. - - -gen_marshal_par_list(_, _, _, [], []) -> - []; -gen_marshal_par_list(G, N, X, [_Type |Types], [{out, _Arg}|Args]) -> - gen_marshal_par_list(G, N, X, Types, Args); -gen_marshal_par_list(G, N, X, [Type |Types], [{Attr, Arg}|Args]) -> - JType = ic_java_type:getParamType(G, N, Type, Attr), - [JType ++ " " ++ Arg | - gen_marshal_par_list(G, N, X, Types, Args)]. - - -gen_unmarshal_par_list(_, _, _, [], []) -> - []; -gen_unmarshal_par_list(G, N, X, [_Type |Types], [{in, _Arg}|Args]) -> - gen_unmarshal_par_list(G, N, X, Types, Args); -gen_unmarshal_par_list(G, N, X, [Type |Types], [{Attr, Arg}|Args]) -> - JType = ic_java_type:getParamType(G, N, Type, Attr), - [JType ++ " " ++ Arg | - gen_unmarshal_par_list(G, N, X, Types, Args)]. - - -%% -gen_client_marshal_call_par_list([]) -> - []; -gen_client_marshal_call_par_list([{out, _Arg}|Args]) -> - gen_client_marshal_call_par_list(Args); -gen_client_marshal_call_par_list([{_Attr, Arg}|Args]) -> - [Arg | gen_client_marshal_call_par_list(Args)]. - - -gen_client_unmarshal_call_par_list([]) -> - []; -gen_client_unmarshal_call_par_list([{in, _Arg}|Args]) -> - gen_client_unmarshal_call_par_list(Args); -gen_client_unmarshal_call_par_list([{_Attr, Arg}|Args]) -> - [Arg | gen_client_unmarshal_call_par_list(Args)]. - - - -count_client_receive(ArgNames) -> - count_client_receive(ArgNames,0). - -count_client_receive([],C) -> - C; -count_client_receive([{in, _Arg}|Args],C) -> - count_client_receive(Args,C); -count_client_receive([_|Args],C) -> - count_client_receive(Args,C+1). - - - -count_client_send(ArgNames) -> - count_client_send(ArgNames,0). - -count_client_send([],C) -> - C; -count_client_send([{out, _Arg}|Args],C) -> - count_client_send(Args,C); -count_client_send([_|Args],C) -> - count_client_send(Args,C+1). - - -gen_cb_arg_list([]) -> - []; -gen_cb_arg_list([{_Attr, Arg}|Args]) -> - [Arg | gen_cb_arg_list(Args)]. - - -count_server_receive(ArgNames) -> - count_server_receive(ArgNames,0). - -count_server_receive([],C) -> - C; -count_server_receive([_|Args],C) -> - count_server_receive(Args,C+1). - - -count_server_send(ArgNames) -> - count_server_send(ArgNames,0). - -count_server_send([],C) -> - C; -count_server_send([{in, _Arg}|Args],C) -> - count_server_send(Args,C); -count_server_send([_|Args],C) -> - count_server_send(Args,C+1). - - - - - -%%%------------------------------------------------------- - - -emit_type_function(G, N, X, Fd) -> - - TC = ic_forms:get_type_code(G, N, X), - - %%io:format("X = ~p\nTC = ~p\n",[X,TC]), - - ic_codegen:emit(Fd, " private static ~sTypeCode _tc;\n",[?ICPACKAGE]), - ic_codegen:emit(Fd, " synchronized public static ~sTypeCode type() {\n\n",[?ICPACKAGE]), - - ic_codegen:emit(Fd, " if (_tc != null)\n"), - ic_codegen:emit(Fd, " return _tc;\n\n"), - - emit_type_function(TC, 0, Fd), - - ic_codegen:emit(Fd, "\n _tc = _tc0;\n"), - - ic_codegen:emit(Fd, "\n return _tc0;\n"), - ic_codegen:emit(Fd, " }\n\n"). - - - -emit_type_function({tk_struct, ID, Name, ML}, C, Fd) -> %% struct - ic_codegen:emit(Fd, " ~sTypeCode _tc~p =\n",[?ICPACKAGE,C]), - ic_codegen:emit(Fd, " new ~sTypeCode();\n", [?ICPACKAGE]), - ic_codegen:emit(Fd, " _tc~p.kind(~sTCKind.tk_struct);\n", [C,?ICPACKAGE]), - ic_codegen:emit(Fd, " _tc~p.id(~p);\n", [C,ID]), - ic_codegen:emit(Fd, " _tc~p.name(~p);\n", [C,Name]), - ic_codegen:emit(Fd, " _tc~p.member_count(~p);\n", [C,length(ML)]), - emit_struct_members(ML, C, C+1, 0, Fd); - -emit_type_function({tk_enum, ID, Name, MNames}, C, Fd) -> %% enum - ic_codegen:emit(Fd, " ~sTypeCode _tc~p =\n",[?ICPACKAGE,C]), - ic_codegen:emit(Fd, " new ~sTypeCode();\n", [?ICPACKAGE]), - ic_codegen:emit(Fd, " _tc~p.kind(~sTCKind.tk_enum);\n", [C,?ICPACKAGE]), - ic_codegen:emit(Fd, " _tc~p.id(~p);\n", [C,ID]), - ic_codegen:emit(Fd, " _tc~p.name(~p);\n", [C,Name]), - ic_codegen:emit(Fd, " _tc~p.member_count(~p);\n", [C,length(MNames)]), - emit_enum_members(MNames, C, 0, Fd), - C+1; - -emit_type_function({tk_array, ET, L}, C, Fd) -> %% array - ic_codegen:emit(Fd, " ~sTypeCode _tc~p =\n",[?ICPACKAGE,C]), - ic_codegen:emit(Fd, " new ~sTypeCode();\n", [?ICPACKAGE]), - ic_codegen:emit(Fd, " _tc~p.kind(~sTCKind.tk_array);\n", [C,?ICPACKAGE]), - ic_codegen:emit(Fd, " _tc~p.id(id());\n",[C]), - ic_codegen:emit(Fd, " _tc~p.length(~p);\n", [C,L]), - C1 = C+1, - C2 = emit_type_function(ET, C1, Fd), - ic_codegen:emit(Fd, " _tc~p.content_type(_tc~p);\n", [C,C1]), - C2; - -emit_type_function({tk_sequence, ET, L}, C, Fd) -> %% sequence - ic_codegen:emit(Fd, " ~sTypeCode _tc~p =\n",[?ICPACKAGE,C]), - ic_codegen:emit(Fd, " new ~sTypeCode();\n", [?ICPACKAGE]), - ic_codegen:emit(Fd, " _tc~p.kind(~sTCKind.tk_sequence);\n", [C,?ICPACKAGE]), - ic_codegen:emit(Fd, " _tc~p.id(id());\n",[C]), - ic_codegen:emit(Fd, " _tc~p.length(~p);\n", [C,L]), - C1 = C+1, - C2 = emit_type_function(ET, C1, Fd), - ic_codegen:emit(Fd, " _tc~p.content_type(_tc~p);\n", [C,C1]), - C2; - -emit_type_function({tk_string, L}, C, Fd) -> %% string - ic_codegen:emit(Fd, " ~sTypeCode _tc~p =\n",[?ICPACKAGE,C]), - ic_codegen:emit(Fd, " new ~sTypeCode();\n", [?ICPACKAGE]), - ic_codegen:emit(Fd, " _tc~p.kind(~sTCKind.tk_string);\n", [C,?ICPACKAGE]), - ic_codegen:emit(Fd, " _tc~p.length(~p);\n", [C,L]), - C+1; - -emit_type_function({tk_union, ID, Name, DT, DI, LL}, C, Fd) -> %% union - - ic_codegen:emit(Fd, " ~sTypeCode _tc~p =\n",[?ICPACKAGE,C]), - ic_codegen:emit(Fd, " new ~sTypeCode();\n", [?ICPACKAGE]), - ic_codegen:emit(Fd, " _tc~p.kind(~sTCKind.tk_union);\n", [C,?ICPACKAGE]), - ic_codegen:emit(Fd, " _tc~p.id(~p);\n", [C,ID]), - ic_codegen:emit(Fd, " _tc~p.name(~p);\n", [C,Name]), - - C1 = C+1, - C2 = emit_type_function(DT, C1, Fd), - - ic_codegen:emit(Fd, " _tc~p.discriminator_type(_tc~p);\n", [C,C1]), - ic_codegen:emit(Fd, " _tc~p.default_index(~p);\n", [C,DI]), - ic_codegen:emit(Fd, " _tc~p.member_count(~p);\n", [C,length(LL)]), - - emit_union_labels(LL, C, DT, C2, 0, Fd); - -emit_type_function(tk_term, C, Fd) -> %% term, must change it to tk_any - ic_codegen:emit(Fd, " ~sTypeCode _tc~p =\n",[?ICPACKAGE,C]), - ic_codegen:emit(Fd, " new ~sTypeCode();\n", [?ICPACKAGE]), - ic_codegen:emit(Fd, " _tc~p.kind(~sTCKind.tk_any);\n", [C,?ICPACKAGE]), - C+1; - -emit_type_function(TC, C, Fd) -> %% other - ic_codegen:emit(Fd, " ~sTypeCode _tc~p =\n",[?ICPACKAGE,C]), - ic_codegen:emit(Fd, " new ~sTypeCode();\n", [?ICPACKAGE]), - ic_codegen:emit(Fd, " _tc~p.kind(~sTCKind.~p);\n", [C,?ICPACKAGE,TC]), - C+1. - - - -emit_struct_members([], _, TCtr, _, _Fd) -> - TCtr; -emit_struct_members([{Name,MT}|Rest], BTCtr, TCtr, I, Fd) -> - ic_codegen:emit(Fd, " _tc~p.member_name(~p,~p);\n", [BTCtr,I,Name]), - TCtr2 = emit_type_function(MT, TCtr, Fd), - ic_codegen:emit(Fd, " _tc~p.member_type(~p,_tc~p);\n", [BTCtr,I,TCtr]), - emit_struct_members(Rest, BTCtr, TCtr2, I+1, Fd). - -emit_enum_members([], _, _, _Fd) -> - ok; -emit_enum_members([Name|Names], BTCtr, I, Fd) -> - ic_codegen:emit(Fd, " _tc~p.member_name(~p,~p);\n", [BTCtr,I,Name]), - emit_enum_members(Names, BTCtr, I+1, Fd). - - -emit_union_labels([], _, _, TCtr, _, _) -> - TCtr; -emit_union_labels([{L, LN, LT}|Rest], BTCtr, DT, TCtr, I, Fd) -> - ic_codegen:emit(Fd, " ~sAny _any~p =\n",[?ICPACKAGE,TCtr]), - ic_codegen:emit(Fd, " new ~sAny();\n", [?ICPACKAGE]), - TCtr1 = TCtr+1, - TCtr2 = emit_type_function(LT, TCtr1,Fd), - ic_codegen:emit(Fd, " _any~p.type(_tc~p);\n",[TCtr,TCtr1]), - - case L of - default -> - ic_codegen:emit(Fd, " _any~p.insert_atom(\"default\");\n", [TCtr]); - _ -> - case DT of - tk_boolean -> - ic_codegen:emit(Fd, " _any~p.insert_boolean(~p);\n",[TCtr,L]); - tk_char -> - Default = if is_integer(L) -> - [L]; - true -> - L - end, - ic_codegen:emit(Fd, " _any~p.insert_char('~s');\n",[TCtr,Default]); - tk_ushort -> - ic_codegen:emit(Fd, " _any~p.insert_ushort(~p);\n",[TCtr,L]); - tk_ulong -> - ic_codegen:emit(Fd, " _any~p.insert_ulong(~p);\n",[TCtr,L]); - tk_short -> - ic_codegen:emit(Fd, " _any~p.insert_short(~p);\n",[TCtr,L]); - tk_long -> - ic_codegen:emit(Fd, " _any~p.insert_long(~p);\n",[TCtr,L]); - _ -> - ic_codegen:emit(Fd, " _any~p.insert_string(~p);\n", [TCtr,L]) - end - end, - ic_codegen:emit(Fd, " _tc~p.member_label(~p,_any~p);\n", [BTCtr,I,TCtr]), - ic_codegen:emit(Fd, " _tc~p.member_name(~p,~p);\n", [BTCtr,I,LN]), - TCtr3 = emit_type_function(LT, TCtr2, Fd), - ic_codegen:emit(Fd, " _tc~p.member_type(~p,_tc~p);\n", [BTCtr,I,TCtr2]), - emit_union_labels(Rest, BTCtr, DT, TCtr3, I+1, Fd). - - - - - - - - diff --git a/lib/ic/src/ic_noc.erl b/lib/ic/src/ic_noc.erl deleted file mode 100644 index 0e387b5e70..0000000000 --- a/lib/ic/src/ic_noc.erl +++ /dev/null @@ -1,1117 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(ic_noc). - - --export([do_gen/3]). -%%------------------------------------------------------------ -%% -%% Internal stuff -%% -%%------------------------------------------------------------ - --export([unfold/1, mk_attr_func_names/2]). - - --import(ic_util, [mk_name/2, mk_var/1, mk_oe_name/2, to_atom/1, to_list/1]). --import(ic_forms, [get_id/1, get_id2/1, get_body/1, is_oneway/1]). --import(ic_codegen, [emit/2, emit/3, nl/1]). --import(ic_options, [get_opt/2]). - - --import(lists, [foreach/2, foldr/3, map/2]). - - --include("icforms.hrl"). --include("ic.hrl"). - - - - -%%------------------------------------------------------------ -%% -%% Generate the client side Erlang stubs. -%% -%% Each module is generated to a separate file. -%% -%% Export declarations for all interface functions must be -%% generated. Each function then needs to generate a function head and -%% a body. IDL parameters must be converted into Erlang parameters -%% (variables, capitalised) and a type signature list must be -%% generated (for later encode/decode). -%% -%%------------------------------------------------------------ - - -do_gen(G, File, Form) -> - G2 = ic_file:filename_push(G, [], mk_oe_name(G, - ic_file:remove_ext(to_list(File))), - erlang), - gen_head(G2, [], Form), - exportDependency(G2), - %% Loop through form and adds inheritence data - ic_pragma:preproc(G2, [], Form), - gen(G2, [], Form), - genDependency(G2), - ic_file:filename_pop(G2, erlang), - ok. - - -gen(G, N, [X|Xs]) when is_record(X, preproc) -> - NewG = ic:handle_preproc(G, N, X#preproc.cat, X), - gen(NewG, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, module) -> - CD = ic_code:codeDirective(G,X), - G2 = ic_file:filename_push(G, N, X, CD), - N2 = [get_id2(X) | N], - gen_head(G2, N2, X), - gen(G2, N2, get_body(X)), - G3 = ic_file:filename_pop(G2, CD), - gen(G3, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, interface) -> - G2 = ic_file:filename_push(G, N, X, erlang), - N2 = [get_id2(X) | N], - gen_head(G2, N2, X), - gen(G2, N2, get_body(X)), - foreach(fun({_Name, Body}) -> gen(G2, N2, Body) end, - X#interface.inherit_body), - gen_serv(G2, N, X), - G3 = ic_file:filename_pop(G2, erlang), - gen(G3, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, const) -> -% N2 = [get_id2(X) | N], - emit_constant_func(G, X#const.id, X#const.val), - gen(G, N, Xs); %% N2 or N? - -gen(G, N, [X|Xs]) when is_record(X, op) -> - {Name, ArgNames, TypeList, OutArgs} = extract_info(G, N, X), - - case getNocType(G,X,N) of - transparent -> - emit_transparent_func(G, N, X, Name, ArgNames, TypeList, OutArgs); - multiple -> - mark_not_transparent(G,N), - emit_transparent_func(G, N, X, Name, ArgNames, TypeList, OutArgs); - _XTuple -> - mark_not_transparent(G,N), - emit_stub_func(G, N, X, Name, ArgNames, TypeList, OutArgs) - end, - - gen(G, N, Xs); - - -gen(G, N, [X|Xs]) when is_record(X, attr) -> - emit_attr(G, N, X, fun emit_stub_func/7), - gen(G, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, except) -> - icstruct:except_gen(G, N, X, erlang), - gen(G, N, Xs); - -gen(G, N, [X|Xs]) -> - case may_contain_structs(X) of - true -> icstruct:struct_gen(G, N, X, erlang); - false -> ok - end, - gen(G, N, Xs); - -gen(_G, _N, []) -> ok. - - -may_contain_structs(X) when is_record(X, typedef) -> true; -may_contain_structs(X) when is_record(X, struct) -> true; -may_contain_structs(X) when is_record(X, union) -> true; -may_contain_structs(_X) -> false. - - - -%%-------------------------------------------------------------------- -%% -%% Generate the server side (handle_call and handle_cast) -%% - -gen_serv(G, N, X) -> - case ic_genobj:is_stubfile_open(G) of - true -> - emit_serv_std(G, N, X), - N2 = [get_id2(X) | N], - gen_calls(G, N2, get_body(X)), - lists:foreach(fun({_Name, Body}) -> - gen_calls(G, N2, Body) end, - X#interface.inherit_body), - get_if_gen(G, N2, X), - gen_end_of_call(G, N, X), % Note N instead of N2 - - gen_casts(G, N2, get_body(X)), - lists:foreach(fun({_Name, Body}) -> - gen_casts(G, N2, Body) end, - X#interface.inherit_body), - gen_end_of_cast(G, N, X), % Note N instead of N2 - emit_skel_footer(G, N, X); % Note N instead of N2 - false -> - ok - end. - -gen_calls(G, N, [X|Xs]) when is_record(X, op) -> - case is_oneway(X) of - false -> - {Name, ArgNames, TypeList, OutArgs} = extract_info(G, N, X), - emit_skel_func(G, N, X, Name, ArgNames, TypeList, OutArgs), - gen_calls(G, N, Xs); - true -> - gen_calls(G, N, Xs) - end; - -gen_calls(G, N, [X|Xs]) when is_record(X, attr) -> - emit_attr(G, N, X, fun emit_skel_func/7), - gen_calls(G, N, Xs); - -gen_calls(G, N, [_X|Xs]) -> gen_calls(G, N, Xs); -gen_calls(_G, _N, []) -> ok. - -gen_casts(G, N, [X|Xs]) when is_record(X, op) -> - case is_oneway(X) of - true -> - {Name, ArgNames, TypeList, OutArgs} = extract_info(G, N, X), - emit_skel_func(G, N, X, Name, ArgNames, TypeList, OutArgs), - gen_casts(G, N, Xs); - false -> - gen_casts(G, N, Xs) - end; - -gen_casts(G, N, [_X|Xs]) -> gen_casts(G, N, Xs); -gen_casts(_G, _N, []) -> ok. - -emit_attr(G, N, X, F) -> - XX = #id_of{type=X}, - {GetType, SetType} = mk_attr_func_types(N, X), - lists:foreach(fun(Id) -> - X2 = XX#id_of{id=Id}, - {Get, Set} = mk_attr_func_names(N, get_id(Id)), - F(G, N, X2, Get, [], GetType, []), - case X#attr.readonly of - {readonly, _} -> ok; - _ -> - F(G, N, X2, Set, [mk_name(G, "Value")], - SetType, []) - end end, ic_forms:get_idlist(X)). - - -extract_info(G, _N, X) when is_record(X, op) -> - Name = get_id2(X), - InArgs = ic:filter_params([in,inout], X#op.params), - OutArgs = ic:filter_params([out,inout], X#op.params), - ArgNames = mk_erl_vars(G, InArgs), - TypeList = {ic_forms:get_tk(X), - map(fun(Y) -> ic_forms:get_tk(Y) end, InArgs), - map(fun(Y) -> ic_forms:get_tk(Y) end, OutArgs) - }, - {Name, ArgNames, TypeList, OutArgs}. - - - - -emit_serv_std(G, N, X) -> - Fd = ic_genobj:stubfiled(G), - case transparent(G) of - true -> - true; - _XTupleORMultiple -> - Impl = getImplMod(G,X,[get_id2(X)|N]), - TypeID = ictk:get_IR_ID(G, N, X), - - nl(Fd), nl(Fd), nl(Fd), - ic_codegen:mcomment(Fd, ["Server implementation."]), - nl(Fd), nl(Fd), - ic_codegen:mcomment(Fd, ["Function for fetching the interface type ID."]), - nl(Fd), - emit(Fd, "typeID() ->\n"), - emit(Fd, " \"~s\".\n", [TypeID]), - nl(Fd), nl(Fd), - ic_codegen:mcomment(Fd, ["Server creation functions."]), - nl(Fd), - emit(Fd, "oe_create() ->\n"), - emit(Fd, " start([], []).\n", []), - nl(Fd), - emit(Fd, "oe_create_link() ->\n"), - emit(Fd, " start_link([], []).\n", []), - nl(Fd), - emit(Fd, "oe_create(Env) ->\n"), - emit(Fd, " start(Env, []).\n", []), - nl(Fd), - emit(Fd, "oe_create_link(Env) ->\n"), - emit(Fd, " start_link(Env, []).\n", []), - nl(Fd), - emit(Fd, "oe_create(Env, RegName) ->\n"), - emit(Fd, " start(RegName, Env, []).\n", []), - nl(Fd), - emit(Fd, "oe_create_link(Env, RegName) ->\n"), - emit(Fd, " start_link(RegName, Env, []).\n", []), - nl(Fd), - ic_codegen:mcomment(Fd, ["Start functions."]), - nl(Fd), - emit(Fd, "start(Env, Opt) ->\n"), - emit(Fd, " gen_server:start(?MODULE, Env, Opt).\n"), - nl(Fd), - emit(Fd, "start_link(Env, Opt) ->\n"), - emit(Fd, " gen_server:start_link(?MODULE, Env, Opt).\n"), - nl(Fd), - emit(Fd, "start(RegName, Env, Opt) ->\n"), - emit(Fd, " gen_server:start(RegName, ?MODULE, Env, Opt).\n"), - nl(Fd), - emit(Fd, "start_link(RegName, Env, Opt) ->\n"), - emit(Fd, " gen_server:start_link(RegName, ?MODULE, Env, Opt).\n"), - nl(Fd), - ic_codegen:comment(Fd, "Call to implementation init"), - emit(Fd, "init(Env) ->\n"), - emit(Fd, " ~p:~p(Env).\n", [Impl, init]), - nl(Fd), - emit(Fd, "terminate(Reason, State) ->\n"), - emit(Fd, " ~p:~p(Reason, State).\n", - [Impl, terminate]), - nl(Fd), - emit(Fd, "code_change(_OldVsn, State, _Extra) ->\n"), - emit(Fd, " {ok, State}.\n"), - nl(Fd), nl(Fd) - end, - Fd. - - - - -gen_end_of_call(G, _N, _X) -> - case transparent(G) of - true -> - true; - _XTuple -> - Fd = ic_genobj:stubfiled(G), - nl(Fd), nl(Fd), - ic_codegen:mcomment_light(Fd, ["Standard gen_server call handle"]), - emit(Fd, "handle_call(stop, _From, State) ->\n"), - emit(Fd, " {stop, normal, ok, State}"), - case get_opt(G, serv_last_call) of - exception -> - emit(Fd, ";\n"), - nl(Fd), - emit(Fd, "handle_call(_Req, _From, State) ->\n"), - emit(Fd, " {reply, ~p, State}.\n",[getCallErr()]); - exit -> - emit(Fd, ".\n"), - nl(Fd), - nl(Fd) - end - end, - ok. - - -gen_end_of_cast(G, _N, _X) -> - case transparent(G) of - true -> - true; - _XTuple -> - Fd = ic_genobj:stubfiled(G), - nl(Fd), nl(Fd), - ic_codegen:mcomment_light(Fd, ["Standard gen_server cast handle"]), - emit(Fd, "handle_cast(stop, State) ->\n"), - emit(Fd, " {stop, normal, State}"), - case get_opt(G, serv_last_call) of - exception -> - emit(Fd, ";\n"), - nl(Fd), - emit(Fd, "handle_cast(_Req, State) ->\n"), - emit(Fd, " {reply, ~p, State}.\n",[getCastErr()]); - exit -> - emit(Fd, ".\n"), - nl(Fd), nl(Fd) - end - end, - ok. - - -emit_skel_footer(G, N, X) -> - case transparent(G) of - true -> - true; - _XTuple -> - Fd = ic_genobj:stubfiled(G), - nl(Fd), nl(Fd), - ic_codegen:mcomment_light(Fd, ["Standard gen_server handles"]), - case use_impl_handle_info(G, N, X) of - true -> - emit(Fd, "handle_info(X, State) ->\n"), - emit(Fd, " ~p:handle_info(X, State).\n\n", - [list_to_atom(ic_genobj:impl(G))]); - false -> - emit(Fd, "handle_info(_X, State) ->\n"), - emit(Fd, " {reply, ~p, State}.\n\n",[getInfoErr()]) - end - end, - ok. - - -use_impl_handle_info(G, N, X) -> - FullName = ic_util:to_colon([get_id2(X) | N]), - case {get_opt(G, {handle_info, true}), get_opt(G, {handle_info, FullName})} of - {_, force_false} -> false; - {false, false} -> false; - _ -> true - end. - - -use_timeout(G, N, _X) -> - FullName = ic_util:to_colon(N), - case {get_opt(G, {timeout, true}), get_opt(G, {timeout, FullName})} of - {_, force_false} -> false; - {false, false} -> false; - _ -> true - end. - - -get_if_name(G) -> mk_oe_name(G, "get_interface"). - - -%% Generates the get_interface function (for Lars) -get_if_gen(G, N, X) -> - case transparent(G) of - true -> - ok; - _XTuple -> - case ic_genobj:is_stubfile_open(G) of - true -> - IFC_TKS = tk_interface_data(G,N,X), - Fd = ic_genobj:stubfiled(G), - Name = to_atom(get_if_name(G)), - - ic_codegen:mcomment_light(Fd, - [io_lib:format("Standard Operation: ~p", - [Name])]), - - emit(Fd, "handle_call({_~s, ~p, []}, _From, State) ->~n", - [mk_name(G, "Ref"), Name]), - emit(Fd, " {reply, ~p, State};~n", [IFC_TKS]), - nl(Fd), - ok; - - false -> ok - end - end. - - -get_if(G,N,[X|Rest]) when is_record(X, op) -> - R = ic_forms:get_tk(X), - IN = lists:map(fun(P) -> ic_forms:get_tk(P) end, - ic:filter_params([in, inout], X#op.params)), - OUT = lists:map(fun(P) -> ic_forms:get_tk(P) end, - ic:filter_params([out, inout], X#op.params)), - case print_tk(G,N,X) of - true -> - [{get_id2(X), {R, IN, OUT}} | get_if(G,N,Rest)]; - false -> - get_if(G,N,Rest) - end; - -get_if(G,N,[X|Rest]) when is_record(X, attr) -> %% Attributes not handled so far <<<<<<<<<<<<<<<<<<<<<<<< - {GetT, SetT} = mk_attr_func_types([], X), - AList = lists:map(fun(Id) -> - {Get, Set} = mk_attr_func_names([], get_id(Id)), - case X#attr.readonly of - {readonly, _} -> - {Get, GetT}; - _ -> - [{Set, SetT}, {Get, GetT}] - end end, ic_forms:get_idlist(X)), - lists:flatten(AList) ++ get_if(G,N,Rest); - -get_if(G,N,[_X|Rest]) -> get_if(G,N,Rest); -get_if(_,_,[]) -> []. - - - - -%%------------------------------------------------------------ -%% -%% Export stuff -%% -%% Gathering of all names that should be exported from a stub -%% file. -%% - - -gen_head_special(G, N, X) when is_record(X, interface) -> - Fd = ic_genobj:stubfiled(G), - NocType = getNocType(G,X,N), - - foreach(fun({Name, Body}) -> - ic_codegen:comment(Fd, "Exports from ~p", - [ic_util:to_colon(Name)]), - ic_codegen:export(Fd, exp_top(G, N, Body, NocType, [])), - nl(Fd) - end, X#interface.inherit_body), - - case transparent(G) of - true -> - nl(Fd), nl(Fd); - _XTuple -> - ic_codegen:comment(Fd, "Type identification function"), - ic_codegen:export(Fd, [{typeID, 0}]), - nl(Fd), - ic_codegen:comment(Fd, "Used to start server"), - ic_codegen:export(Fd, [{start, 2},{start_link, 3}]), - ic_codegen:export(Fd, [{oe_create, 0}, {oe_create_link, 0}, {oe_create, 1}, - {oe_create_link, 1},{oe_create, 2}, {oe_create_link, 2}]), - nl(Fd), - ic_codegen:comment(Fd, "gen server export stuff"), - emit(Fd, "-behaviour(gen_server).\n"), - ic_codegen:export(Fd, [{init, 1}, {terminate, 2}, {code_change, 3}, - {handle_call, 3}, {handle_cast, 2}, {handle_info, 2}]), - nl(Fd), nl(Fd), - ic_codegen:mcomment(Fd, ["Object interface functions."]), - nl(Fd), nl(Fd), nl(Fd) - end, - Fd; - - -gen_head_special(_G, _N, _X) -> ok. - - - -%% Shall generate all export declarations -gen_head(G, N, X) -> - case ic_genobj:is_stubfile_open(G) of - true -> - F = ic_genobj:stubfiled(G), - ic_codegen:comment(F, "Interface functions"), - ic_codegen:export(F, exp_top(G, N, X, getNocType(G,X,N), [])), - nl(F), - gen_head_special(G, N, X); - false -> ok - end. - -exp_top(_G, _N, X, _NT, Acc) when element(1, X) == preproc -> - Acc; -exp_top(G, N, L, NT, Acc) when is_list(L) -> - exp_list(G, N, L, NT, Acc); -exp_top(G, N, M, NT, Acc) when is_record(M, module) -> - exp_list(G, N, get_body(M), NT, Acc); -exp_top(G, N, I, NT, Acc) when is_record(I, interface) -> - exp_list(G, N, get_body(I), NT, Acc); -exp_top(G, N, X, NT, Acc) -> - exp3(G, N, X, NT, Acc). - -exp3(_G, _N, C, _NT, Acc) when is_record(C, const) -> - [{get_id(C#const.id), 0} | Acc]; - -exp3(G, N, Op, NocType, Acc) when is_record(Op, op) -> - FuncName = get_id(Op#op.id), - - TA = case use_timeout(G,N,Op) of - true -> - 1; - false -> - 0 - end, - - case NocType of - transparent -> - Arity = length(ic:filter_params([in, inout], Op#op.params)) + TA + 1, - [{FuncName, Arity} | Acc]; - multiple -> - case getModType(G, Op, N) of - dt -> - Arity = length(ic:filter_params([in, inout], Op#op.params)) + TA + 1, - [{FuncName, Arity} | Acc]; - do -> - Arity = length(ic:filter_params([in, inout], Op#op.params)) + TA + 1, - [{FuncName, Arity} | Acc]; - spt -> - Arity = length(ic:filter_params([in, inout], Op#op.params)) + TA + 1, - [{FuncName, Arity} | Acc]; - spo -> - Arity = length(ic:filter_params([in, inout], Op#op.params)) + TA + 1, - [{FuncName, Arity} | Acc] - end; - _ -> - Arity = length(ic:filter_params([in, inout], Op#op.params)) + TA + 1, - [{FuncName, Arity} | Acc] - end; -exp3(_G, _N, A, _NT, Acc) when is_record(A, attr) -> - lists:foldr(fun(Id, Acc2) -> - {Get, Set} = mk_attr_func_names([], get_id(Id)), - case A#attr.readonly of - {readonly, _} -> [{Get, 1} | Acc2]; - _ -> [{Get, 1}, {Set, 2} | Acc2] - end end, Acc, ic_forms:get_idlist(A)); - -exp3(_G, _N, _X, _NT, Acc) -> Acc. - -exp_list(G, N, L, NT, OrigAcc) -> - lists:foldr(fun(X, Acc) -> exp3(G, N, X, NT, Acc) end, OrigAcc, L). - - - - -%%------------------------------------------------------------ -%% -%% Emit stuff -%% -%% Low level generation primitives -%% - -emit_stub_func(G, N, X, Name, ArgNames, TypeList, _OutArgs) -> - case ic_genobj:is_stubfile_open(G) of - false -> ok; - true -> - Fd = ic_genobj:stubfiled(G), - StubName = list_to_atom(Name), - This = mk_name(G, "Ref"), - XTuple = getNocType(G,X,N), - CallOrCast = - case is_oneway(X) of - true -> ?CAST; - _ -> ?CALL - end, - - %% Type expand operation on comments - ic_code:type_expand_op(G,N,X,Fd), - - case use_timeout(G,N,X) of - true -> - Timeout = mk_name(G,"Timeout"), - emit(Fd, "~p(~s) ->\n", - [StubName, mk_list([This, Timeout| ArgNames])]), - emit(Fd, " ~p:~s(~s, ~s, ?MODULE, ~p, ~p, [~s], ~p).\n\n", - [getImplMod(G,X,N), - CallOrCast, - This, - Timeout, - XTuple, - StubName, - mk_list(ArgNames), - tk_operation_data(G, N, X, TypeList)]); - false -> - emit(Fd, "~p(~s) ->\n", - [StubName, mk_list([This | ArgNames])]), - - emit(Fd, " ~p:~s(~s, ~p, ?MODULE, ~p, [~s], ~p).\n\n", - [getImplMod(G,X,N), - CallOrCast, - This, - XTuple, - StubName, - mk_list(ArgNames), - tk_operation_data(G, N, X, TypeList)]) - end - end. - - -emit_transparent_func(G, N, X, Name, ArgNames, _TypeList, _OutArgs) -> - case ic_genobj:is_stubfile_open(G) of - false -> ok; - true -> - Fd = ic_genobj:stubfiled(G), - OpName = list_to_atom(Name), - - ArgList = case use_timeout(G,N,X) of - true -> - mk_list([mk_name(G,"Ref"),mk_name(G,"Timeout")|ArgNames]); - false -> - mk_list([mk_name(G,"Ref")|ArgNames]) - end, - - %% Type expand operation on comments - ic_code:type_expand_op(G,N,X,Fd), - - emit(Fd, "~p(~s) ->\n", [OpName,ArgList]), - emit(Fd, " ~p:~s(~s).\n\n", [getImplMod(G,X,N), OpName, ArgList]) - end. - - - - - - -emit_skel_func(G, N, X, OpName, ArgNames, _TypeList, _OutArgs) -> - case getNocType(G,X,N) of - transparent -> - true; - multiple -> - true; - XTuple -> - case ic_genobj:is_stubfile_open(G) of - false -> ok; - true -> - Fd = ic_genobj:stubfiled(G), - Name = list_to_atom(OpName), - This = mk_name(G, "Ref"), - From = mk_name(G, "From"), - State = mk_name(G, "State"), - - %% Type expand handle operation on comments - ic_code:type_expand_handle_op(G,N,X,Fd), - - case is_oneway(X) of - true -> - emit(Fd, "handle_cast({~s, ~p, OE_Module, ~p, [~s]}, ~s) ->\n", - [This, XTuple, Name, mk_list(ArgNames), State]), - emit(Fd, " ~p:handle_cast({~s, ~p, OE_Module, ~p, [~s]}, ~s);\n\n", - [getImplMod(G,X,N), This, XTuple, Name, mk_list(ArgNames), State]); - false -> - emit(Fd, "handle_call({~s, ~p, OE_Module, ~p, [~s]}, ~s, ~s) ->\n", - [This, XTuple, Name, mk_list(ArgNames), From, State]), - emit(Fd, " ~p:handle_call({~s, ~p, OE_Module, ~p, [~s]}, ~s, ~s);\n\n", - [getImplMod(G,X,N), This, XTuple, Name, mk_list(ArgNames), From, State]) - end - end - end. - - - -emit_constant_func(G, Id, Val) -> - case ic_genobj:is_stubfile_open(G) of - false -> ok; - true -> - Fd = ic_genobj:stubfiled(G), - N = list_to_atom(get_id(Id)), - emit_const_comment(G, Fd, Id, N), - emit(Fd, "~p() -> ~p.\n\n", [N, Val]) - end. - - -emit_const_comment(_G, F, _X, Name) -> - ic_codegen:mcomment_light(F, - [io_lib:format("Constant: ~p", [Name])]). - -%%------------------------------------------------------------ -%% -%% Utilities -%% -%% Convenient little go-get functions -%% -%%------------------------------------------------------------ - -%% The automaticly generated get and set operation names for an -%% attribute. -mk_attr_func_names(_Scope, Name) -> - {"_get_" ++ Name, "_set_" ++ Name}. - -%% Returns TK of the Get and Set attribute functions. -mk_attr_func_types(_N, X) -> - TK = ic_forms:get_tk(X), - {{TK, [], []}, {tk_void, [TK], []}}. - - - -%%------------------------------------------------------------ -%% -%% Generation utilities and common stuff -%% -%% Convenient stuff for generation -%% -%%------------------------------------------------------------ - - -%% Input is a list of parameters (in parse form) and output is a list -%% of capitalised variable names. mk_var is in icgen -mk_erl_vars(_G, Params) -> - map(fun(P) -> mk_var(get_id(P#param.id)) end, Params). - - -%% mk_list produces a nice comma separated string of variable names -mk_list([]) -> []; -mk_list([Arg | Args]) -> - Arg ++ mk_list2(Args). -mk_list2([Arg | Args]) -> - ", " ++ Arg ++ mk_list2(Args); -mk_list2([]) -> []. - - -%%------------------------------------------------------------ -%% -%% Parser utilities -%% -%% Called from the yecc parser. Expands the identifier list of an -%% attribute so that the attribute generator never has to handle -%% lists. -%% -%%------------------------------------------------------------ - - -%% Unfold identifier lists or nested lists. Note that many records -%% contain an entry named id that is a list before unfold and a single -%% id afterwards. -unfold(L) when is_list(L) -> - lists:flatten(map(fun(X) -> unfold2(X) end, L)); -unfold(X) -> unfold2(X). - -unfold2(A) when is_record(A, attr) -> - map(fun(Id) -> A#attr{id=Id} end, A#attr.id); -unfold2(M) when is_record(M, member) -> - map(fun(Id) -> M#member{id=Id} end, M#member.id); -unfold2(M) when is_record(M, case_dcl) -> - map(fun(Id) -> M#case_dcl{label=Id} end, M#case_dcl.label); -unfold2(T) when is_record(T, typedef) -> - map(fun(Id) -> T#typedef{id=Id} end, T#typedef.id ). - - - - - - -%% Export code produce for dependency function -exportDependency(G) -> - Fd = ic_genobj:stubfiled(G), - ic_codegen:export(Fd, [{oe_dependency, 0}]), - nl(Fd). - -%% Code produce for dependency function -genDependency(G) -> - Fd = ic_genobj:stubfiled(G), - nl(Fd),nl(Fd), - ic_codegen:comment(Fd, "Idl file dependency list function"), - emit(Fd, "oe_dependency() ->\n", []), - emit(Fd, " ~p.\n\n", [ic_pragma:get_dependencies(G)]). - - - - - -%%%%%% - - -getImplMod(G,X,Scope) -> %% to_atom(ic_genobj:impl(G)) | ChoicedModuleName - - %% Get actual pragma appliance scope - SpecScope = getActualScope(G,X,Scope), - - %% The "broker" option is passed - %% only by pragmas, seek for module. - case ic_pragma:getBrokerData(G,X,SpecScope) of - {Module,_Type} -> - Module; - _List -> - element(1,ic_pragma:defaultBrokerData(G)) - end. - - -getNocType(G,X,Scope) when is_record(X, interface) -> %% default | specified - OpList = getAllOperationScopes(G,Scope), - getNocType2(G,X,OpList); -getNocType(G,X,Scope) -> %% transparent | {extraarg1,....,extraargN} - getNocType3(G,X,Scope). - -getNocType2(G,X,List) -> - getNocType2(G,X,List,[]). - -getNocType2(_,_,[],Found) -> - selectTypeFromList(Found); -getNocType2(G,X,[OpScope|OpScopes],Found) -> - getNocType2(G,X,OpScopes,[getNocType3(G,X,OpScope)|Found]). - -getNocType3(G,X,Scope) -> %% transparent | {extraarg1,....,extraargN} - - %% Get actual pragma appliance scope - SpecScope = getActualScope(G,X,Scope), - - %% The "broker" option is passed - %% only by pragmas, seek for type. - case ic_pragma:getBrokerData(G,X,SpecScope) of - {_Module,Type} -> - Type; - List -> - selectTypeFromList(List) %%transparent/multiple - end. - - -getModType(G,X,Scope) -> %% default | specified - - %% Get actual pragma appliance scope - SpecScope = getActualScope(G,X,Scope), - - %% The "broker" option is passed - %% only by pragmas, seek for brokerdata. - case ic_pragma:getBrokerData(G,X,SpecScope) of - {Module,Type} -> - case Module == ic_genobj:impl(G) of - true -> - case Type of - transparent -> - dt; %% default + transparent - _ -> - do %% default + opaque - end; - false -> - case Type of - transparent -> - spt; %% specified + transparent - _ -> - spo %% specified + opaque - end - end; - _List -> - dt - end. - - - -%%%% -%% -%% Returns a list of ALL operation full -%% scoped names local and inherited -%% from other interfaces -%% - -getAllOperationScopes(G,Scope) -> - getOperationScopes(G,Scope) ++ - getInhOperationScopes(G,Scope). - - -getOperationScopes(G,Scope) -> - getOpScopes(G, - Scope, - ets:match(ic_genobj:pragmatab(G),{op,'$0',Scope,'_','_'}), - []). - -getOpScopes(_,_,[],OpScopes) -> - OpScopes; -getOpScopes(G,Scope,[[Name]|Names],Found) -> - getOpScopes(G,Scope,Names,[[Name|Scope]|Found]). - - -getInhOperationScopes(G,Scope) -> - getInhOpScopes1(G, - Scope, - ets:match(ic_genobj:pragmatab(G),{inherits,Scope,'$1'}), - []). - -getInhOpScopes1(G,_Scope,[],OpScopes) -> - getInhOpScopes2(G,OpScopes); -getInhOpScopes1(G,Scope,[[SC]|SCs],Found) -> - getInhOpScopes1(G,Scope,SCs,[SC|Found]). - - -getInhOpScopes2(G,Scopes) -> - getInhOpScopes2(G,Scopes,[]). - -getInhOpScopes2(_G,[],Found) -> - Found; -getInhOpScopes2(G,[SC|SCs],Found) -> - getOperationScopes(G,SC) ++ getInhOpScopes2(G,SCs,Found). - -%% -%% -%%%% - - - -%%%% -%% -%% -%% Seek the actual operation scope : -%% -%% * if the operation is inherited, get the real scope for it -%% -%% * if the operation has a specific pragma, apply the real -%% scope, otherwise return the including scope -%% -getActualScope(G, X, Scope) when is_record(X, op) -> - OpScope = getRealOpScope(G,X,Scope), - case ets:match(ic_genobj:pragmatab(G),{codeopt_specific,OpScope}) of - [[]] -> - OpScope; - _ -> - Scope - end; -getActualScope(_G, _X, N) -> - N. - -%% -%% Just seek and return the scope for the operation -%% where it were originaly defined -%% -getRealOpScope(G,X,N) when is_record(X, op) -> - Ptab = ic_genobj:pragmatab(G), - Id = get_id2(X), - - case ets:match(Ptab,{op,Id,N,'_','_'}) of - [[]] -> - [Id|N]; - _ -> - getRealOpScope(G, Ptab, X, N, Id, ets:match(Ptab,{inherits,N,'$1'})) - end; -getRealOpScope(_G,_X,N) -> - N. - -getRealOpScope(_G, _S, _X, N, Id, []) -> - [Id|N]; -getRealOpScope(G, S, X, N, Id, [[OS]|OSs]) -> - case ets:match(S,{op,Id,OS,'_','_'}) of - [[]] -> - [Id|OS]; - _ -> - getRealOpScope(G, S, X, N, Id, OSs) - end. - -selectTypeFromList([]) -> - transparent; -selectTypeFromList([{_,transparent}|Rest]) -> - selectTypeFromList(Rest); -selectTypeFromList([transparent|Rest]) -> - selectTypeFromList(Rest); -selectTypeFromList([_|_Rest]) -> - multiple. - - - -getCallErr() -> - {'ERROR' ,"Bad Operation -- handle call"}. - -getCastErr() -> - {'ERROR' ,"Bad Operation -- handle cast"}. - -getInfoErr() -> - {'ERROR' ,"Bad Operation -- handle info"}. - - - - - - -%% -%% Type code access utilities -%% - -tk_operation_data(G, N, X, TL) -> - case print_tk(G,N,X) of - true -> - TL; - false -> - no_tk - end. - -tk_interface_data(G, N, X) -> - InfoList = - foldr(fun({_Name, Body}, Acc) -> - get_if(G,N,Body)++Acc end, - get_if(G,N,get_body(X)), - X#interface.inherit_body), - case InfoList of - [] -> - no_tk; %%%%%%%% Should be changed to [] <<<<<<<<<<<<<<<<<<<<<<<<<<< Warning ! - _ -> - InfoList - end. - - -print_tk(G, N, X) when is_record(X, op)-> %% operation - case getNocType(G,X,N) of - transparent -> - false; - multiple -> - false; - _XTuple -> %%check if there are any USETK pragmas - operation_usetk(G,N,X) - end; -print_tk(_G, _N, _X) -> %% error - false. - - -operation_usetk(G,N,X) -> - PTab = ic_genobj:pragmatab(G), - OTab = ic_genobj:optiontab(G), - OpName = get_id2(X), -% SID = ic_util:to_colon(N), - Res = case use_tk(OTab,[N]) of - {ok,N} -> - true; - false -> - %% Look if there is an operation with that name - %% which can be found in an included file. - case ets:match(PTab,{file_data_included,'_','_',op,'$3',OpName,'_','_','_'}) of - [] -> - false; - ScopeList -> - case use_tk(OTab,ScopeList) of - %% There is an operation with that name, - %% look if it is inherited by interface "N" - {ok,FoundScope} -> - ic_pragma:is_inherited_by(FoundScope,N,PTab); - false -> - false - end - end - end, - Res. - - -use_tk(_,[]) -> - false; -use_tk(OTab,[[Scope]|Scopes]) -> - SID = ic_util:to_colon(Scope), - case ets:match(OTab,{{option,{use_tk,SID}},true}) of - [] -> - case ets:match(OTab,{{option,{use_tk,"::"++SID}},true}) of - [] -> - use_tk(OTab,Scopes); - _ -> - {ok,Scope} - end; - _ -> - {ok,Scope} - end; -use_tk(OTab,[Scope|Scopes]) -> - SID = ic_util:to_colon(Scope), - case ets:match(OTab,{{option,{use_tk,SID}},true}) of - [] -> - case ets:match(OTab,{{option,{use_tk,"::"++SID}},true}) of - [] -> - use_tk(OTab,Scopes); - _ -> - {ok,Scope} - end; - _ -> - {ok,Scope} - end. - - - - - -mark_not_transparent(G,N) -> - - %% Mark that there are multiple - %% functions in interface - S = ic_genobj:pragmatab(G), - ets:insert(S,{no_transparent,N}). - - -transparent(G) -> - - S = ic_genobj:pragmatab(G), - case ets:match_object(S,{no_transparent,'$0'}) of - [] -> - true; - _ -> - false - end. - diff --git a/lib/ic/src/ic_options.erl b/lib/ic/src/ic_options.erl deleted file mode 100644 index d7f56c0d46..0000000000 --- a/lib/ic/src/ic_options.erl +++ /dev/null @@ -1,364 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(ic_options). - --include_lib("ic/src/ic.hrl"). --include_lib("kernel/include/file.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([defaultBe/0, float_to_version/1, get_opt/2, add_opt/3, - read_cfg/2, which_opts/1, allowed_opt/2]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- - -%%-------------------------------------------------------------------- -%% -%% Option handling -%% -%% Valid options are: (those with * is NotYetImpl) -%% -%% pedantic - makes the compiler really nitty-gritty about its input -%% -%% Wall - those warning options that we feel an IDL programmer should -%% care about. Not as picky as pedantic -%% -%% warn_multi_mod - warn if several modules are declared in the same -%% IDL file -%% -%% warn_nested_mod - warn if there are nested modules. This is not a -%% problem but it breakes the rule that modules are put into one file -%% each. -%% -%% warn_name_shadow - warn if identifiers are shadow through inherited -%% interfaces. Default is true. -%% -%% warn_quoted_atom - warn if atoms needs quote, this makes Erlang -%% code less nice but is certainly no error. -%% -%% nowarn - suppress all warning messages. Will still output warnings -%% if silent2 option is used -%% -%% always_outargs - force object server implementation return the -%% tuple {RetVal, OutArgs, NewState} even if there are no OutArgs. If -%% this option is not set then such an operation implementation is -%% assumed to return {RetVal, NewState} -%% -%% use_proc_dict - use the process dictionary in the client -%% stubs. This means that client stubs return RetVal instead of {ok, -%% RetVal, OutArgs} and that corba:get_outargs() returns OutArgs. The -%% out arguments are stored with the key '$corba_outargs'. -%% -%% module_group - use the top module as file name for both skeletons -%% and stubs. Default value is false which means that each interface -%% is put in a separate file. -%% -%% skel_module_group - group all interfaces in a module in one -%% skeleton file as opposed to one skeleton file for each -%% interface. Defaults to false. -%% -%% stub_module_group - group all interface stubs from a module in one -%% stub file as opposed to one stub file for each interface. Default -%% is false. -%% -%% *help - prints a small summary of the compiler usage -%% -%% silent - suppresses all messages from the compiler -%% -%% silent2 - suppresses all messages from the compiler and returns all -%% warnings or errors as lists. Returns {ok, WarnList} or {error, -%% WarnList, ErrList} -%% -%% *noexec - runs the compiler but does not open files or write to -%% files. -%% -%% {serv, } - sets the name of the implementation skeleton -%% file. This defaults to ModName_skel. -%% -%% {impl, } - sets the name of the interface server -%% implementation module name. This defaults to InterfaceName_impl -%% -%% {outdir, Dir} - use Dir as the directory to put all generated -%% files. -%% -%% {servdir, Dir} - put all generated skel files in the directory Dir. -%% -%% {stubdir, Dir} - put all generated stub files in the directory Dir. -%% -%% {this, InterfaceOrOpName} - puts the OE_THIS parameter into the -%% impl. call. This option can be used both on whole interfaces an on -%% distinct operations. Fullscoped names must be used (as in {this, -%% "M1::I1::Op"}). The option can be given in 3 ways: {this, Name} -%% means this will be added to all matching Name or as {{this, Name}, -%% true} or this can explicitly be asked to be left out as in {{this, -%% Name}, false} which enables OE_THIS to be passed to all ops of an -%% interface except those set by the false flag. -%% -%% cfgfile - sets the name of the config file that is read at -%% startup. The order of the different ways to set options is: default -%% setting, configuration file, options given when generator is -%% called. Default name for this file is .ic_config -%% -%% serv_last_call - tells what the last handle_call clause should -%% do. It can have the values exception, which makes the last clause -%% return a CORBA exception and exit which does not generate a last clause -%% (which will make the server crash on an unknown call) -%% -%% -%% -- UNDOCUMENTED -- -%% -%% debug - prints debug information -%% -%% tokens - prints the tokens from the tokenizer and then exit -%% -%% form - prints the form from the parser and then exit -%% -%% tform - form returned from type check -%% -%% time - if true then time is measured during compilation -%% -%% -%%-------------------------------------------------------------------- -allowed_opt(default_opts, _V) -> true; -allowed_opt(debug, V) -> is_bool(V); -allowed_opt(tokens, V) -> is_bool(V); -allowed_opt(form, V) -> is_bool(V); -allowed_opt(tform, V) -> is_bool(V); -allowed_opt(time, V) -> is_bool(V); -allowed_opt(maxerrs, V) -> is_intorinfinity(V); -allowed_opt(maxwarns, V) -> is_intorinfinity(V); -allowed_opt(nowarn, V) -> is_bool(V); -allowed_opt(show_opts, V) -> is_bool(V); - -allowed_opt(help, V) -> is_bool(V); -allowed_opt('Wall', V) -> is_bool(V); -allowed_opt(warn_multi_mod, V) -> is_bool(V); -allowed_opt(warn_quoted_atom, V) -> is_bool(V); -allowed_opt(warn_nested_mod, V) -> is_bool(V); -allowed_opt(warn_name_shadow, V) -> is_bool(V); -allowed_opt(module_group, V) -> is_bool(V); -allowed_opt(skel_module_group, V) -> is_bool(V); -allowed_opt(stub_module_group, V) -> is_bool(V); -allowed_opt(always_outargs, V) -> is_bool(V); -allowed_opt(pedantic, V) -> is_bool(V); -%%allowed_opt(gen_serv, V) -> is_bool(V); -%%allowed_opt(gen_stub, V) -> is_bool(V); -allowed_opt(gen_hrl, V) -> is_bool(V); -allowed_opt(serv_last_call, exception) -> true; -allowed_opt(serv_last_call, exit) -> true; -allowed_opt(silent, V) -> is_bool(V); -allowed_opt(silent2, V) -> is_bool(V); -allowed_opt({serv, _}, _V) -> true; -allowed_opt({impl, _}, _V) -> true; -allowed_opt(outdir, _V) -> true; -allowed_opt(servdir, _V) -> true; -allowed_opt(stubdir, _V) -> true; -allowed_opt(cfgfile, _V) -> true; -allowed_opt(use_preproc, V) -> is_bool(V); -allowed_opt(preproc_cmd, _V) -> true; -allowed_opt(preproc_flags, _V) -> true; -allowed_opt(this, _V) -> true; -allowed_opt({this, _}, V) -> is_bool(V); -allowed_opt(from, _V) -> true; -allowed_opt({from, _}, V) -> is_bool(V); -allowed_opt(handle_info, _V) -> true; -allowed_opt({handle_info, _}, V) -> is_bool(V); -allowed_opt(timeout, _V) -> true; -allowed_opt({timeout, _}, V) -> is_bool(V); -allowed_opt(c_timeout, {V1, V2}) -> is_int(V1) and is_int(V2); -allowed_opt(c_timeout, V) -> is_int(V); -allowed_opt(c_report, V) -> is_bool(V); -allowed_opt(scoped_op_calls, V) -> is_bool(V); -% Compatibility option (semantic check limitation) -allowed_opt(scl, V) -> is_bool(V); -% Added switches for non corba generation -allowed_opt(flags, V) -> is_int(V); -allowed_opt(be, erl_corba) -> true; -allowed_opt(be, erl_template) -> true; -allowed_opt(be, erl_genserv) -> true; -allowed_opt(be, c_genserv) -> true; -allowed_opt(be, erl_plain) -> true; -allowed_opt(be, c_server) -> true; -allowed_opt(be, c_client) -> true; -allowed_opt(be, java) -> true; -% Noc backend -allowed_opt(be, noc) -> true; -allowed_opt({broker,_},{_,transparent}) -> true; -allowed_opt({broker,_},{_,Term}) -> is_term(Term); -allowed_opt({use_tk,_},V) -> is_bool(V); -% -% Multiple be -allowed_opt(multiple_be, _List) -> true; -% -allowed_opt(precond, {_M, _F}) -> true; -allowed_opt({precond, _}, {_M, _F}) -> true; -allowed_opt(postcond, {_M, _F}) -> true; -allowed_opt({postcond, _}, {_M, _F}) -> true; -allowed_opt(no_codechange, V) -> is_bool(V); -allowed_opt(user_protocol, _V) -> true; -allowed_opt(light_ifr, V) -> is_bool(V); -allowed_opt(_, _) -> false. - - --define(DEFAULTCFGFILE, ".ic_config"). - -which_opts(G) -> - ets:match(G#genobj.options, {{option, '$1'}, '$2'}). - -add_opt(G, KList, Val) when is_list(KList) -> - lists:foreach(fun({K, V}) -> add_opt(G, K, V); - (K) -> add_opt(G, K, Val) end, - KList); - -add_opt(G, servdir, V) -> - do_add_opt(G, servdir, assure_directory(G, ic_util:to_list(V))); -add_opt(G, stubdir, V) -> - do_add_opt(G, stubdir, assure_directory(G, ic_util:to_list(V))); -add_opt(G, K, V) -> - do_add_opt(G, K, V). - - -assure_directory(_G, Dir) -> - Dirs = filename:split(Dir), - check_dirs(Dirs, [], filename:pathtype(Dir)). - -check_dirs([X | Xs], SoFar, Type) -> - New = if SoFar == [], Type /= absolute -> - X; - true -> - filename:join(SoFar, X) - end, - assert_dir(New), - check_dirs(Xs, New, Type); -check_dirs([], SoFar, _Type) -> - SoFar. - -assert_dir(D) -> - case file:read_file_info(D) of - {ok, X} when X#file_info.type == directory -> ok; - _ -> case file:make_dir(D) of - ok -> ok; - _ -> exit({could_not_create, D}) - end - end. - -do_add_opt(G, handle_info, V) -> - ?insert(G#genobj.options, {option, {handle_info, V}}, true); -do_add_opt(G, {handle_info, V}, false) -> - ?insert(G#genobj.options, {option, {handle_info, V}}, force_false); -do_add_opt(G, timeout, V) -> - ?insert(G#genobj.options, {option, {timeout, V}}, true); -do_add_opt(G, {timeout, V}, false) -> - ?insert(G#genobj.options, {option, {timeout, V}}, force_false); -do_add_opt(G, this, V) -> - ?insert(G#genobj.options, {option, {this, V}}, true); -do_add_opt(G, {this, V}, false) -> - ?insert(G#genobj.options, {option, {this, V}}, force_false); -do_add_opt(G, from, V) -> - ?insert(G#genobj.options, {option, {from, V}}, true); -do_add_opt(G, {from, V}, false) -> - ?insert(G#genobj.options, {option, {from, V}}, force_false); -do_add_opt(G, scoped_op_calls, V) when V /= true, V /= false -> - ?insert(G#genobj.options, {option, {scoped_op_calls, V}}, false); -do_add_opt(G, K, V) -> - case allowed_opt(K, V) of - true -> - case expand_opt(K) of - L when is_list(L) -> - add_opt(G, L, V); - _ -> - %%io:format("Add opt: ~p ~p~n", [K, V]), - ?insert(G#genobj.options, {option, K}, V) - end; - _ -> - ic_error:warn(G, {illegal_opt, K}) - end. - -get_opt(G, K) -> - case ets:lookup(G#genobj.options, {option, K}) of - [] -> false; - [{{_, K}, V}] -> V - end. - -expand_opt(pedantic) -> [warn_multi_mod, warn_quoted_atom, always_outargs]; -expand_opt(module_group) -> [skel_module_group, stub_module_group]; -expand_opt('Wall') -> [warn_multi_mod, warn_nested_mod, warn_name_shadow]; -expand_opt(outdir) -> [servdir, stubdir]; -expand_opt(default_opts) -> - ['Wall', gen_hrl, {serv_last_call, exception}, - {outdir, []}, use_preproc, {preproc_cmd, "erl"}, - {preproc_flags, ""}, {maxerrs, 10}, {maxwarns, infinity}]; -%% gcc preproc command {preproc_cmd, "gcc -x c++ -E"} -expand_opt(Opt) -> Opt. - - -%% Use this if user not provide -%% a backend. -defaultBe() -> erl_corba. - - -%% -%% Read any config file -read_cfg(G, Opts) -> - Name = case lists:keysearch(cfgfile, 1, Opts) of - {value, {_, N}} -> ic_util:to_list(N); - _ -> ?DEFAULTCFGFILE - end, - case file:consult(Name) of - {ok, OptList} -> - add_opt(G, OptList, true); - _X when Name == ?DEFAULTCFGFILE -> ok; -%% {error, X} -> -%% ic_error:warn(G, {cfg_open, X, Name}); - X -> ic_error:warn(G, {cfg_open, X, Name}) - end. - - -float_to_version({_,_,Str}) -> Str. - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- -is_bool(true) -> true; -is_bool(false) -> true; -is_bool(_) -> false. - -is_int(V) when is_integer(V) -> true; -is_int(_) -> false. - -is_intorinfinity(X) when is_integer(X) -> true; -is_intorinfinity(infinity) -> true; -is_intorinfinity(_X) -> false. - - -is_term(Term) when is_tuple(Term) -> true; -is_term(_NoTerm) -> false. - diff --git a/lib/ic/src/ic_plainbe.erl b/lib/ic/src/ic_plainbe.erl deleted file mode 100644 index 6875c1314e..0000000000 --- a/lib/ic/src/ic_plainbe.erl +++ /dev/null @@ -1,356 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(ic_plainbe). - - --export([do_gen/3]). -%%------------------------------------------------------------ -%% -%% Internal stuff -%% -%%------------------------------------------------------------ - --import(ic_util, [mk_var/1, mk_oe_name/2, to_atom/1, to_list/1]). --import(ic_forms, [get_id/1, get_id2/1, get_body/1]). --import(ic_codegen, [emit/3, nl/1]). - --import(lists, [foreach/2, map/2]). - --include("icforms.hrl"). --include("ic.hrl"). - -%%------------------------------------------------------------ -%% -%% Generate the client side Erlang stubs. -%% -%% Each module is generated to a separate file. -%% -%% Export declarations for all interface functions must be -%% generated. Each function then needs to generate a function head and -%% a body. IDL parameters must be converted into Erlang parameters -%% (variables, capitalised) and a type signature list must be -%% generated (for later encode/decode). -%% -%%------------------------------------------------------------ - - -do_gen(G, File, Form) -> - G2 = ic_file:filename_push(G, [], mk_oe_name(G, - ic_file:remove_ext(to_list(File))), - erlang), - gen_head(G2, [], Form), - exportDependency(G2), - gen(G2, [], Form), - genDependency(G2), - ic_file:filename_pop(G2, erlang), - ok. - - -gen(G, N, [X|Xs]) when is_record(X, preproc) -> - NewG = ic:handle_preproc(G, N, X#preproc.cat, X), - gen(NewG, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, module) -> - CD = ic_code:codeDirective(G,X), - G2 = ic_file:filename_push(G, N, X, CD), - N2 = [get_id2(X) | N], - gen_head(G2, N2, X), - gen(G2, N2, get_body(X)), - G3 = ic_file:filename_pop(G2, CD), - gen(G3, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, interface) -> - %% Add inheritence data to pragmatab - ic_pragma:add_inh_data(G,N,X), - G2 = ic_file:filename_push(G, N, X, erlang), - N2 = [get_id2(X) | N], - gen_head(G2, N2, X), - gen(G2, N2, get_body(X)), - foreach(fun({_Name, Body}) -> gen(G2, N2, Body) end, - X#interface.inherit_body), - G3 = ic_file:filename_pop(G2, erlang), - gen(G3, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, const) -> -% N2 = [get_id2(X) | N], - emit_constant_func(G, X#const.id, X#const.val), - gen(G, N, Xs); %% N or N2? - -gen(G, N, [X|Xs]) when is_record(X, op) -> - {Name, ArgNames, TypeList, OutArgs} = extract_info(G, N, X), - emit_func(G, N, X, Name, ArgNames, TypeList, OutArgs), - gen(G, N, Xs); - - -gen(G, N, [X|Xs]) when is_record(X, attr) -> - emit_attr(G, N, X, fun emit_func/7), - gen(G, N, Xs); - -gen(G, N, [X|Xs]) when is_record(X, except) -> - icstruct:except_gen(G, N, X, erlang), - gen(G, N, Xs); - -gen(G, N, [X|Xs]) -> - case may_contain_structs(X) of - true -> icstruct:struct_gen(G, N, X, erlang); - false -> ok - end, - gen(G, N, Xs); - -gen(_G, _N, []) -> ok. - - -may_contain_structs(X) when is_record(X, typedef) -> true; -may_contain_structs(X) when is_record(X, struct) -> true; -may_contain_structs(X) when is_record(X, union) -> true; -may_contain_structs(_X) -> false. - - -%%------------------------------------------------------------ -%% -%% Export stuff -%% -%% Gathering of all names that should be exported from a stub -%% file. -%% - - -gen_head_special(G, N, X) when is_record(X, interface) -> - Fd = ic_genobj:stubfiled(G), - - foreach(fun({Name, Body}) -> - ic_codegen:comment(Fd, "Exports from ~p", - [ic_util:to_colon(Name)]), - ic_codegen:export(Fd, exp_top(G, N, Body, [])), - nl(Fd) - end, X#interface.inherit_body), - Fd; -gen_head_special(_G, _N, _X) -> ok. - - - -%% Shall generate all export declarations -gen_head(G, N, X) -> - case ic_genobj:is_stubfile_open(G) of - true -> - F = ic_genobj:stubfiled(G), - ic_codegen:comment(F, "Interface functions"), - ic_codegen:export(F, exp_top(G, N, X, [])), - nl(F), - gen_head_special(G, N, X); - false -> ok - end. - -exp_top(_G, _N, X, Acc) when element(1, X) == preproc -> - Acc; -exp_top(G, N, L, Acc) when is_list(L) -> - exp_list(G, N, L, Acc); -exp_top(G, N, M, Acc) when is_record(M, module) -> - exp_list(G, N, get_body(M), Acc); -exp_top(G, N, I, Acc) when is_record(I, interface) -> - exp_list(G, N, get_body(I), Acc); -exp_top(G, N, X, Acc) -> - exp3(G, N, X, Acc). - -exp3(_G, _N, C, Acc) when is_record(C, const) -> - [{get_id(C#const.id), 0} | Acc]; - -exp3(_G, _N, Op, Acc) when is_record(Op, op) -> - FuncName = get_id(Op#op.id), - Arity = length(ic:filter_params([in, inout], Op#op.params)), - [{FuncName, Arity} | Acc]; - -exp3(_G, _N, A, Acc) when is_record(A, attr) -> - lists:foldr(fun(Id, Acc2) -> - {Get, Set} = mk_attr_func_names([], get_id(Id)), - case A#attr.readonly of - {readonly, _} -> [{Get, 1} | Acc2]; - _ -> [{Get, 1}, {Set, 2} | Acc2] - end end, Acc, ic_forms:get_idlist(A)); - -exp3(_G, _N, _X, Acc) -> Acc. - -exp_list(G, N, L, OrigAcc) -> - lists:foldr(fun(X, Acc) -> exp3(G, N, X, Acc) end, OrigAcc, L). - - - - -%%------------------------------------------------------------ -%% -%% Emit stuff -%% -%% Low level generation primitives -%% - - -emit_func(G, _N, X, Name, ArgNames, _TypeList, OutArgs) -> - case ic_genobj:is_stubfile_open(G) of - false -> ok; - true -> - Fd = ic_genobj:stubfiled(G), - OpName = list_to_atom(Name), - ArgList = mk_list(ArgNames), - emit_op_comment(G, Fd, X, OpName, ArgNames, OutArgs), - emit(Fd, "~p(~s) ->\n", [OpName,ArgList]), - emit(Fd, " ~p:~p(~s).\n\n", [to_atom(ic_genobj:impl(G)), OpName, ArgList]) - end. - -emit_attr(G, N, X, F) -> - XX = #id_of{type=X}, - {GetType, SetType} = mk_attr_func_types(N, X), - lists:foreach(fun(Id) -> - X2 = XX#id_of{id=Id}, - {Get, Set} = mk_attr_func_names(N, get_id(Id)), - F(G, N, X2, Get, [], GetType, []), - case X#attr.readonly of - {readonly, _} -> ok; - _ -> - F(G, N, X2, Set, [ic_util:mk_name(G, "Value")], - SetType, []) - end end, ic_forms:get_idlist(X)). - -emit_constant_func(G, Id, Val) -> - case ic_genobj:is_stubfile_open(G) of - false -> ok; - true -> - Fd = ic_genobj:stubfiled(G), - N = list_to_atom(get_id(Id)), - emit_const_comment(G, Fd, Id, N), - emit(Fd, "~p() -> ~p.\n\n", [N, Val]) - end. - - -emit_const_comment(_G, F, _X, Name) -> - ic_codegen:mcomment_light(F, - [io_lib:format("Constant: ~p", [Name])]). - - -emit_op_comment(G, F, X, Name, InP, OutP) -> - ic_codegen:mcomment_light(F, - [io_lib:format("~s: ~p", [get_title(X), Name]), - "", - get_returns(G, X, InP, OutP) | - get_raises(X)]). - -get_title(X) when is_record(X, attr) -> "Attribute Operation"; -get_title(_X) -> "Operation". - -get_raises(X) when is_record(X, op) -> - if X#op.raises == [] -> []; - true -> - [" Raises: " ++ - mk_list(lists:map(fun(E) -> ic_util:to_colon(E) end, X#op.raises))] - end; -get_raises(_X) -> []. - -get_returns(_G, _X, _InP, []) -> - " Returns: RetVal"; -get_returns(G, _X, _InP, OutP) -> - " Returns: "++mk_list(["RetVal" | mk_erl_vars(G, OutP)]). - - - - -%%------------------------------------------------------------ -%% -%% Utilities -%% -%% Convenient little go-get functions -%% -%%------------------------------------------------------------ - -%% The automaticly generated get and set operation names for an -%% attribute. -mk_attr_func_names(_Scope, Name) -> - {"_get_" ++ Name, "_set_" ++ Name}. - -%% Returns TK of the Get and Set attribute functions. -mk_attr_func_types(_N, X) -> - TK = ic_forms:get_tk(X), - {{TK, [], []}, {tk_void, [TK], []}}. - - - -%%------------------------------------------------------------ -%% -%% Generation utilities and common stuff -%% -%% Convenient stuff for generation -%% -%%------------------------------------------------------------ - - -%% Input is a list of parameters (in parse form) and output is a list -%% of capitalised variable names. mk_var is in icgen -mk_erl_vars(_G, Params) -> - map(fun(P) -> mk_var(get_id(P#param.id)) end, Params). - - -%% mk_list produces a nice comma separated string of variable names -mk_list([]) -> []; -mk_list([Arg | Args]) -> - Arg ++ mk_list2(Args). -mk_list2([Arg | Args]) -> - ", " ++ Arg ++ mk_list2(Args); -mk_list2([]) -> []. - - -%%------------------------------------------------------------ -%% -%% Parser utilities -%% -%% Called from the yecc parser. Expands the identifier list of an -%% attribute so that the attribute generator never has to handle -%% lists. -%% -%%------------------------------------------------------------ - - - - -%% Export code produce for dependency function -exportDependency(G) -> - Fd = ic_genobj:stubfiled(G), - ic_codegen:export(Fd, [{oe_dependency, 0}]), - nl(Fd). - -%% Code produce for dependency function -genDependency(G) -> - Fd = ic_genobj:stubfiled(G), - nl(Fd),nl(Fd), - ic_codegen:comment(Fd, "Idl file dependency list function"), - emit(Fd, "oe_dependency() ->\n", []), - emit(Fd, " ~p.\n\n", [ic_pragma:get_dependencies(G)]). - - - - -extract_info(G, _N, X) when is_record(X, op) -> - Name = get_id2(X), - InArgs = ic:filter_params([in,inout], X#op.params), - OutArgs = ic:filter_params([out,inout], X#op.params), - ArgNames = mk_erl_vars(G, InArgs), - TypeList = {ic_forms:get_tk(X), - map(fun(Y) -> ic_forms:get_tk(Y) end, InArgs), - map(fun(Y) -> ic_forms:get_tk(Y) end, OutArgs) - }, - {Name, ArgNames, TypeList, OutArgs}. diff --git a/lib/ic/src/ic_pp.erl b/lib/ic/src/ic_pp.erl deleted file mode 100644 index 8c2e3a0ffe..0000000000 --- a/lib/ic/src/ic_pp.erl +++ /dev/null @@ -1,2245 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(ic_pp). - --export([run/2]). - --define(is_number(X), X >= $0, X =< $9). --define(is_upper(X), X >= $A, X =< $Z). --define(is_lower(X), X >= $a, X =< $z). --define(is_underline(X), X == $_). --define(is_tab(X), X == 9). --define(is_space(X), X == 32). --define(tab, 9). --define(space, 32). - - -%%====================================================================================== -%%====================================================================================== -%%====================================================================================== -%% Preprocessor -%% -%% This preprocessor is equivalent to the gcc-preprocessor. It takes a file name and -%% a list of preprocessor flags as an input and returns a processed text file. -%% -%% The processing is done in two phases. -%% In the first phase the input file is tokenised into a list where all comments are -%% replaced by a space and all "backslash-newline" sequences are removed. -%% -%% In the second phase all macros are expanded. - -%% %% %% NOTE: #if, #else, and #elif are not yet implemented. -%% Only '#if 0' is implemented to be possible to keep old code as a comment for -%% future refence by putting '#if 0' before it and '#endif' after it. -%% -%%====================================================================================== -%%====================================================================================== -%%====================================================================================== - - -%%====================================================================================== -%% Variables which are used throughout the program: -%% ------------------------------------------------ -%% -%% Command A preprocessor command -%% Current Temporary variable used when tokenising the file -%% Defs The currently valid macro definitions -%% Err The current list of errors = [{file, line number, error text}, ...] -%% File The tokenised file (or what remains of it when expanding the macros) -%% Flags The preprocessor flags -%% FN or FileName Tbe name of the current file -%% IfCou Used for ifdef/ifndef/endif values: check_all | {endif, Endif, IfLine} -%% Endif = number of matching endif's yet to be found -%% Ifline = the line number for the the first found ifdef/ifndef -%% IncDir Directories to be searched for included files -%% IncFile Stack of included files -%% IncLine The line numer of an include -%% L The current line number -%% Name Name of a macro -%% Nl Number of encountered newlines -%% No_of_para Numer of parameters of the currently expanded macro -%% Out The result of the second step -%% Parameters The parameters of the currently expanded macro -%% PrevFile The name of the "parent" file which includes the currently expanded file -%% Rem Remaining of the file currently being expanded -%% Removed The tokens removed, used when removing tokens to the end of a line -%% Result The current result of something -%% SelfRef List of variables which shoud not be expanded at the rescan to avoid -%% endless loops due to self referencing -%% Str Temporary string -%% Text A variable used for string handling, e.g at error handling -%% Tokens Temoprary list when tokenising -%% War The current list of warnings = [{file, line number, warning text}, ...] -%% X Temporary variable used when the value is not important -%% Y Temporary variable used when the value is not important -%% -%%====================================================================================== - -%% Multiple Include Optimization -%% -%% Algorithm described at: -%% http://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html --record(mio, {valid = true, %% multiple include valid - cmacro, %% controlling macro of the current conditional directive - depth = 0, %% conditional directive depth - included = []}). - - - -%%====================================================================================== -%%====================================================================================== -%%====================================================================================== -%% The main entry for the preprocessor -%% -%% -%% Output {ok, Out, War} | {error, Err} -%%====================================================================================== -%%====================================================================================== -%%====================================================================================== -run(FileName, Flags) when is_atom(FileName) -> - run(atom_to_list(FileName), Flags); - -run(FileName, Flags) -> - IncDir = include_dir(Flags), - - case catch file:read_file(FileName) of - {ok, Bin} -> - FileList = binary_to_list(Bin), - run(FileList, FileName, IncDir, Flags); - {error, _} -> - Text = "No such file or directory", - {error, [FileName ++ ": " ++ Text]} - end. - - -run(FileList, FileName, IncDir, Flags) -> - %%---------------------------------------------------------- - %% Run the first phase, i.e tokenise the file - %%---------------------------------------------------------- - File = tokenise(FileList, FileName), - - %%---------------------------------------------------------- - %% Run the second phase, i.e expand macros - %%---------------------------------------------------------- - {Out, Err, War, _Defs, _Mio, IfCou} = expand(File, FileName, IncDir, Flags), - - %%---------------------------------------------------------- - %% Check if all #if #ifdef #ifndef have a matching #endif - %%---------------------------------------------------------- - IfError = case IfCou of - {endif, Endif, IfLine} when Endif > 0 -> - [{FileName, IfLine, "unterminated `#if' conditional"}]; - _ -> - [] - end, - - Err2 = Err++IfError, - - case Err2 of - [] -> - {ok, lists:flatten(lists:reverse(Out)), lists:reverse(War)}; - _ -> - {error, lists:reverse(Err2)} - end. - -%%====================================================================================== -%% The entry for all included files -%% -%% -%% Output {Out, Err, War, Defs, MultipleIncludeValid} -%%====================================================================================== -run_include(FileName, FileList, _Out, Defs, Err, War, IncLine, IncFile, IncDir, Mio) -> - - %%---------------------------------------------------------- - %% Run the first phase, i.e tokenise the file - %%---------------------------------------------------------- - [PrevFile | _T] = IncFile, - {File, FileInfoStart, FileInfoEnd} = - tokenise(FileList, FileName, IncLine, PrevFile), - - %%---------------------------------------------------------- - %% Run the second phase, i.e expand macros - %%---------------------------------------------------------- - {Out2, Err2, War2, Defs2, Mio2, IfCou2} = - expand([FileInfoStart|File]++FileInfoEnd, Defs, Err, War, - [FileName|IncFile], IncDir, - #mio{included=Mio#mio.included}), - - MergeIncluded = sets:to_list(sets:from_list(Mio#mio.included ++ Mio2#mio.included)), - - Mio3 = - case {Mio2#mio.valid, Mio2#mio.cmacro} of - {V, Macro} when V == false; - Macro == undefined -> - update_mio(Mio#mio{included=MergeIncluded}); - {true, _} -> - update_mio({include, FileName}, Mio#mio{included=MergeIncluded}) - end, - - %%---------------------------------------------------------- - %% Check if all #if #ifdef #ifndef have a matching #endif - %%---------------------------------------------------------- - IfError = case IfCou2 of - {endif, Endif, IfLine} when Endif > 0 -> - [{FileName, IfLine, "unterminated `#if' conditional"}]; - _ -> - [] - end, - - {Out2, Defs2, Err2++IfError, War2, Mio3}. - - - - -%%=================================================================================== -%%=================================================================================== -%%=================================================================================== -%% Tokenise the file -%% -%% -%% Output: File -%% -%% Description: -%% The input file is tokenised into a list where all comments are replaced -%% by a space and all "backslash-newline" sequences are removed. -%% -%% A file information is added at start and end of an included file to set the -%% current file name and line number. -%% -%% -%% A token consists of: -%% -------------------- -%% -%% {char, Char} special characters like ()[]{},!%& etc -%% {command,Command} a macro command -%% {expanded,Str} an expanded variable, used to prevent infinite loops -%% at self reference -%% {file_info,FI} start and end information of a file -%% FI is a string of the following format: -%% "# Line FileName Int" were Int is -%% 1 if start of an included file, -%% 2 when returning to "parent" file -%% {nl, L} newline -%% {number,Num) variable, a string starting with a number -%% {self_ref,Var} to allow reference to a variable again, used when expanding -%% self refering macros -%% space a space -%% space_exp a space, special notation to prevent not wanted concatination -%% {string, Str} a (tail of a) string constant -%% {string_part, Str} a head of a string constant defined on several consecutive lines -%% {sys_head, Str} (tail of) the file name of included system file -%% {sys_head_part , Str} the file name of included system file -%% {var,Var} variable, a string starting with minuscular or capital letter or -%% an underline -%% -%% Note, comments are not removed within a character or string constant -%% or inside an include-definition where the file name is delimited with < > -%%=================================================================================== -%%=================================================================================== -%%=================================================================================== - -tokenise(File, FileName) -> - {Result, _L} = token(File, 2, [], not_set, 0), - FI_start = lists:reverse(lists:flatten(io_lib:format("# 1 \"~ts\"~n",[FileName]))), - FileInfoStart = {file_info, FI_start}, - [FileInfoStart | Result]. - -tokenise(File, FileName, IncLine, PrevFile) -> - {Result, _L} = token(File, 2, [], not_set, 0), - FI_start = lists:reverse(lists:flatten(io_lib:format("# 1 \"~ts\" 1~n",[FileName]))), - FileInfoStart = {file_info, FI_start}, - FI_end = lists:reverse(lists:flatten(io_lib:format("# ~p \"~ts\" 2~n~n",[IncLine-1,PrevFile]))), - FileInfoEnd = [{file_info, FI_end}], - {Result, FileInfoStart, FileInfoEnd}. -% [FileInfoStart | Result] ++ FileInfoEnd. - - -%%=================================================================================== -%% token(InputFile, L, Result, Gen) -%% Gen information of the first token on the line, default = not_set -%% -%% Output: File -%%=================================================================================== - -%%================================================================== -%% Normal line -%%================================================================== -%%--------------------------------------- -%% All file tokenised -%%--------------------------------------- -token([], L, [{nl,NL}|Result], _Gen, _BsNl) when L == NL+1-> - {lists:reverse([{nl,NL}|Result]), L}; -token([], L, Result, _Gen, _BsNl) -> - {lists:reverse([{nl,L-1}|Result]), L}; - -%%--------------------------------------- -%% String -%%--------------------------------------- -token(File, L, Result, string, BsNl) -> - case token_string(File, []) of - {Rem, Str, nl} -> - Result1 = [{nl, L}, {string,Str} | Result], - token(Rem, L+1, Result1, string, BsNl); - {Rem, Str} -> - token(Rem, L, [{string,Str}|Result], not_set, BsNl) - end; - -token([$"|File], L, Result, Gen, BsNl) -> - case token_string(File, []) of - {Rem, Str, nl} -> - Result1 = [{nl, L}, {string_part,Str} | Result], - token(Rem, L+1, Result1, string, BsNl); - {Rem, Str} -> - token(Rem, L, [{string,Str}|Result], Gen, BsNl) - end; - -%%--------------------------------------- -%% Include with < > -%%--------------------------------------- -token(File, L, Result, include, BsNl) -> - case token_include(File, []) of - {Rem, Str, nl} -> - Result1 = [{nl, L}, {sys_head,Str} | Result], - token(Rem, L+1, Result1, include, BsNl); - {Rem, Str} -> - token(Rem, L, [{sys_head,Str}|Result], not_set, BsNl) - end; - -token([$<|File], L, [space,{command,"include"}|Result], Gen, BsNl) -> - case token_include(File, []) of - {Rem, Str, nl} -> - Result1 = [{nl, L}, {sys_head_part,Str}, space, {command,"include"} |Result], - token(Rem, L+1,Result1, include, BsNl); - {Rem, Str} -> - Result1 = [{sys_head,Str}, space, {command,"include"} |Result], - token(Rem, L, Result1, Gen, BsNl) - end; -token([$<|File], L, [{command,"include"}|Result], Gen, BsNl) -> - case token_include(File, []) of - {Rem, Str, nl} -> - Result1 = [{nl, L}, {sys_head_part,Str}, space, {command,"include"} |Result], - token(Rem, L+1,Result1, include, BsNl); - {Rem, Str} -> - Result1 = [{sys_head,Str}, space, {command,"include"} |Result], - token(Rem, L, Result1, Gen, BsNl) - end; - - - - -%%--------------------------------------- -%% CR (just remove these) -%%--------------------------------------- -token([$\r|File], L, Result, Gen, BsNl) -> -% Bs = lists:duplicate(BsNl+1,{nl,L}), - token(File, L, Result, Gen, BsNl); %% Bs or BsNl? - -%%--------------------------------------- -%% Newline -%%--------------------------------------- -token([$\n|File], L, Result, _Gen, BsNl) -> - Bs = lists:duplicate(BsNl+1,{nl,L}), - token(File, L+1, Bs++Result, not_set, 0); - -token([$\\,$\n|File], L, Result, Gen, BsNl) -> - token(File, L, Result, Gen, BsNl+1); - -%%--------------------------------------- -%% Comments -%%--------------------------------------- -token([$/,$/|File], L, Result, not_set, BsNl) -> - Rem = skip_to_nl(File), - token(Rem, L+1,[{nl, L} | Result], not_set, BsNl); -token([$/,$/|File], L, Result, _Gen, BsNl) -> - Rem = skip_to_nl(File), - token(Rem, L+1,[{nl, L} | Result], not_set, BsNl); - -token([$/,$*|File], L, Result, not_set, BsNl) -> - case token_comment(File) of - {Rem, nl} -> - token(Rem, L+1, [{nl, L} | Result], not_set, BsNl); - Rem -> - token(Rem, L, Result, not_set, BsNl) - end; -token([$/,$*|File], L, Result, Gen, BsNl) -> - case token_comment(File) of - {Rem, nl} -> - token(Rem, L+1, [{nl, L}, space | Result], not_set, BsNl); - Rem -> - token(Rem, L, [space|Result], Gen, BsNl) - end; - -%%--------------------------------------- -%% Variable -%%--------------------------------------- -token([X|File], L, Result, Gen, BsNl) when ?is_upper(X) -> - GenNew = case Gen of not_set -> var; _ -> Gen end, - {Rem, Var} = tok_var(File, [X]), - token(Rem, L, [{var,Var}|Result], GenNew, BsNl); -token([X|File], L, Result, Gen, BsNl) when ?is_lower(X) -> - GenNew = case Gen of not_set -> var; _ -> Gen end, - {Rem, Var} = tok_var(File, [X]), - token(Rem, L, [{var,Var}|Result], GenNew, BsNl); -token([X|File], L, Result, Gen, BsNl) when ?is_underline(X) -> - GenNew = case Gen of not_set -> var; _ -> Gen end, - {Rem, Var} = tok_var(File, [X]), - token(Rem, L, [{var,Var}|Result], GenNew, BsNl); - -%%--------------------------------------- -%% Number -%%--------------------------------------- -token([X|File], L, Result, Gen, BsNl) when ?is_number(X) -> - GenNew = case Gen of not_set -> number; _ -> Gen end, - {Rem, Tokens} = tok_number(File, [X]), - token(Rem, L, [{number,Tokens}|Result], GenNew, BsNl); - -%%--------------------------------------- -%% Space -%%--------------------------------------- -token([X|File], L, [Y|Result], Gen, BsNl) when ?is_space(X) -> - case Y of - space -> - Rem = remove_leading_spaces(File), - token(Rem, L, [Y|Result], Gen, BsNl); - {nl,_,_} -> - Rem = remove_leading_spaces(File), - token(Rem, L, Result, Gen, BsNl); - _ -> - Rem = remove_leading_spaces(File), - token(Rem, L, [space, Y |Result], Gen, BsNl) - end; - -token([X|File], L, [Y|Result], Gen, BsNl) when ?is_tab(X) -> - case Y of - space -> - Rem = remove_leading_spaces(File), - token(Rem, L, [Y|Result], Gen, BsNl); - {nl,_,_} -> - Rem = remove_leading_spaces(File), - token(Rem, L, Result, Gen, BsNl); - _ -> - Rem = remove_leading_spaces(File), - token(Rem, L, [space, Y |Result], Gen, BsNl) - end; - -%%--------------------------------------- -%% Command -%%--------------------------------------- -token([$#|File], L, Result, not_set, BsNl) -> - {Rem, Command} = token_pp_com(File), - case catch list_to_integer(Command) of - {'EXIT', _} -> - token(Rem, L, [{command,Command}|Result], not_set, BsNl); - _Int -> - Result1 = [{number,Command}, {command,"line"}| Result], - token(Rem, L, Result1, not_set, BsNl) - end; - -%%--------------------------------------- -%% Char -%%--------------------------------------- -token([X|File], L, Result, Gen, BsNl) -> - GenNew = case Gen of not_set -> char; _ -> Gen end, - token(File, L, [{char,X}|Result], GenNew, BsNl). - - -%%================================================================== -%% Scan to the end of a token -%%================================================================== -%%--------------------------------------- -%% Number -%%--------------------------------------- -tok_number([], Str) -> - {[], lists:reverse(Str)}; -tok_number([X|File], Str) when ?is_upper(X) -> - tok_number(File, [X|Str]); -tok_number([X|File], Str) when ?is_lower(X) -> - tok_number(File, [X|Str]); -tok_number([X|File], Str) when ?is_underline(X) -> - tok_number(File, [X|Str]); -tok_number([X|File], Str) when ?is_number(X) -> - tok_number(File, [X|Str]); -tok_number(File, Str) -> - {File, lists:reverse(Str)}. - - -%%--------------------------------------- -%% Variable -%%--------------------------------------- -tok_var([], Str) -> - {[], lists:reverse(Str)}; -tok_var([X|File], Str) when ?is_upper(X) -> - tok_var(File, [X|Str]); -tok_var([X|File], Str) when ?is_lower(X) -> - tok_var(File, [X|Str]); -tok_var([X|File], Str) when ?is_underline(X) -> - tok_var(File, [X|Str]); -tok_var([X|File], Str) when ?is_number(X) -> - tok_var(File, [X|Str]); -tok_var(File, Str) -> - {File, lists:reverse(Str)}. - - -%%--------------------------------------- -%% Preprocessor command -%%--------------------------------------- -token_pp_com([X|File]) when ?is_upper(X) -> - tok_var(File, [X]); -token_pp_com([X|File]) when ?is_lower(X) -> - tok_var(File, [X]); -token_pp_com([X|File]) when ?is_underline(X) -> - tok_var(File, [X]); -token_pp_com([X|File]) when ?is_number(X) -> - tok_var(File, [X]); -token_pp_com(File) -> - Rem = remove_leading_spaces(File), - {Rem, "null"}. - - - -%%--------------------------------------- -%% Comment -%%--------------------------------------- -token_comment([]) -> - []; -token_comment([$*,$/|File]) -> - File; -token_comment([$\n|File]) -> - {[$/,$*|File], nl}; -token_comment([$\r,$\n|File]) -> - {[$/,$*|File], nl}; -token_comment([$\\,$\n|File]) -> - {[$/,$*|File], nl}; -%token_comment([$\\,$\n|File]) -> -% token_comment(File); -token_comment([_|File]) -> - token_comment(File). - - -%%--------------------------------------- -%% String -%%--------------------------------------- -token_string([], Str) -> - {[], lists:reverse(Str)}; -token_string([$"|File], Str) -> - {File, lists:reverse(Str)}; -token_string([$\n|File], Str) -> - {File, lists:reverse(Str), nl}; -token_string([$\r,$\n|File], Str) -> - {File, lists:reverse(Str), nl}; -token_string([$\\,$\n|File], Str) -> - token_string(File, Str); -token_string([X|File], Str) -> - token_string(File, [X|Str]). - - -%%--------------------------------------- -%% Include -%%--------------------------------------- -token_include([], Str) -> - {[], lists:reverse(Str)}; -token_include([$>|File], Str) -> - {File, lists:reverse(Str)}; -token_include([$\n|File], Str) -> - {File, lists:reverse(Str), nl}; -token_include([$\r,$\n|File], Str) -> - {File, lists:reverse(Str), nl}; -token_include([$\\,$\n|File], Str) -> - token_include(File, Str); -token_include([X|File], Str) -> - token_include(File, [X|Str]). - - - - -%%=================================================================================== -%% detokenise a list of tokens, until next newline -%% -%% Output: a string -%%=================================================================================== -detokenise(Tokens) -> - detokenise(Tokens, []). - -detokenise([], Result) -> - lists:flatten(Result); -detokenise([space], Result) -> - lists:flatten(Result); -detokenise([space_exp], Result) -> - lists:flatten(Result); -detokenise([space|Rem], Result) -> - detokenise(Rem, Result++[?space]); -detokenise([space_exp|Rem], Result) -> - detokenise(Rem, Result++[?space]); -detokenise([nl|Rem], Result) -> - detokenise(Rem, Result++[$\n]); -detokenise([{_, String}|Rem], Result) -> - detokenise(Rem, Result++[String]). - - -detokenise_pragma(Tokens) -> - detokenise_pragma(Tokens, []). - -detokenise_pragma([], Result) -> - lists:flatten(Result); -detokenise_pragma([space], Result) -> - lists:flatten(Result); -detokenise_pragma([space|Rem], Result) -> - detokenise_pragma(Rem, Result++[?space]); -detokenise_pragma([nl|Rem], Result) -> - detokenise_pragma(Rem, Result++[$\n]); -detokenise_pragma([{string, String}|Rem], Result) -> - detokenise_pragma(Rem, Result++[$"|String]++[$"]); -detokenise_pragma([{_, String}|Rem], Result) -> - detokenise_pragma(Rem, Result++[String]). - - - - - - - -%%====================================================================================== -%%====================================================================================== -%%====================================================================================== -%% Expand macros. -%% -%% -%% Output: A text file -%% -%% Description: Expands all macros. All macro definitions are logged in a list 'Defs' -%% and all found errors and warnings are logged in a list 'Err' and 'War', -%% respectively. -%% -%% When a macro name is found in a source line it is expanded according -%% to the current 'Defs'-list. The macro must agree both to the name -%% and number of parameters, otherwise an error is reported. -%%====================================================================================== -%%====================================================================================== -%%====================================================================================== - - -expand(List, FileName, IncDir, Flags) -> - %% Get all definitions from preprocessor commnads - %% and merge them on top of the file collected. - CLDefs = get_cmd_line_defs(Flags), - expand(List, [], [], CLDefs, [FileName], IncDir, #mio{}, check_all, [], [], 1, FileName). - -expand(List, Defs, Err, War, [FileName|IncFile], IncDir, Mio) -> - expand(List, [], [], Defs, [FileName|IncFile], IncDir, Mio, check_all, Err, War, 1, FileName). - -%%======================================================= -%% Main loop for the expansion -%%======================================================= -expand([], Out, _SelfRef, Defs, _IncFile, _IncDir, Mio, IfCou, Err, War, _L, _FN) -> -% io:format("~n ===============~n"), -% io:format(" definitions ~p~n",[lists:reverse(Defs)]), -% io:format(" found warnings ~p~n",[lists:reverse(War)]), -% io:format(" found errors ~p~n",[lists:reverse(Err)]), -% io:format(" ===============~n~n~n"), - {Out, Err, War, Defs, Mio, IfCou}; - -expand([{file_info, Str} | Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou, Err, War, L, FN) -> - expand(Rem, Str++Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou, Err, War, L, FN); - -%%--------------------------------------- -%% Searching for endif, -%% i.e skip all source lines until matching -%% end if is encountered -%%--------------------------------------- -expand([{command,Command} | Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, {endif, Endif, IfLine}, Err, War, L, FN) - when Command == "ifdef" -> - {_Removed, Rem2, _Nl} = read_to_nl(Rem), - IfCou2 = {endif, Endif+1, IfLine}, - expand(Rem2, Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou2, Err, War, L, FN); - - -expand([{command,Command} | Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, {endif, Endif, IfLine}, Err, War, L, FN) - when Command == "ifndef" -> - {_Removed, Rem2, _Nl} = read_to_nl(Rem), - IfCou2 = {endif, Endif+1, IfLine}, - expand(Rem2, Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou2, Err, War, L, FN); - - -expand([{command,Command} | Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, {endif, Endif, IfLine}, Err, War, L, FN) - when Command == "if" -> - case pp_command(Command, Rem, Defs, IncDir, Mio, Err, War, L, FN) of - {{'if', true}, Rem2, Err2, War2, Nl} -> - IfCou2 = {endif, Endif+1, IfLine}, - expand(Rem2, Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou2, Err2, War2, L+Nl, FN); -%% {{'if', false}, Rem2, Err2, War2, Nl} -> Not implemented yet - {{'if', error}, Rem2, Err2, War2, Nl} -> - IfCou2 = {endif, Endif, IfLine}, - expand(Rem2, Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou2, Err2, War2, L+Nl, FN) - end; - -expand([{command,Command} | Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, {endif, Endif, IfLine}, Err, War, L, FN) - when Command == "endif" -> - {_Removed, Rem2, Nl} = read_to_nl(Rem), - case Endif of - 1 -> - Out2 = lists:duplicate(Nl,$\n) ++ Out, - expand(Rem2, Out2, SelfRef, Defs, IncFile, IncDir, Mio, check_all, Err, War, L+Nl, FN); - _ -> - IfCou2 = {endif, Endif-1, IfLine}, - expand(Rem2, Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou2, Err, War, L+Nl, FN) - end; - - -expand([{command,_Command} | Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, {endif, Endif, IfLine}, Err, War, L, FN) -> - {_Removed, Rem2, _Nl} = read_to_nl(Rem), - IfCou2 = {endif, Endif, IfLine}, - expand(Rem2, Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou2, Err, War, L, FN); - -%% Solves a bug when spaces in front of hashmark ! -expand([space | Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, {endif, Endif, IfLine}, Err, War, L, FN) -> - expand(Rem, Out, SelfRef, Defs, IncFile, IncDir, Mio, {endif, Endif, IfLine}, Err, War, L, FN); - -expand([{nl,_Nl} | Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, {endif, Endif, IfLine}, Err, War, L, FN) -> - expand(Rem, Out, SelfRef, Defs, IncFile, IncDir, Mio, {endif, Endif, IfLine}, Err, War, L, FN); - - -expand([_X | Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, {endif, Endif, IfLine}, Err, War, L, FN) -> - {_Removed, Rem2, Nl} = read_to_nl(Rem), - Out2 = lists:duplicate(Nl,$\n) ++ Out, - expand(Rem2, Out2, SelfRef, Defs, IncFile, IncDir, Mio, {endif, Endif, IfLine}, Err, War, L, FN); - - - - - -%%--------------------------------------- -%% Check all tokens -%%--------------------------------------- -expand([{nl, _N} | Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou, Err, War, L, FN) -> - expand(Rem, [$\n | Out], SelfRef, Defs, IncFile, IncDir, Mio, IfCou, Err, War, L+1, FN); - -expand([space | Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou, Err, War, L, FN) -> - expand(Rem, [?space | Out], SelfRef, Defs, IncFile, IncDir, Mio, IfCou, Err, War, L, FN); - -expand([space_exp | Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou, Err, War, L, FN) -> - expand(Rem, [?space | Out], SelfRef, Defs, IncFile, IncDir, Mio, IfCou, Err, War, L, FN); - -expand([{command,Command} | Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, check_all, Err, War, L, FN) -> - case pp_command(Command, Rem, Defs, IncDir, Mio, Err, War, L, FN) of - {define, Rem2, Defs2, Err2, War2, Nl} -> - Out2 = lists:duplicate(Nl,$\n) ++ Out, - expand(Rem2, Out2, SelfRef, Defs2, IncFile, IncDir, update_mio(Mio), check_all, Err2, War2, L+Nl, FN); - - {undef, Rem2, Defs2, Err2, War2, Nl} -> - Out2 = lists:duplicate(Nl,$\n) ++ Out, - expand(Rem2, Out2, SelfRef, Defs2, IncFile, IncDir, update_mio(Mio), check_all, Err2, War2, L+Nl, FN); - - {{include, ok}, FileName, FileCont, Rem2, Nl, Err2, War2} -> - {Out3, Defs3, Err3, War3, Mio2} = - run_include(FileName, FileCont, Out, Defs, Err2, War2, L+Nl, IncFile, IncDir, Mio), - Nls = [], - Out4 = Out3++Nls++Out, - expand(Rem2, Out4, SelfRef, Defs3, IncFile, IncDir, Mio2, check_all, Err3, War3, L+Nl, FN); - - {{include, error}, Rem2, Nl, Err2, War2} -> - Out2 = lists:duplicate(Nl,$\n) ++ Out, - expand(Rem2, Out2, SelfRef, Defs, IncFile, IncDir, update_mio(Mio), check_all, Err2, War2, L+Nl, FN); - - {{include, skip}, Rem2} -> - Out2 = [$\n|Out], - expand(Rem2, Out2, SelfRef, Defs, IncFile, IncDir, update_mio(Mio), check_all, Err, War, L+1, FN); - - {{ifdef, true}, Rem2, Err2, War2, Nl} -> - Out2 = lists:duplicate(Nl,$\n) ++ Out, - IfCou2 = {endif, 1, L}, - expand(Rem2, Out2, SelfRef, Defs, IncFile, IncDir, Mio, IfCou2, Err2, War2, L+Nl, FN); - {{ifdef, false}, Rem2, Err2, War2, Nl} -> - Out2 = lists:duplicate(Nl,$\n) ++ Out, - Mio2 = update_mio(ifdef, Mio), - expand(Rem2, Out2, SelfRef, Defs, IncFile, IncDir, Mio2, check_all, Err2, War2, L+Nl, FN); - - {{ifndef, true}, Rem2, Err2, War2, Nl} -> - Out2 = lists:duplicate(Nl,$\n) ++ Out, - IfCou2 = {endif, 1, L}, - expand(Rem2, Out2, SelfRef, Defs, IncFile, IncDir, Mio, IfCou2, Err2, War2, L+Nl, FN); - {{ifndef, false}, Macro, Rem2, Err2, War2, Nl} -> - Out2 = lists:duplicate(Nl,$\n) ++ Out, - Mio2 = update_mio({ifndef, Macro}, Mio), - expand(Rem2, Out2, SelfRef, Defs, IncFile, IncDir, Mio2, check_all, Err2, War2, L+Nl, FN); - - {endif, Rem2, Err2, War2, Nl} -> - Out2 = lists:duplicate(Nl,$\n) ++ Out, - Mio2 = update_mio(endif, Mio), - expand(Rem2, Out2, SelfRef, Defs, IncFile, IncDir, Mio2, check_all, Err2, War2, L+Nl, FN); - - {{'if', true}, Rem2, Err2, War2, Nl} -> - Out2 = lists:duplicate(Nl,$\n) ++ Out, - IfCou2 = {endif, 1, L}, - expand(Rem2, Out2, SelfRef, Defs, IncFile, IncDir, Mio, IfCou2, Err2, War2, L+Nl, FN); -%% {{'if', false}, Removed, Rem2, Nl} -> Not implemented at present - {{'if', error}, Rem2, Err2, War2, Nl} -> - Out2 = lists:duplicate(Nl,$\n) ++ Out, - Mio2 = update_mio('if', Mio), - expand(Rem2, Out2, SelfRef, Defs, IncFile, IncDir, Mio2, check_all, Err2, War2, L+Nl, FN); - - {'else', {_Removed, Rem2, Nl}} -> - Out2 = lists:duplicate(Nl,$\n) ++ Out, - Err2 = {FN, L, "`else' command is not implemented at present"}, - Mio2 = update_mio('else', Mio), - expand(Rem2, Out2, SelfRef, Defs, IncFile, IncDir, Mio2, check_all, [Err2|Err], War, L+Nl, FN); - - {'elif', {_Removed, Rem2, Nl}} -> - Out2 = lists:duplicate(Nl,$\n) ++ Out, - Err2 = {FN, L, "`elif' command is not implemented at present"}, - Mio2 = update_mio('elif', Mio), - expand(Rem2, Out2, SelfRef, Defs, IncFile, IncDir, Mio2, check_all, [Err2|Err], War, L+Nl, FN); - - {warning, {WarningText, Rem2, Nl}} -> - [FileName|_More] = IncFile, - War2 = {FileName, L, "warning: #warning "++detokenise(WarningText)}, - Out2 = lists:duplicate(Nl,$\n) ++ Out, - expand(Rem2, Out2, SelfRef, Defs, IncFile, IncDir, update_mio(Mio), check_all, Err, [War2|War], L+Nl, FN); - - {error, {ErrorText, Rem2, Nl}} -> - [FileName|_More] = IncFile, - Err2 = {FileName, L, detokenise(ErrorText)}, - Out2 = lists:duplicate(Nl,$\n) ++ Out, - expand(Rem2, Out2, SelfRef, Defs, IncFile, IncDir, update_mio(Mio), check_all, [Err2|Err], War, L+Nl, FN); - - {{line, ok}, {_Removed, Rem2, Nl}, L2, FN2, LineText} -> - Out2 = lists:duplicate(Nl,$\n)++LineText++Out, - [_X|IF] = IncFile, - IncFile2 = [FN2|IF], - expand(Rem2, Out2, SelfRef, Defs, IncFile2, IncDir, update_mio(Mio), check_all, Err, War, L2, FN2); - {{line, error}, {_Removed, Rem2, Nl}, Err2} -> - Out2 = lists:duplicate(Nl,$\n) ++ Out, - expand(Rem2, Out2, SelfRef, Defs, IncFile, IncDir, update_mio(Mio), check_all, [Err2|Err], War, L+Nl, FN); - - hash_mark -> - expand(Rem, Out, SelfRef, Defs, IncFile, IncDir, Mio, check_all, Err, War, L, FN); - - {pragma, Rem2, Nl, Text} -> - Out2 = lists:duplicate(Nl,$\n)++Text++Out, - expand(Rem2, Out2, SelfRef, Defs, IncFile, IncDir, update_mio(Mio), check_all, Err, War, L+Nl, FN); - - {ident, Rem2, Nl, Text} -> - Out2 = lists:duplicate(Nl,$\n)++Text++Out, - expand(Rem2, Out2, SelfRef, Defs, IncFile, IncDir, update_mio(Mio), check_all, Err, War, L+Nl, FN); - - {not_recognised, {Removed, Rem2, Nl}} -> - Text = lists:reverse([$#|Command]), - RemovedS = lists:reverse([?space|detokenise(Removed)]), - Out2 = [$\n|RemovedS]++Text++Out, - Mio2 = update_mio(Mio), - case Command of - [X|_T] when ?is_upper(X) -> - expand(Rem2, Out2, SelfRef, Defs, IncFile, IncDir, Mio2, check_all, Err, War, L+Nl, FN); - [X|_T] when ?is_lower(X) -> - expand(Rem2, Out2, SelfRef, Defs, IncFile, IncDir, Mio2, check_all, Err, War, L+Nl, FN); - [X|_T] when ?is_underline(X) -> - expand(Rem2, Out2, SelfRef, Defs, IncFile, IncDir, Mio2, check_all, Err, War, L+Nl, FN); - _ -> - Err2 = {FN, L, "invalid preprocessing directive name"}, - expand(Rem2, Out2, SelfRef, Defs, IncFile, IncDir, Mio2, check_all, [Err2|Err], War, L+Nl, FN) - end; - - Else -> -% io:format(" %%%%Else%%%%%% ~p~n",[Else]), - exit(Else) - end; - - -expand([{var, "__LINE__"}|Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou, Err, War, L, FN) -> - LL = io_lib:format("~p",[L]), - expand(Rem, [LL | Out], SelfRef, Defs, IncFile, IncDir, update_mio(Mio), IfCou, Err, War, L, FN); - -expand([{var, "__FILE__"}|Rem], Out, SelfRef, Defs, IncFile, Mio, IncDir, IfCou, Err, War, L, FN) -> - expand(Rem, [$",FN,$" | Out], SelfRef, Defs, IncFile, IncDir, update_mio(Mio), IfCou, Err, War, L, FN); - -expand([{var, "__DATE__"}|Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou, Err, War, L, FN) -> - {{Y,M,D},{_H,_Mi,_S}} = calendar:universal_time(), - Date = io_lib:format("\"~s ~p ~p\"",[month(M),D,Y]), - expand(Rem, [Date | Out], SelfRef, Defs, IncFile, IncDir, update_mio(Mio), IfCou, Err, War, L, FN); - -expand([{var, "__TIME__"}|Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou, Err, War, L, FN) -> - {{_Y,_M,_D},{H,Mi,S}} = calendar:universal_time(), - HS = if H < 10 -> "0"++integer_to_list(H); - true -> integer_to_list(H) - end, - MiS = if Mi < 10 -> "0"++integer_to_list(Mi); - true -> integer_to_list(Mi) - end, - SS = if S < 10 -> "0"++integer_to_list(S); - true -> integer_to_list(S) - end, - Time = io_lib:format("\"~s:~s:~s\"",[HS,MiS,SS]), - expand(Rem, [Time | Out], SelfRef, Defs, IncFile, IncDir, update_mio(Mio), IfCou, Err, War, L, FN); - -expand([{var, "__INCLUDE_LEVEL__"}|Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou, Err, War, L, FN) -> - IL = io_lib:format("~p",[length(IncFile)-1]), - expand(Rem, [IL | Out], SelfRef, Defs, IncFile, IncDir, update_mio(Mio), IfCou, Err, War, L, FN); - -expand([{var, "__BASE_FILE__"}|Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou, Err, War, L, FN) -> - [BF|_T] = lists:reverse(IncFile), - expand(Rem, [$",BF,$" | Out], SelfRef, Defs, IncFile, IncDir, update_mio(Mio), IfCou, Err, War, L, FN); - -expand([{var, Var} | Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou, Err, War, L, FN) -> - {Out2, Err2, War2, Rem2, SelfRef2} = - source_line(Var, Rem, SelfRef, Defs, Err, War, L, FN), - expand(Rem2, [Out2 | Out], SelfRef2, Defs, IncFile, IncDir, update_mio(Mio), IfCou, Err2, War2, L, FN); - -expand([{char, Char} | Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou, Err, War, L, FN) -> - expand(Rem, [Char | Out], SelfRef, Defs, IncFile, IncDir, update_mio(Mio), IfCou, Err, War, L, FN); - -expand([{number, Number} | Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou, Err, War, L, FN) -> - expand(Rem, [Number | Out], SelfRef, Defs, IncFile, IncDir, update_mio(Mio), IfCou, Err, War, L, FN); - -expand([{expanded, Str} | Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou, Err, War, L, FN) -> - expand(Rem, [Str | Out], SelfRef, Defs, IncFile, IncDir, update_mio(Mio), IfCou, Err, War, L, FN); - -expand([{self_ref, Str} | Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou, Err, War, L, FN) -> - SelfRef2 = lists:delete(Str,SelfRef), - expand(Rem, Out, SelfRef2, Defs, IncFile, IncDir, update_mio(Mio), IfCou, Err, War, L, FN); - -expand([{string, Str} | Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou, Err, War, L, FN) -> - expand(Rem, [$", Str, $" | Out], SelfRef, Defs, IncFile, IncDir, update_mio(Mio), IfCou, Err, War, L, FN); - -expand([{string_part, Str} | Rem], Out, SelfRef, Defs, IncFile, IncDir, Mio, IfCou, Err, War, L, FN) -> - {Str2, Rem2, Nl} = expand_string_part([$"|Str], Rem), - expand(Rem2, [Str2| Out], SelfRef, Defs, IncFile, IncDir, update_mio(Mio), IfCou, Err, War, L+Nl, FN). - - - - - - - - -%%======================================================================== -%% Expand a line starting as a partial string -%%======================================================================== -expand_string_part(Str, File) -> - expand_string_part(File, Str, 0). - -expand_string_part([{string, Str_part} | Rem], Str, Nl) -> - {Str++Str_part++[$"], Rem, Nl}; -expand_string_part([space | Rem], Str, Nl) -> - expand_string_part(Rem, Str, Nl); -expand_string_part([nl| Rem], Str, Nl) -> - expand_string_part(Rem, Str++[$\n], Nl); -expand_string_part([{string_part, Str_part} | Rem], Str, Nl) -> - expand_string_part(Rem, Str++Str_part, Nl). - - - - - -%%======================================================================== -%% Parse and integrate command line macro directives -%% At this momment, only -D and -U are supported (gcc like) -%%======================================================================== - - -%% Collect all command line macro definitions -get_cmd_line_defs(Flags) -> - Adjusted = parse_cmd_line(Flags,[]), - - {_Out, _Err, _War, Defs, _IfCou, _Mio} = - expand(tokenise(Adjusted,""), - [], - [], - [], - [], - [], - #mio{}, - check_all, - [], - [], - 1, - ""), - Defs. - -%% Parse command line macros -parse_cmd_line([],Found) -> - lists:flatten(lists:reverse(Found)); - -parse_cmd_line([45,68|Rest],Found) -> - {Collected,RestCmds} = collect_define(Rest,[]), - parse_cmd_line(RestCmds,[Collected|Found]); - -parse_cmd_line([45,85|Rest],Found) -> - {Collected,RestCmds} = collect_undefine(Rest,[]), - parse_cmd_line(RestCmds,[Collected|Found]); - -parse_cmd_line([_|Rest],Found) -> - parse_cmd_line(Rest,Found). - - -%% Collect defines and translate them -%% into a text format -collect_define([],Found) -> - { "#define "++lists:reverse(Found)++"\n", [] }; -collect_define([32|Rest],Found) -> - { "#define "++lists:reverse(Found)++"\n", Rest }; -collect_define([61|Rest],[]) -> - { "", Rest }; -collect_define([61|Rest],Found) -> - collect_define(Rest,[32|Found]); -collect_define([C|Rest],Found) -> - collect_define(Rest,[C|Found]). - - -%% Collect undefines and translate them -%% into a text format -collect_undefine([],Found) -> - { "#undef "++lists:reverse(Found)++"\n", [] }; -collect_undefine([32|Rest],Found) -> - { "#undef "++lists:reverse(Found)++"\n", Rest }; -collect_undefine([C|Rest],Found) -> - collect_undefine(Rest,[C|Found]). - - - - - - - - - - - - -%%====================================================================================== -%%====================================================================================== -%%====================================================================================== -%% Read a preprocessor command -%% -%% -%% Output: Depending of the command, typically = {Command, Rem, Err, War, Nl} -%% -%%====================================================================================== -%%====================================================================================== -%%====================================================================================== - -pp_command(Command, [space|File], Defs, IncDir, Mio, Err, War, L, FN) -> - pp_command(Command, File, Defs, IncDir, Mio, Err, War, L, FN); - -pp_command(Command, File, Defs, IncDir, Mio, Err, War, L, FN) -> - - case Command of - %%---------------------------------------- - %% #define - %%---------------------------------------- - "define" -> - case define(File, Err, War, L, FN) of - {error, Rem, Err2, War2, Nl} -> - {define, Rem, Defs, Err2, War2, Nl}; - {warning, Rem, Name, No_of_para, Parameters, Macro, Err2, War2, Nl} -> - case is_define_ok(Name, No_of_para, Parameters, Macro, Defs) of - {yes, Defs2} -> - {define, Rem, Defs2, Err2, War2, Nl}; - {no, Defs2} -> - Text = lists:flatten(io_lib:format("`~s' redefined",[Name])), - {define, Rem, Defs2, Err2, [{FN, L, Text}|War2], Nl}; - {error, Text, Defs2} -> - {define, Rem, Defs2, [{FN, L, Text}|Err2], War2, Nl} - end; - {ok, Rem, Name, No_of_para, Parameters, Macro, Err2, War2, Nl} -> - case is_define_ok(Name, No_of_para, Parameters, Macro, Defs) of - {yes, Defs2} -> - {define, Rem, Defs2, Err2, War2, Nl}; - {no, Defs2} -> - Text = lists:flatten(io_lib:format("`~s' redefined",[Name])), - {define, Rem, Defs2, Err2, [{FN, L, Text}|War2], Nl}; - {error, Text, Defs2} -> - {define, Rem, Defs2, [{FN, L, Text}|Err2], War2, Nl} - end - end; - - %%---------------------------------------- - %% #undef - %%---------------------------------------- - "undef" -> - case undef(File, Err, War, L, FN) of - {error, Rem, Err2, War2, Nl} -> - {undef, Rem, Defs, Err2, War2, Nl}; - {ok, Rem, Name, Err2, War2, Nl} -> - Defs2 = lists:keydelete(Name, 1, Defs), - {undef, Rem, Defs2, Err2, War2, Nl} - end; - - %%---------------------------------------- - %% #include - %%---------------------------------------- - "include" -> - case include(File, IncDir, Mio) of - {error, Rem, Nl, Err2} -> - {{include, error}, Rem, Nl, [{FN, L, Err2}|Err], War}; - {error, Rem, Nl, Err2, NameNl} -> - {{include, error}, Rem, Nl, [{FN, L+ NameNl, Err2}|Err], War}; - {ok, FileNamePath, FileCont, Rem, Nl} -> - {{include, ok}, FileNamePath, FileCont, Rem, Nl, Err, War}; - {skip, Rem} -> - {{include, skip}, Rem} - end; - - %%---------------------------------------- - %% #ifdef - %%---------------------------------------- - "ifdef" -> - case define(File, Err, War, L, FN) of - {error, Rem, Err2, War2, Nl} -> - {{ifdef, false}, Rem, Defs, Err2, War2, Nl}; - {warning, Rem, Name, No_of_para, _Parameters, _Macro, Err2, War2, Nl} -> - case is_defined_before(Name, No_of_para, Defs) of - yes -> - {{ifdef, false}, Rem, Err2, War2, Nl}; - no -> - {{ifdef, true}, Rem, Err2, War2, Nl} - end; - {ok, Rem, Name, No_of_para, _Parameters, _Macro, Err2, War2, Nl} -> - case is_defined_before(Name, No_of_para, Defs) of - yes -> - {{ifdef, false}, Rem, Err2, War2, Nl}; - no -> - {{ifdef, true}, Rem, Err2, War2, Nl} - end - end; - - - - %%---------------------------------------- - %% #ifndef - %%---------------------------------------- - "ifndef" -> - case define(File, Err, War, L, FN) of - {error, Rem, Err2, War2, Nl} -> - {{ifndef, false}, Rem, Defs, Err2, War2, Nl}; - {warning, Rem, Name, No_of_para, _Parameters, _Macro, Err2, War2, Nl} -> - case is_defined_before(Name, No_of_para, Defs) of - yes -> - {{ifndef, true}, Rem, Err2, War2, Nl}; - no -> - {{ifndef, false}, Name, Rem, Err2, War2, Nl} - end; - {ok, Rem, Name, No_of_para, _Parameters, _Macro, Err2, War2, Nl} -> - case is_defined_before(Name, No_of_para, Defs) of - yes -> - {{ifndef, true}, Rem, Err2, War2, Nl}; - no -> - {{ifndef, false}, Name, Rem, Err2, War2, Nl} - end - end; - - - %%---------------------------------------- - %% #endif - %%---------------------------------------- - "endif" -> - {Removed, Rem, Nl} = read_to_nl(File), - case Removed of - [] -> - {endif, Rem, Err, War, 1}; - _ -> - Text = "ignoring the tail of the line", - {ok, Rem, Err, [{FN, L, Text}|War], Nl} - end; - - - %%---------------------------------------- - %% #if - %%---------------------------------------- - "if" -> - case if_zero(File, Err, War, L, FN) of - {error, Rem2, _Removed, Nl} -> - Err2 = {FN, L, "only '#if 0' is implemented at present"}, - {{'if', error}, Rem2, [Err2 | Err], War, Nl}; - {ok, Rem2, 0, _Removed, Nl} -> - {{'if', true}, Rem2, Err, War, Nl}; - {ok, Rem2, _Num, _Removed, Nl} -> - Err2 = {FN, L, "only '#if 0' is implemented at present"}, - {{'if', error}, Rem2, [Err2 | Err], War, Nl} - end; - - %%---------------------------------------- - %% #else - %%---------------------------------------- - "else" -> - {'else', read_to_nl(File)}; - - %%---------------------------------------- - %% #elif - %%---------------------------------------- - "elif" -> - {'elif', read_to_nl(File)}; - - %%---------------------------------------- - %% #pragma - %%---------------------------------------- - "pragma" -> - {Removed, Rem, Nl} = read_to_nl(File), - {pragma, Rem, Nl, lists:reverse("#pragma " ++ detokenise_pragma(Removed))}; - - %%---------------------------------------- - %% #ident - %%---------------------------------------- - "ident" -> - {Removed, Rem, Nl} = read_to_nl(File), - {ident, Rem, Nl, lists:reverse("#ident " ++ detokenise_pragma(Removed))}; - - %%---------------------------------------- - %% #warning - %%---------------------------------------- - "warning" -> - {warning, read_to_nl(File)}; - - %%---------------------------------------- - %% #error - %%---------------------------------------- - "error" -> - {error, read_to_nl(File)}; - - %%---------------------------------------- - %% #line - %%---------------------------------------- - "line" -> - line(File, L, FN); - - %%---------------------------------------- - %% # - %%---------------------------------------- - "null" -> - hash_mark; - - %%---------------------------------------- - %% not recognised preprocessor commands - %%---------------------------------------- - _Else -> - {not_recognised, read_to_nl(File)} - end. - - - - -%%=============================================================== -%%=============================================================== -%%=============================================================== -%% if -%% -%% Only #if 0 is implemented at the time to be able to use if -%% to comment some code parts. -%%=============================================================== -%%=============================================================== -%%=============================================================== - -if_zero(File, _Err, _War, _L, _FN) -> - case if_zero(File) of - {ok, Remain, Num, Removed, Nl} -> - case catch list_to_integer(Num) of - {'EXIT', _} -> - {Removed2, Rem2, Nl2} = read_to_nl(File), - {error, Rem2, Removed2, Nl2}; - Int -> - {ok, Remain, Int, Removed, Nl} - end; - E -> - E - end. - -if_zero([{number,Num}]) -> - {ok, [], Num, [], 0}; -if_zero([{number,Num}, space]) -> - {ok, [], Num, [], 0}; -if_zero([{number,Num} | Rem]) -> - {Removed, Rem2, Nl} = read_to_nl(Rem), - {ok, Rem2, Num, Removed, Nl}; -%if_zero([{number,Num}, {nl,_X} | Rem]) -> -% {ok, Rem, Num, [], 1}; -if_zero(Rem) -> - {Removed, Rem2, Nl} = read_to_nl(Rem), - {error, Rem2, Removed, Nl}. - - - -%%=============================================================== -%%=============================================================== -%%=============================================================== -%% Define macro -%% -%% Check the syntax of the macro, extract the parameters if any. -%% If valid macro it is added to the Defs-list. -%% If a macro is redefined, a warning will be given, the latest -%% definition is always the valid one. -%%=============================================================== -%%=============================================================== -%%=============================================================== - -define(File, Err, War, L, FN) -> - case define_name(File) of - {ok, Rem, Name, No_of_para, Parameters, Macro, Nl} -> - {ok, Rem, Name, No_of_para, Parameters, Macro, Err, War, Nl}; - {{warning,no_space}, Rem, Name, No_of_para, Parameters, Macro, Nl} -> - Text = lists:flatten(io_lib:format("missing white space after `#define ~s'",[Name])), - {warning, Rem, Name, No_of_para, Parameters, Macro, Err, [{FN, L, Text}|War], Nl}; - {error, invalid_name, Nl} -> - Text = "invalid macro name", - {_Removed, Rem, Nl2} = read_to_nl(File), - {error, Rem, [{FN, L, Text}|Err], War, Nl+Nl2}; - {error, invalid_name, Name, Nl} -> - Text = lists:flatten(io_lib:format("invalid macro name `~s'",[Name])), - {_Removed, Rem, Nl2} = read_to_nl(File), - {error, Rem, [{FN, L, Text}|Err], War, Nl+Nl2}; - {error, illegal_arg} -> - {Removed, Rem, Nl} = read_to_nl(File), - RemovedS = detokenise(Removed), - Text = lists:flatten(io_lib:format("Invalid argument list ~s",[RemovedS])), - {error, Rem, [{FN, L, Text}|Err], War, Nl} - end. - - - -%%=========================================================== -%% Check if valid macro -%%=========================================================== -define_name([]) -> - {warning, no_macro}; -define_name([space]) -> - {warning, no_macro}; -%% Macro with parameters -define_name([{var,Name},{char,$(}|Rem]) -> - case read_para([{char,$(}|Rem]) of - {ok, Rem2, Para, NoOfPara} -> - {Removed, Rem3, _Nl} = read_to_nl(Rem2), - {ok, Rem3, Name, NoOfPara, Para, Removed, 1}; - Error -> - Error - end; -%% Macro without parameters -define_name([{var,Name}]) -> - {ok, [], Name, 0, [], [], 0}; -define_name([{var,Name}, space | Rem]) -> - {Removed, Rem2, Nl} = read_to_nl(Rem), - {ok, Rem2, Name, 0, [], Removed, Nl}; -define_name([{var,Name}, {nl,_X} | Rem]) -> - {ok, Rem, Name, 0, [], [], 1}; -define_name([{var,Name} | Rem]) -> - {Removed, Rem2, Nl} = read_to_nl(Rem), - {{warning,no_space}, Rem2, Name, 0, [], Removed, Nl}; -%% Invalid macro name -define_name([{number, Name} | _Rem]) -> - {error, invalid_name, Name, 0}; -define_name(_Rem) -> - {error, invalid_name, 0}. - - - - - - - -%%=============================================================== -%%=============================================================== -%%=============================================================== -%% Undefine macro -%% -%% If it is a valid undef command the macro name will be deleted -%% from the Defs-list -%%=============================================================== -%%=============================================================== -%%=============================================================== - -undef(File, Err, War, L, FN) -> - case undef(File) of - {ok, Rem, Name, Nl} -> - {ok, Rem, Name, Err, War, Nl}; - {warning, Rem, Name, Nl} -> - Text = "ignoring the tail of the line", - {ok, Rem, Name, Err, [{FN, L, Text}|War], Nl}; - {error, invalid_name} -> - Text = "invalid macro name", - {_Removed, Rem, Nl} = read_to_nl(File), - {error, Rem, [{FN, L, Text}|Err], War, Nl}; - {error, invalid_name, Name} -> - Text = lists:flatten(io_lib:format("invalid macro name `~s'",[Name])), - {_Removed, Rem, Nl} = read_to_nl(File), - {error, Rem, [{FN, L, Text}|Err], War, Nl} - end. - -%%------------------------------------------------- -%% Check if valid macro name -%%------------------------------------------------- -undef([]) -> - {error, invalid_name, []}; -%% Valid name -undef([{var,Name}]) -> - {ok, [], Name, 0}; -undef([{var,Name}, {nl,_X} | Rem]) -> - {ok, Rem, Name, 1}; -undef([{var,Name}, space, {nl,_X} | Rem]) -> - {ok, Rem, Name, 1}; -undef([{var,Name} | Rem]) -> - {_Removed, Rem2, Nl} = read_to_nl(Rem), - {warning, Rem2, Name, Nl}; -%% Invalid macro name -undef([{number, Name} | _Rem]) -> - {error, invalid_name, Name}; -undef(_Rem) -> - {error, invalid_name}. - - - - - - -%%=============================================================== -%%=============================================================== -%%=============================================================== -%% Include macro -%% -%% Read the included file -%%=============================================================== -%%=============================================================== -%%=============================================================== - -include(File, IncDir, Mio) -> - case include2(File) of - {ok, FileName, Rem, Nl, FileType} -> - Result = read_inc_file(FileName, IncDir, Mio), - case {Result, Nl, FileType} of - {{ok, FileNamePath, FileCont}, _, _} -> - {ok, FileNamePath, FileCont, Rem, Nl}; - {skip, _, _} -> - {skip, Rem}; - {{error, Text}, _, own_file} -> - NameNl = count_nl(FileName,0), - Error = lists:flatten(io_lib:format("~s: ~s",[FileName,Text])), - {error, Rem, Nl, Error, NameNl}; - {{error, Text}, 1, sys_file} -> - NameNl = count_nl(FileName,0), - Error = lists:flatten(io_lib:format("~s: ~s",[FileName,Text])), - {error, Rem, Nl, Error, NameNl}; - {{error, _Text}, _, sys_file} -> - {error, Rem, Nl, "`#include' expects \"FILENAME\" or "} - end; - {error, {_Removed, Rem, Nl}} -> - {error, Rem, Nl, "`#include' expects \#FILENAME\" or "} - end. - - - -count_nl([],Nl) -> - Nl; -count_nl([$\n|T],Nl) -> - count_nl(T,Nl+1); -count_nl([_H|T],Nl) -> - count_nl(T,Nl). - -%%================================================= -%% Extract the file name from the token list -%%================================================= -include2([space|Rem]) -> - include2(Rem); - -include2([{string, FileName}]) -> - {ok, FileName, [], 1, own_file}; -include2([{string, FileName}, space]) -> - {ok, FileName, [], 1, own_file}; -include2([{string, FileName}, {nl, _X} | Rem]) -> - {ok, FileName, Rem, 1, own_file}; -include2([{string, FileName}, space, {nl, _X} | Rem]) -> - {ok, FileName, Rem, 1, own_file}; -include2([{string, _FileName}, _No_nl | Rem]) -> - {error, read_to_nl(Rem)}; -include2([{string_part, File_part}, {nl, _X} | Rem]) -> - case include_read_string_file_name(File_part++[$\n], Rem, 1) of - {ok, FileName, Rem2, Nl} -> - {ok, FileName, Rem2, Nl, own_file}; - error -> - {error, read_to_nl([{string_part,File_part} | Rem])} - end; -include2([{sys_head, FileName}]) -> - {ok, FileName, [], 1, sys_file}; -include2([{sys_head, FileName}, space]) -> - {ok, FileName, [], 1, sys_file}; -include2([{sys_head, FileName}, {nl, _X} | Rem]) -> - {ok, FileName, Rem, 1, sys_file}; -include2([{sys_head, FileName}, space, {nl, _X} | Rem]) -> - {ok, FileName, Rem, 1, sys_file}; -include2([{sys_head, _FileName}, _No_nl | Rem]) -> - {error, read_to_nl(Rem)}; -include2([{sys_head_part ,File_part}, {nl, _X} | Rem]) -> - case include_read_sys_file_name(File_part++[$\n], Rem, 1) of - {ok, FileName, Rem2, Nl} -> - {ok, FileName, Rem2, Nl, sys_file}; - error -> - {error, read_to_nl([{sys_head_part, File_part} | Rem])} - end; -include2(Rem) -> - {error, read_to_nl(Rem)}. - - - -%%------------------------------------------------- -%% File name framed by " " -%%------------------------------------------------- -include_read_string_file_name(File, [{string, File_part}, {nl,_X} | Rem], Nl) -> - {ok, File++File_part, Rem, Nl+1}; -include_read_string_file_name(File, [{string_part, File_part}, {nl,_X} | Rem], Nl) -> - include_read_string_file_name(File++File_part++[$\n], Rem, Nl+1); -include_read_string_file_name(_File, _X, _Nl) -> - error. - -%%------------------------------------------------- -%% File name framed by < > -%%------------------------------------------------- -include_read_sys_file_name(File, [{sys_head, File_part}, {nl,_X} | Rem], Nl) -> - {ok, File++File_part, Rem, Nl+1}; -include_read_sys_file_name(File, [{sys_head_part, File_part}, {nl,_X} | Rem], Nl) -> - include_read_sys_file_name(File++File_part++[$\n], Rem, Nl+1); -include_read_sys_file_name(_File, _X, _Nl) -> - error. - - - - - - - -%%=============================================================== -%%=============================================================== -%%=============================================================== -%% Line macro -%% -%% The line macro may redefine both the current line number and -%% the current file name: #line ' new_line_nr' 'new_file_name' -%%=============================================================== -%%=============================================================== -%%=============================================================== - -line(File, L, FN) -> - line(File, L, FN, not_defined, not_defined). - - - -line([], L, FN, _Line, _File) -> - {{line, error}, {[],[],0}, {FN,L,"invalid format `#line' directive"}}; - -line([space|Rem], L, FN, Line, File) -> - line(Rem, L, FN, Line, File); - -%%------------------------------ -%% Line number expected -%%------------------------------ -line([{number,Number}|Rem], L, FN, not_defined, File) -> - case catch list_to_integer(Number) of - {'EXIT', _} -> - {{line, error}, read_to_nl(Rem), {FN,L,"invalid format `#line' directive"}}; - Int -> - line(Rem, L, FN, Int, File) - end; -line(Rem, L, FN, not_defined, _File) -> - {{line, error}, read_to_nl(Rem), {FN,L,"invalid format `#line' directive"}}; - -%%------------------------------ -%% File name or newline expected -%%------------------------------ -line([{nl, _NL}|Rem], _L, FN, Line, not_defined) -> - {{line, ok}, {[],Rem,1}, Line, FN, io_lib:format("~n~p ~p #",[FN, Line-1])}; -line([{string,NewFN}|Rem], _L, _FN, Line, not_defined) -> - {{line, ok}, read_to_nl(Rem), Line, NewFN, io_lib:format("~n~p ~p #",[NewFN, Line-1])}; -line(Rem, L, FN, _Line, _File) -> - {{line, error}, read_to_nl(Rem), {FN,L,"invalid format `#line' directive"}}. - - - - -%%====================================================================================== -%%====================================================================================== -%%====================================================================================== -%% Source line -%% -%% -%% Output: {Str, Err, War, Rem, SelfRef} -%% -%% Description: The input source line is searched for macros. If a macro is found it -%% is expanded. The result of an expansion is rescanned for more macros. -%% To prevent infinite loops if the macro is self referring -%% an extra token is put into the Rem list. The variable SelfRef -%% contains all the macros which are inhibited to be expanded. -%% A special specae token is also inserted to prevent not wanted -%% concatinations if one of the variables to be concatinated is expanded. -%%====================================================================================== -%%====================================================================================== -%%====================================================================================== - -source_line(Str, Rem, SelfRef, Defs, Err, War, L, FN) -> - {Rem2, Para, No_of_para} = case read_para(Rem) of - {ok, RemT, ParaT, No_of_paraT} -> - {RemT, ParaT, No_of_paraT}; - {error, illegal_arg} -> - {[], [], 0} - end, - - - %%------------------------------------------------- - %% Check if a valid macro - %%------------------------------------------------- - case lists:keysearch(Str, 1, Defs) of - %% a macro without parameters - {value, {Str, 0, _MacroPara, Macro}} -> - case lists:member(Str, SelfRef) of - true -> - {[Str], Err, War, Rem, SelfRef}; - false -> - ExpandedRes2 = sl_mark_expanded(Macro, Str), - {[], Err, War, ExpandedRes2 ++ [{self_ref,Str}|Rem], [Str|SelfRef]} - end; - - %% a macro with parameters - {value, {Str, N, _MacroPara, Macro}} when N == No_of_para -> - case lists:member(Str, SelfRef) of - true -> - {[Str], Err, War, Rem, SelfRef}; - false -> - ExpandedRes = sl_macro_expand(Macro, Para, Defs), - ExpandedRes2 = sl_mark_expanded(ExpandedRes, Str), - {[], Err, War, ExpandedRes2 ++ [{self_ref,Str}|Rem2], [Str|SelfRef]} - end; - - %% a variable, because it doesn't have any parameters - {value, {Str, _N, _MacroPara, _Macro}} when No_of_para == 0 -> - {Str, Err, War, Rem, SelfRef}; - - %% illegal no of parameters - {value, {Str, N, _MacroPara, _Macro}} when No_of_para < N -> - Text = io_lib:format(" macro `~s' used with just ~p arg",[Str,No_of_para]), - Err2 = {FN, L, lists:flatten(Text)}, - {Str, [Err2|Err], War, Rem, SelfRef}; - {value, {Str, _N, _MacroPara, _Macro}} -> - Text = io_lib:format(" macro `~s' used with too many (~p) args",[Str,No_of_para]), - Err2 = {FN, L, lists:flatten(Text)}, - {Str, [Err2|Err], War, Rem, SelfRef}; - - %% no macro - false -> - {Str, Err, War, Rem, SelfRef} - end. - - - - - -%%================================================= -%% Expand a macro -%%================================================= -sl_macro_expand(Macro, Para, Defs) -> - sl_macro_expand(Macro, Para, Defs, []). - - -%%................... -%% End -%%................... -sl_macro_expand([], _Para, _Defs, Res) -> - lists:reverse(Res); - -%%................... -%% Concatination -%%................... -%% para ## para -sl_macro_expand([{para, N}, space, {char,$#}, {char,$#}, space, {para,M} | T], Para, Defs, Res) -> - Exp = sl_para_para({para, N},{para, M}, Para), - sl_macro_expand(Exp++T, Para, Defs, [space |Res]); -%% para## para -sl_macro_expand([{para, N}, {char,$#}, {char,$#}, space, {para,M} | T], Para, Defs, Res) -> - Exp = sl_para_para({para, N},{para, M}, Para), - sl_macro_expand(Exp++T, Para, Defs, [space |Res]); -%% para ##para -sl_macro_expand([{para, N}, space, {char,$#}, {char,$#}, {para,M} | T], Para, Defs, Res) -> - Exp = sl_para_para({para, N},{para, M}, Para), - sl_macro_expand(Exp++T, Para, Defs, [space |Res]); -%% para##para -sl_macro_expand([{para, N}, {char,$#}, {char,$#}, {para,M} | T], Para, Defs, Res) -> - Exp = sl_para_para({para, N},{para, M}, Para), - sl_macro_expand(Exp++T, Para, Defs, [space |Res]); - -%% para ## var -sl_macro_expand([{para, N}, space, {char,$#}, {char,$#}, space, {var, Var}|T], Para, Defs, Res) -> - Exp = sl_para_var({para, N}, {var, Var}, Para), - sl_macro_expand(Exp++T, Para, Defs, [space |Res]); -%% para## var -sl_macro_expand([{para, N}, {char,$#}, {char,$#}, space, {var, Var} | T], Para, Defs, Res) -> - [{var, VarN}] = lists:nth(N,Para), - sl_macro_expand(T, Para, Defs, [{expanded,Var},{expanded,VarN}, space |Res]); -%% para ##var -sl_macro_expand([{para, N}, space, {char,$#}, {char,$#}, {var, Var} | T], Para, Defs, Res) -> - [{var, VarN}] = lists:nth(N,Para), - sl_macro_expand(T, Para, Defs, [{expanded,Var},{expanded,VarN}, space |Res]); -%% para##var -sl_macro_expand([{para, N}, {char,$#}, {char,$#}, {var, Var} | T], Para, Defs, Res) -> - [{var, VarN}] = lists:nth(N,Para), - sl_macro_expand(T, Para, Defs, [{expanded,Var},{expanded,VarN}, space |Res]); - -%% var ## para -sl_macro_expand([{var, Var}, space, {char,$#}, {char,$#}, space, {para,M} | T], Para, Defs, Res) -> - Exp = sl_var_para({var, Var},{para, M}, Para), - sl_macro_expand(Exp++T, Para, Defs, [space |Res]); -%% var## para -sl_macro_expand([{var, Var}, {char,$#}, {char,$#}, space, {para,M} | T], Para, Defs, Res) -> - Exp = sl_var_para({var, Var},{para, M}, Para), - sl_macro_expand(Exp++T, Para, Defs, [space |Res]); -%% var ##para -sl_macro_expand([{var, Var}, space, {char,$#}, {char,$#}, {para,M} | T], Para, Defs, Res) -> - Exp = sl_var_para({var, Var},{para, M}, Para), - sl_macro_expand(Exp++T, Para, Defs, [space |Res]); -%% var##para -sl_macro_expand([{var, Var}, {char,$#}, {char,$#}, {para,M} | T], Para, Defs, Res) -> - Exp = sl_var_para({var, Var},{para, M}, Para), - sl_macro_expand(Exp++T, Para, Defs, [space |Res]); - -%% expanded ## para -sl_macro_expand([space, {char,$#}, {char,$#}, space, {para,M} | T], Para, Defs, [{expanded, Var}|Res]) -> - [{var, VarM}] = lists:nth(M,Para), - sl_macro_expand(T, Para, Defs, [{expanded,VarM},{expanded,Var} |Res]); -%% expanded## para -sl_macro_expand([{char,$#}, {char,$#}, space, {para,M} | T], Para, Defs, [{expanded, Var}|Res]) -> - [{var, VarM}] = lists:nth(M,Para), - sl_macro_expand(T, Para, Defs, [{expanded,VarM},{expanded,Var} |Res]); -%% expanded ##para -sl_macro_expand([space, {char,$#}, {char,$#}, {para,M} | T], Para, Defs, [{expanded, Var}|Res]) -> - [{var, VarM}] = lists:nth(M,Para), - sl_macro_expand(T, Para, Defs, [{expanded,VarM},{expanded,Var} |Res]); -%% expanded##para -sl_macro_expand([{char,$#}, {char,$#}, {para,M} | T], Para, Defs, [{expanded, Var}|Res]) -> - [{var, VarM}] = lists:nth(M,Para), - sl_macro_expand(T, Para, Defs, [{expanded,VarM},{expanded,Var} |Res]); - -%% para ## ? -sl_macro_expand([{para, N}, space, {char,$#}, {char,$#}, space, X | T], Para, Defs, Res) -> - Reexp = sl_macro_reexpand(lists:nth(N,Para), Defs, []), - sl_macro_expand([X, space|T], Para, Defs, lists:flatten([Reexp, space|Res])); -%% para## ? -sl_macro_expand([{para, N}, {char,$#}, {char,$#}, space, X | T], Para, Defs, Res) -> - Reexp = sl_macro_reexpand(lists:nth(N,Para), Defs, []), - sl_macro_expand([X, space|T], Para, Defs, lists:flatten([Reexp, space|Res])); -%% para ##? -sl_macro_expand([{para, N}, space, {char,$#}, {char,$#}, X | T], Para, Defs, Res) -> - Reexp = sl_macro_reexpand(lists:nth(N,Para), Defs, []), - sl_macro_expand([X, space|T], Para, Defs, lists:flatten([Reexp, space|Res])); -%% para##? -sl_macro_expand([{para, N}, {char,$#}, {char,$#}, X | T], Para, Defs, Res) -> - Reexp = sl_macro_reexpand(lists:nth(N,Para), Defs, []), - sl_macro_expand([X, space|T], Para, Defs, lists:flatten([Reexp, space|Res])); - -sl_macro_expand([{char,$#}, {char,$#}, space |T], Para, Defs, [space|Res]) -> - sl_macro_expand(T, Para, Defs, Res); -sl_macro_expand([{char,$#}, {char,$#} |T], Para, Defs, [space|Res]) -> - sl_macro_expand(T, Para, Defs, Res); -sl_macro_expand([{char,$#}, {char,$#}, space |T], Para, Defs, Res) -> - sl_macro_expand(T, Para, Defs, Res); -sl_macro_expand([{char,$#}, {char,$#} |T], Para, Defs, Res) -> - sl_macro_expand(T, Para, Defs, Res); - -%%................... -%% Stringification -%%................... -sl_macro_expand([{char,$#}, {para, N}|T], Para, Defs, Res) -> - Nth = lists:nth(N,Para), - Tokens = detokenise(Nth), - sl_macro_expand(T, Para, Defs, [{string,Tokens}|Res]); -sl_macro_expand([{char,$#}, space, {para, N}|T], Para, Defs, Res) -> - Nth = lists:nth(N,Para), - Tokens = detokenise(Nth), - sl_macro_expand(T, Para, Defs, [{string,Tokens}|Res]); - -%%................... -%% A parameter -%%................... -sl_macro_expand([{para, N}|T], Para, Defs, Res) -> - Reexp = sl_macro_reexpand(lists:nth(N,Para), Defs, []), - sl_macro_expand(T, Para, Defs, lists:flatten([Reexp|Res])); - -%%................... -%% No parameter -%%................... -sl_macro_expand([H|T], Para, Defs, Res) -> - sl_macro_expand(T, Para, Defs, [H|Res]). - - - -%%------------------------------------------------- -%% Expand parameters -%%------------------------------------------------- -sl_para_para({para, N}, {para, M}, Para) -> - case sl_para_1st(lists:nth(N,Para)) of - {ok, Para1st} -> - Para1st ++ sl_para_2nd(lists:nth(M,Para)); - {exp, Para1st} -> - Para1st ++ sl_para_2nd(lists:nth(M,Para)) ++ [space_exp]; - {space, Para1st} -> - Para1st ++ [space_exp | sl_para_2nd(lists:nth(M,Para))] - end. - - -sl_var_para(Var, {para, M}, Para) -> - [Var|sl_para_2nd(lists:nth(M,Para))]. - - -sl_para_var({para, N}, Var, Para) -> - case sl_para_1st(lists:nth(N,Para)) of - {ok, Para1st} -> - Para1st ++ [Var]; - {exp, Para1st} -> - Para1st ++ [Var | space_exp]; - {space, Para1st} -> - Para1st ++ [space_exp | Var] - end. - - -sl_para_1st([{var, Var}]) -> - {ok,[{expanded,Var}]}; -sl_para_1st([{var, Var}, space]) -> - {ok,[{expanded,Var}]}; -sl_para_1st([{var, Var}, space_exp]) -> - {exp, [{expanded,Var}]}; -sl_para_1st(L) -> - {space, L}. - -sl_para_2nd([{var, Var}]) -> - [{expanded,Var}]; -sl_para_2nd([{var, Var}, space_exp]) -> - [{expanded,Var}]; -sl_para_2nd([space, {var, Var}]) -> - [{expanded,Var}]; -sl_para_2nd([space_exp, {var, Var}]) -> - [{expanded,Var}]; -sl_para_2nd(L) -> - L++[space]. - - - -%%------------------------------------------------- -%% Check if the expansion is a valid macro, -%% do not reexpand if concatination -%%------------------------------------------------- -sl_macro_reexpand([], _Defs, Result) -> - Result; -sl_macro_reexpand([{var,Var}|Rem], Defs, Result) -> - case lists:keysearch(Var, 1, Defs) of - {value, {Var, 0, _MacroPara, Macro}} -> - Rem2 = case Rem of - [space | RemT] -> - [space_exp | RemT]; - _ -> - [space_exp | Rem] - end, - sl_macro_reexpand(Macro++Rem2, Defs, Result); - _ -> - sl_macro_reexpand(Rem, Defs, [{var,Var}|Result]) - end; -sl_macro_reexpand([H|Rem], Defs, Result) -> - sl_macro_reexpand(Rem, Defs, [H|Result]). - - - -%%------------------------------------------------- -%% Self referring macros are marked not be reexpanded -%%------------------------------------------------- -sl_mark_expanded(QQ, Str) -> - sl_mark_expanded(QQ, Str, []). - -sl_mark_expanded([], _Str, Res) -> - lists:reverse(Res); -sl_mark_expanded([H|T], Str, Res) -> - case H of - {_,Str} -> - sl_mark_expanded(T, Str, [{expanded, Str}|Res]); - _ -> - sl_mark_expanded(T, Str, [H|Res]) - end. - - - - - - - - - -%%====================================================================================== -%%====================================================================================== -%%====================================================================================== -%% Misceleaneous functions -%%====================================================================================== -%%====================================================================================== -%%====================================================================================== - - -%%=============================================================== -%% Check the Flags for include directories -%%=============================================================== -include_dir(Flags) when is_list(Flags)-> - include_dir(Flags,[]); -include_dir(_Flags) -> - []. - -include_dir(Flags,IncDirs) -> - case string:str(Flags,"-I") of - 0 -> - lists:reverse(IncDirs); - X -> - {NewDir, RemainingFlags} = - gobble_inc_dir(string:sub_string(Flags, X+2),nq,[]), - include_dir(RemainingFlags, [NewDir|IncDirs]) - end. - -% nq = not-quoted, q = quoted. -% Possible strange scenarios: -% /usr/test\ ing/ -% "/usr/test ing/" -% /usr/test\"ing/ -% "/usr/test\"ing/" -gobble_inc_dir([],nq,Acc) -> - % Only accept nq here, if we end up here in q mode the user has missed a " - {lists:reverse(Acc),[]}; -gobble_inc_dir([$\\,$"|R],Q,Acc) -> - gobble_inc_dir(R,Q,[$"|Acc]); -gobble_inc_dir([$"|R],nq,Acc) -> - gobble_inc_dir(R,q,Acc); -gobble_inc_dir([$"|R],q,Acc) -> - gobble_inc_dir(R,nq,Acc); -gobble_inc_dir([$\\,$ |R],nq,Acc) -> - gobble_inc_dir(R,nq,[$ |Acc]); -gobble_inc_dir([$ |R],nq,Acc) -> - {lists:reverse(Acc),R}; -gobble_inc_dir([C|R],Q,Acc) -> - gobble_inc_dir(R,Q,[C|Acc]). - - -%%=============================================================== -%% Read a included file. Try current dir first then the IncDir list -%%=============================================================== - -read_inc_file(FileName, IncDir, Mio) -> - case find_inc_file(FileName, IncDir) of - {ok, AbsFile} -> - %% is included before? - case lists:member(FileName, Mio#mio.included) of - false -> - case catch file:read_file(AbsFile) of - {ok, Bin} -> - FileList = binary_to_list(Bin), - {ok, AbsFile, FileList}; - {error, Text} -> - {error, Text} - end; - true -> - skip - end; - {error, Text} -> - {error, Text} - end. - -find_inc_file(FileName, IncDir) -> - case catch file:read_file_info(FileName) of - {ok, _} -> - {ok, FileName}; - {error, _} -> - find_inc_file2(FileName, IncDir) - end. - -find_inc_file2(_FileName, []) -> - {error, "No such file or directory"}; -find_inc_file2(FileName, [D|Rem]) -> - Dir = case lists:last(D) of - $/ -> - D; - _ -> - D++"/" - end, - case catch file:read_file_info(Dir++FileName) of - {ok, _} -> - {ok, Dir++FileName}; - {error, _} -> - find_inc_file2(FileName, Rem) - end. - - -%%=============================================================== -%% Read parameters of a macro or a variable in a source line -%%=============================================================== -read_para([{char,$(} | Rem]) -> - read_para(Rem, 1, [], [], 1); -read_para([space,{char,$(} | Rem]) -> - read_para(Rem, 1, [], [], 1); -read_para(_Rem) -> - {ok, [], [], 0}. - - -%% Abrupt end of the list -read_para([], _NoOfParen, _Current, _Para, _NoOfPara) -> - {error, illegal_arg}; -%% All parameters checked -read_para([{char,$)}|Rem], 1, [], Para, NoOfPara) -> - {ok, Rem, lists:reverse(Para), NoOfPara}; -read_para([{char,$)}|Rem], 1, Current, Para, NoOfPara) -> - {ok, Rem, lists:reverse([Current|Para]), NoOfPara}; - -%% Continue reading -read_para([{char,$)}|Rem], NoOfParen, Current, Para, NoOfPara) -> - read_para(Rem, NoOfParen-1, Current++[{char,$)}], Para, NoOfPara); -read_para([{char,$(}|Rem], NoOfParen, Current, Para, NoOfPara) -> - read_para(Rem, NoOfParen+1, Current++[{char,$(}], Para, NoOfPara); -read_para([{char,$,}|Rem], NoOfParen, Current, Para, NoOfPara) when NoOfParen == 1 -> - read_para(Rem, NoOfParen, [], [Current|Para], NoOfPara+1); -read_para([space|Rem], NoOfParen, [], Para, NoOfPara) -> - read_para(Rem, NoOfParen, [], Para, NoOfPara); -read_para([X|Rem], NoOfParen, Current, Para, NoOfPara) -> - read_para(Rem, NoOfParen, Current++[X], Para, NoOfPara). - - - - - - -%%=================================================================================== -%% check if a macro is already defined -%%=================================================================================== -is_define_ok(Name, No_of_para, Parameters, Macro, Defs) -> - - case lists:keysearch(Name, 1, Defs) of - {value, {Name, No_of_para, _MacroPara, Macro}} -> - {yes, Defs}; - {value, _} -> - Defs2 = lists:keydelete(Name, 1, Defs), - NewMacro = is_define_ok_check_para(Parameters, Macro, []), - case is_stringify_ok(NewMacro) of - yes -> - {no, [{Name, No_of_para, Parameters, NewMacro}|Defs2]}; - no -> - ErrorText = "`#' operator is not followed by a macro argument name", - {error, ErrorText, [{Name, No_of_para, Parameters, NewMacro}|Defs2]} - end; - false -> - NewMacro = is_define_ok_check_para(Parameters, Macro, []), - case is_stringify_ok(NewMacro) of - yes -> - {yes, [{Name, No_of_para, Parameters, NewMacro}|Defs]}; - no -> - ErrorText = "`#' operator is not followed by a macro argument name", - {error, ErrorText, [{Name, No_of_para, Parameters, NewMacro}|Defs]} - end - end. - -is_define_ok_check_para(_Para, [], Result) -> - lists:reverse(Result); - -is_define_ok_check_para(Para, [H|T], Result) -> - case define_arg_para_number(1, Para, H) of - no_para -> - is_define_ok_check_para(Para, T, [H|Result]); - N -> - is_define_ok_check_para(Para, T, [{para,N}|Result]) - end. - -define_arg_para_number(_N, [], _Current) -> - no_para; -define_arg_para_number(N, [H|_Para], Current) when H == [Current] -> - N; -define_arg_para_number(N, [_H|Para], Current) -> - define_arg_para_number(N+1, Para, Current). - - -is_stringify_ok([]) -> - yes; -is_stringify_ok([{char,$#},{char,$#}|T]) -> - is_stringify_ok(T); -is_stringify_ok([{char,$#},space,{para,_X}|T]) -> - is_stringify_ok(T); -is_stringify_ok([{char,$#},{para,_X}|T]) -> - is_stringify_ok(T); -is_stringify_ok([{char,$#},space,{var,_X}|T]) -> - is_stringify_ok(T); -is_stringify_ok([{char,$#},{var,_X}|T]) -> - is_stringify_ok(T); -is_stringify_ok([{char,$#},space,{nl,_X}|_T]) -> - no; -is_stringify_ok([{char,$#},{nl,_X}|_T]) -> - no; -is_stringify_ok([{char,$#}|_T]) -> - no; -is_stringify_ok([_H|T]) -> - is_stringify_ok(T). - -%%=================================================================================== -%% check if a macro is already defined -%%=================================================================================== -is_defined_before(Name, No_of_para, Defs) -> - case lists:keysearch(Name, 1, Defs) of - {value, {Name, No_of_para, _MacroPara, _Macro}} -> - yes; - {value, _} -> - no; - false -> - no - end. - - - - -%%=================================================================================== -%% read_to_nl(File) -%%=================================================================================== -read_to_nl([space|Rem]) -> - read_to_nl(Rem, [], 1); -read_to_nl(Rem) -> - read_to_nl(Rem, [], 1). - -read_to_nl([], Result, Nl) -> - {lists:reverse(Result), [], Nl}; -read_to_nl([{nl, _N}|Rem], [{string_part,String} | Result], Nl) -> - read_to_nl(Rem, [nl, {string_part,String}|Result], Nl+1); -read_to_nl([{nl, _N}|Rem], [{sys_head_part,String} | Result], Nl) -> - read_to_nl(Rem, [nl, {sys_head_part,String}|Result], Nl+1); -read_to_nl([{nl, _N}|Rem], Result, Nl) -> - {lists:reverse(Result), Rem, Nl}; -read_to_nl([space|Rem], Result, Nl) -> - read_to_nl(Rem, [space|Result], Nl); -read_to_nl([{X,String}|Rem], Result, Nl) -> - read_to_nl(Rem, [{X,String}|Result], Nl). - - - - -%%=========================================================== -%% Read characters until next newline -%%=========================================================== -%read_to_nl2(Str) -> read_to_nl2([],Str). - -%read_to_nl2(Line, []) -> {Line,[]}; -%read_to_nl2(Line, [$\n|Str]) -> {Line, Str}; -%read_to_nl2(Line, [X|Str]) -> read_to_nl2([X|Line], Str). - - - - -%%=========================================================== -%% Remove leading spaces from a list -%%=========================================================== -remove_leading_spaces([?space|List]) -> - remove_leading_spaces(List); -remove_leading_spaces([?tab|List]) -> - remove_leading_spaces(List); -remove_leading_spaces(List) -> - List. - - - - -%%=========================================================== -%% Skip characters until next newline -%%=========================================================== -skip_to_nl([]) -> []; -skip_to_nl([$\n | Str]) -> Str; -skip_to_nl([$\\,$\n | Str]) -> [$/,$/|Str]; -skip_to_nl([_|Str]) -> skip_to_nl(Str). - - - - -month(1) -> "Jan"; -month(2) -> "Feb"; -month(3) -> "Mar"; -month(4) -> "Apr"; -month(5) -> "May"; -month(6) -> "Jun"; -month(7) -> "Jul"; -month(8) -> "Aug"; -month(9) -> "Sep"; -month(10) -> "Oct"; -month(11) -> "Nov"; -month(12) -> "Dec". - - -%% Multiple Include Optimization -%% -%% Algorithm described at: -%% http://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html -update_mio({include, FileName}, #mio{included=Inc}=Mio) -> - Mio#mio{valid=false, included=[FileName|Inc]}; - -%% valid=false & cmacro=undefined indicates it is already decided this file is -%% not subject to MIO -update_mio(_, #mio{valid=false, depth=0, cmacro=undefined}=Mio) -> - Mio; - -%% if valid=true, there is no non-whitespace tokens before this ifndef -update_mio({'ifndef', Macro}, #mio{valid=true, depth=0, cmacro=undefined}=Mio) -> - Mio#mio{valid=false, cmacro=Macro, depth=1}; - -%% detect any tokens before top level #ifndef -update_mio(_, #mio{valid=true, depth=0, cmacro=undefined}=Mio) -> - Mio#mio{valid=false}; - -%% If cmacro is alreay set, this is after the top level #endif -update_mio({'ifndef', _}, #mio{valid=true, depth=0}=Mio) -> - Mio#mio{valid=false, cmacro=undefined}; - -%% non-top level conditional, just update depth -update_mio({'ifndef', _}, #mio{depth=D}=Mio) when D > 0 -> - Mio#mio{depth=D+1}; -update_mio('ifdef', #mio{depth=D}=Mio) -> - Mio#mio{depth=D+1}; -update_mio('if', #mio{depth=D}=Mio) -> - Mio#mio{depth=D+1}; - -%% top level #else #elif invalidates multiple include optimization -update_mio('else', #mio{depth=1}=Mio) -> - Mio#mio{valid=false, cmacro=undefined}; -update_mio('else', Mio) -> - Mio; -update_mio('elif', #mio{depth=1}=Mio) -> - Mio#mio{valid=false, cmacro=undefined}; -update_mio('elif', Mio) -> - Mio; - -%% AT exit to top level, if the controlling macro is not set, this could be the -%% end of a non-ifndef conditional block, or there were tokens before entering -%% the #ifndef block. In either way, this invalidates the MIO -%% -%% It doesn't matter if `valid` is true at the time of exiting, it is set to -%% true. This will be used to detect if more tokens are following the top -%% level #endif. -update_mio('endif', #mio{depth=1, cmacro=undefined}=Mio) -> - Mio#mio{valid=false, depth=0}; -update_mio('endif', #mio{depth=1}=Mio) -> - Mio#mio{valid=true, depth=0}; -update_mio('endif', #mio{depth=D}=Mio) when D > 1 -> - Mio#mio{valid=true, depth=D-1}; - -%%if more tokens are following the top level #endif. -update_mio('endif', #mio{depth=1, cmacro=undefined}=Mio) -> - Mio#mio{valid=false, depth=0}; -update_mio('endif', #mio{depth=D}=Mio) when D > 0 -> - Mio#mio{valid=true, depth=D-1}; -update_mio(_, Mio) -> - Mio#mio{valid=false}. - -%% clear `valid`, this doesn't matter since #endif will restore it if -%% appropriate -update_mio(Mio) -> - Mio#mio{valid=false}. - - diff --git a/lib/ic/src/ic_pragma.erl b/lib/ic/src/ic_pragma.erl deleted file mode 100644 index 13c02cfcba..0000000000 --- a/lib/ic/src/ic_pragma.erl +++ /dev/null @@ -1,1957 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(ic_pragma). - - --export([pragma_reg/2,pragma_cover/3]). --export([pragma_prefix/3,pragma_version/3,pragma_id/3]). --export([mk_alias/3,get_alias/2,scope2id/2,id2scope/2,mk_scope/1]). --export([mk_ref/3,get_incl_refs/1,get_local_refs/1]). --export([get_dependencies/1, add_inh_data/3, preproc/3]). --export([getBrokerData/3,defaultBrokerData/1,list_to_term/1]). --export([get_local_c_headers/2,get_included_c_headers/1,is_inherited_by/3]). --export([no_doubles/1,fetchRandomLocalType/1,fetchLocalOperationNames/2]). --export([is_local/2]). - -%% Debug --export([print_tab/1,slashify/1,is_short/1]). - --import(lists,[suffix/2,delete/2,reverse/1,keysearch/3,member/2,last/1,flatten/1]). --import(string,[tokens/2]). --import(ets,[insert/2,lookup/2]). - --import(ic_forms, [get_id2/1, get_body/1, get_line/1]). --import(ic_util, [to_atom/1]). --import(ic_genobj, [idlfile/1]). --import(ic_options, [get_opt/2]). - --include("icforms.hrl"). --include("ic.hrl"). - - - - -%% Initialization of the pragma table and -%% start of pragma registration. -%% NOTE : this pragma registration is build -%% as a separate stage under compilation. -%% If it is to be optimised, it should be -%% embodied in one of other compiling stages. -pragma_reg(G,X) -> - S = ic_genobj:pragmatab(G), - init_idlfile(G,S), - init_pragma_status(S), - registerOptions(G,S), - pragma_reg_all(G, S, [], X), - denote_specific_code_opts(G), - case get_pragma_compilation_status(S) of - true -> - %% Remove ugly pragmas from form - PragmaCleanForm = cleanup(X), - {ok,PragmaCleanForm}; - false -> - ErrorNr = get_pragma_error_nr(S), - %% Just print the number of errors found - case ErrorNr > 1 of - true -> - io:format("There were ~p errors found on file ~p~n", - [ErrorNr,get_idlfile(S)]), - error; - false -> - io:format("There were ~p error found on file ~p~n", - [ErrorNr,get_idlfile(S)]), - error - end - end. - - - -registerOptions(G,S) -> - OptList = ets:tab2list(ic_genobj:optiontab(G)), - registerOptions(G,S,OptList). - - -registerOptions(_G,_S,[]) -> - true; -registerOptions(G,S,[{{option,{broker,Scope}},{Mod,Type}}|Rest]) -> - insert(S, - {codeopt, - reverse(tokens(Scope,":")), - {broker,{Mod,Type}}, - -1, - nil, - nil}), - registerOptions(G,S,Rest); -registerOptions(G,S,[_|Rest]) -> - registerOptions(G,S,Rest). - - -%% Decide if to apply pragmas -%% by checking backend switch -applyPragmasInBe(G) -> - case get_opt(G, be) of - erl_plain -> - false; - _ -> - true - end. - - -%% Decide if the code option directive -%% is allowed to change backend -applyCodeOpt(G) -> - case get_opt(G, be) of - erl_corba -> %% Does not support codeopt - false; - erl_plain -> %% Does not support codeopt - false; - c_native -> %% Does not support codeopt - false; - _ -> - true - end. - - - -%% This removes all pragma records from the form. -%% When debugged, it can be enbodied in pragma_reg_all. -cleanup(undefined,C) -> C; -cleanup([],C) -> C; -cleanup([X|Xs],CSF) -> - cleanup(Xs, CSF++cleanup(X)). - -cleanup(X) when is_list(X) -> cleanup(X,[]); -cleanup(X) when is_record(X, preproc) -> [X]; -cleanup(X) when is_record(X, pragma) -> []; -cleanup(X) when is_record(X, op) -> % Clean inside operation parameters - [ X#op{params = cleanup(X#op.params,[])}]; - -cleanup(X) when is_record(X, module) -> % Clean inside module body - [ X#module{body = cleanup(X#module.body,[])}]; - -cleanup(X) when is_record(X, interface) -> % Clean inside interface body - [ X#interface{body = cleanup(X#interface.body,[])}]; - -cleanup(X) when is_record(X, except) -> % Clean inside exception body - [ X#except{body = cleanup(X#except.body,[])}]; - -cleanup(X) when is_record(X, struct) -> % Clean inside struct body - [ X#struct{body = cleanup(X#struct.body,[])}]; - -cleanup(X) when is_record(X, case_dcl) -> % Clean inside union body - [ X#case_dcl{label = cleanup(X#case_dcl.label,[])}]; - -cleanup(X) when is_record(X, union) -> % Clean inside union body - [ X#union{body = cleanup(X#union.body,[])}]; - -cleanup(X) when is_record(X, enum) -> % Clean inside enum body - [ X#enum{body = cleanup(X#enum.body,[])}]; - -cleanup(X) -> [X]. - - - - -%% pragma_reg_all is top level registration for pragmas -pragma_reg_all(_G, _S, _N, []) -> ok; -pragma_reg_all(G, S, N, [X|Xs]) -> - pragma_reg(G, S, N, X), - pragma_reg_all(G, S, N, Xs). - - -%% pragma_reg is top level registration for pragmas -pragma_reg(G, S, N, X) when is_list(X) -> pragma_reg_list(G, S, N, X); -pragma_reg(_G, S, _N, X) when element(1, X) == preproc -> - case X#preproc.aux of - [{_, _, "1"}] -> - IncludeEntryLNr = get_line(X#preproc.id), - IncludeFileName = element(3,element(3,X)), - insert(S,{includes,get_idlfile(S),IncludeFileName,IncludeEntryLNr}); - _Other -> - ok - end, - set_idlfile(S,element(3,element(3,X))); -pragma_reg(G, S, N, X) when element(1, X) == pragma -> - case applyPragmasInBe(G) of - - %% Pragmas are allowed to be - %% applied in this this backend. - true -> - - File = get_idlfile(S), % The current file or an included one. - Type = case idlfile(G) of % Local/Included flag - File -> - local; - _ -> - included - end, - - %% Register pragmas into pragmatab. - case X of - {pragma,{_,LineNr,"prefix"}, _To, _Apply} -> - insert(S,{prefix,X,LineNr,N,File,Type}); - - {pragma,{_,_,"ID"},_,_} -> - pragma_reg_ID(G, S, N, X); - - {pragma,{_,_,"version"},_,_} -> - pragma_reg_version(G, S, N, X ); - - {pragma,{_,_,"CODEOPT"},_,_} -> - pragma_reg_codeOpt(G,S,N,X); - - {pragma,{_,LineNr,BadPragma}, _To, _Apply} -> - io:format("Warning : on file ~p :~n",[get_idlfile(S)]), - io:format(" Unknown pragma directive ~p on line ~p, ignored.~n", - [BadPragma,LineNr]) - end; - - %% Pragmas are not to be applied in - %% this backend, ignore all pragmas. - false -> - true - end, - ok; - -pragma_reg(G, S, N, X) when is_record(X, module) -> - mk_ref(G,[get_id2(X) | N],mod_ref), - mk_file_data(G,X,N,module), - pragma_reg_all(G, S, [get_id2(X) | N], get_body(X)); - -pragma_reg(G, S, N, X) when is_record(X, interface) -> - mk_ref(G,[get_id2(X) | N],ifc_ref), - mk_file_data(G,X,N,interface), - pragma_reg_all(G, S, [get_id2(X) | N], get_body(X)); - -pragma_reg(G, S, N, X) when is_record(X, op) -> - %% Add operation in table - insert(S,{op, - get_id2(X), - N, - get_idlfile(S), - get_filepath(S)}), - mk_file_data(G,X,N,op), - pragma_reg_all(G, S, N, X#op.params); - -pragma_reg(G, S, N, X) when is_record(X, except) -> - mk_ref(G,[get_id2(X) | N],except_ref), - mk_file_data(G,X,N,except), - pragma_reg_all(G, S, N, X#except.body); - -pragma_reg(G, _S, N, X) when is_record(X, const) -> - mk_ref(G,[get_id2(X) | N],const_ref), - mk_file_data(G,X,N,const); - -pragma_reg(G, _S, N, X) when is_record(X, typedef) -> - XX = #id_of{type=X}, - lists:foreach(fun(Id) -> - mk_ref(G,[get_id2(Id) | N],typedef_ref), - mk_file_data(G,XX#id_of{id=Id},N,typedef) - end, - ic_forms:get_idlist(X)); - -pragma_reg(G, S, N, X) when is_record(X, enum) -> - mk_ref(G,[get_id2(X) | N],enum_ref), - mk_file_data(G,X,N,enum), - pragma_reg_all(G, S, N, X#enum.body); - -pragma_reg(G, S, N, X) when is_record(X, union) -> - mk_ref(G,[get_id2(X) | N],union_ref), - mk_file_data(G,X,N,union), - pragma_reg_all(G, S, N, X#union.body); - -pragma_reg(G, S, N, X) when is_record(X, struct) -> - mk_ref(G,[get_id2(X) | N],struct_ref), - mk_file_data(G,X,N,struct), - case X#struct.body of - undefined -> - ok; - _ -> - pragma_reg_all(G, S, N, X#struct.body) - end; - -pragma_reg(G, _S, N, X) when is_record(X, attr) -> - XX = #id_of{type=X}, - lists:foreach(fun(Id) -> - mk_ref(G,[get_id2(Id) | N],attr_ref), - mk_file_data(G,XX#id_of{id=Id},N,attr) - end, - ic_forms:get_idlist(X)); - -pragma_reg(_G, _S, _N, _X) -> ok. - - - - -pragma_reg_list(_G, _S, _N, []) -> ok; -pragma_reg_list(G, S, N, List ) -> - CurrentFileName = get_idlfile(S), - pragma_reg_list(G, S, N, CurrentFileName, List). - -pragma_reg_list(_G, _S, _N, _CFN, []) -> ok; -pragma_reg_list(G, S, N, CFN, [X | Xs]) -> - case X of - {preproc,_,{_,_,FileName},_} -> - set_idlfile(S,FileName), - pragma_reg(G, S, N, X), - pragma_reg_list(G, S, N, FileName, Xs); - _ -> - pragma_reg(G, S, N, X), - pragma_reg_list(G, S, N, CFN, Xs) - end. - - - - - -pragma_reg_ID(G, S, N, X) -> - {pragma,{_,LineNr,"ID"}, _To, Apply} = X, - - - File = get_idlfile(S), % The current file or an included one. - Type = case idlfile(G) of % Local/Included flag - File -> - local; - _ -> - included - end, - - %% Check if ID is one of the allowed types : - %% * OMG IDL - %% * DCE UUID - %% * LOCAL - case tokens(element(3,Apply),":") of - ["IDL",_,_] -> - insert(S,{id,X,LineNr,N,File,Type}); - ["DCE",_,VSN] -> - case is_short(VSN) of - true -> - insert(S,{id,X,LineNr,N,File,Type}); - false -> - set_compilation_failure(S), - io:format("Error on file ~p :~n",[get_idlfile(S)]), - io:format(" Bad pragma ID ~p on line ~p,~n", - [element(3,Apply),LineNr]), - io:format(" the version part of ID is not a short integer.~n") - end; - ["LOCAL"|_] -> - insert(S,{id,X,LineNr,N,File,Type}); - _ -> - set_compilation_failure(S), - io:format("Error on file ~p :~n",[get_idlfile(S)]), - io:format(" Bad pragma ID ~p on line ~p.~n", - [element(3,Apply),LineNr]) - end. - - - -pragma_reg_version(G, S, N, X) -> - {pragma,{_,LineNr,"version"}, _To, Apply} = X, - - File = get_idlfile(S), % The current file or an included one. - Type = case idlfile(G) of % Local/Included flag - File -> - local; - _ -> - included - end, - - case tokens(Apply,".") of - [Major,Minor] -> - case is_short(Major) and is_short(Minor) of - true -> - insert(S,{version,X,LineNr,N,File,Type}); - false -> - set_compilation_failure(S), - io:format("Error on file ~p :~n",[get_idlfile(S)]), - io:format(" Bad pragma version ~p on line ~p,~n", - [Apply,LineNr]), - io:format(" the version is not valid.~n") - end; - _ -> - set_compilation_failure(S), - io:format("Error on file ~p :~n",[get_idlfile(S)]), - io:format(" Bad pragma version ~p on line ~p,~n", - [Apply,LineNr]), - io:format(" the version is not valid.~n") - end. - - -pragma_reg_codeOpt(G, S, _N, {pragma,{_,LineNr,"CODEOPT"},_,Apply} )-> - case applyCodeOpt(G) of - true -> - {_,_,OptionList_str} = Apply, - case list_to_term(OptionList_str) of - error -> - ic_error:error(G,{pragma_code_opt_bad_option_list,LineNr}); - OptionList -> - case lists:keysearch(be,1,OptionList) of - false -> - %% Add the terms of the option list - %% to the compiler option list - applyCodeOpts(G,S,LineNr,OptionList); - {value, {be,Type}} -> - %% If backend is set from user, - %% let the same backend be otherwize - %% set backend by codeOpt directive - case get_opt(G, be) of - false -> - %% Add the terms of the option list - %% to the compiler option list - applyCodeOpts(G,S,LineNr,OptionList); - _ -> - %% Add all the terms of the option list - %% to the compiler option list but the - %% backend option - applyCodeOpts(G, - S, - LineNr, - lists:delete({be,Type},OptionList)) - end - end - end; - false -> - true - end. - - - -applyCodeOpts(_,_,_,[]) -> - true; -applyCodeOpts(G,S,LNr,[{{broker,Scope},{M,T}}|Xs]) -> - ScopedId = reverse(tokens(Scope,":")), - case ets:match(S, - {codeopt,ScopedId, - '$1','$2','_','_'}) of - [] -> - %% Add pragma in table - insert(S, - {codeopt, - ScopedId, - {broker,{M,T}}, - LNr, - get_idlfile(S), - get_filepath(S)}), - %% Continue - applyCodeOpts(G,S,LNr,Xs); - _ -> - %% Use the code option - %% from user and continue - applyCodeOpts(G,S,LNr,Xs) - end; -applyCodeOpts(G,S,LNr,[X|Xs]) -> - case is_allowed_opt(X) of - true -> - %% Add that term of the option list - %% to the compiler option list - ic_options:add_opt(G, [X], true), - %% Continue - applyCodeOpts(G,S,LNr,Xs); - false -> - %% Print warning and continue - io:format("Warning on file ~p :~n",[get_idlfile(S)]), - io:format(" Bad option in pragma : ~p, ignored !~n",[X]), - applyCodeOpts(G,S,LNr,Xs) - end. - - -is_allowed_opt({X,Y}) -> - ic_options:allowed_opt(X,Y); -is_allowed_opt(_X) -> - false. - - - -%% Returns a tuple { PFX, VSN, ID }, that is the -%% pragma prefix, version and id coverages of -%% the scope SCOPE. This is done by use of the -%% function pragma_cover/4. -pragma_cover(G,Scope,Object) -> - pragma_cover(ic_genobj:pragmatab(G),get_id2(Object),Scope,get_line(Object)). - -%% Returns a tuple { PFX, VSN, ID }, that is the -%% pragma prefix, version and id coverages of -%% the scope SCOPE -pragma_cover(PragmaTab,Name,Scope,LineNr) -> - PFX = pragma_prefix_cover(PragmaTab,Name,Scope,LineNr), - VSN = pragma_version_cover(PragmaTab,Name,Scope,LineNr), - ID = pragma_id_cover(PragmaTab,Name,Scope,LineNr), - { PFX, VSN, ID }. - - - -%% Finds out which pragma PREFIX that affects -%% the scope Scope -pragma_prefix(G,Scope,Object) -> - pragma_prefix_cover(ic_genobj:pragmatab(G),get_id2(Object),Scope,get_line(Object)). - - -%% Finds out which pragma PREFIX that affects -%% the scope Scope -pragma_prefix_cover(PragmaTab,Name,Scope,LineNr) -> - case lookup(PragmaTab,prefix) of - [] -> - none; - PragmaPrefixList -> - FilteredPragmaPrefixList = - filter_pragma_prefix_list(PragmaTab,Name,Scope,PragmaPrefixList), - case most_local(FilteredPragmaPrefixList,Scope) of - [] -> - none; - MostLocalList -> - case dominant_prefix(MostLocalList,LineNr) of - none -> - none; - - %% Just filter empty pragma prefix - {prefix,{pragma,{_,_,_},_,{'',_,[]}},_,_,_,_} -> - none; - - DP -> - %% Return the scoped id (reversed list of - %% path elements, but remember to remove - %% '[]' that represents the top level - slashify(lists:sublist(Scope, 1, - length(Scope) - length(element(4,DP))) ++ - [ element(3,element(4,element(2,DP)))]) - end - end - end. - - -%% Returns a slashified name, [I1, M1] becomes "M1/I1" -slashify(List) -> lists:foldl(fun(X, Acc) -> X++"/"++Acc end, - hd(List), tl(List)). - - -%% Finds out which pragma VERSION that affects -%% the scope Scope -pragma_version(G,Scope,Object) -> - pragma_version_cover(ic_genobj:pragmatab(G),get_id2(Object),Scope,get_line(Object)). - -%% Finds out which pragma VERSION that affects -%% the scope Scope -pragma_version_cover(PragmaTab,Name,Scope,LineNr) -> - case lookup(PragmaTab,version) of - [] -> - default_version(); - PragmaVersionList -> - case all_actual_for_version_or_id( PragmaVersionList, Name ) of - [] -> - default_version(); - ActualVersionList -> - case most_local(ActualVersionList,Scope) of - [] -> - default_version(); - MostLocalList -> - case dominant_version(MostLocalList,LineNr) of - DV -> - element(4,element(2,DV)) - end - end - end - end. - - -default_version() -> "1.0". - - - -%% Finds out which pragma ID that affects -%% the scope Scope -pragma_id(G,Scope,Object) -> - pragma_id_cover(ic_genobj:pragmatab(G),get_id2(Object),Scope,get_line(Object)). - -%% Finds out which pragma ID that affects -%% the scope Scope -pragma_id_cover(PragmaTab,Name,Scope,LineNr) -> - case lookup(PragmaTab,id) of - [] -> - none; - PragmaIdList -> - case all_actual_for_version_or_id( PragmaIdList, Name ) of - [] -> - none; - ActualIdList -> - case most_local(ActualIdList,Scope) of - [] -> - none; - MostLocalList -> - case dominant_id(MostLocalList,LineNr) of - PI -> - element(3,element(4,element(2,PI))) - end - end - end - end. - - - - -%% Finds out which pragma VERSION ( or ID ) that -%% that affects the scope object with name NAME -all_actual_for_version_or_id(NList, Name) -> - all_actual_for_version_or_id( NList, [], Name ). - -all_actual_for_version_or_id([], Actual, _) -> - Actual; -all_actual_for_version_or_id([First|Rest], Found, Name) -> - case is_actual_for_version_or_id(First,Name) of - true -> - all_actual_for_version_or_id(Rest, [First|Found], Name); - false -> - all_actual_for_version_or_id(Rest, Found, Name) - end. - -is_actual_for_version_or_id( Current, Name ) -> - case element(3,element(3,element(2,Current))) of - Name -> - true; - OtherName -> - suffix([Name],tokens(OtherName,"::")) - end. - - - - -%% Find the most locally defind pragmas -%% to the scope SCOPE -most_local( SList, Scope ) -> - case SList of - [] -> - []; - [First|Rest] -> - case suffix( element(4,First), Scope ) of - true -> - most_local( Rest, First, Scope, [First] ); - false -> - most_local( Rest, Scope ) - end - end. - -%% Returns a list of all pragmas found in the -%% same scope. Should choose the right one by looking -%% att the position of the pragma in relation to -%% the current object..... ( For hairy cases ). -most_local( SList, Current, Scope, AllFound ) -> - case SList of - [] -> - AllFound; - [First|Rest] -> - FirstScope = element(4,First), - case suffix( FirstScope, Scope ) of - true -> - CurrentScope = element(4,Current), - case suffix( CurrentScope, FirstScope ) of - true -> - case length( CurrentScope ) == length( FirstScope ) of - true -> %% SAME SCOPE ! KEEP BOTH - most_local( Rest, Current, Scope, [First|AllFound] ); - false -> - most_local( Rest, First, Scope, [First] ) - end; - false -> - most_local( Rest, Current, Scope, AllFound ) - end; - false -> - most_local( Rest, Current, Scope, AllFound ) - end - end. - - - - -%% Find the most dominant prefix pragmas -%% located onto the SAME scope. Now -%% we look att the line number, the position -%% on the file. -dominant_prefix(SList,LineNr) -> - case SList of - [First|Rest] -> - dominant_prefix(Rest,First,LineNr) - end. - - -dominant_prefix([],{prefix,X,PLNr,N,F,T},LineNr) -> - case LineNr > PLNr of - true -> - {prefix,X,PLNr,N,F,T}; - false -> - none - end; -dominant_prefix([{prefix,FX,FPLNr,FN,F1,T1}|Rest],{prefix,CX,CPLNr,CN,F2,T2},LineNr) -> - case LineNr > FPLNr of % Check if FIRST before the object - true -> - case FPLNr > CPLNr of % Check if FIRST after CURRENT - true -> - dominant_prefix(Rest,{prefix,FX,FPLNr,FN,F1,T1},LineNr); - false -> - dominant_prefix(Rest,{prefix,CX,CPLNr,CN,F2,T2},LineNr) - end; - false -> % FIRST does not affect the object - dominant_prefix(Rest,{prefix,CX,CPLNr,CN,F2,T2},LineNr) - end. - - - - -%% Find the most dominant version pragmas -%% located onto the SAME scope. Now -%% we look att the line number, the position -%% on the file. -dominant_version(SList,LineNr) -> - case SList of - [First|Rest] -> - dominant_version(Rest,First,LineNr) - end. - - -dominant_version([],Current,_) -> Current; -dominant_version([{version,FX,FPLNr,FN,F1,T1}|Rest],{version,CX,CPLNr,CN,F2,T2},LineNr) -> - case FPLNr > CPLNr of % Check if FIRST after CURRENT - true -> - dominant_version(Rest,{prefix,FX,FPLNr,FN,F1,T1},LineNr); - false -> - dominant_version(Rest,{prefix,CX,CPLNr,CN,F2,T2},LineNr) - end. - - - - -%% Find the most dominant id pragmas -%% located onto the SAME scope. Now -%% we look att the line number, the position -%% on the file. -dominant_id(SList,LineNr) -> - case SList of - [First|Rest] -> - dominant_id(Rest,First,LineNr) - end. - - -dominant_id([],Current,_) -> Current; -dominant_id([{id,FX,FPLNr,FN,F1,T1}|Rest],{id,CX,CPLNr,CN,F2,T2},LineNr) -> - case FPLNr > CPLNr of % Check if FIRST after CURRENT - true -> - dominant_id(Rest,{id,FX,FPLNr,FN,F1,T1},LineNr); - false -> - dominant_id(Rest,{id,CX,CPLNr,CN,F2,T2},LineNr) - end. - - - - - -%% This registers a module defined inside the file or -%% an included file. A tuple that describes the module -%% is added to the table. -%% Observe that the modules registered are ONLY those -%% who are in the top level, not definedd inside others ! -mk_ref(G,Name,Type) -> - case length(Name) > 1 of - true -> %% The interface is NOT defined att top level - true; - false -> - S = ic_genobj:pragmatab(G), - File = get_idlfile(S), % The current file or an included one. - case idlfile(G) of % The current file to be compiled. - File -> - insert(S,{Type,Name,File,local}); - _ -> - insert(S,{Type,Name,File,included}) - end - end. - - -%% The same as mk_ref/3 but this registers everything with -%% all vital information available inside files. -%% Registers ESSENTIAL data for included files -mk_file_data(G,X,Scope,Type) -> - S = ic_genobj:pragmatab(G), - Name = get_id2(X), - PreprocFile = get_idlfile(S), % The current file or an included one. - CompFile = idlfile(G), % The current file compiled - Depth = length(Scope), % The depth of the scope - ScopedName = ic_util:to_undersc([Name|Scope]), - Line = ic_forms:get_line(X), - case PreprocFile of - CompFile -> - insert(S,{file_data_local,CompFile,CompFile,Type,Scope,Name,ScopedName,Depth,Line}); - PreprocFile -> - insert(S,{file_data_included,PreprocFile,CompFile,Type,Scope,Name,ScopedName,Depth,Line}) - end. - - - -%% Return a list with all the headers from -%% the local file that represent the module -%% or interface that is preciding the current -get_local_c_headers(G,X) -> - S = ic_genobj:pragmatab(G), - Local = lookup(S,file_data_local), - FoundLocal = get_local_c_headers(X,Local,Local), - no_doubles(FoundLocal). - -get_local_c_headers(X,Local,Local) -> - get_local_c_headers(X,Local,Local,[]). - -get_local_c_headers(_X,[],_All,Found) -> - Found; -get_local_c_headers(X,[{file_data_local,_PF_idl,_,module,_,_,SN,_,Line}|Hs],All,Found)-> - case ic_forms:get_line(X) > Line of - true -> - get_local_c_headers(X,Hs,All,[SN|Found]); - false -> - get_local_c_headers(X,Hs,All,Found) - end; -get_local_c_headers(X,[{file_data_local,_PF_idl,_,interface,_,_,SN,_,Line}|Hs],All,Found)-> - case ic_forms:get_line(X) > Line of - true -> - get_local_c_headers(X,Hs,All,[SN|Found]); - false -> - get_local_c_headers(X,Hs,All,Found) - end; -get_local_c_headers(X,[_|Hs],All,Found) -> - get_local_c_headers(X,Hs,All,Found). - - - -%% Return a list with all the headers from -%% the included file that represent the module -%% or interface that have to be included -get_included_c_headers(G) -> - S = ic_genobj:pragmatab(G), - Included = lookup(S,file_data_included), - FoundIncluded = get_included_c_headers(Included,Included), - no_doubles(FoundIncluded). - -get_included_c_headers(Included,Included) -> - get_included_c_headers(Included,Included,[]). - -get_included_c_headers([],_All,Found) -> - Found; -get_included_c_headers([{file_data_included,PF_idl,_CF_idl,T,_S,_N,SN,0,_}|Hs],All,Found) -> - Len = length(PF_idl), - FN = string:sub_string(PF_idl,1,Len-4), - case only_top_level(PF_idl,All) of - true -> - %% - L = string:tokens(FN,"/"), - FN2 = lists:last(L), - %% - get_included_c_headers(Hs,All,["oe_"++FN2|Found]); - false -> - case T of - module -> - case contains_interface(PF_idl,All) of - true -> - %% - L = string:tokens(FN,"/"), - FN2 = lists:last(L), - %% - get_included_c_headers(Hs,All,["oe_"++FN2|Found]); - false -> - get_included_c_headers(Hs,All,[SN|Found]) - end; - interface -> - case contains_interface(PF_idl,All) of - true -> - %% - L = string:tokens(FN,"/"), - FN2 = lists:last(L), - %% - get_included_c_headers(Hs,All,["oe_"++FN2|Found]); - false -> - get_included_c_headers(Hs,All,[SN|Found]) - end; - _ -> - get_included_c_headers(Hs,All,["oe_"++FN|Found]) - end - end; -get_included_c_headers([{file_data_included,_PF_idl,_,module,_,_,SN,_,_}|Hs],All,Found)-> - get_included_c_headers(Hs,All,[SN|Found]); -get_included_c_headers([{file_data_included,_PF_idl,_,interface,_,_,SN,_,_}|Hs],All,Found)-> - get_included_c_headers(Hs,All,[SN|Found]); -get_included_c_headers([_|Hs],All,Found) -> - get_included_c_headers(Hs,All,Found). - -%% Help functions for the above - -only_top_level(_PF_idl,[]) -> - true; -only_top_level(PF_idl,[H|Hs]) -> - case element(2,H) of - PF_idl -> - case element(8,H) > 0 of - true -> - false; - false -> - only_top_level(PF_idl,Hs) - end; - _ -> - only_top_level(PF_idl,Hs) - end. - -contains_interface(_PF_idl,[]) -> - false; -contains_interface(PF_idl,[H|Hs]) -> - case element(2,H) of - PF_idl -> - case element(4,H) of - interface -> - case element(8,H) > 0 of - true -> - true; - false -> - contains_interface(PF_idl,Hs) - end; - _ -> - contains_interface(PF_idl,Hs) - end; - _ -> - contains_interface(PF_idl,Hs) - end. - - - -%% This returns a list of everything defined in an included file. -get_incl_refs(G) -> - S = ic_genobj:pragmatab(G), - - RefList = - ets:match(S,{mod_ref,'$0','_',included}) ++ - ets:match(S,{ifc_ref,'$0','_',included}) ++ - ets:match(S,{const_ref,'$0','_',included}) ++ - ets:match(S,{typedef_ref,'$0','_',included}) ++ - ets:match(S,{except_ref,'$0','_',included}) ++ - ets:match(S,{struct_ref,'$0','_',included}) ++ - ets:match(S,{union_ref,'$0','_',included}) ++ - ets:match(S,{enum_ref,'$0','_',included}) ++ - ets:match(S,{attr_ref,'$0','_',included}), - - case RefList of - [] -> - none; - _ -> - RefList - end. - - - -%% This returns a list of everything locally defined. -get_local_refs(G) -> - S = ic_genobj:pragmatab(G), - - RefList = - ets:match(S,{mod_ref,'$0','_',local}) ++ - ets:match(S,{ifc_ref,'$0','_',local}) ++ - ets:match(S,{const_ref,'$0','_',local}) ++ - ets:match(S,{typedef_ref,'$0','_',local}) ++ - ets:match(S,{except_ref,'$0','_',local}) ++ - ets:match(S,{struct_ref,'$0','_',local}) ++ - ets:match(S,{union_ref,'$0','_',local}) ++ - ets:match(S,{enum_ref,'$0','_',local}) ++ - ets:match(S,{attr_ref,'$0','_',local}), - - case RefList of - [] -> - none; - _ -> - RefList - end. - - - - - -%% This is intented to be used for solving the identification -%% problem introduced by pragmas. It creates aliases between -%% scoped and "final" identities. -mk_alias(G,PragmaId,ScopedId) -> - %io:format("~nMaking alias -> ~p~n",[PragmaId]), - S = ic_genobj:pragmatab(G), - insert(S,{alias,ScopedId,PragmaId}). - - -%% This is used to find out if the object described with -%% the scoped id is created. If this is the case, it should -%% be registered as an alias and the identity of the object -%% is returned. Otherwize "none" is returned. -get_alias(G,ScopedId) -> - S = ic_genobj:pragmatab(G), - case ets:match(S,{alias,ScopedId,'$1'}) of - [] -> - none; - [[IfrId]] -> - %io:format("~nFound alias -> ~p~n",[IfrId]), - IfrId - end. - - - -%% Returns the alias id or constructs an id -scope2id(G,ScopedId) -> - case get_alias(G,ScopedId) of - none -> - case is_included(G,ScopedId) of - true -> %% File included - get_included_IR_ID(G,ScopedId); - false -> %% File local - NewIfrId = mk_id(ScopedId), % Create a "standard" id - mk_alias(G,NewIfrId,ScopedId), % Create an alias - NewIfrId - end; - IfrId -> - IfrId - end. - - - - -is_included(G,ScopedId) -> - S = ic_genobj:pragmatab(G), - Name = ic_util:to_undersc(ScopedId), - case ets:match(S,{file_data_included,'_','_','_','_','_',Name,'_','_'}) of - [[]] -> - true; - _ -> - false - end. - - - -get_included_IR_ID(G,ScopedId) -> - S = ic_genobj:pragmatab(G), - ScopedName = ic_util:to_undersc(ScopedId), - [[Scope,Name,LNr]] = ets:match(S,{file_data_included,'_','_','_','$3','$4',ScopedName,'_','$7'}), - {Prefix,Vsn,Id} = pragma_cover(S,Name,Scope,LNr), - case Id of - none -> - case Prefix of - none -> - IR_ID = - lists:flatten(io_lib:format("IDL:~s:~s",[ScopedName, Vsn])), - ic_pragma:mk_alias(G,IR_ID,ScopedId), - IR_ID; - _ -> - IR_ID = - lists:flatten(io_lib:format("IDL:~s:~s",[Prefix ++ "/" ++ ScopedName, Vsn])), - ic_pragma:mk_alias(G,IR_ID,ScopedId), - IR_ID - end; - _ -> - ic_pragma:mk_alias(G,Id,ScopedId), - Id - end. - - - - - -%% Returns the scope for object -id2scope(G,IfrId) -> - S = ic_genobj:pragmatab(G), - case lookup(S,alias) of - [] -> - mk_scope(IfrId); - AliasList -> - case keysearch(IfrId,3,AliasList) of - false -> - mk_scope(IfrId); - {value,{alias,ScopedId,_}} -> - ScopedId - end - end. - -%% Returns a "standard" IDL ID by getting the scope list -mk_id(ScopedId) -> - "IDL:" ++ ic_pragma:slashify(ScopedId) ++ ":" ++ default_version(). - -%% Returns the scope of an object when getting a "standard" IDL ID -mk_scope(IfrId) -> - [_,Body,_] = tokens(IfrId,":"), - reverse(tokens(Body,"/")). - - - -%% This is used to note the exact compiled file -%% under pragma creation. There are two options, the -%% main file or files included by the main file. This -%% just denotes the CURRENT file, the main file or -%% the included ones. A very usual field is the file -%% path that shows the include path of the file - -init_idlfile(G,S) -> - IdlFile = idlfile(G), - insert(S,{file,IdlFile,[]}). - -set_idlfile(S,FileName) -> - FilePath = get_filepath(S), - case FilePath of - [] -> - ets:delete(S,file), - insert(S,{file,FileName,[FileName|FilePath]}); - _ -> - case hd(FilePath) of - [] -> - ets:delete(S,file), - insert(S,{file,FileName,[FileName|FilePath]}); - _ -> - case tl(FilePath) of - [] -> - ets:delete(S,file), - insert(S,{file,FileName,[FileName|FilePath]}); - _ -> - case hd(tl(FilePath)) of - [] -> - ets:delete(S,file), - insert(S,{file,FileName,[FileName|FilePath]}); - FileName -> - ets:delete(S,file), - insert(S,{dependency,FilePath}), % Add dependency branch - insert(S,{file,FileName,tl(FilePath)}); - _ -> - ets:delete(S,file), - insert(S,{file,FileName,[FileName|FilePath]}) - end - end - end - end. - -get_idlfile(S) -> - [FT] = lookup(S,file), - element(2,FT). - -get_filepath(S) -> - [FT] = lookup(S,file), - element(3,FT). - - -%% This returns a list of file names -%% that direct or indirect the current -%% compiled file is depended on. -get_dependencies(G) -> - S = ic_genobj:pragmatab(G), - case lookup(S,dependency) of - [] -> - []; - Dependencies -> - {get_idlfile(S),get_dependencies(Dependencies,[])} - end. - -get_dependencies([],Dependencies) -> - no_doubles(Dependencies); -get_dependencies([{dependency,Path}|Tail],Current) -> - get_dependencies(Tail,[hd(Path)|Current]). - - -no_doubles(List) -> - no_doubles(List,[]). - -no_doubles([],NoDoubles) -> - NoDoubles; -no_doubles([X|Xs],Current) -> - case member(X,Xs) of - true -> - no_doubles(Xs,Current); - false -> - no_doubles(Xs,[X|Current]) - end. - - - - -%% Pragma compilation status initialization -init_pragma_status(S) -> - insert(S,{status,true,0}). - -%% Pragma compilation status set to failure -%% and count up the number of errors -set_compilation_failure(S) -> - [{status,_,ErrorNr}] = lookup(S,status), - ets:delete(S,status), - insert(S,{status,false,ErrorNr+1}). - -%% Pragma compilation status set to lookup -get_pragma_compilation_status(S) -> - [Status] = lookup(S,status), - element(2,Status). - -%% Pragma error number -get_pragma_error_nr(S) -> - [Status] = lookup(S,status), - element(3,Status). - - -%% Short check -is_short(N_str) when is_list(N_str) -> - case is_short_decimal_str(N_str) of - true -> - true; - false -> - false - end; -is_short(N) when is_integer(N)-> - (N < 65535) and (N > -65536); -is_short(_) -> false. - - -%% Check if the string is a -%% list of characters representing -%% a short. Avoid crash !. -is_short_decimal_str(N_str) -> - case is_decimal_str(N_str) of - true -> - N = list_to_integer(N_str), - (N < 65535) and (N > -65536); - false -> - false - end. - -%% Check if the string is a -%% list of characters representing -%% decimals. -is_decimal_str([]) -> - true; -is_decimal_str([First|Rest]) -> - case is_decimal_char(First) of - true -> - is_decimal_str(Rest); - false -> - false - end. - -%% True if D is a character -%% representing a decimal (0-9). -is_decimal_char(D) -> - case (48= - true; - false -> - false - end. - - -%% Prints out all the table -print_tab(G) -> - io:format("~nPragmaTab = ~p~n",[ets:tab2list(ic_genobj:pragmatab(G))]). - - -list_to_term(List) -> - case catch erl_scan:string(List) of - {ok, Tokens, _} -> - case erl_parse:parse_term(Tokens ++ [{dot, 1}]) of - {ok,Term} -> - Term; - _ -> - error - end; - _ -> - error - end. - - - -%% Cleanup all other code options for a specified scope -%% in the same file, but the most dominant. -cleanup_codeOptions(G,S,ScopedId) -> - case ets:match(S,{codeopt,ScopedId,'$1','$2',idlfile(G),'$4'}) of - [] -> - %% No codeOpt directive is placed inside the - %% currently compiled file. Try to find other - %% directives located in included files. - true; - List -> - %% A codeOpt directive is placed inside the - %% currently compiled file. This dominates - %% all other directives. - CodeOption = best_positioned_codeOpt(List), - %% Remove code options that do not affect - %% the code production (redundant) - remove_redundant_codeOpt(S,[ScopedId|CodeOption]) - end. - - -%% Best positioned is the codeopt located -%% "highest" on the SAME file, the one with -%% lowest line number. -best_positioned_codeOpt([X|Xs]) -> - best_positioned_codeOpt(Xs,X). - -best_positioned_codeOpt([],Found) -> - Found; -best_positioned_codeOpt([X|Xs],Current) -> - case hd(tl(X)) > hd(tl(Current)) of - true -> - best_positioned_codeOpt(Xs,Current); - false -> - best_positioned_codeOpt(Xs,X) - end. - - -remove_redundant_codeOpt(S,[ScopedId,CodeOption,LNr,FilePath]) -> - ets:match_delete(S,{codeopt,ScopedId,'$1','$2','$3','$4'}), - ets:insert(S,{codeopt,ScopedId,CodeOption,LNr,last(FilePath),FilePath}). - - - - -add_inh_data(G,InclScope,X) -> - S = ic_genobj:pragmatab(G), - case X#interface.inherit of - [] -> - true; - [InhBody] -> - Scope = [get_id2(X)|InclScope], - insert(S,{inherits,Scope,InhBody}); - InhList -> - add_inh_data(G, S, InclScope, X, InhList) - end. - -add_inh_data(_,_,_,_,[]) -> - true; -add_inh_data(G, S, InclScope, X, [InhBody|InhBodies]) -> - Scope = [get_id2(X)|InclScope], - insert(S, {inherits,Scope,InhBody}), - add_inh_data(G, S, InclScope, X, InhBodies). - - -%% Returns a default broker data -defaultBrokerData(G) -> - {to_atom(ic_genobj:impl(G)),transparent}. - - -%% Loops through the form and sdds inheritence data -preproc(G, N, [X|Xs]) when is_record(X, interface) -> - %% Add inheritence data to pragmatab - ic_pragma:add_inh_data(G,N,X), - N2 = [get_id2(X) | N], - preproc(G, N2, get_body(X)), - lists:foreach(fun({_Name, Body}) -> preproc(G, N2, Body) end, - X#interface.inherit_body), - preproc(G, N, Xs); - -preproc(G,N,[X|Xs]) when is_record(X, module) -> - N2 = [get_id2(X) | N], - preproc(G, N2, get_body(X)), - preproc(G,N,Xs); - -preproc(G,N,[_X|Xs]) -> - preproc(G,N,Xs); - -preproc(_G, _N, []) -> - ok. - - -%% Returns a tuple / list of tuples { Mod, Type } -%% Does not check overridence because it is the -%% top scope for the module to be produced and -%% cannot be overriden. -getBrokerData(G,X,Scope) -> - S = ic_genobj:pragmatab(G), - cleanup_codeOptions(G,S,Scope), - - %% Check if it is an operation denoted - case isOperation(S,Scope) of - %% Yes, check options - true -> - %% Look if there is a specific code option on top file - case hasSpecificCodeoptionOnTopFile(S,ic_genobj:idlfile(G),Scope) of - true -> - %% Yes, let it work - getBrokerData(G,S,X,Scope,[Scope],[]); - false -> - %% No, try to see if there is codeoption on top file - case hasNonSpecificCodeoptionOnTopFile(S,ic_genobj:idlfile(G)) of - true -> - %% Yes, override every other specific code option - [_H|T] = Scope, - getBrokerData(G,S,X,Scope,[T],[]); - false -> - %% No, let inherited specific code options work - getBrokerData(G,S,X,Scope,[Scope],[]) - end - end; - %% No, continue - false -> - getBrokerData(G,S,X,Scope,[Scope],[]) - end. - -%% Returns a tuple / list of tuples { Mod, Type } -%% Inside loop, uses overridence. -getBrokerData(G,X,RS,Scope,CSF) -> - S = ic_genobj:pragmatab(G), - cleanup_codeOptions(G,S,Scope), - OvScope = overridedFrom(S,RS,Scope), - getBrokerData(G,S,X,RS,[OvScope],[OvScope|CSF]). - - - -getBrokerData(G,S,X,RS,[[[First]|Rest]],CSF) when is_integer(First) -> - Scope = [[First]|Rest], - case ets:match(S,{codeopt,Scope,'$1','_','_','_'}) of - [] -> - case ets:match(S,{inherits,Scope,'$1'}) of - [] -> %% No inheritence, no pragma codeopt - defaultBrokerData(G); %% Default - [InhScope] -> - getBrokerData(G,S,X,RS,InhScope,CSF); - InhList -> - getBrokerDataInh(G,S,X,RS,Scope,CSF,InhList) - end; - [[{broker,{Module,Type}}]] -> %% A branch only, with pragma codeopt - {Module,Type}; - List -> %% Multiple branches with pragma codeopt - flatten(List) - end; - -getBrokerData(G,S,X,RS,[[[First]|Rest]],CSF) -> - getBrokerDataLoop(G,S,X,RS,[[First]|Rest],CSF); - -getBrokerData(G,S,X,RS,[Scope],CSF) -> - %io:format(" 1"), - case ets:match(S,{codeopt,Scope,'$1','_','_','_'}) of - [] -> - %io:format(" 2"), - case ets:match(S,{inherits,Scope,'$1'}) of - [] -> %% No inheritence, no pragma codeopt - %io:format(" 5"), - defaultBrokerData(G); %% Default - [InhScope] -> - %io:format(" 6"), - getBrokerData(G,S,X,RS,InhScope,CSF); - InhList -> - %io:format(" 7"), - getBrokerDataInh(G,S,X,RS,Scope,CSF,InhList) - end; - [[{broker,{Module,Type}}]] -> %% A branch only, with pragma codeopt - %io:format(" 3"), - {Module,Type}; - List -> %% Multiple branches with pragma codeopt - %io:format(" 4"), - flatten(List) - end. - - -%% Special treatment when X is an operation -getBrokerDataInh(G,S,X,RS,Scope,CSF,InhList) when is_record(X,op)-> - %io:format(" 8"), - case ets:match(S,{op,get_id2(X),'$1','_','_'}) of - [] -> - %io:format(" 10"), - CleanList = remove_inherited(S,InhList), - getBrokerDataLoop(G,S,X,RS,CleanList,CSF); - - [[Scope]] -> - %io:format(" 11"), - CleanList = remove_inherited(S,InhList), - getBrokerDataLoop(G,S,X,RS,CleanList,CSF); - - [[OpScope]] -> - %io:format(" 12"), - case member([OpScope],InhList) of - true -> - %io:format(" 14"), - %% No inherited scopes - getBrokerData(G,X,RS,OpScope,CSF); - false -> - %io:format(" 15"), - %% Inherited scopes - CleanList = remove_inherited(S,InhList), - getBrokerDataLoop(G,S,X,RS,CleanList,CSF) - end; - - ListOfOpScopes -> - %io:format(" 13"), - case get_inherited(S,Scope,ListOfOpScopes) of - [[OpScope]] -> - case member([OpScope],InhList) of - true -> - getBrokerData(G,X,RS,OpScope,CSF); - false -> - CleanList = remove_inherited(S,InhList), - getBrokerDataLoop(G,S,X,RS,CleanList,CSF) - end; - _ -> - CleanList = remove_inherited(S,InhList), - getBrokerDataLoop(G,S,X,RS,CleanList,CSF) - end - end; -%% Just add InhList after removing all inherited -getBrokerDataInh(G,S,X,RS,_Scope,CSF,InhList) -> - %io:format(" 9"), - CleanList = remove_inherited(S,InhList), - getBrokerDataLoop(G,S,X,RS,CleanList,CSF). - - - - -%% Loops over a list of scopes -getBrokerDataLoop(G,S,X,RS,List,CSF) -> - getBrokerDataLoop(G,S,X,RS,List,[],CSF). - -getBrokerDataLoop(G,_,_X,_RS,[],BrokerDataList,_CSF) -> - case no_doubles(BrokerDataList) of - [BrokerData] -> %% No pragma codeopt / Multiple branches with pragma codeopt - BrokerData; - List -> - DefaultBD = defaultBrokerData(G), - case member(DefaultBD,List) of - true -> - %% Remove default, choose codeoption - NewList = delete(DefaultBD,List), - case NewList of - [BData] -> %% A branch only, with pragma codeopt - BData; - _Other -> %% Multiple branches with pragma codeopt - %%io:format("Multiple branches ~p~n",[Other]), - NewList - end; - false -> %% Multiple branches with pragma codeopt - flatten(List) - end - end; - -getBrokerDataLoop(G,S,X,RS,[[Scope]|Scopes],_Found,CSF) when is_integer(Scope) -> - getBrokerData(G,S,X,RS,[[Scope]|Scopes],CSF); - -getBrokerDataLoop(G,S,X,RS,[[Scope]|Scopes],Found,CSF) -> - %% Start from the beginning, check for overridings - case member(overridedFrom(S,RS,Scope),CSF) of %% Avoid infinite loops - true -> - getBrokerDataLoop(G,S,X,RS,Scopes,Found,CSF); - false -> - BrokerData = getBrokerData(G,X,RS,Scope,CSF), - getBrokerDataLoop(G,S,X,RS,Scopes,[BrokerData|Found],[Scope|CSF]) - end. - - - - -%%%-------------------------------------- -%%% Finds out the overrider of a scope -%%%-------------------------------------- -overridedFrom(S,RS,Scope) -> - overridedFrom(S,RS,Scope,Scope). - -overridedFrom(S,RS,Last,Scope) -> - case ets:match(S,{inherits,'$0',Scope}) of - [] -> - %% No inheritence, no pragma codeopt, - %% choose the last scope. - Last; - - [[RS]] -> - %% Garbage, unused interface with pragma - %% code option ! Danger ! - Last; - - [[InhScope]] -> - case ets:match(S,{codeopt,InhScope,'$1','_','_','_'}) of - [] -> - %% InhScope has no code options, keep Last. - overridedFrom(S,RS,Scope,InhScope); - _ -> - %% InhScope has code option, Last = InhScope. - overridedFrom(S,RS,InhScope,InhScope) - end; - List -> - %% Several inherit from Scope, choose the one feeseble, - %% the one DIRECTLY inherited by Scope and not through - %% other interface. - case remove_inheriters(S,RS,List) of - [] -> - Scope; - Removed -> - Removed - end - end. - -%%%------------------------------------------------------ -%%% Removes all the scopes that inherit from others -%%%------------------------------------------------------ -remove_inheriters(S,RS,InheriterList) -> - DominantList = - dominantList(S,InheriterList), - ReducedInhList = - [X || X <- InheriterList, - member(X,DominantList)], - - case ReducedInhList of - [] -> - []; - [_OneOnly] -> - ReducedInhList; - _Other -> - CleanList = - ets:match_object(S, {inherits,'_','_'}), -% CodeOptList = -% [X || X <- EtsList, element(1,X) == codeopt], - NoInheriters =remove_inheriters2(S,ReducedInhList,CleanList), - - [ [X] || [X] <- NoInheriters, - inherits(RS,X,CleanList)] - end. - -remove_inheriters2(_,[A],_) -> - [A]; -remove_inheriters2(_S,[A,B],EtsList) -> - case remove_inh(A,B,[A,B],EtsList) of - [[X]] -> - X; - List -> - List - end; -remove_inheriters2(S,[A,B|Rest],EtsList) -> - case remove_inh(A,B,[A,B|Rest],EtsList) of - [A,B|Rest] -> - [A,B|Rest]; - NewList -> - remove_inheriters2(S,NewList,EtsList) - end. - -remove_inh([X],[Y],List,EtsList) -> - case inherits(X,Y,EtsList) of - true -> - delete([X],List); - false -> - case inherits(Y,X,EtsList) of - true -> - delete([Y],List); - false -> - List - end - end. - - - -%%%---------------------------------------------- -%%% Should remove all scope links that inherit -%%% from others in the list -%%%---------------------------------------------- -remove_inherited(S,InheriterList) -> - CleanList = - ets:match_object(S, {inherits, '_', '_'}), - remove_inherited(S,InheriterList,CleanList). - - -remove_inherited(_S,[A,B],EtsList) -> - case remove_inhed(A,B,[A,B],EtsList) of - [[X]] -> - [[X]]; - List -> - List - end; -remove_inherited(S,[A,B|Rest],EtsList) -> - case remove_inhed(A,B,[A,B|Rest],EtsList) of - [A,B|Rest] -> - [A,B|Rest]; - NewList -> - remove_inherited(S,NewList,EtsList) - end. - - -remove_inhed([X],[Y],List,EtsList) -> - case inherits(X,Y,EtsList) of - true -> - delete([Y],List); - false -> - case inherits(Y,X,EtsList) of - true -> - delete([X],List); - false -> - List - end - end. - - - - - - - -%%%---------------------------------------------- -%%% Should return all scope links that is -%% are inherited from scope in the list -%%%---------------------------------------------- -get_inherited(S,Scope,OpScopeList) -> - EtsList1 = ets:match(S, {inherits, Scope, '$1'}), - [X || X <- EtsList1, member(X, OpScopeList)]. - - - - - - - -%%%--------------------------------------------------- -%%% Returns a the list of scopes that have codeoption -%%% from a list of scopes -%%%--------------------------------------------------- -dominantList(S,IL) -> - dominantList(S,IL,[]). - -dominantList(_S,[],Found) -> - Found; -dominantList(S,[[X]|Xs],Found) -> - case ets:match(S,{codeopt,X,'$1','_','_','_'}) of - [] -> - dominantList(S,Xs,Found); - _ -> - dominantList(S,Xs,[[X]|Found]) - end. - - - - -%%%--------------------------------------------------- -%%% Returns true if X direct or indirect inherits Y -%%%--------------------------------------------------- -inherits(X,Y,EtsList) -> - case member({inherits,X,Y},EtsList) of - true -> - %% Direct inherited - true; - false -> - %% Indirectly inherited - AllInh = [ B || {inherits,A,B} <- EtsList, A == X ], - inherits(X,Y,AllInh,EtsList) - end. - -inherits(_X,_Y,[],_EtsList) -> - false; -inherits(X,Y,[Z|Zs],EtsList) -> - case inherits2(X,Y,Z,EtsList) of - true -> - true; - false -> - inherits(X,Y,Zs,EtsList) - end. - -inherits2(_X,Y,Z,EtsList) -> - case member({inherits,Z,Y},EtsList) of - true -> - true; - false -> - inherits(Z,Y,EtsList) - end. - - - -%% -%% is_inherited_by/3 -%% -%% Returns : -%% -%% true if the first parameter is -%% inherited by the second one -%% -%% false otherwise -%% -is_inherited_by(Interface1,Interface2,PragmaTab) -> - InheritsList = ets:match_object(PragmaTab, {inherits, '_', '_'}), - inherits(Interface2,Interface1,InheritsList). - - - - -%% Filters all pragma prefix from list not in same file -%% the object - -filter_pragma_prefix_list(PragmaTab, Name, Scope, List) -> - IdlFile = scoped_names_idl_file(PragmaTab, Name, Scope), - filter_pragma_prefix_list2(PragmaTab,IdlFile,List,[]). - - -filter_pragma_prefix_list2(_,_,[],Found) -> - Found; -filter_pragma_prefix_list2(PT, IdlFile, [PP|PPs], Found) -> - case PP of - {prefix,_,_,_,IdlFile,_} -> %% Same file as the Object, keep - filter_pragma_prefix_list2(PT, IdlFile, PPs, [PP|Found]); - - _Other -> %% NOT in same file as the Object, throw away - filter_pragma_prefix_list2(PT, IdlFile, PPs, Found) - end. - -scoped_names_idl_file(PragmaTab, Name, Scope) -> - case ets:match(PragmaTab,{'_','$0','_','$2',Scope,Name,'_','_','_'}) of - [[IdlFile, _Type]] -> %% Usual case - IdlFile; - [[_File,module]|_Files] -> %% Multiple modules, get LOCAL file - case ets:match(PragmaTab,{file_data_local,'$0','_',module,Scope,Name,'_','_','_'}) of - [[LocalIdlFile]] -> - LocalIdlFile; - _ -> %% Should NEVER occur - error - end; - - _ -> - error %% Should NEVER occur - end. - - - - - - -%%------------------------------------------------- -%% -%% Register specific pragma code options -%% -%% If there is an operation with that -%% scope, denote this as {codeopt_specific,Scope} -%% -%%------------------------------------------------- -denote_specific_code_opts(G) -> - case ic_options:get_opt(G, be) of - noc -> - S = ic_genobj:pragmatab(G), - COList = ets:match(S,{codeopt,'$0','_','_','_','_'}), - OPList = ets:match(S,{op,'$0','$1','_','_'}), - denote_specific_code_opts(S,COList,OPList); - _ -> - ok - end. - -denote_specific_code_opts(_,_,[]) -> - ok; -denote_specific_code_opts(S,COList,[[OpN,OpS]|OPSs]) -> - case lists:member([[OpN|OpS]],COList) of - true -> - insert(S, {codeopt_specific,[OpN|OpS]}); - false -> - ok - end, - denote_specific_code_opts(S,COList,OPSs). - - - -%%--------------------------------------------- -%% -%% Returns true/false if it denotes an operation -%% -%%--------------------------------------------- -isOperation(_S,[]) -> - false; -isOperation(_S,[_]) -> - false; -isOperation(S,[H|T]) -> - case ets:match(S,{op,H,T,'$2','$3'}) of - [] -> - false; - _ -> - true - end. - - -hasSpecificCodeoptionOnTopFile(S,File,Scope) -> - case ets:match(S,{codeopt,Scope,'_','$2',File,[File]}) of - [] -> - false; - _ -> - true - end. - - -hasNonSpecificCodeoptionOnTopFile(S,File) -> - case ets:match(S,{codeopt,'_','_','$2',File,[File]}) of - [] -> - false; - _ -> - true - end. - - - -%%--------------------------------------------- -%% -%% Returns {ok,IfrId}/error when searching a random local type -%% -%%--------------------------------------------- - - -fetchRandomLocalType(G) -> - - S = ic_genobj:pragmatab(G), - - case ets:match(S,{file_data_local,'_','_','$2','$3','$4','_','_','_'}) of - [] -> - false; - - List -> - fetchRandomLocalType(S,List) - end. - - -fetchRandomLocalType(_,[]) -> - false; -fetchRandomLocalType(S,[[module|_]|Tail]) -> - fetchRandomLocalType(S,Tail); -fetchRandomLocalType(S,[[_,Scope,Name]|Tail]) -> - case ets:match(S,{alias,[Name|Scope],'$1'}) of - [] -> - fetchRandomLocalType(S,Tail); - [[IfrId]] -> - {ok,IfrId} - end. - - - -%%--------------------------------------------- -%% -%% Returns A list of local operation mapping -%% for a given scope -%% -%%--------------------------------------------- - - -fetchLocalOperationNames(G,I) -> - S = ic_genobj:pragmatab(G), - case ets:match(S,{file_data_local,'_','_',op,I,'$4','_','_','_'}) of - [] -> - []; - List -> - fetchLocalOperationNames2(List,[]) - end. - -fetchLocalOperationNames2([],Found) -> - lists:reverse(Found); -fetchLocalOperationNames2([[Name]|Names],Found) -> - fetchLocalOperationNames2(Names,[Name|Found]). - - - -%%------------------------------------------------ -%% -%% Returns a true if this scoped id is a local -%% one, false otherwise -%% -%%------------------------------------------------ -is_local(G,ScopedId) -> - S = ic_genobj:pragmatab(G), - Name = ic_util:to_undersc(ScopedId), - case ets:match(S,{file_data_local,'_','_','_',tl(ScopedId),'_',Name,'_','_'}) of - [[]] -> - true; - _ -> - false - end. diff --git a/lib/ic/src/ic_sequence_java.erl b/lib/ic/src/ic_sequence_java.erl deleted file mode 100644 index f4873a0691..0000000000 --- a/lib/ic/src/ic_sequence_java.erl +++ /dev/null @@ -1,240 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(ic_sequence_java). - - --include("icforms.hrl"). --include("ic.hrl"). --include("ic_debug.hrl"). -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([gen/4]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- - -%%----------------------------------------------------------------- -%% Func: gen/4 -%%----------------------------------------------------------------- -gen(G, N, X, SequenceName) when is_record(X, sequence) -> - emit_holder_class(G, N, X, SequenceName), - emit_helper_class(G, N, X, SequenceName); -gen(_G, _N, _X, _SequenceName) -> - ok. - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- - - -%%----------------------------------------------------------------- -%% Func: emit_holder_class/4 -%%----------------------------------------------------------------- -emit_holder_class(G, N, X, SequenceName) -> - SName = string:concat(SequenceName, "Holder"), - {Fd, _}= ic_file:open_java_file(G, N, SName), - - SequenceType = ic_java_type:getType(G, N, X), - - ic_codegen:emit(Fd, ["final public class ",SequenceName,"Holder {\n" - " // instance variables\n" - " public ",SequenceType," value;\n\n" - " // constructors\n" - " public ",SequenceName,"Holder() {}\n" - " public ",SequenceName,"Holder(",SequenceType," initial) {\n" - " value = initial;\n" - " }\n\n" - - " // methods\n" - - " public void _marshal(",?ERLANGPACKAGE,"OtpOutputStream out) throws java.lang.Exception{\n" - " ",SequenceName,"Helper.marshal(out, value);\n" - " }\n\n" - - " public void _unmarshal(",?ERLANGPACKAGE,"OtpInputStream in) throws java.lang.Exception {\n" - " value = ",SequenceName,"Helper.unmarshal(in);\n" - " }\n\n" - "}\n"]), - file:close(Fd). - - - -emit_helper_class(G, N, X, SequenceName) -> - SName = string:concat(SequenceName, "Helper"), - {Fd, _}= ic_file:open_java_file(G, N, SName), - - SequenceType = ic_java_type:getType(G, N, X), - ElementType = ic_forms:get_type(X), - - ic_codegen:emit(Fd, ["public class ",SequenceName,"Helper {\n" - - " // constructors\n" - " private ",SequenceName,"Helper() {}\n\n" - - " // methods\n" - " public static void marshal(",?ERLANGPACKAGE,"OtpOutputStream _out, ",SequenceType," _value) \n" - " throws java.lang.Exception {\n\n"]), - - emit_sequence_marshal_function(G, N, X, Fd, SequenceName, ElementType), - - ic_codegen:emit(Fd, [" }\n\n" - - " public static ",SequenceType," unmarshal(",?ERLANGPACKAGE,"OtpInputStream _in) \n" - " throws java.lang.Exception {\n\n"]), - - emit_sequence_unmarshal_function(G, N, X, Fd, SequenceName, ElementType), - - ic_codegen:emit(Fd, [" }\n\n" - - " public static String id() {\n" - " return \"",ic_pragma:scope2id(G, [SequenceName | N]),"\";\n" - " }\n\n" - - " public static String name() {\n" - " return \"",SequenceName,"\";\n" - " }\n\n"]), - - ic_jbe:emit_type_function(G, N, X, Fd), - - ic_codegen:emit(Fd, [" public static void insert(",?ICPACKAGE,"Any _any, ",SequenceType," _this)\n" - " throws java.lang.Exception {\n\n" - - " ",?ERLANGPACKAGE,"OtpOutputStream _os = \n" - " new ",?ERLANGPACKAGE,"OtpOutputStream();\n\n" - - " _any.type(type());\n" - " marshal(_os, _this);\n" - " _any.insert_Streamable(_os);\n" - " }\n\n" - - " public static ",SequenceType," extract(",?ICPACKAGE,"Any _any)\n" - " throws java.lang.Exception {\n\n" - - " return unmarshal(_any.extract_Streamable());\n" - " }\n\n" - - - %% In corba mapping there is also a _type function here. - "}\n\n"]), - file:close(Fd). - - -%%----------------------------------------------------------------- -%% Func: emit_sequence_marshal_function/6 -%%----------------------------------------------------------------- -emit_sequence_marshal_function(G, N, X, Fd, _SequenceName, ElementType) -> - ic_codegen:emit(Fd, [" int _length = _value.length;\n\n" - - " _out.write_list_head(_length);\n\n" - - " if (_length > 0) {\n" - " for(int _tmp = 0; _tmp < _length; _tmp++)\n"]), - - case ic_java_type:isBasicType(G, N, ElementType) of - true -> - ic_codegen:emit(Fd, [" _out",ic_java_type:marshalFun(G, N, X, ElementType),"(_value[_tmp]);\n\n"]); - false -> - ic_codegen:emit(Fd, [" ",ic_java_type:marshalFun(G, N, X, ElementType),"(_out, _value[_tmp]);\n\n"]) - end, - - ic_codegen:emit(Fd, [" _out.write_nil();\n" - " }\n\n"]). - - - - -%%----------------------------------------------------------------- -%% Func: emit_sequence_unmarshal_function/6 -%%----------------------------------------------------------------- -emit_sequence_unmarshal_function(G, N, X, Fd, _SequenceName, ElementType) -> - - SequenceElementType = ic_java_type:getType(G, N, ElementType), - - ic_codegen:emit(Fd, [" int _tag,_length;\n" - " ",SequenceElementType," _sequence[];\n" - " _tag = _in.peek();\n\n"]), - - case ic_java_type:isIntegerType(G, N, ElementType) of - true -> - ic_codegen:emit(Fd, [" switch(_tag) {\n" - " case ",?ERLANGPACKAGE,"OtpExternal.stringTag:\n" - " byte _compressed[] = (_in.read_string()).getBytes();\n" - " _length = _compressed.length;\n" - " _sequence = new ",ic_java_type:getFullType(G,N,X),";\n\n" - - " for(int _tmp = 0; _tmp < _length; _tmp++)\n" - " _sequence[_tmp] = (",ic_java_type:getType(G, N, ElementType),")(_compressed[_tmp] & 0xff);\n\n" - - " break;\n" - " default:\n" - " _length = _in.read_list_head();\n" - " _sequence = new ",ic_java_type:getFullType(G,N,X),";\n\n" - - " if(_length > 0) {\n" - " for(int _tmp = 0; _tmp < _length; _tmp++)\n" - " _sequence[_tmp] = _in",ic_java_type:unMarshalFun(G, N, X, ElementType),";\n\n" - - " _in.read_nil();\n" - " }\n" - " }\n"]); - false -> - ic_codegen:emit(Fd, [" _length = _in.read_list_head();\n" - " _sequence = new ",ic_java_type:getFullType(G,N,X),";\n\n" - - " if(_length > 0) {\n" - " for(int _tmp = 0; _tmp < _length; _tmp++)\n"]), - case ic_java_type:isBasicType(G, N, ElementType) of - true -> - ic_codegen:emit(Fd, [" _sequence[_tmp] = _in",ic_java_type:unMarshalFun(G, N, X, ElementType),";\n\n"]); - _ -> - ic_codegen:emit(Fd, [" _sequence[_tmp] = ",ic_java_type:getUnmarshalType(G, N, X, ElementType),".unmarshal(_in);\n\n"]) - end, - - ic_codegen:emit(Fd, [" _in.read_nil();\n" - " }\n\n"]) - end, - - ic_codegen:emit(Fd, " return _sequence;\n"). - - - - -%%--------------------------------------------------- -%% Utilities -%%--------------------------------------------------- - - - - - - - - - diff --git a/lib/ic/src/ic_struct_java.erl b/lib/ic/src/ic_struct_java.erl deleted file mode 100644 index 94b98f6c52..0000000000 --- a/lib/ic/src/ic_struct_java.erl +++ /dev/null @@ -1,315 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(ic_struct_java). - --include("icforms.hrl"). --include("ic.hrl"). --include("ic_debug.hrl"). -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([gen/3]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- -gen(G, N, X) when is_record(X, struct) -> - StructName = ic_forms:get_java_id(X), - WireStructName = ic_forms:get_id2(X), - emit_struct_class(G, N, X, StructName), - emit_holder_class(G, N, X, StructName), - emit_helper_class(G, N, X, StructName, WireStructName), - N2 = [StructName ++ "Package" |N], - ic_jbe:gen(G, N2, ic_forms:get_body(X)); -gen(_G, _N, _X) -> - ok. - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- - -%%----------------------------------------------------------------- -%% Func: emit_struct_class/4 -%%----------------------------------------------------------------- -emit_struct_class(G, N, X, StructName) -> - {Fd, _}= ic_file:open_java_file(G, N, StructName), - - MList = struct_member_list(G, N, X), - ArgList = gen_parameter_list(G, [ StructName ++ "Package" |N], X, MList), - - ic_codegen:emit(Fd, ["final public class ",StructName," {\n" - " // instance variables\n"]), - - emit_struct_members_declarations(G, [StructName ++ "Package" |N], - X, Fd, MList), - - ic_codegen:emit(Fd, ["\n // constructors\n" - " public ",StructName,"() {}\n\n" - - " public ",StructName,"(",ArgList,") {\n"]), - - emit_struct_members_initialisation(G, N, X, Fd, MList), - - ic_codegen:emit(Fd, [" }\n\n" - - "}\n\n"]), - file:close(Fd). - - -%%----------------------------------------------------------------- -%% Func: emit_holder_class/4 -%%----------------------------------------------------------------- -emit_holder_class(G, N, _X, StructName) -> - SName = string:concat(StructName, "Holder"), - {Fd, _}= ic_file:open_java_file(G, N, SName), - - ic_codegen:emit(Fd, ["final public class ",StructName,"Holder {\n" - - " // instance variables\n" - " public ",StructName," value;\n\n" - - " // constructors\n" - " public ",StructName,"Holder() {}\n\n" - - " public ",StructName,"Holder(",StructName," initial) {\n" - " value = initial;\n" - " }\n\n" - - " // methods\n"]), - - ic_codegen:emit(Fd, [" public void _marshal(",?ERLANGPACKAGE,"OtpOutputStream out) throws java.lang.Exception {\n" - " ",StructName,"Helper.marshal(out, value);\n" - " }\n\n" - - " public void _unmarshal(",?ERLANGPACKAGE,"OtpInputStream in) throws java.lang.Exception {\n" - " value = ",StructName,"Helper.unmarshal(in);\n" - " }\n" - - "}\n\n"]), - file:close(Fd). - -%%----------------------------------------------------------------- -%% Func: emit_helper_class/5 -%%----------------------------------------------------------------- -emit_helper_class(G, N, X, StructName, WireStructName) -> - SName = string:concat(StructName, "Helper"), - {Fd, _}= ic_file:open_java_file(G, N, SName), - - ic_codegen:emit(Fd, ["public class ",StructName,"Helper {\n" - - " // constructors\n" - " private ",StructName,"Helper() {}\n\n" - - " // methods\n"]), - - MList = struct_member_list(G, N, X), - - ic_codegen:emit(Fd, [" public static void marshal(",?ERLANGPACKAGE,"OtpOutputStream _out, ",StructName," _value)\n" - " throws java.lang.Exception {\n\n"]), - - emit_struct_marshal_function(G, N, X, Fd, StructName, WireStructName, MList), - - ic_codegen:emit(Fd, [" }\n\n" - - " public static ",StructName," unmarshal(",?ERLANGPACKAGE,"OtpInputStream _in)\n" - " throws java.lang.Exception {\n\n"]), - - emit_struct_unmarshal_function(G, N, X, Fd, StructName, WireStructName, MList), - - ic_codegen:emit(Fd, [" }\n\n" - - " public static String id() {\n" - " return \"",ictk:get_IR_ID(G, N, X),"\";\n" - " }\n\n" - - " public static String name() {\n" - " return \"",StructName,"\";\n" - " }\n\n"]), - - ic_jbe:emit_type_function(G, N, X, Fd), - - ic_codegen:emit(Fd, [" public static void insert(",?ICPACKAGE,"Any _any, ",StructName," _this)\n" - " throws java.lang.Exception {\n\n" - - " ",?ERLANGPACKAGE,"OtpOutputStream _os = \n" - " new ",?ERLANGPACKAGE,"OtpOutputStream();\n\n" - - " _any.type(type());\n" - " marshal(_os, _this);\n" - " _any.insert_Streamable(_os);\n" - " }\n\n" - - " public static ",StructName," extract(",?ICPACKAGE,"Any _any)\n" - " throws java.lang.Exception {\n\n" - - " return unmarshal(_any.extract_Streamable());\n" - " }\n\n" - - - %% In corba mapping there is also a _type function here. - "}\n"]), - file:close(Fd). - - -%%----------------------------------------------------------------- -%% Func: emit_struct_members_declarations/ -%%----------------------------------------------------------------- -emit_struct_members_declarations(_, _, _, _, []) -> - ok; -emit_struct_members_declarations(G, N, X, Fd, [{Member, _Type, Id} | MList]) -> - ic_codegen:emit(Fd, [" public ",ic_java_type:getType(G, N, Member)," ",Id,";\n"]), - emit_struct_members_declarations(G, N, X, Fd, MList). - - - -%%----------------------------------------------------------------- -%% Func: emit_struct_members_initialisation/5 -%%----------------------------------------------------------------- -emit_struct_members_initialisation(_, _, _, _, []) -> - ok; -emit_struct_members_initialisation(G, N, X, Fd, [{_Member, _Type, Id} | MList]) -> - ic_codegen:emit(Fd, [" ",Id," = _",Id,";\n"]), - emit_struct_members_initialisation(G, N, X, Fd, MList). - - - - -%%----------------------------------------------------------------- -%% Func: emit_struct_marshal_function/7 -%%----------------------------------------------------------------- -emit_struct_marshal_function(G, N, X, Fd, StructName, WireStructName, MList) -> - - ic_codegen:emit(Fd, [" _out.write_tuple_head(",integer_to_list(length(MList) + 1),");\n" - " _out.write_atom(\"",ic_util:to_undersc([WireStructName|N]),"\");\n\n"]), - - emit_struct_marshal_function_loop(G, [StructName ++ "Package" |N], - X, Fd, MList, 1). - -%%----------------------------------------------------------------- -%% Func: emit_struct_marshal_function_loop/6 -%%----------------------------------------------------------------- -emit_struct_marshal_function_loop(_, _, _, Fd, [], _) -> - ic_codegen:nl(Fd); -emit_struct_marshal_function_loop(G, N, X, Fd, [{Member, Type, Id} |MList], Num) -> - - case ic_java_type:isBasicType(G, N, Member) of - true -> - ic_codegen:emit(Fd, [" _out",ic_java_type:marshalFun(G, N, Member, Type),"(_value.",Id,");\n"]); - _ -> - if (element(1,hd(element(3,Member))) == array) -> - ic_codegen:emit(Fd, - [" ", - ic_util:to_dot(G,[ic_forms:get_id2(Member)|N]), - "Helper.marshal(_out, _value.",Id,");\n"]); - true -> - ic_codegen:emit(Fd, [" ", - ic_java_type:marshalFun(G, N, Member, Type), - "(_out, _value.",Id,");\n"]) - end - end, - - emit_struct_marshal_function_loop(G, N, X, Fd, MList, Num+1). - - - - -%%----------------------------------------------------------------- -%% Func: emit_struct_unmarshal_function/7 -%%----------------------------------------------------------------- -emit_struct_unmarshal_function(G, N, X, Fd, StructName, WireStructName, MList) -> - - ic_codegen:emit(Fd, [" _in.read_tuple_head();\n\n" - - " if ((_in.read_atom()).compareTo(\"", - ic_util:to_undersc([WireStructName|N]), - "\") != 0)\n" - " throw new java.lang.Exception(\"\");\n\n" - - " ",StructName," _value = new ",StructName,"();\n"]), - - emit_struct_unmarshal_function_loop(G, [StructName ++ "Package"|N], - X, Fd, MList, 1), - - ic_codegen:emit(Fd, " return _value;\n"). - -%%----------------------------------------------------------------- -%% Func: emit_union_unmarshal_function_loop/6 -%%----------------------------------------------------------------- -emit_struct_unmarshal_function_loop(_, _, _, Fd, [], _) -> - ic_codegen:nl(Fd); -emit_struct_unmarshal_function_loop(G, N, X, Fd, [{Member, Type, Id} |MList], Num) -> - - case ic_java_type:isBasicType(G, N, Member) of - true -> - ic_codegen:emit(Fd, [" _value.",Id," = _in",ic_java_type:unMarshalFun(G, N, Member, Type),";\n"]); - _ -> - if (element(1,hd(element(3,Member))) == array) -> - ic_codegen:emit(Fd, - [" _value.",Id," = ",ic_util:to_dot(G,[ic_forms:get_id2(Member)|N]),"Helper.unmarshal(_in);\n"]); - true -> - ic_codegen:emit(Fd, - [" _value.",Id," = ",ic_java_type:getUnmarshalType(G, N, Member, Type),".unmarshal(_in);\n"]) - end - end, - - emit_struct_unmarshal_function_loop(G, N, X, Fd, MList, Num +1). - - - -%%----------------------------------------------------------------- -%% Func: gen_parameter_list/4 -%%----------------------------------------------------------------- -gen_parameter_list(G, N, _X, [{Member, _Type, Id}]) -> - ic_java_type:getType(G,N,Member) ++ - " _" ++ - ic_util:to_list(Id); -gen_parameter_list(G, N, X, [{Member, _Type, Id} | MList]) -> - ic_java_type:getType(G,N,Member) ++ - " _" ++ - ic_util:to_list(Id) ++ - ", " ++ - gen_parameter_list(G, N, X, MList). - - -%%----------------------------------------------------------------- -%% Func: struct_member_list/3 -%%----------------------------------------------------------------- -struct_member_list(_G, _N, X) -> - M = lists:map( - fun(Member) -> - lists:map( - fun(Id) -> - Type = ic_forms:get_type(Member), - { Member, Type, ic_forms:get_java_id(Id)} - end, - ic_forms:get_idlist(Member)) - end, - ic_forms:get_body(X)), - lists:flatten(M). - - - diff --git a/lib/ic/src/ic_symtab.erl b/lib/ic/src/ic_symtab.erl deleted file mode 100644 index 037d004049..0000000000 --- a/lib/ic/src/ic_symtab.erl +++ /dev/null @@ -1,235 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(ic_symtab). - - --include_lib("ic/src/ic.hrl"). --include_lib("ic/src/icforms.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([new/0, store/3, retrieve/2, soft_retrieve/2, intf_resolv/3]). --export([get_full_scoped_name/3, scoped_id_new_global/1, scoped_id_new/1]). --export([scoped_id_strip/1,symtab_add_faked_included_types/1]). --export([scoped_id_is_global/1, scoped_id_add/2]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- - - -%%-------------------------------------------------------------------- -%% -%% Symbol table routines -%% -%% Symbol tables handles mappings Id -> Value, where Id is an -%% ordinary Id from the parser (or a string) and value is an -%% arbitrary term. -%% -%%-------------------------------------------------------------------- - -%%----------------------------------------------------------------- -%% Func: new/0 (used to be symtab_new) -%%----------------------------------------------------------------- -new() -> - ets:new(symtab, [set, public]). - -%%----------------------------------------------------------------- -%% Func: store/3 (used to be symtab_store) -%%----------------------------------------------------------------- -store(G, N, X) -> - Name = [ic_forms:get_id2(X) | N], - %%io:format("Adding id: ~p~n", [N]), - case soft_retrieve(G, Name) of - {error, _} -> - ets:insert(G#genobj.symtab, {Name, X}); - {ok, Y} when is_record(Y, forward) -> - ets:insert(G#genobj.symtab, {Name, X}); - {ok, Y} when is_record(Y, constr_forward) -> - ets:insert(G#genobj.symtab, {Name, X}); - {ok, _Y} -> - ic_error:error(G, {multiply_defined, X}) - end. - - -%%----------------------------------------------------------------- -%% Func: retrieve/2 (used to be symtab_retrieve) -%% -%% Makes a lookup in the symbol table for Id. Will throw -%% not_found if it fails. -%%----------------------------------------------------------------- -retrieve(G, Id) -> - case ets:lookup(G#genobj.symtab, Id) of - [{_, Val}] -> Val; - [] -> ic_error:error(G, {symtab_not_found, Id}) - end. - - -%%----------------------------------------------------------------- -%% Func: soft_retrieve/2 (used to be symtab_soft_retrieve) -%% -%% Same as retrieve but will use tagged return values. -%% -%%----------------------------------------------------------------- -soft_retrieve(G, Id) -> - case ets:lookup(G#genobj.symtab, Id) of - [{_, Val}] -> {ok, Val}; - [] -> {error, {symtab_not_found, Id}} - end. - - -%%----------------------------------------------------------------- -%% Func: intf_resolv/3 and resolv2/3 -%% (used to be symtab_intf_resolv and symtab_intf_resolv2) -%% -%% Tries to resolv the interface identifier reference. The id can -%% be either a scoped name or an standard identifier. The -%% function returns a global reference to the id. -%% -%% Will throw not_found if the id really cannot be found. Will -%% throw illegal_forward if any forward references are founf in -%% the inheritance list. -%% -%%----------------------------------------------------------------- -intf_resolv(G, Scope, Id) -> - case scoped_id_is_global(Id) of - true -> - retrieve(G, Id), - Id; - false -> - intf_resolv2(G, Scope, Id) - end. - -intf_resolv2(G, Scope, Id) -> - N = scoped_id_add(Scope, Id), - case soft_retrieve(G, scoped_id_strip(N)) of - {ok, F} when is_record(F, forward) -> - ic_error:error(G, {illegal_forward, Id}), []; - {ok, _Val} -> - scoped_id_mk_global(N); - _ -> - case scoped_id_is_top(Scope) of - false -> - intf_resolv2(G, scoped_id_up_one(Scope), Id); - true -> - ic_error:error(G, {symtab_not_found, Id}), [] - end - end. - - - -%%-------------------------------------------------------------------- -%% -%% Scoped id routines -%% -%% A scoped id is an id written as M::Id in IDL. Scoped ids are -%% implemented as lists of id in reverse order, so M1::F1 becomes -%% [F1, M1]. -%% -%%-------------------------------------------------------------------- - -get_full_scoped_name(G, N, S) when element(1, S) == scoped_id -> - ictype:scoped_lookup(G, ic_genobj:tktab(G), N, S). - -scoped_id_new_global(Id) -> - X=scoped_id_new(Id), X#scoped_id{type=global}. - -scoped_id_new(Id) -> - #scoped_id{line=ic_forms:get_line(Id), id=[ic_forms:get_id(Id)]}. - -%% Adds one more id to the list of ids -scoped_id_add(S1, S2) when is_record(S2, scoped_id) -> - S1#scoped_id{id=S2#scoped_id.id ++ S1#scoped_id.id, - line=S2#scoped_id.line}; -scoped_id_add(S, Id) -> - S#scoped_id{id=[ic_forms:get_id(Id) | S#scoped_id.id], line=ic_forms:get_line(Id)}. - - -scoped_id_mk_global(S) -> S#scoped_id{type=global}. - -scoped_id_is_global(S) when is_record(S, scoped_id), S#scoped_id.type==global -> - true; -scoped_id_is_global(_) -> false. - -%% Top level scope (i.e no more cd ..) -scoped_id_is_top(S) when S#scoped_id.id==[] -> true; -scoped_id_is_top(_) -> false. - - -scoped_id_up_one(S) -> S#scoped_id{id=tl(S#scoped_id.id)}. % cd .. in scope -%%scoped_id_get_def(S) -> hd(S#scoped_id.id). % Last added id -scoped_id_strip(S) -> S#scoped_id.id. % Strips all junk - - - - -% Add CORBA:: that as if they -% were defined in an included file. -% This is only supported in the case -% of Corba backend -symtab_add_faked_included_types(G) -> - case ic_options:get_opt(G, be) of - false -> - %% Add TypeCode as if it were defiend in included file - ets:insert(G#genobj.symtab, {["CORBA"], - {interface,{'',0,"TypeCode"}, - [], - [], - [], - {tk_objref, - "IDL:omg.org/CORBA/TypeCode:1.0", - "TypeCode"}}}); - erl_corba -> - %% Add TypeCode as if it were defiend in included file - ets:insert(G#genobj.symtab, {["CORBA"], - {interface,{'',0,"TypeCode"}, - [], - [], - [], - {tk_objref, - "IDL:omg.org/CORBA/TypeCode:1.0", - "TypeCode"}}}); - erl_template -> - %% Add TypeCode as if it were defiend in included file - ets:insert(G#genobj.symtab, {["CORBA"], - {interface,{'',0,"TypeCode"}, - [], - [], - [], - {tk_objref, - "IDL:omg.org/CORBA/TypeCode:1.0", - "TypeCode"}}}); - _ -> - ok - end. - - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- diff --git a/lib/ic/src/ic_union_java.erl b/lib/ic/src/ic_union_java.erl deleted file mode 100644 index 14d585b0a4..0000000000 --- a/lib/ic/src/ic_union_java.erl +++ /dev/null @@ -1,755 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - - --module(ic_union_java). - --include("icforms.hrl"). --include("ic.hrl"). --include("ic_debug.hrl"). -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([gen/3]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- - -%%----------------------------------------------------------------- -%% Func: gen/3 -%%----------------------------------------------------------------- -gen(G, N, X) when is_record(X, union) -> - - %% Create a TK value if not existed - %% Should be integrated in fetchTk - %% instead - NewX = case ic_forms:get_tk(X) of - undefined -> - S = ic_genobj:tktab(G), - Tk = ictype:tk(G, S, N, X), - #union{ id = X#union.id, - type = X#union.type, - body = X#union.body, - tk = Tk }; - _Tk -> - X - end, - - UnionName = ic_forms:get_java_id(NewX), - WiredUnionName = ic_forms:get_id2(NewX), - N2 = [UnionName ++ "Package"|N], - %%?PRINTDEBUG2("Recursive call over type ~p", - %% [[ic_forms:get_type(NewX)]]), - ic_jbe:gen(G, N, [ic_forms:get_type(NewX)]), - %%?PRINTDEBUG2("Recursive call over body: ~p", - %% [ic_forms:get_body(NewX)]), - ic_jbe:gen(G, N2, ic_forms:get_body(NewX)), - - emit_union_class(G, N, NewX, UnionName), - emit_holder_class(G, N, NewX, UnionName), - emit_helper_class(G, N, NewX, UnionName, WiredUnionName); -gen(_G, _N, _X) -> - ok. - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- - -%%----------------------------------------------------------------- -%% Func: emit_union_class/4 -%%----------------------------------------------------------------- -emit_union_class(G, N, X, UnionName) -> - {Fd, _} = ic_file:open_java_file(G, N, UnionName), - - DiscrType = ic_java_type:getType(G, [UnionName ++ "Package"|N], - ic_forms:get_type(X)), - - MList = union_member_list(G, N, X, DiscrType), - - ic_codegen:emit(Fd, "final public class ~s {\n",[UnionName]), - - ic_codegen:emit(Fd, " // instance variables\n", []), - ic_codegen:emit(Fd, " private boolean _initialized;\n", []), - ic_codegen:emit(Fd, " private ~s _discriminator;\n", [DiscrType]), - ic_codegen:emit(Fd, " private java.lang.Object _value;\n", []), - - {tk_union,_, _,DiscrTk, _, _} = ic_forms:get_tk(X), - - DV = get_default_val(G, [UnionName |N], DiscrType, DiscrTk, MList), - - case DV of - none -> %% all values in case - ok; - _ -> - ic_codegen:emit(Fd, " private ~s _default = ~s;\n", - [DiscrType, DV]) - end, - - ic_codegen:nl(Fd), - ic_codegen:emit(Fd, " // constructors\n", []), - - ic_codegen:emit(Fd, " public ~s() {\n", [UnionName]), - ic_codegen:emit(Fd, " _initialized = false;\n", []), - ic_codegen:emit(Fd, " _value = null;\n", []), - ic_codegen:emit(Fd, " }\n", []), - ic_codegen:nl(Fd), - - ic_codegen:emit(Fd, " // discriminator access\n", []), - - ic_codegen:emit(Fd, " public ~s discriminator() " - "throws java.lang.Exception {\n", [DiscrType]), - ic_codegen:emit(Fd, " if (!_initialized) {\n", []), - ic_codegen:emit(Fd, " throw new java.lang.Exception(\"\");\n",[]), - ic_codegen:emit(Fd, " }\n", []), - ic_codegen:emit(Fd, " return _discriminator;\n", []), - ic_codegen:emit(Fd, " }\n", []), - ic_codegen:nl(Fd), - - emit_union_members_functions(G, [UnionName ++ "Package"|N], X, - Fd, UnionName, DiscrType, MList, MList), - ic_codegen:nl(Fd), - - ic_codegen:emit(Fd, "}\n", []), - file:close(Fd). - -%%----------------------------------------------------------------- -%% Func: emit_holder_class/4 -%%----------------------------------------------------------------- -emit_holder_class(G, N, _X, UnionName) -> - UName = string:concat(UnionName, "Holder"), - {Fd, _} = ic_file:open_java_file(G, N, UName), - - ic_codegen:emit(Fd, "final public class ~sHolder {\n",[UnionName]), - - ic_codegen:emit(Fd, " // instance variables\n"), - ic_codegen:emit(Fd, " public ~s value;\n", [UnionName]), - ic_codegen:nl(Fd), - - ic_codegen:emit(Fd, " // constructors\n"), - ic_codegen:emit(Fd, " public ~sHolder() {}\n", [UnionName]), - ic_codegen:emit(Fd, " public ~sHolder(~s initial) {\n", - [UnionName, UnionName]), - ic_codegen:emit(Fd, " value = initial;\n"), - ic_codegen:emit(Fd, " }\n"), - ic_codegen:nl(Fd), - - ic_codegen:emit(Fd, " // methods\n"), - - ic_codegen:emit(Fd, " public void _marshal(~sOtpOutputStream out) throws java.lang.Exception {\n", - [?ERLANGPACKAGE]), - ic_codegen:emit(Fd, " ~sHelper.marshal(out, value);\n", [UnionName]), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " public void _unmarshal(~sOtpInputStream in) throws java.lang.Exception {\n", - [?ERLANGPACKAGE]), - ic_codegen:emit(Fd, " value = ~sHelper.unmarshal(in);\n", [UnionName]), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, "}\n"), - file:close(Fd). - - -%%----------------------------------------------------------------- -%% Func: emit_helper_class/4 -%%----------------------------------------------------------------- -emit_helper_class(G, N, X, UnionName, WiredUnionName) -> - UName = string:concat(UnionName, "Helper"), - {Fd, _} = ic_file:open_java_file(G, N, UName), - - DiscrType = ic_java_type:getType(G, [ UnionName ++ "Package" |N], - ic_forms:get_type(X)), - - ic_codegen:emit(Fd, "public class ~sHelper {\n",[UnionName]), - - ic_codegen:emit(Fd, " // constructors\n", []), - ic_codegen:emit(Fd, " private ~sHelper() {}\n", [UnionName]), - ic_codegen:nl(Fd), - - ic_codegen:emit(Fd, " // methods\n", []), - MList = union_member_list(G, N, X, DiscrType), - - ic_codegen:emit(Fd, " public static void marshal(~sOtpOutputStream _out, ~s _value)\n", - [?ERLANGPACKAGE, UnionName]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n\n"), - emit_union_marshal_function(G, N, X, Fd, UnionName, WiredUnionName, MList), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " public static ~s unmarshal(~sOtpInputStream _in)\n", - [UnionName, ?ERLANGPACKAGE]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n\n"), - emit_union_unmarshal_function(G, N, X, Fd, UnionName, WiredUnionName, MList), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " public static String id() {\n"), - ic_codegen:emit(Fd, " return ~p;\n",[ictk:get_IR_ID(G, N, X)]), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " public static String name() {\n"), - ic_codegen:emit(Fd, " return ~p;\n",[UnionName]), - ic_codegen:emit(Fd, " }\n\n"), - - ic_jbe:emit_type_function(G, N, X, Fd), - - - ic_codegen:emit(Fd, " public static void insert(~sAny _any, ~s _this)\n", - [?ICPACKAGE,UnionName]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n\n"), - - ic_codegen:emit(Fd, " ~sOtpOutputStream _os = \n",[?ERLANGPACKAGE]), - ic_codegen:emit(Fd, " new ~sOtpOutputStream();\n\n",[?ERLANGPACKAGE]), - - ic_codegen:emit(Fd, " _any.type(type());\n"), - ic_codegen:emit(Fd, " marshal(_os, _this);\n"), - ic_codegen:emit(Fd, " _any.insert_Streamable(_os);\n"), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " public static ~s extract(~sAny _any)\n", - [UnionName,?ICPACKAGE]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n\n"), - - ic_codegen:emit(Fd, " return unmarshal(_any.extract_Streamable());\n"), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " public static int discriminatorAsInt(~s _discriminator)\n", - [DiscrType]), - ic_codegen:emit(Fd, " throws java.lang.Exception {\n"), - emit_discriminator_as_int(G, N, ic_forms:get_type(X), Fd), - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, "}\n"), - file:close(Fd). - -%%----------------------------------------------------------------- -%% Func: emit_union_members_functions/7 -%%----------------------------------------------------------------- -emit_union_members_functions(_, _, _, _, _, _, [], _) -> - ok; -emit_union_members_functions(G, N, X, Fd, UnionName, DiscrType, - [{Label, Case, TypeDef, Id, Ls} | MList], MListTot) -> - - CaseId = Case#case_dcl.id, %% Maybe Array - CaseType = Case#case_dcl.type, %% Maybe Sequence - - Type = if element(1,CaseId) == array -> - ic_java_type:getType(G, N, TypeDef) ++ - ic_java_type:getdim(CaseId#array.size); - true -> - ic_java_type:getType(G, N, TypeDef) - end, - - HolderType = - if element(1,CaseId) == array -> - ic_java_type:getHolderType(G, N, CaseId); - true -> - if element(1,CaseType) == sequence -> - ic_util:to_dot(G,[Id|N]) ++"Holder"; - true -> - ic_java_type:getHolderType(G, N, TypeDef) - end - end, - - %% - %% Set method - %% - ic_codegen:emit(Fd, " // ~s access and set functions\n",[Id]), - ic_codegen:emit(Fd, " public void ~s(~s value) " - "throws java.lang.Exception {\n", - [Id, Type]), - ic_codegen:emit(Fd, " _initialized = true;\n", []), - case Label of - "default" -> - ic_codegen:emit(Fd, " _discriminator = (~s) _default;\n", - [DiscrType]); - _ -> - case ic_java_type:isBasicType(G, N, ic_forms:get_type(X)) of - true -> - ic_codegen:emit(Fd, " _discriminator = (~s) " - "~s;\n", - [DiscrType, Label]); - _ -> - ic_codegen:emit(Fd, " _discriminator = (~s) " - "~s.~s;\n", - [DiscrType, DiscrType, Label]) - end - end, - ic_codegen:emit(Fd, " _value = new ~s(value);\n", - [HolderType]), - ic_codegen:emit(Fd, " }\n", []), - - %% - %% Check this entry has more than one label and the generate an extra set method. - %% - case Ls of - [] -> - ok; - _ -> - ic_codegen:emit(Fd, " public void ~s(~s discriminator, ~s value) " - "throws java.lang.Exception {\n", - [Id, DiscrType, Type]), - ic_codegen:emit(Fd, " _initialized = true;\n", []), - ic_codegen:emit(Fd, " _discriminator = (~s) discriminator;\n", - [DiscrType]), - ic_codegen:emit(Fd, " _value = new ~s(value);\n", - [HolderType]), - ic_codegen:emit(Fd, " }\n", []) - end, - - %% - %% Get method - %% - ic_codegen:emit(Fd, " public ~s ~s() throws java.lang.Exception {\n", - [Type, Id]), - ic_codegen:emit(Fd, " if (!_initialized) {\n", []), - ic_codegen:emit(Fd, " throw new java.lang.Exception(\"\");\n",[]), - ic_codegen:emit(Fd, " }\n", []), - ic_codegen:emit(Fd, " switch (~sHelper.discriminatorAsInt" - "(discriminator())) {\n", - [UnionName]), - if - Label == "default" -> - ic_codegen:emit(Fd, " default:\n", []), - ic_codegen:emit(Fd, " break;\n", []), - emit_default_access_fun_switch_cases(G, N, X, Fd, DiscrType, - MListTot), - ic_codegen:emit(Fd, " throw new java.lang.Exception(\"\");\n", []); - true -> - ic_codegen:emit(Fd, " case ~s:\n", - [get_case_as_int(G, N, ic_forms:get_type(X), - DiscrType, Label)]), - ic_codegen:emit(Fd, " break;\n", []), - ic_codegen:emit(Fd, " default:\n", []), - ic_codegen:emit(Fd, " throw new java.lang.Exception(\"\");\n", []) - end, - ic_codegen:emit(Fd, " }\n", []), - - ic_codegen:emit(Fd, " return ((~s) _value).value;\n", - [HolderType]), - ic_codegen:emit(Fd, " }\n", []), - ic_codegen:nl(Fd), - emit_union_members_functions(G, N, X, Fd, UnionName, DiscrType, MList, - MListTot). - - -%%----------------------------------------------------------------- -%% Func: emit_default_access_fun_switch_cases/6 -%%----------------------------------------------------------------- -emit_default_access_fun_switch_cases(_G, _N, _X, _Fd, _DiscrType, []) -> - ok; -emit_default_access_fun_switch_cases(G, N, X, Fd, DiscrType, - [{"default", _, _, _, _} |MList]) -> - emit_default_access_fun_switch_cases(G, N, X, Fd, DiscrType, MList); -emit_default_access_fun_switch_cases(G, N, X, Fd, DiscrType, - [{Label, _Case, _TypeDef, _Id, _} | MList]) -> - ic_codegen:emit(Fd, " case ~s:\n", - [get_case_as_int(G, N, ic_forms:get_type(X), - DiscrType, Label)]), - emit_default_access_fun_switch_cases(G, N, X, Fd, DiscrType, MList). - - - -%%----------------------------------------------------------------- -%% Func: emit_union_unmarshal_function/5 -%%----------------------------------------------------------------- -emit_union_unmarshal_function(G, N, X, Fd, UnionName, WiredUnionName, MList) -> - DiscrTypeForm = ic_forms:get_type(X), - DiscrType = ic_java_type:getType(G, [UnionName ++ "Package"|N], - DiscrTypeForm), - - ic_codegen:emit(Fd, " _in.read_tuple_head();\n\n"), - - ic_codegen:emit(Fd, " if ((_in.read_atom()).compareTo(~p) != 0)\n", - [ic_util:to_undersc([WiredUnionName|N])]), - ic_codegen:emit(Fd, " throw new java.lang.Exception(\"\");\n\n",[]), - - ic_codegen:emit(Fd, " ~s _value = new ~s();\n", [UnionName, UnionName]), - - %% Decode discriminator - case ic_java_type:isBasicType(G, N, DiscrTypeForm) of - true -> - ic_codegen:emit(Fd, " ~s _discriminator = _in~s;\n\n", - [DiscrType, - ic_java_type:unMarshalFun(G, N, X, DiscrTypeForm)]); - _ -> - ic_codegen:emit(Fd, " ~s _discriminator = ~s.unmarshal(_in);\n\n", - [DiscrType,ic_java_type:getUnmarshalType(G, N, X, DiscrTypeForm)]) - end, - - ic_codegen:emit(Fd, " switch (~sHelper.discriminatorAsInt(_discriminator)) {\n", - [UnionName]), - - emit_union_unmarshal_function_loop(G, [UnionName ++ "Package"|N], X, - Fd, DiscrType, MList), - - ic_codegen:emit(Fd, " }\n\n"), - - ic_codegen:emit(Fd, " return _value;\n"). - -%%----------------------------------------------------------------- -%% Func: emit_union_unmarshal_function_loop/6 -%%----------------------------------------------------------------- -emit_union_unmarshal_function_loop(_, _, _, _, _, []) -> - ok; -emit_union_unmarshal_function_loop(G, N, X, Fd, DiscrType, - [{Label, Case, Type, Id, Ls} |MList]) -> - case Label of - "default" -> - ic_codegen:emit(Fd, " default:\n"); - _ -> - ic_codegen:emit(Fd, " case ~s:\n", - [get_case_as_int(G, N, ic_forms:get_type(X), - DiscrType, Label)]) - end, - - gen_multiple_cases(G, N, X, Fd, DiscrType, Ls), - - CaseId = Case#case_dcl.id, %% Maybe Array - CaseType = Case#case_dcl.type, %% Maybe Sequence - - case element(1,CaseId) of - array -> - ic_codegen:emit(Fd, " _value.~s(~s.unmarshal(_in));\n", - [Id, - ic_java_type:getUnmarshalType(G, N, Case, CaseId)]); - - _ -> - case element(1, CaseType) of - sequence -> - ic_codegen:emit(Fd, " _value.~s(~s.unmarshal(_in));\n", - [Id, - ic_java_type:getUnmarshalType(G, N, Case, CaseType)]); - _ -> - case ic_java_type:isBasicType(G, N, CaseType) of - true -> - ic_codegen:emit(Fd, " _value.~s(_in~s);\n", - [Id, - ic_java_type:unMarshalFun(G, N, X, Type)]); - false -> - ic_codegen:emit(Fd, " _value.~s(~s.unmarshal(_in));\n", - [Id, - ic_java_type:getUnmarshalType(G, N, X, Type)]) - end - end - end, - - ic_codegen:emit(Fd, " break;\n", []), - emit_union_unmarshal_function_loop(G, N, X, Fd, DiscrType, MList). - - - - - -%%----------------------------------------------------------------- -%% Func: emit_union_marshal_function/6 -%%----------------------------------------------------------------- -emit_union_marshal_function(G, N, X, Fd, UnionName, WiredUnionName, MList) -> - - DiscrTypeForm = ic_forms:get_type(X), - DiscrType = ic_java_type:getType(G, [UnionName ++ "Package" |N], - DiscrTypeForm), - - ic_codegen:emit(Fd, " _out.write_tuple_head(3);\n"), - ic_codegen:emit(Fd, " _out.write_atom(~p);\n", - [ic_util:to_undersc([WiredUnionName|N])]), - - case ic_java_type:isBasicType(G, N, DiscrTypeForm) of - true -> - ic_codegen:emit(Fd, " _out~s(_value.discriminator());\n\n", - [ic_java_type:marshalFun(G, N, X, DiscrTypeForm)]); - false -> - ic_codegen:emit(Fd, " ~s(_out, _value.discriminator());\n\n", - [ic_java_type:marshalFun(G, N, X, DiscrTypeForm)]) - end, - - ic_codegen:emit(Fd, " switch(~sHelper.discriminatorAsInt(_value.discriminator())) {\n", - [UnionName]), - - emit_union_marshal_function_loop(G, - [ UnionName ++ "Package"|N], - X, - Fd, - DiscrType, - MList), - - ic_codegen:emit(Fd, " }\n\n", []). - - -%%----------------------------------------------------------------- -%% Func: emit_union_marshal_function_loop/ -%%----------------------------------------------------------------- -emit_union_marshal_function_loop(_, _, _, _, _, []) -> - ok; -emit_union_marshal_function_loop(G, N, X, Fd, DiscrType, - [{Label, Case, Type, Id, Ls} |MList]) -> - case Label of - "default" -> - ic_codegen:emit(Fd, " default:\n", - []); - _ -> - ic_codegen:emit(Fd, " case ~s:\n", - [get_case_as_int(G, N, ic_forms:get_type(X), - DiscrType, Label)]) - end, - - gen_multiple_cases(G, N, X, Fd, DiscrType, Ls), - - - CaseId = Case#case_dcl.id, %% Maybe Array - CaseType = Case#case_dcl.type, %% Maybe Sequence - - case element(1,CaseId) of - array -> - ic_codegen:emit(Fd, " ~s(_out, _value.~s());\n", - [ic_java_type:marshalFun(G, N, Case, CaseId), - Id]); - _ -> - case element(1, CaseType) of - sequence -> - ic_codegen:emit(Fd, " ~s.marshal(_out, _value.~s());\n", - [ic_util:to_dot(G,[Id|N]) ++ "Helper", - Id]); - _ -> - case ic_java_type:isBasicType(G, N, CaseType) of - true -> - ic_codegen:emit(Fd, " _out~s(_value.~s());\n", - [ic_java_type:marshalFun(G, N, X, Type), - Id]); - false -> - ic_codegen:emit(Fd, " ~s(_out, _value.~s());\n", - [ic_java_type:marshalFun(G, N, X, Type), - Id]) - end - end - end, - - ic_codegen:emit(Fd, " break;\n", []), - emit_union_marshal_function_loop(G, N, X, Fd, DiscrType, MList). - - - -gen_multiple_cases(_G, _N, _X, _Fd, _DiscrType, []) -> - ok; -gen_multiple_cases(G, N, X, Fd, DiscrType, [Label |Ls]) -> - ic_codegen:emit(Fd, " case ~s:\n", - [get_case_as_int(G, N, ic_forms:get_type(X), - DiscrType, getLabel(DiscrType, Label))]), - gen_multiple_cases(G, N, X, Fd, DiscrType, Ls). - - -%%----------------------------------------------------------------- -%% Func: union_member_list/3 -%%----------------------------------------------------------------- -union_member_list(G, N, X, DiscrType) -> - M = lists:map( - fun(Case) -> - {Label, LabelList} = case check_default(ic_forms:get_idlist(Case)) of - {{default, C}, List} -> - {{default, C}, List}; - {L, []} -> - {L, []}; - {_, [L |Ls]} -> - {L, Ls} - end, - - CName = ic_forms:get_java_id(Case), - CId = Case#case_dcl.id, - CType = Case#case_dcl.type, - - if element(1,CId) == array -> - N2 = [ic_forms:get_id2(X) ++ "Package" |N], - ic_array_java:gen(G, N2, Case, CId); - true -> - if element(1,Case#case_dcl.type) == sequence -> - N2 = [ic_forms:get_id2(X) ++ "Package" |N], - ic_sequence_java:gen(G, N2, CType, CName); - true -> - ok - end - end, - - {getLabel(DiscrType, Label), - Case, - ic_forms:get_type(Case), - CName, - LabelList} - end, - ic_forms:get_body(X)), - lists:flatten(M). - -check_default([]) -> - {false, []}; -check_default([{default, X} |Ls]) -> - {{default, X}, Ls}; -check_default([L]) -> - {false, [L]}; -check_default([L |Ls]) -> - {X, Y} = check_default(Ls), - {X, [L | Y]}. - -getLabel(_, {'', _, N}) -> - N; -getLabel(_, {'', _, N}) -> - "'" ++ N ++ "'"; -getLabel(_, {'', _, N}) -> - "'" ++ N ++ "'"; -getLabel(_, {'TRUE',_}) -> - "true"; -getLabel(_, {'FALSE',_}) -> - "true"; -getLabel(_, {default, _}) -> - "default"; -getLabel(_DiscrType, X) -> %%DiscrType ++ "." ++ - ic_util:to_dot(ic_forms:get_id(X)). - -get_default_val(G, N, _, tk_short, MList) -> - integer_default_val(G, N, 1, lists:map(fun({V, _, _, _, _}) -> V end, MList)); -get_default_val(G, N, _, tk_long, MList) -> - integer_default_val(G, N, 1, lists:map(fun({V, _, _, _, _}) -> V end, MList)); -get_default_val(G, N, _, tk_ushort, MList) -> - integer_default_val(G, N, 1, lists:map(fun({V, _, _, _, _}) -> V end, MList)); -get_default_val(G, N, _, tk_ulong, MList) -> - integer_default_val(G, N, 1, lists:map(fun({V, _, _, _, _}) -> V end, MList)); -get_default_val(G, N, _, tk_char, MList) -> - char_default_val(G, N, $a, lists:map(fun({V, _, _, _, _}) -> V end, MList)); -get_default_val(G, N, _, tk_boolean, MList) -> - boolean_default_val(G, N, lists:map(fun({V, _, _, _, _}) -> V end, MList)); -get_default_val(G, N, DiscrType, {tk_enum, _, _, Values}, MList) -> - enum_default_val(G, N, DiscrType, Values, MList). - -integer_default_val(G, N, Num, MList) -> - Num2 = integer_to_list(Num), - case lists:member(Num2, MList) of - true -> - integer_default_val(G, N, Num + 1, MList); - false -> - Num2 - end. - -char_default_val(G, N, CharNum, MList) -> - Str = "'", - CharNum2 = Str ++ [CharNum | Str], - case lists:member(CharNum2, MList) of - true -> - char_default_val(G, N, CharNum + 1, MList); - false -> - CharNum2 - end. - -boolean_default_val(G, N, MList) -> - if - length(MList) > 2 -> - ic_error:error(G, {plain_error_string, - lists:flatten( - io_lib:format("Default value found while all values have label on ~s", - [ic_util:to_colon(N)]))}), - none; - true -> - case MList of - ["true"] -> - "false"; - ["false"] -> - "true"; - ["default","true"] -> - "false"; - ["true","default"] -> - "false"; - ["default","false"] -> - "true"; - ["false","default"] -> - "true"; - _ -> - none - end - end. - - - - -enum_default_val(G, N, DiscrType, Values, Mlist) -> - - VLen = length(Values), - MLen = length(Mlist), - - case MLen > VLen of - true -> - ic_error:error(G, {plain_error_string, - lists:flatten( - io_lib:format("Default value found while all values have label on ~s", - [ic_util:to_colon(N)]))}), - none; - false -> - enum_default_val_loop(G, N, DiscrType, Values, Mlist) - end. - -enum_default_val_loop(_G, _N, _, [], []) -> - none; -enum_default_val_loop(_G, _N, DiscrType, [Value| _], []) -> - DiscrType ++ "." ++ Value; -enum_default_val_loop(G, N, DiscrType, Values, [Case | MList]) when is_tuple(Case) -> - NewValues = lists:delete(element(1,Case), Values), - enum_default_val_loop(G, N, DiscrType, NewValues, MList). - - - -emit_discriminator_as_int(G, N, T, Fd) -> - case ictype:isBoolean(G,N,T) of - true -> - ic_codegen:emit(Fd, " if(_discriminator)\n", []), - ic_codegen:emit(Fd, " return 1;\n", []), - ic_codegen:emit(Fd, " else\n", []), - ic_codegen:emit(Fd, " return 0;\n", []); - false -> - case ictype:isEnum(G, N, T) of - true -> - ic_codegen:emit(Fd, " return _discriminator.value();\n", - []); - false -> - ic_codegen:emit(Fd, " return _discriminator;\n", []) - end - end. - - -get_case_as_int(G, N, T, DiscrJavaTypeName, Label) -> - case ictype:isBoolean(G,N,T) of - true -> - case Label of - "true" -> - "1"; - "false" -> - "0" - end; - false -> - case ictype:isEnum(G, N, T) of - true -> - DiscrJavaTypeName ++ "._" ++ Label; - false -> - "(" ++ DiscrJavaTypeName ++ ") " ++ Label - end - end. - - - diff --git a/lib/ic/src/ic_util.erl b/lib/ic/src/ic_util.erl deleted file mode 100644 index b1263ae63d..0000000000 --- a/lib/ic/src/ic_util.erl +++ /dev/null @@ -1,314 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(ic_util). - - --include("icforms.hrl"). --include("ic.hrl"). --include("ic_debug.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- - --export([mk_align/1, mk_list/1, join/2, chain/2, mk_name/2, - mk_OE_name/2, mk_oe_name/2, mk_var/1]). - --export([to_atom/1, to_colon/1, to_list/1, to_undersc/1, to_dot/1, - to_dot/2]). --export([to_uppercase/1, adjustScopeToJava/2, eval_java/3, eval_c/3]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- - -%% mk_list produces a nice comma separated string of variable names -mk_list([]) -> []; -mk_list([Arg | Args]) -> - Arg ++ mk_list2(Args). -mk_list2([Arg | Args]) -> - ", " ++ Arg ++ mk_list2(Args); -mk_list2([]) -> []. - -%% Produce a list of items separated by S. -join([E1, E2| Es], S) -> - [E1, S| join([E2| Es], S)]; -join([E], _) -> - [E]; -join([], _) -> - []. - -%% Produce a list of items, each terminated by T. -chain([E| Es], T) -> - [E, T| chain(Es, T)]; -chain([], _) -> - []. - - -%% Shall convert a string to a Erlang variable name (Capitalise) -mk_var( [N | Str] ) when N >= $a, N =< $z -> - [ N+$A-$a | Str ]; -mk_var( [N | Str] ) when N >= $A, N =< $Z -> [N | Str]. - -%% Shall produce a "public" name for name. When we introduce new -%% identifiers in the mapping that must not collide with those from -%% the IDL spec. -%% -%% NOTE: Change name of IFR ID in system exceptions in corba.hrl when -%% prefix is changed here. -%% -mk_name(_Gen, Name) -> lists:flatten(["OE_" | Name]). -mk_OE_name(_Gen, Name) -> lists:flatten(["OE_" | Name]). -mk_oe_name(_Gen, Name) -> lists:flatten(["oe_" | Name]). - -mk_align(String) -> - io_lib:format("OE_ALIGN(~s)",[String]). - -to_atom(A) when is_atom(A) -> A; -to_atom(L) when is_list(L) -> list_to_atom(L). - -to_list(A) when is_list(A) -> A; -to_list(L) when is_atom(L) -> atom_to_list(L); -to_list(X) when is_integer(X) -> integer_to_list(X). - - - -%% Produce a colon (or under score) separated string repr of the name -%% X -%% -to_colon(X) when element(1, X) == scoped_id -> - to_colon2(ic_symtab:scoped_id_strip(X)); -to_colon(L) -> to_colon2(L). - -to_colon2([X]) -> X; -to_colon2([X | Xs]) -> to_colon2(Xs) ++ "::" ++ X; -to_colon2([]) -> "". - - -to_undersc(X) when element(1, X) == scoped_id -> - to_undersc2(ic_symtab:scoped_id_strip(X)); -to_undersc(L) -> to_undersc2(L). - -to_undersc2([X]) -> X; -to_undersc2([X | Xs]) -> to_undersc2(Xs) ++ "_" ++ X; -to_undersc2([]) -> "". - - -%% Z is a single name -to_uppercase(Z) -> - lists:map(fun(X) when X>=$a, X=<$z -> X-$a+$A; - (X) -> X end, Z). - - -%% -to_dot(X) when element(1, X) == scoped_id -> - to_dotLoop(ic_symtab:scoped_id_strip(X)); -to_dot(L) -> to_dotLoop(L). - -to_dotLoop([X]) -> ic_forms:get_java_id(X); -to_dotLoop([X | Xs]) -> to_dotLoop(Xs) ++ "." ++ ic_forms:get_java_id(X); -to_dotLoop([]) -> "". - - - -%% -to_dot(G,X) when element(1, X) == scoped_id -> - S = ic_genobj:pragmatab(G), - ScopedId = ic_symtab:scoped_id_strip(X), - case isConstScopedId(S, ScopedId) of %% Costants are left as is - true -> - to_dotLoop(ScopedId) ++ addDotValue(S, ScopedId); - false -> - to_dotLoop(S,ScopedId) - end; -to_dot(G,ScopedId) -> - S = ic_genobj:pragmatab(G), - case isConstScopedId(S, ScopedId) of %% Costants are left as is - true -> - to_dotLoop(ScopedId) ++ addDotValue(S, ScopedId); - false -> - to_dotLoop(S,ScopedId) - end. - -addDotValue(S, [_C | Ss]) -> - case isInterfaceScopedId(S, Ss) of - true -> - ""; - false -> - ".value" - end. - -to_dotLoop(S,[X]) -> - case isInterfaceScopedId(S, [X]) of - true -> - ic_forms:get_java_id(X) ++ "Package"; - false -> - ic_forms:get_java_id(X) - end; -to_dotLoop(S,[X | Xs]) -> - case isInterfaceScopedId(S, [X | Xs]) of - true -> - to_dotLoop(S,Xs) ++ "." ++ ic_forms:get_java_id(X) ++ "Package"; - false -> - to_dotLoop(S,Xs) ++ "." ++ ic_forms:get_java_id(X) - end; -to_dotLoop(_S,[]) -> "". - -isInterfaceScopedId(_S,[]) -> - false; -isInterfaceScopedId(S,[X|Xs]) -> - case ets:match(S,{file_data_local,'_','_',interface,Xs,X,'_','_','_'}) of - [] -> - case ets:match(S,{file_data_included,'_','_',interface,Xs,X,'_','_','_'}) of - [] -> - false; - _ -> - true - end; - _ -> - true - end. - -isConstScopedId(_S,[]) -> - false; -isConstScopedId(S,[X|Xs]) -> - case ets:match(S,{file_data_local,'_','_',const,Xs,X,'_','_','_'}) of - [] -> - case ets:match(S,{file_data_included,'_','_',const,Xs,X,'_','_','_'}) of - [] -> - false; - _ -> - true - end; - _ -> - true - end. - - - -%% -adjustScopeToJava(G,X) when element(1, X) == scoped_id -> - S = ic_genobj:pragmatab(G), - ScopedId = ic_symtab:scoped_id_strip(X), - case isConstScopedId(S, ScopedId) of %% Costants are left as is - true -> - ic_forms:get_java_id(ScopedId); - false -> - adjustScopeToJavaLoop(S,ScopedId) - end; -adjustScopeToJava(G,ScopedId) -> - S = ic_genobj:pragmatab(G), - case isConstScopedId(S, ScopedId) of %% Costants are left as is - true -> - ic_forms:get_java_id(ScopedId); - false -> - adjustScopeToJavaLoop(S,ScopedId) - end. - - - -adjustScopeToJavaLoop(_S,[]) -> - []; -adjustScopeToJavaLoop(S,[X | Xs]) -> - case isInterfaceScopedId(S, [X | Xs]) of - true -> - [ic_forms:get_java_id(X) ++ "Package" | adjustScopeToJavaLoop(S,Xs)]; - false -> - [ic_forms:get_java_id(X) | adjustScopeToJavaLoop(S,Xs)] - end. - - -%% -%% Expression evaluator for java -%% -%% Well, this is not an evaluator, it just -%% prints the hole operation, sorry. -%% -eval_java(G,N,Arg) when is_record(Arg, scoped_id) -> - {FSN, _, _, _} = - ic_symtab:get_full_scoped_name(G, N, Arg), - ic_util:to_dot(G,FSN); -eval_java(_G,_N,Arg) when is_tuple(Arg) andalso element(1,Arg) == '' -> - element(3,Arg); -eval_java(_G,_N,Arg) when is_tuple(Arg) andalso element(1,Arg) == '' -> - element(3,Arg); -eval_java(_G,_N,Arg) when is_tuple(Arg) andalso element(1,Arg) == '' -> - element(3,Arg); -eval_java(_G,_N,Arg) when is_tuple(Arg) andalso element(1,Arg) == '' -> - element(3,Arg); -eval_java(_G,_N,Arg) when is_tuple(Arg) andalso element(1,Arg) == '' -> - element(3,Arg); -eval_java(_G,_N,Arg) when is_tuple(Arg) andalso element(1,Arg) == '' -> - element(3,Arg); -eval_java(_G,_N,Arg) when is_tuple(Arg) andalso element(1,Arg) == '' -> - element(3,Arg); -eval_java(G,N,{Op,Arg1,Arg2}) -> - "(" ++ eval_java(G,N,Arg1) ++ - ic_forms:get_java_id(Op) ++ - eval_java(G,N,Arg2) ++ ")". - - - -%% -%% Expression evaluator for c -%% -%% Well, this is not an evaluator, it just -%% prints the hole operation, sorry. -%% -eval_c(G,N,Arg) when is_record(Arg, scoped_id) -> - {FSN, _, _, _} = - ic_symtab:get_full_scoped_name(G, N, Arg), - ic_util:to_undersc(FSN); -eval_c(_G,_N,Arg) when is_tuple(Arg) andalso element(1,Arg) == '' -> - element(3,Arg); -eval_c(_G,_N,Arg) when is_tuple(Arg) andalso element(1,Arg) == '' -> - element(3,Arg); -eval_c(_G,_N,Arg) when is_tuple(Arg) andalso element(1,Arg) == '' -> - element(3,Arg); -eval_c(_G,_N,Arg) when is_tuple(Arg) andalso element(1,Arg) == '' -> - element(3,Arg); -eval_c(_G,_N,Arg) when is_tuple(Arg) andalso element(1,Arg) == '' -> - element(3,Arg); -eval_c(_G,_N,Arg) when is_tuple(Arg) andalso element(1,Arg) == '' -> - element(3,Arg); -eval_c(_G,_N,Arg) when is_tuple(Arg) andalso element(1,Arg) == '' -> - element(3,Arg); -eval_c(G,N,{Op,Arg1,Arg2}) -> - "(" ++ eval_c(G,N,Arg1) ++ - atom_to_list(Op) ++ - eval_c(G,N,Arg2) ++ ")". - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- - - - - - - diff --git a/lib/ic/src/icenum.erl b/lib/ic/src/icenum.erl deleted file mode 100644 index cab68d17fa..0000000000 --- a/lib/ic/src/icenum.erl +++ /dev/null @@ -1,206 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: icenum.erl -%% -%% -%%----------------------------------------------------------------- -%% -%% Code generation for enum's. -%%----------------------------------------------------------------- --module(icenum). - --import(ic_codegen, [emit/2, emit/3, emit/4, emit_c_enc_rpt/4, emit_c_dec_rpt/4]). - --include("icforms.hrl"). --include("ic.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([enum_gen/4]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -enum_gen(G, N, X, c) when is_record(X, enum) -> - emit_c_enum(G, N, X); -enum_gen(_G, _N, _X, _L) -> - ok. - - -emit_c_enum(G, N, X) -> - case ic_genobj:is_hrlfile_open(G) of - true -> - EnumName = [ic_forms:get_id2(X) | N], - - case ic_pragma:is_local(G,EnumName) of - true -> - - Fd = ic_genobj:hrlfiled(G), - EnumNameStr = ic_util:to_undersc(EnumName), - ic_code:insert_typedef(G, EnumNameStr, {enum, EnumNameStr}), - {tk_enum,_,_,EList} = ic_forms:get_tk(X), - emit(Fd, "\n#ifndef __~s__\n",[ic_util:to_uppercase(EnumNameStr)]), - emit(Fd, "#define __~s__\n",[ic_util:to_uppercase(EnumNameStr)]), - ic_codegen:mcomment_light(Fd, - [io_lib:format("Enum definition: ~s", - [EnumNameStr])], - c), - emit(Fd, "typedef CORBA_enum {", []), - emit_c_enum_values(G, N, Fd, EList), - emit(Fd, "} ~s ;\n\n", [EnumNameStr]), - create_c_enum_file(G, N, EnumNameStr, EList), - emit(Fd, "\n#endif\n\n"); - - false -> %% Do not generate included types att all. - ok - end; - - false -> - ok - end. - - -emit_c_enum_values(_G, N, Fd, [E]) -> - emit(Fd, "~s", [ic_util:to_undersc([E| N])]); -emit_c_enum_values(G, N, Fd, [E |Es]) -> - emit(Fd, "~s, ", [ic_util:to_undersc([E| N])]), - emit_c_enum_values(G, N, Fd, Es). - - -open_c_coding_file(G, Name) -> - SName = string:concat(ic_util:mk_oe_name(G, "code_"), Name), - FName = - ic_file:join(ic_options:get_opt(G, stubdir),ic_file:add_dot_c(SName)), - case file:open(FName, [write]) of - {ok, Fd} -> - {Fd, SName}; - Other -> - exit(Other) - end. - - -create_c_enum_file(G, N, Name, Elist) -> - - {Fd , SName} = open_c_coding_file(G, Name), - HFd = ic_genobj:hrlfiled(G), %% Write on stubfile header - HrlFName = filename:basename(ic_genobj:include_file(G)), - ic_codegen:emit_stub_head(G, Fd, SName, c), - emit(Fd, "#include \"~s\"\n\n",[HrlFName]), - - %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - %% Fd = ic_genobj:stubfiled(G), %% Write on stubfile - %% HFd = ic_genobj:hrlfiled(G), %% Write on stubfile header - %% HrlFName = filename:basename(ic_genobj:include_file(G)), - %% emit(Fd, "#include \"~s\"\n\n",[HrlFName]), - %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - emit(Fd, "char* ~s[~p] = {\n", [ic_util:mk_oe_name(G, Name), - length(Elist)]), - emit_c_enum_array_values(Fd, Elist), - emit(Fd, "};\n\n",[]), - emit_sizecount(G, N, Fd, HFd, Name, Elist), - emit_encode(G, N, Fd, HFd, Name, Elist), - emit_decode(G, N, Fd, HFd, Name, Elist), - file:close(Fd). - -emit_c_enum_array_values(Fd, [E]) -> - emit(Fd, " ~p\n", [E]); -emit_c_enum_array_values(Fd, [E |Es]) -> - emit(Fd, " ~p,\n", [E]), - emit_c_enum_array_values(Fd, Es). - - -emit_sizecount(G, _N, Fd, HFd, Name, _Elist) -> - - emit(HFd, "int ~s~s(CORBA_Environment *oe_env, int*, int*);\n", - [ic_util:mk_oe_name(G, "sizecalc_"), Name]), - - emit(Fd, "int ~s~s(CORBA_Environment *oe_env, int* oe_size_count_index, int* oe_size)\n" - "{\n", - [ic_util:mk_oe_name(G, "sizecalc_"), Name]), - emit(Fd, " int oe_error_code = 0;\n\n",[]), - - AlignName = lists:concat(["*oe_size + sizeof(",Name,")"]), - emit(Fd, " *oe_size = ~s;\n\n",[ic_util:mk_align(AlignName)]), - - emit(Fd, " if ((oe_error_code = ei_decode_atom(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - emit_c_enc_rpt(Fd, " ", "ei_decode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " return 0;\n\n",[]), - emit(Fd, "}\n\n",[]). - - -emit_encode(G, _N, Fd, HFd, Name, _Elist) -> - - emit(HFd, "int ~s~s(CORBA_Environment *oe_env, ~s);\n", - [ic_util:mk_oe_name(G, "encode_"), Name, Name]), - - emit(Fd, "int ~s~s(CORBA_Environment *oe_env, ~s oe_rec) {\n", - [ic_util:mk_oe_name(G, "encode_"), Name, Name]), - emit(Fd, " int oe_error_code = 0;\n\n",[]), - - emit(Fd, " if ((oe_error_code = oe_ei_encode_atom(oe_env, ~s[oe_rec])) < 0) {\n", - [ic_util:mk_oe_name(G, Name)]), - emit_c_enc_rpt(Fd, " ", "oe_ei_encode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"), - - emit(Fd, " return 0;\n\n",[]), - emit(Fd, "}\n\n",[]). - -emit_decode(G, _N, Fd, HFd, Name, Elist) -> - - emit(HFd, "int ~s~s(CORBA_Environment *oe_env, char *, int*, ~s *);\n", - [ic_util:mk_oe_name(G, "decode_"), Name, Name]), - - emit(Fd, "int ~s~s(CORBA_Environment *oe_env, char *oe_first, int* oe_outindex, " - "~s *oe_out) {\n\n", - [ic_util:mk_oe_name(G, "decode_"), Name, Name]), - emit(Fd, " int oe_error_code = 0;\n",[]), - emit(Fd, " int oe_i;\n",[]), - emit(Fd, " char oe_atom[256];\n\n",[]), - - AlignName = lists:concat(["*oe_outindex + sizeof(",Name,")"]), - emit(Fd, " *oe_outindex = ~s;\n\n",[ic_util:mk_align(AlignName)]), - - emit(Fd, " if ((oe_error_code = ei_decode_atom(oe_env->_inbuf, &oe_env->_iin, oe_atom)) < 0) {\n"), - emit_c_enc_rpt(Fd, " ", "ei_decode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"), - - Len = length(Elist), - emit(Fd, " for(oe_i = 0; oe_i < ~p && strcmp(oe_atom, ~s[oe_i]); oe_i++);\n", - [Len, ic_util:mk_oe_name(G, Name)]), - emit(Fd, " *oe_out = oe_i;\n\n", []), - - emit(Fd, " if (oe_i == ~p) {\n",[Len]), - emit_c_enc_rpt(Fd, " ", "decode atom failure", []), - emit(Fd, " return oe_error_code;\n }\n"), - - emit(Fd, " return 0;\n",[]), - emit(Fd, "}\n\n",[]). - - - - - diff --git a/lib/ic/src/iceval.erl b/lib/ic/src/iceval.erl deleted file mode 100644 index a93e60124c..0000000000 --- a/lib/ic/src/iceval.erl +++ /dev/null @@ -1,556 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(iceval). - --include("icforms.hrl"). - --export([eval_const/5, eval_e/5]). - --export([check_tk/3, get_val/1, mk_val/1]). - --define(get_max(__X, __Y), if __X > __Y -> __X; true -> __Y end). --define(get_min(__X, __Y), if __X > __Y -> __Y; true -> __X end). - --define(BASE, 100000000000000000000000000000000). --define(FIXED_MAX, 9999999999999999999999999999999). - -%% Called fr: ictype 99, 522, 533 -%% Fixed constants can be declared as: -%% (1) const fixed pi = 3.14D; or -%% (2) typedef fixed<3,2> f32; -%% const f32 pi = 3.14D; -%% Hence, if fixed is declared as (1) we must handle it especially. -eval_const(G, S, N, tk_fixed, Expr) -> - case catch eval_e(G, S, N, tk_fixed, Expr) of - T when element(1, T) == error -> 0; - V when is_record(V, fixed) -> - {ok, {tk_fixed, V#fixed.digits, V#fixed.scale}, V}; - V -> - ic_error:error(G, {bad_tk_match, Expr, tk_fixed, get_val(V)}) - end; -eval_const(G, S, N, TK, Expr) -> - case catch eval_e(G, S, N, TK, Expr) of - T when element(1, T) == error -> 0; - V -> - case check_tk(G, TK, V) of - true -> ok; - false -> - ic_error:error(G, {bad_tk_match, Expr, TK, get_val(V)}) - end, - get_val(V) - end. - - -check_op(G, S, N, Tk, Types, Op, E1, E2) -> - V1 = eval_e(G, S, N, Tk, E1), - V2 = eval_e(G, S, N, Tk, E2), - check_types(G, Op, E1, Types, V1), - check_types(G, Op, E2, Types, V2), - case check_comb(V1, V2) of - true -> - {V1, V2}; - false -> - Err = {bad_type_combination, E1, get_val(V1), get_val(V2)}, - ic_error:error(G, Err), - throw({error, Err}) - end. - -check_op(G, S, N, Tk, Types, Op, E1) -> - V1 = eval_e(G, S, N, Tk, E1), - check_types(G, Op, E1, Types, V1), - V1. - -%% Match the declared type TK against the factual value of an constant -%% -check_tk(_G, _Any, default) -> true; % Default case in union -check_tk(_G, positive_int, V) when is_integer(V) andalso V >= 0 -> true; -check_tk(_G, tk_long, V) when is_integer(V) -> true; -check_tk(_G, tk_longlong, V) when is_integer(V) -> true; %% LLON_G -check_tk(_G, tk_short, V) when is_integer(V) -> true; -check_tk(_G, tk_ushort, V) when is_integer(V) andalso V >= 0 -> true; -check_tk(_G, tk_ulong, V) when is_integer(V) andalso V >= 0 -> true; -check_tk(_G, tk_ulonglong, V) when is_integer(V) andalso V >= 0 -> true; %% ULLON_G -check_tk(_G, tk_float, V) when is_float(V) -> true; -check_tk(_G, tk_double, V) when is_float(V) -> true; -check_tk(_G, tk_boolean, V) -> is_bool(V); -check_tk(_G, tk_char, {char, _V}) -> true; -check_tk(_G, tk_wchar, {wchar, _V}) -> true; %% WCHAR -check_tk(_G, {tk_string, _Len}, {string, _V}) -> true; -check_tk(_G, {tk_wstring, _Len}, {wstring, _V}) -> true; %% WSTRING -check_tk(_G, {tk_fixed, Digits, Scale}, {fixed, Digits, Scale, _V}) -> true; -check_tk(_G, tk_octet, V) when is_integer(V) -> true; -%%check_tk(_G, tk_null, V) when integer(V) -> true; -%%check_tk(_G, tk_void, V) when integer(V) -> true; -%%check_tk(_G, tk_any, V) when integer(V) -> true; -%%check_tk(_G, {tk_objref, "", "Object"}, V) when integer(V) -> true. -check_tk(_G, {tk_enum, _, _, Body}, {enum_id, Id}) -> - until(fun(X) when X == Id -> true; - (_X) -> - false - end, Body); -check_tk(_G, _TK, _V) -> - false. - -get_val({string, X}) -> X; -get_val({wstring, X}) -> X; %% WCHAR -get_val({char, X}) -> X; -get_val({wchar, X}) -> X; %% WSTRING -get_val({enum_id, X}) -> X; -get_val(X) -> X. - -check_types(G, Op, Expr, TypeList, V) -> - case until(fun(int) when is_integer(V) -> true; - (float) when is_float(V) -> true; - (bool) when V==true -> true; - (bool) when V==false -> true; - (fixed) when is_record(V, fixed) -> true; - (_) -> false end, - TypeList) of - true -> true; - false -> - Err = {bad_type, Expr, Op, TypeList, V}, - ic_error:error(G, Err), - throw({error, Err}) - end. - -%%get_op(T) when tuple(T) -> element(1, T). - -%% Should be in lists -until(F, [H|T]) -> - case F(H) of - true -> true; - false -> until(F, T) - end; -until(_F, []) -> false. - -%% Section of all the boolean operators (because Erlang ops don't like -%% boolean values. -e_or(X, Y) when is_integer(X) andalso is_integer(Y) -> X bor Y; -e_or(true, _) -> true; -e_or(_, true) -> true; -e_or(_, _) -> false. - -e_and(X, Y) when is_integer(X) andalso is_integer(Y) -> X band Y; -e_and(true, true) -> true; -e_and(_, _) -> false. - -e_xor(X, Y) when is_integer(X) andalso is_integer(Y) -> X bxor Y; -e_xor(X, X) -> false; -e_xor(_, _) -> true. - -%% Handling infix operators (+,-,*,/) for fixed type. -%% Boundries determined as fixed -e_fixed_add(#fixed{digits = D1, scale = S1, value = V1}, - #fixed{digits = D2, scale = S2, value = V2}) -> - Scale = ?get_max(S1, S2), - Digits = ?get_max((D1-S1), (D2-S2)) + Scale +1, - %% We must normalize the values before adding. Why? - %% 4.23 and 5.2 are represented as 423 and 52. To be able to get the - %% correct result we must add 4230 and 5200 == 9430. - {PV1, PV2} = normalize(S1, V1, S2, V2), - check_fixed_overflow(#fixed{digits = Digits, - scale = Scale, - value = (PV1 + PV2)}). - -%% Boundries determined as fixed -e_fixed_sub(#fixed{digits = D1, scale = S1, value = V1}, - #fixed{digits = D2, scale = S2, value = V2}) -> - Scale = ?get_max(S1, S2), - Digits = ?get_max((D1-S1), (D2-S2)) + Scale +1, - {PV1, PV2} = normalize(S1, V1, S2, V2), - check_fixed_overflow(#fixed{digits = Digits, - scale = Scale, - value = (PV1 - PV2)}). - -%% Boundries determined as fixed -e_fixed_mul(#fixed{digits = D1, scale = S1, value = V1}, - #fixed{digits = D2, scale = S2, value = V2}) -> - check_fixed_overflow(#fixed{digits = (D1+D2), - scale = (S1+S2), - value = V1*V2}). - -%% Boundries determined as fixed<(d1-s1+s2) + s inf ,s inf> -e_fixed_div(#fixed{digits = D1, scale = S1, value = V1}, - #fixed{digits = _D2, scale = S2, value = V2}) -> - {PV1, PV2} = normalize(S1, V1, S2, V2), - DigitsMin = (D1-S1+S2), - R1 = (PV1 div PV2), - R2 = (R1*?BASE + (PV1 rem PV2) * (?BASE div PV2)), - {Result2, Sinf} = delete_zeros_value(R2, 0, R1), - check_fixed_overflow(#fixed{digits = DigitsMin + Sinf, scale = Sinf, - value = Result2}). - - -%% Checks combination of argument types, basically floats and ints are -%% interchangeable, and all types are allowed with themselves. No -%% other combinations are allowed -%% -check_comb(X, Y) when is_integer(X) andalso is_integer(Y) -> true; -check_comb(X, Y) when is_float(X) andalso is_integer(Y) -> true; -check_comb(X, Y) when is_integer(X) andalso is_float(Y) -> true; -check_comb(X, Y) when is_float(X) andalso is_float(Y) -> true; -check_comb({X, _}, {X, _}) -> true; % Strings and chars are tuples -check_comb({fixed, _, _, _}, {fixed, _, _, _}) -> true; -check_comb(X, Y) -> - case {is_bool(X), is_bool(Y)} of - {true, true} -> - true; - _ -> - false - end. - -is_bool(true) -> true; -is_bool(false) -> true; -is_bool(_) -> false. - - -%%%% (15) -eval_e(G, S, N, Tk, {'or', T1, T2}) -> - {E1, E2} = check_op(G, S, N, Tk, [int, bool], 'or', T1, T2), - e_or(E1, E2); - -%%%% (16) -eval_e(G, S, N, Tk, {'xor', T1, T2}) -> - {E1, E2} = check_op(G, S, N, Tk, [int, bool], 'xor', T1, T2), - e_xor(E1, E2); - -%%%% (17) -eval_e(G, S, N, Tk, {'and', T1, T2}) -> - {E1, E2} = check_op(G, S, N, Tk, [int, bool], 'and', T1, T2), - e_and(E1, E2); - -%%%% (18) -eval_e(G, S, N, Tk, {'rshift', T1, T2}) -> - {E1, E2} = check_op(G, S, N, Tk, [int], 'rshift', T1, T2), - E1 bsr E2; -eval_e(G, S, N, Tk, {'lshift', T1, T2}) -> - {E1, E2} = check_op(G, S, N, Tk, [int], 'lshift', T1, T2), - E1 bsl E2; - -%%%% (19) -eval_e(G, S, N, Tk, {'+', T1, T2}) -> - case check_op(G, S, N, Tk, [int, float, fixed], '+', T1, T2) of - {F1, F2} when is_record(F1,fixed) andalso is_record(F2,fixed) -> - e_fixed_add(F1, F2); - {E1, E2} -> - E1 + E2 - end; -eval_e(G, S, N, Tk, {'-', T1, T2}) -> - case check_op(G, S, N, Tk, [int, float, fixed], '-', T1, T2) of - {F1, F2} when is_record(F1,fixed) andalso is_record(F2,fixed) -> - e_fixed_sub(F1, F2); - {E1, E2} -> - E1 - E2 - end; - -%%%% (20) -eval_e(G, S, N, Tk, {'*', T1, T2}) -> - case check_op(G, S, N, Tk, [int, float, fixed], '*', T1, T2) of - {F1, F2} when is_record(F1,fixed) andalso is_record(F2,fixed) -> - e_fixed_mul(F1, F2); - {E1, E2} -> - E1 * E2 - end; -eval_e(G, S, N, Tk, {'/', T1, T2}) -> - case check_op(G, S, N, Tk, [int, float, fixed], '/', T1, T2) of - {F1, F2} when is_record(F1,fixed) andalso is_record(F2,fixed) -> - e_fixed_div(F1, F2); - {E1, E2} -> - E1 / E2 - end; -eval_e(G, S, N, Tk, {'%', T1, T2}) -> - {E1, E2} = check_op(G, S, N, Tk, [int], '%', T1, T2), - E1 rem E2; - -%%%% (21) -eval_e(G, S, N, Tk, {{'-', _Line}, T}) -> - case check_op(G, S, N, Tk, [int, float, fixed], '-', T) of - F when is_record(F,fixed) -> - F#fixed{value = -(F#fixed.value)}; - Number -> - -Number - end; -eval_e(G, S, N, Tk, {{'+', _Line}, T}) -> - check_op(G, S, N, Tk, [int, float, fixed], '+', T); -eval_e(G, S, N, Tk, {{'~', Line}, T}) -> - ic_error:error(G, {unsupported_op, {'~', Line}}), - eval_e(G, S, N, Tk, T); - - -%% Ints are repr. by an Erlang integer val, floats and doubles by -%% Erlang floats, chars and strings must be tuplerized for type -%% checking. These tuples are removed just before returning from top -%% function. -%% -eval_e(_G, _S, _N, tk_fixed, {'', _Line, X}) -> - create_fixed(X); -eval_e(G, _S, _N, {tk_fixed, Digits, Scale}, {'', Line, X}) - when Digits < 32, Digits >= Scale -> - case convert_fixed(X, [], Digits, Digits-Scale) of - {error, Format, Args} -> - ic_error:error(G, {bad_fixed, Format, Args, Line}); - FixedData -> - {fixed, Digits, Scale, FixedData} - end; -eval_e(_G, _S, _N, _Tk, {'', _Line, X}) -> list_to_integer(X); -eval_e(_G, _S, _N, {tk_string,_}, {'', _Line, X}) -> {string, X}; -eval_e(_G, _S, _N, {tk_wstring,_}, {'', _Line, X}) -> {wstring, X}; %% WSTRING -eval_e(_G, _S, _N, tk_char, {'', _Line, X}) -> {char, hd(X)}; -eval_e(_G, _S, _N, tk_wchar, {'', _Line, X}) -> {wchar, hd(X)}; %% WCHAR -eval_e(_G, _S, _N, _Tk, {'TRUE', _Line}) -> true; -eval_e(_G, _S, _N, _Tk, {'FALSE', _Line}) -> false; -eval_e(_G, _S, _N, _Tk, {'', _Line, X}) -> to_float(X); -%% Some possible error conditions -eval_e(_G, _S, _N, _Tk, {'', _Line, X}) -> {char, hd(X)}; %% ERROR? -%% -eval_e(G, S, N, _Tk, X) when element(1, X) == scoped_id -> - mk_val(ictype:scoped_lookup(G, S, N, X)); -eval_e(_G, _S, _N, _Tk, {default, _}) -> default; % Default case in union -eval_e(G, _S, _N, Tk, Val) -> - ic_error:error(G, {plain_error_string, Val, - io_lib:format("value and declared type ~p differ", [Tk])}). - -%% A fixed type can be 123.45 or 123 but we represent it as integers (i.e. 12345 or 123). -convert_fixed([], Acc, 0, _) -> - list_to_integer(lists:reverse(Acc)); -convert_fixed([], _Acc, _, _) -> - {error, "Fixed type do not match the digits field", []}; -convert_fixed([$.|Rest], Acc, Digits, 0) -> - convert_fixed(Rest, Acc, Digits, -1); -convert_fixed([$.|_Rest], _Acc, _, _) -> - {error, "Fixed decimal point placed incorrectly", []}; -convert_fixed([X|Rest], Acc, Digits, Position) -> - convert_fixed(Rest, [X|Acc], Digits-1, Position-1). - - -create_fixed([$0|Rest]) -> - %% Leading zeros shall be ignored. - create_fixed(Rest); -create_fixed(Fixed) -> - create_fixed(Fixed, [], 0, 0, false). - -create_fixed([], Acc, Total, Frac, true) -> - {Fixed, N} = remove_trailing_zeros(Acc, 0), - Digits = Total-N, - Scale = Frac-N, - #fixed{digits = Digits, scale = Scale, value = list_to_integer(Fixed)}; -create_fixed([], Acc, Total, _Frac, false) -> - %% A '.' never found. Hence, must be 2000D - #fixed{digits = Total, scale = 0, value = list_to_integer(lists:reverse(Acc))}; -create_fixed([$.|Rest], Acc, Total, _, _) -> - create_fixed(Rest, Acc, Total, 0, true); -create_fixed([X|Rest], Acc, Total, Frac, FoundDot) -> - create_fixed(Rest, [X|Acc], Total+1, Frac+1, FoundDot). - -remove_trailing_zeros([$0|Rest], N) -> - remove_trailing_zeros(Rest, N+1); -remove_trailing_zeros(Fixed, N) -> - {lists:reverse(Fixed), N}. - -%% Make the newly looked up value a value that can be type checked. -mk_val({_, _, {tk_string, _}, V}) -> {string, V}; -mk_val({_, _, {tk_wstring, _}, V}) -> {wstring, V}; %% WSTRING -mk_val({_, _, tk_char, V}) -> {char, V}; -mk_val({_, _, tk_wchar, V}) -> {wchar, V}; %% WCHAR -mk_val({_, _, enum_val, V}) -> - {enum_id, ic_forms:get_id2(V)}; -mk_val(X) when element(1, X) == error -> X; -mk_val({_, _, _TK, V}) -> - V; -mk_val(V) -> V. - - - -%% Floating point numbers -%% -%% Conversion to Erlang floating points is neccessary because -%% list_to_float BIF differs from IDL floats. "1e2" ".4e2" is -%% allowed in IDL and must be translated to "1.0e2" and "0.4e2" - -to_float(X) -> - list_to_float(erlangify(X)). - -erlangify([$. | R]) -> - [$0, $. | R]; -erlangify(R) -> - look_for_dot(R). - -look_for_dot([$. | R]) -> [$. | dot_pending(R)]; -look_for_dot([$e | R]) -> [$., $0, $e | R]; -look_for_dot([$E | R]) -> [$., $0, $E | R]; -look_for_dot([X | R]) -> [X | look_for_dot(R)]. - -dot_pending([$e | R]) -> [$0, $e | R]; -dot_pending([$E | R]) -> [$0, $E | R]; -dot_pending([]) -> [$0]; -dot_pending(R) -> R. - - -%%------------------------------------------------------------------ -%%--------------- Fixed Datatype Helper Functions ------------------ -%%------------------------------------------------------------------ -%% Pretty?! No, but since we now the upper-limit this is the fastest way -%% to calculate 10^x -power(0) -> 1; -power(1) -> 10; -power(2) -> 100; -power(3) -> 1000; -power(4) -> 10000; -power(5) -> 100000; -power(6) -> 1000000; -power(7) -> 10000000; -power(8) -> 100000000; -power(9) -> 1000000000; -power(10) -> 10000000000; -power(11) -> 100000000000; -power(12) -> 1000000000000; -power(13) -> 10000000000000; -power(14) -> 100000000000000; -power(15) -> 1000000000000000; -power(16) -> 10000000000000000; -power(17) -> 100000000000000000; -power(18) -> 1000000000000000000; -power(19) -> 10000000000000000000; -power(20) -> 100000000000000000000; -power(21) -> 1000000000000000000000; -power(22) -> 10000000000000000000000; -power(23) -> 100000000000000000000000; -power(24) -> 1000000000000000000000000; -power(25) -> 10000000000000000000000000; -power(26) -> 100000000000000000000000000; -power(27) -> 1000000000000000000000000000; -power(28) -> 10000000000000000000000000000; -power(29) -> 100000000000000000000000000000; -power(30) -> 1000000000000000000000000000000; -power(31) -> 10000000000000000000000000000000; -power(_) -> 10000000000000000000000000000000. - - - -%% If the result of an operation (+, -, * or /) causes overflow we use this -%% operation. However, since these calculations are performed during compiletime, -%% shouldn't the IDL-specification be changed to not cause overflow?! But, since -%% the OMG standard allows this we must support it. -check_fixed_overflow(#fixed{digits = Digits, scale = Scale, value = Value}) -> - case count_digits(abs(Value)) of - overflow -> - {N, NewVal} = cut_overflow(0, Value), -% NewDigits = Digits - N, - if - N > Scale -> - #fixed{digits = 31, scale = 0, value = NewVal}; - true -> - NewScale = Scale - N, - {NewVal2, Removed} = delete_zeros(NewVal, NewScale), - #fixed{digits = 31, scale = NewScale-Removed, value = NewVal2} - end; - Count when Count > Digits -> - Diff = Count-Digits, - if - Diff > Scale -> - #fixed{digits = Digits, scale = 0, - value = (Value div power(Diff))}; - true -> - NewScale = Scale-Diff, - {NewVal, Removed} = delete_zeros((Value div power(Diff)), NewScale), - #fixed{digits = Digits-Removed, - scale = NewScale-Removed, - value = NewVal} - end; - Count -> - {NewVal, Removed} = delete_zeros(Value, Scale), - #fixed{digits = Count-Removed, scale = Scale-Removed, value = NewVal} - end. - -%% This function see to that the values are of the same baase. -normalize(S, V1, S, V2) -> - {V1, V2}; -normalize(S1, V1, S2, V2) when S1 > S2 -> - {V1, V2*power(S1-S2)}; -normalize(S1, V1, S2, V2) -> - {V1*power(S2-S1), V2}. - -%% If we have access to the integer part of the fixed type we use this -%% operation to remove all trailing zeros. If we know the scale, length of -%% fraction part, we can use delete_zeros as well. But, after a division -%% it's hard to know the scale and we don't need to calcluate the integer part. -delete_zeros_value(0, N, _) -> - {0, 32-N}; -delete_zeros_value(X, N, M) when X > M, (X rem 10) == 0 -> - delete_zeros_value((X div 10), N+1, M); -delete_zeros_value(X, N, _) -> - {X, 32-N}. - -%% If we know the exact scale of a fixed type we can use this operation to -%% remove all trailing zeros. -delete_zeros(0, _) -> - {0,0}; -delete_zeros(X, Max) -> - delete_zeros(X, 0, Max). -delete_zeros(X, Max, Max) -> - {X, Max}; -delete_zeros(X, N, Max) when (X rem 10) == 0 -> - delete_zeros((X div 10), N+1, Max); -delete_zeros(X, N, _) -> - {X, N}. - -cut_overflow(N, X) when X > ?FIXED_MAX -> - cut_overflow(N+1, (X div 10)); -cut_overflow(N, X) -> - {N, X}. - -%% A fast way to check the size of a fixed data type. -count_digits(X) when X > ?FIXED_MAX -> overflow; -count_digits(X) when X >= 1000000000000000000000000000000 -> 31; -count_digits(X) when X >= 100000000000000000000000000000 -> 30; -count_digits(X) when X >= 10000000000000000000000000000 -> 29; -count_digits(X) when X >= 1000000000000000000000000000 -> 28; -count_digits(X) when X >= 100000000000000000000000000 -> 27; -count_digits(X) when X >= 10000000000000000000000000 -> 26; -count_digits(X) when X >= 1000000000000000000000000 -> 25; -count_digits(X) when X >= 100000000000000000000000 -> 24; -count_digits(X) when X >= 10000000000000000000000 -> 23; -count_digits(X) when X >= 1000000000000000000000 -> 22; -count_digits(X) when X >= 100000000000000000000 -> 21; -count_digits(X) when X >= 10000000000000000000 -> 20; -count_digits(X) when X >= 1000000000000000000 -> 19; -count_digits(X) when X >= 100000000000000000 -> 18; -count_digits(X) when X >= 10000000000000000 -> 17; -count_digits(X) when X >= 1000000000000000 -> 16; -count_digits(X) when X >= 100000000000000 -> 15; -count_digits(X) when X >= 10000000000000 -> 14; -count_digits(X) when X >= 1000000000000 -> 13; -count_digits(X) when X >= 100000000000 -> 12; -count_digits(X) when X >= 10000000000 -> 11; -count_digits(X) when X >= 1000000000 -> 10; -count_digits(X) when X >= 100000000 -> 9; -count_digits(X) when X >= 10000000 -> 8; -count_digits(X) when X >= 1000000 -> 7; -count_digits(X) when X >= 100000 -> 6; -count_digits(X) when X >= 10000 -> 5; -count_digits(X) when X >= 1000 -> 4; -count_digits(X) when X >= 100 -> 3; -count_digits(X) when X >= 10 -> 2; -count_digits(_X) -> 1. - -%%------------------------------------------------------------------ -%%--------------- END Fixed Datatype Helper Functions -------------- -%%------------------------------------------------------------------ diff --git a/lib/ic/src/icforms.hrl b/lib/ic/src/icforms.hrl deleted file mode 100644 index f71aee3664..0000000000 --- a/lib/ic/src/icforms.hrl +++ /dev/null @@ -1,70 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%% -%% Module documentation: -%% --------------------- -%% -%% Header file for the Erlang IDL compiler. Contains all records -%% used in the parse tree -%% -%% -%%------------------------------------------------------------ - - - -%%------------------------------------------------------------ - --record(module, {id, body}). --record(interface, {id, inherit, body, inherit_body, tk}). --record(forward, {id, tk}). --record(constr_forward, {id, tk}). --record(const, {type, id, val, tk}). --record(type_dcl, {type, tk}). --record(typedef, {type, id, tk}). --record(struct, {id, body, tk}). --record(member, {type, id}). --record(union, {id, type, body, tk}). --record(case_dcl, {label, id, type}). --record(enum, {id, body, tk}). --record(enumerator, {id}). --record(sequence, {type, length=0}). --record(string, {length=0}). --record(wstring, {length=0}). %% WSTRING --record(array, {id, size}). --record(attr, {readonly, type, id, tk}). --record(except, {id, body, tk}). --record(op, {oneway, type, id, params, raises, ctx, tk}). --record(param, {inout, type, id, tk}). --record(fixed, {digits, scale, value}). - -%% NON-STANDARD --record(preproc, {cat, id, aux}). --record(pragma, {type, to, apply}). - - - - - - - - - - diff --git a/lib/ic/src/icparse.yrl b/lib/ic/src/icparse.yrl deleted file mode 100644 index 27e949729c..0000000000 --- a/lib/ic/src/icparse.yrl +++ /dev/null @@ -1,872 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%%------------------------------------------------------------ -%% Yecc spec for IDL -%% -%% -%% -%% Implementation Detail: -%% OorM_ means OneORMany and is used instead of -%% the "+" BNF notation -%% ZorM_ means ZeroORMany and is used instead of -%% the "*" BNF notation -%% -%% All the reverse/1 calls are because yecc+lists naturally leads -%% to reversed lists, which then have to be reversed. Maybe fix -%% this? -%% -%% Implementation history -%% -%% The IDL language supported is not the complete IDL. We skipped -%% the multiple declarator syntax allowed (i.e. typedef long T1, -%% T2). This also applies to attributes members in structs, -%% unions and exceptions, and to case labels in unions. The cases -%% where IDL has been altered is marked with comments containing -%% NIY. -%% -%% Above is chaging. Whenever we change a clause, we put (FIXED) in -%% its comment. -%% -%%------------------------------------------------------------ - - - - - -Nonterminals - '' - '' - '' - 'OorM_' - '' - '' - '' - '' - '' - '' - '' - 'ZorM_' - 'Opt_' - '' - '' - '' - '' - '' - '' - 'ZorM_' - 'Opt_' - '' - '' - '' - '' - '' - 'OorM_' - '' - '' - '' - '' - '' - '' - '' - '' - 'ZorM_' - '' - '' - '' - 'OorM_' - '' - '' - '' - '' - 'OorM_' - '' - '' - '' - '' - '' - '' - '' - '' - '' - '' - '' - '' - '' - '' - '' - '' - 'Opt_' - '' - '' - 'ZorM_' - '' - '' - '' - 'ZorM_' - 'ZorM_' - '' - '' - '' - '' - 'Opt_readonly' - '' - '' - '' - 'OorM_' - '' - '' - '' - '' - '' - '' - 'Opt_' - 'ZorM_' - '' - '' - '' - '' - 'ZorM_' - '' - 'OE_preproc' % NON standard - 'OE_pragma' % NON standard - 'Ugly_pragmas' % NON standard - 'ZorM_' - '' - '' - '' - . - - -Terminals - '#' - 'in' - '[' - 'interface' - '(' - 'case' - 'union' - 'struct' - '' - '' - ')' - ']' - 'any' - 'long' - 'float' - 'out' - '*' - '^' - 'enum' - 'double' - '+' - 'context' - 'oneway' - 'sequence' - ',' - 'FALSE' - '' - '{' - 'readonly' - ':' - '-' - 'void' - ';' - 'char' - 'wchar' %% WCHAR - '|' - 'inout' - '}' - 'attribute' - '<' - 'octet' - '/' - 'TRUE' - '~' - '=' - '>' - 'switch' - 'unsigned' - 'typedef' - '>>' - 'const' - '' - '' - 'raises' - 'string' - 'wstring' - 'fixed' - 'default' - 'short' - '%' - '<<' - 'module' - 'exception' - 'boolean' - '' - '' - '' - '&' - '::' - 'Object' - . - - -Rootsymbol ''. - - -Expect 9. - - -%%------------------------------------------------------------ -%% Clauses -%% - -%% Handling of pragmas. -%% Pragma prefix, id and version are not standard. - -%% pragma prefix, or codeopt -OE_pragma -> '#' '' '' - '' '' '#' - : #pragma{type='$4', to=followed, apply='$5'} . - -%% pragma id -OE_pragma -> '#' '' '' - '' '' '' '#' - : #pragma{type='$4', to='$5', apply='$6'} . - -%% pragma version -OE_pragma -> '#' '' '' - '' '' '' '#' - : #pragma{type='$4', to='$5', apply=ic_options:float_to_version('$6')} . - - - - - - - -%% Ugly pragmas -Ugly_pragmas -> '$empty' : []. -Ugly_pragmas -> 'Ugly_pragmas' 'OE_pragma' : ['$2'|'$1']. - - - -%% (0) Handling of preprocessor stuff. - -OE_preproc -> '#' '#' . - -OE_preproc -> '#' '' '' - 'ZorM_' '#' - : case '$4' of - [] -> - case '$2' of - {_,_,"1"} -> - #preproc{cat=line_nr, id='$3', aux='$4'}; - _ -> - [] - end; - _ -> - #preproc{cat=line_nr, id='$3', aux='$4'} - end. - -%% (0b) Non-standard -'ZorM_' -> '$empty' : [] . -'ZorM_' -> '' 'ZorM_' - : ['$1' | '$2'] . - -%% (1) -'' -> 'OorM_' : reverse('$1') . - - -%% Added clause -'OorM_' -> '' : ['$1'] . -'OorM_' -> 'OorM_' '' -: ['$2' | '$1'] . - - -%% (2) -'' -> '' ';' : '$1' . -'' -> '' ';' : '$1' . -'' -> '' ';' : '$1' . -'' -> '' ';' : '$1' . -'' -> '' ';' : '$1' . -'' -> 'OE_preproc' : '$1' . -'' -> 'OE_pragma' : '$1' . - - -%% (3) -'' -> 'module' '' '{' 'OorM_' '}' -: #module{ id='$2', body=reverse('$4')}. - - -%% (4) -'' -> '' : '$1' . -'' -> '' : '$1' . - - -%% (5) -'' -> '' '{' '' '}' - : #interface{id=element(1, '$1'), inherit=element(2, '$1'), - body=lists:reverse('$3')} . - - -%% (6) -'' -> 'interface' '' -: #forward{id='$2'} . - - -%% (7) -'' -> 'interface' '' 'Opt_' -: {'$2', '$3'} . - - -%% (8) -'' -> 'ZorM_' : '$1' . - - -%% Added clause -'ZorM_' -> '$empty' : [] . -'ZorM_' -> 'ZorM_' '' - %% Complicated because might be a list (of type defs for instance) - : if is_list('$2') -> '$2' ++ '$1'; - true -> ['$2' | '$1'] - end . - - -%% (9) -'' -> '' ';' : '$1' . -'' -> '' ';' : '$1' . -'' -> '' ';' : '$1' . -'' -> '' ';' : '$1' . -'' -> '' ';' : '$1' . -'' -> 'OE_preproc' : '$1' . -'' -> 'OE_pragma' : '$1' . - -%% Added clause -'Opt_' -> '$empty' : []. -'Opt_' -> '' : '$1'. - -%% (10) -'' -> ':' '' 'ZorM_' - : ['$2' | reverse('$3')] . - - -%% Added clause -'ZorM_' -> '$empty' : [] . -'ZorM_' -> 'ZorM_' ',' '' - : ['$3' | '$1'] . - - -%% (11) -'' -> '' : ic_symtab:scoped_id_new('$1') . -'' -> '::' '' : ic_symtab:scoped_id_new_global('$2') . -'' -> '' '::' '' - : ic_symtab:scoped_id_add('$1', '$3') . - - -%% (12) -'' -> 'const' '' '' '=' '' - : #const{type='$2', id='$3', val='$5'} . - - -%% (13) -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . - - -%% (14) -'' -> '' : '$1' . - - -%% (15) -'' -> '' : '$1' . -'' -> '' '|' '' : {'or', '$1', '$3'} . - - -%% (16) -'' -> '' : '$1' . -'' -> '' '^' '' : {'xor', '$1', '$3'} . - - -%% (17) -'' -> '' : '$1' . -'' -> '' '&' '' : {'and', '$1', '$3'} . - - -%% (18) -'' -> '' : '$1' . -'' -> '' '>>' '' : {'rshift', '$1', '$3'} . -'' -> '' '<<' '' : {'lshift', '$1', '$3'} . - - -%% (19) -'' -> '' : '$1' . -'' -> '' '+' '' : {'+', '$1', '$3'} . -'' -> '' '-' '' : {'-', '$1', '$3'} . - - -%% (20) -'' -> '' : '$1' . -'' -> '' '*' '' : {'*', '$1', '$3'} . -'' -> '' '/' '' : {'/', '$1', '$3'} . -'' -> '' '%' '' : {'%', '$1', '$3'} . - - -%% (21) -'' -> '' '' : {'$1', '$2'} . -'' -> '' : '$1' . - - -%% (22) -'' -> '-' : '$1' . -'' -> '+' : '$1' . -'' -> '~' : '$1' . - - -%% (23) -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '(' '' ')' : '$2' . - - -%% (24) -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . - - -%% (25) -'' -> 'TRUE' : '$1' . -'' -> 'FALSE' : '$1' . - - -%% (26) -'' -> '' : '$1' . - - -%% (27) -'' -> 'typedef' '' : '$2' . -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . - -%% (28) NIY multiple declarators (FIXED) -'' -> '' '' - : #typedef{type='$1', id='$2'} . %%%ic:unfold(#typedef{type='$1', id='$2'}) . -%%'' -> '' '' -%% : #typedef{type='$1', id='$2'} . - -%% (29) -'' -> '' : '$1' . -'' -> '' : '$1' . - - -%% (30) -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . - - -%% (31) -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> 'Object' : '$1' . %% NON Standard, isn't a base type - - -%% (32) -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . - - -%% (33) -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . - - -%% (34) -'' -> '' 'ZorM_' -: ['$1' | reverse('$2')] . - -%% Added clause -'ZorM_' -> '$empty' : [] . -'ZorM_' -> 'ZorM_' ',' '' -: ['$3' | '$1'] . - - -%% (35) -'' -> '' : '$1' . -'' -> '' : '$1' . - - -%% (36) -'' -> '' : '$1' . - - -%% (37) -'' -> '' : '$1' . - - -%% (38) -'' -> 'float' : '$1' . -'' -> 'double' : '$1' . - - -%% (39) -'' -> '' : '$1' . -'' -> '' : {'unsigned', '$1'} . - - -%% (40) -'' -> '' : '$1' . -'' -> '' : '$1' . - - -%% (41) -'' -> 'long' : '$1' . -'' -> 'long' 'long': {'long long', element(2,'$2')} . - - -%% (42) -'' -> 'short' : '$1' . - - -%% (43) -'' -> '' : '$1' . -'' -> '' : '$1' . - - -%% (44) -'' -> 'unsigned' 'long' : '$2' . -'' -> 'unsigned' 'long' 'long' : {'long long', element(2,'$2')} . %% ULLONG - - -%% (45) -'' -> 'unsigned' 'short' : '$2' . - - -%% (46) -'' -> 'char' : '$1' . -'' -> 'wchar' : '$1' . %% WCHAR - - -%% (47) -'' -> 'boolean' : '$1' . - - -%% (48) -'' -> 'octet' : '$1' . - - -%% (49) -'' -> 'any' : '$1' . - -%% -'' -> 'fixed' : '$1'. - -%% (50) NIY: unfolding of struct decls (FIXED) -%%'' -> 'struct' '' '{' '' '}' -%% : #struct{id='$2', body=ic:unfold('$4')} . -'' -> 'struct' '' '{' '' '}' - : #struct{id='$2', body='$4'} . - - -%% (51) -'' -> 'OorM_' : reverse('$1') . - - -%% Added clause -%%'OorM_' -> '' : ['$1'] . -%%'OorM_' -> 'OorM_' '' -%% : ['$2' | '$1'] . - -'OorM_' -> '' : '$1' . -'OorM_' -> 'OorM_' '' - : '$2' ++ '$1' . - - - -%% (52) NIY: member multiple declarators (FIXED) -%%'' -> '' '' ';' -%% : #member{type='$1', id='$2'} . - -'' -> 'Ugly_pragmas' '' '' 'Ugly_pragmas' ';' 'Ugly_pragmas' - : '$1' ++ '$4' ++ '$6' ++ [#member{type='$2', id='$3'}] . - - -%% (53) NIY: unfolding of union cases (FIXED) -%%'' -> 'union' '' 'switch' -%% '(' '' ')' '{' '' '}' -%% : #union{id='$2', type='$5', body=ic:unfold('$8')} . -'' -> 'union' '' 'switch' - '(' '' ')' '{' '' '}' - : #union{id='$2', type='$5', body='$8'} . - - -%% (54) -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . - - -%% (55) -'' -> 'OorM_' : reverse(lists:flatten('$1')) . - -%%'' -> 'OorM_' : '$1' . - - -%% Added clause -'OorM_' -> '' : ['$1'] . -'OorM_' -> 'OorM_' '' : ['$2' | '$1'] . - - -%% (56) NIY thing: multiple case labels (FIXED) -%%'' -> 'OorM_' '' ';' -%% : '$2'#case_dcl{label=reverse('$1')} . - -'' -> - 'Ugly_pragmas' 'OorM_' - 'Ugly_pragmas' '' - 'Ugly_pragmas' ';' 'Ugly_pragmas' - : '$1' ++ '$3' ++ '$5' ++ '$7' ++ [ '$4'#case_dcl{label=reverse('$2')} ] . - - -%% Added clause -%%'OorM_' -> '' : ['$1'] . -%%'OorM_' -> 'OorM_' '' : ['$2' | '$1'] . - -'OorM_' -> 'Ugly_pragmas' '' 'Ugly_pragmas' - : '$1' ++ ['$2'] ++ '$3' . -'OorM_' -> 'OorM_' 'Ugly_pragmas' '' 'Ugly_pragmas' - : '$2' ++ ['$3'|'$1'] ++ '$4'. - - -%% (57) -'' -> 'case' '' ':' : '$2' . -'' -> 'default' ':' : '$1' . - - -%% (58) -'' -> '' '' -: #case_dcl{type='$1', id='$2'} . - - -%% (59) -%%'' -> 'enum' '' -%%'{' '' 'ZorM_' '}' -%%: #enum{id='$2', body=['$4' | reverse('$5')]} . - -'' -> 'enum' '' -'{' 'Ugly_pragmas' '' 'Ugly_pragmas' 'ZorM_' 'Ugly_pragmas' '}' -: #enum{id='$2', body='$4'++'$6'++'$8'++['$5' | reverse('$7')]} . - - - -%% Added clause -%%'ZorM_' -> '$empty' : [] . -%%'ZorM_' -> 'ZorM_' ',' '' : ['$3' | '$1'] . - -'ZorM_' -> '$empty' : [] . -'ZorM_' -> 'ZorM_' 'Ugly_pragmas' ',' 'Ugly_pragmas' '' - : '$2'++'$4'++['$5' | '$1'] . - -%% (60) -'' -> '' : #enumerator{id='$1'} . - - -%% (61) -'' -> 'sequence' '<' '' ',' - '' '>' - : #sequence{type='$3', length='$5'} . -'' -> 'sequence' '<' '' '>' - : #sequence{type='$3'} . - - -%% (62) -'' -> 'string' '<' '' '>' - : #string{length='$3'} . -'' -> 'string' : #string{} . - -'' -> 'wstring' '<' '' '>' %% WSTRING - : #wstring{length='$3'} . -'' -> 'wstring' : #wstring{} . %% WSTRING - - -%% (63) -'' -> '' 'OorM_' - : #array{id='$1', size=reverse('$2')} . - - -%% Added clause -'OorM_' -> '' : ['$1'] . -'OorM_' -> 'OorM_' '' - : ['$2' | '$1'] . - - -%% (64) -'' -> '[' '' ']' : '$2' . - - -%% (65) NIY: multiple attribute declarators (FIXED) -'' -> 'Opt_readonly' 'attribute' '' - '' 'ZorM_' - : #attr{readonly='$1', type='$3', id=['$4' | reverse('$5')]} . -%% : ic:unfold(#attr{readonly='$1', type='$3', id=['$4' | reverse('$5')]}) . -%%'' -> 'Opt_readonly' 'attribute' '' -%% '' - - -%% (66) NIY: unfolding of exception bodies (FIXED) -%%'' -> 'exception' '' '{' 'ZorM_' '}' -%% : #except{id='$2', body=ic:unfold('$4')} . -'' -> 'exception' '' '{' 'ZorM_' '}' - : #except{id='$2', body=reverse('$4')} . - -%% (67) -'' -> 'Opt_' '' '' '' 'Opt_' 'Opt_' - : #op{oneway='$1', type='$2', id='$3', params='$4', raises='$5', ctx='$6'} . - -%% Added clause -'Opt_' -> '$empty' : nil. -'Opt_' -> '' : '$1'. - -%% (68) -'' -> 'oneway' : '$1' . - - -%% (69) -'' -> '' : '$1' . -'' -> 'void' : '$1' . - - -%% (70) Rewritten -%'' -> '(' '' 'ZorM_' ')' -% : ['$2' | reverse('$3')] . -%'' -> '(' ')' : [] . - -'' -> '(' 'Ugly_pragmas' '' 'ZorM_' ')' - : '$2' ++ ['$3' | reverse('$4')] . -'' -> '(' 'Ugly_pragmas' ')' : '$2' . - - -%% Added clause -%'ZorM_' -> '$empty' : [] . -%'ZorM_' -> 'ZorM_' ',' '' : ['$3' | '$1'] . - - -'ZorM_' -> 'Ugly_pragmas' : '$1' . -'ZorM_' -> 'ZorM_' 'Ugly_pragmas' ',' 'Ugly_pragmas' '' 'Ugly_pragmas' - : '$2' ++ '$4' ++ '$6' ++ ['$5' | '$1'] . - - - - -%% (71) -'' -> '' '' '' - : #param{inout='$1', type='$2', id='$3'} . - - -%% (72) -'' -> 'in' : '$1' . -'' -> 'out' : '$1' . -'' -> 'inout' : '$1' . - - -%% Added clause -'Opt_' -> '$empty' : [] . -'Opt_' -> '' : '$1' . - -%% (73) -'' -> 'raises' '(' '' 'ZorM_' ')' - : ['$3'| reverse('$4')] . - - -%% Added clause -'Opt_' -> '$empty' : [] . -'Opt_' -> '' : '$1'. - -%% (74) -'' -> 'context' '(' '' 'ZorM_'')' - : ['$3' | reverse('$4')] . - - - -%% (75) -'' -> '' : '$1' . -'' -> '' : '$1' . -'' -> '' : '$1' . - - -%% (96) -'' -> 'fixed' '<' '' ',' '' '>' - : #fixed{digits='$3',scale='$5'} . - -%% (99) -'' -> 'struct' '' : #constr_forward{id='$2', tk=tk_struct} . -'' -> 'union' '' : #constr_forward{id='$2', tk=tk_union} . - -%% Added clause -'ZorM_' -> '$empty' : [] . -'ZorM_' -> 'ZorM_' ',' '' - : ['$3' | '$1'] . - -%% Added clause -'ZorM_' -> '$empty' : [] . -'ZorM_' -> 'ZorM_' ',' -'' : ['$3' | '$1'] . - -%% Added clause -%%'ZorM_' -> '$empty' : [] . -%%'ZorM_' -> 'ZorM_' '' : ['$2' | '$1'] . - -'ZorM_' -> 'Ugly_pragmas' : '$1' . -'ZorM_' -> 'ZorM_' '' : '$2' ++ '$1' . - - -%% Added clause -'Opt_readonly' -> '$empty' : nil. -'Opt_readonly' -> 'readonly' : '$1'. - - - -Erlang code. -%%----------------------------------------------------------- - - - diff --git a/lib/ic/src/icpreproc.erl b/lib/ic/src/icpreproc.erl deleted file mode 100644 index fc936c4bf3..0000000000 --- a/lib/ic/src/icpreproc.erl +++ /dev/null @@ -1,112 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(icpreproc). - - - --export([preproc/2]). - - --import(lists, [filter/2]). - - -%%---------------------------------------------------------------------- -%%---------------------------------------------------------------------- - - -preproc(G, File) -> - Cmd = ic_options:get_opt(G, preproc_cmd), - Flags = ic_options:get_opt(G, preproc_flags), - - - case Cmd of - "erl" -> - case ic_pp:run(File,Flags) of - {ok, [$#, $ , $1 | Rest], []} -> - [$#, $ , $1 | Rest]; - {ok, [$#, $ , $1 | Rest], Warning} -> - print_warning(G,Warning), - [$#, $ , $1 | Rest]; - {error,Error} -> - print_error(G,Error) - end; - - _ -> - Line = Cmd++" "++Flags++" "++File, - % FIXME: Check status code of command instead of this test - case os:cmd(Line) of - [$#, $ , C | Rest] when is_integer(C), C > $0, C =< $9 -> - [$#, $ , C | Rest]; - X -> - ic_error:fatal_error(G, {preproc, filter(X)}) - end - end. - - -filter(X) -> - X2 = divide_nl(X, []), - filter_x_switch(X2). - - -divide_nl([10 | Xs], Out) -> - [lists:reverse(Out) | divide_nl(Xs, [])]; -divide_nl([X | Xs], Out) -> divide_nl(Xs, [X|Out]); -divide_nl([], Out) -> lists:reverse(Out). - - -filter_x_switch(L) -> - filter(fun([$g,$c,$c,$:,$ ,$W,$a,$r,$n,$i,$n,$g,$:,$ ,$`,$-,$x,$ | _]) -> - false; - (_) -> true end, L). - - -print_error(_G,[]) -> - ok; -print_error(G,[{File,Line,Text}]) -> - ErrorText = File++":"++integer_to_list(Line)++": "++Text, - ic_error:fatal_error(G, {ic_pp_error, ErrorText}), - ok; -print_error(G,[{File,Line,Text}|T]) -> - ErrorText = File++":"++integer_to_list(Line)++": "++Text, - ic_error:error(G, {ic_pp_error, ErrorText}), - print_error(G,T); -print_error(G,[H]) -> - ErrorText = H++"\n", - ic_error:fatal_error(G, {ic_pp_error, ErrorText}), - ok; -print_error(G,[H|T]) -> - ErrorText = H++"\n", - ic_error:error(G, {ic_pp_error, ErrorText}), - print_error(G,T). - - -print_warning(_G,[]) -> - ok; -print_warning(G,[{File,Line,Text}|T]) -> - WarText = File++":"++integer_to_list(Line)++": "++Text, - ic_error:warn(G, {ic_pp_warning, WarText}), - print_warning(G,T); -print_warning(G,[H|T]) -> - WarText = H++"\n", - ic_error:warn(G, {ic_pp_warning, WarText}), - print_warning(G,T). - - diff --git a/lib/ic/src/icscan.erl b/lib/ic/src/icscan.erl deleted file mode 100644 index 123041495e..0000000000 --- a/lib/ic/src/icscan.erl +++ /dev/null @@ -1,453 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(icscan). - - --export([scan/2]). - --include("ic.hrl"). - - -%%---------------------------------------------------------------------- -%%---------------------------------------------------------------------- - --import(lists, [reverse/1]). - - -scan(G, File) -> - PL = call_preproc(G, File), - call_scan(G, PL). - -call_preproc(G, File) -> - case ic_options:get_opt(G, use_preproc) of - true -> - icpreproc:preproc(G, File); - false -> - case catch file:read_file(File) of - {ok, Bin} -> - binary_to_list(Bin); - Other -> - exit(Other) - end - end. - -call_scan(G, PL) -> - BE = ic_options:get_opt(G, be), - RSL = scan(G, BE, PL, 1, []), - lists:reverse(RSL). - - -%% Guard macros used at top scan functions only --define(is_number(X), X >= $0 , X =< $9). --define(is_upper(X), X >= $A , X =< $Z). --define(is_lower(X), X >= $a, X =< $z). --define(is_hex_uc(X), X >= $A , X =< $F). --define(is_hex_lc(X), X >= $a , X =< $f). --define(is_octal(X), X >=$0, X =< $7). - -%% Handle: -%% const wchar aWChar = L'X'; -scan(G, BE, [$L, $'|Str], Line, Out) -> - scan_const(G, BE, wchar, Str, [], Line, Out); -scan(G, BE, [$L, $"|Str], Line, Out) -> - scan_const(G, BE, wstring, Str, [], Line, Out); -scan(G, BE, [$_, X|Str], Line, Out) when ?is_upper(X) -> - scan_name(G, BE, Str, [X], false, Line, Out); -scan(G, BE, [$_, X|Str], Line, Out) when ?is_lower(X) -> - scan_name(G, BE, Str, [X], false, Line, Out); -scan(G, BE, [X|Str], Line, Out) when ?is_upper(X) -> - scan_name(G, BE, Str, [X], true, Line, Out); -scan(G, BE, [X|Str], Line, Out) when ?is_lower(X) -> - scan_name(G, BE, Str, [X], true, Line, Out); -scan(G, BE, [X|Str], Line, Out) when ?is_number(X) -> - scan_number(G, BE, Str, [X], Line, Out); -scan(G, BE, [9| T], Line, Out) -> scan(G, BE, T, Line, Out); -scan(G, BE, [32| T], Line, Out) -> scan(G, BE, T, Line, Out); -scan(G, BE, [$\r|Str], Line, Out) -> - scan(G, BE, Str, Line, Out); -scan(G, BE, [$\n|Str], Line, Out) -> - scan(G, BE, Str, Line+1, Out); -scan(G, BE, [$:, $: | Str], Line, Out) -> - scan(G, BE, Str, Line, [{'::', Line} | Out]); -scan(G, BE, [$/, $/ | Str], Line, Out) -> - Rest = skip_to_nl(Str), - scan(G, BE, Rest, Line, Out); -scan(G, BE, [$/, $* | Str], Line, Out) -> - Rest = skip_comment(Str), - scan(G, BE, Rest, Line, Out); -scan(G, BE, [$", $\\|Str], Line, Out) -> - scan_const(G, BE, string, [$\\|Str], [], Line, Out); -scan(G, BE, [$"|Str], Line, Out) -> - scan_const(G, BE, string, Str, [], Line, Out); -scan(G, BE, [$', $\\|Str], Line, Out) -> - scan_const(G, BE, char, [$\\|Str], [], Line, Out); -scan(G, BE, [$'|Str], Line, Out) -> - scan_const(G, BE, char, Str, [], Line, Out); -scan(G, BE, [$\\|Str], Line, Out) -> - scan_const(G, BE, escaped, [$\\|Str], [], Line, Out); -scan(G, BE, [$. | Str], Line, Out) -> - scan_frac(G, BE, Str, [$.], Line, Out); -scan(G, BE, [$# | Str], Line, Out) -> - scan_preproc(G, BE, Str, Line, Out); -scan(G, BE, [$<, $< | Str], Line, Out) -> - scan(G, BE, Str, Line, [{'<<', Line} | Out]); -scan(G, BE, [$>, $> | Str], Line, Out) -> - scan(G, BE, Str, Line, [{'>>', Line} | Out]); -scan(G, BE, [C|Str], Line, Out) -> - scan(G, BE, Str, Line, [{list_to_atom([C]), Line} | Out]); - -scan(_G, _BE, [], _Line, Out) -> - Out. - - -scan_number(G, BE, [X|Str], [$0], Line, Out) when X == $X ; X ==$x -> - case Str of - [D|_TmpStr] when ?is_number(D); ?is_hex_uc(D); ?is_hex_lc(D) -> - {Num,Rest} = scan_hex_number(Str,0), - scan(G, BE, Rest, Line, [{'', Line, - integer_to_list(Num)} | Out]); - [D|TmpStr] -> - scan(G, BE, TmpStr, Line, [{list_to_atom([D]), Line} | Out]) - end; -scan_number(G, BE, Str, [$0], Line, Out) -> - %% If an integer literal starts with a 0 it may indicate that - %% it is represented as an octal number. But, it can also be a fixed - %% type which must use padding to match a fixed typedef. For example: - %% typedef fixed<5,2> fixed52; - %% 123.45d, 123.00d and 023.00d is all valid fixed values. - %% Naturally, a float can be defined as 0.14 or 00.14. - case pre_scan_number(Str, [], octal) of - octal -> - {Num, Rest} = scan_octal_number(Str,0), - scan(G, BE, Rest, Line, [{'', Line, - integer_to_list(Num)} | Out]); - {fixed, Fixed, Rest} -> - scan(G, BE, Rest, Line, [{'', Line, Fixed} | Out]); - float -> - %% Not very likely that someone defines a constant as 00.14 but ... - NewStr = remove_leading_zeroes(Str), - scan(G, BE, NewStr, Line, Out) - end; -scan_number(G, BE, [X|Str], Accum, Line, Out) when ?is_number(X) -> - scan_number(G, BE, Str, [X|Accum], Line, Out); -scan_number(G, BE, [X|Str], Accum, Line, Out) when X==$. -> - scan_frac(G, BE, Str, [X|Accum], Line, Out); -scan_number(G, BE, [X|Str], Accum, Line, Out) when X==$e ; X==$e -> - scan_exp(G, BE, Str, [X|Accum], Line, Out); -scan_number(G, BE, [X|Str], Accum, Line, Out) when X==$D ; X==$d -> - scan(G, BE, Str, Line, [{'', Line, - (lists:reverse(Accum))} | Out]); -scan_number(G, BE, Str, Accum, Line, Out) -> - scan(G, BE, Str, Line, [{'', Line, - (lists:reverse(Accum))} | Out]). - - -remove_leading_zeroes([$0|Rest]) -> - remove_leading_zeroes(Rest); -remove_leading_zeroes(L) -> - L. - -scan_hex_number([X|Rest],Acc) when X >=$a, X =< $f -> - scan_hex_number(Rest,(Acc bsl 4) + (X - $a + 10)); -scan_hex_number([X|Rest],Acc) when X >=$A, X =< $F -> - scan_hex_number(Rest,(Acc bsl 4) + (X - $A + 10)); -scan_hex_number([X|Rest],Acc) when X >=$0, X =< $9 -> - scan_hex_number(Rest,(Acc bsl 4) + (X-$0)); -scan_hex_number(Rest,Acc) -> - {Acc,Rest}. - -pre_scan_number([$d|Rest], Acc, _) -> - {fixed, [$0|lists:reverse(Acc)], Rest}; -pre_scan_number([$D|Rest], Acc, _) -> - {fixed, [$0|lists:reverse(Acc)], Rest}; -pre_scan_number([$.|Rest], Acc, _) -> - %% Actually, we don't know if it's a float since it can be a fixed. - pre_scan_number(Rest, [$.|Acc], float); -pre_scan_number([X|_], _Acc, _) when X == $E ; X ==$e -> - %% Now we now it's a float. - float; -pre_scan_number([X|Rest], Acc, Type) when ?is_number(X) -> - pre_scan_number(Rest, [X|Acc], Type); -pre_scan_number(_Rest, _Acc, Type) -> - %% At this point we know it's a octal or float. - Type. - -scan_octal_number([X|Rest],Acc) when ?is_octal(X) -> - scan_octal_number(Rest,(Acc bsl 3) + (X-$0)); -scan_octal_number(Rest,Acc) -> - {Acc, Rest}. - -%% Floating point number scan. -%% -%% Non trivial scan. A float consists of an integral part, a -%% decimal point, a fraction part, an e or E and a signed integer -%% exponent. Either the integer part or the fraction part but not -%% both may be missing, and either the decimal point or the -%% exponent part but not both may be missing. The exponent part -%% must consist of an e or E and a possibly signed exponent. -%% -%% Analysis shows that "1." ".7" "1e2" ".5e-3" "1.7e2" "1.7e-2" -%% is allowed and "1" ".e9" is not. The sign is only allowed just -%% after an e or E. The scanner reads a number as an integer -%% until it encounters a "." so the integer part only error case -%% will not be caught in the scanner (but rather in expression -%% evaluation) - -scan_frac(G, _BE, [$e | _Str], [$.], Line, _Out) -> - ic_error:fatal_error(G, {illegal_float, Line}); -scan_frac(G, _BE, [$E | _Str], [$.], Line, _Out) -> - ic_error:fatal_error(G, {illegal_float, Line}); -scan_frac(G, BE, Str, Accum, Line, Out) -> - scan_frac2(G, BE, Str, Accum, Line, Out). - -scan_frac2(G, BE, [X|Str], Accum, Line, Out) when ?is_number(X) -> - scan_frac2(G, BE, Str, [X|Accum], Line, Out); -scan_frac2(G, BE, [X|Str], Accum, Line, Out) when X==$e ; X==$E -> - scan_exp(G, BE, Str, [X|Accum], Line, Out); -%% The following case is for fixed (e.g. 123.45d). -scan_frac2(G, BE, [X|Str], Accum, Line, Out) when X==$d ; X==$D -> - scan(G, BE, Str, Line, [{'', Line, - (lists:reverse(Accum))} | Out]); -scan_frac2(G, BE, Str, Accum, Line, Out) -> - scan(G, BE, Str, Line, [{'', Line, - (lists:reverse(Accum))} | Out]). - -scan_exp(G, BE, [X|Str], Accum, Line, Out) when X==$- -> - scan_exp2(G, BE, Str, [X|Accum], Line, Out); -scan_exp(G, BE, Str, Accum, Line, Out) -> - scan_exp2(G, BE, Str, Accum, Line, Out). - -scan_exp2(G, BE, [X|Str], Accum, Line, Out) when ?is_number(X) -> - scan_exp2(G, BE, Str, [X|Accum], Line, Out); -scan_exp2(G, BE, Str, Accum, Line, Out) -> - scan(G, BE, Str, Line, [{'', Line, - (lists:reverse(Accum))} | Out]). - - -scan_name(G, BE, [X|Str], Accum, TypeCheck, Line, Out) when ?is_upper(X) -> - scan_name(G, BE, Str, [X|Accum], TypeCheck, Line, Out); -scan_name(G, BE, [X|Str], Accum, TypeCheck, Line, Out) when ?is_lower(X) -> - scan_name(G, BE, Str, [X|Accum], TypeCheck, Line, Out); -scan_name(G, BE, [X|Str], Accum, TypeCheck, Line, Out) when ?is_number(X) -> - scan_name(G, BE, Str, [X|Accum], TypeCheck, Line, Out); -scan_name(G, BE, [$_|Str], Accum, TypeCheck, Line, Out) -> - scan_name(G, BE, Str, [$_|Accum], TypeCheck, Line, Out); -scan_name(G, BE, S, Accum, false, Line, Out) -> - %% The CORBA 2.3 specification allows the user to override typechecking: - %% typedef string _native; - %% interface i { - %% void foo(in _native VT); - %% }; - %% BUT, the IFR-id remains the same ("IDL:native:1.0") etc. The reason for - %% this is that one don't have to re-write a large chunk of IDL- and - %% application-code. - scan(G, BE, S, Line, [{'', Line, lists:reverse(Accum)} | Out]); -scan_name(G, BE, S, Accum, _, Line, Out) -> - L = lists:reverse(Accum), - X = case is_reserved(L, BE) of - undefined -> - {'', Line, L}; - Yes -> - {Yes, Line} - end, - scan(G, BE, S, Line, [X | Out]). - -%% Shall scan a constant -scan_const(G, BE, string, [$" | Rest], Accum, Line, [{'', _, Str}|Out]) -> - scan(G, BE, Rest, Line, - [{'', Line, Str ++ lists:reverse(Accum)} | Out]); -scan_const(G, BE, string, [$" | Rest], Accum, Line, Out) -> - scan(G, BE, Rest, Line, - [{'', Line, lists:reverse(Accum)} | Out]); -scan_const(G, BE, wstring, [$" | Rest], Accum, Line, [{'', _,Wstr}|Out]) -> %% WSTRING - scan(G, BE, Rest, Line, - [{'', Line, Wstr ++ lists:reverse(Accum)} | Out]); -scan_const(G, BE, wstring, [$" | Rest], Accum, Line, Out) -> %% WSTRING - scan(G, BE, Rest, Line, - [{'', Line, lists:reverse(Accum)} | Out]); -scan_const(G, _BE, string, [], _Accum, Line, Out) -> %% Bad string - ic_error:error(G, {bad_string, Line}), - Out; -scan_const(G, _BE, wstring, [], _Accum, Line, Out) -> %% Bad WSTRING - ic_error:error(G, {bad_string, Line}), - Out; -scan_const(G, BE, char, [$' | Rest], Accum, Line, Out) -> - scan(G, BE, Rest, Line, - [{'', Line, lists:reverse(Accum)} | Out]); -scan_const(G, BE, wchar, [$' | Rest], Accum, Line, Out) -> %% WCHAR - scan(G, BE, Rest, Line, - [{'', Line, lists:reverse(Accum)} | Out]); -scan_const(G, BE, Mode, [$\\, C | Rest], Accum, Line, Out) -> - case escaped_char(C) of - error -> - ic_error:error(G, {bad_escape_character, Line, C}), %% Bad escape character - scan_const(G, BE, Mode, Rest, [C | Accum], Line, Out); - octal -> - {Num,Rest2} = scan_octal_number([C|Rest], 0), - scan_const(G, BE, Mode, Rest2, [Num|Accum], Line, Out); - hexadecimal -> - {Num,Rest2} = scan_hex_number(Rest, 0), - if - Num > 255 -> %% 16#FF - ic_error:error(G, {bad_escape_character, Line, C}), - scan_const(G, BE, Mode, Rest, [C | Accum], Line, Out); - true -> - scan_const(G, BE, Mode, Rest2, [Num|Accum], Line, Out) - end; - unicode -> - {Num,Rest2} = scan_hex_number(Rest, 0), - if - Num > 65535 -> %% 16#FFFF - ic_error:error(G, {bad_escape_character, Line, C}), - scan_const(G, BE, Mode, Rest, [C | Accum], Line, Out); - true -> - scan_const(G, BE, Mode, Rest2, [Num|Accum], Line, Out) - end; - EC -> - scan_const(G, BE, Mode, Rest, [EC | Accum], Line, Out) - end; -scan_const(G, BE, Mode, [C | Rest], Accum, Line, Out) -> - scan_const(G, BE, Mode, Rest, [C | Accum], Line, Out). - - -%% -%% Preprocessor output handling -%% -%% gcc outputs a line with line number, file name (within \") and -%% one or more integer flags. The scanner scans the line number, -%% the id and all integers up to nl. -%% -%% NOTE: This will have to be enhanced in order to eat #pragma -%% -scan_preproc(G, BE, Str, Line, Out) -> - {List, Rest} = scan_to_nl(strip(Str), []), - NewLine = get_new_line_nr(strip(List), Line+1, []), - case scan_number(G, BE, List, [], Line, [{'#', Line} | Out]) of - L when is_list(L) -> - scan(G, BE, Rest, NewLine, [{'#', Line} | L]) - end. - -get_new_line_nr([C|R], Line, Acc) when C>=$0, C=<$9 -> - get_new_line_nr(R, Line, [C|Acc]); -get_new_line_nr(_, Line, []) -> Line; % No line nr found -get_new_line_nr(_, _, Acc) -> list_to_integer(reverse(Acc)). - -scan_to_nl([], Acc) -> {reverse(Acc), []}; -scan_to_nl([$\n|Str], Acc) -> {reverse(Acc), Str}; -scan_to_nl([$\r|R], Acc) -> scan_to_nl(R, Acc); -scan_to_nl([C|R], Acc) -> scan_to_nl(R, [C|Acc]). - -strip([$ |R]) -> strip(R); -strip(L) -> L. - -%% Escaped character. Escaped chars are repr as two characters in the -%% input list of letters and this is translated into one char. -escaped_char($n) -> $\n; -escaped_char($t) -> $\t; -escaped_char($v) -> $\v; -escaped_char($b) -> $\b; -escaped_char($r) -> $ ; -escaped_char($f) -> $\f; -escaped_char($a) -> $\a; -escaped_char($\\) -> $\\; -escaped_char($?) -> $?; -escaped_char($') -> $'; -escaped_char($") -> $"; -escaped_char($x) -> hexadecimal; -escaped_char($u) -> unicode; -escaped_char(X) when ?is_octal(X) -> octal; -%% Error -escaped_char(_Other) -> error. - -skip_to_nl([]) -> []; -skip_to_nl([$\n | Str]) ->[$\n | Str]; -skip_to_nl([_|Str]) -> - skip_to_nl(Str). - -skip_comment([$\\, _ | Str]) -> - skip_comment(Str); -skip_comment([$*, $/ | Str]) -> Str; -skip_comment([_|Str]) -> - skip_comment(Str). - - -%%---------------------------------------------------------------------- -%% Shall separate keywords from identifiers and numbers - -%% Fill in the ets of reserved words -is_reserved("Object", _) -> 'Object'; -is_reserved("in", _) -> in; -is_reserved("interface", _) -> interface; -is_reserved("case", _) -> 'case'; -is_reserved("union", _) -> union; -is_reserved("struct", _) -> struct; -is_reserved("any", _) -> any; -is_reserved("long", _) -> long; -is_reserved("float", _) -> float; -is_reserved("out", _) -> out; -is_reserved("enum", _) -> enum; -is_reserved("double", _) -> double; -is_reserved("context", _) -> context; -is_reserved("oneway", _) -> oneway; -is_reserved("sequence", _) -> sequence; -is_reserved("FALSE", _) -> 'FALSE'; -is_reserved("readonly", _) -> readonly; -is_reserved("char", _) -> char; -is_reserved("wchar", _) -> wchar; -is_reserved("void", _) -> void; -is_reserved("inout", _) -> inout; -is_reserved("attribute", _) -> attribute; -is_reserved("octet", _) -> octet; -is_reserved("TRUE", _) -> 'TRUE'; -is_reserved("switch", _) -> switch; -is_reserved("unsigned", _) -> unsigned; -is_reserved("typedef", _) -> typedef; -is_reserved("const", _) -> const; -is_reserved("raises", _) -> raises; -is_reserved("string", _) -> string; -is_reserved("wstring", _) -> wstring; -is_reserved("default", _) -> default; -is_reserved("short", _) -> short; -is_reserved("module", _) -> module; -is_reserved("exception", _) -> exception; -is_reserved("boolean", _) -> boolean; -%% --- New keywords Introduced in CORBA-2.3.1 --- -%% For now we cannot add these for all backends right now since it would cause -%% some problems for at least one customer. -is_reserved("fixed", BE) -> check_be(BE, fixed); -%is_reserved("abstract", BE) -> check_be(BE, abstract); -%is_reserved("custom", BE) -> check_be(BE, custom); -%is_reserved("factory", BE) -> check_be(BE, factory); -%is_reserved("local", BE) -> check_be(BE, local); -%is_reserved("native", BE) -> check_be(BE, native); -%is_reserved("private", BE) -> check_be(BE, private); -%is_reserved("public", BE) -> check_be(BE, public); -%is_reserved("supports", BE) -> check_be(BE, supports); -%is_reserved("truncatable", BE) -> check_be(BE, truncatable); -%is_reserved("ValueBase", BE) -> check_be(BE, 'ValueBase'); -%is_reserved("valuetype", BE) -> check_be(BE, valuetype); -is_reserved(_, _) -> undefined. - -check_be(erl_corba, KeyWord) -> - KeyWord; -check_be(_, _) -> - undefined. - diff --git a/lib/ic/src/icstruct.erl b/lib/ic/src/icstruct.erl deleted file mode 100644 index 713ac87287..0000000000 --- a/lib/ic/src/icstruct.erl +++ /dev/null @@ -1,1917 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(icstruct). - - --export([struct_gen/4, except_gen/4, create_c_array_coding_file/5]). - -%%------------------------------------------------------------ -%% -%% Internal stuff -%% -%%------------------------------------------------------------ --import(ic_codegen, [emit/2, emit/3, emit/4, emit_c_enc_rpt/4, emit_c_dec_rpt/4]). - --include("icforms.hrl"). --include("ic.hrl"). - - - -%%------------------------------------------------------------ - -%%------------------------------------------------------------ -%% -%% File handling stuff -%% -%%------------------------------------------------------------ - - - -%%------------------------------------------------------------ -%% -%% Generation loop -%% -%% The idea is to traverse everything and find every struct that -%% may be hiding down in nested types. All structs that are found -%% are generated to a hrl file. -%% -%% struct_gen is entry point for structs and types, except_gen is -%% for exceptions -%% -%%------------------------------------------------------------ - - -except_gen(G, N, X, L) when is_record(X, except) -> - N2 = [ic_forms:get_id2(X) | N], - if - L == c -> - io:format("Warning : Exception not defined for c mapping\n", []); - true -> - emit_struct(G, N, X, L) - end, - struct_gen_list(G, N2, ic_forms:get_body(X), L). - -struct_gen(G, N, X, L) when is_record(X, struct) -> - N2 = [ic_forms:get_id2(X) | N], - struct_gen_list(G, N2, ic_forms:get_body(X), L), - emit_struct(G, N, X, L); -struct_gen(G, N, X, L) when is_record(X, union) -> - N2 = [ic_forms:get_id2(X) | N], - if - L == c -> - %% Produce the "body" first - struct_gen_list(G, N2, ic_forms:get_body(X), L), - icunion:union_gen(G, N, X, c); - true -> - struct_gen(G, N, ic_forms:get_type(X), L), - struct_gen_list(G, N2, ic_forms:get_body(X), L) - end, - emit_union(G, N, X, L); -struct_gen(G, N, X, L) when is_record(X, member) -> - struct_gen(G, N, ic_forms:get_type(X), L); -struct_gen(G, N, X, L) when is_record(X, typedef) -> - struct_gen(G, N, ic_forms:get_body(X), L), - emit_typedef(G, N, X, L); -struct_gen(G, N, X, L) when is_record(X, type_dcl) -> - struct_gen_list(G, N, ic_forms:get_type(X), L); -struct_gen(G, N, X, L) when is_record(X, case_dcl) -> - struct_gen(G, N, ic_forms:get_type(X), L); -struct_gen(G, N, X, L) when is_record(X, sequence) -> - struct_gen(G, N, ic_forms:get_type(X), L), - X; -struct_gen(G, N, X, L) when is_record(X, enum) -> - icenum:enum_gen(G, N, X, L); -struct_gen(_G, _N, _X, _L) -> - ok. - -%% List clause for struct_gen -struct_gen_list(G, N, Xs, L) -> - lists:foreach( - fun(X) -> - R = struct_gen(G, N, X, L), - if - L == c -> - if - is_record(R,sequence) -> - emit_sequence_head_def(G,N,X,R,L); - true -> - ok - end; - true -> - ok - end - end, Xs). - - -%% emit primitive for structs. -emit_struct(G, N, X, erlang) -> - case ic_genobj:is_hrlfile_open(G) of - true -> - %% Make a straight list of all member ids (this is a - %% variant of flatten) - EList = lists:map( - fun(XX) -> - lists:map( - fun(XXX) -> - ic_util:to_atom(ic_forms:get_id2(XXX)) - end, - ic_forms:get_idlist(XX)) - end, - ic_forms:get_body(X)), - ic_codegen:record(G, X, - ic_util:to_undersc([ic_forms:get_id2(X) | N]), - ictk:get_IR_ID(G, N, X), lists:flatten(EList)), - mkFileRecObj(G,N,X,erlang); - false -> - ok - end; -emit_struct(G, N, X, c) -> - - N1 = [ic_forms:get_id2(X) | N], - case ic_pragma:is_local(G,N1) of - true -> - emit_c_struct(G, N, X,local); - false -> - emit_c_struct(G, N, X,included) - end. - - -emit_c_struct(_G, _N, _X, included) -> - %% Do not generate included types att all. - ok; -emit_c_struct(G, N, X, local) -> - case ic_genobj:is_hrlfile_open(G) of - true -> - Fd = ic_genobj:hrlfiled(G), - - N1 = [ic_forms:get_id2(X) | N], - StructName = ic_util:to_undersc(N1), - - %% Make a straight list of all member ids (this is a - %% variant of flatten) - M = lists:map( - fun(XX) -> - lists:map( - fun(XXX) -> - if - is_record(XXX, array) -> - Type = ic_forms:get_type(XX), - Name = element(3,element(2,XXX)), - {_, _, StructTK, _} = - ic_symtab:get_full_scoped_name( - G, - N, - ic_symtab:scoped_id_new( - ic_forms:get_id2(X))), - ArrayTK = - get_structelement_tk(StructTK, - Name), - Dim = extract_dim(ArrayTK), - %% emit array file - emit(Fd, "\n#ifndef __~s__\n", - [ic_util:to_uppercase( - StructName ++ "_" - ++ Name)]), - emit(Fd, "#define __~s__\n\n", - [ic_util:to_uppercase( - StructName ++ "_" - ++ Name)]), - create_c_array_coding_file( - G, - N, - {StructName ++ "_" ++ Name, Dim}, - Type, - no_typedef), - emit(Fd, "\n#endif\n\n"), - {{Type, XXX}, - ic_forms:get_id2(XXX)}; - true -> - %% Ugly work around to fix the ETO - %% return patch problem - Name = - case ic_forms:get_id2(XXX) of - "return" -> - "return1"; - Other -> - Other - end, - {ic_forms:get_type(XX), Name} - end - end, - ic_forms:get_idlist(XX)) - end, - ic_forms:get_body(X)), - EList = lists:flatten(M), - %%io:format("Elist = ~p~n",[EList]), - - emit(Fd, "\n#ifndef __~s__\n",[ic_util:to_uppercase(StructName)]), - emit(Fd, "#define __~s__\n",[ic_util:to_uppercase(StructName)]), - ic_codegen:mcomment_light(Fd, - [io_lib:format("Struct definition: ~s", - [StructName])], - c), - emit(Fd, "typedef struct {\n"), - lists:foreach( - fun({Type, Name}) -> - emit_struct_member(Fd, G, N1, X, Name, Type) - end, - EList), - emit(Fd, "} ~s;\n\n", [StructName]), - create_c_struct_coding_file(G, N, X, nil, StructName, - EList, struct), - emit(Fd, "\n#endif\n\n"); - false -> - ok - end. - -%% Extracts array dimention(s) - -get_structelement_tk({tk_struct, _, _, EList}, EN) -> - {value, {EN, ArrayTK}} = lists:keysearch(EN, 1, EList), - ArrayTK. - -extract_dim({tk_array, {tk_array, T, D1}, D}) -> - [integer_to_list(D) | extract_dim({tk_array, T, D1})]; -extract_dim({tk_array, _, D}) -> - [integer_to_list(D)]. - -%% Makes the array name -mk_array_name(Name,Dim) -> - Name ++ mk_array_name(Dim). - -mk_array_name([]) -> - ""; -mk_array_name([Dim|Dims]) -> - "[" ++ Dim ++ "]" ++ mk_array_name(Dims). - - -emit_struct_member(Fd, G, N, X, Name,{Type,Array}) when is_record(Array, array)-> - {_, _, StructTK, _} = - ic_symtab:get_full_scoped_name( - G, - N, - ic_symtab:scoped_id_new(ic_forms:get_id2(X))), - ArrayTK = get_structelement_tk(StructTK, Name), - Dim = extract_dim(ArrayTK), - emit(Fd, " ~s ~s;\n", - [ic_cbe:mk_c_type(G, N, Type),mk_array_name(Name,Dim)]); -emit_struct_member(Fd, _G, N, _X, Name, Union) when is_record(Union, union)-> - emit(Fd, " ~s ~s;\n", - [ic_util:to_undersc([ic_forms:get_id2(Union) | N]),Name]); -emit_struct_member(Fd, _G, _N, _X, Name, {string, _}) -> - emit(Fd, " CORBA_char *~s;\n", - [Name]); -emit_struct_member(Fd, _G, N, _X, Name, {sequence, _Type, _Length}) -> - %% Sequence used as struct - emit(Fd, " ~s ~s;\n", - [ic_util:to_undersc([Name | N]), Name]); -emit_struct_member(Fd, G, N, X, Name, Type) - when element(1, Type) == scoped_id -> - CType = ic_cbe:mk_c_type(G, N, Type, evaluate_not), - emit_struct_member(Fd, G, N, X, Name, CType); -emit_struct_member(Fd, G, N, _X, Name, {enum, Type}) -> - emit(Fd, " ~s ~s;\n", - [ic_cbe:mk_c_type(G, N, Type), - Name]); -emit_struct_member(Fd, _G, _N, _X, Name, "ETERM*") -> - emit(Fd, " ETERM* ~s;\n", - [Name]); -emit_struct_member(Fd, _G, _N, _X, Name, Type) when is_list(Type) -> - emit(Fd, " ~s ~s;\n", - [Type, Name]); -emit_struct_member(Fd, G, N, _X, Name, Type) -> - emit(Fd, " ~s ~s;\n", - [ic_cbe:mk_c_type(G, N, Type), - Name]). - - -emit_typedef(G, N, X, erlang) -> - case X of - {typedef,_,[{array,_,_}],_} -> %% Array but not a typedef of - %% an array definition - case ic_options:get_opt(G, be) of - noc -> - mkFileArrObj(G,N,X,erlang); - _ -> - %% Search the table to see if the type is local or - %% inherited. - PTab = ic_genobj:pragmatab(G), - Id = ic_forms:get_id2(X), - case ets:match(PTab,{file_data_local,'_','_', - typedef,N,Id, - ic_util:to_undersc([Id | N]), - '_','_'}) of - [[]] -> - %% Local, create erlang file for the array - mkFileArrObj(G,N,X,erlang); - _ -> - %% Inherited, do nothing - ok - end - end; - - {typedef,{sequence,_,_},_,{tk_sequence,_,_}} -> - %% Sequence but not a typedef of - %% a typedef of a sequence definition - case ic_options:get_opt(G, be) of - noc -> - mkFileRecObj(G,N,X,erlang); - _ -> - %% Search the table to see if the type is local or - %% inherited. - PTab = ic_genobj:pragmatab(G), - Id = ic_forms:get_id2(X), - case ets:match(PTab,{file_data_local,'_','_',typedef, - N,Id, - ic_util:to_undersc([Id | N]), - '_','_'}) of - [[]] -> - %% Local, create erlang file for the sequence - mkFileRecObj(G,N,X,erlang); - _ -> - %% Inherited, do nothing - ok - end - end; - _ -> - ok - end; -emit_typedef(G, N, X, c) -> - B = ic_forms:get_body(X), - if - is_record(B, sequence) -> - emit_sequence_head_def(G, N, X, B, c); - true -> - lists:foreach(fun(D) -> - emit_typedef(G, N, D, B, c) - end, - ic_forms:get_idlist(X)) - end. - -emit_typedef(G, N, D, Type, c) when is_record(D, array) -> - emit_array(G, N, D, Type); -emit_typedef(G, N, D, Type, c) -> - Name = ic_util:to_undersc([ic_forms:get_id2(D) | N]), - CType = ic_cbe:mk_c_type(G, N, Type), - TDType = mk_base_type(G, N, Type), - ic_code:insert_typedef(G, Name, TDType), - case ic_genobj:is_hrlfile_open(G) of - true -> - Fd = ic_genobj:hrlfiled(G), - emit(Fd, "\n#ifndef __~s__\n",[ic_util:to_uppercase(Name)]), - emit(Fd, "#define __~s__\n",[ic_util:to_uppercase(Name)]), - ic_codegen:mcomment_light(Fd, - [io_lib:format("Type definition ~s " - "for type ~s", - [Name, CType])], - c), - emit(Fd, "typedef ~s ~s;\n", - [CType, Name]), - emit(Fd, "\n#endif\n\n"), - ic_codegen:nl(Fd); - false -> - ok - end. - - -mk_base_type(G, N, S) when element(1, S) == scoped_id -> - {FullScopedName, _T, _TK, _} = ic_symtab:get_full_scoped_name(G, N, S), - BT = ic_code:get_basetype(G, ic_util:to_undersc(FullScopedName)), - case BT of - "erlang_binary" -> - "erlang_binary"; - "erlang_pid" -> - "erlang_pid"; - "erlang_port" -> - "erlang_port"; - "erlang_ref" -> - "erlang_ref"; - "erlang_term" -> - "ETERM*"; - Type -> - Type - end; -mk_base_type(_G, _N, S) -> - S. - -emit_array(G, N, D, Type) -> - case ic_genobj:is_hrlfile_open(G) of - true -> - Fd = ic_genobj:hrlfiled(G), - Name = ic_util:to_undersc([ic_forms:get_id2(D) | N]), - {_, _, ArrayTK, _} = - ic_symtab:get_full_scoped_name(G, N, - ic_symtab:scoped_id_new( - ic_forms:get_id(D))), - Dim = extract_dim(ArrayTK), - CType = ic_cbe:mk_c_type(G, N, Type), - emit(Fd, "\n#ifndef __~s__\n",[ic_util:to_uppercase(Name)]), - emit(Fd, "#define __~s__\n",[ic_util:to_uppercase(Name)]), - ic_codegen:mcomment_light(Fd, - [io_lib:format("Array definition ~s " - "for type ~s", - [Name, CType])], - c), - emit(Fd, "typedef ~s ~s~s;\n", - [CType, Name, ic_cbe:mk_dim(Dim)]), - emit(Fd, "typedef ~s ~s_slice~s;\n", - [CType, Name, ic_cbe:mk_slice_dim(Dim)]), - ic_codegen:nl(Fd), - create_c_array_coding_file(G, N, {Name, Dim}, Type, typedef), - emit(Fd, "\n#endif\n\n"); - false -> - ok - end. - -open_c_coding_file(G, Name) -> - SName = string:concat(ic_util:mk_oe_name(G, "code_"), Name), - FName = - ic_file:join(ic_options:get_opt(G, stubdir),ic_file:add_dot_c(SName)), - case file:open(FName, [write]) of - {ok, Fd} -> - {Fd, SName}; - Other -> - exit(Other) - end. - - - -create_c_array_coding_file(G, N, {Name, Dim}, Type, TypeDefFlag) -> - - {Fd , SName} = open_c_coding_file(G, Name), - HFd = ic_genobj:hrlfiled(G), %% Write on stubfile header - HrlFName = filename:basename(ic_genobj:include_file(G)), - ic_codegen:emit_stub_head(G, Fd, SName, c), - emit(Fd, "#include \"~s\"\n\n",[HrlFName]), - - %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - %% Fd = ic_genobj:stubfiled(G), %% Write on stubfile - %% HFd = ic_genobj:hrlfiled(G), %% Write on stubfile header - %% HrlFName = filename:basename(ic_genobj:include_file(G)), - %% emit(Fd, "#include \"~s\"\n\n",[HrlFName]), - %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - put(op_variable_count, 0), - put(tmp_declarations, []), - - emit(HFd, "int ~s~s(CORBA_Environment *oe_env, int*, int*);\n", - [ic_util:mk_oe_name(G, "sizecalc_"), Name]), - - emit(Fd, "int ~s~s(CORBA_Environment *oe_env, int* oe_size_count_index, " - "int* oe_size) {\n", [ic_util:mk_oe_name(G, "sizecalc_"), Name]), - - emit(Fd, " int oe_malloc_size = 0;\n",[]), - emit(Fd, " int oe_error_code = 0;\n",[]), - emit(Fd, " int oe_type = 0;\n",[]), - emit(Fd, " int oe_array_size = 0;\n",[]), - - {ok, RamFd} = ram_file:open([], [binary, write]), - - emit_sizecount(array, G, N, nil, RamFd, {Name, Dim}, Type), - - ic_cbe:emit_tmp_variables(Fd), - ic_codegen:nl(Fd), - %% Move data from ram file to output file. - {ok, Data} = ram_file:get_file(RamFd), - emit(Fd, Data), - ram_file:close(RamFd), - - emit(Fd, " return 0;\n\n",[]), - emit(Fd, "}\n",[]), - - put(op_variable_count, 0), - put(tmp_declarations, []), - - RefStr = get_refStr(Dim), - - case TypeDefFlag of - typedef -> - emit(HFd, "int ~s~s(CORBA_Environment *oe_env, ~s);\n", - [ic_util:mk_oe_name(G, "encode_"), Name, Name]), - - emit(Fd, "int ~s~s(CORBA_Environment *oe_env, ~s oe_rec) {\n", - [ic_util:mk_oe_name(G, "encode_"), Name, Name]); - no_typedef -> - - emit(HFd, "int ~s~s(CORBA_Environment *oe_env, ~s oe_rec~s);\n", - [ic_util:mk_oe_name(G, "encode_"), - Name, - ic_cbe:mk_c_type(G, N, Type), - RefStr]), - - emit(Fd, "int ~s~s(CORBA_Environment *oe_env, ~s oe_rec~s) {\n", - [ic_util:mk_oe_name(G, "encode_"), - Name, - ic_cbe:mk_c_type(G, N, Type), - RefStr]) - end, - - emit(Fd, " int oe_error_code = 0;\n",[]), - - {ok, RamFd1} = ram_file:open([], [binary, write]), - - case TypeDefFlag of - typedef -> - emit_encode(array, G, N, nil, RamFd1, {Name, Dim}, Type); - no_typedef -> - emit_encode(array_no_typedef, G, N, nil, RamFd1, {Name, Dim}, Type) - end, - - ic_cbe:emit_tmp_variables(Fd), - ic_codegen:nl(Fd), - %% Move data from ram file to output file. - {ok, Data1} = ram_file:get_file(RamFd1), - emit(Fd, Data1), - ram_file:close(RamFd1), - - emit(Fd, " return 0;\n\n",[]), - emit(Fd, "}\n",[]), - - put(op_variable_count, 0), - put(tmp_declarations, []), - - case TypeDefFlag of - typedef -> - emit(HFd, "int ~s~s(CORBA_Environment *oe_env, char *, " - "int*, ~s);\n", - [ic_util:mk_oe_name(G, "decode_"), Name, Name]), - - emit(Fd, "int ~s~s(CORBA_Environment *oe_env, char *oe_first, " - "int* oe_outindex, ~s oe_out) {\n", - [ic_util:mk_oe_name(G, "decode_"), Name, Name]); - no_typedef -> - emit(HFd, "int ~s~s(CORBA_Environment *oe_env, char *, int*, " - "~s oe_rec~s);\n", - [ic_util:mk_oe_name(G, "decode_"), - Name, - ic_cbe:mk_c_type(G, N, Type), - RefStr]), - - emit(Fd, "int ~s~s(CORBA_Environment *oe_env, char *oe_first, " - "int* oe_outindex, ~s oe_out~s) {\n", - [ic_util:mk_oe_name(G, "decode_"), - Name, - ic_cbe:mk_c_type(G, N, Type), - RefStr]) - end, - - emit(Fd, " int oe_error_code = 0;\n",[]), - emit(Fd, " int oe_array_size = 0;\n",[]), - - {ok, RamFd2} = ram_file:open([], [binary, write]), - - case TypeDefFlag of - typedef -> - emit_decode(array, G, N, nil, RamFd2, {Name, Dim}, Type); - no_typedef -> - emit_decode(array_no_typedef, G, N, nil, RamFd2, {Name, Dim}, Type) - end, - - - ic_cbe:emit_tmp_variables(Fd), - ic_codegen:nl(Fd), - %% Move data from ram file to output file. - {ok, Data2} = ram_file:get_file(RamFd2), - emit(Fd, Data2), - ram_file:close(RamFd2), - - emit(Fd, " *oe_outindex = ~s;\n\n",[align("*oe_outindex")]), - - emit(Fd, " return 0;\n\n",[]), - emit(Fd, "}\n",[]), - file:close(Fd). - - -get_refStr([]) -> - ""; -get_refStr([X|Xs]) -> - "[" ++ X ++ "]" ++ get_refStr(Xs). - - -emit_sequence_head_def(G, N, X, T, c) -> - %% T is the sequence - case ic_genobj:is_hrlfile_open(G) of - true -> - Fd = ic_genobj:hrlfiled(G), - SeqName = ic_util:to_undersc([ic_forms:get_id2(X) | N]), - emit(Fd, "\n#ifndef __~s__\n",[ic_util:to_uppercase(SeqName)]), - emit(Fd, "#define __~s__\n",[ic_util:to_uppercase(SeqName)]), - ic_codegen:mcomment_light(Fd, - [io_lib:format("Struct definition: ~s", - [SeqName])], - c), - emit(Fd, "typedef struct {\n"), - emit(Fd, " CORBA_unsigned_long _maximum;\n"), - emit(Fd, " CORBA_unsigned_long _length;\n"), - emit_seq_buffer(Fd, G, N, T#sequence.type), - emit(Fd, "} ~s;\n\n", [SeqName]), - create_c_struct_coding_file(G, N, X, T, SeqName, - T#sequence.type, sequence_head), - emit(Fd, "\n#endif\n\n"); - - false -> - ok - end. - -emit_seq_buffer(Fd, G, N, Type) -> - emit(Fd, " ~s* _buffer;\n", - [ic_cbe:mk_c_type(G, N, Type)]). - -%%------------------------------------------------------------ -%% -%% Emit decode bodies for functions in C for array, sequences and -%% structs. -%% -%%------------------------------------------------------------ -emit_decode(array, G, N, _T, Fd, {_Name, Dim}, Type) -> - emit(Fd, " if((char*) oe_out == oe_first)\n",[]), - AlignName = - lists:concat(["*oe_outindex + ", dim_multiplication(Dim), - " * sizeof(", ic_cbe:mk_c_type(G, N, Type),")"]), - emit(Fd, " *oe_outindex = ~s;\n\n",[align(AlignName)]), - array_decode_dimension_loop(G, N, Fd, Dim, "", Type, array); -emit_decode(array_no_typedef, G, N, _T, Fd, {_Name, Dim}, Type) -> - emit(Fd, " if((char*) oe_out == oe_first)\n",[]), - AlignName = - lists:concat(["*oe_outindex + ", dim_multiplication(Dim), - " * sizeof(", ic_cbe:mk_c_type(G, N, Type),")"]), - emit(Fd, " *oe_outindex = ~s;\n\n",[align(AlignName)]), - array_decode_dimension_loop(G, N, Fd, Dim, "", Type, array_no_typedef); -emit_decode(sequence_head, G, N, T, Fd, SeqName, ElType) -> - ic_cbe:store_tmp_decl(" int oe_seq_len = 0;\n", []), - ic_cbe:store_tmp_decl(" int oe_seq_count = 0;\n", []), - ic_cbe:store_tmp_decl(" int oe_seq_dummy = 0;\n", []), - - TmpBuf = - case ictype:isBasicTypeOrEterm(G, N, ElType) of - true -> - Tmp = "oe_seq_tmpbuf", - ic_cbe:store_tmp_decl(" char* ~s = 0;\n", [Tmp]), - Tmp; - false -> - "NOT USED" - end, - - MaxSize = get_seq_max(T), - emit(Fd, " if((char*) oe_out == oe_first)\n",[]), - emit(Fd, " *oe_outindex = ~s;\n\n", - [align(["*oe_outindex + sizeof(", SeqName, ")"])]), - - Ctype = ic_cbe:mk_c_type(G, N, ElType), - emit(Fd, " if ((oe_error_code = ei_decode_list_header(oe_env->_inbuf, " - "&oe_env->_iin, &oe_seq_len)) < 0) {\n"), - case ictype:isBasicTypeOrEterm(G, N, ElType) of - true -> - emit(Fd, " int oe_type = 0;\n"), - emit(Fd, " (int) ei_get_type(oe_env->_inbuf, &oe_env->_iin, " - "&oe_type, &oe_seq_len);\n\n"), - - if - MaxSize == infinity -> - ok; - true -> - emit(Fd, " if (oe_seq_len > ~w) {\n", [MaxSize]), - emit(Fd, " CORBA_exc_set(oe_env, " - "CORBA_SYSTEM_EXCEPTION, DATA_CONVERSION, " - "\"Length of sequence `~s' out of bound\");\n" - " return -1;\n }\n", [SeqName]) - end, - emit(Fd, " oe_out->_maximum = oe_seq_len;\n"), - emit(Fd, " oe_out->_length = oe_seq_len;\n"), - emit(Fd, " oe_out->_buffer = (void *) (oe_first + " - "*oe_outindex);\n"), - emit(Fd, " *oe_outindex = ~s;\n", - [align(["*oe_outindex + (sizeof(", Ctype, ") * " - "oe_out->_length)"])]), - emit(Fd, - " if ((~s = malloc(oe_seq_len + 1)) == NULL) {\n" - " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "NO_MEMORY, \"Cannot malloc\");\n" - " return -1;\n" - " }\n", [TmpBuf]), - emit(Fd, " if ((oe_error_code = ei_decode_string(" - "oe_env->_inbuf, &oe_env->_iin, ~s)) < 0) {\n", [TmpBuf]), - emit(Fd, " CORBA_free(~s);\n\n", [TmpBuf]), - emit_c_dec_rpt(Fd, " ", "string1", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " for (oe_seq_count = 0; " - "oe_seq_count < oe_out->_length; oe_seq_count++)\n"), - case ictype:isBasicType(G, N, ElType) of - true -> - emit(Fd, " oe_out->_buffer[oe_seq_count] = (unsigned char) " - "~s[oe_seq_count];\n\n", [TmpBuf]); - false -> %% Term - emit(Fd, " oe_out->_buffer[oe_seq_count] = " - "erl_mk_int(~s[oe_seq_count]);\n\n",[TmpBuf]) % XXXX What? - end, - emit(Fd, " CORBA_free(~s);\n\n", [TmpBuf]); - false -> - emit(Fd, " return oe_error_code;\n") - end, - - emit(Fd, " } else {\n"), - - if - MaxSize == infinity -> - ok; - true -> - emit(Fd, " if (oe_seq_len > ~w) {\n", [MaxSize]), - emit(Fd, " CORBA_exc_set(oe_env, " - "CORBA_SYSTEM_EXCEPTION, DATA_CONVERSION, " - "\"Length of sequence `~s' out of bound\");\n" - " return -1;\n }\n", [SeqName]) - end, - - emit(Fd, " oe_out->_maximum = oe_seq_len;\n"), - emit(Fd, " oe_out->_length = oe_seq_len;\n"), - emit(Fd, " oe_out->_buffer = (void *) (oe_first + *oe_outindex);\n"), - emit(Fd, " *oe_outindex = ~s;\n\n", - [align(["*oe_outindex + (sizeof(", Ctype, ") * oe_out->_length)"])]), - - if - Ctype == "CORBA_char *" -> - emit(Fd, " for (oe_seq_count = 0; " - "oe_seq_count < oe_out->_length; oe_seq_count++) {\n"), - emit(Fd, " oe_out->_buffer[oe_seq_count] = " - "(void*) (oe_first + *oe_outindex);\n\n"), - ic_cbe:emit_decoding_stmt(G, N, Fd, ElType, - "oe_out->_buffer[oe_seq_count]", - "", - "oe_env->_inbuf", 0, "", caller_dyn), - emit(Fd, " *oe_outindex = ~s;", - [align(["*oe_outindex + strlen(oe_out->_buffer[" - "oe_seq_count]) + 1"])]); - true -> - emit(Fd, " for (oe_seq_count = 0; " - "oe_seq_count < oe_out->_length; oe_seq_count++) {\n"), - case ictype:isArray(G, N, ElType) of - %% XXX Silly. There is no real difference between the - %% C statements produced by the following calls. - true -> - ic_cbe:emit_decoding_stmt(G, N, Fd, ElType, - "oe_out->_buffer[oe_seq_count]", - "", - "oe_env->_inbuf", - 0, "oe_outindex", generator); - false -> - ic_cbe:emit_decoding_stmt(G, N, Fd, ElType, - "oe_out->_buffer + oe_seq_count", - "", - "oe_env->_inbuf", - 0, "oe_outindex", generator) - end - end, - emit(Fd, " }\n"), - emit(Fd, " if (oe_out->_length != 0) {\n"), - emit(Fd, " if ((oe_error_code = ei_decode_list_header(" - "oe_env->_inbuf, &oe_env->_iin, &oe_seq_dummy)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "ei_decode_list_header", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " } else\n"), - emit(Fd, " oe_out->_buffer = NULL;\n"), - emit(Fd, " }\n"); - -emit_decode(struct, G, N, _T, Fd, StructName, ElTypes) -> - Length = length(ElTypes) + 1, - Tname = ic_cbe:mk_variable_name(op_variable_count), - Tname1 = ic_cbe:mk_variable_name(op_variable_count), - - ic_cbe:store_tmp_decl(" int ~s = 0;\n",[Tname]), - ic_cbe:store_tmp_decl(" char ~s[256];\n\n",[Tname1]), - - emit(Fd, " if((char*) oe_out == oe_first)\n",[]), - AlignName = lists:concat(["*oe_outindex + sizeof(",StructName,")"]), - emit(Fd, " *oe_outindex = ~s;\n\n", [align(AlignName)]), - - emit(Fd, " if ((oe_error_code = ei_decode_tuple_header(oe_env->_inbuf, " - "&oe_env->_iin, &~s)) < 0) {\n", [Tname]), - emit_c_dec_rpt(Fd, " ", "ei_decode_tuple_header", []), - emit(Fd, " return oe_error_code;\n }\n"), - - emit(Fd, " if (~s != ~p) {\n",[Tname, Length]), - emit_c_dec_rpt(Fd, " ", "tuple header size != ~p", [Length]), - emit(Fd, " return -1;\n }\n"), - - emit(Fd, " if ((oe_error_code = ei_decode_atom(oe_env->_inbuf, " - "&oe_env->_iin, ~s)) < 0) {\n", [Tname1]), - emit_c_dec_rpt(Fd, " ", "ei_decode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " if (strcmp(~s, ~p) != 0)\n",[Tname1, StructName]), - emit(Fd, " return -1;\n\n"), - lists:foreach( - fun({ET, EN}) -> - case ic_cbe:is_variable_size(G, N, ET) of - true -> - case ET of - - {struct, _, _, _} -> - %% Sequence member = a struct - ic_cbe:emit_decoding_stmt(G, N, Fd, - StructName ++ "_" ++ - ic_forms:get_id2(ET), - "&oe_out->" ++ EN, - "", "oe_env->_inbuf", - 0, - "oe_outindex", - generator); - - {sequence, _, _} -> - %% Sequence member = a struct XXX ?? - ic_cbe:emit_decoding_stmt(G, N, Fd, - StructName ++ "_" ++ - EN, - "&oe_out->" ++ EN, - "", - "oe_env->_inbuf", - 0, - "oe_outindex", - generator); - {_,{array, _, _}} -> - emit(Fd, " oe_out->~s = (void *) " - "(oe_first+*oe_outindex);\n\n",[EN]), - ic_cbe:emit_decoding_stmt(G, N, Fd, - StructName ++ "_" ++ - EN, "oe_out->" ++ EN , - "", - "oe_env->_inbuf", - 0, - "oe_outindex", - generator); - - {union, _, _, _, _} -> - %% Sequence member = a union - ic_cbe:emit_decoding_stmt(G, N, Fd, - StructName ++ "_" ++ - ic_forms:get_id2(ET), - "&oe_out->" ++ EN, - "", - "oe_env->_inbuf", - 0, - "oe_outindex", - generator); - - {string,_} -> - ic_cbe:emit_decoding_stmt(G, N, Fd, - ET, - "oe_out->" ++ EN , - "", - "oe_env->_inbuf", - 0, - "oe_outindex", - generator_malloc); - - {scoped_id,_,_,_} -> - case ictype:member2type(G,StructName,EN) of - array -> - ic_cbe:emit_decoding_stmt(G, N, Fd, - ET, - "oe_out->" ++ - EN, - "", - "oe_env->" - "_inbuf", - 0, - "oe_outindex", - generator); - struct -> - ic_cbe:emit_decoding_stmt(G, N, Fd, - ET, - "&oe_out->" ++ - EN , - "", - "oe_env->" - "_inbuf", - 0, - "oe_outindex", - generator); - sequence -> - ic_cbe:emit_decoding_stmt(G, N, Fd, - ET, - "&oe_out->" ++ - EN, - "", - "oe_env->" - "_inbuf", - 0, - "oe_outindex", - generator); - union -> - ic_cbe:emit_decoding_stmt(G, N, Fd, - ET, - "&oe_out->" ++ - EN, - "", - "oe_env->" - "_inbuf", - 0, - "oe_outindex", - generator); - _ -> - ic_cbe:emit_decoding_stmt(G, N, Fd, - ET, - "oe_out->" ++ - EN, - "", - "oe_env->" - "_inbuf", - 0, - "oe_outindex", - generator) - end; - - _ -> - emit(Fd, " oe_out->~s = (void *) " - "(oe_first+*oe_outindex);\n\n",[EN]), - ic_cbe:emit_decoding_stmt(G, N, Fd, - ET, - "oe_out->" ++ EN , - "", - "oe_env->_inbuf", - 0, "oe_outindex", - generator) - end; - false -> - case ET of - - {struct, _, _, _} -> - %% A struct member - ic_cbe:emit_decoding_stmt(G, N, Fd, - StructName ++ "_" ++ - ic_forms:get_id2(ET), - "&oe_out->" ++ EN , - "", - "oe_env->_inbuf", - 0, - "oe_outindex", - generator); - - {_,{array, _, _}} -> - ic_cbe:emit_decoding_stmt(G, N, Fd, - StructName ++ "_" ++ - EN, - "oe_out->" ++ EN , - "", - "oe_env->_inbuf", - 0, - "oe_outindex", - generator); - - {union, _, _, _, _} -> - %% Sequence member = a union - ic_cbe:emit_decoding_stmt(G, N, Fd, - StructName ++ "_" ++ - ic_forms:get_id2(ET), - "&oe_out->" ++ EN , - "", - "oe_env->_inbuf", - 0, - "oe_outindex", - generator); - - {_,_} -> - ic_cbe:emit_decoding_stmt(G, N, Fd, - ET, - "&oe_out->" ++ EN , - "", - "oe_env->_inbuf", - 0, - "oe_outindex", - generator); - {scoped_id,_,_,_} -> - case ic_symtab:get_full_scoped_name(G, N, ET) of - {_FullScopedName, _, {tk_array,_,_}, _} -> - ic_cbe:emit_decoding_stmt(G, N, Fd, - ET, - "oe_out->" ++ - EN, - "", - "oe_env->" - "_inbuf", - 0, - "oe_outindex", - generator); - {_FullScopedName, _, {tk_string,_}, _} -> - ic_cbe:emit_decoding_stmt(G, N, Fd, - ET, - "oe_out->" ++ - EN, - "", - "oe_env->" - "_inbuf", - 0, - "oe_outindex", - generator); - {_FullScopedName, _, {tk_struct,_,_,_}, _} -> - ic_cbe:emit_decoding_stmt(G, N, Fd, - ET, - "&oe_out->" ++ - EN, - "", - "oe_env->" - "_inbuf", - 0, - "oe_outindex", - generator); - - {_FullScopedName, _, - {tk_union,_,_,_,_,_}, _} -> - ic_cbe:emit_decoding_stmt(G, N, Fd, - ET, - "&oe_out->" ++ - EN, - "", - "oe_env->" - "_inbuf", - 0, - "oe_outindex", - generator); - - _ -> - ic_cbe:emit_decoding_stmt(G, N, Fd, - ET, - "&oe_out->" ++ - EN, - "", - "oe_env->" - "_inbuf", - 0, - "oe_outindex", - generator) - end - end - end - end, - ElTypes). - - -ref_array_static_dec(array, true) -> - %% Typedef, Static, Basic Type - "&(oe_out)"; -ref_array_static_dec(array, false) -> - %% Typedef, Static, Constr Type - "&(oe_out)"; -ref_array_static_dec(array_no_typedef, true) -> - %% No Typedef, Static, Basic Type - "&oe_out"; -ref_array_static_dec(array_no_typedef, false) -> - %% No Typedef, Static, Constr Type - "&oe_out". - - -ref_array_dynamic_dec(G, N, T, array) -> - case ictype:isString(G, N, T) of - true -> % Typedef, Dynamic, String - "oe_out"; - false -> % Typedef, Dynamic, No String - "&(oe_out)" - end; -ref_array_dynamic_dec(G, N, T, array_no_typedef) -> - case ictype:isString(G, N, T) of - true -> % No Typedef, Dynamic, String - "oe_out"; - false -> % No Typedef, Dynamic, No String - "&oe_out" - end. - - - -array_decode_dimension_loop(G, N, Fd, [Dim], Dimstr, Type, TDFlag) -> - Tname = ic_cbe:mk_variable_name(op_variable_count), - ic_cbe:store_tmp_decl(" int ~s = 0;\n",[Tname]), - - emit(Fd, " if ((oe_error_code = ei_decode_tuple_header(oe_env->_inbuf, " - "&oe_env->_iin, &oe_array_size)) < 0) {\n", - []), - emit_c_dec_rpt(Fd, " ", "ei_decode_tuple_header", []), - emit(Fd, " return oe_error_code;\n }\n"), - - %% This is disabled due to a bug in erl_interface : - %% tuples inside tuples hae no correct data about the size - %% of the tuple........( allways = 0 ) - %%emit(Fd, " if (oe_array_size != ~s)\n",[Dim]), - %%emit(Fd, " return -1;\n\n"), - - emit(Fd, " for (~s = 0; ~s < ~s; ~s++) {\n", - [Tname, Tname, Dim, Tname]), - - - ArrAccess = - case ic_cbe:is_variable_size(G, N, Type) of - true -> - ref_array_dynamic_dec(G, N, Type, TDFlag) ++ - Dimstr ++ "[" ++ Tname ++ "]"; - false -> - ref_array_static_dec(TDFlag, ictype:isBasicType(G,N,Type)) ++ - Dimstr ++ "[" ++ Tname ++ "]" - end, - - ic_cbe:emit_decoding_stmt(G, N, Fd, Type, - ArrAccess, - "", "oe_env->_inbuf", 0, - "oe_outindex", generator), - - %% emit(Fd, "\n *oe_outindex += - %% sizeof(~s);\n",[ic_cbe:mk_c_type(G, N, Type)]), - emit(Fd, " }\n"); -array_decode_dimension_loop(G, N, Fd, [Dim | Ds], _Dimstr, Type, TDFlag) -> - Tname = ic_cbe:mk_variable_name(op_variable_count), - ic_cbe:store_tmp_decl(" int ~s = 0;\n",[Tname]), - - emit(Fd, " if ((oe_error_code = ei_decode_tuple_header(oe_env->_inbuf, " - "&oe_env->_iin, &oe_array_size)) < 0) {\n", - []), - emit_c_dec_rpt(Fd, " ", "ei_decode_tuple_header", []), - emit(Fd, " return oe_error_code;\n }\n"), - - %% This is disabled due to a bug in erl_interface : - %% tuples inside tuples hae no correct data about the size - %% of the tuple........( allways = 0 ) - %%emit(Fd, " if (oe_array_size != ~s)\n",[Dim]), - %%emit(Fd, " return -1;\n\n"), - - emit(Fd, " for (~s = 0; ~s < ~s; ~s++) {\n", - [Tname, Tname, Dim, Tname]), - array_decode_dimension_loop(G, N, Fd, Ds, "[" ++ Tname ++ "]" , Type, - TDFlag), - - emit(Fd, " }\n"). - -dim_multiplication([D]) -> - D; -dim_multiplication([D |Ds]) -> - D ++ "*" ++ dim_multiplication(Ds). - -emit_encode(array, G, N, _T, Fd, {_Name, Dim}, Type) -> - array_encode_dimension_loop(G, N, Fd, Dim, {"",""}, Type, array); -emit_encode(array_no_typedef, G, N, _T, Fd, {_Name, Dim}, Type) -> - array_encode_dimension_loop(G, N, Fd, Dim, {"",""}, Type, - array_no_typedef); -emit_encode(sequence_head, G, N, T, Fd, SeqName, ElType) -> - Tname = ic_cbe:mk_variable_name(op_variable_count), - ic_cbe:store_tmp_decl(" int ~s = 0;\n\n",[Tname]), - - MaxSize = get_seq_max(T), - if - MaxSize == infinity -> - ok; - true -> - emit(Fd, " if (oe_rec->_length > ~w) {\n", [MaxSize]), - emit(Fd, " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "DATA_CONVERSION, \"Length of sequence `~s' " - "out of bound\");\n" - " return -1;\n }\n", [SeqName]) - end, - - emit(Fd, " if (oe_rec->_length != 0) {\n"), - - emit(Fd, " if ((oe_error_code = oe_ei_encode_list_header(oe_env, " - "oe_rec->_length)) < 0) {\n", - []), - emit_c_enc_rpt(Fd, " ", "oi_ei_encode_list_header", []), - emit(Fd, " return oe_error_code;\n }\n"), - - emit(Fd, " for (~s = 0; ~s < oe_rec->_length; ~s++) {\n", - [Tname, Tname, Tname]), - case ElType of - {_,_} -> %% ElType = elementary type or pointer type - ic_cbe:emit_encoding_stmt(G, N, Fd, ElType, "oe_rec->_buffer[" ++ - Tname ++ "]", "oe_env->_outbuf"); - - {scoped_id,local,_,["term","erlang"]} -> - ic_cbe:emit_encoding_stmt(G, N, Fd, ElType, "oe_rec->_buffer[" ++ - Tname ++ "]", "oe_env->_outbuf"); - - {scoped_id,_,_,_} -> - case ic_symtab:get_full_scoped_name(G, N, ElType) of - {_, typedef, TDef, _} -> - case TDef of - {tk_struct,_,_,_} -> - ic_cbe:emit_encoding_stmt(G, N, Fd, ElType, - "&oe_rec->_buffer[" ++ - Tname ++ "]", - "oe_env->_outbuf"); - {tk_sequence,_,_} -> - ic_cbe:emit_encoding_stmt(G, N, Fd, ElType, - "&oe_rec->_buffer[" ++ - Tname ++ "]", - "oe_env->_outbuf"); - {tk_union,_,_,_,_,_} -> - ic_cbe:emit_encoding_stmt(G, N, Fd, ElType, - "&oe_rec->_buffer[" ++ - Tname ++ "]", - "oe_env->_outbuf"); - _ -> - ic_cbe:emit_encoding_stmt(G, N, Fd, ElType, - "oe_rec->_buffer[" ++ - Tname ++ "]", - "oe_env->_outbuf") - end; - {_,enum,_,_} -> - ic_cbe:emit_encoding_stmt(G, N, Fd, ElType, - "oe_rec->_buffer[" ++ - Tname ++ "]", - "oe_env->_outbuf"); - _ -> - ic_cbe:emit_encoding_stmt(G, N, Fd, ElType, - "&oe_rec->_buffer[" ++ - Tname ++ "]", - "oe_env->_outbuf") - end; - - _ -> %% ElType = structure - ic_cbe:emit_encoding_stmt(G, N, Fd, ElType, - "&oe_rec->_buffer[" ++ Tname ++ "]", - "oe_env->_outbuf") - end, - emit(Fd, " }\n"), - emit(Fd, " }\n"), - emit(Fd, " if ((oe_error_code = oe_ei_encode_empty_list(oe_env)) < 0) {\n"), - emit_c_enc_rpt(Fd, " ", "oe_ei_encode_empty_list", []), - emit(Fd, " return oe_error_code;\n }\n"); -emit_encode(struct, G, N, _T, Fd, StructName, ElTypes) -> - Length = length(ElTypes) + 1, - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_tuple_header(oe_env, ~p)) < 0) {\n", [Length]), - emit_c_enc_rpt(Fd, " ", "oe_ei_encode_tuple_header", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_atom(oe_env, ~p)) < 0) {\n", [StructName]), - emit_c_enc_rpt(Fd, " ", "oe_ei_encode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"), - lists:foreach( - fun({ET, EN}) -> - case ET of - {sequence, _, _} -> - %% Sequence = struct - ic_cbe:emit_encoding_stmt(G, N, Fd, - StructName ++ "_" ++ EN, - "&oe_rec->" ++ EN, - "oe_env->_outbuf"); - {_,{array, _, _Dims}} -> - ic_cbe:emit_encoding_stmt(G, N, Fd, - StructName ++ "_" ++ EN, - "oe_rec->" ++ EN, - "oe_env->_outbuf"); - - {union,_,_,_,_} -> - ic_cbe:emit_encoding_stmt(G, N, Fd, - StructName ++ "_" ++ - ic_forms:get_id2(ET), - "&oe_rec->" ++ EN, - "oe_env->_outbuf"); - - {struct,_,_,_} -> - ic_cbe:emit_encoding_stmt(G, N, Fd, - StructName ++ "_" ++ - ic_forms:get_id2(ET), - "&oe_rec->" ++ EN, - "oe_env->_outbuf"); - - {scoped_id,_,_,_} -> - case ictype:member2type(G,StructName,EN) of - struct -> - ic_cbe:emit_encoding_stmt(G, N, Fd, - ET, - "&oe_rec->" ++ EN, - "oe_env->_outbuf"); - sequence -> - ic_cbe:emit_encoding_stmt(G, N, Fd, - ET, - "&oe_rec->" ++ EN, - "oe_env->_outbuf"); - union -> - ic_cbe:emit_encoding_stmt(G, N, Fd, - ET, - "&oe_rec->" ++ EN, - "oe_env->_outbuf"); - array -> - ic_cbe:emit_encoding_stmt(G, N, Fd, - ET, - "oe_rec->" ++ EN, - "oe_env->_outbuf"); - _ -> - ic_cbe:emit_encoding_stmt(G, N, Fd, - ET, - "oe_rec->" ++ EN, - "oe_env->_outbuf") - end; - _ -> - ic_cbe:emit_encoding_stmt(G, N, Fd, - ET, - "oe_rec->" ++ EN, - "oe_env->_outbuf") - end - end, - ElTypes). - -ref_array_static_enc(array, true) -> - %% Typedef, Static, Basic Type - "oe_rec"; -ref_array_static_enc(array, false) -> - %% Typedef, Static, Constr Type - "&(oe_rec)"; -ref_array_static_enc(array_no_typedef, true) -> - %% No Typedef, Static, Basic Type - "oe_rec"; -ref_array_static_enc(array_no_typedef, false) -> - %% No Typedef, Static, Constr Type - "&oe_rec". - - -ref_array_dynamic_enc(G, N, T, array) -> - case ictype:isString(G, N, T) of - true -> % Typedef, Dynamic, String - "oe_rec"; - false -> % Typedef, Dynamic, No String - "&(oe_rec)" - end; -ref_array_dynamic_enc(G, N, T, array_no_typedef) -> - case ictype:isString(G, N, T) of - true -> % No Typedef, Dynamic, String - "oe_rec"; - false -> % No Typedef, Dynamic, No String - "&oe_rec" - end. - - - -array_encode_dimension_loop(G, N, Fd, [Dim], {Str1,_Str2}, Type, TDFlag) -> - Tname = ic_cbe:mk_variable_name(op_variable_count), - ic_cbe:store_tmp_decl(" int ~s = 0;\n",[Tname]), - - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_tuple_header(oe_env, ~s)) < 0) {\n", [Dim]), - emit_c_enc_rpt(Fd, " ", "oe_ei_encode_tuple_header", []), - emit(Fd, " return oe_error_code;\n }\n"), - - emit(Fd, " for (~s = 0; ~s < ~s; ~s++) {\n", - [Tname, Tname, Dim, Tname]), - - ArrAccess = - case ic_cbe:is_variable_size(G, N, Type) of - true -> - ref_array_dynamic_enc(G, N, Type, TDFlag) ++ - Str1 ++ "[" ++ Tname ++ "]"; - false -> - ref_array_static_enc(TDFlag, ictype:isBasicType(G,N,Type)) ++ - Str1 ++ "[" ++ Tname ++ "]" - end, - - ic_cbe:emit_encoding_stmt(G, N, Fd, Type, ArrAccess, "oe_env->_outbuf"), - emit(Fd, " }\n"); -array_encode_dimension_loop(G, N, Fd, [Dim | Ds],{Str1,Str2}, Type, TDFlag) -> - Tname = ic_cbe:mk_variable_name(op_variable_count), - ic_cbe:store_tmp_decl(" int ~s = 0;\n",[Tname]), - - emit(Fd, " if ((oe_error_code = " - "oe_ei_encode_tuple_header(oe_env, ~s)) < 0) {\n", [Dim]), - emit_c_enc_rpt(Fd, " ", "oe_ei_encode_tuple_header", []), - emit(Fd, " return oe_error_code;\n }\n"), - - emit(Fd, " for (~s = 0; ~s < ~s; ~s++) {\n", - [Tname, Tname, Dim, Tname]), - array_encode_dimension_loop(G, N, Fd, Ds, - {Str1 ++ "[" ++ Tname ++ "]", Str2}, - Type, TDFlag), - emit(Fd, " }\n"). - - -emit_sizecount(array, G, N, _T, Fd, {_Name, Dim}, Type) -> - emit(Fd, " if(*oe_size == 0)\n",[]), - AlignName = lists:concat(["*oe_size + ", dim_multiplication(Dim), - " * sizeof(", ic_cbe:mk_c_type(G, N, Type),")"]), - emit(Fd, " *oe_size = ~s;\n\n",[align(AlignName)]), - array_size_dimension_loop(G, N, Fd, Dim, Type), - emit(Fd, " *oe_size = ~s;\n\n", - [align("*oe_size + oe_malloc_size")]), - ic_codegen:nl(Fd); - -emit_sizecount(sequence_head, G, N, T, Fd, SeqName, ElType) -> - ic_cbe:store_tmp_decl(" int oe_seq_len = 0;\n", []), - ic_cbe:store_tmp_decl(" int oe_seq_count = 0;\n", []), - - emit(Fd, " if(*oe_size == 0)\n",[]), - emit(Fd, " *oe_size = ~s;\n\n", - [align(["*oe_size + sizeof(", SeqName, ")"])]), - - MaxSize = get_seq_max(T), - - emit(Fd, " if ((oe_error_code = ei_get_type(oe_env->_inbuf, " - "oe_size_count_index, &oe_type, &oe_seq_len)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "ei_get_type", []), - emit(Fd, " return oe_error_code;\n }\n"), - - if - MaxSize == infinity -> - ok; - true -> - emit(Fd, " if (oe_seq_len > ~w) {\n", [MaxSize]), - emit(Fd, " CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, " - "DATA_CONVERSION, \"Length of sequence `~s' " - "out of bound\");\n" - " return -1;\n }\n", [SeqName]) - end, - - CType = ic_cbe:mk_c_type(G, N, ElType), - - emit(Fd, " if ((oe_error_code = ei_decode_list_header(oe_env->_inbuf, " - "oe_size_count_index, NULL)) < 0) {\n"), - - case ictype:isBasicTypeOrEterm(G, N, ElType) of - true -> - emit(Fd, " if ((oe_error_code = ei_decode_string(oe_env->" - "_inbuf, oe_size_count_index, NULL)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "ei_decode_string", []), - emit(Fd, " return oe_error_code;\n }\n"), - - emit(Fd, " oe_malloc_size = ~s;\n\n", - [align(["sizeof(", CType, ") * oe_seq_len"])]); - false -> - emit_c_dec_rpt(Fd, " ", "non mea culpa", []), - emit(Fd, " return oe_error_code;\n\n") - end, - - emit(Fd, " } else {\n"), - - emit(Fd, " oe_malloc_size = ~s;\n\n", - [align(["sizeof(", CType, ") * oe_seq_len"])]), - - emit(Fd, " for (oe_seq_count = 0; oe_seq_count < oe_seq_len; " - "oe_seq_count++) {\n"), - ic_cbe:emit_malloc_size_stmt(G, N, Fd, ElType, - "oe_env->_inbuf", 0, generator), - emit(Fd, " }\n"), - - emit(Fd, " if (oe_seq_len != 0) \n"), - emit(Fd, " if ((oe_error_code = ei_decode_list_header(oe_env->_inbuf," - "oe_size_count_index, NULL)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "ei_decode_list_header", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " }\n"), - emit(Fd, " *oe_size = ~s;\n\n", [align("*oe_size + oe_malloc_size")]); - -emit_sizecount(struct, G, N, _T, Fd, StructName, ElTypes) -> - Length = length(ElTypes) + 1, - Tname = ic_cbe:mk_variable_name(op_variable_count), - ic_cbe:store_tmp_decl(" int ~s = 0;\n\n",[Tname]), - - emit(Fd, " if(*oe_size == 0)\n",[]), - AlignName = lists:concat(["*oe_size + sizeof(",StructName,")"]), - emit(Fd, " *oe_size = ~s;\n\n", [align(AlignName)]), - ic_codegen:nl(Fd), - - emit(Fd, " if ((oe_error_code = " - "ei_get_type(oe_env->_inbuf, oe_size_count_index, &oe_type, " - "&~s)) < 0) {\n", [Tname]), - emit_c_dec_rpt(Fd, " ", "ei_get_type", []), - emit(Fd, " return oe_error_code;\n }\n"), - - emit(Fd, " if (~s != ~p) {\n",[Tname, Length]), - emit_c_dec_rpt(Fd, " ", "~s != ~p", [Tname, Length]), - emit(Fd, " return -1;\n }\n"), - - - emit(Fd, " if ((oe_error_code = " - "ei_decode_tuple_header(oe_env->_inbuf, " - "oe_size_count_index, 0)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "ei_decode_tuple_header", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " if ((oe_error_code = " - "ei_decode_atom(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n", []), - emit_c_dec_rpt(Fd, " ", "ei_decode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"), - lists:foreach( - fun({ET, EN}) -> - case ic_cbe:is_variable_size(G, N, ET) of - true -> - case ET of - {sequence, _, _} -> - ic_cbe:emit_malloc_size_stmt( - G, N, Fd, - StructName ++ "_" ++ EN, - "oe_env->_inbuf", - 0, - generator); - {_,{array, _, _}} -> - ic_cbe:emit_malloc_size_stmt( - G, N, Fd, - StructName ++ "_" ++ EN, - "oe_env->_inbuf", - 0, - generator); - {union,_,_,_,_} -> - ic_cbe:emit_malloc_size_stmt( - G, N, Fd, - StructName ++ "_" ++ ic_forms:get_id2(ET), - "oe_env->_inbuf", - 0, - generator); - - {struct,_,_,_} -> - ic_cbe:emit_malloc_size_stmt( - G, N, Fd, - StructName ++ "_" ++ ic_forms:get_id2(ET), - "oe_env->_inbuf", - 0, - generator); - - _ -> - ic_cbe:emit_malloc_size_stmt( - G, N, Fd, - ET, - "oe_env->_inbuf", - 0, - generator) - end; - false -> - case ET of - {_,{array, _, _}} -> - ic_cbe:emit_malloc_size_stmt( - G, N, Fd, - StructName ++ "_" ++ EN, - "oe_env->_inbuf", - 0, - generator); - - {union,_,_,_,_} -> - ic_cbe:emit_malloc_size_stmt( - G, N, Fd, - StructName ++ "_" ++ ic_forms:get_id2(ET), - "oe_env->_inbuf", - 0, - generator); - - {struct,_,_,_} -> - ic_cbe:emit_malloc_size_stmt( - G, N, Fd, - StructName ++ "_" ++ ic_forms:get_id2(ET), - "oe_env->_inbuf", - 0, - generator); - _ -> - ic_cbe:emit_malloc_size_stmt( - G, N, Fd, - ET, - "oe_env->_inbuf", - 1, - generator) - end - end - end, - ElTypes), - - emit(Fd, " *oe_size = ~s;\n\n", - [align("*oe_size + oe_malloc_size")]). - - -array_size_dimension_loop(G, N, Fd, [Dim], Type) -> - Tname = ic_cbe:mk_variable_name(op_variable_count), - - ic_cbe:store_tmp_decl(" int ~s = 0;\n",[Tname]), - emit(Fd, " if ((oe_error_code = " - "ei_get_type(oe_env->_inbuf, oe_size_count_index, " - "&oe_type, &oe_array_size)) < 0) {\n", - []), - emit_c_dec_rpt(Fd, " ", "ei_get_type", []), - emit(Fd, " return oe_error_code;\n }\n"), - - emit(Fd, " if (oe_array_size != ~s) {\n",[Dim]), - emit_c_dec_rpt(Fd, " ", "array size != ~s", [Dim]), - emit(Fd, " return -1;\n }\n"), - - emit(Fd, " if ((oe_error_code = ei_decode_tuple_header(oe_env->_inbuf, " - "oe_size_count_index, 0)) < 0) {\n", []), - emit_c_dec_rpt(Fd, " ", "ei_decode_tuple_header", []), - emit(Fd, " return oe_error_code;\n }\n"), - - emit(Fd, " for (~s = 0; ~s < ~s; ~s++) {\n", - [Tname, Tname, Dim, Tname]), - ic_cbe:emit_malloc_size_stmt(G, N, Fd, - Type, "oe_env->_inbuf", 0, generator), - emit(Fd, " }\n"); -array_size_dimension_loop(G, N, Fd, [Dim | Ds], Type) -> - Tname = ic_cbe:mk_variable_name(op_variable_count), - - ic_cbe:store_tmp_decl(" int ~s = 0;\n",[Tname]), - emit(Fd, " if ((oe_error_code = " - "ei_get_type(oe_env->_inbuf, oe_size_count_index, " - "&oe_type, &oe_array_size)) < 0) {\n", []), - emit_c_dec_rpt(Fd, " ", "ei_get_type", []), - emit(Fd, " return oe_error_code;\n }\n"), - - emit(Fd, " if (oe_array_size != ~s) {\n",[Dim]), - emit_c_dec_rpt(Fd, " ", "array size != ~s", [Dim]), - emit(Fd, " return -1;\n }\n"), - - emit(Fd, " if ((oe_error_code = ei_decode_tuple_header(oe_env->_inbuf, " - "oe_size_count_index, 0)) < 0) {\n", - []), - emit_c_dec_rpt(Fd, " ", "ei_decode_tuple_header", []), - emit(Fd, " return oe_error_code;\n }\n"), - - emit(Fd, " for (~s = 0; ~s < ~s; ~s++) {\n", - [Tname, Tname, Dim, Tname]), - array_size_dimension_loop(G, N, Fd, Ds, Type), - emit(Fd, " }\n"). - - -create_c_struct_coding_file(G, N, _X, T, StructName, ElTypes, StructType) -> - - {Fd , SName} = open_c_coding_file(G, StructName), % stub file - HFd = ic_genobj:hrlfiled(G), % stub header file - HrlFName = filename:basename(ic_genobj:include_file(G)), - - ic_codegen:emit_stub_head(G, Fd, SName, c), - HrlFName = filename:basename(ic_genobj:include_file(G)), - emit(Fd, "#include \"~s\"\n\n",[HrlFName]), - - %% Size count - - put(op_variable_count, 0), - put(tmp_declarations, []), - - emit(HFd, "int ~s~s(CORBA_Environment *oe_env, int*, int*);\n", - [ic_util:mk_oe_name(G, "sizecalc_"), StructName]), - - emit(Fd, "int ~s~s(CORBA_Environment *oe_env, " - "int* oe_size_count_index, int* oe_size)\n{\n", - [ic_util:mk_oe_name(G, "sizecalc_"), StructName]), - - emit(Fd, " int oe_malloc_size = 0;\n",[]), - emit(Fd, " int oe_error_code = 0;\n",[]), - emit(Fd, " int oe_type = 0;\n",[]), - - {ok, RamFd} = ram_file:open([], [binary, write]), - - emit_sizecount(StructType, G, N, T, RamFd, StructName, ElTypes), - - ic_cbe:emit_tmp_variables(Fd), - ic_codegen:nl(Fd), - %% Move data from ram file to output file. - {ok, Data} = ram_file:get_file(RamFd), - emit(Fd, Data), - ram_file:close(RamFd), - - emit(Fd, " return 0;\n\n",[]), - emit(Fd, "}\n\n",[]), - - %% Encode - - put(op_variable_count, 0), - put(tmp_declarations, []), - - - emit(HFd, "int ~s~s(CORBA_Environment *oe_env, ~s*);\n", - [ic_util:mk_oe_name(G, "encode_"), StructName, StructName]), - - emit(Fd, "int ~s~s(CORBA_Environment *oe_env, ~s* oe_rec)\n{\n", - [ic_util:mk_oe_name(G, "encode_"), StructName, StructName]), - - emit(Fd, " int oe_error_code = 0;\n",[]), - - {ok, RamFd1} = ram_file:open([], [binary, write]), - - emit_encode(StructType, G, N, T, RamFd1, StructName, ElTypes), - - ic_cbe:emit_tmp_variables(Fd), - ic_codegen:nl(Fd), - %% Move data from ram file to output file. - {ok, Data1} = ram_file:get_file(RamFd1), - emit(Fd, Data1), - ram_file:close(RamFd1), - - emit(Fd, " return 0;\n\n",[]), - emit(Fd, "}\n\n",[]), - - %% Decode - - put(op_variable_count, 0), - put(tmp_declarations, []), - - emit(HFd, "int ~s~s(CORBA_Environment *oe_env, char *, int*, ~s *);\n", - [ic_util:mk_oe_name(G, "decode_"), StructName, StructName]), - - emit(Fd, "int ~s~s(CORBA_Environment *oe_env, char *oe_first, " - "int* oe_outindex, " - "~s *oe_out)\n{\n", - [ic_util:mk_oe_name(G, "decode_"), StructName, StructName]), - - emit(Fd, " int oe_error_code = 0;\n",[]), - - {ok, RamFd2} = ram_file:open([], [binary, write]), - - emit_decode(StructType, G, N, T, RamFd2, StructName, ElTypes), - - ic_cbe:emit_tmp_variables(Fd), - ic_codegen:nl(Fd), - %% Move data from ram file to output file. - {ok, Data2} = ram_file:get_file(RamFd2), - emit(Fd, Data2), - ram_file:close(RamFd2), - - emit(Fd, " *oe_outindex = ~s;\n",[align("*oe_outindex")]), - emit(Fd, " return 0;\n\n",[]), - emit(Fd, "}\n\n",[]), - file:close(Fd). - - -%%------------------------------------------------------------ -%% -%% emit primitive for unions. -%% -%%------------------------------------------------------------ -emit_union(G, N, X, erlang) -> - case ic_genobj:is_hrlfile_open(G) of - true -> - ic_codegen:record(G, X, - ic_util:to_undersc([ic_forms:get_id2(X) | N]), - nil,nil), - mkFileRecObj(G,N,X,erlang); - false -> ok - end; -emit_union(_G, _N, _X, c) -> %% Not supported in c backend - true. - - -%%------------------------------------------------------------ -%% -%% emit erlang modules for objects with record definitions -%% (such as unions or structs), or sequences -%% -%% The record files, other than headers are only generated -%% for CORBA...... If wished an option could allows even -%% for other backends ( not necessary anyway ) -%% -%%------------------------------------------------------------ -mkFileRecObj(G,N,X,erlang) -> - case ic_options:get_opt(G, be) of - erl_corba -> - SName = - ic_util:to_undersc([ic_forms:get_id2(X) | N]), - FName = - ic_file:join(ic_options:get_opt(G, stubdir), - ic_file:add_dot_erl(SName)), - - case file:open(FName, [write]) of - {ok, Fd} -> - HrlFName = filename:basename(ic_genobj:include_file(G)), - - ic_codegen:emit_stub_head(G, Fd, SName, erlang), - emit(Fd, "-include(~p).\n\n",[HrlFName]), - emit_exports(G,Fd), - emit_rec_methods(G,N,X,SName,Fd), - ic_codegen:nl(Fd), - ic_codegen:nl(Fd), - file:close(Fd); - Other -> - exit(Other) - end; - _ -> - true - end. - - -%%------------------------------------------------------------ -%% -%% emit erlang modules for objects with array definitions.. -%% -%%------------------------------------------------------------ -mkFileArrObj(G,N,X,erlang) -> - SName = - ic_util:to_undersc([ic_forms:get_id2(X) | N]), - FName = - ic_file:join(ic_options:get_opt(G, stubdir), - ic_file:add_dot_erl(SName)), - - case file:open(FName, [write]) of - {ok, Fd} -> - HrlFName = filename:basename(ic_genobj:include_file(G)), - - ic_codegen:emit_stub_head(G, Fd, SName, erlang), - emit(Fd, "-include(~p).\n\n",[HrlFName]), - emit_exports(G,Fd), - emit_arr_methods(G,N,X,SName,Fd), - ic_codegen:nl(Fd), - ic_codegen:nl(Fd), - file:close(Fd); - Other -> - exit(Other) - end. - - - - -%%------------------------------------------------------------ -%% -%% emit exports for erlang modules which represent records. -%% -%%------------------------------------------------------------ -emit_exports(G,Fd) -> - case ic_options:get_opt(G, be) of - erl_corba -> - emit(Fd, "-export([tc/0,id/0,name/0]).\n\n\n\n",[]); - _ -> - emit(Fd, "-export([id/0,name/0]).\n\n\n\n",[]) - end. - - -%%------------------------------------------------------------ -%% -%% emit erlang module functions which represent records, yields -%% record information such as type code, identity and name. -%% -%%------------------------------------------------------------ -emit_rec_methods(G,N,X,Name,Fd) -> - - IR_ID = ictk:get_IR_ID(G, N, X), - - case ic_options:get_opt(G, be) of - - erl_corba -> - TK = ic_forms:get_tk(X), - - case TK of - undefined -> - STK = ic_forms:search_tk(G,ictk:get_IR_ID(G, N, X)), - emit(Fd, "%% returns type code\n",[]), - emit(Fd, "tc() -> ~p.\n\n",[STK]), - emit(Fd, "%% returns id\n",[]), - emit(Fd, "id() -> ~p.\n\n",[IR_ID]), - emit(Fd, "%% returns name\n",[]), - emit(Fd, "name() -> ~p.\n\n",[Name]); - _ -> - emit(Fd, "%% returns type code\n",[]), - emit(Fd, "tc() -> ~p.\n\n",[TK]), - emit(Fd, "%% returns id\n",[]), - emit(Fd, "id() -> ~p.\n\n",[IR_ID]), - emit(Fd, "%% returns name\n",[]), - emit(Fd, "name() -> ~p.\n\n",[Name]) - end; - - _ -> - emit(Fd, "%% returns id\n",[]), - emit(Fd, "id() -> ~p.\n\n",[IR_ID]), - emit(Fd, "%% returns name\n",[]), - emit(Fd, "name() -> ~p.\n\n",[Name]) - end. - - - -%%------------------------------------------------------------ -%% -%% emit erlang module functions which represent arrays, yields -%% record information such as type code, identity and name. -%% -%%------------------------------------------------------------ -emit_arr_methods(G,N,X,Name,Fd) -> - - IR_ID = ictk:get_IR_ID(G, N, X), - - case ic_options:get_opt(G, be) of - - erl_corba -> - - TK = ic_forms:get_type_code(G, N, X), - - emit(Fd, "%% returns type code\n",[]), - emit(Fd, "tc() -> ~p.\n\n",[TK]), - emit(Fd, "%% returns id\n",[]), - emit(Fd, "id() -> ~p.\n\n",[IR_ID]), - emit(Fd, "%% returns name\n",[]), - emit(Fd, "name() -> ~p.\n\n",[Name]); - - _ -> - - emit(Fd, "%% returns id\n",[]), - emit(Fd, "id() -> ~p.\n\n",[IR_ID]), - emit(Fd, "%% returns name\n",[]), - emit(Fd, "name() -> ~p.\n\n",[Name]) - end. - -get_seq_max(T) when is_record(T, sequence) andalso T#sequence.length == 0 -> - infinity; -get_seq_max(T) when is_record(T, sequence) andalso is_tuple(T#sequence.length) -> - list_to_integer(element(3, T#sequence.length)). - - -align(Cs) -> - ic_util:mk_align(Cs). - diff --git a/lib/ic/src/ictk.erl b/lib/ic/src/ictk.erl deleted file mode 100644 index 701d662776..0000000000 --- a/lib/ic/src/ictk.erl +++ /dev/null @@ -1,874 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(ictk). - - -%% Toplevel generation functions --export([reg_gen/3, unreg_gen/3]). - - -%% Utilities --export([get_IR_ID/3, get_IR_VSN/3, register_name/1, unregister_name/1]). - --import(ic_forms, [get_id2/1, get_body/1, get_idlist/1]). --import(ic_util, [mk_name/2, mk_oe_name/2, to_atom/1, to_list/1]). --import(ic_codegen, [emit/2, emit/3, nl/1]). - --include("icforms.hrl"). --include("ic.hrl"). - -%%-------------------------------------------------------------------- -%% -%% IFR Registration Generation -%% -%% -%%-------------------------------------------------------------------- - --define(IFRID(G), mk_name(G, "IFR")). --define(VARID(G), mk_name(G, "VAR")). --define(IFRMOD, orber_ifr). - -reg_gen(G, N, X) -> - S = ic_genobj:tktab(G), - Light = ic_options:get_opt(G, light_ifr), - init_var(), - case ic_genobj:is_stubfile_open(G) of - true when Light == false -> - Var = ?IFRID(G), - Fd = ic_genobj:stubfiled(G), - nl(Fd), nl(Fd), nl(Fd), - emit(Fd, "~p() ->\n", [to_atom(register_name(G))]), - emit(Fd, " ~s = ~p:find_repository(),\n", - [Var, ?IFRMOD]), - nl(Fd), - - %% Write call function that checks if included - %% modules and interfaces are created. - emit(Fd, " register_tests(~s),\n",[?IFRID(G)]), - - reg2(G, S, N, Var, X), - nl(Fd), - emit(Fd, " ok.\n"), - - %% Write general register test function. - register_tests(Fd,G), - - %% Write functopn that registers modules only if - %% they are not registered. - register_if_unregistered(Fd); - true when Light == true -> - Fd = ic_genobj:stubfiled(G), - nl(Fd), nl(Fd), nl(Fd), - Regname = to_atom(register_name(G)), - emit(Fd, "~p() ->\n\t~p([]).\n\n", [Regname, Regname]), - emit(Fd, "~p(OE_Options) ->\n\t~p:add_items(?MODULE, OE_Options,\n\t[", - [Regname, ?IFRMOD]), - reg_light(G, N, X), - emit(Fd, "ok]),\n\tok.\n"); - false -> - ok - end. - -reg_light(G, N, X) when is_list(X) -> - reg_light_list(G, N, X); -reg_light(G, N, X) when is_record(X, module) -> - reg_light_list(G, [get_id2(X) | N], get_body(X)); -reg_light(G, N, X) when is_record(X, struct) -> - emit(ic_genobj:stubfiled(G), "{~p, ~p, struct},\n\t", - [get_IR_ID(G, N, X), get_module(X, N)]); -reg_light(G, N, X) when is_record(X, except) -> - emit(ic_genobj:stubfiled(G), "{~p, ~p, except},\n\t", - [get_IR_ID(G, N, X), get_module(X, N)]); -reg_light(G, N, X) when is_record(X, union) -> - emit(ic_genobj:stubfiled(G), "{~p, ~p, union},\n\t", - [get_IR_ID(G, N, X), get_module(X, N)]); -reg_light(G, N, X) when is_record(X, interface) -> - emit(ic_genobj:stubfiled(G), "{~p, ~p, interface},\n\t", - [get_IR_ID(G, N, X), get_module(X, N)]), - reg_light_list(G, [get_id2(X)|N], get_body(X)); -reg_light(_G, _N, _X) -> - ok. - -get_module(X, N) -> - List = [get_id2(X) | N], - list_to_atom(lists:foldl(fun(E, Acc) -> E++"_"++Acc end, - hd(List), tl(List))). - -%% This function filters off all "#include .idl" code that -%% come along from preprocessor and scanner. Produces code ONLY for -%% the actuall file. See ticket OTP-2133 -reg_light_list(_G, _N, []) -> []; -reg_light_list(G, N, List ) -> - CurrentFileName = ic_genobj:idlfile(G), - reg_light_list(G, N, {CurrentFileName,true}, List). - -%% The filter function + loop -reg_light_list(_G, _N, {_CFN, _Status}, []) -> []; -reg_light_list(G, N, {CFN,Status}, [X | Xs]) -> - case Status of - true -> - case X of - {preproc,_,{_,_,_FileName},[{_,_,"1"}]} -> - reg_light_list(G, N, {CFN,false}, Xs); - _ -> - reg_light(G, N, X), - reg_light_list(G, N, {CFN,Status}, Xs) - end; - false -> - case X of - {preproc,_,{_,_,CFN},[{_,_,"2"}]} -> - reg_light(G, N, X), - reg_light_list(G, N, {CFN,true}, Xs); - _ -> - reg_light_list(G, N, {CFN,Status}, Xs) - end - end. - - -%% reg2 is top level registration - -reg2(G, S, N, Var, X) -> - reg2(G, S, N, "Repository_create_", Var, X). - -reg2(G, S, N, C, V, X) when is_list(X) -> reg2_list(G, S, N, C, V, X); - -reg2(G, S, N, C, V, X) when is_record(X, module) -> - NewV = r_emit2(G, S, N, C, V, X, "", []), - reg2_list(G, S, [get_id2(X) | N], "ModuleDef_create_", NewV, get_body(X)); - -reg2(G, S, N, C, V, X) when is_record(X, const) -> - r_emit2(G, S, N, C, V, X, ", ~s, ~p", - [get_idltype(G, S, N, X), {X#const.tk, X#const.val}]); - -reg2(G, S, N, C, V, X) when is_record(X, struct) -> - do_struct(G, S, N, C, V, X, ic_forms:get_tk(X)); - -reg2(G, S, N, C, V, X) when is_record(X, except) -> - do_except(G, S, N, C, V, X, ic_forms:get_tk(X)); - -reg2(G, S, N, C, V, X) when is_record(X, union) -> - do_union(G, S, N, C, V, X, ic_forms:get_tk(X)); - -reg2(G, S, N, C, V, X) when is_record(X, enum) -> - r_emit2(G, S, N, C, V, X, ", ~p", - [get_enum_member_list(G, S, N, get_body(X))]); - -reg2(G, S, N, C, V, X) when is_record(X, typedef) -> - do_typedef(G, S, N, C, V, X), - look_for_types(G, S, N, C, V, get_body(X)); - -reg2(G, S, N, C, V, X) when is_record(X, attr) -> - XX = #id_of{type=X}, - lists:foreach(fun(Id) -> r_emit2(G, S, N, C, V, XX#id_of{id=Id}, ", ~s, ~p", - [get_idltype(G, S, N, X), get_mode(G, N, X)]) - end, - get_idlist(X)); - -reg2(G, S, N, C, V, X) when is_record(X, interface) -> - N2 = [get_id2(X) | N], - Body = get_body(X), - BIs = get_base_interfaces(G,X), %% produce code for the interface inheritance - NewV = r_emit2(G, S, N, C, V, X, ", " ++ BIs,[]), - reg2_list(G, S, N2, "InterfaceDef_create_", NewV, Body); - - -reg2(G, S, N, C, V, X) when is_record(X, op) -> - r_emit2(G, S, N, C, V, X, ", ~s, ~p, [~s], [~s], ~p", - [get_idltype(G, S, N, X), get_mode(G, N, X), - get_params(G, S, N, X#op.params), get_exceptions(G, S, N, X), - get_context(G, S, N, X)]); - -reg2(_G, _S, _N, _C, _V, X) when is_record(X, preproc) -> ok; - -reg2(_G, _S, _N, _C, _V, X) when is_record(X, pragma) -> ok; - -reg2(_G, _S, _N, _C, _V, _X) -> ok. - - -%% This function filters off all "#include .idl" code that -%% come along from preprocessor and scanner. Produces code ONLY for -%% the actuall file. See ticket OTP-2133 -reg2_list(_G, _S, _N, _C, _V, []) -> []; -reg2_list(G, S, N, C, V, List ) -> - CurrentFileName = ic_genobj:idlfile(G), - reg2_list(G, S, N, C, V, {CurrentFileName,true}, List). - -%% The filter function + loop -reg2_list(_G, _S, _N, _C, _V, {_CFN, _Status}, []) -> []; -reg2_list(G, S, N, C, V, {CFN,Status}, [X | Xs]) -> - case Status of - true -> - case X of - {preproc,_,{_,_,_FileName},[{_,_,"1"}]} -> - reg2_list(G, S, N, C, V, {CFN,false}, Xs); - _ -> - F = reg2(G, S, N, C, V, X), - [F | reg2_list(G, S, N, C, V, {CFN,Status}, Xs)] - end; - false -> - case X of - {preproc,_,{_,_,CFN},[{_,_,"2"}]} -> - F = reg2(G, S, N, C, V, X), - [F | reg2_list(G, S, N, C, V, {CFN,true}, Xs)]; - _ -> - reg2_list(G, S, N, C, V, {CFN,Status}, Xs) - end - end. - - - - - -%% General registration tests -register_tests(Fd,G) -> - IfrId = ?IFRID(G), - emit(Fd,"\n\n%% General IFR registration checks.\n", []), - emit(Fd,"register_tests(~s)->\n",[IfrId]), - emit(Fd," re_register_test(~s),\n",[IfrId]), - emit(Fd," include_reg_test(~s).\n\n",[IfrId]), - - emit(Fd,"\n%% IFR type Re-registration checks.\n", []), - case ic_pragma:fetchRandomLocalType(G) of - {ok,TypeId} -> - emit(Fd,"re_register_test(~s)->\n",[IfrId]), - emit(Fd," case orber_ifr:'Repository_lookup_id'(~s,~p) of\n", [IfrId,TypeId]), - emit(Fd," [] ->\n true;\n",[]), - emit(Fd," _ ->\n exit({allready_registered,~p})\n end.\n\n", [TypeId]); - false -> - emit(Fd,"re_register_test(_)-> true.\n",[]) - end, - - emit(Fd,"~s",[check_include_regs(G)]). - - - - -%% This function produces code for existance check over -%% top level included modules and interfaces -check_include_regs(G) -> - IfrId = ?IFRID(G), - case ic_pragma:get_incl_refs(G) of - none -> - io_lib:format("\n%% No included idl-files detected.\n", []) ++ - io_lib:format("include_reg_test(_~s) -> true.\n",[IfrId]); - IMs -> - io_lib:format("\n%% IFR registration checks for included idl files.\n", []) ++ - io_lib:format("include_reg_test(~s) ->\n",[IfrId]) ++ - check_incl_refs(G,IfrId,IMs) - end. - - - -check_incl_refs(_,_,[]) -> - io_lib:format(" true.\n",[]); -check_incl_refs(G,IfrId,[[First]|Rest]) -> - ModId = ic_pragma:scope2id(G,First), - io_lib:format(" case orber_ifr:'Repository_lookup_id'(~s,~p) of~n", [IfrId,ModId]) ++ - io_lib:format(" [] ->~n exit({unregistered,~p});~n", [ModId]) ++ - io_lib:format(" _ ->~n true~n end,~n",[]) ++ - check_incl_refs(G,IfrId,Rest). - - - -%% This function will return module ref, it will -%% also register module if not registered. -register_if_unregistered(Fd) -> - emit(Fd, "\n\n%% Fetch top module reference, register if unregistered.\n"), - emit(Fd, "oe_get_top_module(OE_IFR, ID, Name, Version) ->\n"), - emit(Fd, " case orber_ifr:'Repository_lookup_id'(OE_IFR, ID) of\n"), - emit(Fd, " [] ->\n"), - emit(Fd, " orber_ifr:'Repository_create_module'(OE_IFR, ID, Name, Version);\n"), - emit(Fd, " Mod ->\n"), - emit(Fd, " Mod\n",[]), - emit(Fd, " end.\n\n"), - emit(Fd, "%% Fetch module reference, register if unregistered.\n"), - emit(Fd, "oe_get_module(OE_IFR, OE_Parent, ID, Name, Version) ->\n"), - emit(Fd, " case orber_ifr:'Repository_lookup_id'(OE_IFR, ID) of\n"), - emit(Fd, " [] ->\n"), - emit(Fd, " orber_ifr:'ModuleDef_create_module'(OE_Parent, ID, Name, Version);\n"), - emit(Fd, " Mod ->\n"), - emit(Fd, " Mod\n",[]), - emit(Fd, " end.\n"). - - - -do_typedef(G, S, N, C, V, X) -> - case ic_genobj:is_stubfile_open(G) of - false -> ok; - true -> - Fd = ic_genobj:stubfiled(G), - Thing = get_thing_name(X), - IR_VSN = get_IR_VSN(G, N, X), - TK = ic_forms:get_tk(X), - - lists:foreach( - fun(Id) -> - r_emit_raw(G, X, Fd, "", C, Thing, V, - get_IR_ID(G, N, Id), get_id2(Id), - IR_VSN, ", ~s", - [get_idltype_tk(G, S, N, - ictype:maybe_array(G, S, N, - Id, TK))]) - end, get_idlist(X)) - end. - - -do_union(G, S, N, C, V, X, {tk_union, _IFRID, _Name, DiscrTK, _DefNr, L}) -> - N2 = [get_id2(X) | N], - r_emit2(G, S, N, C, V, X, ", ~s, [~s]", - [get_idltype_tk(G, S, N, DiscrTK), - get_union_member_def(G, S, N2, L)]), - look_for_types(G, S, N2, C, V, get_body(X)). - -do_struct(G, S, N, C, V, X, {tk_struct, _IFRID, _Name, ElemList}) -> - N2 = [get_id2(X) | N], - r_emit2(G, S, N, C, V, X, ", [~s]", - [get_member_def(G, S, N, ElemList)]), - look_for_types(G, S, N2, C, V, get_body(X)). - -do_except(G, S, N, C, V, X, {tk_except, _IFRID, _Name, ElemList}) -> - N2 = [get_id2(X) | N], - r_emit2(G, S, N, C, V, X, ", [~s]", - [get_member_def(G, S, N, ElemList)]), - look_for_types(G, S, N2, C, V, get_body(X)). - - -%% new_var finds an unused Erlang variable name by increasing a -%% counter. -new_var(_G) -> - lists:flatten(["_OE_", integer_to_list(put(var_count, get(var_count) + 1))]). -init_var() -> - put(var_count, 1). - -%% Public interface. The name of the register function. -register_name(G) -> - mk_oe_name(G, "register"). -unregister_name(G) -> - mk_oe_name(G, "unregister"). - - - -look_for_types(G, S, N, C, V, L) when is_list(L) -> - lists:foreach(fun(X) -> look_for_types(G, S, N, C, V, X) end, L); -look_for_types(G, S, N, C, V, {_Name, TK}) -> % member - look_for_types(G, S, N, C, V, TK); -look_for_types(_G, _S, _N, _C, _V, {tk_union, _IFRID, _Name, _DT, _Def, _L}) -> - ok; -look_for_types(G, S, N, C, V, {_Label, _Name, TK}) -> % case_dcl - look_for_types(G, S, N, C, V, TK); -look_for_types(_G, _S, _N, _C, _V, {tk_struct, _IFRID, _Name, _L}) -> - ok; -look_for_types(_G, _S, _N, _C, _V, _X) -> - ok. - - - - -%% This function produces code for the interface inheritance registration. -%% It produces a string that represents a list of function calls. -%% This list becomes a list of object references when the main function -%% "orber_ifr:ModuleDef_create_interface" is called. - -get_base_interfaces(G,X) -> - case element(3,X) of - [] -> - "[]"; - L -> - "[" ++ - lists:flatten( - lists:foldl( - fun(E, Acc) -> [call_fun_str(G,E), ", " | Acc] end, - call_fun_str(G,hd(L)), - tl(L) - ) - ) ++ "]" - end. - -call_fun_str(G,S) -> - lists:flatten( - io_lib:format("orber_ifr:lookup_id(~s,\"~s\")", - [ ?IFRID(G), - ic_pragma:scope2id(G,S)] )). - - - - - -%%-------------------------------------------------------------------- -%% -%% r_emit emits an IFR register function call. It returns a new -%% variable (if further defs should be added to that one) -%% -%% G is genobj -%% -%% S is symbol table (ets) -%% -%% N is list of ids describing scope -%% -%% C is create stub (eg. "Repository_create_") -%% -%% V is variable name where current def should be added, -%% -%% X is the current def item, -%% -%% F and A is auxillary format and args that will be io_lib -%% formatted and inserted as a string (don't forget to start with -%% ", ") -%% -r_emit2(G, _S, N, C, V, X, F, A) -> - case ic_genobj:is_stubfile_open(G) of - false -> ok; - true -> - {NewV, Str} = get_assign(G, V, X), - r_emit_raw(G, X, ic_genobj:stubfiled(G), Str, - C, get_thing_name(X), V, - get_IR_ID(G, N, X), get_id2(X), get_IR_VSN(G, N, X), - F, A), - NewV - end. - - -%%-------------------------------------------------------------------- -%% -%% An IFR register line registers an entity (Thing) into the IFR. The -%% thing is registered INTO something, an type is registered into a -%% module for instance, and this is reflected in the Var parameter -%% below. The var parameter is the name of the parent IFR object. The -%% Thing parameter is the name of the thing we're trying to register, -%% a typdef is called an alias and an interface is called an -%% interface. Sometimes we need to store the thing we're registering -%% into a variable because we're going to add other things to it -%% later, modules and interfaces are such containers, so we must -%% remember that variable for later use. -%% -%% All parameters shall be strings unless otherwise noted -%% -%% Fd - File descriptor -%% AssignStr - Assign or not, empty except for interfaces and modules -%% Create - Create has diff. names dep. on into what we register -%% Thing - WHAT is registered, interface -%% Var - The name of the variable we register into -%% IR_ID - The IFR identifier (may be "") -%% Id - The identifier (name) of the object -%% IR_VSN - The IFR version as a string -%% AuxStr - An auxillary string -%% -%%r_emit_raw(Fd, AssignStr, Create, Thing, Var, IR_ID, Id, IR_VSN) -> -%% r_emit_raw(Fd, AssignStr, Create, Thing, Var, IR_ID, Id, IR_VSN, "", []). -r_emit_raw(_G, X, Fd, AssignStr, "Repository_create_", Thing, Var, IR_ID, Id, IR_VSN, F, A) - when is_record(X, module) -> - emit(Fd, "~n ~s~p(~s, \"~s\", \"~s\", \"~s\"~s),~n", - [AssignStr, to_atom("oe_get_top_"++Thing), Var, IR_ID, Id, - IR_VSN, io_lib:format(F, A)]); -r_emit_raw(G, X, Fd, AssignStr, "ModuleDef_create_", Thing, Var, IR_ID, Id, IR_VSN, F, A) - when is_record(X, module) -> - emit(Fd, "~n ~s~p(~s, ~s, \"~s\", \"~s\", \"~s\"~s),~n", - [AssignStr, to_atom("oe_get_"++Thing), ?IFRID(G), Var, IR_ID, Id, - IR_VSN, io_lib:format(F, A)]); -r_emit_raw(_G, _X, Fd, AssignStr, Create, Thing, Var, IR_ID, Id, IR_VSN, F, A) -> - emit(Fd, "~n ~s~p:~p(~s, \"~s\", \"~s\", \"~s\"~s),~n", - [AssignStr, ?IFRMOD, to_atom(Create++Thing), Var, IR_ID, Id, - IR_VSN, io_lib:format(F, A)]). - - - - -%% Used by r_emit. Returns tuple {Var, Str} where Var is the resulting -%% output var (if any, otherwise same as input arg) and Str is a -%% string of the assignment if any ("" or "Var = ") -get_assign(G, _V, X) when is_record(X, module) -> - mk_assign(G); -get_assign(G, _V, X) when is_record(X, interface) -> - mk_assign(G); -get_assign(_G, V, _X) -> {V, ""}. -mk_assign(G) -> - V = new_var(G), - {V, io_lib:format("~s = ", [V])}. - -%% Returns a list of strings of all enum members (suitable for ~p) -get_enum_member_list(_G, _S, _N, L) -> - lists:map(fun(M) -> get_id2(M) end, L). - -%% Will output a string of the union members. -get_union_member_def(_G, _S, _N, []) -> []; -get_union_member_def(G, S, N, L) -> - [union_member2str(G, S, N, hd(L)) | - lists:map(fun(M) -> [", ", union_member2str(G, S, N, M)] end, tl(L))]. -%% lists:foldl(fun(M, Acc) -> -%% [union_member2str(G, S, N, M),", " | Acc] end, -%% union_member2str(G, S, N, hd(L)), tl(L)). - -union_member2str(G, S, N, {Label, Name, TK}) -> - io_lib:format("~s{name=~p, label=~p, type=~p, type_def=~s}", - ["#unionmember", Name, Label, TK, - get_idltype_tk(G, S, N, TK)]). - - -%% Will output a string of the struct members. Works for exceptions -%% and structs -%% -get_member_def(_G, _S, _N, []) -> []; -get_member_def(G, S, N, L) -> - [member2str(G, S, N, hd(L)) | - lists:map(fun(M) -> [", ", member2str(G, S, N, M)] end, tl(L))]. - -member2str(G, S, N, {Id, TK}) -> - io_lib:format("~s{name=~p, type=~p, type_def=~s}", - ["#structmember", Id, TK, get_idltype_tk(G, S, N, TK)]). - -%% Translates between record names and create operation names. -get_thing_name(X) when is_record(X, op) -> "operation"; -get_thing_name(X) when is_record(X, const) -> "constant"; -get_thing_name(X) when is_record(X, typedef) -> "alias"; -get_thing_name(X) when is_record(X, attr) -> "attribute"; -get_thing_name(X) when is_record(X, except) -> "exception"; -get_thing_name(X) when is_record(X, id_of) -> get_thing_name(X#id_of.type); -get_thing_name(X) -> to_list(element(1,X)). - - -%% Returns the mode (in, out, oneway etc) of ops and params. Return -%% value is an atom. -get_mode(_G, _N, X) when is_record(X, op) -> - case X#op.oneway of - {oneway, _} -> 'OP_ONEWAY'; - _ -> 'OP_NORMAL' - end; -get_mode(_G, _N, X) when is_record(X, attr) -> - case X#attr.readonly of - {readonly, _} -> 'ATTR_READONLY'; - _ -> 'ATTR_NORMAL' - end; -get_mode(_G, _N, X) when is_record(X, param) -> - case X#param.inout of - {in, _} -> 'PARAM_IN'; - {inout, _} -> 'PARAM_INOUT'; - {out, _} -> 'PARAM_OUT' - end. - - -%% Returns a string form of idltype creation. -%%get_idltype_id(G, S, N, X, Id) -> -%% TK = ictype:tk_lookup(G, S, N, Id), -%% get_idltype_tk(G, S, N, TK). -get_idltype(G, S, N, X) -> - get_idltype_tk(G, S, N, ic_forms:get_tk(X)). -get_idltype_tk(G, _S, _N, TK) -> - io_lib:format("~p:~p(~s, ~p)", [orber_ifr, 'Repository_create_idltype', - ?IFRID(G), TK]). - -%% Returns a string form of typecode creation. This shall be found in -%% the type code symbol table. -%%get_typecode(G, S, N, X) -> typecode. -%%get_typecode(G, S, N, X) -> tk(G, S, N, get_type(X)). - - -%% Returns the string form of a list of parameters. -get_params(_G, _S, _N, []) -> ""; -get_params(G, S, N, L) -> - lists:foldl(fun(X, Acc) -> param2str(G, S, N, X)++", "++Acc end, - param2str(G, S, N, hd(L)), tl(L)). - - -%% Converts a parameter to a string. -param2str(G, S, N, X) -> - io_lib:format("~s{name=~p, type=~p, type_def=~s, mode=~p}~n", - ["#parameterdescription", get_id2(X), - ic_forms:get_tk(X), - %%tk_lookup(G, S, N, get_type(X)), - get_idltype(G, S, N, X), - get_mode(G, N, X)]). - - - - -%% Public interface. Returns the IFR ID of an object. This -%% is updated to comply with CORBA 2.0 pragma directives. -get_IR_ID(G, N, X) -> - ScopedId = [get_id2(X) | N], - case ic_pragma:get_alias(G,ScopedId) of - none -> - case ic_pragma:pragma_id(G, N, X) of - none -> - case ic_pragma:pragma_prefix(G, N, X) of - none -> - IR_ID = lists:flatten( - io_lib:format("IDL:~s:~s", - [slashify(ScopedId), - get_IR_VSN(G, N, X)])), - ic_pragma:mk_alias(G,IR_ID,ScopedId), - IR_ID; - PF -> - IR_ID = lists:flatten( - io_lib:format("IDL:~s:~s", - [ PF ++ "/" ++ - get_id2(X), - get_IR_VSN(G, N, X)])), - ic_pragma:mk_alias(G,IR_ID,ScopedId), - IR_ID - end; - PI -> - ic_pragma:mk_alias(G,PI,ScopedId), - PI - end; - Alias -> - Alias - end. - - -%% Public interface. Returns the IFR Version of an object. This -%% is updated to comply with CORBA 2.0 pragma directives. -get_IR_VSN(G, N, X) -> - ic_pragma:pragma_version(G,N,X). - - - - - -%% Returns a slashified name, [I1, M1] becomes "M1/I1" -%slashify(List) -> lists:foldl(fun(X, Acc) -> get_id2(X)++"/"++Acc end, -% hd(List), tl(List)). - -%% Returns a slashified name, [I1, M1] becomes "M1/I1" -slashify(List) -> lists:foldl(fun(X, Acc) -> X++"/"++Acc end, - hd(List), tl(List)). - - -%% Returns the context literals of an op -get_context(_G, _S, _N, X) -> - lists:map(fun(C) -> element(3, C) end, X#op.ctx). - - - -%% Returns the list of the exceptions of an operation -get_exceptions(G, S, N, X) -> - case X#op.raises of - [] -> - ""; - L -> - lists:flatten( - lists:foldl( - fun(E, Acc) -> [excdef(G, S, N, X, E), ", " | Acc] end, - excdef(G, S, N, X, hd(L)), - tl(L) - ) - ) - end. - - -%% Returns the definition of an exception of an operation -excdef(G, S, N, X, L) -> - io_lib:format("orber_ifr:lookup_id(~s,\"~s\")", - [ ?IFRID(G), - get_EXC_ID(G, S, N, X, L) ] ). - - - - - - -%% This function produces code for the exception registration. -%% It produces a string that represents a list of function calls. -%% This list becomes a list of object references when the main function -%% "orber_ifr:InterfaceDef_create_operation" is called. - -get_EXC_ID(G, _S, N, X, ScopedId) -> - case ic_pragma:get_alias(G,ScopedId) of - none -> - case ic_pragma:pragma_id(G, N, X) of - none -> - case ic_pragma:pragma_prefix(G, N, X) of - none -> - EXC_ID = lists:flatten( - io_lib:format("IDL:~s:~s", [slashify(ScopedId), - get_IR_VSN(G, N, X)])), - ic_pragma:mk_alias(G,EXC_ID,ScopedId), - EXC_ID; - PF -> - EXC_ID = lists:flatten( - io_lib:format("IDL:~s:~s", [ PF ++ "/" ++ - hd(ScopedId), - get_IR_VSN(G, N, X)])), - ic_pragma:mk_alias(G,EXC_ID,ScopedId), - EXC_ID - end; - PI -> - ic_pragma:mk_alias(G,PI,ScopedId), - PI - end; - Alias -> - Alias - end. - - - - - -%% unreg_gen/1 uses the information stored in pragma table -%% to decide which modules are to be unregistered -unreg_gen(G, N, X) -> - Light = ic_options:get_opt(G, light_ifr), - case ic_genobj:is_stubfile_open(G) of - true when Light == false -> - Var = ?IFRID(G), - Fd = ic_genobj:stubfiled(G), - nl(Fd), nl(Fd), nl(Fd), - emit(Fd, "~p() ->\n", [to_atom(unregister_name(G))]), - emit(Fd, " ~s = ~p:find_repository(),\n", - [Var, ?IFRMOD]), - nl(Fd), - - unreg2(G, N, X), - emit(Fd, " ok.\n\n"), - destroy(Fd); - true -> - Fd = ic_genobj:stubfiled(G), - nl(Fd), nl(Fd), - Unregname = to_atom(unregister_name(G)), - emit(Fd, "~p() ->\n\t~p([]).\n\n~p(OE_Options) ->\n", - [Unregname, Unregname, Unregname]), - emit(Fd, "\t~p:remove(?MODULE, OE_Options),\n\tok.\n\n", [?IFRMOD]); - false -> ok - end. - - -destroy(Fd) -> -emit(Fd," -oe_destroy_if_empty(OE_IFR,IFR_ID) -> - case orber_ifr:'Repository_lookup_id'(OE_IFR, IFR_ID) of - [] -> - ok; - Ref -> - case orber_ifr:contents(Ref, \'dk_All\', \'true\') of - [] -> - orber_ifr:destroy(Ref), - ok; - _ -> - ok - end - end. - -oe_destroy(OE_IFR,IFR_ID) -> - case orber_ifr:'Repository_lookup_id'(OE_IFR, IFR_ID) of - [] -> - ok; - Ref -> - orber_ifr:destroy(Ref), - ok - end. - -",[]). - - - - - - - - - - -%% unreg2 is top level registration - -unreg2(G, N, X) -> - emit(ic_genobj:stubfiled(G),"~s",[lists:flatten(unreg3(G, N, X))]). - -unreg3(G, N, X) when is_list(X) -> - unreg3_list(G, N, X, []); - -unreg3(G, N, X) when is_record(X, module) -> - unreg3_list(G, [get_id2(X) | N], get_body(X), [unreg_collect(G, N, X)]); - -unreg3(G, N, X) when is_record(X, const) -> - unreg_collect(G, N, X); - -unreg3(G, N, X) when is_record(X, struct) -> - unreg_collect(G, N, X); - -unreg3(G, N, X) when is_record(X, except) -> - unreg_collect(G, N, X); - -unreg3(G, N, X) when is_record(X, union) -> - unreg_collect(G, N, X); - -unreg3(G, N, X) when is_record(X, enum) -> - unreg_collect(G, N, X); - -unreg3(G, N, X) when is_record(X, typedef) -> - unreg_collect(G, N, X); - -unreg3(G, N, X) when is_record(X, interface) -> - unreg_collect(G, N, X); - -unreg3(_G, _N, X) when is_record(X, op) -> []; - -unreg3(_G, _N, X) when is_record(X, attr) -> []; - -unreg3(_G, _N, X) when is_record(X, preproc) -> []; - -unreg3(_G, _N, X) when is_record(X, pragma) -> []; - -unreg3(_G, _N, _X) -> []. - - -unreg3_list(_G, _N, [], Found) -> - Found; -unreg3_list(G, N, List, Found) -> - CurrentFileName = ic_genobj:idlfile(G), - unreg3_list(G, N, {CurrentFileName,true}, List, Found). - -%% The filter function + loop -unreg3_list(_G, _N, {_CFN, _Status}, [], Found) -> - Found; -unreg3_list(G, N, {CFN,Status}, [X | Xs], Found) -> - case Status of - true -> - case X of - {preproc,_,{_,_,_FileName},[{_,_,"1"}]} -> - unreg3_list(G, N, {CFN,false}, Xs, Found); - _ -> - unreg3_list(G, N, {CFN,Status}, Xs, [unreg3(G, N, X) | Found]) - end; - false -> - case X of - {preproc,_,{_,_,CFN},[{_,_,"2"}]} -> - unreg3_list(G, N, {CFN,true}, Xs,[unreg3(G, N, X) | Found]); - _ -> - unreg3_list(G, N, {CFN,Status}, Xs, Found) - end - end. - - - -unreg_collect(G, N, X) when is_record(X, module) -> - io_lib:format(" oe_destroy_if_empty(OE_IFR, ~p),\n", - [get_IR_ID(G, N, X)]); -unreg_collect(G, N, X) when is_record(X, typedef) -> - lists:map(fun(Id) -> - io_lib:format(" oe_destroy(OE_IFR, ~p),\n", - [get_IR_ID(G, N, Id)]) - end, - ic_forms:get_idlist(X)); -unreg_collect(G, N, X) -> - io_lib:format(" oe_destroy(OE_IFR, ~p),\n", - [get_IR_ID(G, N, X)]). - - - diff --git a/lib/ic/src/ictype.erl b/lib/ic/src/ictype.erl deleted file mode 100644 index eb6f2088d7..0000000000 --- a/lib/ic/src/ictype.erl +++ /dev/null @@ -1,1417 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(ictype). - - --include("ic.hrl"). --include("icforms.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([type_check/2, scoped_lookup/4, maybe_array/5, to_uppercase/1]). - --export([name2type/2, member2type/3, isBasicTypeOrEterm/3, isEterm/3]). --export([isBasicType/1, isBasicType/2, isBasicType/3, isString/3, isWString/3, - isArray/3, isStruct/3, isUnion/3, isEnum/3, isSequence/3, isBoolean/3 ]). --export([fetchTk/3, fetchType/1, tk/4]). -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% Macros -%%----------------------------------------------------------------- -%%-define(DBG(F,A), io:format(F,A)). --define(DBG(F,A), true). --define(STDDBG, ?DBG(" dbg: ~p: ~p~n", [element(1,X), ic_forms:get_id2(X)])). - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- - -type_check(G, Forms) -> - S = ic_genobj:tktab(G), - check_list(G, S, [], Forms). - -scoped_lookup(G, S, N, X) -> - Id = ic_symtab:scoped_id_strip(X), - case ic_symtab:scoped_id_is_global(X) of - true -> - lookup(G, S, [], X, Id); - false -> - lookup(G, S, N, X, Id) - end. - - -%%-------------------------------------------------------------------- -%% maybe_array -%% -%% Array declarators are indicated on the declarator and not on -%% the type, therefore the declarator decides if the array type -%% kind is added or not. -%% -maybe_array(G, S, N, X, TK) when is_record(X, array) -> - mk_array(G, S, N, X#array.size, TK); -maybe_array(_G, _S, _N, _, TK) -> TK. - - - -name2type(G, Name) -> - S = ic_genobj:tktab(G), - ScopedName = lists:reverse(string:tokens(Name, "_")), - InfoList = ets:lookup(S, ScopedName ), - filter( InfoList ). - - -%% This is en overloaded function, -%% differs in input on unions -member2type(_G, X, I) when is_record(X, union)-> - Name = ic_forms:get_id2(I), - case lists:keysearch(Name,2,element(6,X#union.tk)) of - false -> - error; - {value,Rec} -> - fetchType(element(3,Rec)) - end; -member2type( G, SName, MName ) -> - - S = ic_genobj:tktab( G ), - SNList = lists:reverse(string:tokens(SName,"_")), - ScopedName = [MName | SNList], - InfoList = ets:lookup( S, ScopedName ), - - case filter( InfoList ) of - error -> - %% Try a little harder, seeking inside tktab - case lookup_member_type_in_tktab(S, ScopedName, MName) of - error -> - %% Check if this is the "return to return1" case - case MName of - "return1" -> - %% Do it all over again ! - ScopedName2 = ["return" | SNList], - InfoList2 = ets:lookup( S, ScopedName2 ), - case filter( InfoList2 ) of - error -> - %% Last resort: seek in pragma table - lookup_type_in_pragmatab(G, SName); - - Other -> - Other - end; - _ -> - %% Last resort: seek in pragma table - lookup_type_in_pragmatab(G, SName) - end; - Other -> - Other - end; - Other -> - Other - end. - - -lookup_member_type_in_tktab(S, ScopedName, MName) -> - case ets:match_object(S, {'_',member,{MName,'_'},nil}) of - [] -> - error; - [{_FullScopedName,member,{MName,TKInfo},nil}]-> - fetchType( TKInfo ); - List -> - lookup_member_type_in_tktab(List,ScopedName) - end. - -lookup_member_type_in_tktab([], _ScopedName) -> - error; -lookup_member_type_in_tktab([{FullScopedName,_,{_,TKInfo},_}|Rest],ScopedName) -> - case lists:reverse(string:tokens(ic_util:to_undersc(FullScopedName),"_")) of - ScopedName -> - fetchType(TKInfo); - _ -> - lookup_member_type_in_tktab(Rest,ScopedName) - end. - - -lookup_type_in_pragmatab(G, SName) -> - S = ic_genobj:pragmatab(G), - - %% Look locally first - case ets:match(S,{file_data_local,'_','_','$2','_','_',SName,'_','_'}) of - [] -> - %% No match, seek included - case ets:match(S,{file_data_included,'_','_','$2','_','_',SName,'_','_'}) of - - [] -> - error; - [[Type]] -> - io:format("1 Found(~p) : ~p~n",[SName,Type]), - Type - end; - - [[Type]] -> - io:format("2 Found(~p) : ~p~n",[SName,Type]), - Type - end. - - - - -isString(G, N, T) when element(1, T) == scoped_id -> - case ic_symtab:get_full_scoped_name(G, N, T) of - {_FullScopedName, _, {'tk_string',_}, _} -> - true; - _ -> - false - end; -isString(_G, _N, T) when is_record(T, string) -> - true; -isString(_G, _N, _Other) -> - false. - - -isWString(G, N, T) when element(1, T) == scoped_id -> %% WSTRING - case ic_symtab:get_full_scoped_name(G, N, T) of - {_FullScopedName, _, {'tk_wstring',_}, _} -> - true; - _ -> - false - end; -isWString(_G, _N, T) when is_record(T, wstring) -> - true; -isWString(_G, _N, _Other) -> - false. - - -isArray(G, N, T) when element(1, T) == scoped_id -> - case ic_symtab:get_full_scoped_name(G, N, T) of - {_FullScopedName, _, {'tk_array', _, _}, _} -> - true; - _ -> - false - end; -isArray(_G, _N, T) when is_record(T, array) -> - true; -isArray(_G, _N, _Other) -> - false. - - -isSequence(G, N, T) when element(1, T) == scoped_id -> - case ic_symtab:get_full_scoped_name(G, N, T) of - {_FullScopedName, _, {'tk_sequence', _, _}, _} -> - true; - _ -> - false - end; -isSequence(_G, _N, T) when is_record(T, sequence) -> - true; -isSequence(_G, _N, _Other) -> - false. - - -isStruct(G, N, T) when element(1, T) == scoped_id -> - case ic_symtab:get_full_scoped_name(G, N, T) of - {_FullScopedName, _, {'tk_struct', _, _, _}, _} -> - true; - _ -> - false - end; -isStruct(_G, _N, T) when is_record(T, struct) -> - true; -isStruct(_G, _N, _Other) -> - false. - - -isUnion(G, N, T) when element(1, T) == scoped_id -> - case ic_symtab:get_full_scoped_name(G, N, T) of - {_FullScopedName, _, {'tk_union', _, _, _,_,_}, _} -> - true; - _Other -> - false - end; -isUnion(_G, _N, T) when is_record(T, union) -> - true; -isUnion(_G, _N, _Other) -> - false. - - - -isEnum(G, N, T) when element(1, T) == scoped_id -> - case ic_symtab:get_full_scoped_name(G, N, T) of - {_FullScopedName, _, {'tk_enum',_,_,_}, _} -> - true; - _Other -> - false - end; -isEnum(_G, _N, T) when is_record(T, enum) -> - true; -isEnum(_G, _N, _Other) -> - false. - - - -isBoolean(G, N, T) when element(1, T) == scoped_id -> - {_, _, TK, _} = - ic_symtab:get_full_scoped_name(G, N, T), - case fetchType(TK) of - 'boolean' -> - true; - _ -> - false - end; -isBoolean(_, _, {'tk_boolean',_}) -> - true; -isBoolean(_, _, {'boolean',_}) -> - true; -isBoolean(_, _, _) -> - false. - - -%%% Just used for C - -isBasicTypeOrEterm(G, N, S) -> - case isBasicType(G, N, S) of - true -> - true; - false -> - isEterm(G, N, S) - end. - -isEterm(G, N, S) when element(1, S) == scoped_id -> - {FullScopedName, _, _TK, _} = ic_symtab:get_full_scoped_name(G, N, S), - case ic_code:get_basetype(G, ic_util:to_undersc(FullScopedName)) of - "erlang_term" -> - true; - "ETERM*" -> - true; - _X -> - false - end; -isEterm(_G, _Ni, _X) -> - false. - -isBasicType(_G, _N, {scoped_id,_,_,["term","erlang"]}) -> - false; -isBasicType(G, N, S) when element(1, S) == scoped_id -> - {_, _, TK, _} = ic_symtab:get_full_scoped_name(G, N, S), - isBasicType(fetchType(TK)); -isBasicType(_G, _N, {string, _} ) -> - false; -isBasicType(_G, _N, {wstring, _} ) -> %% WSTRING - false; -isBasicType(_G, _N, {unsigned, {long, _}} ) -> - true; -isBasicType(_G, _N, {unsigned, {short, _}} ) -> - true; -isBasicType(_G, _N, {Type, _} ) -> - isBasicType(Type); -isBasicType(_G, _N, _X) -> - false. - - -isBasicType( G, Name ) -> - isBasicType( name2type( G, Name ) ). - - -isBasicType( Type ) -> - lists:member(Type, - [tk_short,short, - tk_long,long, - tk_longlong,longlong, %% LLONG - tk_ushort,ushort, - tk_ulong,ulong, - tk_ulonglong,ulonglong, %% ULLONG - tk_float,float, - tk_double,double, - tk_boolean,boolean, - tk_char,char, - tk_wchar,wchar, %% WCHAR - tk_octet,octet, - tk_any,any]). %% Fix for any - - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- -check(G, _S, N, X) when is_record(X, preproc) -> - handle_preproc(G, N, X#preproc.cat, X), - X; - -check(G, S, N, X) when is_record(X, op) -> - ?STDDBG, - TK = tk_base(G, S, N, ic_forms:get_type(X)), - tktab_add(G, S, N, X), - N2 = [ic_forms:get_id2(X) | N], - Ps = lists:map(fun(P) -> - tktab_add(G, S, N2, P), - P#param{tk=tk_base(G, S, N, ic_forms:get_type(P))} end, - X#op.params), - %% Check for exception defs. - Raises = lists:map(fun(E) -> name_lookup(G, S, N, E) end, - X#op.raises), - case ic_forms:is_oneway(X) of - true -> - if TK /= tk_void -> - ic_error:error(G, {bad_oneway_type, X, TK}); - true -> ok - end, - case ic:filter_params([inout, out], X#op.params) of - [] -> ok; % No out parameters! - _ -> - ic_error:error(G, {oneway_outparams, X}) - end, - case X#op.raises of - [] -> ok; - _ -> - ic_error:error(G, {oneway_raises, X}) - end; - false -> - ok - end, - X#op{params=Ps, tk=TK, raises=Raises}; - -check(G, S, N, X) when is_record(X, interface) -> - ?STDDBG, - N2 = [ic_forms:get_id2(X) | N], - TK = {tk_objref, ictk:get_IR_ID(G, N, X), ic_forms:get_id2(X)}, - Inherit = inherit_resolve(G, S, N, X#interface.inherit, []), - tktab_add(G, S, N, X, TK, Inherit), - CheckedBody = check_list(G, S, N2, ic_forms:get_body(X)), - InhBody = calc_inherit_body(G, N2, CheckedBody, Inherit, []), - X2 = X#interface{inherit=Inherit, tk=TK, body=CheckedBody, - inherit_body=InhBody}, - ic_symtab:store(G, N, X2), - X2; - -check(G, S, N, X) when is_record(X, forward) -> - ?STDDBG, - tktab_add(G, S, N, X, {tk_objref, ictk:get_IR_ID(G, N, X), ic_forms:get_id2(X)}), - X; - -check(G, S, N, #constr_forward{tk = tk_struct} = X) -> - ?STDDBG, - ID = ic_forms:get_id2(X), - Module = list_to_atom(string:join(lists:reverse([ID|N]), "_")), - tktab_add(G, S, N, X, {tk_struct, ictk:get_IR_ID(G, N, X), ID, Module}), - X; -check(G, S, N, #constr_forward{tk = tk_union} = X) -> - ?STDDBG, - ID = ic_forms:get_id2(X), - Module = list_to_atom(string:join(lists:reverse([ID|N]), "_")), - tktab_add(G, S, N, X, {tk_union, ictk:get_IR_ID(G, N, X), ID, [], [], Module}), - X; - -check(G, S, N, X) when is_record(X, const) -> - ?STDDBG, - case tk_base(G, S, N, ic_forms:get_type(X)) of - Err when element(1, Err) == error -> X; - TK -> - check_const_tk(G, S, N, X, TK), - case iceval:eval_const(G, S, N, TK, X#const.val) of - Err when element(1, Err) == error -> X; - {ok, NewTK, Val} -> - V = iceval:get_val(Val), - tktab_add(G, S, N, X, NewTK, V), - X#const{val=V, tk=NewTK}; - Val -> - V = iceval:get_val(Val), - tktab_add(G, S, N, X, TK, V), - X#const{val=V, tk=TK} - end - end; - -check(G, S, N, X) when is_record(X, except) -> - ?STDDBG, - TK = tk(G, S, N, X), - X#except{tk=TK}; - -check(G, S, N, X) when is_record(X, struct) -> - ?STDDBG, - TK = tk(G, S, N, X), - X#struct{tk=TK}; - -check(G, S, N, X) when is_record(X, enum) -> - ?STDDBG, - TK = tk(G, S, N, X), - X#enum{tk=TK}; - -check(G, S, N, X) when is_record(X, union) -> - ?STDDBG, - TK = tk(G, S, N, X), - X#union{tk=TK}; - -check(G, S, N, X) when is_record(X, attr) -> - ?STDDBG, - TK = tk_base(G, S, N, ic_forms:get_type(X)), - XX = #id_of{type=X}, - lists:foreach(fun(Id) -> tktab_add(G, S, N, XX#id_of{id=Id}) end, - ic_forms:get_idlist(X)), - X#attr{tk=TK}; - -check(G, S, N, X) when is_record(X, module) -> - ?STDDBG, - tktab_add(G, S, N, X), - X#module{body=check_list(G, S, [ic_forms:get_id2(X) | N], ic_forms:get_body(X))}; - -check(G, S, N, X) when is_record(X, typedef) -> - ?STDDBG, - TKbase = tk(G, S, N, X), - X#typedef{tk=TKbase}; - -check(_G, _S, _N, X) -> - ?DBG(" dbg: ~p~n", [element(1,X)]), - X. - -handle_preproc(G, _N, line_nr, X) -> ic_genobj:set_idlfile(G, ic_forms:get_id2(X)); -handle_preproc(_G, _N, _C, _X) -> ok. - - -%%-------------------------------------------------------------------- -%% -%% TK calculation -%% -%%-------------------------------------------------------------------- - -tk(G, S, N, X) when is_record(X, union) -> - N2 = [ic_forms:get_id2(X) | N], - DisrcTK = tk(G, S, N, ic_forms:get_type(X)), - case check_switch_tk(G, S, N, X, DisrcTK) of - true -> - do_special_enum(G, S, N2, ic_forms:get_type(X)), - BodyTK = lists:reverse( - tk_caselist(G, S, N2, DisrcTK, ic_forms:get_body(X))), - tktab_add(G, S, N, X, - {tk_union, ictk:get_IR_ID(G, N, X), ic_forms:get_id2(X), - DisrcTK, default_count(ic_forms:get_body(X)), BodyTK}); - false -> - tk_void - end; - -tk(G, S, N, X) when is_record(X, enum) -> - N2 = [ic_forms:get_id2(X) | N], - tktab_add(G, S, N, X, - {tk_enum, ictk:get_IR_ID(G, N, X), ic_forms:get_id2(X), - enum_body(G, S, N2, ic_forms:get_body(X))}); - - -%% Note that the TK returned from this function is the base TK. It -%% must be modified for each of the identifiers in the idlist (for -%% array reasons). -tk(G, S, N, X) when is_record(X, typedef) -> - case X of - %% Special case only for term and java backend ! - {typedef,{any,_},[{'',_,"term"}],undefined} -> - case ic_options:get_opt(G, be) of - java -> - tktab_add(G, S, N, X, tk_term), - tk_term; - _ -> - TK = tk(G, S, N, ic_forms:get_body(X)), - lists:foreach(fun(Id) -> - tktab_add(G, S, N, #id_of{id=Id, type=X}, - maybe_array(G, S, N, Id, TK)) - end, - X#typedef.id), - TK - end; - _ -> - TK = tk(G, S, N, ic_forms:get_body(X)), - lists:foreach(fun(Id) -> - tktab_add(G, S, N, #id_of{id=Id, type=X}, - maybe_array(G, S, N, Id, TK)) - end, - X#typedef.id), - TK - end; - -tk(G, S, N, X) when is_record(X, struct) -> - N2 = [ic_forms:get_id2(X) | N], - tktab_add(G, S, N, X, {tk_struct, ictk:get_IR_ID(G, N, X), ic_forms:get_id2(X), - tk_memberlist(G, S, N2, ic_forms:get_body(X))}); - -tk(G, S, N, X) when is_record(X, except) -> - N2 = [ic_forms:get_id2(X) | N], - tktab_add(G, S, N, X, {tk_except, ictk:get_IR_ID(G, N, X), ic_forms:get_id2(X), - tk_memberlist(G, S, N2, ic_forms:get_body(X))}); - -tk(G, S, N, X) -> tk_base(G, S, N, X). - - -tk_base(G, S, N, X) when is_record(X, sequence) -> - {tk_sequence, tk(G, S, N, X#sequence.type), - len_eval(G, S, N, X#sequence.length)}; - -tk_base(G, S, N, X) when is_record(X, string) -> - {tk_string, len_eval(G, S, N, X#string.length)}; - -tk_base(G, S, N, X) when is_record(X, wstring) -> %% WSTRING - {tk_wstring, len_eval(G, S, N, X#wstring.length)}; - -%% Fixed constants can be declared as: -%% (1) const fixed pi = 3.14D; or -%% (2) typedef fixed<3,2> f32; -%% const f32 pi = 3.14D; -tk_base(G, S, N, X) when is_record(X, fixed) -> - %% Case 2 - {tk_fixed, len_eval(G, S, N, X#fixed.digits), len_eval(G, S, N, X#fixed.scale)}; -tk_base(_G, _S, _N, {fixed, _}) -> - %% Case 1 - tk_fixed; - - -%% Special case, here CORBA::TypeCode is built in -%% ONLY when erl_corba is the backend of choice -tk_base(G, S, N, {scoped_id,V1,V2,["TypeCode","CORBA"]}) -> - case ic_options:get_opt(G, be) of - false -> - tk_TypeCode; - erl_corba -> - tk_TypeCode; - erl_template -> - tk_TypeCode; - _ -> - case scoped_lookup(G, S, N, {scoped_id,V1,V2,["TypeCode","CORBA"]}) of - T when element(1, T) == error -> T; - T when is_tuple(T) -> element(3, T) - end - end; - -tk_base(G, S, N, X) when element(1, X) == scoped_id -> - case scoped_lookup(G, S, N, X) of - T when element(1, T) == error -> T; - T when is_tuple(T) -> element(3, T) - end; -tk_base(_G, _S, _N, {long, _}) -> tk_long; -tk_base(_G, _S, _N, {'long long', _}) -> tk_longlong; %% LLONG -tk_base(_G, _S, _N, {short, _}) -> tk_short; -tk_base(_G, _S, _N, {'unsigned', {short, _}}) -> tk_ushort; -tk_base(_G, _S, _N, {'unsigned', {long, _}}) -> tk_ulong; -tk_base(_G, _S, _N, {'unsigned', {'long long', _}})-> tk_ulonglong; %% ULLONG -tk_base(_G, _S, _N, {float, _}) -> tk_float; -tk_base(_G, _S, _N, {double, _}) -> tk_double; -tk_base(_G, _S, _N, {boolean, _}) -> tk_boolean; -tk_base(_G, _S, _N, {char, _}) -> tk_char; -tk_base(_G, _S, _N, {wchar, _}) -> tk_wchar; %% WCHAR -tk_base(_G, _S, _N, {octet, _}) -> tk_octet; -tk_base(_G, _S, _N, {null, _}) -> tk_null; -tk_base(_G, _S, _N, {void, _}) -> tk_void; -tk_base(_G, _S, _N, {any, _}) -> tk_any; -tk_base(_G, _S, _N, {'Object', _}) -> {tk_objref, "", "Object"}. - - -%%-------------------------------------------------------------------- -%% -%% Special handling of idlists. Note that the recursion case is given -%% as accumulator to foldr. Idlists are those lists of identifiers -%% that share the same definition, i.e. multiple cases, multiple type -%% declarations, multiple member names. -%% -tk_memberlist(G, S, N, [X | Xs]) -> - BaseTK = tk(G, S, N, ic_forms:get_type(X)), - - XX = #id_of{type=X}, - lists:foldr(fun(Id, Acc) -> - [tk_member(G, S, N, XX#id_of{id=Id}, BaseTK) | Acc] end, - tk_memberlist(G, S, N, Xs), - ic_forms:get_idlist(X)); -tk_memberlist(_G, _S, _N, []) -> []. - -%% same as above but for case dcls -tk_caselist(G, S, N, DiscrTK, Xs) -> - lists:foldl(fun(Case, Acc) -> - BaseTK = tk(G, S, N, ic_forms:get_type(Case)), - %% tktab_add for the uniqueness check of the declarator - tktab_add(G, S, N, Case), - lists:foldl(fun(Id, Acc2) -> - case tk_case(G, S, N, Case, BaseTK, - DiscrTK, Id) of - Err when element(1, Err)==error -> - Acc2; - TK -> - unique_add_case_label(G, S, N, Id, - TK, Acc2) - end - end, - Acc, - ic_forms:get_idlist(Case)) - end, - [], - Xs). - - -%% Handling of the things that can be in an idlist or caselist -tk_member(G, S, N, X, BaseTK) -> - tktab_add(G, S, N, X, - {ic_forms:get_id2(X), maybe_array(G, S, N, X#id_of.id, BaseTK)}). - - -get_case_id_and_check(G, _S, _N, _X, ScopedId) -> - case ic_symtab:scoped_id_is_global(ScopedId) of - true -> ic_error:error(G, {bad_scope_enum_case, ScopedId}); - false -> ok - end, - case ic_symtab:scoped_id_strip(ScopedId) of - [Id] -> Id; - _List -> - ic_error:error(G, {bad_scope_enum_case, ScopedId}), - "" - end. - - -tk_case(G, S, N, X, BaseTK, DiscrTK, Id) -> - case case_eval(G, S, N, DiscrTK, Id) of - Err when element(1, Err) == error -> Err; - Val -> - case iceval:check_tk(G, DiscrTK, Val) of - true -> - {iceval:get_val(Val), ic_forms:get_id2(X), - maybe_array(G, S, N, X#case_dcl.id, BaseTK)}; - false -> - ic_error:error(G, {bad_case_type, DiscrTK, X, - iceval:get_val(Val)}) - end - end. - -tktab_add(G, S, N, X) -> - tktab_add_id(G, S, N, X, ic_forms:get_id2(X), nil, nil). -tktab_add(G, S, N, X, TK) -> - tktab_add_id(G, S, N, X, ic_forms:get_id2(X), TK, nil). -tktab_add(G, S, N, X, TK, Aux) -> - tktab_add_id(G, S, N, X, ic_forms:get_id2(X), TK, Aux). - - -tktab_add_id(G, S, N, X, Id, TK, Aux) when is_record(X,enumerator) -> - - %% Check if the "scl" flag is set to true - %% if so, allow old semantics ( errornous ) - %% Warning, this is for compatibility reasons only. - Name = case ic_options:get_opt(G, scl) of - true -> - [Id | N]; - false -> - [Id | tl(N)] - end, - - UName = mk_uppercase(Name), - case ets:lookup(S, Name) of - [_] -> ic_error:error(G, {multiply_defined, X}); - [] -> - case ets:lookup(S, UName) of - [] -> ok; - [_] -> ic_error:error(G, {illegal_spelling, X}) - end - end, - ets:insert(S, {Name, element(1, get_beef(X)), TK, Aux}), - if UName =/= Name -> ets:insert(S, {UName, spellcheck}); - true -> true end, - TK; -%% -%% Fixes the multiple file module definition check -%% but ONLY for Corba backend -%% -tktab_add_id(G, S, N, X, Id, TK, Aux) when is_record(X,module) -> - case ic_options:get_opt(G, be) of - erl_template -> - Name = [Id | N], - UName = mk_uppercase(Name), - ets:insert(S, {Name, element(1, get_beef(X)), TK, Aux}), - if UName =/= Name -> ets:insert(S, {UName, spellcheck}); - true -> true end, - TK; - erl_corba -> - Name = [Id | N], - UName = mk_uppercase(Name), - ets:insert(S, {Name, element(1, get_beef(X)), TK, Aux}), - if UName =/= Name -> ets:insert(S, {UName, spellcheck}); - true -> true end, - TK; - false -> %% default == erl_corba - Name = [Id | N], - UName = mk_uppercase(Name), - ets:insert(S, {Name, element(1, get_beef(X)), TK, Aux}), - if UName =/= Name -> ets:insert(S, {UName, spellcheck}); - true -> true end, - TK; - java -> - Name = [Id | N], - UName = mk_uppercase(Name), - ets:insert(S, {Name, element(1, get_beef(X)), TK, Aux}), - if UName =/= Name -> ets:insert(S, {UName, spellcheck}); - true -> true end, - TK; - erl_genserv -> - Name = [Id | N], - UName = mk_uppercase(Name), - ets:insert(S, {Name, element(1, get_beef(X)), TK, Aux}), - if UName =/= Name -> ets:insert(S, {UName, spellcheck}); - true -> true end, - TK; - erl_plain -> - Name = [Id | N], - UName = mk_uppercase(Name), - ets:insert(S, {Name, element(1, get_beef(X)), TK, Aux}), - if UName =/= Name -> ets:insert(S, {UName, spellcheck}); - true -> true end, - TK; - _Be -> - Name = [Id | N], - UName = mk_uppercase(Name), - case ets:lookup(S, Name) of - [_] -> ic_error:error(G, {multiply_defined, X}); - [] -> - case ets:lookup(S, UName) of - [] -> ok; - [_] -> ic_error:error(G, {illegal_spelling, X}) - end - end, - ets:insert(S, {Name, element(1, get_beef(X)), TK, Aux}), - if UName =/= Name -> ets:insert(S, {UName, spellcheck}); - true -> true end, - TK - end; -tktab_add_id(G, S, N, X, Id, TK, Aux) -> - Name = [Id | N], - UName = mk_uppercase(Name), - case ets:lookup(S, Name) of - [{_, forward, _, _}] when is_record(X, interface) -> - ok; - [{_, constr_forward, _, _}] when is_record(X, union) orelse - is_record(X, struct) -> - ok; - [XX] when is_record(X, forward) andalso element(2, XX)==interface -> - ok; - [_] -> - ic_error:error(G, {multiply_defined, X}); - [] -> - case ets:lookup(S, UName) of - [] -> ok; - [_] -> ic_error:error(G, {illegal_spelling, X}) - end - end, - ets:insert(S, {Name, element(1, get_beef(X)), TK, Aux}), - if UName =/= Name -> ets:insert(S, {UName, spellcheck}); - true -> true end, - TK. - - - - -%%-------------------------------------------------------------------- -%% enum_body -%% -%% Special because ids are treated different than usual. -%% -enum_body(G, S, N, [Enum | EnumList]) -> - tktab_add(G, S, N, Enum), %%%, enum_val, Enum), - %% tktab_add(G, S, N, X, TK, V), - [ic_forms:get_id2(Enum) | enum_body(G, S, N, EnumList)]; -enum_body(_G, _S, _N, []) -> []. - - -%%-------------------------------------------------------------------- -%% mk_array -%% -%% Multi dimensional arrays are written as nested tk_array -%% -mk_array(G, S, N, [Sz | Szs], TK) -> - case iceval:eval_const(G, S, N, positive_int, Sz) of - Err when element(1, Err) == error -> TK; - Val -> - {tk_array, mk_array(G, S, N, Szs, TK), iceval:get_val(Val)} - end; -mk_array(_G, _S, _N, [], TK) -> TK. - - -%%-------------------------------------------------------------------- -%% len_eval -%% -%% Evaluates the length, which in case it has been left out is a -%% plain 0 (zero) -%% -len_eval(_G, _S, _N, 0) -> 0; -len_eval(G, S, N, X) -> %%iceval:eval_const(G, S, N, positive_int, X). - case iceval:eval_const(G, S, N, positive_int, X) of - Err when element(1, Err) == error -> 0; - Val -> iceval:get_val(Val) - end. - - -%%-------------------------------------------------------------------- -%% case_eval -%% -%% Evaluates the case label. -%% - -case_eval(G, S, N, DiscrTK, X) when element(1, DiscrTK) == tk_enum, - element(1, X) == scoped_id -> - {tk_enum, _, _, Cases} = DiscrTK, - Id = get_case_id_and_check(G, S, N, X, X), - %%io:format("Matching: ~p to ~p~n", [Id, Cases]), - case lists:member(Id, Cases) of - true -> - {enum_id, Id}; - false -> - iceval:mk_val(scoped_lookup(G, S, N, X)) % Will generate error - end; - -case_eval(G, S, N, DiscrTK, X) -> - iceval:eval_e(G, S, N, DiscrTK, X). - - -%% The enum declarator is in the union scope. -do_special_enum(G, S, N, X) when is_record(X, enum) -> - tktab_add(G, S, N, #id_of{id=X#enum.id, type=X}); -do_special_enum(_G, _S, _N, _X) -> - ok. - - -unique_add_case_label(G, _S, _N, Id, TK, TKList) -> -%%%io:format("check_case_labels: TK:~p TKLIST:~p ~n", [TK, TKList]), - if element(1, TK) == error -> - TKList; - true -> - case lists:keysearch(element(1, TK), 1, TKList) of - {value, _} -> - ic_error:error(G, {multiple_cases, Id}), - TKList; - false -> - [TK | TKList] - end - end. - - -%%-------------------------------------------------------------------- -%% default_count -%% -%% Returns the position of the default case. -%% -%% Modified for OTP-2007 -%% -default_count(Xs) -> - default_count2(Xs, 0). - -default_count2([X | Xs], N) -> default_count3(X#case_dcl.label, Xs, N); -default_count2([], _) -> -1. - -default_count3([{default, _} | _Ys], _Xs, N) -> N; -default_count3([_ | Ys], Xs, N) -> default_count3(Ys, Xs, N+1); -default_count3([], Xs, N) -> default_count2(Xs, N). - - - - -%% -%% Type checks. -%% -%% Check constant type references (only for the scoped id case, others -%% are caught by the BNF) -%% -check_const_tk(_G, _S, _N, _X, tk_long) -> true; -check_const_tk(_G, _S, _N, _X, tk_longlong) -> true; %% LLONG -check_const_tk(_G, _S, _N, _X, tk_short) -> true; -check_const_tk(_G, _S, _N, _X, tk_ushort) -> true; -check_const_tk(_G, _S, _N, _X, tk_ulong) -> true; -check_const_tk(_G, _S, _N, _X, tk_ulonglong) -> true; %% ULLONG -check_const_tk(_G, _S, _N, _X, tk_float) -> true; -check_const_tk(_G, _S, _N, _X, tk_double) -> true; -check_const_tk(_G, _S, _N, _X, tk_boolean) -> true; -check_const_tk(_G, _S, _N, _X, tk_char) -> true; -check_const_tk(_G, _S, _N, _X, tk_wchar) -> true; %% WCHAR -check_const_tk(_G, _S, _N, _X, tk_octet) -> true; -check_const_tk(_G, _S, _N, _X, {tk_string, _Len}) -> true; -check_const_tk(_G, _S, _N, _X, {tk_wstring, _Len}) -> true; %% WSTRING -check_const_tk(_G, _S, _N, _X, tk_fixed) -> true; -check_const_tk(_G, _S, _N, _X, {tk_fixed, _Digits, _Scale}) -> true; -check_const_tk(G, _S, _N, X, TK) -> ic_error:error(G, {illegal_const_t, X, TK}). - - -check_switch_tk(_G, _S, _N, _X, tk_long) -> true; -check_switch_tk(_G, _S, _N, _X, tk_longlong) -> true; %% LLONG -check_switch_tk(_G, _S, _N, _X, tk_short) -> true; -check_switch_tk(_G, _S, _N, _X, tk_ushort) -> true; -check_switch_tk(_G, _S, _N, _X, tk_ulong) -> true; -check_switch_tk(_G, _S, _N, _X, tk_ulonglong) -> true; %% ULLONG -check_switch_tk(_G, _S, _N, _X, tk_boolean) -> true; -check_switch_tk(_G, _S, _N, _X, tk_char) -> true; -check_switch_tk(_G, _S, _N, _X, tk_wchar) -> true; %% WCHAR -check_switch_tk(_G, _S, _N, _X, TK) when element(1, TK) == tk_enum -> true; -check_switch_tk(G, _S, _N, X, TK) -> ic_error:error(G, {illegal_switch_t, X, TK}), - false. - - - -%% Lookup a name -name_lookup(G, S, N, X) -> - case scoped_lookup(G, S, N, X) of - T when is_tuple(T) -> element(1, T) - end. - - -lookup(G, S, N, X, Id) -> - N2 = Id ++ N, - ?DBG(" Trying ~p ...~n", [N2]), - case ets:lookup(S, N2) of - [] -> - case look_for_interface(G, S, [hd(N2)], tl(N2)) of - - %% First attempt: filtering inherited members ! - [{_, member, _, _}] -> - case look_for_interface(G, S, [hd(N)], tl(N2)) of - [T] -> - ?DBG(" -- found ~p~n", [T]), - T; - _ -> - lookup(G, S, tl(N), X, Id) - end; - %% - - [T] -> - ?DBG(" -- found ~p~n", [T]), - T; - - _ -> - if N == [] -> - ic_error:error(G, {tk_not_found, X}); - true -> - lookup(G, S, tl(N), X, Id) - end - - end; - - %% Second attempt: filtering members ! - [{_, member, _, _}] -> - case look_for_interface(G, S, [hd(N2)], tl(N2)) of - [T] -> - ?DBG(" -- found ~p~n", [T]), - T; - _ -> - if N == [] -> - ic_error:error(G, {tk_not_found, X}); - true -> - lookup(G, S, tl(N), X, Id) - end - end; - %% - [T] -> - ?DBG(" -- found ~p~n", [T]), - T - end. - - -look_for_interface(_G, _S, _Hd, []) -> - false; -look_for_interface(G, S, Hd, Tl) -> - case ets:lookup(S, Tl) of - [{_, interface, _TK, Inh}] -> - case look_in_inherit(G, S, Hd, Inh) of - %% gather_inherit(G, S, Inh, [])) of - [X] when is_tuple(X) -> - [X]; - _ -> - look_for_interface(G, S, Hd ++ [hd(Tl)], tl(Tl)) - end; - _ -> - look_for_interface(G, S, Hd ++ [hd(Tl)], tl(Tl)) - end. - -look_in_inherit(G, S, Id, [I | Is]) -> - case ets:lookup(S, Id ++ I) of - [X] when is_tuple(X) -> - [X]; - [] -> - look_in_inherit(G, S, Id, Is) - end; -look_in_inherit(_G, _S, _Id, []) -> - false. - - -%% L is a list of names -mk_uppercase(L) -> - lists:map(fun(Z) -> lists:map(fun(X) when X>=$a, X=<$z -> X-$a+$A; - (X) -> X end, Z) end, L). - - -%%-------------------------------------------------------------------- -%% -%% Inheritance stuff -%% -%% -%%-------------------------------------------------------------------- - -%% InhBody is an accumulating parameter - -calc_inherit_body(G, N, OrigBody, [X|Xs], InhBody) -> - case ic_symtab:retrieve(G, X) of - Intf when is_record(Intf, interface) -> - Body = filter_body(G, X, ic_forms:get_body(Intf), N, OrigBody, InhBody), - calc_inherit_body(G, N, OrigBody, Xs, [{X, Body} | InhBody]); - XXX -> - io:format("Oops, not found ~p~n", [XXX]), - calc_inherit_body(G, N, OrigBody, Xs, InhBody) - end; -calc_inherit_body(_G, _N, _OrigBody, [], InhBody) -> lists:reverse(InhBody). - - -filter_body(G, XPath, [X | Xs], OrigPath, OrigBody, InhBody) -> - case complex_body_member(G, XPath, X, OrigPath, OrigBody, InhBody) of - true -> - %%io:format("NOT adding ~p~n", [ic_forms:get_id2(X)]), - filter_body(G, XPath, Xs, OrigPath, OrigBody, InhBody); - {false, NewX} -> % For those with idlist - %%io:format("Adding from idlist~n", []), - [NewX | filter_body(G, XPath, Xs, OrigPath, OrigBody, InhBody)]; - false -> - %%io:format("Adding: ~p~n", [ic_forms:get_id2(X)]), - [X | filter_body(G, XPath, Xs, OrigPath, OrigBody, InhBody)] - end; -filter_body(_G, _XPath, [], _OrigPath, _OrigBody, _InhBody) -> []. - - -complex_body_member(G, XPath, X, OrigPath, OrigBody, InhBody) -> - case has_idlist(X) of - true -> - idlist_member(G, XPath, X, OrigPath, OrigBody, InhBody); - false -> - straight_member(G, XPath, X, OrigPath, OrigBody, InhBody) - end. - - -idlist_member(G, XPath, X, OrigPath, OrigBody, InhBody) -> - XX = #id_of{type=X}, - F = fun(Id) -> - not(straight_member(G, XPath, XX#id_of{id=Id}, OrigPath, - OrigBody, InhBody)) - end, - case lists:filter(F, ic_forms:get_idlist(X)) of - [] -> - true; - IdList -> -%%% io:format("Idlist added: ~p~n",[IdList]), - {false, replace_idlist(X, IdList)} - end. - - -straight_member(G, XPath, X, OrigPath, OrigBody, InhBody) -> - %%io:format("straight member: ~p~n", [ic_forms:get_id2(X)]), - case body_member(G, XPath, X, OrigPath, OrigBody) of - true -> - true; - false -> - inh_body_member(G, XPath, X, InhBody) - end. - - -inh_body_member(G, XPath, X, [{Name, Body} | InhBody]) -> - case body_member(G, XPath, X, Name, Body) of - true -> - true; - false -> - inh_body_member(G, XPath, X, InhBody) - end; -inh_body_member(_G, _XPath, _X, []) -> false. - - -body_member(G, XPath, X, YPath, [Y|Ys]) -> - case has_idlist(Y) of - true -> - YY = #id_of{type=Y}, - case list_and(fun(Y2) -> - not(is_equal(G, XPath, X, YPath, - YY#id_of{id=Y2})) end, - ic_forms:get_idlist(Y)) of - true -> - body_member(G, XPath, X, YPath, Ys); - false -> - true - end; - false -> - case is_equal(G, XPath, X, YPath, Y) of - false -> - body_member(G, XPath, X, YPath, Ys); - true -> - true - end - end; -body_member(_G, _XPath, _X, _YPath, []) -> false. - - -is_equal(G, XPath, X, YPath, Y) -> - case {ic_forms:get_id2(X), ic_forms:get_id2(Y)} of - {ID, ID} -> - collision(G, XPath, X, YPath, Y), - true; - _ -> - false - end. - - -%% X is the new item, Y is the old one. So it is X that collides with -%% Y and Y shadows X. -collision(G, XPath, X, YPath, Y) -> - I1 = get_beef(X), - % I2 = get_beef(Y), - if is_record(I1, op) -> %%, record(I2, op) -> - ic_error:error(G, {inherit_name_collision, - {YPath, Y}, {XPath, X}}); - is_record(I1, attr) -> %%, record(I2, attr) -> - ic_error:error(G, {inherit_name_collision, - {YPath, Y}, {XPath, X}}); - true -> - ?ifopt(G, warn_name_shadow, - ic_error:warn(G, {inherit_name_shadow, - {YPath, Y}, {XPath, X}})) - end. - -has_idlist(X) when is_record(X, typedef) -> true; -has_idlist(X) when is_record(X, member) -> true; -has_idlist(X) when is_record(X, case_dcl) -> true; -has_idlist(X) when is_record(X, attr) -> true; -has_idlist(_) -> false. - -replace_idlist(X, IdList) when is_record(X, typedef) -> X#typedef{id=IdList}; -replace_idlist(X, IdList) when is_record(X, attr) -> X#attr{id=IdList}. - -get_beef(X) when is_record(X, id_of) -> X#id_of.type; -get_beef(X) -> X. - - -%% And among all elements in list -list_and(F, [X|Xs]) -> - case F(X) of - true -> list_and(F, Xs); - false -> false - end; -list_and(_F, []) -> true. - - - - - -%%-------------------------------------------------------------------- -%% -%% resolve_inherit shall return a list of resolved inheritances, -%% that is all names replaced with their global names. -%% - -inherit_resolve(G, S, N, [X|Rest], Out) -> - case scoped_lookup(G, S, N, X) of - {Name, _T, _TK, Inh} -> - case lists:member(Name, Out) of - true -> - inherit_resolve(G, S, N, Rest, Out); - false -> - case unique_append(Inh, [Name|Out]) of - error -> - ic_error:error(G, {inherit_resolve, X, Name}), - inherit_resolve(G, S, N, Rest, []); - UA -> - inherit_resolve(G, S, N, Rest, UA) - end - end; - _ -> inherit_resolve(G, S, N, Rest, Out) - end; -inherit_resolve(_G, _S, _N, [], Out) -> lists:reverse(Out). - -unique_append([X|Xs], L) -> - case lists:member(X, L) of - true -> unique_append(Xs, L); - false -> unique_append(Xs, [X|L]) - end; -unique_append([], L) -> L; -%% Error -unique_append(_, _L) -> error. - - - - -%%-------------------------------------------------------------------- -%% -%% Utilities -%% - -%% Must preserve order, therefore had to write my own (instead of lists:map) -check_list(G, S, N, [X|Xs]) -> - X1 = check(G, S, N, X), - [X1 | check_list(G, S, N, Xs)]; -check_list(_G, _S, _N, []) -> []. - - - -filter( [] ) -> - error; -filter( [I | Is ] ) -> - case I of - { _, member, { _, TKINFO }, _ } -> - fetchType( TKINFO ); - - { _, struct, _, _ } -> - struct; - - { _, typedef, TKINFO, _ } -> - fetchType( TKINFO ); - - { _, module, _, _ } -> - module; - - { _, interface, _, _ } -> - interface; - - { _, op, _, _ } -> - op; - - { _,enum, _, _ } -> - enum; - - { _, spellcheck } -> - filter( Is ); - - _ -> - error - end. - - -fetchType( { tk_sequence, _, _ } ) -> - sequence; -fetchType( { tk_array, _, _ } ) -> - array; -fetchType( { tk_struct, _, _, _} ) -> - struct; -fetchType( { tk_string, _} ) -> - string; -fetchType( { tk_wstring, _} ) -> %% WSTRING - wstring; -fetchType( { tk_fixed, _, _} ) -> - fixed; -fetchType( tk_short ) -> - short; -fetchType( tk_long ) -> - long; -fetchType( tk_longlong ) -> %% LLONG - longlong; -fetchType( tk_ushort ) -> - ushort; -fetchType( tk_ulong ) -> - ulong; -fetchType( tk_ulonglong ) -> %% ULLONG - ulonglong; -fetchType( tk_float ) -> - float; -fetchType( tk_double ) -> - double; -fetchType( tk_boolean ) -> - boolean; -fetchType( tk_char ) -> - char; -fetchType( tk_wchar ) -> %% WCHAR - wchar; -fetchType( tk_octet ) -> - octet; -fetchType( { tk_enum, _, _, _ } ) -> - enum; -fetchType( { tk_union, _, _, _, _, _ } ) -> - union; -fetchType( tk_any ) -> - any; -fetchType( _ ) -> - error. - -%% Z is a single name -to_uppercase(Z) -> - lists:map(fun(X) when X>=$a, X=<$z -> X-$a+$A; - (X) -> X end, Z). - - -%%------------------------------------------------------------ -%% -%% Always fetchs TK of a record. -%% -%%------------------------------------------------------------ -fetchTk(G,N,X) -> - case ic_forms:get_tk(X) of - undefined -> - searchTk(G,ictk:get_IR_ID(G, N, X)); - TK -> - TK - end. - - -%%------------------------------------------------------------ -%% -%% seek type code when not accessible by get_tk/1 -%% -%%------------------------------------------------------------ -searchTk(G,IR_ID) -> - S = ic_genobj:tktab(G), - case catch searchTk(S,IR_ID,typedef) of - {value,TK} -> - TK; - _ -> %% false / exit - case catch searchTk(S,IR_ID,struct) of - {value,TK} -> - TK; - _ -> %% false / exit - case catch searchTk(S,IR_ID,union) of - {value,TK} -> - TK; - _ -> - undefined - end - end - end. - - -searchTk(S,IR_ID,Type) -> - L = lists:flatten(ets:match(S,{'_',Type,'$1','_'})), - case lists:keysearch(IR_ID,2,L) of - {value,TK} -> - {value,TK}; - false -> - searchInsideTks(L,IR_ID) - end. - - -searchInsideTks([],_IR_ID) -> - false; -searchInsideTks([{tk_array,TK,_}|Xs],IR_ID) -> - case searchIncludedTk(TK,IR_ID) of - {value,TK} -> - {value,TK}; - false -> - searchInsideTks(Xs,IR_ID) - end. - - -searchIncludedTk({tk_array,TK,_},IR_ID) -> - searchIncludedTk(TK,IR_ID); -searchIncludedTk({tk_sequence,TK,_},IR_ID) -> - searchIncludedTk(TK,IR_ID); -searchIncludedTk(TK, _IR_ID) when is_atom(TK) -> - false; -searchIncludedTk(TK,IR_ID) -> - case element(2,TK) == IR_ID of - true -> - {value,TK}; - false -> - false - end. - diff --git a/lib/ic/src/icunion.erl b/lib/ic/src/icunion.erl deleted file mode 100644 index c39a5177e7..0000000000 --- a/lib/ic/src/icunion.erl +++ /dev/null @@ -1,1491 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - --module(icunion). - --import(ic_codegen, [emit/2, emit/3, emit/4, emit_c_enc_rpt/4, emit_c_dec_rpt/4]). --import(ic_cbe, [mk_c_type/3, mk_c_type/4]). - --include("icforms.hrl"). --include("ic.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([union_gen/4]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -union_gen(G, N, X, c) when is_record(X, union) -> - emit_c_union(G, N, X); -union_gen(_G, _N, _X, _L) -> - ok. - - -%% Emits the union -emit_c_union(G, N, X) -> - %%io:format("Rec = ~p\n",[X]), - case ic_genobj:is_hrlfile_open(G) of - true -> - - %% Sort Union Default = put it last in case list - NewX = #union{ id = X#union.id, - type = X#union.type, - body = mvDefaultToTail(X#union.body), - tk = X#union.tk }, - - UnionScope = [ic_forms:get_id2(NewX) | N], - - case ic_pragma:is_local(G,UnionScope) of - - true -> - - HFd = ic_genobj:hrlfiled(G), - emit_c_union_values(G, N, NewX, HFd), - UnionName = ic_util:to_undersc(UnionScope), - - emit(HFd, "\n#ifndef __~s__\n",[ictype:to_uppercase(UnionName)]), - emit(HFd, "#define __~s__\n",[ictype:to_uppercase(UnionName)]), - ic_codegen:mcomment_light(HFd, - [io_lib:format("Union definition: ~s", - [UnionName])], - c), - emit(HFd, "typedef struct {\n"), - emit(HFd, " ~s _d;\n", [get_c_union_discriminator(G, N, NewX)]), - emit(HFd, " union {\n"), - emit_c_union_values_decl(G, N, NewX, HFd), - emit(HFd, " } _u;\n"), - emit(HFd, "} ~s;\n\n", [UnionName]), - - emit(HFd, "int ~s~s(CORBA_Environment *oe_env, int*, int*);\n", - [ic_util:mk_oe_name(G, "sizecalc_"), UnionName]), - emit(HFd, "int ~s~s(CORBA_Environment *oe_env, ~s*);\n", - [ic_util:mk_oe_name(G, "encode_"), UnionName, UnionName]), - emit(HFd, "int ~s~s(CORBA_Environment *oe_env, char *, int*, ~s*);\n", - [ic_util:mk_oe_name(G, "decode_"), UnionName, UnionName]), - emit(HFd, "\n#endif\n\n"), - create_c_union_file(G, N, NewX, UnionName); - - false -> %% Do not generate included types att all. - ok - end; - false -> - ok - end. - - - -%% Loops over union members and creates members typedefs -emit_c_union_values(G, N, X, Fd) -> - emit_c_union_values_loop(G, N, X, Fd, X#union.body). - -emit_c_union_values_loop(G, N, X, Fd, [CU]) -> - case CU of - {case_dcl,_,Id,Type} -> - case Id of - {array, _AID, _SZ} -> % Check for arrays - mk_array_file(G,N,X,Id,Type,Fd); - _ -> % Elementary types or seq/struct - ok - end; - _ -> - error - end; -emit_c_union_values_loop(G, N, X, Fd, [CU |CUs]) -> - case CU of - {case_dcl,_,Id,Type} -> - case Id of - {array, _AID, _SZ} -> % Check for arrays - mk_array_file(G,N,X,Id,Type,Fd); - _ -> % Elementary types or seq/struct - emit_c_union_values_loop(G, N, X, Fd, CUs) - end; - _ -> - error - end. - - -%% Loops over union members and declares members inside union structure -emit_c_union_values_decl(G, N, X, Fd) -> - emit_c_union_values_decl_loop(G, N, X, Fd, X#union.body). - -emit_c_union_values_decl_loop(G, N, X, Fd, [CU]) -> - case CU of - {case_dcl,_,Id,Type} -> - case Id of - {array, _AID, _SZ} -> % Check for arrays - mk_array_decl(G,N,X,Id,Type,Fd); - _ -> % Elementary types or seq/struct - mk_union_member_decl(G,N,X,Id,Type,Fd), - ok - end; - _ -> - error - end; -emit_c_union_values_decl_loop(G, N, X, Fd, [CU |CUs]) -> - case CU of - {case_dcl,_,Id,Type} -> - case Id of - {array, _AID, _SZ} -> % Check for arrays - mk_array_decl(G,N,X,Id,Type,Fd), - emit_c_union_values_decl_loop(G, N, X, Fd, CUs); - _ -> % Elementary types or seq/struct - mk_union_member_decl(G,N,X,Id,Type,Fd), - emit_c_union_values_decl_loop(G, N, X, Fd, CUs) - end; - _ -> - error - end. - - -%% Makes the declaration for the array in union -mk_array_decl(G,N,X,Id,Type,Fd) -> - emit(Fd, " ~s ~s;\n", - [getCaseTypeStr(G,N,X,Id,Type), - mk_array_name(Id)]). - -mk_array_name({array,Id,D}) -> - ic_forms:get_id2(Id) ++ mk_array_dim(D). - -mk_array_dim([]) -> - ""; -mk_array_dim([{_,_,Dim}|Dims]) -> - "[" ++ Dim ++ "]" ++ mk_array_dim(Dims). - - -%% Creates the array file -mk_array_file(G,N,X,{array,AID,SZ},Type,HFd) -> - ArrayName = ic_util:to_undersc([ic_forms:get_id2(AID),ic_forms:get_id2(X) | N]), - ArrayDim = extract_array_dim(SZ), - emit(HFd, "\n#ifndef __~s__\n",[ictype:to_uppercase(ArrayName)]), - emit(HFd, "#define __~s__\n\n",[ictype:to_uppercase(ArrayName)]), - icstruct:create_c_array_coding_file(G, - N, - {ArrayName,ArrayDim}, - Type, - no_typedef), - emit(HFd, "\n#endif\n\n"). - -extract_array_dim([{_,_,Dim}]) -> - [Dim]; -extract_array_dim([{_,_,Dim}|Dims]) -> - [Dim | extract_array_dim(Dims)]. - - -%% Makes the declaration for the member in union -mk_union_member_decl(G,N,X,Id,Type,Fd) -> - emit(Fd, " ~s ~s;\n", - [getCaseTypeStr(G,N,X,Id,Type), - ic_forms:get_id2(Id)]). - - - - -%% File utilities -create_c_union_file(G, N, X, UnionName) -> - - {Fd , SName} = open_c_coding_file(G, UnionName), - _HFd = ic_genobj:hrlfiled(G), %% Write on stubfile header - HrlFName = filename:basename(ic_genobj:include_file(G)), - ic_codegen:emit_stub_head(G, Fd, SName, c), - emit(Fd, "#include \"~s\"\n\n",[HrlFName]), - - %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - %% Fd = ic_genobj:stubfiled(G), %% Write on stubfile - %% HFd = ic_genobj:hrlfiled(G), %% Write on stubfile header - %% HrlFName = filename:basename(ic_genobj:include_file(G)), - %% emit(Fd, "#include \"~s\"\n\n",[HrlFName]), - %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - put(op_variable_count, 0), - put(tmp_declarations, []), - - %% Write generated code on file - emit_union_sizecount(G, N, X, Fd, UnionName), - emit_union_encode(G, N, X, Fd, UnionName), - emit_union_decode(G, N, X, Fd, UnionName), - file:close(Fd). - -open_c_coding_file(G, Name) -> - SName = string:concat(ic_util:mk_oe_name(G, "code_"), Name), - FName = - ic_file:join(ic_options:get_opt(G, stubdir),ic_file:add_dot_c(SName)), - case file:open(FName, [write]) of - {ok, Fd} -> - {Fd, SName}; - Other -> - exit(Other) - end. - - - - -get_c_union_discriminator(G, N, X) -> - case getDiscrStr(G, N, X#union.type) of - error -> - ic_error:fatal_error(G, {illegal_typecode_for_c, X#union.type, N}); - DiscrStr -> - case ic_code:get_basetype(G, DiscrStr) of - {short, _} -> - "CORBA_short"; - {unsigned,{short, _}} -> - "CORBA_unsigned_short"; - {long, _} -> - "CORBA_long"; - {unsigned,{long, _}} -> - "CORBA_unsigned_long"; - {boolean,_} -> - "CORBA_boolean"; - {char,_} -> - "CORBA_char"; - {enum, EnumType} -> - EnumType; - _ -> - DiscrStr - end - end. - -getDiscrStr(G, N, S) when element(1, S) == scoped_id -> - case ic_symtab:get_full_scoped_name(G, N, S) of - {FSN, _, tk_short, _} -> - ic_util:to_undersc(FSN); - {FSN, _, tk_ushort, _} -> - ic_util:to_undersc(FSN); - {FSN, _, tk_long, _} -> - ic_util:to_undersc(FSN); - {FSN, _, tk_ulong, _} -> - ic_util:to_undersc(FSN); - {FSN, _, tk_boolean, _} -> - ic_util:to_undersc(FSN); - {FSN, _, tk_char, _} -> - ic_util:to_undersc(FSN); - {FSN, _, {tk_enum,_,_,_}, _} -> - ic_util:to_undersc(FSN); - _ -> - error - end; -getDiscrStr(_G, N, X) -> - case X of - {short,_} -> - "CORBA_short"; - {unsigned,{short,_}} -> - "CORBA_unsigned_short"; - {long, _} -> - "CORBA_long"; - {unsigned,{long,_}} -> - "CORBA_unsigned_long"; - {boolean,_} -> - "CORBA_boolean"; - {char,_} -> - "CORBA_char"; - {enum,TID,_,_} -> - ic_util:to_undersc([ic_forms:get_id2(TID) | N]); - _ -> - error - end. - - - - -getCaseTypeStr(G, N, X, I, T) when element(1, T) == scoped_id -> - case catch ic_symtab:get_full_scoped_name(G, N, T) of - {FSN, _, _, _} -> - BT = ic_code:get_basetype(G, ic_util:to_undersc(FSN)), - case isList(BT) of - true -> - BT; - false -> - case BT of - {short,_} -> - "CORBA_short"; - {unsigned,{short,_}} -> - "CORBA_unsigned_short"; - {long, _} -> - "CORBA_long"; - {unsigned,{long,_}} -> - "CORBA_unsigned_long"; - {float,_} -> - "CORBA_float"; - {double,_} -> - "CORBA_double"; - {boolean,_} -> - "CORBA_boolean"; - {char,_} -> - "CORBA_char"; - {wchar,_} -> - "CORBA_wchar"; - {octet,_} -> - "CORBA_octet"; - {string,_} -> - "CORBA_char*"; - {wstring,_} -> - "CORBA_wchar*"; - {sequence,_,_} -> - ic_util:to_undersc([ic_forms:get_id2(I), ic_forms:get_id2(X) | N]); - {struct,SID,_,_} -> - ic_util:to_undersc([ic_forms:get_id2(SID), ic_forms:get_id2(X) | N]); - {enum,EID} -> - EID; - {any, _} -> %% Fix for any type - "CORBA_long"; - _ -> - %%io:format("BT = ~p~n",[BT]), - error - end - end - end; -getCaseTypeStr(_G, N, X, I, T) -> - case T of - {short,_} -> - "CORBA_short"; - {unsigned,{short,_}} -> - "CORBA_unsigned_short"; - {long, _} -> - "CORBA_long"; - {unsigned,{long,_}} -> - "CORBA_unsigned_long"; - {float,_} -> - "CORBA_float"; - {double,_} -> - "CORBA_double"; - {boolean,_} -> - "CORBA_boolean"; - {char,_} -> - "CORBA_char"; - {wchar,_} -> - "CORBA_wchar"; - {octet,_} -> - "CORBA_octet"; - {string,_} -> - "CORBA_char*"; - {wstring,_} -> - "CORBA_wchar*"; - {sequence,_,_} -> - ic_util:to_undersc([ic_forms:get_id2(I), ic_forms:get_id2(X) | N]); - {struct,SID,_,_} -> - ic_util:to_undersc([ic_forms:get_id2(SID), ic_forms:get_id2(X) | N]); - {union,UID,_,_,_} -> - ic_util:to_undersc([ic_forms:get_id2(UID), ic_forms:get_id2(X) | N]); - {any, _} -> %% Fix for any type - "CORBA_long"; - _ -> - error - end. - -isList(L) when is_list(L) -> - true; -isList(_) -> - false. - -%% -%% Sizecount facilities -%% -emit_union_sizecount(G, N, X, Fd, UnionName) -> - emit(Fd, "int ~s~s(CORBA_Environment *oe_env, int* oe_size_count_index, int* oe_size) {\n\n", - [ic_util:mk_oe_name(G, "sizecalc_"), UnionName]), - - emit(Fd, " int oe_malloc_size = 0;\n"), - emit(Fd, " int oe_error_code = 0;\n"), - emit(Fd, " int oe_type = 0;\n"), - emit(Fd, " int oe_tmp = 0;\n"), - emit_union_discr_var_decl(G, N, X, Fd), - - ic_codegen:nl(Fd), - emit(Fd, " if(*oe_size == 0)\n",[]), - AlignName = lists:concat(["*oe_size + sizeof(",UnionName,")"]), - emit(Fd, " *oe_size = ~s;\n\n", [ic_util:mk_align(AlignName)]), - - emit(Fd, " if ((oe_error_code = ei_get_type(oe_env->_inbuf, oe_size_count_index, &oe_type, &oe_tmp)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "ei_get_type", []), - emit(Fd, " return oe_error_code;\n }\n"), - - %%emit(Fd, " if (oe_tmp != 3)\n"), - %%emit(Fd, " return -1;\n\n"), - - emit(Fd, " if ((oe_error_code = ei_decode_tuple_header(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "ei_decode_tuple_header", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " if ((oe_error_code = ei_decode_atom(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n", []), - emit_c_dec_rpt(Fd, " ", "ei_decode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"), - - emit_c_union_discr_sizecount(G, N, X, Fd), - emit(Fd, " /* Calculate union size */\n"), - emit(Fd, " switch(oe_discr) {\n"), - - emit_c_union_loop(G, N, X, Fd, X#union.body, sizecalc), - emit(Fd, " }\n\n"), - - emit(Fd, " *oe_size = ~s;\n",[ic_util:mk_align("*oe_size+oe_malloc_size")]), - emit(Fd, " return 0;\n"), - emit(Fd, "}\n\n\n"). - - -emit_union_discr_var_decl(G, N, X, Fd) -> - UD = get_c_union_discriminator(G, N, X), - case UD of - "CORBA_short" -> - emit(Fd, " long oe_discr = 0;\n"); - "CORBA_unsigned_short" -> - emit(Fd, " unsigned long oe_discr = 0;\n"); - "CORBA_long" -> - emit(Fd, " long oe_discr = 0;\n"); - "CORBA_unsigned_long" -> - emit(Fd, " unsigned long oe_discr = 0;\n"); - "CORBA_boolean" -> - emit(Fd, " int oe_discr = 0;\n"), - emit(Fd, " char oe_bool[256];\n"); - "CORBA_char" -> - emit(Fd, " char oe_discr = 0;\n"); - _T -> - emit(Fd, " int oe_dummy = 0;\n"), - emit(Fd, " ~s oe_discr = 0;\n",[UD]) - end. - - -emit_c_union_discr_sizecount(G, N, X, Fd) -> - emit(Fd, " /* Calculate discriminator size */\n"), - UD = get_c_union_discriminator(G, N, X), - case UD of - "CORBA_short" -> - emit(Fd, " if ((oe_error_code = ei_decode_long(oe_env->_inbuf, oe_size_count_index, &oe_discr)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "ei_decode_long", []), - emit(Fd, " return oe_error_code;\n }\n"); - "CORBA_unsigned_short" -> - emit(Fd, " if ((oe_error_code = ei_decode_ulong(oe_env->_inbuf, oe_size_count_index, &oe_discr)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "ei_decode_ulong", []), - emit(Fd, " return oe_error_code;\n }\n"); - "CORBA_long" -> - emit(Fd, " if ((oe_error_code = ei_decode_long(oe_env->_inbuf, oe_size_count_index, &oe_discr)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "ei_decode_long", []), - emit(Fd, " return oe_error_code;\n }\n"); - "CORBA_unsigned_long" -> - emit(Fd, " if ((oe_error_code = ei_decode_ulong(oe_env->_inbuf, oe_size_count_index, &oe_discr)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "ei_decode_ulong", []), - emit(Fd, " return oe_error_code;\n }\n"); - "CORBA_boolean" -> - emit(Fd, " if ((oe_error_code = ei_decode_atom(oe_env->_inbuf, oe_size_count_index, oe_bool)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "ei_decode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " if (strcmp(oe_bool, \"false\") == 0) {\n"), - emit(Fd, " oe_discr = 0;\n"), - emit(Fd, " }\n"), - emit(Fd, " else if (strcmp(oe_bool, \"true\") == 0) {\n"), - emit(Fd, " oe_discr = 1;\n"), - emit(Fd, " }\n"), - emit(Fd, " else {\n"), - emit_c_dec_rpt(Fd, " ", "not boolean", []), - emit(Fd, " return -1;\n }\n"); - - "CORBA_char" -> - emit(Fd, " if ((oe_error_code = ei_decode_char(oe_env->_inbuf, oe_size_count_index, &oe_discr)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "ei_decode_char", []), - emit(Fd, " return oe_error_code;\n }\n"); - T -> - emit(Fd, " oe_tmp = *oe_size_count_index;\n"), - emit(Fd, " if ((oe_error_code = oe_sizecalc_~s(oe_env, oe_size_count_index, &oe_malloc_size)) < 0) {\n", [T]), - ?emit_c_dec_rpt(Fd, " ", "oe_size_calc_~s", [T]), - emit(Fd, " return oe_error_code;\n }\n"), - - emit(Fd, " *oe_size_count_index = oe_tmp;\n"), - emit(Fd, " oe_tmp = oe_env->_iin;\n"), - emit(Fd, " oe_env->_iin = *oe_size_count_index;\n"), - emit(Fd, " if ((oe_error_code = oe_decode_~s(oe_env, NULL, &oe_dummy, &oe_discr)) < 0) {\n", [T]), - ?emit_c_dec_rpt(Fd, " ", "oe_decode_~s", [T]), - emit(Fd, " return oe_error_code;\n }\n"), - - emit(Fd, " *oe_size_count_index = oe_env->_iin;\n"), - emit(Fd, " oe_env->_iin = oe_tmp;\n\n") - end. - - - -emit_c_union_loop(G, N, X, Fd, CaseList, Case) -> - emit_c_union_loop(G, N, X, Fd, CaseList, false, Case). - -emit_c_union_loop(G, N, X, Fd, [], GotDefaultCase, Case) -> - case GotDefaultCase of - false -> - emit_c_union_valueless_discriminator(G, N, X, Fd, Case) - end; -emit_c_union_loop(G, N, X, Fd, [CU|CUs], GotDefaultCase, Case) -> - case CU of - {case_dcl,CaseList,I,T} -> - GotDefaultCase = emit_c_union_case(G, N, X, Fd, I, T, CaseList, Case), - emit_c_union_loop(G, N, X, Fd, CUs, GotDefaultCase, Case); - _ -> - error - end. - -emit_c_union_valueless_discriminator(_G, _N, _X, Fd, Case) -> - emit(Fd, " default:\n"), - case Case of - sizecalc -> - emit(Fd, " {\n"), - emit(Fd, " char oe_undefined[15];\n\n"), - emit(Fd, " if ((oe_error_code = ei_decode_atom(oe_env->_inbuf, " - "oe_size_count_index, oe_undefined)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "ei_decode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " }\n"); - encode -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_atom(oe_env, \"undefined\")) < 0) {\n"), - emit_c_enc_rpt(Fd, " ", "oe_ei_encode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " break;\n"); - decode -> - emit(Fd, " {\n"), - emit(Fd, " char oe_undefined[15];\n\n"), - emit(Fd, " if ((oe_error_code = ei_decode_atom(oe_env->_inbuf, &oe_env->_iin, " - "oe_undefined)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "ei_decode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " if (strcmp(oe_undefined, \"undefined\") != 0) {\n"), - emit_c_dec_rpt(Fd, " ", "undefined", []), - emit(Fd, " return -1;\n }\n"), - emit(Fd, " }\n") - end. - - -emit_c_union_case(G, N, X, Fd, I, T, [{default,_}], Case) -> - emit(Fd, " default:\n"), - case Case of - sizecalc -> - getCaseTypeSizecalc(G, N, X, Fd, I, T); - encode -> - getCaseTypeEncode(G, N, X, Fd, I, T); - decode -> - getCaseTypeDecode(G, N, X, Fd, I, T) - end, - true; -emit_c_union_case(G, N, X, Fd, I, T, [{Bool,_}], Case) -> %% Boolean discriminator - case Bool of - 'TRUE' -> - emit(Fd, " case 1:\n"); - 'FALSE' -> - emit(Fd, " case 0:\n") - end, - case Case of - sizecalc -> - getCaseTypeSizecalc(G, N, X, Fd, I, T); - encode -> - getCaseTypeEncode(G, N, X, Fd, I, T); - decode -> - getCaseTypeDecode(G, N, X, Fd, I, T) - end, - emit(Fd, " break;\n\n"), - false; -emit_c_union_case(G, N, X, Fd, I, T, [{Bool,_}|Rest], Case) -> %% Boolean discriminator - case Bool of - 'TRUE' -> - emit(Fd, " case 1:\n"); - 'FALSE' -> - emit(Fd, " case 0:\n") - end, - emit_c_union_case(G, N, X, Fd, I, T, Rest, Case), - false; -emit_c_union_case(G, N, X, Fd, I, T, [{_,_,NrStr}], Case) -> %% Integer type discriminator - case get_c_union_discriminator(G, N, X) of - "CORBA_char" -> - emit(Fd, " case \'~s\':\n",[NrStr]); - _ -> - emit(Fd, " case ~s:\n",[NrStr]) - end, - case Case of - sizecalc -> - getCaseTypeSizecalc(G, N, X, Fd, I, T); - encode -> - getCaseTypeEncode(G, N, X, Fd, I, T); - decode -> - getCaseTypeDecode(G, N, X, Fd, I, T) - end, - emit(Fd, " break;\n\n"), - false; -emit_c_union_case(G, N, X, Fd, I, T, [{_,_,NrStr}|Rest], Case) -> %% Integer type discriminator - emit(Fd, " case ~s:\n",[NrStr]), - emit_c_union_case(G, N, X, Fd, I, T, Rest, Case), - false; -emit_c_union_case(G, N, X, Fd, I, T, [{scoped_id,_,_,[EID]}], Case) -> %% Enumerant type discriminator - SID = ic_util:to_undersc([EID|get_c_union_discriminator_scope(G, N, X)]), - %%io:format("SID = ~p~n",[SID]), - emit(Fd, " case ~s:\n",[SID]), - case Case of - sizecalc -> - getCaseTypeSizecalc(G, N, X, Fd, I, T); - encode -> - getCaseTypeEncode(G, N, X, Fd, I, T); - decode -> - getCaseTypeDecode(G, N, X, Fd, I, T) - end, - emit(Fd, " break;\n\n"), - false; -emit_c_union_case(G, N, X, Fd, I, T, [{scoped_id,_,_,[EID]}|Rest], Case) -> %% Enumerant type discriminator - SID = ic_util:to_undersc([EID|get_c_union_discriminator_scope(G, N, X)]), - %%io:format("SID = ~p~n",[SID]), - emit(Fd, " case ~s:\n",[SID]), - emit_c_union_case(G, N, X, Fd, I, T, Rest, Case), - false. - - -%% -%% Returns the enumerant discriminator scope -%% -get_c_union_discriminator_scope(G, N, X) -> - {FullScopedName, _, _TK, _} = ic_symtab:get_full_scoped_name(G, N, X#union.type), - BT = case ic_code:get_basetype(G, ic_util:to_undersc(FullScopedName)) of - {enum,ST} -> - ST; - Other -> - Other - end, - tl(lists:reverse(string:tokens(BT,"_"))). %% Ugly work arround - - - - - -getCaseTypeSizecalc(G, N, X, Fd, I, T) when element(1, T) == scoped_id -> - case ic_fetch:member2type(G,X,I) of - ushort -> - emit(Fd, " if ((oe_error_code = ei_decode_ulong(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "ushort:ei_decode_ulong", []), - emit(Fd, " return oe_error_code;\n }\n"); - ulong -> - emit(Fd, " if ((oe_error_code = ei_decode_ulong(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "ulong:ei_decode_ulong", []), - emit(Fd, " return oe_error_code;\n }\n"); - short -> - emit(Fd, " if ((oe_error_code = ei_decode_long(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "short:ei_decode_long", []), - emit(Fd, " return oe_error_code;\n }\n"); - long -> - emit(Fd, " if ((oe_error_code = ei_decode_long(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "long:ei_decode_long", []), - emit(Fd, " return oe_error_code;\n }\n"); - float -> - emit(Fd, " if ((oe_error_code = ei_decode_double(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "float:ei_decode_double", []), - emit(Fd, " return oe_error_code;\n }\n"); - double -> - emit(Fd, " if ((oe_error_code = ei_decode_double(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "double:ei_decode_double", []), - emit(Fd, " return oe_error_code;\n }\n"); - boolean -> - emit(Fd, " if ((oe_error_code = ei_decode_atom(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "boolean:ei_decode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"); - char -> - emit(Fd, " if ((oe_error_code = ei_decode_char(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "char:ei_decode_char", []), - emit(Fd, " return oe_error_code;\n }\n"); - octet -> - emit(Fd, " if ((oe_error_code = ei_decode_char(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "octet:ei_decode_char", []), - emit(Fd, " return oe_error_code;\n }\n"); - string -> - emit(Fd, " if ((oe_error_code = ei_get_type(oe_env->_inbuf, oe_size_count_index, &oe_type, &oe_tmp)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "ei_get_type", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " if ((oe_error_code = ei_decode_string(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "ei_decode_string", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " oe_malloc_size = ~s;\n",[ic_util:mk_align("oe_malloc_size+oe_tmp+1")]); - any -> %% Fix for any type - emit(Fd, " if ((oe_error_code = ei_decode_long(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "ei_decode_long", []), - emit(Fd, " return oe_error_code;\n }\n"); - - _ -> - case getCaseTypeStr(G, N, X, I, T) of - "erlang_pid" -> - emit(Fd, " if ((oe_error_code = ei_decode_pid(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n", - []), - ?emit_c_dec_rpt(Fd, " ", "ei_decode_pid", []), - emit(Fd, " return oe_error_code;\n }\n"); - "erlang_port" -> - emit(Fd, " if ((oe_error_code = ei_decode_port(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n", - []), - ?emit_c_dec_rpt(Fd, " ", "ei_decode_port", []), - emit(Fd, " return oe_error_code;\n }\n"); - "erlang_ref" -> - emit(Fd, " if ((oe_error_code = ei_decode_ref(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n", - []), - ?emit_c_dec_rpt(Fd, " ", "ei_decode_ref", []), - emit(Fd, " return oe_error_code;\n }\n"); - "erlang_term" -> - emit(Fd, " if ((oe_error_code = ei_decode_term(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n", - []), - ?emit_c_dec_rpt(Fd, " ", "ei_deoce_term", []), - emit(Fd, " return oe_error_code;\n }\n"); - - Other -> - - emit(Fd, " if ((oe_error_code = oe_sizecalc_~s(oe_env, oe_size_count_index, &oe_malloc_size)) < 0) {\n", - [Other]), - ?emit_c_dec_rpt(Fd, " ", "oe_sizecalc_~s", [Other]), - emit(Fd, " return oe_error_code;\n }\n") - end - end; -getCaseTypeSizecalc(G, N, X, Fd, I, T) -> - case I of - {array,_,_} -> - ArrayName = ic_util:to_undersc([ic_forms:get_id2(I),ic_forms:get_id2(X) | N]), - emit(Fd, " if ((oe_error_code = oe_sizecalc_~s(oe_env, oe_size_count_index, &oe_malloc_size)) < 0) {\n", - [ArrayName]), - ?emit_c_dec_rpt(Fd, " ", "oe_sizecalc_~s", [ArrayName]), - emit(Fd, " return oe_error_code;\n }\n"); - _ -> - case T of - {short,_} -> - emit(Fd, " if ((oe_error_code = ei_decode_long(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "short:ei_decode_long", []), - emit(Fd, " return oe_error_code;\n }\n"); - {unsigned,{short,_}} -> - emit(Fd, " if ((oe_error_code = ei_decode_ulong(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "ushort:ei_decode_ulong", []), - emit(Fd, " return oe_error_code;\n }\n"); - {long, _} -> - emit(Fd, " if ((oe_error_code = ei_decode_long(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "long:ei_decode_long", []), - emit(Fd, " return oe_error_code;\n }\n"); - {unsigned,{long,_}} -> - emit(Fd, " if ((oe_error_code = ei_decode_ulong(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "ulong:ei_decode_ulong", []), - emit(Fd, " return oe_error_code;\n }\n"); - {float,_} -> - emit(Fd, " if ((oe_error_code = ei_decode_double(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "float:ei_decode_double", []), - emit(Fd, " return oe_error_code;\n }"); - {double,_} -> - emit(Fd, " if ((oe_error_code = ei_decode_double(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "double:ei_decode_double", []), - emit(Fd, " return oe_error_code;\n }\n"); - {boolean,_} -> - emit(Fd, " if ((oe_error_code = ei_decode_atom(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "boolean:ei_decode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"); - {char,_} -> - emit(Fd, " if ((oe_error_code = ei_decode_char(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "char:ei_decode_char", []), - emit(Fd, " return oe_error_code;\n }\n"); - {octet,_} -> - emit(Fd, " if ((oe_error_code = ei_decode_char(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "octet:ei_decode_char", []), - emit(Fd, " return oe_error_code;\n }\n"); - {string,_} -> - emit(Fd, " if ((oe_error_code = ei_get_type(oe_env->_inbuf, oe_size_count_index, &oe_type, &oe_tmp)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "ei_get_type", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " if ((oe_error_code = ei_decode_string(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "ei_decode_string", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " oe_malloc_size = ~s;\n",[ic_util:mk_align("oe_malloc_size+oe_tmp+1")]); - {sequence,_,_} -> - SeqName = ic_util:to_undersc([ic_forms:get_id2(I), ic_forms:get_id2(X) | N]), - emit(Fd, " if ((oe_error_code = oe_sizecalc_~s(oe_env, oe_size_count_index, &oe_malloc_size)) < 0) {\n", - [SeqName]), - ?emit_c_dec_rpt(Fd, " ", "sequence:oe_sizecalc_~s", [SeqName]), - emit(Fd, " return oe_error_code;\n }\n"); - {struct,SID,_,_} -> - StructName = ic_util:to_undersc([ic_forms:get_id2(SID), ic_forms:get_id2(X) | N]), - emit(Fd, " if ((oe_error_code = oe_sizecalc_~s(oe_env, oe_size_count_index, &oe_malloc_size)) < 0) {\n", - [StructName]), - ?emit_c_dec_rpt(Fd, " ", "struct:oe_sizecalc_~s", [StructName]), - emit(Fd, " return oe_error_code;\n }\n"); - {union,UID,_,_,_} -> - UnionName = ic_util:to_undersc([ic_forms:get_id2(UID), ic_forms:get_id2(X) | N]), - emit(Fd, " if ((oe_error_code = oe_sizecalc_~s(oe_env, oe_size_count_index, &oe_malloc_size)) < 0) {\n", - [UnionName]), - ?emit_c_dec_rpt(Fd, " ", "union:oe_sizecalce_~s", [UnionName]), - emit(Fd, " return oe_error_code;\n }\n"); - {any, _} -> %% Fix for any type - emit(Fd, " if ((oe_error_code = ei_decode_long(oe_env->_inbuf, oe_size_count_index, 0)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "any:ei_decode_long", []), - emit(Fd, " return oe_error_code;\n }\n"); - _ -> - ic_error:fatal_error(G, {illegal_typecode_for_c, T, N}) - end - end. - - - - - -%% -%% Encode facilities -%% -emit_union_encode(G, N, X, Fd, UnionName) -> - emit(Fd, "int ~s~s(CORBA_Environment *oe_env, ~s* oe_rec) {\n\n", - [ic_util:mk_oe_name(G, "encode_"), UnionName, UnionName]), - - emit(Fd, " int oe_error_code = 0;\n\n"), - - emit(Fd, " if ((oe_error_code = oe_ei_encode_tuple_header(oe_env, 3)) < 0) {\n"), - emit_c_enc_rpt(Fd, " ", "oe_ei_encode_tuple_header", []), - emit(Fd, " return oe_error_code;\n }\n"), - - emit(Fd, " if ((oe_error_code = oe_ei_encode_atom(oe_env, \"~s\")) < 0) {\n", - [UnionName]), - emit_c_enc_rpt(Fd, " ", "oe_ei_encode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"), - - emit_c_union_discr_encode(G, N, X, Fd), - emit(Fd, " /* Encode union */\n"), - emit(Fd, " switch(oe_rec->_d) {\n"), - emit_c_union_loop(G, N, X, Fd, X#union.body, encode), - emit(Fd, " }\n\n"), - emit(Fd, " return 0;\n"), - emit(Fd, "}\n\n\n"). - - -emit_c_union_discr_encode(G, N, X, Fd) -> - emit(Fd, " /* Encode descriminator */\n"), - UD = get_c_union_discriminator(G, N, X), - case UD of - "CORBA_short" -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_long(oe_env, oe_rec->_d)) < 0) {\n"), - emit_c_enc_rpt(Fd, " ", "oe_ei_encode_long", []), - emit(Fd, " return oe_error_code;\n }\n"); - "CORBA_unsigned_short" -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_ulong(oe_env, oe_rec->_d)) < 0) {\n"), - emit_c_enc_rpt(Fd, " ", "oe_ei_encode_ulong", []), - emit(Fd, " return oe_error_code;\n }\n"); - "CORBA_long" -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_long(oe_env, oe_rec->_d)) < 0) {\n"), - emit_c_enc_rpt(Fd, " ", "oe_ei_encode_long", []), - emit(Fd, " return oe_error_code;\n }\n"); - "CORBA_unsigned_long" -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_ulong(oe_env, oe_rec->_d)) < 0) {\n"), - emit_c_enc_rpt(Fd, " ", "oe_ei_encode_ulong", []), - emit(Fd, " return oe_error_code;\n }\n"); - "CORBA_boolean" -> - emit(Fd, " switch(oe_rec->_d) {\n"), - emit(Fd, " case 0:\n"), - emit(Fd, " if ((oe_error_code = oe_ei_encode_atom(oe_env, \"false\")) < 0) {\n"), - emit_c_enc_rpt(Fd, " ", "oe_ei_encode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " break;\n"), - emit(Fd, " case 1:\n"), - emit(Fd, " if ((oe_error_code = oe_ei_encode_atom(oe_env, \"true\")) < 0) {\n"), - emit_c_enc_rpt(Fd, " ", "oe_ei_encode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " break;\n"), - emit(Fd, " default:\n"), - emit_c_enc_rpt(Fd, " ", "boolean failure", []), - emit(Fd, " return -1;\n"), - emit(Fd, " }\n\n"); - "CORBA_char" -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_char(oe_env, oe_rec->_d)) < 0) {\n"), - emit_c_enc_rpt(Fd, " ", "oe_ei_encode_char", []), - emit(Fd, " return oe_error_code;\n }\n"); - T -> - emit(Fd, " if ((oe_error_code = oe_encode_~s(oe_env, oe_rec->_d)) < 0) {\n", [T]), - ?emit_c_enc_rpt(Fd, " ", "oe_encode_~s", [T]), - emit(Fd, " return oe_error_code;\n }\n") - end. - - -getCaseTypeEncode(G, N, X, Fd, I, T) when element(1, T) == scoped_id -> - case ic_fetch:member2type(G,X,I) of - ushort -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_ulong(oe_env, oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "ushort:oe_ei_encode_ulong", []), - emit(Fd, " return oe_error_code;\n }\n"); - ulong -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_ulong(oe_env, oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "ulong:oe_ei_encode_ulong", []), - emit(Fd, " return oe_error_code;\n }\n"); - short -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_long(oe_env, oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "short:oe_ei_encode_long", []), - emit(Fd, " return oe_error_code;\n }\n"); - long -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_long(oe_env, oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "long:oe_ei_encode_long", []), - emit(Fd, " return oe_error_code;\n }\n"); - float -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_double(oe_env, oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "float:oe_ei_encode_double", []), - emit(Fd, " return oe_error_code;\n }\n"); - double -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_double(oe_env, oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "double:oe_ei_encode_double", []), - emit(Fd, " return oe_error_code;\n }\n"); - boolean -> - emit(Fd, " switch(oe_rec->_u.~s) {\n",[ic_forms:get_id2(I)]), - emit(Fd, " case 0:\n"), - emit(Fd, " if ((oe_error_code = oe_ei_encode_atom(oe_env, \"false\")) < 0) {\n"), - ?emit_c_enc_rpt(Fd, " ", "boolean:oe_ei_encode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " break;\n"), - emit(Fd, " case 1:\n"), - emit(Fd, " if ((oe_error_code = oe_ei_encode_atom(oe_env, \"true\")) < 0) {\n"), - ?emit_c_enc_rpt(Fd, " ", "boolean:oe_ei_encode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " break;\n"), - emit(Fd, " default:\n"), - ?emit_c_enc_rpt(Fd, " ", "boolean failure", []), - emit(Fd, " return -1;\n"), - emit(Fd, " }\n"); - char -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_char(oe_env, oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "char:oe_ei_encode_char", []), - emit(Fd, " return oe_error_code;\n }\n"); - octet -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_char(oe_env, oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "octet:oe_ei_encode_char", []), - emit(Fd, " return oe_error_code;\n }\n"); - string -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_string(oe_env, oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "oe_ei_encode_string", []), - emit(Fd, " return oe_error_code;\n }\n"); - struct -> - case ic_cbe:mk_c_type(G, N, T, evaluate_not) of - "erlang_pid" -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_pid(oe_env, &oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "oe_ei_encode_pid", []), - emit(Fd, " return oe_error_code;\n }\n"); - "erlang_port" -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_port(oe_env, &oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "oe_ei_encode_port", []), - emit(Fd, " return oe_error_code;\n }\n"); - "erlang_ref" -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_ref(oe_env, &oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "oe_ei_encode_ref", []), - emit(Fd, " return oe_error_code;\n }\n"); - "ETERM*" -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_term(oe_env, &oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "oe_ei_encode_term", []), - emit(Fd, " return oe_error_code;\n }\n"); - _ -> - emit(Fd, " if ((oe_error_code = oe_encode_~s(oe_env, &oe_rec->_u.~s)) < 0) {\n", - [getCaseTypeStr(G, N, X, I, T), ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "oe_encode_~s", - [getCaseTypeStr(G, N, X, I, T)]), - emit(Fd, " return oe_error_code;\n }\n") - end; - sequence -> - emit(Fd, " if ((oe_error_code = oe_encode_~s(oe_env, &oe_rec->_u.~s)) < 0) {\n", - [getCaseTypeStr(G, N, X, I, T),ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "sequence:oe_encode_~s", - [getCaseTypeStr(G, N, X, I, T)]), - emit(Fd, " return oe_error_code;\n }\n"); - array -> - emit(Fd, " if ((oe_error_code = oe_encode_~s(oe_env, oe_rec->_u.~s)) < 0) {\n", - [getCaseTypeStr(G, N, X, I, T),ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "array:oe_encode_~s", - [getCaseTypeStr(G, N, X, I, T)]), - emit(Fd, " return oe_error_code;\n }\n"); - union -> - emit(Fd, " if ((oe_error_code = oe_encode_~s(oe_env, &oe_rec->_u.~s)) < 0) {\n", - [getCaseTypeStr(G, N, X, I, T),ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "union:oe_encode_~s", - [getCaseTypeStr(G, N, X, I, T)]), - emit(Fd, " return oe_error_code;\n }\n"); - enum -> - emit(Fd, " if ((oe_error_code = oe_encode_~s(oe_env, oe_rec->_u.~s)) < 0) {\n", - [getCaseTypeStr(G, N, X, I, T),ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "enum:oe_encode_~s", - [getCaseTypeStr(G, N, X, I, T)]), - emit(Fd, " return oe_error_code;\n }\n"); - any -> %% Fix for any type - emit(Fd, " if ((oe_error_code = oe_ei_encode_long(oe_env, oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "enum:oe_ei_encodelong", []), - emit(Fd, " return oe_error_code;\n }\n"); - _ -> - ic_error:fatal_error(G, {illegal_typecode_for_c, T, N}) - end; -getCaseTypeEncode(G, N, X, Fd, I, T) -> - case I of - {array,AID,_} -> - ArrayName = ic_util:to_undersc([ic_forms:get_id2(AID),ic_forms:get_id2(X) | N]), - emit(Fd, " if ((oe_error_code = oe_encode_~s(oe_env, oe_rec->_u.~s)) < 0) {\n", - [ArrayName,ic_forms:get_id2(AID)]), - ?emit_c_enc_rpt(Fd, " ", "array:oe_encode_~s", [ArrayName]), - emit(Fd, " return oe_error_code;\n }\n"); - _ -> - case T of - {short,_} -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_long(oe_env, oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "short:oe_ei_encode_long", []), - emit(Fd, " return oe_error_code;\n }\n"); - {unsigned,{short,_}} -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_ulong(oe_env, oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "ushort:oe_ei_encode_ulong", []), - emit(Fd, " return oe_error_code;\n }\n"); - {long, _} -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_long(oe_env, oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "long:oe_ei_encode_long", []), - emit(Fd, " return oe_error_code;\n }\n"); - {unsigned,{long,_}} -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_ulong(oe_env, oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "ulong:oe_ei_encode_ulong", []), - emit(Fd, " return oe_error_code;\n }\n"); - {float,_} -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_double(oe_env, oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "float:oe_ei_encode_double", []), - emit(Fd, " return oe_error_code;\n }\n"); - {double,_} -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_double(oe_env, oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "double:oe_ei_encode_double", []), - emit(Fd, " return oe_error_code;\n }\n"); - {boolean,_} -> - emit(Fd, " switch(oe_rec->_u.~s) {\n",[ic_forms:get_id2(I)]), - emit(Fd, " case 0:\n"), - emit(Fd, " if ((oe_error_code = oe_ei_encode_atom(oe_env, \"false\")) < 0) {\n"), - ?emit_c_enc_rpt(Fd, " ", "boolean:oe_ei_encode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " break;\n"), - emit(Fd, " case 1:\n"), - emit(Fd, " if ((oe_error_code = oe_ei_encode_atom(oe_env, \"true\")) < 0) {\n"), - ?emit_c_enc_rpt(Fd, " ", "boolean:oe_ei_encode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " break;\n"), - emit(Fd, " default:\n"), - ?emit_c_enc_rpt(Fd, " ", "boolean failure", []), - emit(Fd, " return -1;\n"), - emit(Fd, " }\n"); - {char,_} -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_char(oe_env, oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "char:oe_ei_encode_char", []), - emit(Fd, " return oe_error_code;\n }\n"); - {octet,_} -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_char(oe_env, oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "octet:oe_ei_encode_char", []), - emit(Fd, " return oe_error_code;\n }\n"); - {string,_} -> - emit(Fd, " if ((oe_error_code = oe_ei_encode_string(oe_env, oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "oe_ei_encode_string", []), - emit(Fd, " return oe_error_code;\n }\n"); - {sequence,_,_} -> - SeqName = ic_util:to_undersc([ic_forms:get_id2(I), ic_forms:get_id2(X) | N]), - emit(Fd, " if ((oe_error_code = oe_encode_~s(oe_env, &oe_rec->_u.~s)) < 0) {\n", - [SeqName,ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "sequence:oe_encode_~s", [SeqName]), - emit(Fd, " return oe_error_code;\n }\n"); - {struct,SID,_,_} -> - StructName = ic_util:to_undersc([ic_forms:get_id2(SID), ic_forms:get_id2(X) | N]), - emit(Fd, " if ((oe_error_code = oe_encode_~s(oe_env, &oe_rec->_u.~s)) < 0) {\n", - [StructName,ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "struct:oe_encode_~s", [StructName]), - emit(Fd, " return oe_error_code;\n }\n"); - {union,UID,_,_,_} -> - UnionName = ic_util:to_undersc([ic_forms:get_id2(UID), ic_forms:get_id2(X) | N]), - emit(Fd, " if ((oe_error_code = oe_encode_~s(oe_env, &oe_rec->_u.~s)) < 0) {\n", - [UnionName,ic_forms:get_id2(I)]), - ?emit_c_enc_rpt(Fd, " ", "union:oe_encode_~s", [UnionName]), - emit(Fd, " return oe_error_code;\n }\n"); - _ -> - ic_error:fatal_error(G, {illegal_typecode_for_c, T, N}) - end - end. - - - - -%% -%% Decode facilities -%% -emit_union_decode(G, N, X, Fd, UnionName) -> - emit(Fd, "int ~s~s(CORBA_Environment *oe_env, char *oe_first, int* oe_index, ~s* oe_rec) {\n\n", - [ic_util:mk_oe_name(G, "decode_"), UnionName, UnionName]), - - emit(Fd, " int oe_error_code = 0;\n"), - emit(Fd, " int oe_tmp = 0;\n"), - emit(Fd, " char oe_union_name[256];\n\n"), - - emit(Fd, " if((char*) oe_rec == oe_first)\n",[]), - AlignName = lists:concat(["*oe_index + sizeof(",UnionName,")"]), - emit(Fd, " *oe_index = ~s;\n\n", [ic_util:mk_align(AlignName)]), - - emit(Fd, " if ((oe_error_code = ei_decode_tuple_header(oe_env->_inbuf, &oe_env->_iin, &oe_tmp)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "ei_decode_tuple_header", []), - emit(Fd, " return oe_error_code;\n }\n"), - - emit(Fd, " if ((oe_error_code = ei_decode_atom(oe_env->_inbuf, &oe_env->_iin, oe_union_name)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "ei_decode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"), - - emit_c_union_discr_decode(G, N, X, Fd), - emit(Fd, " /* Decode union */\n"), - emit(Fd, " switch(oe_rec->_d) {\n"), - emit_c_union_loop(G, N, X, Fd, X#union.body, decode), - emit(Fd, " }\n\n"), - - emit(Fd, " *oe_index = ~s;\n", [ic_util:mk_align("*oe_index")]), - emit(Fd, " return 0;\n"), - emit(Fd, "}\n\n\n"). - - -emit_c_union_discr_decode(G, N, X, Fd) -> - emit(Fd, " /* Decode descriminator */\n"), - UD = get_c_union_discriminator(G, N, X), - case UD of - "CORBA_short" -> - emit(Fd, " {\n"), - emit(Fd, " long oe_long;\n"), - emit(Fd, " if ((oe_error_code = ei_decode_long(oe_env->_inbuf, &oe_env->_iin, &oe_long)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "short:ei_decode_long", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " oe_rec->_d = (short) oe_long;\n\n"), - emit(Fd, " if (oe_rec->_d != oe_long)\n return -1;\n"), - emit(Fd, " }\n\n"); - "CORBA_unsigned_short" -> - emit(Fd, " {\n"), - emit(Fd, " unsigned long oe_ulong;\n"), - emit(Fd, " if ((oe_error_code = ei_decode_ulong(oe_env->_inbuf, &oe_env->_iin, &oe_ulong)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "unshort:ei_decode_ulong", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " oe_rec->_d = (unsigned short) oe_ulong;\n\n"), - emit(Fd, " if (oe_rec->_d != oe_ulong)\n return -1;\n"), - emit(Fd, " }\n\n"); - "CORBA_long" -> - emit(Fd, " if ((oe_error_code = ei_decode_long(oe_env->_inbuf, &oe_env->_iin, &oe_rec->_d)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "long:ei_decode_long", []), - emit(Fd, " return oe_error_code;\n }\n"); - "CORBA_unsigned_long" -> - emit(Fd, " if ((oe_error_code = ei_decode_ulong(oe_env->_inbuf, &oe_env->_iin, &oe_rec->_d)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "ulong:ei_decode_ulong", []), - emit(Fd, " return oe_error_code;\n }\n"); - "CORBA_boolean" -> - emit(Fd, " {\n"), - emit(Fd, " char oe_bool[25];\n\n"), - emit(Fd, " if ((oe_error_code = ei_decode_atom(oe_env->_inbuf, &oe_env->_iin, oe_bool)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "boolean:ei_decode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " if (strcmp(oe_bool, \"false\") == 0) {\n"), - emit(Fd, " oe_rec->_d = 0;\n"), - emit(Fd, " }else if (strcmp(oe_bool, \"true\") == 0) {\n"), - emit(Fd, " oe_rec->_d = 1;\n"), - emit(Fd, " } else {\n"), - emit_c_dec_rpt(Fd, " ", "boolean failure", []), - emit(Fd, " return -1;\n }\n"), - emit(Fd, " }\n\n"); - "CORBA_char" -> - emit(Fd, " if ((oe_error_code = ei_decode_char(oe_env->_inbuf, &oe_env->_iin, &oe_rec->_d)) < 0) {\n"), - emit_c_dec_rpt(Fd, " ", "char:ei_decode_char", []), - emit(Fd, " return oe_error_code;\n }\n"); - T -> - emit(Fd, " if ((oe_error_code = oe_decode_~s(oe_env, oe_first, oe_index, &oe_rec->_d)) < 0) {\n", - [T]), - ?emit_c_dec_rpt(Fd, " ", "oe_decode_~s", [T]), - emit(Fd, " return oe_error_code;\n }\n") - end. - - - -getCaseTypeDecode(G, N, X, Fd, I, T) when element(1, T) == scoped_id -> - case ic_fetch:member2type(G,X,I) of - ushort -> - emit(Fd, " {\n"), - emit(Fd, " unsigned long oe_ulong;\n"), - emit(Fd, " if ((oe_error_code = ei_decode_ulong(oe_env->_inbuf, &oe_env->_iin, &oe_ulong)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "ushort:ei_decode_ulong", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " oe_rec->_u.~s = (unsigned short) oe_ulong;\n\n",[ic_forms:get_id2(I)]), - emit(Fd, " if (oe_rec->_u.~s != oe_ulong)\n return -1;\n",[ic_forms:get_id2(I)]), - emit(Fd, " }\n"); - ulong -> - emit(Fd, " if ((oe_error_code = ei_decode_ulong(oe_env->_inbuf, &oe_env->_iin, &oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "ulong:ei_decode_ulong", []), - emit(Fd, " return oe_error_code;\n }\n"); - short -> - emit(Fd, " {\n"), - emit(Fd, " long oe_long;\n"), - emit(Fd, " if ((oe_error_code = ei_decode_long(oe_env->_inbuf, &oe_env->_iin, &oe_long)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "short:ei_decode_long", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " oe_rec->_u.~s = (short) oe_long;\n\n",[ic_forms:get_id2(I)]), - emit(Fd, " if (oe_rec->_u.~s != oe_long)\n return -1;\n",[ic_forms:get_id2(I)]), - emit(Fd, " }\n"); - long -> - emit(Fd, " if ((oe_error_code = ei_decode_long(oe_env->_inbuf, &oe_env->_iin, &oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "long:ei_decode_long", []), - emit(Fd, " return oe_error_code;\n }\n"); - float -> - emit(Fd, " {\n"), - emit(Fd, " double oe_double;\n"), - emit(Fd, " if ((oe_error_code = ei_decode_double(oe_env->_inbuf, &oe_env->_iin, &oe_double)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "float:ei_decode_double", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " oe_rec->_u.~s = (float) oe_double;\n",[ic_forms:get_id2(I)]), - emit(Fd, " }\n"); - double -> - emit(Fd, " if ((oe_error_code = ei_decode_double(oe_env->_inbuf, &oe_env->_iin, &oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "double:ei_decode_double", []), - emit(Fd, " return oe_error_code;\n }\n"); - boolean -> - emit(Fd, " {\n"), - emit(Fd, " char oe_bool[25];\n\n"), - emit(Fd, " if ((oe_error_code = ei_decode_atom(oe_env->_inbuf, &oe_env->_iin, oe_bool)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "boolean:ei_decode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " if (strcmp(oe_bool, \"false\") == 0) {\n"), - emit(Fd, " oe_rec->_u.~s = 0;\n",[ic_forms:get_id2(I)]), - emit(Fd, " } else if (strcmp(oe_bool, \"true\") == 0) {\n"), - emit(Fd, " oe_rec->_u.~s = 1;\n",[ic_forms:get_id2(I)]), - emit(Fd, " } else {\n"), - ?emit_c_dec_rpt(Fd, " ", "boolean failure", []), - emit(Fd, " return -1;\n }\n"), - emit(Fd, " }\n"); - char -> - emit(Fd, " if ((oe_error_code = ei_decode_char(oe_env->_inbuf, &oe_env->_iin, &oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "char:ei_decode_char", []), - emit(Fd, " return oe_error_code;\n }\n"); - octet -> - emit(Fd, " if ((oe_error_code = ei_decode_char(oe_env->_inbuf, &oe_env->_iin, &oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "octet:ei_decode_char", []), - emit(Fd, " return oe_error_code;\n }\n"); - string -> - emit(Fd, " {\n"), - emit(Fd, " int oe_type = 0;\n"), - emit(Fd, " int oe_string_ctr = 0;\n\n"), - - emit(Fd, " (int) ei_get_type(oe_env->_inbuf, &oe_env->_iin, &oe_type, &oe_string_ctr);\n\n"), - - emit(Fd, " oe_rec->_u.~s = (void *) (oe_first + *oe_index);\n\n",[ic_forms:get_id2(I)]), - - emit(Fd, " if ((oe_error_code = ei_decode_string(oe_env->_inbuf, &oe_env->_iin, oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "ei_decode_string", []), - emit(Fd, " return oe_error_code;\n }\n"), - - emit(Fd, " *oe_index = ~s;\n",[ic_util:mk_align("*oe_index+oe_string_ctr+1")]), - emit(Fd, " }\n"); - struct -> - case ic_cbe:mk_c_type(G, N, T, evaluate_not) of - "erlang_pid" -> - emit(Fd, " if ((oe_error_code = ei_decode_pid(oe_env->_inbuf, &oe_env->_iin, &oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "ei_decode_pid", []), - emit(Fd, " return oe_error_code;\n }\n"); - "erlang_port" -> - emit(Fd, " if ((oe_error_code = ei_decode_port(oe_env->_inbuf, &oe_env->_iin, &oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "ei_decode_port", []), - emit(Fd, " return oe_error_code;\n }\n"); - "erlang_ref" -> - emit(Fd, " if ((oe_error_code = ei_decode_ref(oe_env->_inbuf, &oe_env->_iin, &oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "ei_decode_ref", []), - emit(Fd, " return oe_error_code;\n }\n"); - "ETERM*" -> - emit(Fd, " if ((oe_error_code = ei_decode_term(oe_env->_inbuf, &oe_env->_iin, (void **)&oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "ei_decode_term", []), - emit(Fd, " return oe_error_code;\n }\n"); - - _ -> - emit(Fd, " if ((oe_error_code = oe_decode_~s(oe_env, oe_first, oe_index, &oe_rec->_u.~s)) < 0) {\n", - [getCaseTypeStr(G, N, X, I, T),ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "oe_decode_~s", - [getCaseTypeStr(G, N, X, I, T)]), - emit(Fd, " return oe_error_code;\n }\n") - end; - sequence -> - emit(Fd, " if ((oe_error_code = oe_decode_~s(oe_env, oe_first, oe_index, &oe_rec->_u.~s)) < 0) {\n", - [getCaseTypeStr(G, N, X, I, T),ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "sequence:oe_decode_~s", - [getCaseTypeStr(G, N, X, I, T)]), - emit(Fd, " return oe_error_code;\n }\n"); - array -> - emit(Fd, " if ((oe_error_code = oe_decode_~s(oe_env, oe_first, oe_index, oe_rec->_u.~s)) < 0) {\n", - [getCaseTypeStr(G, N, X, I, T),ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "array:oe_decode_~s", [getCaseTypeStr(G, N, X, I, T)]), - emit(Fd, " return oe_error_code;\n }\n"); - union -> - emit(Fd, " if ((oe_error_code = oe_decode_~s(oe_env, oe_first, oe_index, &oe_rec->_u.~s)) < 0) {\n", - [getCaseTypeStr(G, N, X, I, T),ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "union:oe_decode_~s", [getCaseTypeStr(G, N, X, I, T)]), - emit(Fd, " return oe_error_code;\n }\n"); - enum -> - emit(Fd, " if ((oe_error_code = oe_decode_~s(oe_env, oe_first, oe_index, &oe_rec->_u.~s)) < 0) {\n", - [getCaseTypeStr(G, N, X, I, T),ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "enum:oe_decode_~s", [getCaseTypeStr(G, N, X, I, T)]), - emit(Fd, " return oe_error_code;\n }\n"); - any -> %% Fix for any type - emit(Fd, " if ((oe_error_code = ei_decode_long(oe_env->_inbuf, &oe_env->_iin, &oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "any:ei_decodelong", []), - emit(Fd, " return oe_error_code;\n }\n"); - _ -> - ic_error:fatal_error(G, {illegal_typecode_for_c, T, N}) - end; -getCaseTypeDecode(G, N, X, Fd, I, T) -> - case I of - {array,AID,_} -> - ArrayName = ic_util:to_undersc([ic_forms:get_id2(AID),ic_forms:get_id2(X) | N]), - emit(Fd, " if ((oe_error_code = oe_decode_~s(oe_env, oe_first, oe_index, oe_rec->_u.~s)) < 0) {\n", - [ArrayName,ic_forms:get_id2(AID)]), - ?emit_c_dec_rpt(Fd, " ", "array:oe_decode_~s", [ArrayName]), - emit(Fd, " return oe_error_code;\n }\n"); - _ -> - case T of - {short,_} -> - emit(Fd, " {\n"), - emit(Fd, " long oe_long;\n"), - emit(Fd, " if ((oe_error_code = ei_decode_long(oe_env->_inbuf, &oe_env->_iin, &oe_long)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "short:ei_decode_long", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " oe_rec->_u.~s = (short) oe_long;\n\n",[ic_forms:get_id2(I)]), - emit(Fd, " if (oe_rec->_u.~s != oe_long)\n return -1;\n",[ic_forms:get_id2(I)]), - emit(Fd, " }\n"); - {unsigned,{short,_}} -> - emit(Fd, " {\n"), - emit(Fd, " unsigned long oe_ulong;\n"), - emit(Fd, " if ((oe_error_code = ei_decode_ulong(oe_env->_inbuf, &oe_env->_iin, &oe_ulong)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "ushort:ei_decode_ulong", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " oe_rec->_u.~s = (unsigned short) oe_ulong;\n\n",[ic_forms:get_id2(I)]), - emit(Fd, " if (oe_rec->_u.~s != oe_ulong)\n return -1;\n",[ic_forms:get_id2(I)]), - emit(Fd, " }\n"); - {long, _} -> - emit(Fd, " if ((oe_error_code = ei_decode_long(oe_env->_inbuf, &oe_env->_iin, &oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "long:ei_decode_long", []), - emit(Fd, " return oe_error_code;\n }\n"); - {unsigned,{long,_}} -> - emit(Fd, " if ((oe_error_code = ei_decode_ulong(oe_env->_inbuf, &oe_env->_iin, &oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "ulong:ei_decode_ulong", []), - emit(Fd, " return oe_error_code;\n }\n"); - {float,_} -> - emit(Fd, " {\n"), - emit(Fd, " double oe_double;\n"), - emit(Fd, " if ((oe_error_code = ei_decode_double(oe_env->_inbuf, &oe_env->_iin, &oe_double)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "float:ei_decode_double", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " oe_rec->_u.~s = (float) oe_double;\n",[ic_forms:get_id2(I)]), - emit(Fd, " }\n"); - {double,_} -> - emit(Fd, " if ((oe_error_code = ei_decode_double(oe_env->_inbuf, &oe_env->_iin, &oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "dobule:ei_decode_double", []), - emit(Fd, " return oe_error_code;\n }\n"); - {boolean,_} -> - emit(Fd, " {\n"), - emit(Fd, " char oe_bool[25];\n\n"), - emit(Fd, " if ((oe_error_code = ei_decode_atom(oe_env->_inbuf, &oe_env->_iin, oe_bool)) < 0) {\n"), - ?emit_c_dec_rpt(Fd, " ", "boolean:ei_decode_atom", []), - emit(Fd, " return oe_error_code;\n }\n"), - emit(Fd, " if (strcmp(oe_bool, \"false\") == 0) {\n"), - emit(Fd, " oe_rec->_u.~s = 0;\n",[ic_forms:get_id2(I)]), - emit(Fd, " } else if (strcmp(oe_bool, \"true\") == 0) {\n"), - emit(Fd, " oe_rec->_u.~s = 1;\n",[ic_forms:get_id2(I)]), - emit(Fd, " } else {\n"), - ?emit_c_dec_rpt(Fd, " ", "boolean failure", []), - emit(Fd, " return -1;\n }\n"), - emit(Fd, " }\n"); - {char,_} -> - emit(Fd, " if ((oe_error_code = ei_decode_char(oe_env->_inbuf, &oe_env->_iin, &oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "char:ei_decode_char", []), - emit(Fd, " return oe_error_code;\n }\n"); - {octet,_} -> - emit(Fd, " if ((oe_error_code = ei_decode_char(oe_env->_inbuf, &oe_env->_iin, &oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - emit(Fd, " return oe_error_code;\n }\n"); - {string,_} -> - emit(Fd, " {\n"), - emit(Fd, " int oe_type = 0;\n"), - emit(Fd, " int oe_string_ctr = 0;\n\n"), - - emit(Fd, " (int) ei_get_type(oe_env->_inbuf, &oe_env->_iin, &oe_type, &oe_string_ctr);\n\n"), - - emit(Fd, " oe_rec->_u.~s = (void *) (oe_first + *oe_index);\n\n",[ic_forms:get_id2(I)]), - - emit(Fd, " if ((oe_error_code = ei_decode_string(oe_env->_inbuf, &oe_env->_iin, oe_rec->_u.~s)) < 0) {\n", - [ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "ei_decode_string", []), - emit(Fd, " return oe_error_code;\n }\n"), - - emit(Fd, " *oe_index = ~s;\n",[ic_util:mk_align("*oe_index+oe_string_ctr+1")]), - emit(Fd, " }\n"); - {sequence,_,_} -> - SeqName = ic_util:to_undersc([ic_forms:get_id2(I), ic_forms:get_id2(X) | N]), - emit(Fd, " if ((oe_error_code = oe_decode_~s(oe_env, oe_first, oe_index, &oe_rec->_u.~s)) < 0) {\n", - [SeqName,ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "sequence:oe_decode_~s", [SeqName]), - emit(Fd, " return oe_error_code;\n }\n"); - {struct,SID,_,_} -> - StructName = ic_util:to_undersc([ic_forms:get_id2(SID), ic_forms:get_id2(X) | N]), - emit(Fd, " if ((oe_error_code = oe_decode_~s(oe_env, oe_first, oe_index, &oe_rec->_u.~s)) < 0) {\n", - [StructName,ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "struct:oe_decode_~s", [StructName]), - emit(Fd, " return oe_error_code;\n }\n"); - {union,UID,_,_,_} -> - UnionName = ic_util:to_undersc([ic_forms:get_id2(UID), ic_forms:get_id2(X) | N]), - emit(Fd, " if ((oe_error_code = oe_decode_~s(oe_env, oe_first, oe_index, &oe_rec->_u.~s)) < 0) {\n", - [UnionName,ic_forms:get_id2(I)]), - ?emit_c_dec_rpt(Fd, " ", "union:oe_decode_~s", [UnionName]), - emit(Fd, " return oe_error_code;\n }"); - _ -> - ic_error:fatal_error(G, {illegal_typecode_for_c, T, N}) - end - end. - -mvDefaultToTail(CDclL) -> - mvDefaultToTail(CDclL,[],[]). - - -mvDefaultToTail([], F, FD) -> - lists:reverse(F) ++ FD; -mvDefaultToTail([{case_dcl,CaseList,I,T}|Rest], Found, FoundDefault) -> - case lists:keysearch(default, 1, CaseList) of - {value,Default} -> - NewCaseList = lists:delete(Default, CaseList) ++ [Default], - mvDefaultToTail(Rest, Found, [{case_dcl,NewCaseList,I,T}|FoundDefault]); - false -> - mvDefaultToTail(Rest, [{case_dcl,CaseList,I,T}|Found], FoundDefault) - end. - - diff --git a/lib/ic/src/icyeccpre.hrl b/lib/ic/src/icyeccpre.hrl deleted file mode 100644 index 3a2fad185f..0000000000 --- a/lib/ic/src/icyeccpre.hrl +++ /dev/null @@ -1,125 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - - --export([parse/1, parse_and_scan/1, format_error/1]). - --import(lists, [reverse/1]). - --ifdef(JAM). --compile([{parse_transform,jam_yecc_pj},pj]). --endif. - - --include("icforms.hrl"). - - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% The parser generator will insert appropriate declarations before this line.% - -parse(Tokens) -> - case catch yeccpars1(Tokens, false, 0, [], []) of - error -> - Errorline = - if Tokens == [] -> 0; true -> element(2, hd(Tokens)) end, - {error, - {Errorline, ?MODULE, "syntax error at or after this line."}}; - Other -> - Other - end. - -parse_and_scan({Mod, Fun, Args}) -> - case apply(Mod, Fun, Args) of - {eof, _} -> - {ok, eof}; - {error, Descriptor, _} -> - {error, Descriptor}; - {ok, Tokens, _} -> - yeccpars1(Tokens, {Mod, Fun, Args}, 0, [], []) - end. - -format_error(Message) -> - case io_lib:deep_char_list(Message) of - true -> - Message; - _ -> - io_lib:write(Message) - end. - -% To be used in grammar files to throw an error message to the parser toplevel. -% Doesn't have to be exported! -return_error(Line, Message) -> - throw({error, {Line, ?MODULE, Message}}). - - -% Don't change yeccpars1/6 too much, it is called recursively by yeccpars2/8! -yeccpars1([Token | Tokens], Tokenizer, State, States, Vstack) -> - yeccpars2(State, element(1, Token), States, Vstack, Token, Tokens, - Tokenizer); -yeccpars1([], {M, F, A}, State, States, Vstack) -> - case catch apply(M, F, A) of - {eof, Endline} -> - {error, {Endline, ?MODULE, "end_of_file"}}; - {error, Descriptor, _Endline} -> - {error, Descriptor}; - {'EXIT', Reason} -> - {error, {0, ?MODULE, Reason}}; - {ok, Tokens, _Endline} -> - case catch yeccpars1(Tokens, {M, F, A}, State, States, Vstack) of - error -> - Errorline = element(2, hd(Tokens)), - {error, {Errorline, ?MODULE, - "syntax error at or after this line."}}; - Other -> - Other - end - end; -yeccpars1([], false, State, States, Vstack) -> - yeccpars2(State, '$end', States, Vstack, {'$end', 999999}, [], false). - -% For internal use only. -yeccerror(Token) -> - {error, - {element(2, Token), ?MODULE, - ["syntax error before: ", yecctoken2string(Token)]}}. - -yecctoken2string({atom, _, A}) -> io_lib:write(A); -yecctoken2string({integer,_,N}) -> io_lib:write(N); -yecctoken2string({float,_,F}) -> io_lib:write(F); -yecctoken2string({char,_,C}) -> io_lib:write_char(C); -yecctoken2string({var,_,V}) -> io_lib:format("~s", [V]); -yecctoken2string({string,_,S}) -> io_lib:write_string(S); -yecctoken2string({reserved_symbol, _, A}) -> io_lib:format("~w", [A]); -yecctoken2string({'dot', _}) -> "'.'"; -yecctoken2string({'$end', _}) -> - []; -yecctoken2string({Other, _}) when is_atom(Other) -> - io_lib:format("~w", [Other]); -yecctoken2string({_, _, Other}) when is_list(Other) andalso is_number(hd(Other)) -> - Other; -yecctoken2string({_, _, Other}) -> - io_lib:format("~p", [Other]); -yecctoken2string(Other) -> - io_lib:write(Other). - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - diff --git a/lib/ic/test/Makefile b/lib/ic/test/Makefile deleted file mode 100644 index 55b8915875..0000000000 --- a/lib/ic/test/Makefile +++ /dev/null @@ -1,276 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1998-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(IC_VSN) -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/ic_test - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -TEST_SPEC_FILE = ic.spec ic_smoke.spec - - -IDL_FILES = - -COMPILER_TEST_FILES = \ - ic_SUITE_data/Corba.idl \ - ic_SUITE_data/Coss.idl \ - ic_SUITE_data/attr.idl \ - ic_SUITE_data/c_err1.idl \ - ic_SUITE_data/c_err2.idl \ - ic_SUITE_data/c_err3.idl \ - ic_SUITE_data/c_norm.idl \ - ic_SUITE_data/enum.idl \ - ic_SUITE_data/forward.idl \ - ic_SUITE_data/include.idl \ - ic_SUITE_data/include2.idl \ - ic_SUITE_data/include3.idl \ - ic_SUITE_data/inherit.idl \ - ic_SUITE_data/inherit_err.idl \ - ic_SUITE_data/inherit_warn.idl \ - ic_SUITE_data/mult_ids.idl \ - ic_SUITE_data/nasty.idl \ - ic_SUITE_data/one.idl \ - ic_SUITE_data/one_out.idl \ - ic_SUITE_data/one_raises.idl \ - ic_SUITE_data/one_followed.idl \ - ic_SUITE_data/one_void.idl \ - ic_SUITE_data/raises_reg.idl \ - ic_SUITE_data/struct.idl \ - ic_SUITE_data/syntax1.idl \ - ic_SUITE_data/syntax2.idl \ - ic_SUITE_data/syntax3.idl \ - ic_SUITE_data/syntax4.idl \ - ic_SUITE_data/syntax5.idl \ - ic_SUITE_data/syntax6.idl \ - ic_SUITE_data/type.idl \ - ic_SUITE_data/typeid.idl \ - ic_SUITE_data/u_case_mult.idl \ - ic_SUITE_data/u_mult.idl \ - ic_SUITE_data/u_norm.idl \ - ic_SUITE_data/u_type.idl \ - ic_SUITE_data/u_default.idl \ - ic_SUITE_data/undef_id.idl - - -COMPILER_TEST_FILES2 = \ - ic_register_SUITE_data/reg_m8.idl \ - ic_register_SUITE_data/reg_m9.idl \ - ic_register_SUITE_data/reg_m10.idl \ - ic_register_SUITE_data/reg_m11.idl \ - ic_register_SUITE_data/reg_m12.idl - - -COMPILER_TEST_FILES3 = \ - ic_pragma_SUITE_data/reg_m0.idl \ - ic_pragma_SUITE_data/reg_m1.idl \ - ic_pragma_SUITE_data/reg_m2.idl \ - ic_pragma_SUITE_data/reg_m3.idl \ - ic_pragma_SUITE_data/reg_m4.idl \ - ic_pragma_SUITE_data/reg_m5.idl \ - ic_pragma_SUITE_data/reg_m6.idl \ - ic_pragma_SUITE_data/reg_m7.idl \ - ic_pragma_SUITE_data/uggly.idl - - -COMPILER_TEST_FILES4 = \ - ic_be_SUITE_data/plain.idl - - -PREPROCESSOR_TEST_FILES = \ - ic_pp_SUITE_data/arg.idl \ - ic_pp_SUITE_data/cascade.idl \ - ic_pp_SUITE_data/comment.idl \ - ic_pp_SUITE_data/concat.idl \ - ic_pp_SUITE_data/define.idl \ - ic_pp_SUITE_data/if.idl \ - ic_pp_SUITE_data/if_zero.idl \ - ic_pp_SUITE_data/improp_nest_constr.idl \ - ic_pp_SUITE_data/inc.idl \ - ic_pp_SUITE_data/line.idl \ - ic_pp_SUITE_data/misc.idl \ - ic_pp_SUITE_data/nopara.idl \ - ic_pp_SUITE_data/predef.idl \ - ic_pp_SUITE_data/predef_time.idl \ - ic_pp_SUITE_data/self_ref.idl \ - ic_pp_SUITE_data/separate.idl \ - ic_pp_SUITE_data/swallow_sc.idl \ - ic_pp_SUITE_data/unintended_grp.idl - -C_CLIENT_ERL_SERVER_TEST_FILES = \ - c_client_erl_server_SUITE_data/Makefile.src \ - c_client_erl_server_SUITE_data/c_erl_test.idl \ - c_client_erl_server_SUITE_data/c_client.c \ - c_client_erl_server_SUITE_data/m_i_impl.erl - -C_CLIENT_ERL_SERVER_PROTO_TEST_FILES = \ - c_client_erl_server_proto_SUITE_data/Makefile.src \ - c_client_erl_server_proto_SUITE_data/c_erl_test.idl \ - c_client_erl_server_proto_SUITE_data/c_client.c \ - c_client_erl_server_proto_SUITE_data/my.c \ - c_client_erl_server_proto_SUITE_data/m_i_impl.erl - -C_CLIENT_ERL_SERVER_PROTO_TMO_TEST_FILES = \ - c_client_erl_server_proto_tmo_SUITE_data/Makefile.src \ - c_client_erl_server_proto_tmo_SUITE_data/c_erl_test.idl \ - c_client_erl_server_proto_tmo_SUITE_data/c_client.c \ - c_client_erl_server_proto_tmo_SUITE_data/my.c \ - c_client_erl_server_proto_tmo_SUITE_data/m_i_impl.erl - -ERL_CLIENT_C_SERVER_TEST_FILES = \ - erl_client_c_server_SUITE_data/Makefile.src \ - erl_client_c_server_SUITE_data/erl_c_test.idl \ - erl_client_c_server_SUITE_data/erl_client.erl \ - erl_client_c_server_SUITE_data/c_server.c \ - erl_client_c_server_SUITE_data/callbacks.c - -ERL_CLIENT_C_SERVER_PROTO_TEST_FILES = \ - erl_client_c_server_proto_SUITE_data/Makefile.src \ - erl_client_c_server_proto_SUITE_data/erl_c_test.idl \ - erl_client_c_server_proto_SUITE_data/erl_client.erl \ - erl_client_c_server_proto_SUITE_data/c_server.c \ - erl_client_c_server_proto_SUITE_data/callbacks.c - -JAVA_CLIENT_ERL_SERVER_TEST_FILES = \ - java_client_erl_server_SUITE_data/Makefile.src \ - java_client_erl_server_SUITE_data/java_erl_test.idl \ - java_client_erl_server_SUITE_data/JavaClient.java \ - java_client_erl_server_SUITE_data/m_i_impl.erl - -MODULES = \ - ic_SUITE \ - ic_register_SUITE \ - ic_pragma_SUITE \ - ic_pp_SUITE \ - ic_be_SUITE \ - c_client_erl_server_SUITE \ - c_client_erl_server_proto_SUITE \ - c_client_erl_server_proto_tmo_SUITE \ - erl_client_c_server_SUITE \ - erl_client_c_server_proto_SUITE \ - java_client_erl_server_SUITE - -GEN_MODULES = - -ERL_FILES = $(MODULES:%=%.erl) - -HRL_FILES = - -GEN_HRL_FILES = - - -GEN_FILES = \ - $(GEN_HRL_FILES:%=$(IDLOUTDIR)/%) \ - $(GEN_MODULES=:%=$(IDLOUTDIR)/%.erl) - -GEN_TARGET_FILES = $(GEN_MODULES:%=$(IDLOUTDIR)/%.$(EMULATOR)) - -SUITE_TARGET_FILES = $(MODULES:%=%.$(EMULATOR)) - -TARGET_FILES = \ - $(GEN_TARGET_FILES) \ - $(SUITE_TARGET_FILES) - -# ---------------------------------------------------- -# PROGRAMS -# ---------------------------------------------------- - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_LOCAL_FLAGS += -pa $(ERL_TOP)/lib/orber/ebin -pa $(ERL_TOP)/lib/ic/ebin - -ERL_COMPILE_FLAGS += \ - $(ERL_LOCAL_FLAGS) \ - -pa $(ERL_TOP)/lib/orber/ebin \ - -I$(ERL_TOP)/lib/orber - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -tests debug opt: $(TARGET_FILES) - -clean: - rm -f $(TARGET_FILES) - rm -f errs core *~ - -docs: - -# ---------------------------------------------------- -# Special Targets -# ---------------------------------------------------- - - -# ---------------------------------------------------- -# Release Targets -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: - -release_docs_spec: - -release_tests_spec: tests - $(INSTALL_DIR) "$(RELSYSDIR)" - $(INSTALL_DIR) "$(RELSYSDIR)/ic_SUITE_data" - $(INSTALL_DIR) "$(RELSYSDIR)/ic_register_SUITE_data" - $(INSTALL_DIR) "$(RELSYSDIR)/ic_pragma_SUITE_data" - $(INSTALL_DIR) "$(RELSYSDIR)/ic_pp_SUITE_data" - $(INSTALL_DIR) "$(RELSYSDIR)/ic_be_SUITE_data" - $(INSTALL_DIR) "$(RELSYSDIR)/c_client_erl_server_SUITE_data" - $(INSTALL_DIR) "$(RELSYSDIR)/c_client_erl_server_proto_SUITE_data" - $(INSTALL_DIR) "$(RELSYSDIR)/c_client_erl_server_proto_tmo_SUITE_data" - $(INSTALL_DIR) "$(RELSYSDIR)/erl_client_c_server_SUITE_data" - $(INSTALL_DIR) "$(RELSYSDIR)/erl_client_c_server_proto_SUITE_data" - $(INSTALL_DIR) "$(RELSYSDIR)/java_client_erl_server_SUITE_data" - $(INSTALL_DATA) $(IDL_FILES) ic.cover $(TEST_SPEC_FILE) $(ERL_FILES) \ - "$(RELSYSDIR)" - $(INSTALL_DATA) $(COMPILER_TEST_FILES) "$(RELSYSDIR)/ic_SUITE_data" - $(INSTALL_DATA) $(COMPILER_TEST_FILES2) \ - "$(RELSYSDIR)/ic_register_SUITE_data" - $(INSTALL_DATA) $(COMPILER_TEST_FILES3) \ - "$(RELSYSDIR)/ic_pragma_SUITE_data" - $(INSTALL_DATA) $(COMPILER_TEST_FILES4) \ - "$(RELSYSDIR)/ic_be_SUITE_data" - $(INSTALL_DATA) $(PREPROCESSOR_TEST_FILES) \ - "$(RELSYSDIR)/ic_pp_SUITE_data" - $(INSTALL_DATA) $(C_CLIENT_ERL_SERVER_TEST_FILES) \ - "$(RELSYSDIR)/c_client_erl_server_SUITE_data" - $(INSTALL_DATA) $(C_CLIENT_ERL_SERVER_PROTO_TEST_FILES) \ - "$(RELSYSDIR)/c_client_erl_server_proto_SUITE_data" - $(INSTALL_DATA) $(C_CLIENT_ERL_SERVER_PROTO_TMO_TEST_FILES) \ - "$(RELSYSDIR)/c_client_erl_server_proto_tmo_SUITE_data" - $(INSTALL_DATA) $(ERL_CLIENT_C_SERVER_TEST_FILES) \ - "$(RELSYSDIR)/erl_client_c_server_SUITE_data" - $(INSTALL_DATA) $(ERL_CLIENT_C_SERVER_PROTO_TEST_FILES) \ - "$(RELSYSDIR)/erl_client_c_server_proto_SUITE_data" - $(INSTALL_DATA) $(SUITE_TARGET_FILES) "$(RELSYSDIR)" - $(INSTALL_DATA) $(JAVA_CLIENT_ERL_SERVER_TEST_FILES) \ - "$(RELSYSDIR)/java_client_erl_server_SUITE_data" diff --git a/lib/ic/test/c_client_erl_server_SUITE.erl b/lib/ic/test/c_client_erl_server_SUITE.erl deleted file mode 100644 index b6e100e102..0000000000 --- a/lib/ic/test/c_client_erl_server_SUITE.erl +++ /dev/null @@ -1,265 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - -%%---------------------------------------------------------------------- -%% Purpose : Test suite for c-client/erl-server -%%---------------------------------------------------------------------- - - --module(c_client_erl_server_SUITE). --include_lib("common_test/include/ct.hrl"). - --export([init_per_testcase/2, end_per_testcase/2, - all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2, - void_test/1, long_test/1, long_long_test/1, - unsigned_short_test/1, unsigned_long_test/1, - unsigned_long_long_test/1, double_test/1, char_test/1, - wchar_test/1, octet_test/1, bool_test/1, struct_test/1, - struct2_test/1, seq1_test/1, seq2_test/1, seq3_test/1, - seq4_test/1, seq5_test/1, array1_test/1, array2_test/1, - enum_test/1, string1_test/1, string2_test/1, string3_test/1, - string4_test/1, pid_test/1, port_test/1, ref_test/1, term_test/1, - typedef_test/1, inline_sequence_test/1, term_sequence_test/1, - term_struct_test/1, wstring1_test/1]). - --define(DEFAULT_TIMEOUT, 20000). --define(PORT_TIMEOUT, 15000). --define(ERLANG_SERVER_NAME, idl_erlang_server). --define(C_CLIENT_NODE_NAME, c_client_idl_test). - -%% Add/remove code path and watchdog before/after each test case. -%% -init_per_testcase(_Case, Config) -> - DataDir = proplists:get_value(data_dir, Config), - code:add_patha(DataDir), - - %% Since other test suites use the module m_i, we have - %% to make sure we are using the right m_i module. - code:purge(m_i), - code:load_file(m_i), - - WatchDog = test_server:timetrap(?DEFAULT_TIMEOUT), - [{watchdog, WatchDog}| Config]. - -end_per_testcase(_Case, Config) -> - DataDir = proplists:get_value(data_dir, Config), - code:del_path(DataDir), - WatchDog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(WatchDog). - -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - [void_test, long_test, long_long_test, - unsigned_short_test, unsigned_long_test, - unsigned_long_long_test, double_test, char_test, - wchar_test, octet_test, bool_test, struct_test, - struct2_test, seq1_test, seq2_test, seq3_test, - seq4_test, seq5_test, array1_test, array2_test, - enum_test, string1_test, string2_test, string3_test, - string4_test, pid_test, port_test, ref_test, term_test, - typedef_test, inline_sequence_test, term_sequence_test, - term_struct_test, wstring1_test]. - -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - -array1_test(Config) -> - do_test(array1_test, Config). - -array2_test(Config) -> - do_test(array2_test, Config). - -bool_test(Config) -> - do_test(bool_test, Config). - -char_test(Config) -> - do_test(char_test, Config). - -double_test(Config) -> - do_test(double_test, Config). - -enum_test(Config) -> - do_test(enum_test, Config). - -inline_sequence_test(Config) -> - do_test(inline_sequence_test, Config). - -long_long_test(Config) -> - do_test(long_long_test, Config). - -long_test(Config) -> - do_test(long_test, Config). - -octet_test(Config) -> - do_test(octet_test, Config). - -pid_test(Config) -> - do_test(pid_test, Config). - -port_test(Config) -> - do_test(port_test, Config). - -ref_test(Config) -> - do_test(ref_test, Config). - -seq1_test(Config) -> - do_test(seq1_test, Config). - -seq2_test(Config) -> - do_test(seq2_test, Config). - -seq3_test(Config) -> - do_test(seq3_test, Config). - -seq4_test(Config) -> - do_test(seq4_test, Config). - -seq5_test(Config) -> - do_test(seq5_test, Config). - -string1_test(Config) -> - do_test(string1_test, Config). - -string2_test(Config) -> - do_test(string2_test, Config). - -string3_test(Config) -> - do_test(string3_test, Config). - -string4_test(Config) -> - do_test(string4_test, Config). - -struct2_test(Config) -> - do_test(struct2_test, Config). - -struct_test(Config) -> - do_test(struct_test, Config). - -term_sequence_test(Config) -> - do_test(term_sequence_test, Config). - -term_struct_test(Config) -> - do_test(term_struct_test, Config). - -term_test(Config) -> - do_test(term_test, Config). - -typedef_test(Config) -> - do_test(typedef_test, Config). - -unsigned_long_long_test(Config) -> - do_test(unsigned_long_long_test, Config). - -unsigned_long_test(Config) -> - do_test(unsigned_long_test, Config). - -unsigned_short_test(Config) -> - do_test(unsigned_short_test, Config). - -void_test(Config) -> - do_test(void_test, Config). - -wchar_test(Config) -> - do_test(wchar_test, Config). - -wstring1_test(Config) -> - do_test(wstring1_test, Config). - - -%% It is here that all tests really are done. -%% - -do_test(Case, Config) -> - %% Trap exits - process_flag(trap_exit, true), - %% Start the server - {ok, _Pid} = m_i:oe_create_link([], {local, ?ERLANG_SERVER_NAME}), - Node = atom_to_list(node()), - DataDir = proplists:get_value(data_dir, Config), - %% io:format("~p: data directory: ~p~n", [?MODULE, DataDir]), - Cookie = atom_to_list(erlang:get_cookie()), - %% Start C-client node as a port program. - Cmd = filename:join([DataDir, "c_client"]) ++ - " -this-node-name " ++ atom_to_list(?C_CLIENT_NODE_NAME) ++ - " -peer-node " ++ Node ++ - " -peer-process-name " ++ atom_to_list(?ERLANG_SERVER_NAME) ++ - " -cookie " ++ Cookie ++ - " -test-case " ++ atom_to_list(Case), - Port = open_port({spawn, Cmd}, [exit_status, eof, stderr_to_stdout]), - Res = wait_for_completion(Port), - %% Kill off node if there was timeout - case Res of - {error, timeout} -> - catch rpc:cast(?C_CLIENT_NODE_NAME, erlang, halt, [1]); - _ -> - ok - end, - process_flag(trap_exit, false), - catch m_i:stop(?ERLANG_SERVER_NAME), - ok = Res. - - -%% Wait for eof *and* exit status, but return if exit status indicates -%% an error, or we have been waiting more than PORT_TIMEOUT seconds. -%% -wait_for_completion(Port) -> - wait_for_completion(Port, 0). - -wait_for_completion(Port, N) when N < 2 -> - receive - {Port, {data, Bytes}} -> - %% Relay output - io:format("~s", [Bytes]), - wait_for_completion(Port, N); - {Port, {exit_status, 0}} -> - wait_for_completion(Port, N + 1); - {Port, {exit_status, Status}} -> - {error, Status}; - {Port, eof} -> - wait_for_completion(Port, N + 1); - {'EXIT', Port, Reason} -> - io:format("Port exited with reason: ~w~n", [Reason]), - wait_for_completion(Port, N); - {'EXIT', From, Reason} -> - io:format("Got unexpected exit: ~p~n", [{'EXIT', From, Reason}]), - wait_for_completion(Port, N) - after ?PORT_TIMEOUT -> - {error, timeout} - end; -wait_for_completion(_, _) -> - ok. - - - diff --git a/lib/ic/test/c_client_erl_server_SUITE_data/Makefile.src b/lib/ic/test/c_client_erl_server_SUITE_data/Makefile.src deleted file mode 100644 index 60ea8ea598..0000000000 --- a/lib/ic/test/c_client_erl_server_SUITE_data/Makefile.src +++ /dev/null @@ -1,155 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2001-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -# Makefile.src for c_client_erl_server test -# Note: This file *must* work for both Unix and Windows -# -# We use both `rm' (Unix) and `del' (Windows) for removing files, but -# with a `-' in front so that the error in not finding `rm' (`del') on -# Windows (Unix) is ignored. -# -# VxWorks? XXX -# - -.SUFFIXES: -.SUFFIXES: .c .h .erl .idl @obj@ .@EMULATOR@ - - -# Variables from ts: -# - -ERL_INCLUDE = @erl_include@ - -IC_INCLUDE_PATH = @ic_include_path@ -IC_LIB = @ic_lib@ - -ERL_INTERFACE_INCLUDE = @erl_interface_include@ -ERL_INTERFACE_LIB = @erl_interface_lib@ -ERL_INTERFACE_EILIB = @erl_interface_eilib@ -ERL_INTERFACE_THREADLIB = @erl_interface_threadlib@ -ERL_INTERFACE_SOCK_LIBS = @erl_interface_sock_libs@ - -CC = @CC@ -## XXX Should set warning flag with a DEBUG_FLAG -CFLAGS = @CFLAGS@ @DEFS@ -I@erl_include@ \ - -I@ic_include_path@ -I@erl_interface_include@ - -LD = @LD@ -LDFLAGS = @CROSSLDFLAGS@ -LIBS = $(IC_LIB) $(ERL_INTERFACE_LIB) $(ERL_INTERFACE_EILIB) \ - $(ERL_INTERFACE_THREADLIB) @LIBS@ $(ERL_INTERFACE_SOCK_LIBS) -ERLC = erlc - -# Generated C header files -GEN_H_FILES = \ - m.h \ - m_i.h \ - oe_c_erl_test.h - -# Generated C files -GEN_C_FILES = \ - m.c \ - m_i.c \ - oe_c_erl_test.c \ - oe_code_m_a.c \ - oe_code_m_arr1.c \ - oe_code_m_arr2.c \ - oe_code_m_arr3.c \ - oe_code_m_aseq.c \ - oe_code_m_b.c \ - oe_code_m_bseq.c \ - oe_code_m_dd.c \ - oe_code_m_dyn.c \ - oe_code_m_dyn_sl.c \ - oe_code_m_es.c \ - oe_code_m_et.c \ - oe_code_m_etseq.c \ - oe_code_m_fruit.c \ - oe_code_m_lseq.c \ - oe_code_m_s.c \ - oe_code_m_s_sl.c \ - oe_code_m_sarr3.c \ - oe_code_m_simple.c \ - oe_code_m_ssarr3.c \ - oe_code_m_sseq.c \ - oe_code_m_ssstr3.c \ - oe_code_m_sstr3.c \ - oe_code_m_str1.c \ - oe_code_m_str3.c \ - oe_code_m_strRec.c \ - oe_code_m_strRec_str5.c \ - oe_code_m_strRec_str7.c - -GEN_HRL_FILES = \ - m.hrl \ - m_i.hrl \ - oe_c_erl_test.hrl - -GEN_ERL_FILES = \ - m.erl \ - m_arr2.erl \ - m_arr3.erl \ - m_i.erl \ - m_str3.erl \ - oe_c_erl_test.erl - -C_FILES = $(GEN_C_FILES) c_client.c - -OBJS = $(C_FILES:.c=@obj@) - -PGMS = c_client@exe@ - -ERL_FILES = $(GEN_ERL_FILES) m_i_impl.erl - -EBINS = $(ERL_FILES:.erl=.@EMULATOR@) - - -all: $(PGMS) $(EBINS) - -$(GEN_ERL_FILES) $(GEN_HRL_FILES): c_erl_test.built_erl -$(GEN_C_FILES) $(GEN_H_FILES): c_erl_test.built_c -$(OBJS): $(GEN_C_FILES) $(GEN_H_FILES) -$(EBINS): $(GEN_ERL_FILES) $(GEN_HRL_FILES) - -clean: - -rm -f $(OBJS) $(GEN_C_FILES) $(GEN_H_FILES) $(PGMS) \ - $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) \ - c_erl_test.built_erl c_erl_test.built_c - -del /F /Q $(OBJS) $(GEN_C_FILES) $(GEN_H_FILES) $(PGMS) \ - $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) \ - c_erl_test.built_erl c_erl_test.built_c - -$(PGMS): $(OBJS) - $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) - -c_erl_test.built_c: c_erl_test.idl - $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,c_client}" c_erl_test.idl - echo done > c_erl_test.built_c - -c_erl_test.built_erl: c_erl_test.idl - $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,erl_genserv}" c_erl_test.idl - echo done > c_erl_test.built_erl - -.c@obj@: - $(CC) -c -o $*@obj@ $(CFLAGS) $< - -.erl.@EMULATOR@: - $(ERLC) -I $(IC_INCLUDE_PATH) $< - diff --git a/lib/ic/test/c_client_erl_server_SUITE_data/c_client.c b/lib/ic/test/c_client_erl_server_SUITE_data/c_client.c deleted file mode 100644 index 446b46ad82..0000000000 --- a/lib/ic/test/c_client_erl_server_SUITE_data/c_client.c +++ /dev/null @@ -1,1760 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2001-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -/* C-client for test of IC. - * - */ - -#include -#include - -#ifndef __WIN32__ -# include -#endif - -#include - -#ifdef __WIN32__ -# include -# include -#elif defined VXWORKS -#include -#include -#else -#include -#endif - -#include - -#ifdef __WIN32__ -# include -# include -#else -# include -# include -# include -# include -# include -#endif - -#include "ei.h" -#include "erl_interface.h" -#include "m_i.h" - -#define HOSTNAMESZ 255 -#define NODENAMESZ 512 - -#define INBUFSZ 10 -#define OUTBUFSZ 0 - -#define MAXTRIES 5 - -#define CHECK_EXCEPTION(x) \ - if ((x)->_major != CORBA_NO_EXCEPTION) { \ - fprintf(stderr,"\n\nException: %s\n\n", \ - (char *)CORBA_exception_value((x))); \ - CORBA_exception_free((x)); \ - return -1; \ - } \ - -/* XXX Should free things here too! */ -#define RETURN_IF_OK(x) \ - if ((x)) {\ - fprintf(stdout, "ok\n");\ - return 0;\ - }\ - -#define cmp_str(x,y) (!strcmp((x),(y))) -#define cmp_wstr(x,y) (!ic_wstrcmp((x),(y))) - -typedef CORBA_Environment IC_Env; - -typedef int (*TestFunc)(IC_Env *); -typedef struct { - char *name; - TestFunc func; -} TestCase; - -static char longtext[] = -"Introduction The IC application is an IDL compiler implemented in Erlang." -" The IDL compiler generates client stubs and server skeletons." -" Several back-ends are supported, and they fall into three main groups." -" For more details on IC compiler options consult the ic(3) manual page." -" Argument passing cases 1 Caller allocates all necessary storage," -" except that which may be encapsulated and managed within the parameter itself." -" 2 The caller allocates a pointer and passes it by reference to the callee." -" The callee sets the pointer to point to a valid instance of the parameter's type." -" The caller is responsible for releasing the returned storage." -" Following completion of a request, the caller is not allowed to modify any values" -" in the returned storage. To do so the caller must first copy the returned instance" -" into a new instance, then modify the new instance. 3 The caller allocates a" -" pointer to an array slice which has all the same dimensions of the original" -" array except the first, and passes it by reference to the callee. The callee sets" -" the pointer to point to a valid instance of the array. The caller is responsible for" -" releasing the returned storage. Following completion of a request, the caller is not" -" allowed to modify any values in the returned storage. To do so the caller must first" -" copy the returned instance into a new instance, then modify the new instance." -" Generated Files Two files will be generated for each scope. One set of files will be" -" generated for each module and each interface scope. An extra set is generated for" -" those definitions at top level scope. One of the files is a header file(.h), and the" -" other file is a C source code file (.c). In addition to these files a number of C" -" source files will be generated for type encodings, they are named according to the " -"following template: oe_code_.c."; -static char this_node[NODENAMESZ + 1]; -static char *progname; - -/* Test function prototypes */ - -static int void_test(IC_Env *env); -static int long_test(IC_Env *env); -static int long_long_test(IC_Env *env); -static int unsigned_short_test(IC_Env *env); -static int unsigned_long_test(IC_Env *env); -static int unsigned_long_long_test(IC_Env *env); -static int double_test(IC_Env *env); -static int char_test(IC_Env *env); -static int wchar_test(IC_Env *env); -static int octet_test(IC_Env *env); -static int bool_test(IC_Env *env); -static int struct_test(IC_Env *env); -static int struct2_test(IC_Env *env); -static int seq1_test(IC_Env *env); -static int seq2_test(IC_Env *env); -static int seq3_test(IC_Env *env); -static int seq4_test(IC_Env *env); -static int seq5_test(IC_Env *env); -static int array1_test(IC_Env *env); -static int array2_test(IC_Env *env); -static int enum_test(IC_Env *env); -static int string1_test(IC_Env *env); -static int string2_test(IC_Env *env); -static int string3_test(IC_Env *env); -static int string4_test(IC_Env *env); -static int pid_test(IC_Env *env); -static int port_test(IC_Env *env); -static int ref_test(IC_Env *env); -static int term_test(IC_Env *env); -static int typedef_test(IC_Env *env); -static int inline_sequence_test(IC_Env *env); -static int term_sequence_test(IC_Env *env); -static int term_struct_test(IC_Env *env); -static int wstring1_test(IC_Env *env); - -static TestCase test_cases[] = { - {"void_test", void_test}, - {"long_test", long_test}, - {"long_long_test", long_long_test}, - {"unsigned_short_test", unsigned_short_test}, - {"unsigned_long_test", unsigned_long_test}, - {"unsigned_long_long_test", unsigned_long_long_test}, - {"double_test", double_test}, - {"char_test", char_test}, - {"wchar_test", wchar_test}, - {"octet_test", octet_test}, - {"bool_test", bool_test}, - {"struct_test", struct_test}, - {"struct2_test", struct2_test}, - {"seq1_test", seq1_test}, - {"seq2_test", seq2_test}, - {"seq3_test", seq3_test}, - {"seq4_test", seq4_test}, - {"seq5_test", seq5_test}, - {"array1_test", array1_test}, - {"array2_test", array2_test}, - {"enum_test", enum_test}, - {"string1_test", string1_test}, - {"string2_test", string2_test}, - {"string3_test", string3_test}, - {"string4_test", string4_test}, - {"pid_test", pid_test}, - {"port_test", port_test}, - {"ref_test", ref_test}, - {"term_test", term_test}, - {"typedef_test", typedef_test}, - {"inline_sequence_test", inline_sequence_test}, - {"term_sequence_test", term_sequence_test}, - {"term_struct_test", term_struct_test}, - {"wstring1_test", wstring1_test}, - {"", NULL} -}; - -/* Other prototypes */ -static int cmp_aseq(m_aseq *a1, m_aseq *a2); -static int cmp_a(m_a *a1, m_a *a2); -static int cmp_bseq(m_bseq *b1, m_bseq *b2); -static int cmp_b(m_b *b1, m_b *b2); -static int cmp_lseq(m_lseq *b1, m_lseq *b2); -static int cmp_etseq(m_etseq *b1, m_etseq *b2); -static int cmp_et(m_et* b1, m_et *b2); -static int cmp_es(m_es *b1, m_es *b2); -static int cmp_arr1(m_arr1 b1, m_arr1 b2); -static int cmp_dd(m_dd b1, m_dd b2); -static int cmp_strRec(m_strRec *b1, m_strRec *b2); -static int cmp_sseq(m_sseq *b1, m_sseq *b2); -static int cmp_pid(erlang_pid *p1, erlang_pid *p2); -static int cmp_port(erlang_port *p1, erlang_port *p2); -static int cmp_ref(erlang_ref *p1, erlang_ref *p2); -static int cmp_s(m_s *b1, m_s *b2); -static int cmp_ssstr3(m_ssstr3 *b1, m_ssstr3 *b2); -static int cmp_ssarr3(m_ssarr3 *b1, m_ssarr3 *b2); -static int cmp_sarr3(m_sarr3 *b1, m_sarr3 *b2); -static int cmp_arr3(m_arr3 b1, m_arr3 b2); - -static void print_aseq(m_aseq *a); -static void print_a(m_a *a); -static void print_bseq(m_bseq *b); -static void print_lseq(m_lseq *b); -static void print_b(m_b *b); -static void print_etseq(m_etseq *b); -static void print_et(m_et* b); -static void print_es(m_es *b); -static void print_arr1(long a[500]); -static void print_dd(long a[2][3]); -static void print_strRec(m_strRec* sr); -static void print_sseq(m_sseq *b); -static void print_pid(erlang_pid *p); -static void print_port(erlang_port *p); -static void print_ref(erlang_ref *p); -static void print_term(ETERM *t); -static void print_s(m_s *p); -static void print_ssstr3(m_ssstr3 *b1); -static void print_ssarr3(m_ssarr3 *b1); -static void print_sarr3(m_sarr3 *b1); -static void print_arr3(m_arr3 b1); -static void print_wstr(CORBA_wchar *ws); - -static void free_etseq_buf(m_etseq *b); -static void free_et(m_et* b); - -#ifdef __WIN32__ -typedef struct { - long tv_sec; - long tv_usec; -} MyTimeval; -#else -typedef struct timeval MyTimeval; -#endif -static void my_gettimeofday(MyTimeval *tv); -static void showtime(MyTimeval *start, MyTimeval *stop); -static void usage(void); -static void done(int r); - - - -/* main */ - -#ifdef VXWORKS -int client(int argc, char **argv) -#else -int main(int argc, char **argv) -#endif -{ - struct hostent *hp; - erlang_pid pid; - MyTimeval start, stop; - int i, fd, ires, tres; - IC_Env *env; - int tries = 0; - char *this_node_name = NULL; - char *peer_node = NULL; - char *peer_process_name = NULL; - char *cookie = NULL; - char host[HOSTNAMESZ + 1]; - TestFunc test_func = NULL; - TestCase *test_case; - char *test_case_name = NULL; - -#ifdef __WIN32__ - WORD wVersionRequested; - WSADATA wsaData; - - wVersionRequested = MAKEWORD(2, 0); - - if (WSAStartup(wVersionRequested, &wsaData) != 0) { - fprintf(stderr, "Could not load winsock2 v2.0 compatible DLL"); - exit(1); - } -#endif - - progname = argv[0]; - host[HOSTNAMESZ] = '\0'; - if (gethostname(host, HOSTNAMESZ + 1) < 0) { - fprintf(stderr, "Can't find own hostname\n"); - done(1); - } - if ((hp = gethostbyname(host)) == 0) { - fprintf(stderr, "Can't get ip address for host %s\n", host); - done(1); - } - for (i = 1; i < argc; i++) { - if (cmp_str(argv[i], "-help")) { - usage(); - done(0); - } else if (cmp_str(argv[i], "-this-node-name")) { - i++; - this_node_name = argv[i]; - } else if (cmp_str(argv[i], "-peer-node")) { - i++; - peer_node = argv[i]; - } else if (cmp_str(argv[i], "-peer-process-name")) { - i++; - peer_process_name = argv[i]; - } else if (cmp_str(argv[i], "-cookie")) { - i++; - cookie = argv[i]; - } else if (cmp_str(argv[i], "-test-case")) { - i++; - test_case_name = argv[i]; - } else { - fprintf(stderr, "Error : invalid argument \"%s\"\n", argv[i]); - usage(); - done(1); - } - } - - if (this_node_name == NULL || peer_node == NULL || test_case_name == NULL - || peer_process_name == NULL || cookie == NULL) { - fprintf(stderr, "Error: missing option\n"); - usage(); - done(1); - } - - test_case = test_cases; - while (test_case->func) { - if (cmp_str(test_case->name, test_case_name)) { - test_func = test_case->func; - break; - } - test_case++; - } - if (test_func == NULL) { - fprintf(stderr, "Error: illegal test case: \"%s\"\n", test_case_name); - done(1); - } - - /* Behead hostname at first dot */ - for (i=0; host[i] != '\0'; i++) { - if (host[i] == '.') { host[i] = '\0'; break; } - } - sprintf(this_node, "%s@%s", this_node_name, host); - fprintf(stderr, "c_client: this node: \"%s\"\n", this_node); - fprintf(stderr, "c_client: peer node: \"%s\"\n", peer_node); - fprintf(stderr, "c_client: test case: \"%s\"\n", test_case_name); - - fprintf(stderr, "c_client: starting\n"); - - /* initialize erl_interface */ - erl_init(NULL, 0); - - for (tries = 0; tries < MAXTRIES; tries++) { - - /* connect to erlang node */ - - ires = erl_connect_xinit(host, this_node_name, this_node, - (struct in_addr *)*hp->h_addr_list, - cookie, 0); - - fprintf(stderr, "c_client: erl_connect_xinit(): %d\n", ires); - - fd = erl_connect(peer_node); - fprintf(stderr, "c_client: erl_connect(): %d\n", fd); - - if (fd >= 0) - break; - fprintf(stderr, "c_client: cannot connect, retrying\n"); - } - if (fd < 0) { - fprintf(stderr, "c_client: cannot connect, exiting\n"); - done(1); - } - env = CORBA_Environment_alloc(INBUFSZ, OUTBUFSZ); - env->_fd = fd; - strcpy(env->_regname, peer_process_name); - env->_to_pid = NULL; - env->_from_pid = &pid; - - strcpy(pid.node, this_node); - pid.num = fd; - pid.serial = 0; - pid.creation = 0; - - my_gettimeofday(&start); - tres = test_func(env); /* Call test case */ - my_gettimeofday(&stop); - showtime(&start, &stop); - erl_close_connection(fd); - - printf("c_client: env->_inbuf before : %d\n", INBUFSZ); - printf("c_client: env->_outbuf before : %d\n", OUTBUFSZ); - printf("c_client: env->_inbuf after : %d\n", env->_inbufsz); - printf("c_client: env->_outbuf after : %d\n", env->_outbufsz); - - CORBA_free(env->_inbuf); - CORBA_free(env->_outbuf); - CORBA_free(env); - done(tres); -} - -static void usage() -{ - fprintf(stderr, "Usage: %s [-help] -this-node-name " - "-peer-node -peer-process-name " - "-cookie -test-case \n", progname); - fprintf(stderr, "Example:\n %s -this-node-name kalle " - "-peer-node olle@home -peer-process-name idltest " - "-cookie oa678er -test-case octet_test\n", progname); -} - -static void done(int r) -{ -#ifdef __WIN32__ - WSACleanup(); -#endif - exit(r); -} - - -/* TESTS */ - -static int void_test(IC_Env *env) -{ - fprintf(stdout, "\n======== m_i_void test ======\n\n"); - m_i_void_test(NULL,env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(1); -} - -static int long_test(IC_Env *env) -{ - long l = 4711, lo, lr; - - fprintf(stdout, "\n======== m_i_long test ======\n\n"); - lr = m_i_long_test(NULL, l, &lo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(l == lo && l == lr); - if (l != lo) - fprintf(stdout, " out parameter error, sent: %ld, got: %ld\n", l, lo); - if (l != lr) - fprintf(stdout, " result error, sent: %ld, got: %ld\n", l, lr); - return -1; -} - -static int long_long_test(IC_Env *env) -{ - CORBA_long_long ll = 4711, llo, llr; - - fprintf(stdout, "\n======== m_i_longlong test ======\n\n"); - llr = m_i_longlong_test(NULL, ll, &llo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(ll == llo && ll == llr); - if (ll != llo) - fprintf(stdout, " out parameter error, sent: %ld, got: %ld\n", - ll, llo); - if (ll != llr) - fprintf(stdout, " result error, sent: %ld, got: %ld\n", ll, llr); - return -1; -} - -static int unsigned_short_test(IC_Env *env) -{ - unsigned short x, y = 2, z; - - fprintf(stdout, "\n======== m_i_ushort test ======\n\n"); - x = m_i_ushort_test(NULL, y, &z, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(y == z && y == x); - if (y != z) - fprintf(stdout, " out parameter error, sent: %d, got: %d\n", y, z); - if (y != x) - fprintf(stdout, " result error, sent: %d, got: %d\n", y, x); - return -1; -} - - -static int unsigned_long_test(IC_Env *env) -{ - unsigned long ul = 5050, ulo, ulr; - - fprintf(stdout, "\n======== m_i_ulong test ======\n\n"); - ulr = m_i_ulong_test(NULL, ul, &ulo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(ul == ulo && ul == ulr); - if (ul != ulo) - fprintf(stdout, " out parameter error, sent: %lu, got: %lu\n", - ul, ulo); - if (ul != ulr) - fprintf(stdout, " result error, sent: %lu, got: %lu\n", ul, ulr); - return -1; -} - -/* - * Note: CORBA_unsigned_long_long is in fact a plain long. - */ -static int unsigned_long_long_test(IC_Env *env) -{ - CORBA_unsigned_long_long ull = 5050, ullo, ullr; - - fprintf(stdout, "\n======== m_i_ulonglong test ======\n\n"); - ullr = m_i_ulonglong_test(NULL, ull, &ullo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(ull == ullo && ull == ullr); - if (ull != ullo) - fprintf(stdout, " out parameter error, sent: %lu, got: %lu\n", - ull, ullo); - if (ull != ullr) - fprintf(stdout, " result error, sent: %lu, got: %lu\n", - ull, ullr); - return -1; -} - -static int double_test(IC_Env *env) -{ - double d = 12.1212, db, dr; - - fprintf(stdout, "\n======== m_i_double test ======\n\n"); - dr = m_i_double_test(NULL, d, &db, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(d == db && d == dr); - if (d != db) - fprintf(stdout, " out parameter error, sent: %f, got: %f\n", d, db); - if (d != dr) - fprintf(stdout, " result error, sent: %f, got: %f\n", d, dr); - return -1; -} - -static int char_test(IC_Env *env) -{ - char c = 'g', co, cr; - - /* char test */ - fprintf(stdout, "\n======== m_i_char test ======\n\n"); - cr = m_i_char_test(NULL, c, &co, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(c == co && c == cr); - if (c !=co) - fprintf(stdout, " out parameter error, sent: %c, got: %c\n", c, co); - if (c != cr) - fprintf(stdout, " result error, sent: %c, got: %c\n", c, cr); - return -1; -} - -static int wchar_test(IC_Env *env) -{ - CORBA_wchar wc = 103, wco, wcr; - - fprintf(stdout, "\n======== m_i_wchar test ======\n\n"); - wcr = m_i_wchar_test(NULL, wc, &wco, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(wc == wco && wc == wcr); - if (wc != wco) - fprintf(stdout, " out parameter error, sent: %lu, got: %lu\n", - wc, wco); - if (wc != wcr) - fprintf(stdout, " result error, sent: %lu, got: %lu\n", - wc, wcr); - return -1; -} - -static int octet_test(IC_Env *env) -{ - char o ='r', oo, or; - - fprintf(stdout, "\n======== m_i_octet test ======\n\n"); - or = m_i_octet_test(NULL, o, &oo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(o == oo && o == or); - if (o != oo) - fprintf(stdout, " out parameter error, sent: %c, got: %c\n", o, oo); - if (o != or) - fprintf(stdout, " result error, sent: %c, got: %c\n", o, or); - return -1; -} - -static int bool_test(IC_Env *env) -{ - unsigned char i = 0, io, ir; - - fprintf(stdout, "\n======== m_i_bool test ======\n\n"); - ir = m_i_bool_test(NULL, i, &io, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(i == io && i == ir); - if (i != io) - fprintf(stdout, " out parameter error, sent: %d, got: %d\n", i, io); - if (i != ir) - fprintf(stdout, " result error, sent: %d, got: %d\n", i, ir); - return -1; -} - -static int struct_test(IC_Env *env) -{ - m_b b = {4711, 'a'}, bo, br; - - fprintf(stdout, "\n======== m_i_struct test ======\n\n"); - br = m_i_struct_test(NULL, &b, &bo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_b(&b, &bo) && cmp_b(&b, &br)); - if (!cmp_b(&b, &bo)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_b(&b); - fprintf(stdout, " got:\n"); - print_b(&bo); - fprintf(stdout, "\n"); - } - if (!cmp_b(&b, &br)) { - fprintf(stdout, " result error, sent:\n"); - print_b(&b); - fprintf(stdout, " got:\n"); - print_b(&br); - fprintf(stdout, "\n"); - } - return -1; -} - -static int struct2_test(IC_Env *env) -{ - m_es esi = {m_peach, 5050}, eso, esr; - - fprintf(stdout, "\n======== m_i_struct2 test ======\n\n"); - esr = m_i_struct2_test(NULL, &esi, &eso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_es(&esi, &eso) && cmp_es(&esi, &esr)); - if (!cmp_es(&esi, &eso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_es(&esi); - fprintf(stdout, " got:\n"); - print_es(&eso); - fprintf(stdout, "\n"); - } - if (!cmp_es(&esi, &esr)) { - fprintf(stdout, " result error, sent:\n"); - print_es(&esi); - fprintf(stdout, " got:\n"); - print_es(&esr); - fprintf(stdout, "\n"); - } - return -1; -} - - -static int seq1_test(IC_Env *env) -{ - m_bseq bs, *bso, *bsr; - - m_b ba[3] = {{4711, 'a'}, {4712, 'b'}, {4713, 'c'}}; - bs._length = 3; - bs._buffer = ba; - - fprintf(stdout, "\n======== m_i_seq1 test ======\n\n"); - bsr = m_i_seq1_test(NULL, &bs, &bso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_bseq(&bs, bso) && cmp_bseq(&bs, bsr)); - if (!cmp_bseq(&bs, bso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_bseq(&bs); - fprintf(stdout, " got:\n"); - print_bseq(bso); - fprintf(stdout, "\n"); - } - if (!cmp_bseq(&bs, bsr)) { - fprintf(stdout, " result error, sent:\n"); - print_bseq(&bs); - fprintf(stdout, " got:\n"); - print_bseq(bsr); - fprintf(stdout, "\n"); - } - CORBA_free(bso); - CORBA_free(bsr); - return -1; -} - -static int seq2_test(IC_Env *env) -{ - m_b ba[3] = {{4711, 'a'}, {4712, 'b'}, {4713, 'c'}}; - m_a a; - m_a aa[2]; - m_aseq as, *aso, *asr; - - a.l = 9999; - a.y._length = 3; - a.y._buffer = ba; - a.d = 66.89898989; - - aa[0] = a; - aa[1] = a; - as._length = 2; - as._buffer = aa; - - fprintf(stdout, "\n======== m_i_seq2 test ======\n\n"); - asr = m_i_seq2_test(NULL, &as, &aso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_aseq(&as, aso) && cmp_aseq(&as, asr)); - if (!cmp_aseq(&as, aso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_aseq(&as); - fprintf(stdout, " got:\n"); - print_aseq(aso); - fprintf(stdout, "\n"); - } - if (!cmp_aseq(&as, asr)) { - fprintf(stdout, " result error, sent:\n"); - print_aseq(&as); - fprintf(stdout, " got:\n"); - print_aseq(asr); - fprintf(stdout, "\n"); - } - CORBA_free(aso); - CORBA_free(asr); - return -1; -} - -static int seq3_test(IC_Env *env) -{ - m_lseq lsi, *lso, *lsr; - long al[500]; - int i=0; - - for (i = 0; i < 500; i++) - al[i]=i; - lsi._length = 500; - lsi._buffer = al; - - fprintf(stdout, "\n======== m_i_seq3 test ======\n\n"); - lsr = m_i_seq3_test(NULL, &lsi, &lso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_lseq(&lsi, lso) && cmp_lseq(&lsi, lsr)); - if (!cmp_lseq(&lsi, lso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_lseq(&lsi); - fprintf(stdout, " got:\n"); - print_lseq(lso); - fprintf(stdout, "\n"); - } - if (!cmp_lseq(&lsi, lsr)) { - fprintf(stdout, " result error, sent:\n"); - print_lseq(&lsi); - fprintf(stdout, " got:\n"); - print_lseq(lsr); - fprintf(stdout, "\n"); - } - CORBA_free(lso); - CORBA_free(lsr); - return -1; -} - -static int seq4_test(IC_Env *env) -{ - char *stra0[3] = {"a", "long", "time"}; - char *stra1[3] = {"ago", "there", "was"}; - char *stra2[3] = {"a", "buggy", "compiler"}; - m_sstr3 str3s[3] = {{3, 3, stra0}, {3, 3, stra1}, {3, 3, stra2}}; - m_ssstr3 str3ssi = {3, 3, str3s}; - m_ssstr3 *str3sso, *str3ssr; - - fprintf(stdout, "\n======== m_i_seq4 test ======\n\n"); - str3ssr = m_i_seq4_test(NULL, &str3ssi, &str3sso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_ssstr3(&str3ssi, str3sso) && - cmp_ssstr3(&str3ssi, str3ssr)); - if (!cmp_ssstr3(&str3ssi, str3sso)){ - fprintf(stdout, " out parameter error, sent:\n"); - print_ssstr3(&str3ssi); - fprintf(stdout, " got:\n"); - print_ssstr3(str3sso); - fprintf(stdout, "\n"); - } - if (!cmp_ssstr3(&str3ssi, str3ssr)) { - fprintf(stdout, " result error, sent:\n"); - print_ssstr3(&str3ssi); - fprintf(stdout, " got:\n"); - print_ssstr3(str3ssr); - fprintf(stdout, "\n"); - } - CORBA_free(str3sso); - CORBA_free(str3ssr); - return -1; -} - -static int seq5_test(IC_Env *env) -{ - m_arr3 arr3a[3] = { - {4711, 18931947, 3}, - {4711, 18931947, 3}, - {4711, 18931947, 3}}; - m_sarr3 arr3sa[3] = {{3, 3, arr3a}, {3, 3, arr3a}, {3, 3, arr3a}}; - m_ssarr3 arr3ssi = {3, 3, arr3sa}; - m_ssarr3 *arr3sso; - m_ssarr3 *arr3ssr; - - fprintf(stdout, "\n======== m_i_seq5 test ======\n\n"); - arr3ssr = m_i_seq5_test(NULL, &arr3ssi, &arr3sso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_ssarr3(&arr3ssi, arr3sso) && - cmp_ssarr3(&arr3ssi, arr3ssr)); - if (!cmp_ssarr3(&arr3ssi, arr3sso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_ssarr3(&arr3ssi); - fprintf(stdout, " got:\n"); - print_ssarr3(arr3sso); - fprintf(stdout, "\n"); - } - if (!cmp_ssarr3(&arr3ssi, arr3ssr)) { - fprintf(stdout, " result error, sent:\n"); - print_ssarr3(&arr3ssi); - fprintf(stdout, " got:\n"); - print_ssarr3(arr3ssr); - fprintf(stdout, "\n"); - } - CORBA_free(arr3sso); - CORBA_free(arr3ssr); - return -1; -} - -static int array1_test(IC_Env *env) -{ - int i; - long al[500]; - m_arr1 alo; - m_arr1_slice* alr; - - for (i = 0; i < 500; i++) - al[i]=i; - - fprintf(stdout, "\n======== m_i_array1 test ======\n\n"); - alr = m_i_array1_test(NULL, al, alo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_arr1(al, alo) && cmp_arr1(al, alr)); - if (!cmp_arr1(al, alo)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_arr1(al); - fprintf(stdout, " got:\n"); - print_arr1(alo); - fprintf(stdout, "\n"); - } - if (!cmp_arr1(al,alr)) { - fprintf(stdout, " result error, sent:\n"); - print_arr1(al); - fprintf(stdout, " got:\n"); - print_arr1(alr); - fprintf(stdout, "\n"); - } - free(alr); - return -1; -} - -static int array2_test(IC_Env *env) -{ - long dl[2][3] = {{11, 2, 7}, {22, 8 ,13}}; - m_dd dlo; - m_dd_slice* dlr; - - fprintf(stdout, "\n======== m_i_array2 test ======\n\n"); - dlr = m_i_array2_test(NULL, dl, dlo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_dd(dl,dlo) && cmp_dd(dl,dlr)); - if (!cmp_dd(dl,dlo)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_dd(dl); - fprintf(stdout, " got:\n"); - print_dd(dlo); - fprintf(stdout, "\n"); - } - if (!cmp_dd(dl,dlr)) { - fprintf(stdout, " result error, sent:\n"); - print_dd(dl); - fprintf(stdout, " got:\n"); - print_dd(dlr); - fprintf(stdout, "\n"); - } - free(*dlr); - return -1; -} - -static int enum_test(IC_Env *env) -{ - m_fruit ei = m_banana, eo, er; - - fprintf(stdout, "\n======== m_i_enum test ======\n\n"); - er = m_i_enum_test(NULL, ei, &eo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(ei == eo && ei == er); - if (ei != eo) - fprintf(stdout, " out parameter error, sent: %d, got: %d\n", ei, eo); - if (ei != er) - fprintf(stdout, " result error, sent: %d, got: %d\n", ei, er); - return -1; -} - -static int string1_test(IC_Env *env) -{ - char* si = longtext; - char* so; - char* sr; - - fprintf(stdout, "\n======== m_i_string1 test ======\n\n"); - sr = m_i_string1_test(NULL, si, &so, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_str(si, so) && cmp_str(si, sr)); - if (!cmp_str(si, so)) - fprintf(stdout, " out parameter error, sent: %s, got: %s\n", si, so); - if (!cmp_str(si, sr)) - fprintf(stdout, " result error, sent: %s, got: %s\n", si, sr); - CORBA_free(so); - CORBA_free(sr); - return -1; -} - -static int string2_test(IC_Env *env) -{ - char* sa[3] = {"hello", "foo", "bar"}; - m_sseq ssi = {3, 3, sa}; - m_sseq *sso, *ssr; - - fprintf(stdout, "\n======== m_i_string2 test ======\n\n"); - ssr = m_i_string2_test(NULL, &ssi, &sso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_sseq(&ssi, sso) && cmp_sseq(&ssi, sso)); - if (!cmp_sseq(&ssi, sso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_sseq(&ssi); - fprintf(stdout, "got:\n"); - print_sseq(sso); - } - if (!cmp_sseq(&ssi, ssr)) { - fprintf(stdout, " result error, sent:\n"); - print_sseq(&ssi); - fprintf(stdout, "got:\n"); - print_sseq(ssr); - } - CORBA_free(sso); - CORBA_free(ssr); - return -1; -} - -static int string3_test(IC_Env *env) -{ - char* si = longtext; - char* so; - char* sr; - - fprintf(stdout, "\n======== m_i_string3 test ======\n\n"); - sr = m_i_string3_test(NULL, si, &so, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_str(si, so) && cmp_str(si, so)); - if (!cmp_str(si, so)) - fprintf(stdout, " out parameter error, sent: %s, got: %s\n", si, so); - if (!cmp_str(si, sr)) - fprintf(stdout, " result error, sent: %s, got: %s\n", si, sr); - CORBA_free(so); - CORBA_free(sr); - return -1; -} - -static int string4_test(IC_Env *env) -{ - char as1[100] = "a string", as2[200] = "help", as3[200] = "hello there"; - m_strRec stri = { 1, /* dd */ - as1, /* str4 */ - {{'a', 'k'}, {'z', 'g'}, {'n', 'q'}}, /* str7 */ - {3, 3, "buf"}, /* str5 */ - as2, /* str6 */ - {'m', 'f', 'o'}, /* str8 */ - as3, /* str9 */ - {3, 3, "stu"} /* str10 */ - }; - m_strRec *stro, *strr; - - fprintf(stdout, "\n======== m_i_string4 test ======\n\n"); - strr = m_i_string4_test(NULL, &stri, &stro, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_strRec(&stri,stro) && cmp_strRec(&stri,strr)); - if (!cmp_strRec(&stri,stro)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_strRec(&stri); - fprintf(stdout, " got:\n"); - print_strRec(stro); - fprintf(stdout, "\n"); - } - if (!cmp_strRec(&stri,strr)) { - fprintf(stdout, " result error, sent:\n"); - print_strRec(&stri); - fprintf(stdout, " got:\n"); - print_strRec(strr); - fprintf(stdout, "\n"); - } - CORBA_free(stro); - CORBA_free(strr); - return -1; -} - - -static int pid_test(IC_Env *env) -{ - erlang_pid pid = {"", 7, 0, 0}, pido, pidr; - - strcpy(pid.node, this_node), /* this currently running node */ - fprintf(stdout, "\n======== m_i_pid test ======\n\n"); - pidr = m_i_pid_test(NULL, &pid, &pido, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_pid(&pid, &pido) && cmp_pid(&pid, &pidr)); - if (!cmp_pid(&pid, &pido)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_pid(&pid); - fprintf(stdout, "got:\n"); - print_pid(&pido); - } - if (!cmp_pid(&pid, &pidr)) { - fprintf(stdout, " result error, sent:\n"); - print_pid(&pid); - fprintf(stdout, "got:\n"); - print_pid(&pidr); - } - return -1; -} - -static int port_test(IC_Env *env) -{ - erlang_port porti = {"node", 5, 1}, porto, portr; - - fprintf(stdout, "\n======== m_i_port test ======\n\n"); - portr = m_i_port_test(NULL, &porti, &porto, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_port(&porti, &porto) && cmp_port(&porti, &portr)); - if (!cmp_port(&porti, &porto)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_port(&porti); - fprintf(stdout, "got:\n"); - print_port(&porto); - } - if (!cmp_port(&porti, &portr)) { - fprintf(stdout, " result error, sent:\n"); - print_port(&porti); - fprintf(stdout, "got:\n"); - print_port(&portr); - } - return -1; -} - -static int ref_test(IC_Env *env) -{ - erlang_ref refi = { "node1", 3, {1, 2, 3}, 1}, - refo, refr; - - fprintf(stdout, "\n======== m_i_ref test ======\n\n"); - refr = m_i_ref_test(NULL, &refi, &refo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_ref(&refi, &refo) && cmp_ref(&refi, &refr)); - if (!cmp_ref(&refi, &refo)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_ref(&refi); - fprintf(stdout, "got:\n"); - print_ref(&refo); - } - if (!cmp_ref(&refi, &refr)) { - fprintf(stdout, " result error, sent:\n"); - print_ref(&refi); - fprintf(stdout, "got:\n"); - print_ref(&refr); - } - return -1; -} - -static int term_test(IC_Env *env) -{ - ETERM *ti, *to, *tr; - - ti = erl_format("[{hej, 1, 23}, \"string\", {1.23, 45}]"); - - fprintf(stdout, "\n======== m_i_term test ======\n\n"); - tr = m_i_term_test(NULL, ti, &to, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(erl_match(ti, to) && erl_match(ti, tr)); - if (!erl_match(ti, to)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_term(ti); - fprintf(stdout, "got:\n"); - print_term(to); - } - if (!erl_match(ti, tr)) { - fprintf(stdout, " result error, sent:\n"); - print_term(ti); - fprintf(stdout, "got:\n"); - print_term(tr); - } - erl_free_term(ti); - erl_free_term(to); - erl_free_term(tr); - return -1; -} - -static int typedef_test(IC_Env *env) -{ - m_banan mbi, mbo; /* erlang_port */ - m_apa mai; /* ETERM* */ - m_apa mao = NULL; - long tl; - - strcpy(mbi.node,"node"); - mbi.id = 15; - mbi.creation = 1; - - fprintf(stdout, "\n======== m_i_typedef test ======\n\n"); - mai = erl_format("[{hej, 1, 23}, \"string\", {1.23, 45}]"); - tl = m_i_typedef_test(NULL, mai, &mbi, &mao, &mbo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(erl_match(mai, mao) && cmp_port(&mbi, &mbo) && tl == 4711); - if (!erl_match(mai, mao)) { - fprintf(stdout, " out parameter error (term), sent:\n"); - print_term(mai); - fprintf(stdout, "got:\n"); - print_term(mao); - } - if (!cmp_port(&mbi, &mbo)) { - fprintf(stdout, " out parameter error (port), sent:\n"); - print_port(&mbi); - fprintf(stdout, "got:\n"); - print_port(&mbo); - } - if (tl != 4711) { - fprintf(stdout, " result error, sent: 4711, got %ld\n", tl); - } - erl_free_term(mai); - erl_free_term(mao); - return -1; -} - -static int inline_sequence_test(IC_Env *env) -{ - int i; - long al[500]; - m_s isi = {4711, {500, 10, al}}, - *iso, *isr; - - for (i = 0; i < 500; i++) - al[i]=i; - fprintf(stdout, "\n======== m_i_inline_sequence test ======\n\n"); - isr = m_i_inline_sequence_test(NULL, &isi, &iso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_s(&isi, iso) && cmp_s(&isi, isr)); - if (!cmp_s(&isi, iso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_s(&isi); - fprintf(stdout, "got:\n"); - print_s(iso); - } - if (!cmp_s(&isi, isr)) { - fprintf(stdout, " result error, sent:\n"); - print_s(&isi); - fprintf(stdout, "got:\n"); - print_s(isr); - } - CORBA_free(iso); - CORBA_free(isr); - return -1; -} - -static int term_sequence_test(IC_Env *env) -{ - ETERM* et_array[4] = { - erl_format("[{apa, 1, 23}, \"string\", {1.23, 45}]"), - erl_format("[{banan, 1, 23}, \"string\", {1.23, 45}]"), - erl_format("[{apelsin, 1, 23}, \"string\", {1.23, 45}]"), - erl_format("[{mango, 1, 23}, \"string\", {1.23, 45}]")}; - m_etseq etsi = {4, 4, et_array}, *etso, *etsr; - - fprintf(stdout, "\n======== m_i_term_sequence test ======\n\n"); - etsr = m_i_term_sequence_test(NULL, &etsi, &etso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_etseq(&etsi, etso) && cmp_etseq(&etsi, etsr)); - if (!cmp_etseq(&etsi, etso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_etseq(&etsi); - fprintf(stdout, "got:\n"); - print_etseq(etso); - } - if (!cmp_etseq(&etsi, etsr)) { - fprintf(stdout, " result error, sent:\n"); - print_etseq(&etsi); - fprintf(stdout, "got:\n"); - print_etseq(etsr); - } - free_etseq_buf(&etsi); - free_etseq_buf(etso); - free_etseq_buf(etsr); - CORBA_free(etso); - CORBA_free(etsr); - return -1; -} - -static int term_struct_test(IC_Env *env) -{ - m_et eti = { erl_format("[{hej, 1, 23}, \"string\", {1.23, 45}]"), - 121212 }; - m_et eto, etr; - - fprintf(stdout, "\n======== m_i_term_struct test ======\n\n"); - etr = m_i_term_struct_test(NULL, &eti, &eto, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_et(&eti, &eto) && cmp_et(&eti, &etr)); - if (!cmp_et(&eti, &eto)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_et(&eti); - fprintf(stdout, "got:\n"); - print_et(&eto); - } - if (!cmp_et(&eti, &etr)) { - fprintf(stdout, " result error, sent:\n"); - print_et(&eti); - fprintf(stdout, "got:\n"); - print_et(&etr); - } - free_et(&eti); - free_et(&eto); - free_et(&etr); - return -1; -} - -static int wstring1_test(IC_Env *env) -{ - CORBA_wchar wsi[] = {100, 101, 102, 103, 104, 0}, *wso, *wsr; - - fprintf(stdout, "\n======== m_i_wstring1 test ======\n\n"); - wsr = m_i_wstring1_test(NULL, wsi, &wso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_wstr(wsi, wso) && cmp_wstr(wsi, wsr)); - if (!cmp_wstr(wsi, wso)) { - fprintf(stdout, " out parameter error, sent: \n"); - print_wstr(wsi); - fprintf(stdout, "got:\n"); - print_wstr(wso); - } - if (!cmp_wstr(wsi, wsr)) { - fprintf(stdout, " result error, sent: \n"); - print_wstr(wsi); - fprintf(stdout, "got:\n"); - print_wstr(wsr); - } - CORBA_free(wso); - CORBA_free(wsr); - return -1; -} - -/* Compare functions */ -static int cmp_aseq(m_aseq *a1, m_aseq *a2) -{ - int i; - - if (a1->_length != a2->_length) - return 0; - for (i = 0; i < a1->_length; i++) - if (cmp_a(&(a1->_buffer[i]), &(a2->_buffer[i])) == 0) - return 0; - return 1; -} - -static int cmp_a(m_a *a1, m_a *a2) -{ - return a1->l == a2->l && - a1->d == a2->d && - cmp_bseq(&a1->y, &a2->y); -} - -static int cmp_bseq(m_bseq *b1, m_bseq *b2) -{ - int i; - - if (b1->_length != b2->_length) - return 0; - for (i = 0; i < b1->_length; i++) - if (cmp_b(&(b1->_buffer[i]), &(b2->_buffer[i])) == 0) - return 0; - return 1; -} - -static int cmp_b(m_b *b1, m_b *b2) -{ - return b1->l == b2->l && b1->c == b2->c; -} - -static int cmp_lseq(m_lseq *b1, m_lseq *b2) -{ - int i; - - if (b1->_length != b2->_length) - return 0; - for (i = 0; i < b1->_length; i++) - if (b1->_buffer[i] != b2->_buffer[i]) - return 0; - return 1; -} - -static int cmp_etseq(m_etseq *b1, m_etseq *b2) -{ - int i; - - if (b1->_length != b2->_length) - return 0; - for (i = 0; i < b1->_length; i++) - if (!erl_match(b1->_buffer[i], b2->_buffer[i])) - return 0; - return 1; -} - -static int cmp_et(m_et* b1, m_et *b2) -{ - return erl_match(b1->e, b2->e) && b1->l == b2->l; -} - -static int cmp_es(m_es *b1, m_es *b2) -{ - return b1->f == b2->f && b1->l == b2->l; -} - -static int cmp_arr1(m_arr1 b1, m_arr1 b2) -{ - int i; - - for (i = 0; i < 500; i++) - if (b1[i] != b2[i]) - return 0; - return 1; -} - -static int cmp_dd(m_dd b1, m_dd b2) -{ - - int i, j; - - for (i = 0; i < 2; i++) - for (j = 0; j < 3; j++) - if (b1[i][j] != b2[i][j]) - return 0; - return 1; -} - - - -static int cmp_strRec(m_strRec *b1, m_strRec *b2) -{ - int i, j; - - if (b1->bb != b2->bb) - return 0; - if (!cmp_str(b1->str4,b2->str4)) - return 0; - if (b1->str5._length != b2->str5._length) - return 0; - for (j = 0; j < b1->str5._length; j++) - if (b1->str5._buffer[j] != b2->str5._buffer[j]) - return 0; - if (!cmp_str(b1->str6,b2->str6)) - return 0; - for (i = 0; i < 3; i++) - for (j = 0; j < 2; j++) - if (b1->str7[i][j] != b2->str7[i][j]) - return 0; - for (j = 0; j < 3; j++) - if (b1->str8[j] != b2->str8[j]) - return 0; - if (!cmp_str(b1->str9,b2->str9)) - return 0; - if (b1->str10._length != b2->str10._length) - return 0; - for (j = 0; j < b1->str10._length; j++) - if (b1->str10._buffer[j] != b2->str10._buffer[j]) - return 0; - return 1; -} - - -static int cmp_sseq(m_sseq *b1, m_sseq *b2) -{ - int i; - - if (b1->_length != b2->_length) - return 0; - for (i = 0; i < b1->_length; i++) - if (!cmp_str(b1->_buffer[i], b2->_buffer[i])) - return 0; - return 1; -} - - -static int cmp_pid(erlang_pid *p1, erlang_pid *p2) -{ - return cmp_str(p1->node,p2-> node) && - p1->num == p2->num && - p1->serial == p2->serial && - p1->creation == p2->creation; -} - -static int cmp_port(erlang_port *p1, erlang_port *p2) -{ - return cmp_str(p1->node,p2-> node) && p1->id == p2->id; -} - -static int cmp_ref(erlang_ref *p1, erlang_ref *p2) -{ - return cmp_str(p1->node, p2->node) && - p1->len == p2->len && - (p1->len < 1 || p1->n[0] == p2->n[0]) && - (p1->len < 2 || p1->n[1] == p2->n[1]) && - (p1->len < 3 || p1->n[2] == p2->n[2]); -} - -static int cmp_s(m_s *b1, m_s *b2) -{ - int i; - - if (b1->l != b2->l) - return 0; - if (b1->sl._length != b2->sl._length) - return 0; - for (i = 0; i < b1->sl._length; i++) - if (b1->sl._buffer[i] != b2->sl._buffer[i]) - return 0; - return 1; -} - - -static int cmp_ssstr3(m_ssstr3 *b1, m_ssstr3 *b2) -{ - int i,j; - - if (b1->_length != b2->_length) - return 0; - for (i = 0; i < b1->_length; i++) { - if (b1->_buffer[i]._length != b2->_buffer[i]._length) - return 0; - for (j = 0; j < b1->_buffer[i]._length; j++) - if (!cmp_str(b1->_buffer[i]._buffer[j], - b2->_buffer[i]._buffer[j])) - return 0; - } - return 1; -} - - - -static int cmp_ssarr3(m_ssarr3 *b1, m_ssarr3 *b2) -{ - int i; - - if (b1->_length != b2->_length) - return 0; - for (i = 0; i < b1->_length; i++) { - if (!cmp_sarr3(&b1->_buffer[i], &b2->_buffer[i])) - return 0; - } - return 1; -} - -static int cmp_sarr3(m_sarr3 *b1, m_sarr3 *b2) -{ - int i; - - if (b1->_length != b2->_length) - return 0; - for (i = 0; i < b1->_length; i++) { - if (!cmp_arr3(b1->_buffer[i], b2->_buffer[i])) - return 0; - } - return 1; -} - -static int cmp_arr3(m_arr3 b1, m_arr3 b2) -{ - int i; - - for (i = 0; i < sizeof(m_arr3)/sizeof(CORBA_long); i++) { - if (b1[i] != b2[i]) - return 0; - } - return 1; -} - -/* Print functions */ -static void print_aseq(m_aseq *a) -{ - int i; - fprintf(stdout, "\nm_aseq size: %ld --------\n", a->_length); - for (i = 0; i < a->_length; i++) - print_a(&(a->_buffer[i])); -} - -static void print_a(m_a *a) -{ - fprintf(stdout, "\nm_a --------\n l: %ld\n d:%f\n", a->l, a->d); - print_bseq(&a->y); -} - -static void print_bseq(m_bseq *b) -{ - int i; - - fprintf(stdout, "\nm_bseq size: %ld --------\n",b->_length); - for (i = 0; i < b->_length; i++) - print_b(&(b->_buffer[i])); -} - -static void print_lseq(m_lseq *b) -{ - int i; - - fprintf(stdout, "\nm_lseq size: %ld --------\n",b->_length); - for (i = 0; i < b->_length; i++) - fprintf(stdout, "[%d]: %ld\n", i, b->_buffer[i]); -} - -static void print_b(m_b *b) -{ - fprintf(stdout, "\nm_b --------\n l: %ld\n c: %c\n", b->l, b->c); -} - - -static void print_etseq(m_etseq *b) -{ - int i; - - for (i = 0; i < b->_length; i++) { - fprintf(stdout, "[%d]:\n", i); - erl_print_term(stdout, b->_buffer[i]); - } -} - - -static void print_et(m_et* b) -{ - fprintf(stdout, "\net struct --------\n"); - erl_print_term(stdout, b->e); - fprintf(stdout, "long: %ld\n", b->l); - fprintf(stdout, "\n--------\n"); -} - -static void print_es(m_es *b) -{ - fprintf(stdout, "\nm_es --------\n f: %d\n l: %ld\n", b->f, b->l); -} - - -static void print_arr1(long a[10]) -{ - int i; - - for (i = 0; i < 10; i++) - fprintf(stdout, "\n[%d]: %ld\n", i, a[i]); -} - -static void print_dd(long a[2][3]) -{ - int i, j; - - fprintf(stdout, "\nlong dd[2][3] --------\n"); - for (i = 0; i < 2; i++) - for (j = 0; j < 3; j++) - fprintf(stdout, "\n[%d][%d]: %ld\n", i, j, a[i][j]); -} - - -static void print_strRec(m_strRec* sr) -{ - int i, j; - - fprintf(stdout, "\nboolean bb : %d\n",sr->bb); - fprintf(stdout, "string str4 : %s\n",sr->str4); - fprintf(stdout, "str7[2][3] :\n"); - for (i = 0; i < 3; i++) - for (j = 0; j < 2; j++) - fprintf(stdout, "str7[%d][%d]: %ld\n", i, j, sr->str7[i][j]); - fprintf(stdout, "str5._length : %ld\n",sr->str5._length); - for (j = 0; j < sr->str5._length; j++) - fprintf(stdout, "str5._buffer[%d]: %c\n", j, sr->str5._buffer[j]); - fprintf(stdout, "string str6 : %s\n",sr->str6); - fprintf(stdout, "str8 :\n"); - for (j = 0; j < 3; j++) - fprintf(stdout, "str8[%d]: %c\n", j, sr->str8[j]); - fprintf(stdout, "string str9 : %s\n",sr->str9); - fprintf(stdout, "str10._length : %ld\n",sr->str10._length); - for (j = 0; j < sr->str10._length; j++) - fprintf(stdout, "str10._buffer[%d]: %c\n", j, sr->str10._buffer[j]); -} - -static void print_sseq(m_sseq *b) -{ - int i; - - fprintf(stdout, "\nm_sseq size: %ld --------\n",b->_length); - for (i = 0; i < b->_length; i++) - fprintf(stdout, "%s\n", b->_buffer[i]); - -} - - -static void print_pid(erlang_pid *p) -{ - fprintf(stdout, "\nerlang_pid --------\n node: %s\n num: %d\n " - "serial: %d\n creation: %d\n", - p->node, p->num, p->serial, p->creation); -} - -static void print_port(erlang_port *p) -{ - fprintf(stdout, "\nerlang_port --------\n node: %s\n id: %d\n " - "creation: %d\n", p->node, p->id, p->creation); -} - -static void print_ref(erlang_ref *p) -{ - fprintf(stdout, "\nerlang_ref --------\n node: %s\n len: %d\n " - "n[0]: %d\n n[1]: %d\n n[2]: %d\n creation: %d\n", - p->node, p->len, p->n[0], p->n[1], p->n[2], p->creation); -} - -static void print_term(ETERM *t) -{ - fprintf(stdout, "\nETERM --------\n"); - erl_print_term(stdout, t); - fprintf(stdout, "\n--------\n"); -} - -static void print_s(m_s *p) -{ - int i; - - fprintf(stdout, "\n%ld\n", p->l); - for (i = 0; i < p->sl._length; i++) - fprintf(stdout, "\n[%d]: %ld\n", i, p->sl._buffer[i]); -} - - -static void print_ssstr3(m_ssstr3 *b1) -{ - int i,j; - - fprintf(stdout, "\nSSSTR3 --------\n"); - fprintf(stdout,"b1->_length = %ld\n",b1->_length); - for (i = 0; i < b1->_length; i++) { - fprintf(stdout,"\nb1->_buffer[%d]._length %ld\n", - i, b1->_buffer[i]._length); - for (j = 0; j < b1->_buffer[i]._length; j++) - fprintf(stdout,"b1->_buffer[%d]._buffer[%d] = %s\n", - i, j, b1->_buffer[i]._buffer[j]); - } - fprintf(stdout, "\n--------\n"); -} - -static void print_wstr(CORBA_wchar *ws) -{ - int i = 0; - - fprintf(stdout, "\nwstr --------\n"); - while (ws[i]) { - fprintf(stdout, "[%d]: %ld\n", i, ws[i]); - i++; - } - fprintf(stdout, "\n--------\n"); -} - - -static void print_ssarr3(m_ssarr3 *b1) -{ - int i; - - fprintf(stdout, "\nssarr3 --------\n"); - fprintf(stdout,"length: %ld\n",b1->_length); - fprintf(stdout, "buffer:\n"); - for (i = 0; i < b1->_length; i++) - print_sarr3(&b1->_buffer[i]); - fprintf(stdout, "\n--------\n"); -} - -static void print_sarr3(m_sarr3 *b1) -{ - int i; - - fprintf(stdout, "\nsarr3 --------\n"); - fprintf(stdout,"length: %ld\n",b1->_length); - fprintf(stdout, "buffer:\n"); - for (i = 0; i < b1->_length; i++) - print_arr3(b1->_buffer[i]); - fprintf(stdout, "\n--------\n"); -} - -static void print_arr3(m_arr3 b1) -{ - int i; - - fprintf(stdout, "\narr3 --------\n"); - for (i = 0; i < sizeof(m_arr3)/sizeof(CORBA_long); i++) - fprintf(stdout, "%ld ", b1[i]); - fprintf(stdout, "\n--------\n"); -} - -static void free_etseq_buf(m_etseq *b) -{ - int i; - - for (i = 0; i < b->_length; i++) - erl_free_term(b->_buffer[i]); -} - -static void free_et(m_et* b) -{ - erl_free_term(b->e); -} - -static void showtime(MyTimeval *start, MyTimeval *stop) -{ - MyTimeval elapsed; - - elapsed.tv_sec = stop->tv_sec - start->tv_sec; - elapsed.tv_usec = stop->tv_usec - start->tv_usec; - while (elapsed.tv_usec < 0) { - elapsed.tv_sec -= 1; - elapsed.tv_usec += 1000000; - } - fprintf(stderr,"%ld.%06ld seconds\n",elapsed.tv_sec, elapsed.tv_usec); -} - -static void my_gettimeofday(MyTimeval *tv) -#ifdef __WIN32__ -#define EPOCH_JULIAN_DIFF 11644473600i64 -{ - SYSTEMTIME t; - FILETIME ft; - LONGLONG lft; - - GetSystemTime(&t); - SystemTimeToFileTime(&t, &ft); - memcpy(&lft, &ft, sizeof(lft)); - tv->tv_usec = (long) ((lft / 10i64) % 1000000i64); - tv->tv_sec = (long) ((lft / 10000000i64) - EPOCH_JULIAN_DIFF); -} -#elif defined VXWORKS -{ - int rate = sysClkRateGet(); /* Ticks per second */ - unsigned long ctick = tickGet(); - tv->tv_sec = ctick / rate; /* secs since reboot */ - tv->tv_usec = ((ctick - (tv->tv_sec * rate))*1000000)/rate; -} -#else -{ - gettimeofday(tv, NULL); -} -#endif diff --git a/lib/ic/test/c_client_erl_server_SUITE_data/c_erl_test.idl b/lib/ic/test/c_client_erl_server_SUITE_data/c_erl_test.idl deleted file mode 100644 index 126389b01d..0000000000 --- a/lib/ic/test/c_client_erl_server_SUITE_data/c_erl_test.idl +++ /dev/null @@ -1,175 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 2001-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -#include "erlang.idl" - - -const short TestConst = 1; - -module m { - - const short TestConst = 2; - - struct b { - long l; - char c; - }; - - struct simple { - long l; - b b_t; - }; - - enum fruit {orange, banana, apple, peach, pear}; - - typedef sequence lseq; - - typedef sequence bseq; - - struct a { - long l; - bseq y; - double d; - }; - - typedef sequence aseq; - - typedef sequence sseq; - typedef string str; - typedef long myLong; - - typedef long arr1[500], dd[2][3]; - - typedef erlang::term apa; - typedef erlang::port banan; - - typedef sequence etseq; - - struct s { - long l; - sequence sl; - }; - - struct es { - fruit f; - myLong l; - }; - - struct et { - erlang::term e; - long l; - }; - - - typedef sequence str1; - typedef string<12> str2; - typedef char str3[3]; - - typedef sequence sstr3; // sequence of string - typedef sequence ssstr3; // sequence of sequences of strings - - typedef long arr3[3]; // array of long - typedef sequence sarr3; // sequence of array - typedef sequence ssarr3; // sequence of sequnces of arrays of strings - - struct strRec{ - boolean bb; - string str4; - long str7[3][2]; - sequence str5; - string<12> str6; - str3 str8; - str2 str9; - str1 str10; - }; - - - struct dyn { - long l; - sequence sl; - }; - typedef dyn arr2[1][2]; - - - interface i { - - const short TestConst = 3; - - //arr2 suck(in arr2 x, out arr2 y ); - - ///////////////////////////////// attribute long l; - - // simple types - void void_test(); - long long_test(in long a, out long a1); - long long longlong_test(in long long a, out long long a1); - unsigned short ushort_test(in unsigned short a, out unsigned short a1); - unsigned long ulong_test(in unsigned long a, out unsigned long a1); - unsigned long long ulonglong_test(in unsigned long long a, out unsigned long long a1); - double double_test(in double a, out double a1); - char char_test(in char a, out char a1); - wchar wchar_test(in wchar a, out wchar a1); - octet octet_test(in octet a, out octet a1); - boolean bool_test(in boolean a, out boolean a1); - - // Seq. and struct tests - b struct_test(in b a, out b a1); - es struct2_test(in es a, out es a1); - //simple struct3_test(in simple x, out simple y); - bseq seq1_test(in bseq a, out bseq a1); - aseq seq2_test(in aseq a, out aseq a1); - lseq seq3_test(in lseq a, out lseq a1); - ssstr3 seq4_test(in ssstr3 a, out ssstr3 a1); - ssarr3 seq5_test(in ssarr3 a, out ssarr3 a1); - - // Array tests - arr1 array1_test(in arr1 a, out arr1 a1); - dd array2_test(in dd a, out dd a1); - - // enum test - fruit enum_test(in fruit a, out fruit a1); - - // string tests - string string1_test(in string a, out string a1); - wstring wstring1_test(in wstring a, out wstring a1); - sseq string2_test(in sseq a, out sseq a1); - str string3_test(in str a, out str a1); - strRec string4_test(in strRec a, out strRec a1); - - // Special erlang types - erlang::pid pid_test(in erlang::pid a, out erlang::pid a1); - erlang::port port_test(in erlang::port a, out erlang::port a1); - erlang::ref ref_test(in erlang::ref a, out erlang::ref a1); - erlang::term term_test(in erlang::term a, out erlang::term a1); - - // typedef test - long typedef_test(in apa a, in banan b, out apa a1, out banan b1); - - // inlined seq. test - s inline_sequence_test(in s a, out s a1); - - // term seq. test - etseq term_sequence_test(in etseq a, out etseq a1); - // term struct test - et term_struct_test(in et a, out et a1); - - }; - -}; diff --git a/lib/ic/test/c_client_erl_server_SUITE_data/erl_server.erl b/lib/ic/test/c_client_erl_server_SUITE_data/erl_server.erl deleted file mode 100644 index 159d3b9b89..0000000000 --- a/lib/ic/test/c_client_erl_server_SUITE_data/erl_server.erl +++ /dev/null @@ -1,29 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(erl_server). - --export([run/0, stop/0]). - -run() -> - m_i:oe_create(). - -stop() -> - gen_server:cast(cidl_test, stop). diff --git a/lib/ic/test/c_client_erl_server_SUITE_data/m_i_impl.erl b/lib/ic/test/c_client_erl_server_SUITE_data/m_i_impl.erl deleted file mode 100644 index c530991058..0000000000 --- a/lib/ic/test/c_client_erl_server_SUITE_data/m_i_impl.erl +++ /dev/null @@ -1,162 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(m_i_impl). --include("m.hrl"). - --export([init/1, terminate/2, void_test/1, long_test/2, ushort_test/2, - longlong_test/2, ulong_test/2, ulonglong_test/2, - double_test/2, char_test/2, wchar_test/2, octet_test/2, - bool_test/2, struct_test/2, struct2_test/2, seq1_test/2, - seq2_test/2, seq3_test/2, seq4_test/2, seq5_test/2, - array1_test/2, array2_test/2, enum_test/2, string1_test/2, - string2_test/2, string3_test/2, string4_test/2, pid_test/2, - port_test/2, ref_test/2, term_test/2, typedef_test/3, - inline_sequence_test/2, '_set_l'/2, '_get_l'/1, - term_struct_test/2, term_sequence_test/2, wstring1_test/2]). - --define(PRINTDEBUG(Case), - io:format("erl_server: case: ~p~n" - "erl_server: location: ~p~n", [Case, [?FILE, ?LINE]])). --define(PRINTDEBUG2(Case, Msg), - io:format("erl_server: case: ~p~n" - "erl_server: Msg: ~p~n" - "erl_server: location: ~p~n", [Case, Msg, [?FILE, ?LINE]])). - -init(Env) -> - {ok, []}. - -terminate(F, R) -> - ok. - -'_get_l'(State) -> - ?PRINTDEBUG("_get_l"), - {reply, State, State}. -void_test(State) -> - ?PRINTDEBUG("void_test"), - {reply, ok, State}. - -'_set_l'(State, V) -> - ?PRINTDEBUG2("_set_l", V), - {reply, ok, V}. -ushort_test(State, V) -> - ?PRINTDEBUG2("ushort_test", V), - {reply, {V, V}, State}. -long_test(State, V) -> - ?PRINTDEBUG2("long_test", V), - {reply, {V, V}, State}. -longlong_test(State, V) -> - ?PRINTDEBUG2("longlong_test", V), - {reply, {V, V}, State}. -ulong_test(State, V) -> - ?PRINTDEBUG2("ulong_test", V), - {reply, {V, V}, State}. -ulonglong_test(State, V) -> - ?PRINTDEBUG2("ulonglong_test", V), - {reply, {V, V}, State}. -double_test(State, V) -> - ?PRINTDEBUG2("double_test", V), - {reply, {V, V}, State}. -char_test(State, V) -> - ?PRINTDEBUG2("char_test", V), - {reply, {V, V}, State}. -wchar_test(State, V) -> - ?PRINTDEBUG2("wchar_test", V), - {reply, {V, V}, State}. -octet_test(State, V) -> - ?PRINTDEBUG2("octet_test", V), - {reply, {V, V}, State}. -bool_test(State, V) -> - ?PRINTDEBUG2("bool_test", V), - {reply, {V, V}, State}. - -struct_test(State, V) -> - ?PRINTDEBUG2("struct_test", V), - {reply, {V, V}, State}. -struct2_test(State, V) -> - ?PRINTDEBUG2("struct2_test", V), - {reply, {V, V}, State}. -seq1_test(State, V) -> - ?PRINTDEBUG2("seq1_test", V), - {reply, {V, V}, State}. -seq2_test(State, V) -> - ?PRINTDEBUG2("seq2_test", V), - {reply, {V, V}, State}. -seq3_test(State, V) -> - ?PRINTDEBUG2("seq3_test", V), - {reply, {V, V}, State}. -seq4_test(State, V) -> - ?PRINTDEBUG2("seq4_test", V), - {reply, {V, V}, State}. -seq5_test(State, V) -> - ?PRINTDEBUG2("seq5_test", V), - {reply, {V, V}, State}. -array1_test(State, V) -> - ?PRINTDEBUG2("array1_test", V), - {reply, {V, V}, State}. -array2_test(State, V) -> - ?PRINTDEBUG2("array2_test", V), - {reply, {V, V}, State}. -enum_test(State, V) -> - ?PRINTDEBUG2("enum_test", V), - {reply, {V, V}, State}. -string1_test(State, V) -> - ?PRINTDEBUG2("string1_test", V), - {reply, {V, V}, State}. -string2_test(State, V) -> - ?PRINTDEBUG2("string2_test", V), - {reply, {V, V}, State}. -string3_test(State, V) -> - ?PRINTDEBUG2("string3_test", V), - {reply, {V, V}, State}. -string4_test(State, V) -> - ?PRINTDEBUG2("string4_test", V), - {reply, {V, V}, State}. -pid_test(State, V) -> - ?PRINTDEBUG2("pid_test", V), - {reply, {V, V}, State}. -port_test(State, V) -> - ?PRINTDEBUG2("port_test", binary_to_list(term_to_binary(V))), - {reply, {V, V}, State}. -ref_test(State, V) -> - ?PRINTDEBUG2("ref_test", binary_to_list(term_to_binary(V))), - {reply, {V, V}, State}. -term_test(State, V) -> - ?PRINTDEBUG2("term_test", V), - {reply, {V, V}, State}. -typedef_test(State, A, B) -> - ?PRINTDEBUG2("typedef_test", [A,B]), - {reply, {4711, A, B}, State}. -inline_sequence_test(State, V) -> - ?PRINTDEBUG2("inline_sequence_test", V), - {reply, {V, V}, State}. -term_sequence_test(State, V) -> - ?PRINTDEBUG2("term_sequence_test", V), - {reply, {V, V}, State}. -term_struct_test(State, V) -> - ?PRINTDEBUG2("term_struct_test", V), - {reply, {V, V}, State}. -wstring1_test(State, V) -> - ?PRINTDEBUG2("wstring1_test", V), - {reply, {V, V}, State}. - - - - diff --git a/lib/ic/test/c_client_erl_server_proto_SUITE.erl b/lib/ic/test/c_client_erl_server_proto_SUITE.erl deleted file mode 100644 index c15617ea3f..0000000000 --- a/lib/ic/test/c_client_erl_server_proto_SUITE.erl +++ /dev/null @@ -1,265 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - -%%---------------------------------------------------------------------- -%% Purpose : Test suite for c-client/erl-server -%%---------------------------------------------------------------------- - --module(c_client_erl_server_proto_SUITE). --include_lib("common_test/include/ct.hrl"). - --export([init_per_testcase/2, end_per_testcase/2, - all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2, - void_test/1, long_test/1, long_long_test/1, - unsigned_short_test/1, unsigned_long_test/1, - unsigned_long_long_test/1, double_test/1, char_test/1, - wchar_test/1, octet_test/1, bool_test/1, struct_test/1, - struct2_test/1, seq1_test/1, seq2_test/1, seq3_test/1, - seq4_test/1, seq5_test/1, array1_test/1, array2_test/1, - enum_test/1, string1_test/1, string2_test/1, string3_test/1, - string4_test/1, pid_test/1, port_test/1, ref_test/1, term_test/1, - typedef_test/1, inline_sequence_test/1, term_sequence_test/1, - term_struct_test/1, wstring1_test/1]). - --define(DEFAULT_TIMEOUT, 20000). --define(PORT_TIMEOUT, 15000). --define(ERLANG_SERVER_NAME, idl_erlang_server). --define(C_CLIENT_NODE_NAME, c_client_idl_test). - -%% Add/remove code path and watchdog before/after each test case. -%% -init_per_testcase(_Case, Config) -> - DataDir = proplists:get_value(data_dir, Config), - code:add_patha(DataDir), - - %% Since other test suites use the module m_i, we have - %% to make sure we are using the right m_i module. - code:purge(m_i), - code:load_file(m_i), - - WatchDog = test_server:timetrap(?DEFAULT_TIMEOUT), - [{watchdog, WatchDog}| Config]. - -end_per_testcase(_Case, Config) -> - DataDir = proplists:get_value(data_dir, Config), - code:del_path(DataDir), - WatchDog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(WatchDog). - -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - [void_test, long_test, long_long_test, - unsigned_short_test, unsigned_long_test, - unsigned_long_long_test, double_test, char_test, - wchar_test, octet_test, bool_test, struct_test, - struct2_test, seq1_test, seq2_test, seq3_test, - seq4_test, seq5_test, array1_test, array2_test, - enum_test, string1_test, string2_test, string3_test, - string4_test, pid_test, port_test, ref_test, term_test, - typedef_test, inline_sequence_test, term_sequence_test, - term_struct_test, wstring1_test]. - -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - -array1_test(Config) -> - do_test(array1_test, Config). - -array2_test(Config) -> - do_test(array2_test, Config). - -bool_test(Config) -> - do_test(bool_test, Config). - -char_test(Config) -> - do_test(char_test, Config). - -double_test(Config) -> - do_test(double_test, Config). - -enum_test(Config) -> - do_test(enum_test, Config). - -inline_sequence_test(Config) -> - do_test(inline_sequence_test, Config). - -long_long_test(Config) -> - do_test(long_long_test, Config). - -long_test(Config) -> - do_test(long_test, Config). - -octet_test(Config) -> - do_test(octet_test, Config). - -pid_test(Config) -> - do_test(pid_test, Config). - -port_test(Config) -> - do_test(port_test, Config). - -ref_test(Config) -> - do_test(ref_test, Config). - -seq1_test(Config) -> - do_test(seq1_test, Config). - -seq2_test(Config) -> - do_test(seq2_test, Config). - -seq3_test(Config) -> - do_test(seq3_test, Config). - -seq4_test(Config) -> - do_test(seq4_test, Config). - -seq5_test(Config) -> - do_test(seq5_test, Config). - -string1_test(Config) -> - do_test(string1_test, Config). - -string2_test(Config) -> - do_test(string2_test, Config). - -string3_test(Config) -> - do_test(string3_test, Config). - -string4_test(Config) -> - do_test(string4_test, Config). - -struct2_test(Config) -> - do_test(struct2_test, Config). - -struct_test(Config) -> - do_test(struct_test, Config). - -term_sequence_test(Config) -> - do_test(term_sequence_test, Config). - -term_struct_test(Config) -> - do_test(term_struct_test, Config). - -term_test(Config) -> - do_test(term_test, Config). - -typedef_test(Config) -> - do_test(typedef_test, Config). - -unsigned_long_long_test(Config) -> - do_test(unsigned_long_long_test, Config). - -unsigned_long_test(Config) -> - do_test(unsigned_long_test, Config). - -unsigned_short_test(Config) -> - do_test(unsigned_short_test, Config). - -void_test(Config) -> - do_test(void_test, Config). - -wchar_test(Config) -> - do_test(wchar_test, Config). - -wstring1_test(Config) -> - do_test(wstring1_test, Config). - - -%% It is here that all tests really are done. -%% - -do_test(Case, Config) -> - %% Trap exits - process_flag(trap_exit, true), - %% Start the server - {ok, _Pid} = m_i:oe_create_link([], {local, ?ERLANG_SERVER_NAME}), - Node = atom_to_list(node()), - %% [NodeName, HostName] = string:tokens(Node, "@"), - DataDir = proplists:get_value(data_dir, Config), - %% io:format("~p: data directory: ~p~n", [?MODULE, DataDir]), - Cookie = atom_to_list(erlang:get_cookie()), - %% Start C-client node as a port program. - Cmd = filename:join([DataDir, "c_client"]) ++ - " -this-node-name " ++ atom_to_list(?C_CLIENT_NODE_NAME) ++ - " -peer-node " ++ Node ++ - " -peer-process-name " ++ atom_to_list(?ERLANG_SERVER_NAME) ++ - " -cookie " ++ Cookie ++ - " -test-case " ++ atom_to_list(Case), - Port = open_port({spawn, Cmd}, [exit_status, eof, stderr_to_stdout]), - Res = wait_for_completion(Port), - %% Kill off node if there was timeout - case Res of - {error, timeout} -> - catch rpc:cast(?C_CLIENT_NODE_NAME, erlang, halt, [1]); - _ -> - ok - end, - process_flag(trap_exit, false), - catch m_i:stop(?ERLANG_SERVER_NAME), - ok = Res. - - -%% Wait for eof *and* exit status, but return if exit status indicates -%% an error, or we have been waiting more than PORT_TIMEOUT seconds. -%% -wait_for_completion(Port) -> - wait_for_completion(Port, 0). - -wait_for_completion(Port, N) when N < 2 -> - receive - {Port, {data, Bytes}} -> - %% Relay output - io:format("~s", [Bytes]), - wait_for_completion(Port, N); - {Port, {exit_status, 0}} -> - wait_for_completion(Port, N + 1); - {Port, {exit_status, Status}} -> - {error, Status}; - {Port, eof} -> - wait_for_completion(Port, N + 1); - {'EXIT', Port, Reason} -> - io:format("Port exited with reason: ~w~n", [Reason]), - wait_for_completion(Port, N); - {'EXIT', From, Reason} -> - io:format("Got unexpected exit: ~p~n", [{'EXIT', From, Reason}]), - wait_for_completion(Port, N) - after ?PORT_TIMEOUT -> - {error, timeout} - end; -wait_for_completion(_, _) -> - ok. - - - diff --git a/lib/ic/test/c_client_erl_server_proto_SUITE_data/Makefile.src b/lib/ic/test/c_client_erl_server_proto_SUITE_data/Makefile.src deleted file mode 100644 index fc6d416316..0000000000 --- a/lib/ic/test/c_client_erl_server_proto_SUITE_data/Makefile.src +++ /dev/null @@ -1,156 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2003-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -# Makefile.src for c_client_erl_server test -# Note: This file *must* work for both Unix and Windows -# -# We use both `rm' (Unix) and `del' (Windows) for removing files, but -# with a `-' in front so that the error in not finding `rm' (`del') on -# Windows (Unix) is ignored. -# -# VxWorks? XXX -# - -.SUFFIXES: -.SUFFIXES: .c .h .erl .idl @obj@ .@EMULATOR@ - - -# Variables from ts: -# - -ERL_INCLUDE = @erl_include@ - -IC_INCLUDE_PATH = @ic_include_path@ -IC_LIB = @ic_lib@ - -ERL_INTERFACE_INCLUDE = @erl_interface_include@ -ERL_INTERFACE_LIB = @erl_interface_lib@ -ERL_INTERFACE_EILIB = @erl_interface_eilib@ -ERL_INTERFACE_THREADLIB = @erl_interface_threadlib@ -ERL_INTERFACE_SOCK_LIBS = @erl_interface_sock_libs@ - -CC = @CC@ -## XXX Should set warning flag with a DEBUG_FLAG -CFLAGS = @CFLAGS@ @DEFS@ -I@erl_include@ \ - -I@ic_include_path@ -I@erl_interface_include@ - -LD = @LD@ -LDFLAGS = @CROSSLDFLAGS@ -LIBS = $(IC_LIB) $(ERL_INTERFACE_LIB) $(ERL_INTERFACE_EILIB) \ - $(ERL_INTERFACE_THREADLIB) @LIBS@ $(ERL_INTERFACE_SOCK_LIBS) -ERLC = erlc - -# Generated C header files -GEN_H_FILES = \ - m.h \ - m_i.h \ - oe_c_erl_test.h - -# Generated C files -GEN_C_FILES = \ - m.c \ - m_i.c \ - oe_c_erl_test.c \ - oe_code_m_a.c \ - oe_code_m_arr1.c \ - oe_code_m_arr2.c \ - oe_code_m_arr3.c \ - oe_code_m_aseq.c \ - oe_code_m_b.c \ - oe_code_m_bseq.c \ - oe_code_m_dd.c \ - oe_code_m_dyn.c \ - oe_code_m_dyn_sl.c \ - oe_code_m_es.c \ - oe_code_m_et.c \ - oe_code_m_etseq.c \ - oe_code_m_fruit.c \ - oe_code_m_lseq.c \ - oe_code_m_s.c \ - oe_code_m_s_sl.c \ - oe_code_m_sarr3.c \ - oe_code_m_simple.c \ - oe_code_m_ssarr3.c \ - oe_code_m_sseq.c \ - oe_code_m_ssstr3.c \ - oe_code_m_sstr3.c \ - oe_code_m_str1.c \ - oe_code_m_str3.c \ - oe_code_m_strRec.c \ - oe_code_m_strRec_str5.c \ - oe_code_m_strRec_str7.c - -GEN_HRL_FILES = \ - m.hrl \ - m_i.hrl \ - oe_c_erl_test.hrl - -GEN_ERL_FILES = \ - m.erl \ - m_arr2.erl \ - m_arr3.erl \ - m_i.erl \ - m_str3.erl \ - oe_c_erl_test.erl - -C_FILES = $(GEN_C_FILES) c_client.c my.c - -OBJS = $(C_FILES:.c=@obj@) - -PGMS = c_client@exe@ - -ERL_FILES = $(GEN_ERL_FILES) m_i_impl.erl - -EBINS = $(ERL_FILES:.erl=.@EMULATOR@) - - -all: $(PGMS) $(EBINS) - -$(GEN_ERL_FILES) $(GEN_HRL_FILES): c_erl_test.built_erl -$(GEN_C_FILES) $(GEN_H_FILES): c_erl_test.built_c -$(OBJS): $(GEN_C_FILES) $(GEN_H_FILES) -$(EBINS): $(GEN_ERL_FILES) $(GEN_HRL_FILES) - -clean: - -rm -f $(OBJS) $(GEN_C_FILES) $(GEN_H_FILES) $(PGMS) \ - $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) \ - c_erl_test.built_erl c_erl_test.built_c - -del /F /Q $(OBJS) $(GEN_C_FILES) $(GEN_H_FILES) $(PGMS) \ - $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) \ - c_erl_test.built_erl c_erl_test.built_c - -$(PGMS): $(OBJS) - $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) - -c_erl_test.built_c: c_erl_test.idl - $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,c_client}" \ - "+{user_protocol,my}" c_erl_test.idl - echo done > c_erl_test.built_c - -c_erl_test.built_erl: c_erl_test.idl - $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,erl_genserv}" c_erl_test.idl - echo done > c_erl_test.built_erl - -.c@obj@: - $(CC) -c -o $*@obj@ $(CFLAGS) $< - -.erl.@EMULATOR@: - $(ERLC) -I $(IC_INCLUDE_PATH) $< - diff --git a/lib/ic/test/c_client_erl_server_proto_SUITE_data/c_client.c b/lib/ic/test/c_client_erl_server_proto_SUITE_data/c_client.c deleted file mode 100644 index d6a78d2481..0000000000 --- a/lib/ic/test/c_client_erl_server_proto_SUITE_data/c_client.c +++ /dev/null @@ -1,1764 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2003-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -/* C-client for test of IC. - * - * TODO: - * - * 1. XXX #includes for VxWorks, Windows - */ - -#include -#include - -#ifndef __WIN32__ -# include -#endif - -#include - -#ifdef __WIN32__ -# include -# include -#elif defined VXWORKS -#include -#include -#else -#include -#endif - -#include - -#ifdef __WIN32__ -# include -# include -#else -# include -# include -# include -# include -# include -#endif - -#include "ei.h" -#include "erl_interface.h" -#include "m_i.h" - -#define HOSTNAMESZ 255 -#define NODENAMESZ 512 - -#define INBUFSZ 10 -#define OUTBUFSZ 0 - -#define MAXTRIES 5 - -#define CHECK_EXCEPTION(x) \ - if ((x)->_major != CORBA_NO_EXCEPTION) { \ - fprintf(stderr,"\n\nException: %s\n\n", \ - (char *)CORBA_exception_value((x))); \ - CORBA_exception_free((x)); \ - return -1; \ - } \ - -/* XXX Should free things here too! */ -#define RETURN_IF_OK(x) \ - if ((x)) {\ - fprintf(stdout, "ok\n");\ - return 0;\ - }\ - -#define cmp_str(x,y) (!strcmp((x),(y))) -#define cmp_wstr(x,y) (!ic_wstrcmp((x),(y))) - -typedef CORBA_Environment IC_Env; - -typedef int (*TestFunc)(IC_Env *); -typedef struct { - char *name; - TestFunc func; -} TestCase; - -static char longtext[] = -"Introduction The IC application is an IDL compiler implemented in Erlang." -" The IDL compiler generates client stubs and server skeletons." -" Several back-ends are supported, and they fall into three main groups." -" For more details on IC compiler options consult the ic(3) manual page." -" Argument passing cases 1 Caller allocates all necessary storage," -" except that which may be encapsulated and managed within the parameter itself." -" 2 The caller allocates a pointer and passes it by reference to the callee." -" The callee sets the pointer to point to a valid instance of the parameter's type." -" The caller is responsible for releasing the returned storage." -" Following completion of a request, the caller is not allowed to modify any values" -" in the returned storage. To do so the caller must first copy the returned instance" -" into a new instance, then modify the new instance. 3 The caller allocates a" -" pointer to an array slice which has all the same dimensions of the original" -" array except the first, and passes it by reference to the callee. The callee sets" -" the pointer to point to a valid instance of the array. The caller is responsible for" -" releasing the returned storage. Following completion of a request, the caller is not" -" allowed to modify any values in the returned storage. To do so the caller must first" -" copy the returned instance into a new instance, then modify the new instance." -" Generated Files Two files will be generated for each scope. One set of files will be" -" generated for each module and each interface scope. An extra set is generated for" -" those definitions at top level scope. One of the files is a header file(.h), and the" -" other file is a C source code file (.c). In addition to these files a number of C" -" source files will be generated for type encodings, they are named according to the " -"following template: oe_code_.c."; -static char this_node[NODENAMESZ + 1]; -static char *progname; - -/* Test function prototypes */ - -static int void_test(IC_Env *env); -static int long_test(IC_Env *env); -static int long_long_test(IC_Env *env); -static int unsigned_short_test(IC_Env *env); -static int unsigned_long_test(IC_Env *env); -static int unsigned_long_long_test(IC_Env *env); -static int double_test(IC_Env *env); -static int char_test(IC_Env *env); -static int wchar_test(IC_Env *env); -static int octet_test(IC_Env *env); -static int bool_test(IC_Env *env); -static int struct_test(IC_Env *env); -static int struct2_test(IC_Env *env); -static int seq1_test(IC_Env *env); -static int seq2_test(IC_Env *env); -static int seq3_test(IC_Env *env); -static int seq4_test(IC_Env *env); -static int seq5_test(IC_Env *env); -static int array1_test(IC_Env *env); -static int array2_test(IC_Env *env); -static int enum_test(IC_Env *env); -static int string1_test(IC_Env *env); -static int string2_test(IC_Env *env); -static int string3_test(IC_Env *env); -static int string4_test(IC_Env *env); -static int pid_test(IC_Env *env); -static int port_test(IC_Env *env); -static int ref_test(IC_Env *env); -static int term_test(IC_Env *env); -static int typedef_test(IC_Env *env); -static int inline_sequence_test(IC_Env *env); -static int term_sequence_test(IC_Env *env); -static int term_struct_test(IC_Env *env); -static int wstring1_test(IC_Env *env); - -static TestCase test_cases[] = { - {"void_test", void_test}, - {"long_test", long_test}, - {"long_long_test", long_long_test}, - {"unsigned_short_test", unsigned_short_test}, - {"unsigned_long_test", unsigned_long_test}, - {"unsigned_long_long_test", unsigned_long_long_test}, - {"double_test", double_test}, - {"char_test", char_test}, - {"wchar_test", wchar_test}, - {"octet_test", octet_test}, - {"bool_test", bool_test}, - {"struct_test", struct_test}, - {"struct2_test", struct2_test}, - {"seq1_test", seq1_test}, - {"seq2_test", seq2_test}, - {"seq3_test", seq3_test}, - {"seq4_test", seq4_test}, - {"seq5_test", seq5_test}, - {"array1_test", array1_test}, - {"array2_test", array2_test}, - {"enum_test", enum_test}, - {"string1_test", string1_test}, - {"string2_test", string2_test}, - {"string3_test", string3_test}, - {"string4_test", string4_test}, - {"pid_test", pid_test}, - {"port_test", port_test}, - {"ref_test", ref_test}, - {"term_test", term_test}, - {"typedef_test", typedef_test}, - {"inline_sequence_test", inline_sequence_test}, - {"term_sequence_test", term_sequence_test}, - {"term_struct_test", term_struct_test}, - {"wstring1_test", wstring1_test}, - {"", NULL} -}; - -/* Other prototypes */ -static int cmp_aseq(m_aseq *a1, m_aseq *a2); -static int cmp_a(m_a *a1, m_a *a2); -static int cmp_bseq(m_bseq *b1, m_bseq *b2); -static int cmp_b(m_b *b1, m_b *b2); -static int cmp_lseq(m_lseq *b1, m_lseq *b2); -static int cmp_etseq(m_etseq *b1, m_etseq *b2); -static int cmp_et(m_et* b1, m_et *b2); -static int cmp_es(m_es *b1, m_es *b2); -static int cmp_arr1(m_arr1 b1, m_arr1 b2); -static int cmp_dd(m_dd b1, m_dd b2); -static int cmp_strRec(m_strRec *b1, m_strRec *b2); -static int cmp_sseq(m_sseq *b1, m_sseq *b2); -static int cmp_pid(erlang_pid *p1, erlang_pid *p2); -static int cmp_port(erlang_port *p1, erlang_port *p2); -static int cmp_ref(erlang_ref *p1, erlang_ref *p2); -static int cmp_s(m_s *b1, m_s *b2); -static int cmp_ssstr3(m_ssstr3 *b1, m_ssstr3 *b2); -static int cmp_ssarr3(m_ssarr3 *b1, m_ssarr3 *b2); -static int cmp_sarr3(m_sarr3 *b1, m_sarr3 *b2); -static int cmp_arr3(m_arr3 b1, m_arr3 b2); - -static void print_aseq(m_aseq *a); -static void print_a(m_a *a); -static void print_bseq(m_bseq *b); -static void print_lseq(m_lseq *b); -static void print_b(m_b *b); -static void print_etseq(m_etseq *b); -static void print_et(m_et* b); -static void print_es(m_es *b); -static void print_arr1(long a[500]); -static void print_dd(long a[2][3]); -static void print_strRec(m_strRec* sr); -static void print_sseq(m_sseq *b); -static void print_pid(erlang_pid *p); -static void print_port(erlang_port *p); -static void print_ref(erlang_ref *p); -static void print_term(ETERM *t); -static void print_s(m_s *p); -static void print_ssstr3(m_ssstr3 *b1); -static void print_ssarr3(m_ssarr3 *b1); -static void print_sarr3(m_sarr3 *b1); -static void print_arr3(m_arr3 b1); -static void print_wstr(CORBA_wchar *ws); - -static void free_etseq_buf(m_etseq *b); -static void free_et(m_et* b); - -#ifdef __WIN32__ -typedef struct { - long tv_sec; - long tv_usec; -} MyTimeval; -#else -typedef struct timeval MyTimeval; -#endif -static void my_gettimeofday(MyTimeval *tv); -static void showtime(MyTimeval *start, MyTimeval *stop); -static void usage(void); -static void done(int r); - - - -/* main */ - -#ifdef VXWORKS -int client(int argc, char **argv) -#else -int main(int argc, char **argv) -#endif -{ - struct hostent *hp; - erlang_pid pid; - MyTimeval start, stop; - int i, fd, ires, tres; - IC_Env *env; - int tries = 0; - char *this_node_name = NULL; - char *peer_node = NULL; - char *peer_process_name = NULL; - char *cookie = NULL; - char host[HOSTNAMESZ + 1]; - TestFunc test_func = NULL; - TestCase *test_case; - char *test_case_name = NULL; - -#ifdef __WIN32__ - WORD wVersionRequested; - WSADATA wsaData; - - wVersionRequested = MAKEWORD(2, 0); - - if (WSAStartup(wVersionRequested, &wsaData) != 0) { - fprintf(stderr, "Could not load winsock2 v2.0 compatible DLL"); - exit(1); - } -#endif - - progname = argv[0]; - host[HOSTNAMESZ] = '\0'; - if (gethostname(host, HOSTNAMESZ + 1) < 0) { - fprintf(stderr, "Can't find own hostname\n"); - done(1); - } - if ((hp = gethostbyname(host)) == 0) { - fprintf(stderr, "Can't get ip address for host %s\n", host); - done(1); - } - for (i = 1; i < argc; i++) { - if (cmp_str(argv[i], "-help")) { - usage(); - done(0); - } else if (cmp_str(argv[i], "-this-node-name")) { - i++; - this_node_name = argv[i]; - } else if (cmp_str(argv[i], "-peer-node")) { - i++; - peer_node = argv[i]; - } else if (cmp_str(argv[i], "-peer-process-name")) { - i++; - peer_process_name = argv[i]; - } else if (cmp_str(argv[i], "-cookie")) { - i++; - cookie = argv[i]; - } else if (cmp_str(argv[i], "-test-case")) { - i++; - test_case_name = argv[i]; - } else { - fprintf(stderr, "Error : invalid argument \"%s\"\n", argv[i]); - usage(); - done(1); - } - } - - if (this_node_name == NULL || peer_node == NULL || test_case_name == NULL - || peer_process_name == NULL || cookie == NULL) { - fprintf(stderr, "Error: missing option\n"); - usage(); - done(1); - } - - test_case = test_cases; - while (test_case->func) { - if (cmp_str(test_case->name, test_case_name)) { - test_func = test_case->func; - break; - } - test_case++; - } - if (test_func == NULL) { - fprintf(stderr, "Error: illegal test case: \"%s\"\n", test_case_name); - done(1); - } - - /* Behead hostname at first dot */ - for (i=0; host[i] != '\0'; i++) { - if (host[i] == '.') { host[i] = '\0'; break; } - } - sprintf(this_node, "%s@%s", this_node_name, host); - fprintf(stderr, "c_client: this node: \"%s\"\n", this_node); - fprintf(stderr, "c_client: peer node: \"%s\"\n", peer_node); - fprintf(stderr, "c_client: test case: \"%s\"\n", test_case_name); - - fprintf(stderr, "c_client: starting\n"); - - /* initialize erl_interface */ - erl_init(NULL, 0); - - for (tries = 0; tries < MAXTRIES; tries++) { - - /* connect to erlang node */ - - ires = erl_connect_xinit(host, this_node_name, this_node, - (struct in_addr *)*hp->h_addr_list, - cookie, 0); - - fprintf(stderr, "c_client: erl_connect_xinit(): %d\n", ires); - - fd = erl_connect(peer_node); - fprintf(stderr, "c_client: erl_connect(): %d\n", fd); - - if (fd >= 0) - break; - fprintf(stderr, "c_client: cannot connect, retrying\n"); - } - if (fd < 0) { - fprintf(stderr, "c_client: cannot connect, exiting\n"); - done(1); - } - env = CORBA_Environment_alloc(INBUFSZ, OUTBUFSZ); - env->_fd = fd; - strcpy(env->_regname, peer_process_name); - env->_to_pid = NULL; - env->_from_pid = &pid; - - strcpy(pid.node, this_node); - pid.num = fd; - pid.serial = 0; - pid.creation = 0; - - my_gettimeofday(&start); - tres = test_func(env); /* Call test case */ - my_gettimeofday(&stop); - showtime(&start, &stop); - erl_close_connection(fd); - - printf("c_client: env->_inbuf before : %d\n", INBUFSZ); - printf("c_client: env->_outbuf before : %d\n", OUTBUFSZ); - printf("c_client: env->_inbuf after : %d\n", env->_inbufsz); - printf("c_client: env->_outbuf after : %d\n", env->_outbufsz); - - CORBA_free(env->_inbuf); - CORBA_free(env->_outbuf); - CORBA_free(env); - done(tres); -} - -static void usage() -{ - fprintf(stderr, "Usage: %s [-help] -this-node-name " - "-peer-node -peer-process-name " - "-cookie -test-case \n", progname); - fprintf(stderr, "Example:\n %s -this-node-name kalle " - "-peer-node olle@home -peer-process-name idltest " - "-cookie oa678er -test-case octet_test\n", progname); -} - -static void done(int r) -{ -#ifdef __WIN32__ - WSACleanup(); -#endif - exit(r); -} - - -/* TESTS */ - -static int void_test(IC_Env *env) -{ - fprintf(stdout, "\n======== m_i_void test ======\n\n"); - m_i_void_test(NULL,env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(1); -} - -static int long_test(IC_Env *env) -{ - long l = 4711, lo, lr; - - fprintf(stdout, "\n======== m_i_long test ======\n\n"); - lr = m_i_long_test(NULL, l, &lo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(l == lo && l == lr); - if (l != lo) - fprintf(stdout, " out parameter error, sent: %ld, got: %ld\n", l, lo); - if (l != lr) - fprintf(stdout, " result error, sent: %ld, got: %ld\n", l, lr); - return -1; -} - -static int long_long_test(IC_Env *env) -{ - CORBA_long_long ll = 4711, llo, llr; - - fprintf(stdout, "\n======== m_i_longlong test ======\n\n"); - llr = m_i_longlong_test(NULL, ll, &llo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(ll == llo && ll == llr); - if (ll != llo) - fprintf(stdout, " out parameter error, sent: %ld, got: %ld\n", - ll, llo); - if (ll != llr) - fprintf(stdout, " result error, sent: %ld, got: %ld\n", ll, llr); - return -1; -} - -static int unsigned_short_test(IC_Env *env) -{ - unsigned short x, y = 2, z; - - fprintf(stdout, "\n======== m_i_ushort test ======\n\n"); - x = m_i_ushort_test(NULL, y, &z, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(y == z && y == x); - if (y != z) - fprintf(stdout, " out parameter error, sent: %d, got: %d\n", y, z); - if (y != x) - fprintf(stdout, " result error, sent: %d, got: %d\n", y, x); - return -1; -} - - -static int unsigned_long_test(IC_Env *env) -{ - unsigned long ul = 5050, ulo, ulr; - - fprintf(stdout, "\n======== m_i_ulong test ======\n\n"); - ulr = m_i_ulong_test(NULL, ul, &ulo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(ul == ulo && ul == ulr); - if (ul != ulo) - fprintf(stdout, " out parameter error, sent: %lu, got: %lu\n", - ul, ulo); - if (ul != ulr) - fprintf(stdout, " result error, sent: %lu, got: %lu\n", ul, ulr); - return -1; -} - -/* - * Note: CORBA_unsigned_long_long is in fact a plain long. - */ -static int unsigned_long_long_test(IC_Env *env) -{ - CORBA_unsigned_long_long ull = 5050, ullo, ullr; - - fprintf(stdout, "\n======== m_i_ulonglong test ======\n\n"); - ullr = m_i_ulonglong_test(NULL, ull, &ullo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(ull == ullo && ull == ullr); - if (ull != ullo) - fprintf(stdout, " out parameter error, sent: %lu, got: %lu\n", - ull, ullo); - if (ull != ullr) - fprintf(stdout, " result error, sent: %lu, got: %lu\n", - ull, ullr); - return -1; -} - -static int double_test(IC_Env *env) -{ - double d = 12.1212, db, dr; - - fprintf(stdout, "\n======== m_i_double test ======\n\n"); - dr = m_i_double_test(NULL, d, &db, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(d == db && d == dr); - if (d != db) - fprintf(stdout, " out parameter error, sent: %f, got: %f\n", d, db); - if (d != dr) - fprintf(stdout, " result error, sent: %f, got: %f\n", d, dr); - return -1; -} - -static int char_test(IC_Env *env) -{ - char c = 'g', co, cr; - - /* char test */ - fprintf(stdout, "\n======== m_i_char test ======\n\n"); - cr = m_i_char_test(NULL, c, &co, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(c == co && c == cr); - if (c !=co) - fprintf(stdout, " out parameter error, sent: %c, got: %c\n", c, co); - if (c != cr) - fprintf(stdout, " result error, sent: %c, got: %c\n", c, cr); - return -1; -} - -static int wchar_test(IC_Env *env) -{ - CORBA_wchar wc = 103, wco, wcr; - - fprintf(stdout, "\n======== m_i_wchar test ======\n\n"); - wcr = m_i_wchar_test(NULL, wc, &wco, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(wc == wco && wc == wcr); - if (wc != wco) - fprintf(stdout, " out parameter error, sent: %lu, got: %lu\n", - wc, wco); - if (wc != wcr) - fprintf(stdout, " result error, sent: %lu, got: %lu\n", - wc, wcr); - return -1; -} - -static int octet_test(IC_Env *env) -{ - char o ='r', oo, or; - - fprintf(stdout, "\n======== m_i_octet test ======\n\n"); - or = m_i_octet_test(NULL, o, &oo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(o == oo && o == or); - if (o != oo) - fprintf(stdout, " out parameter error, sent: %c, got: %c\n", o, oo); - if (o != or) - fprintf(stdout, " result error, sent: %c, got: %c\n", o, or); - return -1; -} - -static int bool_test(IC_Env *env) -{ - unsigned char i = 0, io, ir; - - fprintf(stdout, "\n======== m_i_bool test ======\n\n"); - ir = m_i_bool_test(NULL, i, &io, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(i == io && i == ir); - if (i != io) - fprintf(stdout, " out parameter error, sent: %d, got: %d\n", i, io); - if (i != ir) - fprintf(stdout, " result error, sent: %d, got: %d\n", i, ir); - return -1; -} - -static int struct_test(IC_Env *env) -{ - m_b b = {4711, 'a'}, bo, br; - - fprintf(stdout, "\n======== m_i_struct test ======\n\n"); - br = m_i_struct_test(NULL, &b, &bo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_b(&b, &bo) && cmp_b(&b, &br)); - if (!cmp_b(&b, &bo)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_b(&b); - fprintf(stdout, " got:\n"); - print_b(&bo); - fprintf(stdout, "\n"); - } - if (!cmp_b(&b, &br)) { - fprintf(stdout, " result error, sent:\n"); - print_b(&b); - fprintf(stdout, " got:\n"); - print_b(&br); - fprintf(stdout, "\n"); - } - return -1; -} - -static int struct2_test(IC_Env *env) -{ - m_es esi = {m_peach, 5050}, eso, esr; - - fprintf(stdout, "\n======== m_i_struct2 test ======\n\n"); - esr = m_i_struct2_test(NULL, &esi, &eso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_es(&esi, &eso) && cmp_es(&esi, &esr)); - if (!cmp_es(&esi, &eso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_es(&esi); - fprintf(stdout, " got:\n"); - print_es(&eso); - fprintf(stdout, "\n"); - } - if (!cmp_es(&esi, &esr)) { - fprintf(stdout, " result error, sent:\n"); - print_es(&esi); - fprintf(stdout, " got:\n"); - print_es(&esr); - fprintf(stdout, "\n"); - } - return -1; -} - - -static int seq1_test(IC_Env *env) -{ - m_bseq bs, *bso, *bsr; - - m_b ba[3] = {{4711, 'a'}, {4712, 'b'}, {4713, 'c'}}; - bs._length = 3; - bs._buffer = ba; - - fprintf(stdout, "\n======== m_i_seq1 test ======\n\n"); - bsr = m_i_seq1_test(NULL, &bs, &bso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_bseq(&bs, bso) && cmp_bseq(&bs, bsr)); - if (!cmp_bseq(&bs, bso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_bseq(&bs); - fprintf(stdout, " got:\n"); - print_bseq(bso); - fprintf(stdout, "\n"); - } - if (!cmp_bseq(&bs, bsr)) { - fprintf(stdout, " result error, sent:\n"); - print_bseq(&bs); - fprintf(stdout, " got:\n"); - print_bseq(bsr); - fprintf(stdout, "\n"); - } - CORBA_free(bso); - CORBA_free(bsr); - return -1; -} - -static int seq2_test(IC_Env *env) -{ - m_b ba[3] = {{4711, 'a'}, {4712, 'b'}, {4713, 'c'}}; - m_a a; - m_a aa[2]; - m_aseq as, *aso, *asr; - - a.l = 9999; - a.y._length = 3; - a.y._buffer = ba; - a.d = 66.89898989; - - aa[0] = a; - aa[1] = a; - as._length = 2; - as._buffer = aa; - - fprintf(stdout, "\n======== m_i_seq2 test ======\n\n"); - asr = m_i_seq2_test(NULL, &as, &aso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_aseq(&as, aso) && cmp_aseq(&as, asr)); - if (!cmp_aseq(&as, aso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_aseq(&as); - fprintf(stdout, " got:\n"); - print_aseq(aso); - fprintf(stdout, "\n"); - } - if (!cmp_aseq(&as, asr)) { - fprintf(stdout, " result error, sent:\n"); - print_aseq(&as); - fprintf(stdout, " got:\n"); - print_aseq(asr); - fprintf(stdout, "\n"); - } - CORBA_free(aso); - CORBA_free(asr); - return -1; -} - -static int seq3_test(IC_Env *env) -{ - m_lseq lsi, *lso, *lsr; - long al[500]; - int i=0; - - for (i = 0; i < 500; i++) - al[i]=i; - lsi._length = 500; - lsi._buffer = al; - - fprintf(stdout, "\n======== m_i_seq3 test ======\n\n"); - lsr = m_i_seq3_test(NULL, &lsi, &lso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_lseq(&lsi, lso) && cmp_lseq(&lsi, lsr)); - if (!cmp_lseq(&lsi, lso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_lseq(&lsi); - fprintf(stdout, " got:\n"); - print_lseq(lso); - fprintf(stdout, "\n"); - } - if (!cmp_lseq(&lsi, lsr)) { - fprintf(stdout, " result error, sent:\n"); - print_lseq(&lsi); - fprintf(stdout, " got:\n"); - print_lseq(lsr); - fprintf(stdout, "\n"); - } - CORBA_free(lso); - CORBA_free(lsr); - return -1; -} - -static int seq4_test(IC_Env *env) -{ - char *stra0[3] = {"a", "long", "time"}; - char *stra1[3] = {"ago", "there", "was"}; - char *stra2[3] = {"a", "buggy", "compiler"}; - m_sstr3 str3s[3] = {{3, 3, stra0}, {3, 3, stra1}, {3, 3, stra2}}; - m_ssstr3 str3ssi = {3, 3, str3s}; - m_ssstr3 *str3sso, *str3ssr; - - fprintf(stdout, "\n======== m_i_seq4 test ======\n\n"); - str3ssr = m_i_seq4_test(NULL, &str3ssi, &str3sso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_ssstr3(&str3ssi, str3sso) && - cmp_ssstr3(&str3ssi, str3ssr)); - if (!cmp_ssstr3(&str3ssi, str3sso)){ - fprintf(stdout, " out parameter error, sent:\n"); - print_ssstr3(&str3ssi); - fprintf(stdout, " got:\n"); - print_ssstr3(str3sso); - fprintf(stdout, "\n"); - } - if (!cmp_ssstr3(&str3ssi, str3ssr)) { - fprintf(stdout, " result error, sent:\n"); - print_ssstr3(&str3ssi); - fprintf(stdout, " got:\n"); - print_ssstr3(str3ssr); - fprintf(stdout, "\n"); - } - CORBA_free(str3sso); - CORBA_free(str3ssr); - return -1; -} - -static int seq5_test(IC_Env *env) -{ - m_arr3 arr3a[3] = { - {4711, 18931947, 3}, - {4711, 18931947, 3}, - {4711, 18931947, 3}}; - m_sarr3 arr3sa[3] = {{3, 3, arr3a}, {3, 3, arr3a}, {3, 3, arr3a}}; - m_ssarr3 arr3ssi = {3, 3, arr3sa}; - m_ssarr3 *arr3sso; - m_ssarr3 *arr3ssr; - - fprintf(stdout, "\n======== m_i_seq5 test ======\n\n"); - arr3ssr = m_i_seq5_test(NULL, &arr3ssi, &arr3sso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_ssarr3(&arr3ssi, arr3sso) && - cmp_ssarr3(&arr3ssi, arr3ssr)); - if (!cmp_ssarr3(&arr3ssi, arr3sso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_ssarr3(&arr3ssi); - fprintf(stdout, " got:\n"); - print_ssarr3(arr3sso); - fprintf(stdout, "\n"); - } - if (!cmp_ssarr3(&arr3ssi, arr3ssr)) { - fprintf(stdout, " result error, sent:\n"); - print_ssarr3(&arr3ssi); - fprintf(stdout, " got:\n"); - print_ssarr3(arr3ssr); - fprintf(stdout, "\n"); - } - CORBA_free(arr3sso); - CORBA_free(arr3ssr); - return -1; -} - -static int array1_test(IC_Env *env) -{ - int i; - long al[500]; - m_arr1 alo; - m_arr1_slice* alr; - - for (i = 0; i < 500; i++) - al[i]=i; - - fprintf(stdout, "\n======== m_i_array1 test ======\n\n"); - alr = m_i_array1_test(NULL, al, alo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_arr1(al, alo) && cmp_arr1(al, alr)); - if (!cmp_arr1(al, alo)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_arr1(al); - fprintf(stdout, " got:\n"); - print_arr1(alo); - fprintf(stdout, "\n"); - } - if (!cmp_arr1(al,alr)) { - fprintf(stdout, " result error, sent:\n"); - print_arr1(al); - fprintf(stdout, " got:\n"); - print_arr1(alr); - fprintf(stdout, "\n"); - } - free(alo); - free(alr); - return -1; -} - -static int array2_test(IC_Env *env) -{ - long dl[2][3] = {{11, 2, 7}, {22, 8 ,13}}; - m_dd dlo; - m_dd_slice* dlr; - - fprintf(stdout, "\n======== m_i_array2 test ======\n\n"); - dlr = m_i_array2_test(NULL, dl, dlo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_dd(dl,dlo) && cmp_dd(dl,dlr)); - if (!cmp_dd(dl,dlo)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_dd(dl); - fprintf(stdout, " got:\n"); - print_dd(dlo); - fprintf(stdout, "\n"); - } - if (!cmp_dd(dl,dlr)) { - fprintf(stdout, " result error, sent:\n"); - print_dd(dl); - fprintf(stdout, " got:\n"); - print_dd(dlr); - fprintf(stdout, "\n"); - } - free(*dlr); - return -1; -} - -static int enum_test(IC_Env *env) -{ - m_fruit ei = m_banana, eo, er; - - fprintf(stdout, "\n======== m_i_enum test ======\n\n"); - er = m_i_enum_test(NULL, ei, &eo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(ei == eo && ei == er); - if (ei != eo) - fprintf(stdout, " out parameter error, sent: %d, got: %d\n", ei, eo); - if (ei != er) - fprintf(stdout, " result error, sent: %d, got: %d\n", ei, er); - return -1; -} - -static int string1_test(IC_Env *env) -{ - char* si = longtext; - char* so; - char* sr; - - fprintf(stdout, "\n======== m_i_string1 test ======\n\n"); - sr = m_i_string1_test(NULL, si, &so, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_str(si, so) && cmp_str(si, sr)); - if (!cmp_str(si, so)) - fprintf(stdout, " out parameter error, sent: %s, got: %s\n", si, so); - if (!cmp_str(si, sr)) - fprintf(stdout, " result error, sent: %s, got: %s\n", si, sr); - CORBA_free(so); - CORBA_free(sr); - return -1; -} - -static int string2_test(IC_Env *env) -{ - char* sa[3] = {"hello", "foo", "bar"}; - m_sseq ssi = {3, 3, sa}; - m_sseq *sso, *ssr; - - fprintf(stdout, "\n======== m_i_string2 test ======\n\n"); - ssr = m_i_string2_test(NULL, &ssi, &sso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_sseq(&ssi, sso) && cmp_sseq(&ssi, sso)); - if (!cmp_sseq(&ssi, sso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_sseq(&ssi); - fprintf(stdout, "got:\n"); - print_sseq(sso); - } - if (!cmp_sseq(&ssi, ssr)) { - fprintf(stdout, " result error, sent:\n"); - print_sseq(&ssi); - fprintf(stdout, "got:\n"); - print_sseq(ssr); - } - CORBA_free(sso); - CORBA_free(ssr); - return -1; -} - -static int string3_test(IC_Env *env) -{ - char* si = longtext; - char* so; - char* sr; - - fprintf(stdout, "\n======== m_i_string3 test ======\n\n"); - sr = m_i_string3_test(NULL, si, &so, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_str(si, so) && cmp_str(si, so)); - if (!cmp_str(si, so)) - fprintf(stdout, " out parameter error, sent: %s, got: %s\n", si, so); - if (!cmp_str(si, sr)) - fprintf(stdout, " result error, sent: %s, got: %s\n", si, sr); - CORBA_free(so); - CORBA_free(sr); - return -1; -} - -static int string4_test(IC_Env *env) -{ - char as1[100] = "a string", as2[200] = "help", as3[200] = "hello there"; - m_strRec stri = { 1, /* dd */ - as1, /* str4 */ - {{'a', 'k'}, {'z', 'g'}, {'n', 'q'}}, /* str7 */ - {3, 3, "buf"}, /* str5 */ - as2, /* str6 */ - {'m', 'f', 'o'}, /* str8 */ - as3, /* str9 */ - {3, 3, "stu"} /* str10 */ - }; - m_strRec *stro, *strr; - - fprintf(stdout, "\n======== m_i_string4 test ======\n\n"); - strr = m_i_string4_test(NULL, &stri, &stro, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_strRec(&stri,stro) && cmp_strRec(&stri,strr)); - if (!cmp_strRec(&stri,stro)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_strRec(&stri); - fprintf(stdout, " got:\n"); - print_strRec(stro); - fprintf(stdout, "\n"); - } - if (!cmp_strRec(&stri,strr)) { - fprintf(stdout, " result error, sent:\n"); - print_strRec(&stri); - fprintf(stdout, " got:\n"); - print_strRec(strr); - fprintf(stdout, "\n"); - } - CORBA_free(stro); - CORBA_free(strr); - return -1; -} - - -static int pid_test(IC_Env *env) -{ - erlang_pid pid = {"", 7, 0, 0}, pido, pidr; - - strcpy(pid.node, this_node), /* this currently running node */ - fprintf(stdout, "\n======== m_i_pid test ======\n\n"); - pidr = m_i_pid_test(NULL, &pid, &pido, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_pid(&pid, &pido) && cmp_pid(&pid, &pidr)); - if (!cmp_pid(&pid, &pido)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_pid(&pid); - fprintf(stdout, "got:\n"); - print_pid(&pido); - } - if (!cmp_pid(&pid, &pidr)) { - fprintf(stdout, " result error, sent:\n"); - print_pid(&pid); - fprintf(stdout, "got:\n"); - print_pid(&pidr); - } - return -1; -} - -static int port_test(IC_Env *env) -{ - erlang_port porti = {"node", 5, 1}, porto, portr; - - fprintf(stdout, "\n======== m_i_port test ======\n\n"); - portr = m_i_port_test(NULL, &porti, &porto, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_port(&porti, &porto) && cmp_port(&porti, &portr)); - if (!cmp_port(&porti, &porto)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_port(&porti); - fprintf(stdout, "got:\n"); - print_port(&porto); - } - if (!cmp_port(&porti, &portr)) { - fprintf(stdout, " result error, sent:\n"); - print_port(&porti); - fprintf(stdout, "got:\n"); - print_port(&portr); - } - return -1; -} - -static int ref_test(IC_Env *env) -{ - erlang_ref refi = { "node1", 3, {1, 2, 3}, 1}, - refo, refr; - - fprintf(stdout, "\n======== m_i_ref test ======\n\n"); - refr = m_i_ref_test(NULL, &refi, &refo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_ref(&refi, &refo) && cmp_ref(&refi, &refr)); - if (!cmp_ref(&refi, &refo)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_ref(&refi); - fprintf(stdout, "got:\n"); - print_ref(&refo); - } - if (!cmp_ref(&refi, &refr)) { - fprintf(stdout, " result error, sent:\n"); - print_ref(&refi); - fprintf(stdout, "got:\n"); - print_ref(&refr); - } - return -1; -} - -static int term_test(IC_Env *env) -{ - ETERM *ti, *to, *tr; - - ti = erl_format("[{hej, 1, 23}, \"string\", {1.23, 45}]"); - - fprintf(stdout, "\n======== m_i_term test ======\n\n"); - tr = m_i_term_test(NULL, ti, &to, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(erl_match(ti, to) && erl_match(ti, tr)); - if (!erl_match(ti, to)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_term(ti); - fprintf(stdout, "got:\n"); - print_term(to); - } - if (!erl_match(ti, tr)) { - fprintf(stdout, " result error, sent:\n"); - print_term(ti); - fprintf(stdout, "got:\n"); - print_term(tr); - } - erl_free_term(ti); - erl_free_term(to); - erl_free_term(tr); - return -1; -} - -static int typedef_test(IC_Env *env) -{ - m_banan mbi, mbo; /* erlang_port */ - m_apa mai; /* ETERM* */ - m_apa mao = NULL; - long tl; - - strcpy(mbi.node,"node"); - mbi.id = 15; - mbi.creation = 1; - - fprintf(stdout, "\n======== m_i_typedef test ======\n\n"); - mai = erl_format("[{hej, 1, 23}, \"string\", {1.23, 45}]"); - tl = m_i_typedef_test(NULL, mai, &mbi, &mao, &mbo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(erl_match(mai, mao) && cmp_port(&mbi, &mbo) && tl == 4711); - if (!erl_match(mai, mao)) { - fprintf(stdout, " out parameter error (term), sent:\n"); - print_term(mai); - fprintf(stdout, "got:\n"); - print_term(mao); - } - if (!cmp_port(&mbi, &mbo)) { - fprintf(stdout, " out parameter error (port), sent:\n"); - print_port(&mbi); - fprintf(stdout, "got:\n"); - print_port(&mbo); - } - if (tl != 4711) { - fprintf(stdout, " result error, sent: 4711, got %ld\n", tl); - } - erl_free_term(mai); - erl_free_term(mao); - return -1; -} - -static int inline_sequence_test(IC_Env *env) -{ - int i; - long al[500]; - m_s isi = {4711, {500, 10, al}}, - *iso, *isr; - - for (i = 0; i < 500; i++) - al[i]=i; - fprintf(stdout, "\n======== m_i_inline_sequence test ======\n\n"); - isr = m_i_inline_sequence_test(NULL, &isi, &iso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_s(&isi, iso) && cmp_s(&isi, isr)); - if (!cmp_s(&isi, iso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_s(&isi); - fprintf(stdout, "got:\n"); - print_s(iso); - } - if (!cmp_s(&isi, isr)) { - fprintf(stdout, " result error, sent:\n"); - print_s(&isi); - fprintf(stdout, "got:\n"); - print_s(isr); - } - CORBA_free(iso); - CORBA_free(isr); - return -1; -} - -static int term_sequence_test(IC_Env *env) -{ - ETERM* et_array[4] = { - erl_format("[{apa, 1, 23}, \"string\", {1.23, 45}]"), - erl_format("[{banan, 1, 23}, \"string\", {1.23, 45}]"), - erl_format("[{apelsin, 1, 23}, \"string\", {1.23, 45}]"), - erl_format("[{mango, 1, 23}, \"string\", {1.23, 45}]")}; - m_etseq etsi = {4, 4, et_array}, *etso, *etsr; - - fprintf(stdout, "\n======== m_i_term_sequence test ======\n\n"); - etsr = m_i_term_sequence_test(NULL, &etsi, &etso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_etseq(&etsi, etso) && cmp_etseq(&etsi, etsr)); - if (!cmp_etseq(&etsi, etso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_etseq(&etsi); - fprintf(stdout, "got:\n"); - print_etseq(etso); - } - if (!cmp_etseq(&etsi, etsr)) { - fprintf(stdout, " result error, sent:\n"); - print_etseq(&etsi); - fprintf(stdout, "got:\n"); - print_etseq(etsr); - } - free_etseq_buf(&etsi); - free_etseq_buf(etso); - free_etseq_buf(etsr); - CORBA_free(etso); - CORBA_free(etsr); - return -1; -} - -static int term_struct_test(IC_Env *env) -{ - m_et eti = { erl_format("[{hej, 1, 23}, \"string\", {1.23, 45}]"), - 121212 }; - m_et eto, etr; - - fprintf(stdout, "\n======== m_i_term_struct test ======\n\n"); - etr = m_i_term_struct_test(NULL, &eti, &eto, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_et(&eti, &eto) && cmp_et(&eti, &etr)); - if (!cmp_et(&eti, &eto)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_et(&eti); - fprintf(stdout, "got:\n"); - print_et(&eto); - } - if (!cmp_et(&eti, &etr)) { - fprintf(stdout, " result error, sent:\n"); - print_et(&eti); - fprintf(stdout, "got:\n"); - print_et(&etr); - } - free_et(&eti); - free_et(&eto); - free_et(&etr); - return -1; -} - -static int wstring1_test(IC_Env *env) -{ - CORBA_wchar wsi[] = {100, 101, 102, 103, 104, 0}, *wso, *wsr; - - fprintf(stdout, "\n======== m_i_wstring1 test ======\n\n"); - wsr = m_i_wstring1_test(NULL, wsi, &wso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_wstr(wsi, wso) && cmp_wstr(wsi, wsr)); - if (!cmp_wstr(wsi, wso)) { - fprintf(stdout, " out parameter error, sent: \n"); - print_wstr(wsi); - fprintf(stdout, "got:\n"); - print_wstr(wso); - } - if (!cmp_wstr(wsi, wsr)) { - fprintf(stdout, " result error, sent: \n"); - print_wstr(wsi); - fprintf(stdout, "got:\n"); - print_wstr(wsr); - } - CORBA_free(wso); - CORBA_free(wsr); - return -1; -} - -/* Compare functions */ -static int cmp_aseq(m_aseq *a1, m_aseq *a2) -{ - int i; - - if (a1->_length != a2->_length) - return 0; - for (i = 0; i < a1->_length; i++) - if (cmp_a(&(a1->_buffer[i]), &(a2->_buffer[i])) == 0) - return 0; - return 1; -} - -static int cmp_a(m_a *a1, m_a *a2) -{ - return a1->l == a2->l && - a1->d == a2->d && - cmp_bseq(&a1->y, &a2->y); -} - -static int cmp_bseq(m_bseq *b1, m_bseq *b2) -{ - int i; - - if (b1->_length != b2->_length) - return 0; - for (i = 0; i < b1->_length; i++) - if (cmp_b(&(b1->_buffer[i]), &(b2->_buffer[i])) == 0) - return 0; - return 1; -} - -static int cmp_b(m_b *b1, m_b *b2) -{ - return b1->l == b2->l && b1->c == b2->c; -} - -static int cmp_lseq(m_lseq *b1, m_lseq *b2) -{ - int i; - - if (b1->_length != b2->_length) - return 0; - for (i = 0; i < b1->_length; i++) - if (b1->_buffer[i] != b2->_buffer[i]) - return 0; - return 1; -} - -static int cmp_etseq(m_etseq *b1, m_etseq *b2) -{ - int i; - - if (b1->_length != b2->_length) - return 0; - for (i = 0; i < b1->_length; i++) - if (!erl_match(b1->_buffer[i], b2->_buffer[i])) - return 0; - return 1; -} - -static int cmp_et(m_et* b1, m_et *b2) -{ - return erl_match(b1->e, b2->e) && b1->l == b2->l; -} - -static int cmp_es(m_es *b1, m_es *b2) -{ - return b1->f == b2->f && b1->l == b2->l; -} - -static int cmp_arr1(m_arr1 b1, m_arr1 b2) -{ - int i; - - for (i = 0; i < 500; i++) - if (b1[i] != b2[i]) - return 0; - return 1; -} - -static int cmp_dd(m_dd b1, m_dd b2) -{ - - int i, j; - - for (i = 0; i < 2; i++) - for (j = 0; j < 3; j++) - if (b1[i][j] != b2[i][j]) - return 0; - return 1; -} - - - -static int cmp_strRec(m_strRec *b1, m_strRec *b2) -{ - int i, j; - - if (b1->bb != b2->bb) - return 0; - if (!cmp_str(b1->str4,b2->str4)) - return 0; - if (b1->str5._length != b2->str5._length) - return 0; - for (j = 0; j < b1->str5._length; j++) - if (b1->str5._buffer[j] != b2->str5._buffer[j]) - return 0; - if (!cmp_str(b1->str6,b2->str6)) - return 0; - for (i = 0; i < 3; i++) - for (j = 0; j < 2; j++) - if (b1->str7[i][j] != b2->str7[i][j]) - return 0; - for (j = 0; j < 3; j++) - if (b1->str8[j] != b2->str8[j]) - return 0; - if (!cmp_str(b1->str9,b2->str9)) - return 0; - if (b1->str10._length != b2->str10._length) - return 0; - for (j = 0; j < b1->str10._length; j++) - if (b1->str10._buffer[j] != b2->str10._buffer[j]) - return 0; - return 1; -} - - -static int cmp_sseq(m_sseq *b1, m_sseq *b2) -{ - int i; - - if (b1->_length != b2->_length) - return 0; - for (i = 0; i < b1->_length; i++) - if (!cmp_str(b1->_buffer[i], b2->_buffer[i])) - return 0; - return 1; -} - - -static int cmp_pid(erlang_pid *p1, erlang_pid *p2) -{ - return cmp_str(p1->node,p2-> node) && - p1->num == p2->num && - p1->serial == p2->serial && - p1->creation == p2->creation; -} - -static int cmp_port(erlang_port *p1, erlang_port *p2) -{ - return cmp_str(p1->node,p2-> node) && p1->id == p2->id; -} - -static int cmp_ref(erlang_ref *p1, erlang_ref *p2) -{ - return cmp_str(p1->node, p2->node) && - p1->len == p2->len && - (p1->len < 1 || p1->n[0] == p2->n[0]) && - (p1->len < 2 || p1->n[1] == p2->n[1]) && - (p1->len < 3 || p1->n[2] == p2->n[2]); -} - -static int cmp_s(m_s *b1, m_s *b2) -{ - int i; - - if (b1->l != b2->l) - return 0; - if (b1->sl._length != b2->sl._length) - return 0; - for (i = 0; i < b1->sl._length; i++) - if (b1->sl._buffer[i] != b2->sl._buffer[i]) - return 0; - return 1; -} - - -static int cmp_ssstr3(m_ssstr3 *b1, m_ssstr3 *b2) -{ - int i,j; - - if (b1->_length != b2->_length) - return 0; - for (i = 0; i < b1->_length; i++) { - if (b1->_buffer[i]._length != b2->_buffer[i]._length) - return 0; - for (j = 0; j < b1->_buffer[i]._length; j++) - if (!cmp_str(b1->_buffer[i]._buffer[j], - b2->_buffer[i]._buffer[j])) - return 0; - } - return 1; -} - - - -static int cmp_ssarr3(m_ssarr3 *b1, m_ssarr3 *b2) -{ - int i; - - if (b1->_length != b2->_length) - return 0; - for (i = 0; i < b1->_length; i++) { - if (!cmp_sarr3(&b1->_buffer[i], &b2->_buffer[i])) - return 0; - } - return 1; -} - -static int cmp_sarr3(m_sarr3 *b1, m_sarr3 *b2) -{ - int i; - - if (b1->_length != b2->_length) - return 0; - for (i = 0; i < b1->_length; i++) { - if (!cmp_arr3(b1->_buffer[i], b2->_buffer[i])) - return 0; - } - return 1; -} - -static int cmp_arr3(m_arr3 b1, m_arr3 b2) -{ - int i; - - for (i = 0; i < sizeof(m_arr3)/sizeof(CORBA_long); i++) { - if (b1[i] != b2[i]) - return 0; - } - return 1; -} - -/* Print functions */ -static void print_aseq(m_aseq *a) -{ - int i; - fprintf(stdout, "\nm_aseq size: %ld --------\n", a->_length); - for (i = 0; i < a->_length; i++) - print_a(&(a->_buffer[i])); -} - -static void print_a(m_a *a) -{ - fprintf(stdout, "\nm_a --------\n l: %ld\n d:%f\n", a->l, a->d); - print_bseq(&a->y); -} - -static void print_bseq(m_bseq *b) -{ - int i; - - fprintf(stdout, "\nm_bseq size: %ld --------\n",b->_length); - for (i = 0; i < b->_length; i++) - print_b(&(b->_buffer[i])); -} - -static void print_lseq(m_lseq *b) -{ - int i; - - fprintf(stdout, "\nm_lseq size: %ld --------\n",b->_length); - for (i = 0; i < b->_length; i++) - fprintf(stdout, "[%d]: %ld\n", i, b->_buffer[i]); -} - -static void print_b(m_b *b) -{ - fprintf(stdout, "\nm_b --------\n l: %ld\n c: %c\n", b->l, b->c); -} - - -static void print_etseq(m_etseq *b) -{ - int i; - - for (i = 0; i < b->_length; i++) { - fprintf(stdout, "[%d]:\n", i); - erl_print_term(stdout, b->_buffer[i]); - } -} - - -static void print_et(m_et* b) -{ - fprintf(stdout, "\net struct --------\n"); - erl_print_term(stdout, b->e); - fprintf(stdout, "long: %ld\n", b->l); - fprintf(stdout, "\n--------\n"); -} - -static void print_es(m_es *b) -{ - fprintf(stdout, "\nm_es --------\n f: %d\n l: %ld\n", b->f, b->l); -} - - -static void print_arr1(long a[10]) -{ - int i; - - for (i = 0; i < 10; i++) - fprintf(stdout, "\n[%d]: %ld\n", i, a[i]); -} - -static void print_dd(long a[2][3]) -{ - int i, j; - - fprintf(stdout, "\nlong dd[2][3] --------\n"); - for (i = 0; i < 2; i++) - for (j = 0; j < 3; j++) - fprintf(stdout, "\n[%d][%d]: %ld\n", i, j, a[i][j]); -} - - -static void print_strRec(m_strRec* sr) -{ - int i, j; - - fprintf(stdout, "\nboolean bb : %d\n",sr->bb); - fprintf(stdout, "string str4 : %s\n",sr->str4); - fprintf(stdout, "str7[2][3] :\n"); - for (i = 0; i < 3; i++) - for (j = 0; j < 2; j++) - fprintf(stdout, "str7[%d][%d]: %ld\n", i, j, sr->str7[i][j]); - fprintf(stdout, "str5._length : %ld\n",sr->str5._length); - for (j = 0; j < sr->str5._length; j++) - fprintf(stdout, "str5._buffer[%d]: %c\n", j, sr->str5._buffer[j]); - fprintf(stdout, "string str6 : %s\n",sr->str6); - fprintf(stdout, "str8 :\n"); - for (j = 0; j < 3; j++) - fprintf(stdout, "str8[%d]: %c\n", j, sr->str8[j]); - fprintf(stdout, "string str9 : %s\n",sr->str9); - fprintf(stdout, "str10._length : %ld\n",sr->str10._length); - for (j = 0; j < sr->str10._length; j++) - fprintf(stdout, "str10._buffer[%d]: %c\n", j, sr->str10._buffer[j]); -} - -static void print_sseq(m_sseq *b) -{ - int i; - - fprintf(stdout, "\nm_sseq size: %ld --------\n",b->_length); - for (i = 0; i < b->_length; i++) - fprintf(stdout, "%s\n", b->_buffer[i]); - -} - - -static void print_pid(erlang_pid *p) -{ - fprintf(stdout, "\nerlang_pid --------\n node: %s\n num: %d\n " - "serial: %d\n creation: %d\n", - p->node, p->num, p->serial, p->creation); -} - -static void print_port(erlang_port *p) -{ - fprintf(stdout, "\nerlang_port --------\n node: %s\n id: %d\n " - "creation: %d\n", p->node, p->id, p->creation); -} - -static void print_ref(erlang_ref *p) -{ - fprintf(stdout, "\nerlang_ref --------\n node: %s\n len: %d\n " - "n[0]: %d\n n[1]: %d\n n[2]: %d\n creation: %d\n", - p->node, p->len, p->n[0], p->n[1], p->n[2], p->creation); -} - -static void print_term(ETERM *t) -{ - fprintf(stdout, "\nETERM --------\n"); - erl_print_term(stdout, t); - fprintf(stdout, "\n--------\n"); -} - -static void print_s(m_s *p) -{ - int i; - - fprintf(stdout, "\n%ld\n", p->l); - for (i = 0; i < p->sl._length; i++) - fprintf(stdout, "\n[%d]: %ld\n", i, p->sl._buffer[i]); -} - - -static void print_ssstr3(m_ssstr3 *b1) -{ - int i,j; - - fprintf(stdout, "\nSSSTR3 --------\n"); - fprintf(stdout,"b1->_length = %ld\n",b1->_length); - for (i = 0; i < b1->_length; i++) { - fprintf(stdout,"\nb1->_buffer[%d]._length %ld\n", - i, b1->_buffer[i]._length); - for (j = 0; j < b1->_buffer[i]._length; j++) - fprintf(stdout,"b1->_buffer[%d]._buffer[%d] = %s\n", - i, j, b1->_buffer[i]._buffer[j]); - } - fprintf(stdout, "\n--------\n"); -} - -static void print_wstr(CORBA_wchar *ws) -{ - int i = 0; - - fprintf(stdout, "\nwstr --------\n"); - while (ws[i]) { - fprintf(stdout, "[%d]: %ld\n", i, ws[i]); - i++; - } - fprintf(stdout, "\n--------\n"); -} - - -static void print_ssarr3(m_ssarr3 *b1) -{ - int i; - - fprintf(stdout, "\nssarr3 --------\n"); - fprintf(stdout,"length: %ld\n",b1->_length); - fprintf(stdout, "buffer:\n"); - for (i = 0; i < b1->_length; i++) - print_sarr3(&b1->_buffer[i]); - fprintf(stdout, "\n--------\n"); -} - -static void print_sarr3(m_sarr3 *b1) -{ - int i; - - fprintf(stdout, "\nsarr3 --------\n"); - fprintf(stdout,"length: %ld\n",b1->_length); - fprintf(stdout, "buffer:\n"); - for (i = 0; i < b1->_length; i++) - print_arr3(b1->_buffer[i]); - fprintf(stdout, "\n--------\n"); -} - -static void print_arr3(m_arr3 b1) -{ - int i; - - fprintf(stdout, "\narr3 --------\n"); - for (i = 0; i < sizeof(m_arr3)/sizeof(CORBA_long); i++) - fprintf(stdout, "%ld ", b1[i]); - fprintf(stdout, "\n--------\n"); -} - -static void free_etseq_buf(m_etseq *b) -{ - int i; - - for (i = 0; i < b->_length; i++) - erl_free_term(b->_buffer[i]); -} - -static void free_et(m_et* b) -{ - erl_free_term(b->e); -} - -static void showtime(MyTimeval *start, MyTimeval *stop) -{ - MyTimeval elapsed; - - elapsed.tv_sec = stop->tv_sec - start->tv_sec; - elapsed.tv_usec = stop->tv_usec - start->tv_usec; - while (elapsed.tv_usec < 0) { - elapsed.tv_sec -= 1; - elapsed.tv_usec += 1000000; - } - fprintf(stderr,"%ld.%06ld seconds\n",elapsed.tv_sec, elapsed.tv_usec); -} - -static void my_gettimeofday(MyTimeval *tv) -#ifdef __WIN32__ -#define EPOCH_JULIAN_DIFF 11644473600i64 -{ - SYSTEMTIME t; - FILETIME ft; - LONGLONG lft; - - GetSystemTime(&t); - SystemTimeToFileTime(&t, &ft); - memcpy(&lft, &ft, sizeof(lft)); - tv->tv_usec = (long) ((lft / 10i64) % 1000000i64); - tv->tv_sec = (long) ((lft / 10000000i64) - EPOCH_JULIAN_DIFF); -} -#elif defined VXWORKS -{ - int rate = sysClkRateGet(); /* Ticks per second */ - unsigned long ctick = tickGet(); - tv->tv_sec = ctick / rate; /* secs since reboot */ - tv->tv_usec = ((ctick - (tv->tv_sec * rate))*1000000)/rate; -} -#else -{ - gettimeofday(tv, NULL); -} -#endif diff --git a/lib/ic/test/c_client_erl_server_proto_SUITE_data/c_erl_test.idl b/lib/ic/test/c_client_erl_server_proto_SUITE_data/c_erl_test.idl deleted file mode 100644 index b6ba1583f3..0000000000 --- a/lib/ic/test/c_client_erl_server_proto_SUITE_data/c_erl_test.idl +++ /dev/null @@ -1,174 +0,0 @@ - -// %CopyrightBegin% -// -// Copyright Ericsson AB 2003-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -#include "erlang.idl" - - -const short TestConst = 1; - -module m { - - const short TestConst = 2; - - struct b { - long l; - char c; - }; - - struct simple { - long l; - b b_t; - }; - - enum fruit {orange, banana, apple, peach, pear}; - - typedef sequence lseq; - - typedef sequence bseq; - - struct a { - long l; - bseq y; - double d; - }; - - typedef sequence aseq; - - typedef sequence sseq; - typedef string str; - typedef long myLong; - - typedef long arr1[500], dd[2][3]; - - typedef erlang::term apa; - typedef erlang::port banan; - - typedef sequence etseq; - - struct s { - long l; - sequence sl; - }; - - struct es { - fruit f; - myLong l; - }; - - struct et { - erlang::term e; - long l; - }; - - - typedef sequence str1; - typedef string<12> str2; - typedef char str3[3]; - - typedef sequence sstr3; // sequence of string - typedef sequence ssstr3; // sequence of sequences of strings - - typedef long arr3[3]; // array of long - typedef sequence sarr3; // sequence of array - typedef sequence ssarr3; // sequence of sequnces of arrays of strings - - struct strRec{ - boolean bb; - string str4; - long str7[3][2]; - sequence str5; - string<12> str6; - str3 str8; - str2 str9; - str1 str10; - }; - - - struct dyn { - long l; - sequence sl; - }; - typedef dyn arr2[1][2]; - - - interface i { - - const short TestConst = 3; - - //arr2 suck(in arr2 x, out arr2 y ); - - ///////////////////////////////// attribute long l; - - // simple types - void void_test(); - long long_test(in long a, out long a1); - long long longlong_test(in long long a, out long long a1); - unsigned short ushort_test(in unsigned short a, out unsigned short a1); - unsigned long ulong_test(in unsigned long a, out unsigned long a1); - unsigned long long ulonglong_test(in unsigned long long a, out unsigned long long a1); - double double_test(in double a, out double a1); - char char_test(in char a, out char a1); - wchar wchar_test(in wchar a, out wchar a1); - octet octet_test(in octet a, out octet a1); - boolean bool_test(in boolean a, out boolean a1); - - // Seq. and struct tests - b struct_test(in b a, out b a1); - es struct2_test(in es a, out es a1); - //simple struct3_test(in simple x, out simple y); - bseq seq1_test(in bseq a, out bseq a1); - aseq seq2_test(in aseq a, out aseq a1); - lseq seq3_test(in lseq a, out lseq a1); - ssstr3 seq4_test(in ssstr3 a, out ssstr3 a1); - ssarr3 seq5_test(in ssarr3 a, out ssarr3 a1); - - // Array tests - arr1 array1_test(in arr1 a, out arr1 a1); - dd array2_test(in dd a, out dd a1); - - // enum test - fruit enum_test(in fruit a, out fruit a1); - - // string tests - string string1_test(in string a, out string a1); - wstring wstring1_test(in wstring a, out wstring a1); - sseq string2_test(in sseq a, out sseq a1); - str string3_test(in str a, out str a1); - strRec string4_test(in strRec a, out strRec a1); - - // Special erlang types - erlang::pid pid_test(in erlang::pid a, out erlang::pid a1); - erlang::port port_test(in erlang::port a, out erlang::port a1); - erlang::ref ref_test(in erlang::ref a, out erlang::ref a1); - erlang::term term_test(in erlang::term a, out erlang::term a1); - - // typedef test - long typedef_test(in apa a, in banan b, out apa a1, out banan b1); - - // inlined seq. test - s inline_sequence_test(in s a, out s a1); - - // term seq. test - etseq term_sequence_test(in etseq a, out etseq a1); - // term struct test - et term_struct_test(in et a, out et a1); - - }; - -}; diff --git a/lib/ic/test/c_client_erl_server_proto_SUITE_data/erl_server.erl b/lib/ic/test/c_client_erl_server_proto_SUITE_data/erl_server.erl deleted file mode 100644 index 2fe1dc2f79..0000000000 --- a/lib/ic/test/c_client_erl_server_proto_SUITE_data/erl_server.erl +++ /dev/null @@ -1,29 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2003-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(erl_server). - --export([run/0, stop/0]). - -run() -> - m_i:oe_create(). - -stop() -> - gen_server:cast(cidl_test, stop). diff --git a/lib/ic/test/c_client_erl_server_proto_SUITE_data/m_i_impl.erl b/lib/ic/test/c_client_erl_server_proto_SUITE_data/m_i_impl.erl deleted file mode 100644 index 92420eaeb4..0000000000 --- a/lib/ic/test/c_client_erl_server_proto_SUITE_data/m_i_impl.erl +++ /dev/null @@ -1,162 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2003-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(m_i_impl). --include("m.hrl"). - --export([init/1, terminate/2, void_test/1, long_test/2, ushort_test/2, - longlong_test/2, ulong_test/2, ulonglong_test/2, - double_test/2, char_test/2, wchar_test/2, octet_test/2, - bool_test/2, struct_test/2, struct2_test/2, seq1_test/2, - seq2_test/2, seq3_test/2, seq4_test/2, seq5_test/2, - array1_test/2, array2_test/2, enum_test/2, string1_test/2, - string2_test/2, string3_test/2, string4_test/2, pid_test/2, - port_test/2, ref_test/2, term_test/2, typedef_test/3, - inline_sequence_test/2, '_set_l'/2, '_get_l'/1, - term_struct_test/2, term_sequence_test/2, wstring1_test/2]). - --define(PRINTDEBUG(Case), - io:format("erl_server: case: ~p~n" - "erl_server: location: ~p~n", [Case, [?FILE, ?LINE]])). --define(PRINTDEBUG2(Case, Msg), - io:format("erl_server: case: ~p~n" - "erl_server: Msg: ~p~n" - "erl_server: location: ~p~n", [Case, Msg, [?FILE, ?LINE]])). - -init(Env) -> - {ok, []}. - -terminate(F, R) -> - ok. - -'_get_l'(State) -> - ?PRINTDEBUG("_get_l"), - {reply, State, State}. -void_test(State) -> - ?PRINTDEBUG("void_test"), - {reply, ok, State}. - -'_set_l'(State, V) -> - ?PRINTDEBUG2("_set_l", V), - {reply, ok, V}. -ushort_test(State, V) -> - ?PRINTDEBUG2("ushort_test", V), - {reply, {V, V}, State}. -long_test(State, V) -> - ?PRINTDEBUG2("long_test", V), - {reply, {V, V}, State}. -longlong_test(State, V) -> - ?PRINTDEBUG2("longlong_test", V), - {reply, {V, V}, State}. -ulong_test(State, V) -> - ?PRINTDEBUG2("ulong_test", V), - {reply, {V, V}, State}. -ulonglong_test(State, V) -> - ?PRINTDEBUG2("ulonglong_test", V), - {reply, {V, V}, State}. -double_test(State, V) -> - ?PRINTDEBUG2("double_test", V), - {reply, {V, V}, State}. -char_test(State, V) -> - ?PRINTDEBUG2("char_test", V), - {reply, {V, V}, State}. -wchar_test(State, V) -> - ?PRINTDEBUG2("wchar_test", V), - {reply, {V, V}, State}. -octet_test(State, V) -> - ?PRINTDEBUG2("octet_test", V), - {reply, {V, V}, State}. -bool_test(State, V) -> - ?PRINTDEBUG2("bool_test", V), - {reply, {V, V}, State}. - -struct_test(State, V) -> - ?PRINTDEBUG2("struct_test", V), - {reply, {V, V}, State}. -struct2_test(State, V) -> - ?PRINTDEBUG2("struct2_test", V), - {reply, {V, V}, State}. -seq1_test(State, V) -> - ?PRINTDEBUG2("seq1_test", V), - {reply, {V, V}, State}. -seq2_test(State, V) -> - ?PRINTDEBUG2("seq2_test", V), - {reply, {V, V}, State}. -seq3_test(State, V) -> - ?PRINTDEBUG2("seq3_test", V), - {reply, {V, V}, State}. -seq4_test(State, V) -> - ?PRINTDEBUG2("seq4_test", V), - {reply, {V, V}, State}. -seq5_test(State, V) -> - ?PRINTDEBUG2("seq5_test", V), - {reply, {V, V}, State}. -array1_test(State, V) -> - ?PRINTDEBUG2("array1_test", V), - {reply, {V, V}, State}. -array2_test(State, V) -> - ?PRINTDEBUG2("array2_test", V), - {reply, {V, V}, State}. -enum_test(State, V) -> - ?PRINTDEBUG2("enum_test", V), - {reply, {V, V}, State}. -string1_test(State, V) -> - ?PRINTDEBUG2("string1_test", V), - {reply, {V, V}, State}. -string2_test(State, V) -> - ?PRINTDEBUG2("string2_test", V), - {reply, {V, V}, State}. -string3_test(State, V) -> - ?PRINTDEBUG2("string3_test", V), - {reply, {V, V}, State}. -string4_test(State, V) -> - ?PRINTDEBUG2("string4_test", V), - {reply, {V, V}, State}. -pid_test(State, V) -> - ?PRINTDEBUG2("pid_test", V), - {reply, {V, V}, State}. -port_test(State, V) -> - ?PRINTDEBUG2("port_test", binary_to_list(term_to_binary(V))), - {reply, {V, V}, State}. -ref_test(State, V) -> - ?PRINTDEBUG2("ref_test", binary_to_list(term_to_binary(V))), - {reply, {V, V}, State}. -term_test(State, V) -> - ?PRINTDEBUG2("term_test", V), - {reply, {V, V}, State}. -typedef_test(State, A, B) -> - ?PRINTDEBUG2("typedef_test", [A,B]), - {reply, {4711, A, B}, State}. -inline_sequence_test(State, V) -> - ?PRINTDEBUG2("inline_sequence_test", V), - {reply, {V, V}, State}. -term_sequence_test(State, V) -> - ?PRINTDEBUG2("term_sequence_test", V), - {reply, {V, V}, State}. -term_struct_test(State, V) -> - ?PRINTDEBUG2("term_struct_test", V), - {reply, {V, V}, State}. -wstring1_test(State, V) -> - ?PRINTDEBUG2("wstring1_test", V), - {reply, {V, V}, State}. - - - - diff --git a/lib/ic/test/c_client_erl_server_proto_SUITE_data/my.c b/lib/ic/test/c_client_erl_server_proto_SUITE_data/my.c deleted file mode 100644 index 46920ce05f..0000000000 --- a/lib/ic/test/c_client_erl_server_proto_SUITE_data/my.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2004-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ - -#include "ic.h" -#include "m_i.h" - -int my_prepare_notification_encoding(CORBA_Environment *env) -{ - return oe_prepare_notification_encoding(env); -} - -int my_send_notification(CORBA_Environment *env) -{ - return oe_send_notification(env); -} - -int my_prepare_request_encoding(CORBA_Environment *env) -{ - return oe_prepare_request_encoding(env); -} - -int my_send_request_and_receive_reply(CORBA_Environment *env) -{ - return oe_send_request_and_receive_reply(env); -} - -int my_prepare_reply_decoding(CORBA_Environment *env) -{ - return oe_prepare_reply_decoding(env); -} - - - diff --git a/lib/ic/test/c_client_erl_server_proto_tmo_SUITE.erl b/lib/ic/test/c_client_erl_server_proto_tmo_SUITE.erl deleted file mode 100644 index 334db7c1da..0000000000 --- a/lib/ic/test/c_client_erl_server_proto_tmo_SUITE.erl +++ /dev/null @@ -1,265 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - -%%---------------------------------------------------------------------- -%% Purpose : Test suite for c-client/erl-server -%%---------------------------------------------------------------------- - --module(c_client_erl_server_proto_tmo_SUITE). --include_lib("common_test/include/ct.hrl"). - --export([init_per_testcase/2, end_per_testcase/2, - all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2, - void_test/1, long_test/1, long_long_test/1, - unsigned_short_test/1, unsigned_long_test/1, - unsigned_long_long_test/1, double_test/1, char_test/1, - wchar_test/1, octet_test/1, bool_test/1, struct_test/1, - struct2_test/1, seq1_test/1, seq2_test/1, seq3_test/1, - seq4_test/1, seq5_test/1, array1_test/1, array2_test/1, - enum_test/1, string1_test/1, string2_test/1, string3_test/1, - string4_test/1, pid_test/1, port_test/1, ref_test/1, term_test/1, - typedef_test/1, inline_sequence_test/1, term_sequence_test/1, - term_struct_test/1, wstring1_test/1]). - --define(DEFAULT_TIMEOUT, 20000). --define(PORT_TIMEOUT, 15000). --define(ERLANG_SERVER_NAME, idl_erlang_server). --define(C_CLIENT_NODE_NAME, c_client_idl_test). - -%% Add/remove code path and watchdog before/after each test case. -%% -init_per_testcase(_Case, Config) -> - DataDir = proplists:get_value(data_dir, Config), - code:add_patha(DataDir), - - %% Since other test suites use the module m_i, we have - %% to make sure we are using the right m_i module. - code:purge(m_i), - code:load_file(m_i), - - WatchDog = test_server:timetrap(?DEFAULT_TIMEOUT), - [{watchdog, WatchDog}| Config]. - -end_per_testcase(_Case, Config) -> - DataDir = proplists:get_value(data_dir, Config), - code:del_path(DataDir), - WatchDog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(WatchDog). - -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - [void_test, long_test, long_long_test, - unsigned_short_test, unsigned_long_test, - unsigned_long_long_test, double_test, char_test, - wchar_test, octet_test, bool_test, struct_test, - struct2_test, seq1_test, seq2_test, seq3_test, - seq4_test, seq5_test, array1_test, array2_test, - enum_test, string1_test, string2_test, string3_test, - string4_test, pid_test, port_test, ref_test, term_test, - typedef_test, inline_sequence_test, term_sequence_test, - term_struct_test, wstring1_test]. - -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - -array1_test(Config) -> - do_test(array1_test, Config). - -array2_test(Config) -> - do_test(array2_test, Config). - -bool_test(Config) -> - do_test(bool_test, Config). - -char_test(Config) -> - do_test(char_test, Config). - -double_test(Config) -> - do_test(double_test, Config). - -enum_test(Config) -> - do_test(enum_test, Config). - -inline_sequence_test(Config) -> - do_test(inline_sequence_test, Config). - -long_long_test(Config) -> - do_test(long_long_test, Config). - -long_test(Config) -> - do_test(long_test, Config). - -octet_test(Config) -> - do_test(octet_test, Config). - -pid_test(Config) -> - do_test(pid_test, Config). - -port_test(Config) -> - do_test(port_test, Config). - -ref_test(Config) -> - do_test(ref_test, Config). - -seq1_test(Config) -> - do_test(seq1_test, Config). - -seq2_test(Config) -> - do_test(seq2_test, Config). - -seq3_test(Config) -> - do_test(seq3_test, Config). - -seq4_test(Config) -> - do_test(seq4_test, Config). - -seq5_test(Config) -> - do_test(seq5_test, Config). - -string1_test(Config) -> - do_test(string1_test, Config). - -string2_test(Config) -> - do_test(string2_test, Config). - -string3_test(Config) -> - do_test(string3_test, Config). - -string4_test(Config) -> - do_test(string4_test, Config). - -struct2_test(Config) -> - do_test(struct2_test, Config). - -struct_test(Config) -> - do_test(struct_test, Config). - -term_sequence_test(Config) -> - do_test(term_sequence_test, Config). - -term_struct_test(Config) -> - do_test(term_struct_test, Config). - -term_test(Config) -> - do_test(term_test, Config). - -typedef_test(Config) -> - do_test(typedef_test, Config). - -unsigned_long_long_test(Config) -> - do_test(unsigned_long_long_test, Config). - -unsigned_long_test(Config) -> - do_test(unsigned_long_test, Config). - -unsigned_short_test(Config) -> - do_test(unsigned_short_test, Config). - -void_test(Config) -> - do_test(void_test, Config). - -wchar_test(Config) -> - do_test(wchar_test, Config). - -wstring1_test(Config) -> - do_test(wstring1_test, Config). - - -%% It is here that all tests really are done. -%% - -do_test(Case, Config) -> - %% Trap exits - process_flag(trap_exit, true), - %% Start the server - {ok, _Pid} = m_i:oe_create_link([], {local, ?ERLANG_SERVER_NAME}), - Node = atom_to_list(node()), - %% [NodeName, HostName] = string:tokens(Node, "@"), - DataDir = proplists:get_value(data_dir, Config), - %% io:format("~p: data directory: ~p~n", [?MODULE, DataDir]), - Cookie = atom_to_list(erlang:get_cookie()), - %% Start C-client node as a port program. - Cmd = filename:join([DataDir, "c_client"]) ++ - " -this-node-name " ++ atom_to_list(?C_CLIENT_NODE_NAME) ++ - " -peer-node " ++ Node ++ - " -peer-process-name " ++ atom_to_list(?ERLANG_SERVER_NAME) ++ - " -cookie " ++ Cookie ++ - " -test-case " ++ atom_to_list(Case), - Port = open_port({spawn, Cmd}, [exit_status, eof, stderr_to_stdout]), - Res = wait_for_completion(Port), - %% Kill off node if there was timeout - case Res of - {error, timeout} -> - catch rpc:cast(?C_CLIENT_NODE_NAME, erlang, halt, [1]); - _ -> - ok - end, - process_flag(trap_exit, false), - catch m_i:stop(?ERLANG_SERVER_NAME), - ok = Res. - - -%% Wait for eof *and* exit status, but return if exit status indicates -%% an error, or we have been waiting more than PORT_TIMEOUT seconds. -%% -wait_for_completion(Port) -> - wait_for_completion(Port, 0). - -wait_for_completion(Port, N) when N < 2 -> - receive - {Port, {data, Bytes}} -> - %% Relay output - io:format("~s", [Bytes]), - wait_for_completion(Port, N); - {Port, {exit_status, 0}} -> - wait_for_completion(Port, N + 1); - {Port, {exit_status, Status}} -> - {error, Status}; - {Port, eof} -> - wait_for_completion(Port, N + 1); - {'EXIT', Port, Reason} -> - io:format("Port exited with reason: ~w~n", [Reason]), - wait_for_completion(Port, N); - {'EXIT', From, Reason} -> - io:format("Got unexpected exit: ~p~n", [{'EXIT', From, Reason}]), - wait_for_completion(Port, N) - after ?PORT_TIMEOUT -> - {error, timeout} - end; -wait_for_completion(_, _) -> - ok. - - - diff --git a/lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/Makefile.src b/lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/Makefile.src deleted file mode 100644 index 6d6bd9baab..0000000000 --- a/lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/Makefile.src +++ /dev/null @@ -1,155 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2004-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -# Makefile.src for c_client_erl_server test -# Note: This file *must* work for both Unix and Windows -# -# We use both `rm' (Unix) and `del' (Windows) for removing files, but -# with a `-' in front so that the error in not finding `rm' (`del') on -# Windows (Unix) is ignored. -# -# VxWorks? XXX -# - -.SUFFIXES: -.SUFFIXES: .c .h .erl .idl @obj@ .@EMULATOR@ - - -# Variables from ts: -# - -ERL_INCLUDE = @erl_include@ - -IC_INCLUDE_PATH = @ic_include_path@ -IC_LIB = @ic_lib@ - -ERL_INTERFACE_INCLUDE = @erl_interface_include@ -ERL_INTERFACE_LIB = @erl_interface_lib@ -ERL_INTERFACE_EILIB = @erl_interface_eilib@ -ERL_INTERFACE_THREADLIB = @erl_interface_threadlib@ -ERL_INTERFACE_SOCK_LIBS = @erl_interface_sock_libs@ - -CC = @CC@ -## XXX Should set warning flag with a DEBUG_FLAG -CFLAGS = @CFLAGS@ @DEFS@ -I@erl_include@ \ - -I@ic_include_path@ -I@erl_interface_include@ - -LD = @LD@ -LDFLAGS = @CROSSLDFLAGS@ -LIBS = $(IC_LIB) $(ERL_INTERFACE_LIB) $(ERL_INTERFACE_EILIB) \ - $(ERL_INTERFACE_THREADLIB) @LIBS@ $(ERL_INTERFACE_SOCK_LIBS) -ERLC = erlc - -# Generated C header files -GEN_H_FILES = \ - m.h \ - m_i.h \ - oe_c_erl_test.h - -# Generated C files -GEN_C_FILES = \ - m.c \ - m_i.c \ - oe_c_erl_test.c \ - oe_code_m_a.c \ - oe_code_m_arr1.c \ - oe_code_m_arr2.c \ - oe_code_m_arr3.c \ - oe_code_m_aseq.c \ - oe_code_m_b.c \ - oe_code_m_bseq.c \ - oe_code_m_dd.c \ - oe_code_m_dyn.c \ - oe_code_m_dyn_sl.c \ - oe_code_m_es.c \ - oe_code_m_et.c \ - oe_code_m_etseq.c \ - oe_code_m_fruit.c \ - oe_code_m_lseq.c \ - oe_code_m_s.c \ - oe_code_m_s_sl.c \ - oe_code_m_sarr3.c \ - oe_code_m_simple.c \ - oe_code_m_ssarr3.c \ - oe_code_m_sseq.c \ - oe_code_m_ssstr3.c \ - oe_code_m_sstr3.c \ - oe_code_m_str1.c \ - oe_code_m_str3.c \ - oe_code_m_strRec.c \ - oe_code_m_strRec_str5.c \ - oe_code_m_strRec_str7.c - -GEN_HRL_FILES = \ - m.hrl \ - m_i.hrl \ - oe_c_erl_test.hrl - -GEN_ERL_FILES = \ - m.erl \ - m_arr2.erl \ - m_arr3.erl \ - m_i.erl \ - m_str3.erl \ - oe_c_erl_test.erl - -C_FILES = $(GEN_C_FILES) c_client.c my.c - -OBJS = $(C_FILES:.c=@obj@) - -PGMS = c_client@exe@ - -ERL_FILES = $(GEN_ERL_FILES) m_i_impl.erl - -EBINS = $(ERL_FILES:.erl=.@EMULATOR@) - - -all: $(PGMS) $(EBINS) - -$(GEN_ERL_FILES) $(GEN_HRL_FILES): c_erl_test.built_erl -$(GEN_C_FILES) $(GEN_H_FILES): c_erl_test.built_c -$(OBJS): $(GEN_C_FILES) $(GEN_H_FILES) -$(EBINS): $(GEN_ERL_FILES) $(GEN_HRL_FILES) - -clean: - -rm -f $(OBJS) $(GEN_C_FILES) $(GEN_H_FILES) $(PGMS) \ - $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) \ - c_erl_test.built_erl c_erl_test.built_c - -del /F /Q $(OBJS) $(GEN_C_FILES) $(GEN_H_FILES) $(PGMS) \ - $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) \ - c_erl_test.built_erl c_erl_test.built_c - -$(PGMS): $(OBJS) - $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) - -c_erl_test.built_c: c_erl_test.idl - $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,c_client}" c_erl_test.idl - echo done > c_erl_test.built_c - -c_erl_test.built_erl: c_erl_test.idl - $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,erl_genserv}" c_erl_test.idl - echo done > c_erl_test.built_erl - -.c@obj@: - $(CC) -c -o $*@obj@ $(CFLAGS) $< - -.erl.@EMULATOR@: - $(ERLC) -I $(IC_INCLUDE_PATH) $< - diff --git a/lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/c_client.c b/lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/c_client.c deleted file mode 100644 index 17ef21f4f4..0000000000 --- a/lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/c_client.c +++ /dev/null @@ -1,1764 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2004-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -/* C-client for test of IC. - * - * TODO: - * - * 1. XXX #includes for VxWorks, Windows - */ - -#include -#include - -#ifndef __WIN32__ -# include -#endif - -#include - -#ifdef __WIN32__ -# include -# include -#elif defined VXWORKS -#include -#include -#else -#include -#endif - -#include - -#ifdef __WIN32__ -# include -# include -#else -# include -# include -# include -# include -# include -#endif - -#include "ei.h" -#include "erl_interface.h" -#include "m_i.h" - -#define HOSTNAMESZ 255 -#define NODENAMESZ 512 - -#define INBUFSZ 10 -#define OUTBUFSZ 0 - -#define MAXTRIES 5 - -#define CHECK_EXCEPTION(x) \ - if ((x)->_major != CORBA_NO_EXCEPTION) { \ - fprintf(stderr,"\n\nException: %s\n\n", \ - (char *)CORBA_exception_value((x))); \ - CORBA_exception_free((x)); \ - return -1; \ - } \ - -/* XXX Should free things here too! */ -#define RETURN_IF_OK(x) \ - if ((x)) {\ - fprintf(stdout, "ok\n");\ - return 0;\ - }\ - -#define cmp_str(x,y) (!strcmp((x),(y))) -#define cmp_wstr(x,y) (!ic_wstrcmp((x),(y))) - -typedef CORBA_Environment IC_Env; - -typedef int (*TestFunc)(IC_Env *); -typedef struct { - char *name; - TestFunc func; -} TestCase; - -static char longtext[] = -"Introduction The IC application is an IDL compiler implemented in Erlang." -" The IDL compiler generates client stubs and server skeletons." -" Several back-ends are supported, and they fall into three main groups." -" For more details on IC compiler options consult the ic(3) manual page." -" Argument passing cases 1 Caller allocates all necessary storage," -" except that which may be encapsulated and managed within the parameter itself." -" 2 The caller allocates a pointer and passes it by reference to the callee." -" The callee sets the pointer to point to a valid instance of the parameter's type." -" The caller is responsible for releasing the returned storage." -" Following completion of a request, the caller is not allowed to modify any values" -" in the returned storage. To do so the caller must first copy the returned instance" -" into a new instance, then modify the new instance. 3 The caller allocates a" -" pointer to an array slice which has all the same dimensions of the original" -" array except the first, and passes it by reference to the callee. The callee sets" -" the pointer to point to a valid instance of the array. The caller is responsible for" -" releasing the returned storage. Following completion of a request, the caller is not" -" allowed to modify any values in the returned storage. To do so the caller must first" -" copy the returned instance into a new instance, then modify the new instance." -" Generated Files Two files will be generated for each scope. One set of files will be" -" generated for each module and each interface scope. An extra set is generated for" -" those definitions at top level scope. One of the files is a header file(.h), and the" -" other file is a C source code file (.c). In addition to these files a number of C" -" source files will be generated for type encodings, they are named according to the " -"following template: oe_code_.c."; -static char this_node[NODENAMESZ + 1]; -static char *progname; - -/* Test function prototypes */ - -static int void_test(IC_Env *env); -static int long_test(IC_Env *env); -static int long_long_test(IC_Env *env); -static int unsigned_short_test(IC_Env *env); -static int unsigned_long_test(IC_Env *env); -static int unsigned_long_long_test(IC_Env *env); -static int double_test(IC_Env *env); -static int char_test(IC_Env *env); -static int wchar_test(IC_Env *env); -static int octet_test(IC_Env *env); -static int bool_test(IC_Env *env); -static int struct_test(IC_Env *env); -static int struct2_test(IC_Env *env); -static int seq1_test(IC_Env *env); -static int seq2_test(IC_Env *env); -static int seq3_test(IC_Env *env); -static int seq4_test(IC_Env *env); -static int seq5_test(IC_Env *env); -static int array1_test(IC_Env *env); -static int array2_test(IC_Env *env); -static int enum_test(IC_Env *env); -static int string1_test(IC_Env *env); -static int string2_test(IC_Env *env); -static int string3_test(IC_Env *env); -static int string4_test(IC_Env *env); -static int pid_test(IC_Env *env); -static int port_test(IC_Env *env); -static int ref_test(IC_Env *env); -static int term_test(IC_Env *env); -static int typedef_test(IC_Env *env); -static int inline_sequence_test(IC_Env *env); -static int term_sequence_test(IC_Env *env); -static int term_struct_test(IC_Env *env); -static int wstring1_test(IC_Env *env); - -static TestCase test_cases[] = { - {"void_test", void_test}, - {"long_test", long_test}, - {"long_long_test", long_long_test}, - {"unsigned_short_test", unsigned_short_test}, - {"unsigned_long_test", unsigned_long_test}, - {"unsigned_long_long_test", unsigned_long_long_test}, - {"double_test", double_test}, - {"char_test", char_test}, - {"wchar_test", wchar_test}, - {"octet_test", octet_test}, - {"bool_test", bool_test}, - {"struct_test", struct_test}, - {"struct2_test", struct2_test}, - {"seq1_test", seq1_test}, - {"seq2_test", seq2_test}, - {"seq3_test", seq3_test}, - {"seq4_test", seq4_test}, - {"seq5_test", seq5_test}, - {"array1_test", array1_test}, - {"array2_test", array2_test}, - {"enum_test", enum_test}, - {"string1_test", string1_test}, - {"string2_test", string2_test}, - {"string3_test", string3_test}, - {"string4_test", string4_test}, - {"pid_test", pid_test}, - {"port_test", port_test}, - {"ref_test", ref_test}, - {"term_test", term_test}, - {"typedef_test", typedef_test}, - {"inline_sequence_test", inline_sequence_test}, - {"term_sequence_test", term_sequence_test}, - {"term_struct_test", term_struct_test}, - {"wstring1_test", wstring1_test}, - {"", NULL} -}; - -/* Other prototypes */ -static int cmp_aseq(m_aseq *a1, m_aseq *a2); -static int cmp_a(m_a *a1, m_a *a2); -static int cmp_bseq(m_bseq *b1, m_bseq *b2); -static int cmp_b(m_b *b1, m_b *b2); -static int cmp_lseq(m_lseq *b1, m_lseq *b2); -static int cmp_etseq(m_etseq *b1, m_etseq *b2); -static int cmp_et(m_et* b1, m_et *b2); -static int cmp_es(m_es *b1, m_es *b2); -static int cmp_arr1(m_arr1 b1, m_arr1 b2); -static int cmp_dd(m_dd b1, m_dd b2); -static int cmp_strRec(m_strRec *b1, m_strRec *b2); -static int cmp_sseq(m_sseq *b1, m_sseq *b2); -static int cmp_pid(erlang_pid *p1, erlang_pid *p2); -static int cmp_port(erlang_port *p1, erlang_port *p2); -static int cmp_ref(erlang_ref *p1, erlang_ref *p2); -static int cmp_s(m_s *b1, m_s *b2); -static int cmp_ssstr3(m_ssstr3 *b1, m_ssstr3 *b2); -static int cmp_ssarr3(m_ssarr3 *b1, m_ssarr3 *b2); -static int cmp_sarr3(m_sarr3 *b1, m_sarr3 *b2); -static int cmp_arr3(m_arr3 b1, m_arr3 b2); - -static void print_aseq(m_aseq *a); -static void print_a(m_a *a); -static void print_bseq(m_bseq *b); -static void print_lseq(m_lseq *b); -static void print_b(m_b *b); -static void print_etseq(m_etseq *b); -static void print_et(m_et* b); -static void print_es(m_es *b); -static void print_arr1(long a[500]); -static void print_dd(long a[2][3]); -static void print_strRec(m_strRec* sr); -static void print_sseq(m_sseq *b); -static void print_pid(erlang_pid *p); -static void print_port(erlang_port *p); -static void print_ref(erlang_ref *p); -static void print_term(ETERM *t); -static void print_s(m_s *p); -static void print_ssstr3(m_ssstr3 *b1); -static void print_ssarr3(m_ssarr3 *b1); -static void print_sarr3(m_sarr3 *b1); -static void print_arr3(m_arr3 b1); -static void print_wstr(CORBA_wchar *ws); - -static void free_etseq_buf(m_etseq *b); -static void free_et(m_et* b); - -#ifdef __WIN32__ -typedef struct { - long tv_sec; - long tv_usec; -} MyTimeval; -#else -typedef struct timeval MyTimeval; -#endif -static void my_gettimeofday(MyTimeval *tv); -static void showtime(MyTimeval *start, MyTimeval *stop); -static void usage(void); -static void done(int r); - - - -/* main */ - -#ifdef VXWORKS -int client(int argc, char **argv) -#else -int main(int argc, char **argv) -#endif -{ - struct hostent *hp; - erlang_pid pid; - MyTimeval start, stop; - int i, fd, ires, tres; - IC_Env *env; - int tries = 0; - char *this_node_name = NULL; - char *peer_node = NULL; - char *peer_process_name = NULL; - char *cookie = NULL; - char host[HOSTNAMESZ + 1]; - TestFunc test_func = NULL; - TestCase *test_case; - char *test_case_name = NULL; - -#ifdef __WIN32__ - WORD wVersionRequested; - WSADATA wsaData; - - wVersionRequested = MAKEWORD(2, 0); - - if (WSAStartup(wVersionRequested, &wsaData) != 0) { - fprintf(stderr, "Could not load winsock2 v2.0 compatible DLL"); - exit(1); - } -#endif - - progname = argv[0]; - host[HOSTNAMESZ] = '\0'; - if (gethostname(host, HOSTNAMESZ + 1) < 0) { - fprintf(stderr, "Can't find own hostname\n"); - done(1); - } - if ((hp = gethostbyname(host)) == 0) { - fprintf(stderr, "Can't get ip address for host %s\n", host); - done(1); - } - for (i = 1; i < argc; i++) { - if (cmp_str(argv[i], "-help")) { - usage(); - done(0); - } else if (cmp_str(argv[i], "-this-node-name")) { - i++; - this_node_name = argv[i]; - } else if (cmp_str(argv[i], "-peer-node")) { - i++; - peer_node = argv[i]; - } else if (cmp_str(argv[i], "-peer-process-name")) { - i++; - peer_process_name = argv[i]; - } else if (cmp_str(argv[i], "-cookie")) { - i++; - cookie = argv[i]; - } else if (cmp_str(argv[i], "-test-case")) { - i++; - test_case_name = argv[i]; - } else { - fprintf(stderr, "Error : invalid argument \"%s\"\n", argv[i]); - usage(); - done(1); - } - } - - if (this_node_name == NULL || peer_node == NULL || test_case_name == NULL - || peer_process_name == NULL || cookie == NULL) { - fprintf(stderr, "Error: missing option\n"); - usage(); - done(1); - } - - test_case = test_cases; - while (test_case->func) { - if (cmp_str(test_case->name, test_case_name)) { - test_func = test_case->func; - break; - } - test_case++; - } - if (test_func == NULL) { - fprintf(stderr, "Error: illegal test case: \"%s\"\n", test_case_name); - done(1); - } - - /* Behead hostname at first dot */ - for (i=0; host[i] != '\0'; i++) { - if (host[i] == '.') { host[i] = '\0'; break; } - } - sprintf(this_node, "%s@%s", this_node_name, host); - fprintf(stderr, "c_client: this node: \"%s\"\n", this_node); - fprintf(stderr, "c_client: peer node: \"%s\"\n", peer_node); - fprintf(stderr, "c_client: test case: \"%s\"\n", test_case_name); - - fprintf(stderr, "c_client: starting\n"); - - /* initialize erl_interface */ - erl_init(NULL, 0); - - for (tries = 0; tries < MAXTRIES; tries++) { - - /* connect to erlang node */ - - ires = erl_connect_xinit(host, this_node_name, this_node, - (struct in_addr *)*hp->h_addr_list, - cookie, 0); - - fprintf(stderr, "c_client: erl_connect_xinit(): %d\n", ires); - - fd = erl_connect(peer_node); - fprintf(stderr, "c_client: erl_connect(): %d\n", fd); - - if (fd >= 0) - break; - fprintf(stderr, "c_client: cannot connect, retrying\n"); - } - if (fd < 0) { - fprintf(stderr, "c_client: cannot connect, exiting\n"); - done(1); - } - env = CORBA_Environment_alloc(INBUFSZ, OUTBUFSZ); - env->_fd = fd; - strcpy(env->_regname, peer_process_name); - env->_to_pid = NULL; - env->_from_pid = &pid; - - strcpy(pid.node, this_node); - pid.num = fd; - pid.serial = 0; - pid.creation = 0; - - my_gettimeofday(&start); - tres = test_func(env); /* Call test case */ - my_gettimeofday(&stop); - showtime(&start, &stop); - erl_close_connection(fd); - - printf("c_client: env->_inbuf before : %d\n", INBUFSZ); - printf("c_client: env->_outbuf before : %d\n", OUTBUFSZ); - printf("c_client: env->_inbuf after : %d\n", env->_inbufsz); - printf("c_client: env->_outbuf after : %d\n", env->_outbufsz); - - CORBA_free(env->_inbuf); - CORBA_free(env->_outbuf); - CORBA_free(env); - done(tres); -} - -static void usage() -{ - fprintf(stderr, "Usage: %s [-help] -this-node-name " - "-peer-node -peer-process-name " - "-cookie -test-case \n", progname); - fprintf(stderr, "Example:\n %s -this-node-name kalle " - "-peer-node olle@home -peer-process-name idltest " - "-cookie oa678er -test-case octet_test\n", progname); -} - -static void done(int r) -{ -#ifdef __WIN32__ - WSACleanup(); -#endif - exit(r); -} - - -/* TESTS */ - -static int void_test(IC_Env *env) -{ - fprintf(stdout, "\n======== m_i_void test ======\n\n"); - m_i_void_test(NULL,env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(1); -} - -static int long_test(IC_Env *env) -{ - long l = 4711, lo, lr; - - fprintf(stdout, "\n======== m_i_long test ======\n\n"); - lr = m_i_long_test(NULL, l, &lo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(l == lo && l == lr); - if (l != lo) - fprintf(stdout, " out parameter error, sent: %ld, got: %ld\n", l, lo); - if (l != lr) - fprintf(stdout, " result error, sent: %ld, got: %ld\n", l, lr); - return -1; -} - -static int long_long_test(IC_Env *env) -{ - CORBA_long_long ll = 4711, llo, llr; - - fprintf(stdout, "\n======== m_i_longlong test ======\n\n"); - llr = m_i_longlong_test(NULL, ll, &llo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(ll == llo && ll == llr); - if (ll != llo) - fprintf(stdout, " out parameter error, sent: %ld, got: %ld\n", - ll, llo); - if (ll != llr) - fprintf(stdout, " result error, sent: %ld, got: %ld\n", ll, llr); - return -1; -} - -static int unsigned_short_test(IC_Env *env) -{ - unsigned short x, y = 2, z; - - fprintf(stdout, "\n======== m_i_ushort test ======\n\n"); - x = m_i_ushort_test(NULL, y, &z, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(y == z && y == x); - if (y != z) - fprintf(stdout, " out parameter error, sent: %d, got: %d\n", y, z); - if (y != x) - fprintf(stdout, " result error, sent: %d, got: %d\n", y, x); - return -1; -} - - -static int unsigned_long_test(IC_Env *env) -{ - unsigned long ul = 5050, ulo, ulr; - - fprintf(stdout, "\n======== m_i_ulong test ======\n\n"); - ulr = m_i_ulong_test(NULL, ul, &ulo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(ul == ulo && ul == ulr); - if (ul != ulo) - fprintf(stdout, " out parameter error, sent: %lu, got: %lu\n", - ul, ulo); - if (ul != ulr) - fprintf(stdout, " result error, sent: %lu, got: %lu\n", ul, ulr); - return -1; -} - -/* - * Note: CORBA_unsigned_long_long is in fact a plain long. - */ -static int unsigned_long_long_test(IC_Env *env) -{ - CORBA_unsigned_long_long ull = 5050, ullo, ullr; - - fprintf(stdout, "\n======== m_i_ulonglong test ======\n\n"); - ullr = m_i_ulonglong_test(NULL, ull, &ullo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(ull == ullo && ull == ullr); - if (ull != ullo) - fprintf(stdout, " out parameter error, sent: %lu, got: %lu\n", - ull, ullo); - if (ull != ullr) - fprintf(stdout, " result error, sent: %lu, got: %lu\n", - ull, ullr); - return -1; -} - -static int double_test(IC_Env *env) -{ - double d = 12.1212, db, dr; - - fprintf(stdout, "\n======== m_i_double test ======\n\n"); - dr = m_i_double_test(NULL, d, &db, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(d == db && d == dr); - if (d != db) - fprintf(stdout, " out parameter error, sent: %f, got: %f\n", d, db); - if (d != dr) - fprintf(stdout, " result error, sent: %f, got: %f\n", d, dr); - return -1; -} - -static int char_test(IC_Env *env) -{ - char c = 'g', co, cr; - - /* char test */ - fprintf(stdout, "\n======== m_i_char test ======\n\n"); - cr = m_i_char_test(NULL, c, &co, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(c == co && c == cr); - if (c !=co) - fprintf(stdout, " out parameter error, sent: %c, got: %c\n", c, co); - if (c != cr) - fprintf(stdout, " result error, sent: %c, got: %c\n", c, cr); - return -1; -} - -static int wchar_test(IC_Env *env) -{ - CORBA_wchar wc = 103, wco, wcr; - - fprintf(stdout, "\n======== m_i_wchar test ======\n\n"); - wcr = m_i_wchar_test(NULL, wc, &wco, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(wc == wco && wc == wcr); - if (wc != wco) - fprintf(stdout, " out parameter error, sent: %lu, got: %lu\n", - wc, wco); - if (wc != wcr) - fprintf(stdout, " result error, sent: %lu, got: %lu\n", - wc, wcr); - return -1; -} - -static int octet_test(IC_Env *env) -{ - char o ='r', oo, or; - - fprintf(stdout, "\n======== m_i_octet test ======\n\n"); - or = m_i_octet_test(NULL, o, &oo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(o == oo && o == or); - if (o != oo) - fprintf(stdout, " out parameter error, sent: %c, got: %c\n", o, oo); - if (o != or) - fprintf(stdout, " result error, sent: %c, got: %c\n", o, or); - return -1; -} - -static int bool_test(IC_Env *env) -{ - unsigned char i = 0, io, ir; - - fprintf(stdout, "\n======== m_i_bool test ======\n\n"); - ir = m_i_bool_test(NULL, i, &io, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(i == io && i == ir); - if (i != io) - fprintf(stdout, " out parameter error, sent: %d, got: %d\n", i, io); - if (i != ir) - fprintf(stdout, " result error, sent: %d, got: %d\n", i, ir); - return -1; -} - -static int struct_test(IC_Env *env) -{ - m_b b = {4711, 'a'}, bo, br; - - fprintf(stdout, "\n======== m_i_struct test ======\n\n"); - br = m_i_struct_test(NULL, &b, &bo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_b(&b, &bo) && cmp_b(&b, &br)); - if (!cmp_b(&b, &bo)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_b(&b); - fprintf(stdout, " got:\n"); - print_b(&bo); - fprintf(stdout, "\n"); - } - if (!cmp_b(&b, &br)) { - fprintf(stdout, " result error, sent:\n"); - print_b(&b); - fprintf(stdout, " got:\n"); - print_b(&br); - fprintf(stdout, "\n"); - } - return -1; -} - -static int struct2_test(IC_Env *env) -{ - m_es esi = {m_peach, 5050}, eso, esr; - - fprintf(stdout, "\n======== m_i_struct2 test ======\n\n"); - esr = m_i_struct2_test(NULL, &esi, &eso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_es(&esi, &eso) && cmp_es(&esi, &esr)); - if (!cmp_es(&esi, &eso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_es(&esi); - fprintf(stdout, " got:\n"); - print_es(&eso); - fprintf(stdout, "\n"); - } - if (!cmp_es(&esi, &esr)) { - fprintf(stdout, " result error, sent:\n"); - print_es(&esi); - fprintf(stdout, " got:\n"); - print_es(&esr); - fprintf(stdout, "\n"); - } - return -1; -} - - -static int seq1_test(IC_Env *env) -{ - m_bseq bs, *bso, *bsr; - - m_b ba[3] = {{4711, 'a'}, {4712, 'b'}, {4713, 'c'}}; - bs._length = 3; - bs._buffer = ba; - - fprintf(stdout, "\n======== m_i_seq1 test ======\n\n"); - bsr = m_i_seq1_test(NULL, &bs, &bso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_bseq(&bs, bso) && cmp_bseq(&bs, bsr)); - if (!cmp_bseq(&bs, bso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_bseq(&bs); - fprintf(stdout, " got:\n"); - print_bseq(bso); - fprintf(stdout, "\n"); - } - if (!cmp_bseq(&bs, bsr)) { - fprintf(stdout, " result error, sent:\n"); - print_bseq(&bs); - fprintf(stdout, " got:\n"); - print_bseq(bsr); - fprintf(stdout, "\n"); - } - CORBA_free(bso); - CORBA_free(bsr); - return -1; -} - -static int seq2_test(IC_Env *env) -{ - m_b ba[3] = {{4711, 'a'}, {4712, 'b'}, {4713, 'c'}}; - m_a a; - m_a aa[2]; - m_aseq as, *aso, *asr; - - a.l = 9999; - a.y._length = 3; - a.y._buffer = ba; - a.d = 66.89898989; - - aa[0] = a; - aa[1] = a; - as._length = 2; - as._buffer = aa; - - fprintf(stdout, "\n======== m_i_seq2 test ======\n\n"); - asr = m_i_seq2_test(NULL, &as, &aso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_aseq(&as, aso) && cmp_aseq(&as, asr)); - if (!cmp_aseq(&as, aso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_aseq(&as); - fprintf(stdout, " got:\n"); - print_aseq(aso); - fprintf(stdout, "\n"); - } - if (!cmp_aseq(&as, asr)) { - fprintf(stdout, " result error, sent:\n"); - print_aseq(&as); - fprintf(stdout, " got:\n"); - print_aseq(asr); - fprintf(stdout, "\n"); - } - CORBA_free(aso); - CORBA_free(asr); - return -1; -} - -static int seq3_test(IC_Env *env) -{ - m_lseq lsi, *lso, *lsr; - long al[500]; - int i=0; - - for (i = 0; i < 500; i++) - al[i]=i; - lsi._length = 500; - lsi._buffer = al; - - fprintf(stdout, "\n======== m_i_seq3 test ======\n\n"); - lsr = m_i_seq3_test(NULL, &lsi, &lso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_lseq(&lsi, lso) && cmp_lseq(&lsi, lsr)); - if (!cmp_lseq(&lsi, lso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_lseq(&lsi); - fprintf(stdout, " got:\n"); - print_lseq(lso); - fprintf(stdout, "\n"); - } - if (!cmp_lseq(&lsi, lsr)) { - fprintf(stdout, " result error, sent:\n"); - print_lseq(&lsi); - fprintf(stdout, " got:\n"); - print_lseq(lsr); - fprintf(stdout, "\n"); - } - CORBA_free(lso); - CORBA_free(lsr); - return -1; -} - -static int seq4_test(IC_Env *env) -{ - char *stra0[3] = {"a", "long", "time"}; - char *stra1[3] = {"ago", "there", "was"}; - char *stra2[3] = {"a", "buggy", "compiler"}; - m_sstr3 str3s[3] = {{3, 3, stra0}, {3, 3, stra1}, {3, 3, stra2}}; - m_ssstr3 str3ssi = {3, 3, str3s}; - m_ssstr3 *str3sso, *str3ssr; - - fprintf(stdout, "\n======== m_i_seq4 test ======\n\n"); - str3ssr = m_i_seq4_test(NULL, &str3ssi, &str3sso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_ssstr3(&str3ssi, str3sso) && - cmp_ssstr3(&str3ssi, str3ssr)); - if (!cmp_ssstr3(&str3ssi, str3sso)){ - fprintf(stdout, " out parameter error, sent:\n"); - print_ssstr3(&str3ssi); - fprintf(stdout, " got:\n"); - print_ssstr3(str3sso); - fprintf(stdout, "\n"); - } - if (!cmp_ssstr3(&str3ssi, str3ssr)) { - fprintf(stdout, " result error, sent:\n"); - print_ssstr3(&str3ssi); - fprintf(stdout, " got:\n"); - print_ssstr3(str3ssr); - fprintf(stdout, "\n"); - } - CORBA_free(str3sso); - CORBA_free(str3ssr); - return -1; -} - -static int seq5_test(IC_Env *env) -{ - m_arr3 arr3a[3] = { - {4711, 18931947, 3}, - {4711, 18931947, 3}, - {4711, 18931947, 3}}; - m_sarr3 arr3sa[3] = {{3, 3, arr3a}, {3, 3, arr3a}, {3, 3, arr3a}}; - m_ssarr3 arr3ssi = {3, 3, arr3sa}; - m_ssarr3 *arr3sso; - m_ssarr3 *arr3ssr; - - fprintf(stdout, "\n======== m_i_seq5 test ======\n\n"); - arr3ssr = m_i_seq5_test(NULL, &arr3ssi, &arr3sso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_ssarr3(&arr3ssi, arr3sso) && - cmp_ssarr3(&arr3ssi, arr3ssr)); - if (!cmp_ssarr3(&arr3ssi, arr3sso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_ssarr3(&arr3ssi); - fprintf(stdout, " got:\n"); - print_ssarr3(arr3sso); - fprintf(stdout, "\n"); - } - if (!cmp_ssarr3(&arr3ssi, arr3ssr)) { - fprintf(stdout, " result error, sent:\n"); - print_ssarr3(&arr3ssi); - fprintf(stdout, " got:\n"); - print_ssarr3(arr3ssr); - fprintf(stdout, "\n"); - } - CORBA_free(arr3sso); - CORBA_free(arr3ssr); - return -1; -} - -static int array1_test(IC_Env *env) -{ - int i; - long al[500]; - m_arr1 alo; - m_arr1_slice* alr; - - for (i = 0; i < 500; i++) - al[i]=i; - - fprintf(stdout, "\n======== m_i_array1 test ======\n\n"); - alr = m_i_array1_test(NULL, al, alo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_arr1(al, alo) && cmp_arr1(al, alr)); - if (!cmp_arr1(al, alo)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_arr1(al); - fprintf(stdout, " got:\n"); - print_arr1(alo); - fprintf(stdout, "\n"); - } - if (!cmp_arr1(al,alr)) { - fprintf(stdout, " result error, sent:\n"); - print_arr1(al); - fprintf(stdout, " got:\n"); - print_arr1(alr); - fprintf(stdout, "\n"); - } - free(alo); - free(alr); - return -1; -} - -static int array2_test(IC_Env *env) -{ - long dl[2][3] = {{11, 2, 7}, {22, 8 ,13}}; - m_dd dlo; - m_dd_slice* dlr; - - fprintf(stdout, "\n======== m_i_array2 test ======\n\n"); - dlr = m_i_array2_test(NULL, dl, dlo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_dd(dl,dlo) && cmp_dd(dl,dlr)); - if (!cmp_dd(dl,dlo)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_dd(dl); - fprintf(stdout, " got:\n"); - print_dd(dlo); - fprintf(stdout, "\n"); - } - if (!cmp_dd(dl,dlr)) { - fprintf(stdout, " result error, sent:\n"); - print_dd(dl); - fprintf(stdout, " got:\n"); - print_dd(dlr); - fprintf(stdout, "\n"); - } - free(*dlr); - return -1; -} - -static int enum_test(IC_Env *env) -{ - m_fruit ei = m_banana, eo, er; - - fprintf(stdout, "\n======== m_i_enum test ======\n\n"); - er = m_i_enum_test(NULL, ei, &eo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(ei == eo && ei == er); - if (ei != eo) - fprintf(stdout, " out parameter error, sent: %d, got: %d\n", ei, eo); - if (ei != er) - fprintf(stdout, " result error, sent: %d, got: %d\n", ei, er); - return -1; -} - -static int string1_test(IC_Env *env) -{ - char* si = longtext; - char* so; - char* sr; - - fprintf(stdout, "\n======== m_i_string1 test ======\n\n"); - sr = m_i_string1_test(NULL, si, &so, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_str(si, so) && cmp_str(si, sr)); - if (!cmp_str(si, so)) - fprintf(stdout, " out parameter error, sent: %s, got: %s\n", si, so); - if (!cmp_str(si, sr)) - fprintf(stdout, " result error, sent: %s, got: %s\n", si, sr); - CORBA_free(so); - CORBA_free(sr); - return -1; -} - -static int string2_test(IC_Env *env) -{ - char* sa[3] = {"hello", "foo", "bar"}; - m_sseq ssi = {3, 3, sa}; - m_sseq *sso, *ssr; - - fprintf(stdout, "\n======== m_i_string2 test ======\n\n"); - ssr = m_i_string2_test(NULL, &ssi, &sso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_sseq(&ssi, sso) && cmp_sseq(&ssi, sso)); - if (!cmp_sseq(&ssi, sso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_sseq(&ssi); - fprintf(stdout, "got:\n"); - print_sseq(sso); - } - if (!cmp_sseq(&ssi, ssr)) { - fprintf(stdout, " result error, sent:\n"); - print_sseq(&ssi); - fprintf(stdout, "got:\n"); - print_sseq(ssr); - } - CORBA_free(sso); - CORBA_free(ssr); - return -1; -} - -static int string3_test(IC_Env *env) -{ - char* si = longtext; - char* so; - char* sr; - - fprintf(stdout, "\n======== m_i_string3 test ======\n\n"); - sr = m_i_string3_test(NULL, si, &so, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_str(si, so) && cmp_str(si, so)); - if (!cmp_str(si, so)) - fprintf(stdout, " out parameter error, sent: %s, got: %s\n", si, so); - if (!cmp_str(si, sr)) - fprintf(stdout, " result error, sent: %s, got: %s\n", si, sr); - CORBA_free(so); - CORBA_free(sr); - return -1; -} - -static int string4_test(IC_Env *env) -{ - char as1[100] = "a string", as2[200] = "help", as3[200] = "hello there"; - m_strRec stri = { 1, /* dd */ - as1, /* str4 */ - {{'a', 'k'}, {'z', 'g'}, {'n', 'q'}}, /* str7 */ - {3, 3, "buf"}, /* str5 */ - as2, /* str6 */ - {'m', 'f', 'o'}, /* str8 */ - as3, /* str9 */ - {3, 3, "stu"} /* str10 */ - }; - m_strRec *stro, *strr; - - fprintf(stdout, "\n======== m_i_string4 test ======\n\n"); - strr = m_i_string4_test(NULL, &stri, &stro, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_strRec(&stri,stro) && cmp_strRec(&stri,strr)); - if (!cmp_strRec(&stri,stro)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_strRec(&stri); - fprintf(stdout, " got:\n"); - print_strRec(stro); - fprintf(stdout, "\n"); - } - if (!cmp_strRec(&stri,strr)) { - fprintf(stdout, " result error, sent:\n"); - print_strRec(&stri); - fprintf(stdout, " got:\n"); - print_strRec(strr); - fprintf(stdout, "\n"); - } - CORBA_free(stro); - CORBA_free(strr); - return -1; -} - - -static int pid_test(IC_Env *env) -{ - erlang_pid pid = {"", 7, 0, 0}, pido, pidr; - - strcpy(pid.node, this_node), /* this currently running node */ - fprintf(stdout, "\n======== m_i_pid test ======\n\n"); - pidr = m_i_pid_test(NULL, &pid, &pido, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_pid(&pid, &pido) && cmp_pid(&pid, &pidr)); - if (!cmp_pid(&pid, &pido)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_pid(&pid); - fprintf(stdout, "got:\n"); - print_pid(&pido); - } - if (!cmp_pid(&pid, &pidr)) { - fprintf(stdout, " result error, sent:\n"); - print_pid(&pid); - fprintf(stdout, "got:\n"); - print_pid(&pidr); - } - return -1; -} - -static int port_test(IC_Env *env) -{ - erlang_port porti = {"node", 5, 1}, porto, portr; - - fprintf(stdout, "\n======== m_i_port test ======\n\n"); - portr = m_i_port_test(NULL, &porti, &porto, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_port(&porti, &porto) && cmp_port(&porti, &portr)); - if (!cmp_port(&porti, &porto)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_port(&porti); - fprintf(stdout, "got:\n"); - print_port(&porto); - } - if (!cmp_port(&porti, &portr)) { - fprintf(stdout, " result error, sent:\n"); - print_port(&porti); - fprintf(stdout, "got:\n"); - print_port(&portr); - } - return -1; -} - -static int ref_test(IC_Env *env) -{ - erlang_ref refi = { "node1", 3, {1, 2, 3}, 1}, - refo, refr; - - fprintf(stdout, "\n======== m_i_ref test ======\n\n"); - refr = m_i_ref_test(NULL, &refi, &refo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_ref(&refi, &refo) && cmp_ref(&refi, &refr)); - if (!cmp_ref(&refi, &refo)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_ref(&refi); - fprintf(stdout, "got:\n"); - print_ref(&refo); - } - if (!cmp_ref(&refi, &refr)) { - fprintf(stdout, " result error, sent:\n"); - print_ref(&refi); - fprintf(stdout, "got:\n"); - print_ref(&refr); - } - return -1; -} - -static int term_test(IC_Env *env) -{ - ETERM *ti, *to, *tr; - - ti = erl_format("[{hej, 1, 23}, \"string\", {1.23, 45}]"); - - fprintf(stdout, "\n======== m_i_term test ======\n\n"); - tr = m_i_term_test(NULL, ti, &to, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(erl_match(ti, to) && erl_match(ti, tr)); - if (!erl_match(ti, to)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_term(ti); - fprintf(stdout, "got:\n"); - print_term(to); - } - if (!erl_match(ti, tr)) { - fprintf(stdout, " result error, sent:\n"); - print_term(ti); - fprintf(stdout, "got:\n"); - print_term(tr); - } - erl_free_term(ti); - erl_free_term(to); - erl_free_term(tr); - return -1; -} - -static int typedef_test(IC_Env *env) -{ - m_banan mbi, mbo; /* erlang_port */ - m_apa mai; /* ETERM* */ - m_apa mao = NULL; - long tl; - - strcpy(mbi.node,"node"); - mbi.id = 15; - mbi.creation = 1; - - fprintf(stdout, "\n======== m_i_typedef test ======\n\n"); - mai = erl_format("[{hej, 1, 23}, \"string\", {1.23, 45}]"); - tl = m_i_typedef_test(NULL, mai, &mbi, &mao, &mbo, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(erl_match(mai, mao) && cmp_port(&mbi, &mbo) && tl == 4711); - if (!erl_match(mai, mao)) { - fprintf(stdout, " out parameter error (term), sent:\n"); - print_term(mai); - fprintf(stdout, "got:\n"); - print_term(mao); - } - if (!cmp_port(&mbi, &mbo)) { - fprintf(stdout, " out parameter error (port), sent:\n"); - print_port(&mbi); - fprintf(stdout, "got:\n"); - print_port(&mbo); - } - if (tl != 4711) { - fprintf(stdout, " result error, sent: 4711, got %ld\n", tl); - } - erl_free_term(mai); - erl_free_term(mao); - return -1; -} - -static int inline_sequence_test(IC_Env *env) -{ - int i; - long al[500]; - m_s isi = {4711, {500, 10, al}}, - *iso, *isr; - - for (i = 0; i < 500; i++) - al[i]=i; - fprintf(stdout, "\n======== m_i_inline_sequence test ======\n\n"); - isr = m_i_inline_sequence_test(NULL, &isi, &iso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_s(&isi, iso) && cmp_s(&isi, isr)); - if (!cmp_s(&isi, iso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_s(&isi); - fprintf(stdout, "got:\n"); - print_s(iso); - } - if (!cmp_s(&isi, isr)) { - fprintf(stdout, " result error, sent:\n"); - print_s(&isi); - fprintf(stdout, "got:\n"); - print_s(isr); - } - CORBA_free(iso); - CORBA_free(isr); - return -1; -} - -static int term_sequence_test(IC_Env *env) -{ - ETERM* et_array[4] = { - erl_format("[{apa, 1, 23}, \"string\", {1.23, 45}]"), - erl_format("[{banan, 1, 23}, \"string\", {1.23, 45}]"), - erl_format("[{apelsin, 1, 23}, \"string\", {1.23, 45}]"), - erl_format("[{mango, 1, 23}, \"string\", {1.23, 45}]")}; - m_etseq etsi = {4, 4, et_array}, *etso, *etsr; - - fprintf(stdout, "\n======== m_i_term_sequence test ======\n\n"); - etsr = m_i_term_sequence_test(NULL, &etsi, &etso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_etseq(&etsi, etso) && cmp_etseq(&etsi, etsr)); - if (!cmp_etseq(&etsi, etso)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_etseq(&etsi); - fprintf(stdout, "got:\n"); - print_etseq(etso); - } - if (!cmp_etseq(&etsi, etsr)) { - fprintf(stdout, " result error, sent:\n"); - print_etseq(&etsi); - fprintf(stdout, "got:\n"); - print_etseq(etsr); - } - free_etseq_buf(&etsi); - free_etseq_buf(etso); - free_etseq_buf(etsr); - CORBA_free(etso); - CORBA_free(etsr); - return -1; -} - -static int term_struct_test(IC_Env *env) -{ - m_et eti = { erl_format("[{hej, 1, 23}, \"string\", {1.23, 45}]"), - 121212 }; - m_et eto, etr; - - fprintf(stdout, "\n======== m_i_term_struct test ======\n\n"); - etr = m_i_term_struct_test(NULL, &eti, &eto, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_et(&eti, &eto) && cmp_et(&eti, &etr)); - if (!cmp_et(&eti, &eto)) { - fprintf(stdout, " out parameter error, sent:\n"); - print_et(&eti); - fprintf(stdout, "got:\n"); - print_et(&eto); - } - if (!cmp_et(&eti, &etr)) { - fprintf(stdout, " result error, sent:\n"); - print_et(&eti); - fprintf(stdout, "got:\n"); - print_et(&etr); - } - free_et(&eti); - free_et(&eto); - free_et(&etr); - return -1; -} - -static int wstring1_test(IC_Env *env) -{ - CORBA_wchar wsi[] = {100, 101, 102, 103, 104, 0}, *wso, *wsr; - - fprintf(stdout, "\n======== m_i_wstring1 test ======\n\n"); - wsr = m_i_wstring1_test(NULL, wsi, &wso, env); - CHECK_EXCEPTION(env); - RETURN_IF_OK(cmp_wstr(wsi, wso) && cmp_wstr(wsi, wsr)); - if (!cmp_wstr(wsi, wso)) { - fprintf(stdout, " out parameter error, sent: \n"); - print_wstr(wsi); - fprintf(stdout, "got:\n"); - print_wstr(wso); - } - if (!cmp_wstr(wsi, wsr)) { - fprintf(stdout, " result error, sent: \n"); - print_wstr(wsi); - fprintf(stdout, "got:\n"); - print_wstr(wsr); - } - CORBA_free(wso); - CORBA_free(wsr); - return -1; -} - -/* Compare functions */ -static int cmp_aseq(m_aseq *a1, m_aseq *a2) -{ - int i; - - if (a1->_length != a2->_length) - return 0; - for (i = 0; i < a1->_length; i++) - if (cmp_a(&(a1->_buffer[i]), &(a2->_buffer[i])) == 0) - return 0; - return 1; -} - -static int cmp_a(m_a *a1, m_a *a2) -{ - return a1->l == a2->l && - a1->d == a2->d && - cmp_bseq(&a1->y, &a2->y); -} - -static int cmp_bseq(m_bseq *b1, m_bseq *b2) -{ - int i; - - if (b1->_length != b2->_length) - return 0; - for (i = 0; i < b1->_length; i++) - if (cmp_b(&(b1->_buffer[i]), &(b2->_buffer[i])) == 0) - return 0; - return 1; -} - -static int cmp_b(m_b *b1, m_b *b2) -{ - return b1->l == b2->l && b1->c == b2->c; -} - -static int cmp_lseq(m_lseq *b1, m_lseq *b2) -{ - int i; - - if (b1->_length != b2->_length) - return 0; - for (i = 0; i < b1->_length; i++) - if (b1->_buffer[i] != b2->_buffer[i]) - return 0; - return 1; -} - -static int cmp_etseq(m_etseq *b1, m_etseq *b2) -{ - int i; - - if (b1->_length != b2->_length) - return 0; - for (i = 0; i < b1->_length; i++) - if (!erl_match(b1->_buffer[i], b2->_buffer[i])) - return 0; - return 1; -} - -static int cmp_et(m_et* b1, m_et *b2) -{ - return erl_match(b1->e, b2->e) && b1->l == b2->l; -} - -static int cmp_es(m_es *b1, m_es *b2) -{ - return b1->f == b2->f && b1->l == b2->l; -} - -static int cmp_arr1(m_arr1 b1, m_arr1 b2) -{ - int i; - - for (i = 0; i < 500; i++) - if (b1[i] != b2[i]) - return 0; - return 1; -} - -static int cmp_dd(m_dd b1, m_dd b2) -{ - - int i, j; - - for (i = 0; i < 2; i++) - for (j = 0; j < 3; j++) - if (b1[i][j] != b2[i][j]) - return 0; - return 1; -} - - - -static int cmp_strRec(m_strRec *b1, m_strRec *b2) -{ - int i, j; - - if (b1->bb != b2->bb) - return 0; - if (!cmp_str(b1->str4,b2->str4)) - return 0; - if (b1->str5._length != b2->str5._length) - return 0; - for (j = 0; j < b1->str5._length; j++) - if (b1->str5._buffer[j] != b2->str5._buffer[j]) - return 0; - if (!cmp_str(b1->str6,b2->str6)) - return 0; - for (i = 0; i < 3; i++) - for (j = 0; j < 2; j++) - if (b1->str7[i][j] != b2->str7[i][j]) - return 0; - for (j = 0; j < 3; j++) - if (b1->str8[j] != b2->str8[j]) - return 0; - if (!cmp_str(b1->str9,b2->str9)) - return 0; - if (b1->str10._length != b2->str10._length) - return 0; - for (j = 0; j < b1->str10._length; j++) - if (b1->str10._buffer[j] != b2->str10._buffer[j]) - return 0; - return 1; -} - - -static int cmp_sseq(m_sseq *b1, m_sseq *b2) -{ - int i; - - if (b1->_length != b2->_length) - return 0; - for (i = 0; i < b1->_length; i++) - if (!cmp_str(b1->_buffer[i], b2->_buffer[i])) - return 0; - return 1; -} - - -static int cmp_pid(erlang_pid *p1, erlang_pid *p2) -{ - return cmp_str(p1->node,p2-> node) && - p1->num == p2->num && - p1->serial == p2->serial && - p1->creation == p2->creation; -} - -static int cmp_port(erlang_port *p1, erlang_port *p2) -{ - return cmp_str(p1->node,p2-> node) && p1->id == p2->id; -} - -static int cmp_ref(erlang_ref *p1, erlang_ref *p2) -{ - return cmp_str(p1->node, p2->node) && - p1->len == p2->len && - (p1->len < 1 || p1->n[0] == p2->n[0]) && - (p1->len < 2 || p1->n[1] == p2->n[1]) && - (p1->len < 3 || p1->n[2] == p2->n[2]); -} - -static int cmp_s(m_s *b1, m_s *b2) -{ - int i; - - if (b1->l != b2->l) - return 0; - if (b1->sl._length != b2->sl._length) - return 0; - for (i = 0; i < b1->sl._length; i++) - if (b1->sl._buffer[i] != b2->sl._buffer[i]) - return 0; - return 1; -} - - -static int cmp_ssstr3(m_ssstr3 *b1, m_ssstr3 *b2) -{ - int i,j; - - if (b1->_length != b2->_length) - return 0; - for (i = 0; i < b1->_length; i++) { - if (b1->_buffer[i]._length != b2->_buffer[i]._length) - return 0; - for (j = 0; j < b1->_buffer[i]._length; j++) - if (!cmp_str(b1->_buffer[i]._buffer[j], - b2->_buffer[i]._buffer[j])) - return 0; - } - return 1; -} - - - -static int cmp_ssarr3(m_ssarr3 *b1, m_ssarr3 *b2) -{ - int i; - - if (b1->_length != b2->_length) - return 0; - for (i = 0; i < b1->_length; i++) { - if (!cmp_sarr3(&b1->_buffer[i], &b2->_buffer[i])) - return 0; - } - return 1; -} - -static int cmp_sarr3(m_sarr3 *b1, m_sarr3 *b2) -{ - int i; - - if (b1->_length != b2->_length) - return 0; - for (i = 0; i < b1->_length; i++) { - if (!cmp_arr3(b1->_buffer[i], b2->_buffer[i])) - return 0; - } - return 1; -} - -static int cmp_arr3(m_arr3 b1, m_arr3 b2) -{ - int i; - - for (i = 0; i < sizeof(m_arr3)/sizeof(CORBA_long); i++) { - if (b1[i] != b2[i]) - return 0; - } - return 1; -} - -/* Print functions */ -static void print_aseq(m_aseq *a) -{ - int i; - fprintf(stdout, "\nm_aseq size: %ld --------\n", a->_length); - for (i = 0; i < a->_length; i++) - print_a(&(a->_buffer[i])); -} - -static void print_a(m_a *a) -{ - fprintf(stdout, "\nm_a --------\n l: %ld\n d:%f\n", a->l, a->d); - print_bseq(&a->y); -} - -static void print_bseq(m_bseq *b) -{ - int i; - - fprintf(stdout, "\nm_bseq size: %ld --------\n",b->_length); - for (i = 0; i < b->_length; i++) - print_b(&(b->_buffer[i])); -} - -static void print_lseq(m_lseq *b) -{ - int i; - - fprintf(stdout, "\nm_lseq size: %ld --------\n",b->_length); - for (i = 0; i < b->_length; i++) - fprintf(stdout, "[%d]: %ld\n", i, b->_buffer[i]); -} - -static void print_b(m_b *b) -{ - fprintf(stdout, "\nm_b --------\n l: %ld\n c: %c\n", b->l, b->c); -} - - -static void print_etseq(m_etseq *b) -{ - int i; - - for (i = 0; i < b->_length; i++) { - fprintf(stdout, "[%d]:\n", i); - erl_print_term(stdout, b->_buffer[i]); - } -} - - -static void print_et(m_et* b) -{ - fprintf(stdout, "\net struct --------\n"); - erl_print_term(stdout, b->e); - fprintf(stdout, "long: %ld\n", b->l); - fprintf(stdout, "\n--------\n"); -} - -static void print_es(m_es *b) -{ - fprintf(stdout, "\nm_es --------\n f: %d\n l: %ld\n", b->f, b->l); -} - - -static void print_arr1(long a[10]) -{ - int i; - - for (i = 0; i < 10; i++) - fprintf(stdout, "\n[%d]: %ld\n", i, a[i]); -} - -static void print_dd(long a[2][3]) -{ - int i, j; - - fprintf(stdout, "\nlong dd[2][3] --------\n"); - for (i = 0; i < 2; i++) - for (j = 0; j < 3; j++) - fprintf(stdout, "\n[%d][%d]: %ld\n", i, j, a[i][j]); -} - - -static void print_strRec(m_strRec* sr) -{ - int i, j; - - fprintf(stdout, "\nboolean bb : %d\n",sr->bb); - fprintf(stdout, "string str4 : %s\n",sr->str4); - fprintf(stdout, "str7[2][3] :\n"); - for (i = 0; i < 3; i++) - for (j = 0; j < 2; j++) - fprintf(stdout, "str7[%d][%d]: %ld\n", i, j, sr->str7[i][j]); - fprintf(stdout, "str5._length : %ld\n",sr->str5._length); - for (j = 0; j < sr->str5._length; j++) - fprintf(stdout, "str5._buffer[%d]: %c\n", j, sr->str5._buffer[j]); - fprintf(stdout, "string str6 : %s\n",sr->str6); - fprintf(stdout, "str8 :\n"); - for (j = 0; j < 3; j++) - fprintf(stdout, "str8[%d]: %c\n", j, sr->str8[j]); - fprintf(stdout, "string str9 : %s\n",sr->str9); - fprintf(stdout, "str10._length : %ld\n",sr->str10._length); - for (j = 0; j < sr->str10._length; j++) - fprintf(stdout, "str10._buffer[%d]: %c\n", j, sr->str10._buffer[j]); -} - -static void print_sseq(m_sseq *b) -{ - int i; - - fprintf(stdout, "\nm_sseq size: %ld --------\n",b->_length); - for (i = 0; i < b->_length; i++) - fprintf(stdout, "%s\n", b->_buffer[i]); - -} - - -static void print_pid(erlang_pid *p) -{ - fprintf(stdout, "\nerlang_pid --------\n node: %s\n num: %d\n " - "serial: %d\n creation: %d\n", - p->node, p->num, p->serial, p->creation); -} - -static void print_port(erlang_port *p) -{ - fprintf(stdout, "\nerlang_port --------\n node: %s\n id: %d\n " - "creation: %d\n", p->node, p->id, p->creation); -} - -static void print_ref(erlang_ref *p) -{ - fprintf(stdout, "\nerlang_ref --------\n node: %s\n len: %d\n " - "n[0]: %d\n n[1]: %d\n n[2]: %d\n creation: %d\n", - p->node, p->len, p->n[0], p->n[1], p->n[2], p->creation); -} - -static void print_term(ETERM *t) -{ - fprintf(stdout, "\nETERM --------\n"); - erl_print_term(stdout, t); - fprintf(stdout, "\n--------\n"); -} - -static void print_s(m_s *p) -{ - int i; - - fprintf(stdout, "\n%ld\n", p->l); - for (i = 0; i < p->sl._length; i++) - fprintf(stdout, "\n[%d]: %ld\n", i, p->sl._buffer[i]); -} - - -static void print_ssstr3(m_ssstr3 *b1) -{ - int i,j; - - fprintf(stdout, "\nSSSTR3 --------\n"); - fprintf(stdout,"b1->_length = %ld\n",b1->_length); - for (i = 0; i < b1->_length; i++) { - fprintf(stdout,"\nb1->_buffer[%d]._length %ld\n", - i, b1->_buffer[i]._length); - for (j = 0; j < b1->_buffer[i]._length; j++) - fprintf(stdout,"b1->_buffer[%d]._buffer[%d] = %s\n", - i, j, b1->_buffer[i]._buffer[j]); - } - fprintf(stdout, "\n--------\n"); -} - -static void print_wstr(CORBA_wchar *ws) -{ - int i = 0; - - fprintf(stdout, "\nwstr --------\n"); - while (ws[i]) { - fprintf(stdout, "[%d]: %ld\n", i, ws[i]); - i++; - } - fprintf(stdout, "\n--------\n"); -} - - -static void print_ssarr3(m_ssarr3 *b1) -{ - int i; - - fprintf(stdout, "\nssarr3 --------\n"); - fprintf(stdout,"length: %ld\n",b1->_length); - fprintf(stdout, "buffer:\n"); - for (i = 0; i < b1->_length; i++) - print_sarr3(&b1->_buffer[i]); - fprintf(stdout, "\n--------\n"); -} - -static void print_sarr3(m_sarr3 *b1) -{ - int i; - - fprintf(stdout, "\nsarr3 --------\n"); - fprintf(stdout,"length: %ld\n",b1->_length); - fprintf(stdout, "buffer:\n"); - for (i = 0; i < b1->_length; i++) - print_arr3(b1->_buffer[i]); - fprintf(stdout, "\n--------\n"); -} - -static void print_arr3(m_arr3 b1) -{ - int i; - - fprintf(stdout, "\narr3 --------\n"); - for (i = 0; i < sizeof(m_arr3)/sizeof(CORBA_long); i++) - fprintf(stdout, "%ld ", b1[i]); - fprintf(stdout, "\n--------\n"); -} - -static void free_etseq_buf(m_etseq *b) -{ - int i; - - for (i = 0; i < b->_length; i++) - erl_free_term(b->_buffer[i]); -} - -static void free_et(m_et* b) -{ - erl_free_term(b->e); -} - -static void showtime(MyTimeval *start, MyTimeval *stop) -{ - MyTimeval elapsed; - - elapsed.tv_sec = stop->tv_sec - start->tv_sec; - elapsed.tv_usec = stop->tv_usec - start->tv_usec; - while (elapsed.tv_usec < 0) { - elapsed.tv_sec -= 1; - elapsed.tv_usec += 1000000; - } - fprintf(stderr,"%ld.%06ld seconds\n",elapsed.tv_sec, elapsed.tv_usec); -} - -static void my_gettimeofday(MyTimeval *tv) -#ifdef __WIN32__ -#define EPOCH_JULIAN_DIFF 11644473600i64 -{ - SYSTEMTIME t; - FILETIME ft; - LONGLONG lft; - - GetSystemTime(&t); - SystemTimeToFileTime(&t, &ft); - memcpy(&lft, &ft, sizeof(lft)); - tv->tv_usec = (long) ((lft / 10i64) % 1000000i64); - tv->tv_sec = (long) ((lft / 10000000i64) - EPOCH_JULIAN_DIFF); -} -#elif defined VXWORKS -{ - int rate = sysClkRateGet(); /* Ticks per second */ - unsigned long ctick = tickGet(); - tv->tv_sec = ctick / rate; /* secs since reboot */ - tv->tv_usec = ((ctick - (tv->tv_sec * rate))*1000000)/rate; -} -#else -{ - gettimeofday(tv, NULL); -} -#endif diff --git a/lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/c_erl_test.idl b/lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/c_erl_test.idl deleted file mode 100644 index ec74d36cea..0000000000 --- a/lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/c_erl_test.idl +++ /dev/null @@ -1,174 +0,0 @@ - -// %CopyrightBegin% -// -// Copyright Ericsson AB 2004-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -#include "erlang.idl" - - -const short TestConst = 1; - -module m { - - const short TestConst = 2; - - struct b { - long l; - char c; - }; - - struct simple { - long l; - b b_t; - }; - - enum fruit {orange, banana, apple, peach, pear}; - - typedef sequence lseq; - - typedef sequence bseq; - - struct a { - long l; - bseq y; - double d; - }; - - typedef sequence aseq; - - typedef sequence sseq; - typedef string str; - typedef long myLong; - - typedef long arr1[500], dd[2][3]; - - typedef erlang::term apa; - typedef erlang::port banan; - - typedef sequence etseq; - - struct s { - long l; - sequence sl; - }; - - struct es { - fruit f; - myLong l; - }; - - struct et { - erlang::term e; - long l; - }; - - - typedef sequence str1; - typedef string<12> str2; - typedef char str3[3]; - - typedef sequence sstr3; // sequence of string - typedef sequence ssstr3; // sequence of sequences of strings - - typedef long arr3[3]; // array of long - typedef sequence sarr3; // sequence of array - typedef sequence ssarr3; // sequence of sequnces of arrays of strings - - struct strRec{ - boolean bb; - string str4; - long str7[3][2]; - sequence str5; - string<12> str6; - str3 str8; - str2 str9; - str1 str10; - }; - - - struct dyn { - long l; - sequence sl; - }; - typedef dyn arr2[1][2]; - - - interface i { - - const short TestConst = 3; - - //arr2 suck(in arr2 x, out arr2 y ); - - ///////////////////////////////// attribute long l; - - // simple types - void void_test(); - long long_test(in long a, out long a1); - long long longlong_test(in long long a, out long long a1); - unsigned short ushort_test(in unsigned short a, out unsigned short a1); - unsigned long ulong_test(in unsigned long a, out unsigned long a1); - unsigned long long ulonglong_test(in unsigned long long a, out unsigned long long a1); - double double_test(in double a, out double a1); - char char_test(in char a, out char a1); - wchar wchar_test(in wchar a, out wchar a1); - octet octet_test(in octet a, out octet a1); - boolean bool_test(in boolean a, out boolean a1); - - // Seq. and struct tests - b struct_test(in b a, out b a1); - es struct2_test(in es a, out es a1); - //simple struct3_test(in simple x, out simple y); - bseq seq1_test(in bseq a, out bseq a1); - aseq seq2_test(in aseq a, out aseq a1); - lseq seq3_test(in lseq a, out lseq a1); - ssstr3 seq4_test(in ssstr3 a, out ssstr3 a1); - ssarr3 seq5_test(in ssarr3 a, out ssarr3 a1); - - // Array tests - arr1 array1_test(in arr1 a, out arr1 a1); - dd array2_test(in dd a, out dd a1); - - // enum test - fruit enum_test(in fruit a, out fruit a1); - - // string tests - string string1_test(in string a, out string a1); - wstring wstring1_test(in wstring a, out wstring a1); - sseq string2_test(in sseq a, out sseq a1); - str string3_test(in str a, out str a1); - strRec string4_test(in strRec a, out strRec a1); - - // Special erlang types - erlang::pid pid_test(in erlang::pid a, out erlang::pid a1); - erlang::port port_test(in erlang::port a, out erlang::port a1); - erlang::ref ref_test(in erlang::ref a, out erlang::ref a1); - erlang::term term_test(in erlang::term a, out erlang::term a1); - - // typedef test - long typedef_test(in apa a, in banan b, out apa a1, out banan b1); - - // inlined seq. test - s inline_sequence_test(in s a, out s a1); - - // term seq. test - etseq term_sequence_test(in etseq a, out etseq a1); - // term struct test - et term_struct_test(in et a, out et a1); - - }; - -}; diff --git a/lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/erl_server.erl b/lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/erl_server.erl deleted file mode 100644 index f2a6ed83fa..0000000000 --- a/lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/erl_server.erl +++ /dev/null @@ -1,29 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(erl_server). - --export([run/0, stop/0]). - -run() -> - m_i:oe_create(). - -stop() -> - gen_server:cast(cidl_test, stop). diff --git a/lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/m_i_impl.erl b/lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/m_i_impl.erl deleted file mode 100644 index ab62ee40c0..0000000000 --- a/lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/m_i_impl.erl +++ /dev/null @@ -1,162 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(m_i_impl). --include("m.hrl"). - --export([init/1, terminate/2, void_test/1, long_test/2, ushort_test/2, - longlong_test/2, ulong_test/2, ulonglong_test/2, - double_test/2, char_test/2, wchar_test/2, octet_test/2, - bool_test/2, struct_test/2, struct2_test/2, seq1_test/2, - seq2_test/2, seq3_test/2, seq4_test/2, seq5_test/2, - array1_test/2, array2_test/2, enum_test/2, string1_test/2, - string2_test/2, string3_test/2, string4_test/2, pid_test/2, - port_test/2, ref_test/2, term_test/2, typedef_test/3, - inline_sequence_test/2, '_set_l'/2, '_get_l'/1, - term_struct_test/2, term_sequence_test/2, wstring1_test/2]). - --define(PRINTDEBUG(Case), - io:format("erl_server: case: ~p~n" - "erl_server: location: ~p~n", [Case, [?FILE, ?LINE]])). --define(PRINTDEBUG2(Case, Msg), - io:format("erl_server: case: ~p~n" - "erl_server: Msg: ~p~n" - "erl_server: location: ~p~n", [Case, Msg, [?FILE, ?LINE]])). - -init(Env) -> - {ok, []}. - -terminate(F, R) -> - ok. - -'_get_l'(State) -> - ?PRINTDEBUG("_get_l"), - {reply, State, State}. -void_test(State) -> - ?PRINTDEBUG("void_test"), - {reply, ok, State}. - -'_set_l'(State, V) -> - ?PRINTDEBUG2("_set_l", V), - {reply, ok, V}. -ushort_test(State, V) -> - ?PRINTDEBUG2("ushort_test", V), - {reply, {V, V}, State}. -long_test(State, V) -> - ?PRINTDEBUG2("long_test", V), - {reply, {V, V}, State}. -longlong_test(State, V) -> - ?PRINTDEBUG2("longlong_test", V), - {reply, {V, V}, State}. -ulong_test(State, V) -> - ?PRINTDEBUG2("ulong_test", V), - {reply, {V, V}, State}. -ulonglong_test(State, V) -> - ?PRINTDEBUG2("ulonglong_test", V), - {reply, {V, V}, State}. -double_test(State, V) -> - ?PRINTDEBUG2("double_test", V), - {reply, {V, V}, State}. -char_test(State, V) -> - ?PRINTDEBUG2("char_test", V), - {reply, {V, V}, State}. -wchar_test(State, V) -> - ?PRINTDEBUG2("wchar_test", V), - {reply, {V, V}, State}. -octet_test(State, V) -> - ?PRINTDEBUG2("octet_test", V), - {reply, {V, V}, State}. -bool_test(State, V) -> - ?PRINTDEBUG2("bool_test", V), - {reply, {V, V}, State}. - -struct_test(State, V) -> - ?PRINTDEBUG2("struct_test", V), - {reply, {V, V}, State}. -struct2_test(State, V) -> - ?PRINTDEBUG2("struct2_test", V), - {reply, {V, V}, State}. -seq1_test(State, V) -> - ?PRINTDEBUG2("seq1_test", V), - {reply, {V, V}, State}. -seq2_test(State, V) -> - ?PRINTDEBUG2("seq2_test", V), - {reply, {V, V}, State}. -seq3_test(State, V) -> - ?PRINTDEBUG2("seq3_test", V), - {reply, {V, V}, State}. -seq4_test(State, V) -> - ?PRINTDEBUG2("seq4_test", V), - {reply, {V, V}, State}. -seq5_test(State, V) -> - ?PRINTDEBUG2("seq5_test", V), - {reply, {V, V}, State}. -array1_test(State, V) -> - ?PRINTDEBUG2("array1_test", V), - {reply, {V, V}, State}. -array2_test(State, V) -> - ?PRINTDEBUG2("array2_test", V), - {reply, {V, V}, State}. -enum_test(State, V) -> - ?PRINTDEBUG2("enum_test", V), - {reply, {V, V}, State}. -string1_test(State, V) -> - ?PRINTDEBUG2("string1_test", V), - {reply, {V, V}, State}. -string2_test(State, V) -> - ?PRINTDEBUG2("string2_test", V), - {reply, {V, V}, State}. -string3_test(State, V) -> - ?PRINTDEBUG2("string3_test", V), - {reply, {V, V}, State}. -string4_test(State, V) -> - ?PRINTDEBUG2("string4_test", V), - {reply, {V, V}, State}. -pid_test(State, V) -> - ?PRINTDEBUG2("pid_test", V), - {reply, {V, V}, State}. -port_test(State, V) -> - ?PRINTDEBUG2("port_test", binary_to_list(term_to_binary(V))), - {reply, {V, V}, State}. -ref_test(State, V) -> - ?PRINTDEBUG2("ref_test", binary_to_list(term_to_binary(V))), - {reply, {V, V}, State}. -term_test(State, V) -> - ?PRINTDEBUG2("term_test", V), - {reply, {V, V}, State}. -typedef_test(State, A, B) -> - ?PRINTDEBUG2("typedef_test", [A,B]), - {reply, {4711, A, B}, State}. -inline_sequence_test(State, V) -> - ?PRINTDEBUG2("inline_sequence_test", V), - {reply, {V, V}, State}. -term_sequence_test(State, V) -> - ?PRINTDEBUG2("term_sequence_test", V), - {reply, {V, V}, State}. -term_struct_test(State, V) -> - ?PRINTDEBUG2("term_struct_test", V), - {reply, {V, V}, State}. -wstring1_test(State, V) -> - ?PRINTDEBUG2("wstring1_test", V), - {reply, {V, V}, State}. - - - - diff --git a/lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/my.c b/lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/my.c deleted file mode 100644 index 6045034052..0000000000 --- a/lib/ic/test/c_client_erl_server_proto_tmo_SUITE_data/my.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2004-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include "ic.h" -#include "m_i.h" - -int my_prepare_notification_encoding(CORBA_Environment *env) -{ - return oe_prepare_notification_encoding(env); -} - -int my_send_notification_tmo(CORBA_Environment *env, unsigned int send_ms) -{ - return oe_send_notification_tmo(env, send_ms); -} - -int my_prepare_request_encoding(CORBA_Environment *env) -{ - return oe_prepare_request_encoding(env); -} - -int my_send_request_and_receive_reply_tmo(CORBA_Environment *env, - unsigned int send_ms, - unsigned int recv_ms) -{ - return oe_send_request_and_receive_reply_tmo(env, send_ms, recv_ms); -} - -int my_prepare_reply_decoding(CORBA_Environment *env) -{ - return oe_prepare_reply_decoding(env); -} - - - diff --git a/lib/ic/test/erl_client_c_server_SUITE.erl b/lib/ic/test/erl_client_c_server_SUITE.erl deleted file mode 100644 index d592a611f7..0000000000 --- a/lib/ic/test/erl_client_c_server_SUITE.erl +++ /dev/null @@ -1,298 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2002-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - -%%---------------------------------------------------------------------- -%% Purpose : Test suite for erl-client/c-server -%%---------------------------------------------------------------------- - - --module(erl_client_c_server_SUITE). --include_lib("common_test/include/ct.hrl"). - --export([init_per_testcase/2, end_per_testcase/2,all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, void_test/1, - long_test/1, longlong_test/1, ushort_test/1, ulong_test/1, - ulonglong_test/1, double_test/1, char_test/1, wchar_test/1, - octet_test/1, bool_test/1, struct_test/1, struct2_test/1, - seq1_test/1, seq2_test/1, seq3_test/1, seq4_test/1, - seq5_test/1, array1_test/1, array2_test/1, enum_test/1, - string1_test/1, string2_test/1, string3_test/1, - string4_test/1, pid_test/1, port_test/1, ref_test/1, - term_test/1, typedef_test/1, inline_sequence_test/1, - term_sequence_test/1, term_struct_test/1, wstring1_test/1]). - --define(DEFAULT_TIMEOUT, 20000). --define(PORT_TIMEOUT, 15000). --define(CALL_TIMEOUT, 5000). - --define(C_SERVER_NODE_NAME, idl_c_server_test). - -%% Add/remove code path and watchdog before/after each test case. -%% -init_per_testcase(_Case, Config) -> - DataDir = proplists:get_value(data_dir, Config), - code:add_patha(DataDir), - - %% Since other test suites use the module m_i, we have - %% to make sure we are using the right m_i module. - code:purge(m_i), - code:load_file(m_i), - - WatchDog = test_server:timetrap(?DEFAULT_TIMEOUT), - [{watchdog, WatchDog}| Config]. - -end_per_testcase(_Case, Config) -> - DataDir = proplists:get_value(data_dir, Config), - code:del_path(DataDir), - WatchDog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(WatchDog). - -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> -[void_test, long_test, longlong_test, ushort_test, - ulong_test, ulonglong_test, double_test, char_test, - wchar_test, octet_test, bool_test, struct_test, - struct2_test, seq1_test, seq2_test, seq3_test, - seq4_test, seq5_test, array1_test, array2_test, - enum_test, string1_test, string2_test, string3_test, - string4_test, pid_test, port_test, ref_test, term_test, - typedef_test, inline_sequence_test, term_sequence_test, - term_struct_test, wstring1_test]. - -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -array1_test(Config) -> - do_test(array1_test, Config). - -array2_test(Config) -> - do_test(array2_test, Config). - -bool_test(Config) -> - do_test(bool_test, Config). - -char_test(Config) -> - do_test(char_test, Config). - -double_test(Config) -> - do_test(double_test, Config). - -enum_test(Config) -> - do_test(enum_test, Config). - -inline_sequence_test(Config) -> - do_test(inline_sequence_test, Config). - -longlong_test(Config) -> - do_test(longlong_test, Config). - -long_test(Config) -> - do_test(long_test, Config). - -octet_test(Config) -> - do_test(octet_test, Config). - -pid_test(Config) -> - do_test(pid_test, Config). - -port_test(Config) -> - do_test(port_test, Config). - -ref_test(Config) -> - do_test(ref_test, Config). - -seq1_test(Config) -> - do_test(seq1_test, Config). - -seq2_test(Config) -> - do_test(seq2_test, Config). - -seq3_test(Config) -> - do_test(seq3_test, Config). - -seq4_test(Config) -> - do_test(seq4_test, Config). - -seq5_test(Config) -> - do_test(seq5_test, Config). - -string1_test(Config) -> - do_test(string1_test, Config). - -string2_test(Config) -> - do_test(string2_test, Config). - -string3_test(Config) -> - do_test(string3_test, Config). - -string4_test(Config) -> - do_test(string4_test, Config). - -struct2_test(Config) -> - do_test(struct2_test, Config). - -struct_test(Config) -> - do_test(struct_test, Config). - -term_sequence_test(Config) -> - do_test(term_sequence_test, Config). - -term_struct_test(Config) -> - do_test(term_struct_test, Config). - -term_test(Config) -> - do_test(term_test, Config). - -typedef_test(Config) -> - do_test(typedef_test, Config). - -ulonglong_test(Config) -> - do_test(ulonglong_test, Config). - -ulong_test(Config) -> - do_test(ulong_test, Config). - -ushort_test(Config) -> - do_test(ushort_test, Config). - -void_test(Config) -> - do_test(void_test, Config). - -wchar_test(Config) -> - do_test(wchar_test, Config). - -wstring1_test(Config) -> - do_test(wstring1_test, Config). - - -do_test(Case, Config) -> - %% Trap exits - process_flag(trap_exit, true), - Node = atom_to_list(node()), - [_NodeName, HostName] = string:tokens(Node, "@"), - DataDir = proplists:get_value(data_dir, Config), - %% io:format("~p: data directory: ~p~n", [?MODULE, DataDir]), - Cookie = atom_to_list(erlang:get_cookie()), - ServerNodeName = atom_to_list(?C_SERVER_NODE_NAME), - %% Start C-server node as a port program. We wait for the node - %% to connect to us. - Cmd = filename:join([DataDir, "c_server"]) ++ - " -this-node-name " ++ ServerNodeName ++ - " -peer-node " ++ Node ++ - " -cookie " ++ Cookie, - Port = open_port({spawn, Cmd}, [exit_status, eof, stderr_to_stdout]), - ServerNode = list_to_atom(ServerNodeName ++ "@" ++ HostName), - Res = case wait_for_hidden_node(ServerNode) of - ok -> - %% Need a port for port_test and typedef_test - put(port_test_port, Port), - R = (catch erl_client:Case(ServerNode, ?CALL_TIMEOUT)), - case wait_for_completion(Port) of - {error, timeout} -> - kill_off_node(ServerNode); - _ -> - ok - end, - R; - {error, timeout} -> - case wait_for_completion(Port) of - {error, timeout} -> - kill_off_node(ServerNode); - _ -> - ok - end, - {error, timeout} - end, - process_flag(trap_exit, false), - true = Res. - - -%% Wait for eof *and* exit status, but return if exit status indicates -%% an error, or we have been waiting more than PORT_TIMEOUT seconds. -%% -wait_for_completion(Port) -> - wait_for_completion(Port, 0). - -wait_for_completion(Port, N) when N < 2 -> - receive - {Port, {data, Bytes}} -> - %% Relay output - io:format("~s", [Bytes]), - wait_for_completion(Port, N); - {Port, {exit_status, 0}} -> - wait_for_completion(Port, N + 1); - {Port, {exit_status, Status}} -> - {error, Status}; - {Port, eof} -> - wait_for_completion(Port, N + 1); - {'EXIT', Port, Reason} -> - io:format("Port exited with reason: ~w~n", [Reason]), - wait_for_completion(Port, N); - {'EXIT', From, Reason} -> - io:format("Got unexpected exit: ~p~n", [{'EXIT', From, Reason}]), - wait_for_completion(Port, N) - after ?PORT_TIMEOUT -> - {error, timeout} - end; -wait_for_completion(_, _) -> - ok. - -wait_for_hidden_node(Node) -> - Times = ?DEFAULT_TIMEOUT div 100, - wait_for_hidden_node(Node, Times, 100). - -wait_for_hidden_node(Node, Times, WaitTime) when Times > 0 -> - io:format("Waiting for hidden node: ~p~n", [Node]), - case lists:member(Node, erlang:nodes(hidden)) of - true -> - ok; - false -> - delay(WaitTime), - wait_for_hidden_node(Node, Times - 1, WaitTime) - end; -wait_for_hidden_node(_Node, _, _WaitTime) -> - {error, timeout}. - -kill_off_node(Node) -> - catch rpc:cast(Node, erlang, halt, [1]). - -delay(Time) -> - receive - after Time -> - ok - end. - - - - diff --git a/lib/ic/test/erl_client_c_server_SUITE_data/Makefile.src b/lib/ic/test/erl_client_c_server_SUITE_data/Makefile.src deleted file mode 100644 index 11eee8b7ac..0000000000 --- a/lib/ic/test/erl_client_c_server_SUITE_data/Makefile.src +++ /dev/null @@ -1,160 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2002-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -# Makefile.src for erl_client_c_server test -# Note: This file *must* work for both Unix and Windows -# -# We use both `rm' (Unix) and `del' (Windows) for removing files, but -# with a `-' in front so that the error in not finding `rm' (`del') on -# Windows (Unix) is ignored. -# -# VxWorks? XXX -# - -.SUFFIXES: -.SUFFIXES: .c .h .erl .idl @obj@ .@EMULATOR@ - - -# Variables from ts: -# - -ERL_INCLUDE = @erl_include@ - -IC_INCLUDE_PATH = @ic_include_path@ -IC_LIB = @ic_lib@ - -ERL_INTERFACE_INCLUDE = @erl_interface_include@ -ERL_INTERFACE_LIB = @erl_interface_lib@ -ERL_INTERFACE_EILIB = @erl_interface_eilib@ -ERL_INTERFACE_THREADLIB = @erl_interface_threadlib@ -ERL_INTERFACE_SOCK_LIBS = @erl_interface_sock_libs@ - -CC = @CC@ -## XXX Should set warning flag with a DEBUG_FLAG -CFLAGS = @CFLAGS@ @DEFS@ -I$(ERL_INCLUDE) \ - -I$(IC_INCLUDE_PATH) -I$(ERL_INTERFACE_INCLUDE) - -LD = @LD@ -LDFLAGS = @CROSSLDFLAGS@ -LIBS = $(IC_LIB) $(ERL_INTERFACE_LIB) $(ERL_INTERFACE_EILIB) \ - $(ERL_INTERFACE_THREADLIB) @LIBS@ $(ERL_INTERFACE_SOCK_LIBS) -ERLC = erlc - -# Generated C header files -GEN_H_FILES = \ - m__s.h \ - m_i__s.h \ - oe_erl_c_test__s.h - -# Generated C files -GEN_C_FILES = \ - m__s.c \ - m_i__s.c \ - oe_code_m_a.c \ - oe_code_m_arr1.c \ - oe_code_m_arr2.c \ - oe_code_m_arr3.c \ - oe_code_m_aseq.c \ - oe_code_m_b.c \ - oe_code_m_bseq.c \ - oe_code_m_dd.c \ - oe_code_m_dyn.c \ - oe_code_m_dyn_sl.c \ - oe_code_m_es.c \ - oe_code_m_et.c \ - oe_code_m_etseq.c \ - oe_code_m_fruit.c \ - oe_code_m_lseq.c \ - oe_code_m_s.c \ - oe_code_m_s_sl.c \ - oe_code_m_sarr3.c \ - oe_code_m_simple.c \ - oe_code_m_ssarr3.c \ - oe_code_m_sseq.c \ - oe_code_m_ssstr3.c \ - oe_code_m_sstr3.c \ - oe_code_m_str1.c \ - oe_code_m_str3.c \ - oe_code_m_strRec.c \ - oe_code_m_strRec_str5.c \ - oe_code_m_strRec_str7.c \ - oe_erl_c_test__s.c - -GEN_HRL_FILES = \ - m.hrl \ - m_i.hrl \ - oe_erl_c_test.hrl - -GEN_ERL_FILES = \ - m.erl \ - m_arr2.erl \ - m_arr3.erl \ - m_i.erl \ - m_str3.erl \ - oe_erl_c_test.erl - -C_FILES = $(GEN_C_FILES) c_server.c callbacks.c - -OBJS = $(C_FILES:.c=@obj@) - -PGMS = c_server@exe@ - -ERL_FILES = $(GEN_ERL_FILES) erl_client.erl - -EBINS = $(ERL_FILES:.erl=.@EMULATOR@) - - -all: $(PGMS) $(EBINS) - -$(GEN_ERL_FILES) $(GEN_HRL_FILES): c_erl_test.built_erl -$(GEN_C_FILES) $(GEN_H_FILES): c_erl_test.built_c -$(OBJS): $(GEN_C_FILES) $(GEN_H_FILES) -$(EBINS): $(GEN_ERL_FILES) $(GEN_HRL_FILES) - -clean: - -rm -f $(OBJS) $(GEN_C_FILES) $(GEN_H_FILES) $(PGMS) \ - $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) \ - c_erl_test.built_erl c_erl_test.built_c - -del /F /Q $(OBJS) $(GEN_C_FILES) $(GEN_H_FILES) $(PGMS) \ - $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) \ - c_erl_test.built_erl c_erl_test.built_c - -$(PGMS): $(OBJS) - $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) - -c_erl_test.built_c: erl_c_test.idl - $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,c_server}" \ - "+{scoped_op_calls,true}" erl_c_test.idl - echo done > c_erl_test.built_c - -# If we have scoped operation calls for C, we must have that for -# Erlang as well, if we use the m_i.erl file for calling the server. - -c_erl_test.built_erl: erl_c_test.idl - $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,erl_genserv}" \ - "+{scoped_op_calls,true}" "+{timeout,true}" erl_c_test.idl - echo done > c_erl_test.built_erl - -.c@obj@: - $(CC) -c -o $*@obj@ $(CFLAGS) $< - -.erl.@EMULATOR@: - $(ERLC) -W -I $(IC_INCLUDE_PATH) $< - diff --git a/lib/ic/test/erl_client_c_server_SUITE_data/c_server.c b/lib/ic/test/erl_client_c_server_SUITE_data/c_server.c deleted file mode 100644 index f48480e8dc..0000000000 --- a/lib/ic/test/erl_client_c_server_SUITE_data/c_server.c +++ /dev/null @@ -1,300 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2002-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -/* C-server for test of IC. - * - * The C-node implemented here connects to its peer node, waits for - * one message, evaluates the message, returns an result message, and - * terminates. - * - * TODO: - * - * 1. XXX #includes for VxWorks, Windows - */ - -#include -#include - -#ifndef __WIN32__ -# include -#endif - -#include - -#ifdef __WIN32__ -# include -# include -#elif defined VXWORKS -# include -# include -#else -# include -#endif - -#include - -#ifdef __WIN32__ -# include -# include -#else -# include -# include -# include -# include -# include -#endif - -#include "ic.h" -#include "ei.h" -#include "erl_interface.h" -#include "eicode.h" -#include "m_i__s.h" -#include "m__s.h" - -#ifdef __WIN32__ -typedef struct { - long tv_sec; - long tv_usec; -} MyTimeval; -#else -typedef struct timeval MyTimeval; -#endif -static void my_gettimeofday(MyTimeval *tv); -static void showtime(MyTimeval *start, MyTimeval *stop); -static void usage(void); -static void done(int r); - -#define HOSTNAMESZ 255 -#define NODENAMESZ 512 -#define INBUFSZ 10 -#define OUTBUFSZ 0 -#define MAXTRIES 5 - -static char *progname; - -/* main */ -#ifdef VXWORKS -int c_server(int argc, char **argv) -#else -int main(int argc, char **argv) -#endif -{ - struct hostent *hp; - MyTimeval start, stop; - int i, fd, ires, tries; - CORBA_Environment *env; - char *this_node_name = NULL; - char *peer_node = NULL; - char *cookie = NULL; - char host[HOSTNAMESZ + 1]; - char this_node[NODENAMESZ + 1]; - erlang_msg msg; - int status, loop; - -#ifdef __WIN32__ - WORD wVersionRequested; - WSADATA wsaData; - - wVersionRequested = MAKEWORD(2, 0); - - if (WSAStartup(wVersionRequested, &wsaData) != 0) { - fprintf(stderr, "Could not load winsock2 v2.0 compatible DLL"); - exit(1); - } -#endif - - progname = argv[0]; - host[HOSTNAMESZ] = '\0'; - if (gethostname(host, HOSTNAMESZ + 1) < 0) { - fprintf(stderr, "Can't find own hostname\n"); - done(1); - } - if ((hp = gethostbyname(host)) == 0) { - fprintf(stderr, "Can't get ip address for host %s\n", host); - done(1); - } - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-help") == 0) { - usage(); - done(0); - } else if (strcmp(argv[i], "-this-node-name") == 0) { - i++; - this_node_name = argv[i]; - } else if (strcmp(argv[i], "-peer-node") == 0) { - i++; - peer_node = argv[i]; - } else if (strcmp(argv[i], "-cookie") == 0) { - i++; - cookie = argv[i]; - } else { - fprintf(stderr, "Error : invalid argument \"%s\"\n", argv[i]); - usage(); - done(1); - } - } - - if (this_node_name == NULL || peer_node == NULL || cookie == NULL) { - fprintf(stderr, "Error: missing option\n"); - usage(); - done(1); - } - - /* Behead hostname at first dot */ - for (i=0; host[i] != '\0'; i++) { - if (host[i] == '.') { host[i] = '\0'; break; } - } - sprintf(this_node, "%s@%s", this_node_name, host); - - fprintf(stderr, "c_server: this node: \"%s\"\n", this_node); - fprintf(stderr, "c_server: peer node: \"%s\"\n", peer_node); - - /* initialize erl_interface */ - erl_init(NULL, 0); - - for (tries = 0; tries < MAXTRIES; tries++) { - /* connect to peer node */ - ires = erl_connect_xinit(host, this_node_name, this_node, - (struct in_addr *)*hp->h_addr_list, - cookie, 0); - fprintf(stderr, "c_server: erl_connect_xinit(): %d\n", ires); - - fd = erl_connect(peer_node); - fprintf(stderr, "c_server: erl_connect(): %d\n", fd); - if (fd >= 0) - break; - fprintf(stderr, "c_server: cannot connect, retrying\n"); - } - if (fd < 0) { - fprintf(stderr, "c_server: cannot connect, exiting\n"); - done(1); - } - env = CORBA_Environment_alloc(INBUFSZ, OUTBUFSZ); - env->_fd = fd; - - status = 1; - loop = 1; - my_gettimeofday(&start); - while (status >= 0 && loop > 0) { - status = ei_receive_encoded(env->_fd, &env->_inbuf, &env->_inbufsz, - &msg, &env->_iin); - switch(status) { - case ERL_SEND: - case ERL_REG_SEND: - /* get result */ - m_i__switch(NULL, env); - switch(env->_major) { - case CORBA_NO_EXCEPTION: - break; - case CORBA_SYSTEM_EXCEPTION: - fprintf(stderr, "Request failure, reason : %s\n", - (char *) CORBA_exception_value(env)); - CORBA_exception_free(env); - break; - default: /* Should not happen */ - CORBA_exception_free(env); - break; - } - /* send back result data */ - if (env->_iout > 0) - ei_send_encoded(env->_fd, &env->_caller, env->_outbuf, - env->_iout); - loop = 0; - break; - case ERL_TICK: - break; - default: - if (status < 0) { - fprintf(stderr, "Status negative: %d\n", status); - loop = 0; - } - break; - } - } - my_gettimeofday(&stop); - showtime(&start, &stop); - - erl_close_connection(fd); - - CORBA_free(env->_inbuf); - CORBA_free(env->_outbuf); - CORBA_free(env); - if (status < 0) - done(-status); - else - done(0); -} - -static void usage() -{ - fprintf(stderr, "Usage: %s [-help] -this-node-name " - "-peer-node -cookie \n", progname); - fprintf(stderr, "Example:\n %s -this-node-name kalle " - "-peer-node olle@home -cookie oa678er\n", progname); -} - -static void done(int r) -{ -#ifdef __WIN32__ - WSACleanup(); -#endif - exit(r); -} - -static void showtime(MyTimeval *start, MyTimeval *stop) -{ - MyTimeval elapsed; - - elapsed.tv_sec = stop->tv_sec - start->tv_sec; - elapsed.tv_usec = stop->tv_usec - start->tv_usec; - while (elapsed.tv_usec < 0) { - elapsed.tv_sec -= 1; - elapsed.tv_usec += 1000000; - } - fprintf(stderr,"%ld.%06ld seconds\n",elapsed.tv_sec, elapsed.tv_usec); -} - - - -static void my_gettimeofday(MyTimeval *tv) -#ifdef __WIN32__ -#define EPOCH_JULIAN_DIFF 11644473600i64 -{ - SYSTEMTIME t; - FILETIME ft; - LONGLONG lft; - - GetSystemTime(&t); - SystemTimeToFileTime(&t, &ft); - memcpy(&lft, &ft, sizeof(lft)); - tv->tv_usec = (long) ((lft / 10i64) % 1000000i64); - tv->tv_sec = (long) ((lft / 10000000i64) - EPOCH_JULIAN_DIFF); -} -#elif defined VXWORKS -{ - int rate = sysClkRateGet(); /* Ticks per second */ - unsigned long ctick = tickGet(); - tv->tv_sec = ctick / rate; /* secs since reboot */ - tv->tv_usec = ((ctick - (tv->tv_sec * rate))*1000000)/rate; -} -#else -{ - gettimeofday(tv, NULL); -} -#endif diff --git a/lib/ic/test/erl_client_c_server_SUITE_data/callbacks.c b/lib/ic/test/erl_client_c_server_SUITE_data/callbacks.c deleted file mode 100644 index 2611e15f5a..0000000000 --- a/lib/ic/test/erl_client_c_server_SUITE_data/callbacks.c +++ /dev/null @@ -1,611 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2002-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include -#include -#ifndef __WIN32__ -# include -#endif -#include -#include -#include -#include -#include -#include "m_i__s.h" - - - -/* OK */ - -void my_void_test(CORBA_Object oe_obj, - CORBA_Environment *oe_env) -{ - /* printf("void test !\n"); */ -} - -m_i_void_test__rs* m_i_void_test__cb(CORBA_Object oe_obj, - CORBA_Environment *oe_env) -{ - return (m_i_void_test__rs*) (my_void_test); -} - - - -/* OK */ - -void my_long_test(CORBA_Object oe_obj, - long* a, - long* b, - long* c, - CORBA_Environment *oe_env) -{ - /* printf("long test !\n"); */ -} - - -m_i_long_test__rs* m_i_long_test__cb(CORBA_Object oe_obj, - long* a, - long* b, - long* c, - CORBA_Environment *oe_env) -{ - *a = *b; - *c = *b; - return (m_i_long_test__rs*) (my_long_test); -} - -/* OK */ - -void my_longlong_test(CORBA_Object oe_obj, - CORBA_long_long* a, - CORBA_long_long* b, - CORBA_long_long* c, - CORBA_Environment *oe_env) -{ - /* printf("long test !\n"); */ -} - -m_i_longlong_test__rs* m_i_longlong_test__cb(CORBA_Object oe_obj, - CORBA_long_long* a, - CORBA_long_long* b, - CORBA_long_long* c, - CORBA_Environment *oe_env) -{ - *a = *b; - *c = *b; - return (m_i_longlong_test__rs*) (my_longlong_test); -} - -/* OK */ -void my_ulong_test(CORBA_Object oe_obj, - unsigned long* a, - unsigned long* b, - unsigned long* c, - CORBA_Environment *oe_env) -{ - /* printf("ulong test !\n"); */ -} - -m_i_ulong_test__rs* m_i_ulong_test__cb(CORBA_Object oe_obj, - unsigned long* a, - unsigned long* b, - unsigned long* c, - CORBA_Environment *oe_env) -{ - *a = *b; - *c = *b; - return (m_i_ulong_test__rs*) (my_ulong_test); -} - -/* OK */ -void my_ulonglong_test(CORBA_Object oe_obj, - CORBA_unsigned_long_long* a, - CORBA_unsigned_long_long* b, - CORBA_unsigned_long_long* c, - CORBA_Environment *oe_env) -{ - /* printf("ulong test !\n"); */ -} - -m_i_ulonglong_test__rs* m_i_ulonglong_test__cb(CORBA_Object oe_obj, - CORBA_unsigned_long_long* a, - CORBA_unsigned_long_long* b, - CORBA_unsigned_long_long* c, - CORBA_Environment *oe_env) -{ - *a = *b; - *c = *b; - return (m_i_ulonglong_test__rs*) (my_ulonglong_test); -} - -m_i_ushort_test__rs* m_i_ushort_test__cb(CORBA_Object oe_obj, - unsigned short* a, - unsigned short* b, - unsigned short* c, - CORBA_Environment *oe_env) -{ - *a = *b; - *c = *b; - return (m_i_ushort_test__rs*) NULL; -} - - -/* OK */ -void my_double_test(CORBA_Object oe_obj, - double* a, - double* b, - double* c, - CORBA_Environment *oe_env) -{ - /* printf("double test !\n"); */ -} - -m_i_double_test__rs* m_i_double_test__cb(CORBA_Object oe_obj, - double* a, - double* b, - double* c, - CORBA_Environment *oe_env) -{ - *a = *b; - *c = *b; - return (m_i_double_test__rs*) (my_double_test); -} - -/* OK */ -m_i_char_test__rs* m_i_char_test__cb(CORBA_Object oe_obj, - char* a, - char* b, - char* c, - CORBA_Environment *oe_env) -{ - m_i_char_test__rs* rs = NULL; - - *a = *b; - *c = *b; - return rs; -} - - -/* OK */ -m_i_wchar_test__rs* m_i_wchar_test__cb(CORBA_Object oe_obj, - CORBA_wchar* a, - CORBA_wchar* b, - CORBA_wchar* c, - CORBA_Environment *oe_env) -{ - m_i_wchar_test__rs* rs = NULL; - - *a = *b; - *c = *b; - return rs; -} - -/* OK */ -m_i_octet_test__rs* m_i_octet_test__cb(CORBA_Object oe_obj, - char* a, - char* b, - char* c, - CORBA_Environment *oe_env) -{ - m_i_octet_test__rs* rs = NULL; - - *a = *b; - *c = *b; - return rs; -} - -/* OK */ -m_i_bool_test__rs* m_i_bool_test__cb(CORBA_Object oe_obj, - CORBA_boolean* a, - CORBA_boolean* b, - CORBA_boolean* c, - CORBA_Environment *oe_env) -{ - m_i_bool_test__rs* rs = NULL; - - *a = *b; - *c = *b; - return rs; -} - -/* OK */ -void my_struct_test(CORBA_Object oe_obj, - m_b* a, - m_b* b, - m_b* c, - CORBA_Environment *oe_env) -{ - /* printf("struct test !\n"); */ -} - -m_i_struct_test__rs* m_i_struct_test__cb(CORBA_Object oe_obj, - m_b* a, - m_b* b, - m_b* c, - CORBA_Environment *oe_env) -{ - *a = *b; - *c = *b; - return (m_i_struct_test__rs*) (my_struct_test); -} - -/* OK */ -m_i_struct2_test__rs* m_i_struct2_test__cb(CORBA_Object oe_obj, - m_es* a, - m_es* b, - m_es* c, - CORBA_Environment *oe_env) -{ - m_i_struct2_test__rs* rs = NULL; - - *a = *b; - *c = *b; - return rs; -} - -/* OK */ -/* XXX Commented out -m_i_struct3_test__rs* m_i_struct3_test__cb(CORBA_Object oe_obj, - m_simple* a, - m_simple* b, - m_simple* c, - CORBA_Environment *oe_env) -{ - m_i_struct3_test__rs* rs = NULL; - *a = *b; - *c = *b; - return rs; -} -*/ - -/* OK */ -m_i_seq1_test__rs* m_i_seq1_test__cb(CORBA_Object oe_obj, - m_bseq** a, - m_bseq* b, - m_bseq** c, - CORBA_Environment *oe_env) -{ - m_i_seq1_test__rs* rs = NULL; - - *a = b; - *c = b; - return rs; -} - - -/* OK */ -m_i_seq2_test__rs* m_i_seq2_test__cb(CORBA_Object oe_obj, - m_aseq** a, - m_aseq* b, - m_aseq** c, - CORBA_Environment *oe_env) -{ - m_i_seq2_test__rs* rs = NULL; - - *a = b; - *c = b; - return rs; -} - -/* OK */ -m_i_seq3_test__rs* m_i_seq3_test__cb(CORBA_Object oe_obj, - m_lseq** a, - m_lseq* b, - m_lseq** c, - CORBA_Environment *oe_env) -{ - m_i_seq3_test__rs* rs = NULL; - - *a = b; - *c = b; - return rs; -} - -/* OK */ -m_i_seq4_test__rs* m_i_seq4_test__cb(CORBA_Object oe_obj, - m_ssstr3** a, - m_ssstr3* b, - m_ssstr3** c, - CORBA_Environment *oe_env) -{ - m_i_seq4_test__rs* rs = NULL; - - *a = b; - *c = b; - return rs; -} - -/* OK */ -m_i_seq5_test__rs* m_i_seq5_test__cb(CORBA_Object oe_obj, - m_ssarr3** a, - m_ssarr3* b, - m_ssarr3** c, - CORBA_Environment *oe_env) -{ - m_i_seq5_test__rs* rs = NULL; - - *a = b; - *c = b; - return rs; -} - -/* OK */ -m_i_array1_test__rs* m_i_array1_test__cb(CORBA_Object oe_obj, - m_arr1 a, - m_arr1 b, - m_arr1 c, - CORBA_Environment *oe_env) -{ - int i; - m_i_array1_test__rs* rs = NULL; - - for (i = 0; i < 500; i++) { - a[i] = b[i]; - c[i] = b[i]; - } - return rs; -} - -/* OK */ -m_i_array2_test__rs* m_i_array2_test__cb(CORBA_Object oe_obj, - m_dd a, - m_dd b, - m_dd c, - CORBA_Environment *oe_env) -{ - int i,j; - m_i_array2_test__rs* rs = NULL; - - for (i = 0; i < 2; i++) - for (j = 0; j < 3; j++) { - a[i][j] = b[i][j]; - c[i][j] = b[i][j]; - } - return rs; -} - - -/* OK */ -m_i_enum_test__rs* m_i_enum_test__cb(CORBA_Object oe_obj, - m_fruit* a, - m_fruit* b, - m_fruit* c, - CORBA_Environment *oe_env) -{ - m_i_enum_test__rs* rs = NULL; - - *a = *b; - *c = *b; - return rs; -} - -/* OK */ -m_i_string1_test__rs* m_i_string1_test__cb(CORBA_Object oe_obj, - char ** a, - char * b, - char ** c, - CORBA_Environment *oe_env) -{ - m_i_string1_test__rs* rs = NULL; - - /*printf("\nString in ------> %s\n\n",b);*/ - *a = b; - *c = b; - return rs; -} - -/* OK */ -m_i_string2_test__rs* m_i_string2_test__cb(CORBA_Object oe_obj, - m_sseq** a, - m_sseq* b, - m_sseq** c, - CORBA_Environment *oe_env) -{ - m_i_string2_test__rs* rs = NULL; - - *a = b; - *c = b; - return rs; -} - -/* OK */ -m_i_string3_test__rs* m_i_string3_test__cb(CORBA_Object oe_obj, - char ** a, - char * b, - char ** c, - CORBA_Environment *oe_env) -{ - m_i_string3_test__rs* rs = NULL; - - *a = b; - *c = b; - return rs; -} - -m_i_string4_test__rs* m_i_string4_test__cb(CORBA_Object oe_obj, - m_strRec** a, - m_strRec* b, - m_strRec** c, - CORBA_Environment *oe_env) -{ - *a = b; - *c = b; - - return (m_i_string4_test__rs*) NULL; -} - -/* OK */ -m_i_wstring1_test__rs* m_i_wstring1_test__cb(CORBA_Object oe_obj, - CORBA_wchar ** a, - CORBA_wchar * b, - CORBA_wchar ** c, - CORBA_Environment *oe_env) -{ - int tmp; - m_i_wstring1_test__rs* rs = NULL; - - /*printf("\nString in ------> %s\n\n",b);*/ - - for(tmp = 0; tmp < 5; tmp++) - fprintf(stderr,"\np[%d] = %ld\n", tmp, b[tmp]); - *a = b; - *c = b; - return rs; -} - - -/* OK */ -m_i_pid_test__rs* m_i_pid_test__cb(CORBA_Object oe_obj, - erlang_pid* a, - erlang_pid* b, - erlang_pid* c, - CORBA_Environment *oe_env) -{ - m_i_pid_test__rs* rs = NULL; - - *a = *b; - *c = *b; - return rs; -} - -/* OK */ -m_i_port_test__rs* m_i_port_test__cb(CORBA_Object oe_obj, - erlang_port* a, - erlang_port* b, - erlang_port* c, - CORBA_Environment *oe_env) -{ - m_i_port_test__rs* rs = NULL; - - strcpy((*a).node,(*b).node); - (*a).id = (*b).id; - (*a).creation = 0; - - strcpy((*c).node,(*b).node); - (*c).id = (*b).id; - (*c).creation = 0; - return rs; -} - -/* OK */ -m_i_ref_test__rs* m_i_ref_test__cb(CORBA_Object oe_obj, - erlang_ref* a, - erlang_ref* b, - erlang_ref* c, - CORBA_Environment *oe_env) -{ - - m_i_ref_test__rs* rs = NULL; - - strcpy((*a).node,(*b).node); - /*(*a).id = (*b).id;*/ - (*a).len = (*b).len; - (*a).n[0] = (*b).n[0]; - (*a).n[1] = (*b).n[1]; - (*a).n[2] = (*b).n[2]; - (*a).creation = 0; - - strcpy((*c).node,(*b).node); - /*(*c).id = (*b).id;*/ - (*c).len = (*b).len; - (*c).n[0] = (*b).n[0]; - (*c).n[1] = (*b).n[1]; - (*c).n[2] = (*b).n[2]; - (*c).creation = 0; - return rs; -} - -/* OK */ -m_i_term_test__rs* m_i_term_test__cb(CORBA_Object oe_obj, - ETERM** a, - ETERM** b, - ETERM** c, - CORBA_Environment *oe_env) -{ - m_i_term_test__rs* rs = NULL; - - *a = *b; - *c = *b; - return rs; -} - -m_i_typedef_test__rs* m_i_typedef_test__cb(CORBA_Object oe_obj, - long* a, - ETERM** b, - erlang_port* c, - ETERM** d , - erlang_port* e, - CORBA_Environment *oe_env) -{ - m_i_typedef_test__rs* rs = NULL; - - *d = *b; - strcpy((*e).node,(*c).node); - (*e).id = (*c).id; - (*e).creation = 0; - *a = 4711; - return rs; -} - -/* OK */ -m_i_inline_sequence_test__rs* m_i_inline_sequence_test__cb( - CORBA_Object oe_obj, - m_s** a, - m_s* b, - m_s** c, - CORBA_Environment *oe_env) -{ - m_i_inline_sequence_test__rs* rs = NULL; - - *a = b; - *c = b; - return rs; -} - -/* OK */ -m_i_term_sequence_test__rs* m_i_term_sequence_test__cb( - CORBA_Object oe_obj, - m_etseq** a, - m_etseq* b, - m_etseq** c, - CORBA_Environment *oe_env) -{ - m_i_term_sequence_test__rs* rs = NULL; - - *a = b; - *c = b; - return rs; -} - - -/* OK */ -m_i_term_struct_test__rs* m_i_term_struct_test__cb(CORBA_Object oe_obj, - m_et* a, - m_et* b, - m_et* c, - CORBA_Environment *oe_env) -{ - m_i_term_struct_test__rs* rs = NULL; - - *a = *b; - *c = *b; - return rs; -} - diff --git a/lib/ic/test/erl_client_c_server_SUITE_data/erl_c_test.idl b/lib/ic/test/erl_client_c_server_SUITE_data/erl_c_test.idl deleted file mode 100644 index 6ed28f0822..0000000000 --- a/lib/ic/test/erl_client_c_server_SUITE_data/erl_c_test.idl +++ /dev/null @@ -1,175 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 2002-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -#include "erlang.idl" - - -const short TestConst = 1; - -module m { - - const short TestConst = 2; - - struct b { - long l; - char c; - }; - - struct simple { - long l; - b b_t; - }; - - enum fruit {orange, banana, apple, peach, pear}; - - typedef sequence lseq; - - typedef sequence bseq; - - struct a { - long l; - bseq y; - double d; - }; - - typedef sequence aseq; - - typedef sequence sseq; - typedef string str; - typedef long myLong; - - typedef long arr1[500], dd[2][3]; - - typedef erlang::term apa; - typedef erlang::port banan; - - typedef sequence etseq; - - struct s { - long l; - sequence sl; - }; - - struct es { - fruit f; - myLong l; - }; - - struct et { - erlang::term e; - long l; - }; - - - typedef sequence str1; - typedef string<12> str2; - typedef char str3[3]; - - typedef sequence sstr3; // sequence of string - typedef sequence ssstr3; // sequence of sequences of strings - - typedef long arr3[3]; // array of long - typedef sequence sarr3; // sequence of array - typedef sequence ssarr3; // sequence of sequnces of arrays of strings - - struct strRec{ - boolean bb; - string str4; - long str7[3][2]; - sequence str5; - string<12> str6; - str3 str8; - str2 str9; - str1 str10; - }; - - - struct dyn { - long l; - sequence sl; - }; - typedef dyn arr2[1][2]; - - - interface i { - - const short TestConst = 3; - - //arr2 suck(in arr2 x, out arr2 y ); - - ///////////////////////////////// attribute long l; - - // simple types - void void_test(); - long long_test(in long a, out long a1); - long long longlong_test(in long long a, out long long a1); - unsigned short ushort_test(in unsigned short a, out unsigned short a1); - unsigned long ulong_test(in unsigned long a, out unsigned long a1); - unsigned long long ulonglong_test(in unsigned long long a, out unsigned long long a1); - double double_test(in double a, out double a1); - char char_test(in char a, out char a1); - wchar wchar_test(in wchar a, out wchar a1); - octet octet_test(in octet a, out octet a1); - boolean bool_test(in boolean a, out boolean a1); - - // Seq. and struct tests - b struct_test(in b a, out b a1); - es struct2_test(in es a, out es a1); - //simple struct3_test(in simple x, out simple y); - bseq seq1_test(in bseq a, out bseq a1); - aseq seq2_test(in aseq a, out aseq a1); - lseq seq3_test(in lseq a, out lseq a1); - ssstr3 seq4_test(in ssstr3 a, out ssstr3 a1); - ssarr3 seq5_test(in ssarr3 a, out ssarr3 a1); - - // Array tests - arr1 array1_test(in arr1 a, out arr1 a1); - dd array2_test(in dd a, out dd a1); - - // enum test - fruit enum_test(in fruit a, out fruit a1); - - // string tests - string string1_test(in string a, out string a1); - wstring wstring1_test(in wstring a, out wstring a1); - sseq string2_test(in sseq a, out sseq a1); - str string3_test(in str a, out str a1); - strRec string4_test(in strRec a, out strRec a1); - - // Special erlang types - erlang::pid pid_test(in erlang::pid a, out erlang::pid a1); - erlang::port port_test(in erlang::port a, out erlang::port a1); - erlang::ref ref_test(in erlang::ref a, out erlang::ref a1); - erlang::term term_test(in erlang::term a, out erlang::term a1); - - // typedef test - long typedef_test(in apa a, in banan b, out apa a1, out banan b1); - - // inlined seq. test - s inline_sequence_test(in s a, out s a1); - - // term seq. test - etseq term_sequence_test(in etseq a, out etseq a1); - // term struct test - et term_struct_test(in et a, out et a1); - - }; - -}; diff --git a/lib/ic/test/erl_client_c_server_SUITE_data/erl_client.erl b/lib/ic/test/erl_client_c_server_SUITE_data/erl_client.erl deleted file mode 100644 index 139e2d7661..0000000000 --- a/lib/ic/test/erl_client_c_server_SUITE_data/erl_client.erl +++ /dev/null @@ -1,332 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2002-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(erl_client). - --export([void_test/2, long_test/2, longlong_test/2, ushort_test/2, - ulong_test/2, ulonglong_test/2, double_test/2, char_test/2, - wchar_test/2, octet_test/2, bool_test/2, struct_test/2, - struct2_test/2, seq1_test/2, seq2_test/2, seq3_test/2, - seq4_test/2, seq5_test/2, array1_test/2, array2_test/2, - enum_test/2, string1_test/2, wstring1_test/2, string2_test/2, - string3_test/2, string4_test/2, pid_test/2, port_test/2, - ref_test/2, term_test/2, typedef_test/2, - inline_sequence_test/2, term_sequence_test/2, - term_struct_test/2 - -]). - --include("m.hrl"). --include("m_i.hrl"). --include("oe_erl_c_test.hrl"). - -%%b -void_test(Node, Timeout) -> - Ret = m_i:void_test({olsson, Node}, Timeout), - Ret == void. % XXX Not documented -%%e - -%%b -long_test(Node, Timeout) -> - In = max_long(), - {Ret, Out} = m_i:long_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -longlong_test(Node, Timeout) -> - In = 65537, - {Ret, Out} = m_i:longlong_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -ushort_test(Node, Timeout) -> - In = max_ushort(), - {Ret, Out} = m_i:ushort_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -ulong_test(Node, Timeout) -> - In = max_ulong(), - {Ret, Out} = m_i:ulong_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -ulonglong_test(Node, Timeout) -> - In = 65537, - {Ret, Out} = m_i:ulonglong_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -double_test(Node, Timeout) -> - In = 37768.93, - {Ret, Out} = m_i:double_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -char_test(Node, Timeout) -> - In = 80, - {Ret, Out} = m_i:char_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -wchar_test(Node, Timeout) -> - In = 4097, - {Ret, Out} = m_i:wchar_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -octet_test(Node, Timeout) -> - In = 255, - {Ret, Out} = m_i:octet_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -bool_test(Node, Timeout) -> - In = false, - {Ret, Out} = m_i:bool_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -struct_test(Node, Timeout) -> - In = #m_b{l = max_long(), c = $a}, - {Ret, Out} = m_i:struct_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -struct2_test(Node, Timeout) -> - In = #m_es{ f = banana, l = max_long()}, - {Ret, Out} = m_i:struct2_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -seq1_test(Node, Timeout) -> - B1 = #m_b{l = max_long(), c = $a}, - B2 = #m_b{l = min_long(), c = $b}, - In = [B1, B2], - {Ret, Out} = m_i:seq1_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -seq2_test(Node, Timeout) -> - B = #m_b{l = max_long(), c = $a}, - A = #m_a{l = min_long(), y = [B, B], d = 4711.31}, - In = [A, A, A], - {Ret, Out} = m_i:seq2_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -seq3_test(Node, Timeout) -> - In = [max_long(), min_long(), max_long()], - {Ret, Out} = m_i:seq3_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -seq4_test(Node, Timeout) -> - In = [["hello", "all"], ["Erlang", "users", "!"]], - {Ret, Out} = m_i:seq4_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -seq5_test(Node, Timeout) -> - Arr3 = mk_array(3, max_long()), - In = [[Arr3, Arr3], [Arr3, Arr3, Arr3]], - {Ret, Out} = m_i:seq5_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -array1_test(Node, Timeout) -> - In = mk_array(500, min_long()), - {Ret, Out} = m_i:array1_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -array2_test(Node, Timeout) -> - In = mk_array(2, mk_array(3, min_long())), - {Ret, Out} = m_i:array2_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -enum_test(Node, Timeout) -> - In = banana, - {Ret, Out} = m_i:enum_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -string1_test(Node, Timeout) -> - In = "Developing Erlang applications is fun!", - {Ret, Out} = m_i:string1_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -wstring1_test(Node, Timeout) -> - In = [1047| "eveloping Erlang applications is fun!"], - {Ret, Out} = m_i:wstring1_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -string2_test(Node, Timeout) -> - In = ["Developing Erlang applications ", "is fun!"], - {Ret, Out} = m_i:string2_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -string3_test(Node, Timeout) -> - In = "Developing Erlang applications is fun!", - {Ret, Out} = m_i:string3_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -string4_test(Node, Timeout) -> - - In = #m_strRec{ - bb = true, - str4 = "Developing Erlang applications " - "is fun!", - str7 = mk_array(3, mk_array(2, max_long())), - str5 = [$a, $b, $c, $d, $e, $f], - str6 = "123456789012", - str8 = {$x, $y, $x}, - str9 = "123456789012", - str10 = [$a, $b, $c, $d, $e, $f] - }, - {Ret, Out} = m_i:string4_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -pid_test(Node, Timeout) -> - In = self(), - {Ret, Out} = m_i:pid_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -port_test(Node, Timeout) -> - In = get(port_test_port), - {Ret, Out} = m_i:port_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -ref_test(Node, Timeout) -> - In = make_ref(), - {Ret, Out} = m_i:ref_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -term_test(Node, Timeout) -> - In = {[a, b], 17, kalle}, - {Ret, Out} = m_i:term_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -typedef_test(Node, Timeout) -> - In1 = {nisse, [1, 2], olsson}, - In2 = get(port_test_port), - {Ret, Out1, Out2} = m_i:typedef_test({olsson, Node}, Timeout, In1, In2), - %% XXX Should check that Ret is an integer. - (Out1 == In1) and (Out2 == In2). -%%e - -%%b -inline_sequence_test(Node, Timeout) -> - In = #m_s{l = min_long(), sl = [max_long(), min_long()]}, - {Ret, Out} = m_i:inline_sequence_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -term_sequence_test(Node, Timeout) -> - In = lists:duplicate(17, {nisse, [1, 2], {kalle, olsson}}), - {Ret, Out} = m_i:term_sequence_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -term_struct_test(Node, Timeout) -> - In = #m_et{e = {nisse, ["abcde"], {kalle, olsson}}, l = 4711}, - {Ret, Out} = m_i:term_struct_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - - -%% Locals - -mk_array(Es) -> - list_to_tuple(Es). - -mk_array(N, E) -> - mk_array(lists:duplicate(N, E)). - -%% max_short() -> -%% power_of_two(15) - 1. -max_long() -> - power_of_two(31) - 1. -max_longlong() -> - power_of_two(63) - 1. -max_ushort() -> - power_of_two(16) - 1. -max_ulong() -> - power_of_two(32) - 1. -max_ulonglong() -> - power_of_two(64) - 1. - -%% min_short() -> -%% -power_of_two(15). -min_long() -> - -power_of_two(31). -%% min_longlong() -> -%% -power_of_two(63). -%% min_ushort() -> -%% 0. -%% min_ulong() -> -%% 0. -%% min_ulonglong() -> -%% 0. - -power_of_two(N) -> - round(math:pow(2, N)). - diff --git a/lib/ic/test/erl_client_c_server_proto_SUITE.erl b/lib/ic/test/erl_client_c_server_proto_SUITE.erl deleted file mode 100644 index 99eeed01ad..0000000000 --- a/lib/ic/test/erl_client_c_server_proto_SUITE.erl +++ /dev/null @@ -1,298 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% - -%%---------------------------------------------------------------------- -%% Purpose : Test suite for erl-client/c-server -%%---------------------------------------------------------------------- - - --module(erl_client_c_server_proto_SUITE). --include_lib("common_test/include/ct.hrl"). - --export([init_per_testcase/2, end_per_testcase/2,all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, void_test/1, - long_test/1, longlong_test/1, ushort_test/1, ulong_test/1, - ulonglong_test/1, double_test/1, char_test/1, wchar_test/1, - octet_test/1, bool_test/1, struct_test/1, struct2_test/1, - seq1_test/1, seq2_test/1, seq3_test/1, seq4_test/1, - seq5_test/1, array1_test/1, array2_test/1, enum_test/1, - string1_test/1, string2_test/1, string3_test/1, - string4_test/1, pid_test/1, port_test/1, ref_test/1, - term_test/1, typedef_test/1, inline_sequence_test/1, - term_sequence_test/1, term_struct_test/1, wstring1_test/1]). - --define(DEFAULT_TIMEOUT, 20000). --define(PORT_TIMEOUT, 15000). --define(CALL_TIMEOUT, 5000). - --define(C_SERVER_NODE_NAME, idl_c_server_test). - -%% Add/remove code path and watchdog before/after each test case. -%% -init_per_testcase(_Case, Config) -> - DataDir = proplists:get_value(data_dir, Config), - code:add_patha(DataDir), - - %% Since other test suites use the module m_i, we have - %% to make sure we are using the right m_i module. - code:purge(m_i), - code:load_file(m_i), - - WatchDog = test_server:timetrap(?DEFAULT_TIMEOUT), - [{watchdog, WatchDog}| Config]. - -end_per_testcase(_Case, Config) -> - DataDir = proplists:get_value(data_dir, Config), - code:del_path(DataDir), - WatchDog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(WatchDog). - -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> -[void_test, long_test, longlong_test, ushort_test, - ulong_test, ulonglong_test, double_test, char_test, - wchar_test, octet_test, bool_test, struct_test, - struct2_test, seq1_test, seq2_test, seq3_test, - seq4_test, seq5_test, array1_test, array2_test, - enum_test, string1_test, string2_test, string3_test, - string4_test, pid_test, port_test, ref_test, term_test, - typedef_test, inline_sequence_test, term_sequence_test, - term_struct_test, wstring1_test]. - -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -array1_test(Config) -> - do_test(array1_test, Config). - -array2_test(Config) -> - do_test(array2_test, Config). - -bool_test(Config) -> - do_test(bool_test, Config). - -char_test(Config) -> - do_test(char_test, Config). - -double_test(Config) -> - do_test(double_test, Config). - -enum_test(Config) -> - do_test(enum_test, Config). - -inline_sequence_test(Config) -> - do_test(inline_sequence_test, Config). - -longlong_test(Config) -> - do_test(longlong_test, Config). - -long_test(Config) -> - do_test(long_test, Config). - -octet_test(Config) -> - do_test(octet_test, Config). - -pid_test(Config) -> - do_test(pid_test, Config). - -port_test(Config) -> - do_test(port_test, Config). - -ref_test(Config) -> - do_test(ref_test, Config). - -seq1_test(Config) -> - do_test(seq1_test, Config). - -seq2_test(Config) -> - do_test(seq2_test, Config). - -seq3_test(Config) -> - do_test(seq3_test, Config). - -seq4_test(Config) -> - do_test(seq4_test, Config). - -seq5_test(Config) -> - do_test(seq5_test, Config). - -string1_test(Config) -> - do_test(string1_test, Config). - -string2_test(Config) -> - do_test(string2_test, Config). - -string3_test(Config) -> - do_test(string3_test, Config). - -string4_test(Config) -> - do_test(string4_test, Config). - -struct2_test(Config) -> - do_test(struct2_test, Config). - -struct_test(Config) -> - do_test(struct_test, Config). - -term_sequence_test(Config) -> - do_test(term_sequence_test, Config). - -term_struct_test(Config) -> - do_test(term_struct_test, Config). - -term_test(Config) -> - do_test(term_test, Config). - -typedef_test(Config) -> - do_test(typedef_test, Config). - -ulonglong_test(Config) -> - do_test(ulonglong_test, Config). - -ulong_test(Config) -> - do_test(ulong_test, Config). - -ushort_test(Config) -> - do_test(ushort_test, Config). - -void_test(Config) -> - do_test(void_test, Config). - -wchar_test(Config) -> - do_test(wchar_test, Config). - -wstring1_test(Config) -> - do_test(wstring1_test, Config). - - -do_test(Case, Config) -> - %% Trap exits - process_flag(trap_exit, true), - Node = atom_to_list(node()), - [_NodeName, HostName] = string:tokens(Node, "@"), - DataDir = proplists:get_value(data_dir, Config), - %% io:format("~p: data directory: ~p~n", [?MODULE, DataDir]), - Cookie = atom_to_list(erlang:get_cookie()), - ServerNodeName = atom_to_list(?C_SERVER_NODE_NAME), - %% Start C-server node as a port program. We wait for the node - %% to connect to us. - Cmd = filename:join([DataDir, "c_server"]) ++ - " -this-node-name " ++ ServerNodeName ++ - " -peer-node " ++ Node ++ - " -cookie " ++ Cookie, - Port = open_port({spawn, Cmd}, [exit_status, eof, stderr_to_stdout]), - ServerNode = list_to_atom(ServerNodeName ++ "@" ++ HostName), - Res = case wait_for_hidden_node(ServerNode) of - ok -> - %% Need a port for port_test and typedef_test - put(port_test_port, Port), - R = (catch erl_client:Case(ServerNode, ?CALL_TIMEOUT)), - case wait_for_completion(Port) of - {error, timeout} -> - kill_off_node(ServerNode); - _ -> - ok - end, - R; - {error, timeout} -> - case wait_for_completion(Port) of - {error, timeout} -> - kill_off_node(ServerNode); - _ -> - ok - end, - {error, timeout} - end, - process_flag(trap_exit, false), - true = Res. - - -%% Wait for eof *and* exit status, but return if exit status indicates -%% an error, or we have been waiting more than PORT_TIMEOUT seconds. -%% -wait_for_completion(Port) -> - wait_for_completion(Port, 0). - -wait_for_completion(Port, N) when N < 2 -> - receive - {Port, {data, Bytes}} -> - %% Relay output - io:format("~s", [Bytes]), - wait_for_completion(Port, N); - {Port, {exit_status, 0}} -> - wait_for_completion(Port, N + 1); - {Port, {exit_status, Status}} -> - {error, Status}; - {Port, eof} -> - wait_for_completion(Port, N + 1); - {'EXIT', Port, Reason} -> - io:format("Port exited with reason: ~w~n", [Reason]), - wait_for_completion(Port, N); - {'EXIT', From, Reason} -> - io:format("Got unexpected exit: ~p~n", [{'EXIT', From, Reason}]), - wait_for_completion(Port, N) - after ?PORT_TIMEOUT -> - {error, timeout} - end; -wait_for_completion(_, _) -> - ok. - -wait_for_hidden_node(Node) -> - Times = ?DEFAULT_TIMEOUT div 100, - wait_for_hidden_node(Node, Times, 100). - -wait_for_hidden_node(Node, Times, WaitTime) when Times > 0 -> - io:format("Waiting for hidden node: ~p~n", [Node]), - case lists:member(Node, erlang:nodes(hidden)) of - true -> - ok; - false -> - delay(WaitTime), - wait_for_hidden_node(Node, Times - 1, WaitTime) - end; -wait_for_hidden_node(_Node, _, _WaitTime) -> - {error, timeout}. - -kill_off_node(Node) -> - catch rpc:cast(Node, erlang, halt, [1]). - -delay(Time) -> - receive - after Time -> - ok - end. - - - - diff --git a/lib/ic/test/erl_client_c_server_proto_SUITE_data/Makefile.src b/lib/ic/test/erl_client_c_server_proto_SUITE_data/Makefile.src deleted file mode 100644 index 4ef7a74cde..0000000000 --- a/lib/ic/test/erl_client_c_server_proto_SUITE_data/Makefile.src +++ /dev/null @@ -1,160 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2004-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -# Makefile.src for erl_client_c_server test -# Note: This file *must* work for both Unix and Windows -# -# We use both `rm' (Unix) and `del' (Windows) for removing files, but -# with a `-' in front so that the error in not finding `rm' (`del') on -# Windows (Unix) is ignored. -# -# VxWorks? XXX -# - -.SUFFIXES: -.SUFFIXES: .c .h .erl .idl @obj@ .@EMULATOR@ - - -# Variables from ts: -# - -ERL_INCLUDE = @erl_include@ - -IC_INCLUDE_PATH = @ic_include_path@ -IC_LIB = @ic_lib@ - -ERL_INTERFACE_INCLUDE = @erl_interface_include@ -ERL_INTERFACE_LIB = @erl_interface_lib@ -ERL_INTERFACE_EILIB = @erl_interface_eilib@ -ERL_INTERFACE_THREADLIB = @erl_interface_threadlib@ -ERL_INTERFACE_SOCK_LIBS = @erl_interface_sock_libs@ - -CC = @CC@ -## XXX Should set warning flag with a DEBUG_FLAG -CFLAGS = @CFLAGS@ @DEFS@ -I$(ERL_INCLUDE) \ - -I$(IC_INCLUDE_PATH) -I$(ERL_INTERFACE_INCLUDE) - -LD = @LD@ -LDFLAGS = @CROSSLDFLAGS@ -LIBS = $(IC_LIB) $(ERL_INTERFACE_LIB) $(ERL_INTERFACE_EILIB) \ - $(ERL_INTERFACE_THREADLIB) @LIBS@ $(ERL_INTERFACE_SOCK_LIBS) -ERLC = erlc - -# Generated C header files -GEN_H_FILES = \ - m__s.h \ - m_i__s.h \ - oe_erl_c_test__s.h - -# Generated C files -GEN_C_FILES = \ - m__s.c \ - m_i__s.c \ - oe_code_m_a.c \ - oe_code_m_arr1.c \ - oe_code_m_arr2.c \ - oe_code_m_arr3.c \ - oe_code_m_aseq.c \ - oe_code_m_b.c \ - oe_code_m_bseq.c \ - oe_code_m_dd.c \ - oe_code_m_dyn.c \ - oe_code_m_dyn_sl.c \ - oe_code_m_es.c \ - oe_code_m_et.c \ - oe_code_m_etseq.c \ - oe_code_m_fruit.c \ - oe_code_m_lseq.c \ - oe_code_m_s.c \ - oe_code_m_s_sl.c \ - oe_code_m_sarr3.c \ - oe_code_m_simple.c \ - oe_code_m_ssarr3.c \ - oe_code_m_sseq.c \ - oe_code_m_ssstr3.c \ - oe_code_m_sstr3.c \ - oe_code_m_str1.c \ - oe_code_m_str3.c \ - oe_code_m_strRec.c \ - oe_code_m_strRec_str5.c \ - oe_code_m_strRec_str7.c \ - oe_erl_c_test__s.c - -GEN_HRL_FILES = \ - m.hrl \ - m_i.hrl \ - oe_erl_c_test.hrl - -GEN_ERL_FILES = \ - m.erl \ - m_arr2.erl \ - m_arr3.erl \ - m_i.erl \ - m_str3.erl \ - oe_erl_c_test.erl - -C_FILES = $(GEN_C_FILES) c_server.c callbacks.c - -OBJS = $(C_FILES:.c=@obj@) - -PGMS = c_server@exe@ - -ERL_FILES = $(GEN_ERL_FILES) erl_client.erl - -EBINS = $(ERL_FILES:.erl=.@EMULATOR@) - - -all: $(PGMS) $(EBINS) - -$(GEN_ERL_FILES) $(GEN_HRL_FILES): c_erl_test.built_erl -$(GEN_C_FILES) $(GEN_H_FILES): c_erl_test.built_c -$(OBJS): $(GEN_C_FILES) $(GEN_H_FILES) -$(EBINS): $(GEN_ERL_FILES) $(GEN_HRL_FILES) - -clean: - -rm -f $(OBJS) $(GEN_C_FILES) $(GEN_H_FILES) $(PGMS) \ - $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) \ - c_erl_test.built_erl c_erl_test.built_c - -del /F /Q $(OBJS) $(GEN_C_FILES) $(GEN_H_FILES) $(PGMS) \ - $(EBINS) $(GEN_ERL_FILES) $(GEN_HRL_FILES) \ - c_erl_test.built_erl c_erl_test.built_c - -$(PGMS): $(OBJS) - $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) - -c_erl_test.built_c: erl_c_test.idl - $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,c_server}" \ - "+{scoped_op_calls,true}" erl_c_test.idl - echo done > c_erl_test.built_c - -# If we have scoped operation calls for C, we must have that for -# Erlang as well, if we use the m_i.erl file for calling the server. - -c_erl_test.built_erl: erl_c_test.idl - $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,erl_genserv}" \ - "+{scoped_op_calls,true}" "+{timeout,true}" erl_c_test.idl - echo done > c_erl_test.built_erl - -.c@obj@: - $(CC) -c -o $*@obj@ $(CFLAGS) $< - -.erl.@EMULATOR@: - $(ERLC) -W -I $(IC_INCLUDE_PATH) $< - diff --git a/lib/ic/test/erl_client_c_server_proto_SUITE_data/c_server.c b/lib/ic/test/erl_client_c_server_proto_SUITE_data/c_server.c deleted file mode 100644 index e2ba5bd5b6..0000000000 --- a/lib/ic/test/erl_client_c_server_proto_SUITE_data/c_server.c +++ /dev/null @@ -1,300 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2004-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -/* C-server for test of IC. - * - * The C-node implemented here connects to its peer node, waits for - * one message, evaluates the message, returns an result message, and - * terminates. - * - * TODO: - * - * 1. XXX #includes for VxWorks, Windows - */ - -#include -#include - -#ifndef __WIN32__ -# include -#endif - -#include - -#ifdef __WIN32__ -# include -# include -#elif defined VXWORKS -# include -# include -#else -# include -#endif - -#include - -#ifdef __WIN32__ -# include -# include -#else -# include -# include -# include -# include -# include -#endif - -#include "ic.h" -#include "ei.h" -#include "erl_interface.h" -#include "eicode.h" -#include "m_i__s.h" -#include "m__s.h" - -#ifdef __WIN32__ -typedef struct { - long tv_sec; - long tv_usec; -} MyTimeval; -#else -typedef struct timeval MyTimeval; -#endif -static void my_gettimeofday(MyTimeval *tv); -static void showtime(MyTimeval *start, MyTimeval *stop); -static void usage(void); -static void done(int r); - -#define HOSTNAMESZ 255 -#define NODENAMESZ 512 -#define INBUFSZ 10 -#define OUTBUFSZ 0 -#define MAXTRIES 5 - -static char *progname; - -/* main */ -#ifdef VXWORKS -int c_server(int argc, char **argv) -#else -int main(int argc, char **argv) -#endif -{ - struct hostent *hp; - MyTimeval start, stop; - int i, fd, ires, tries; - CORBA_Environment *env; - char *this_node_name = NULL; - char *peer_node = NULL; - char *cookie = NULL; - char host[HOSTNAMESZ + 1]; - char this_node[NODENAMESZ + 1]; - erlang_msg msg; - int status, loop; - -#ifdef __WIN32__ - WORD wVersionRequested; - WSADATA wsaData; - - wVersionRequested = MAKEWORD(2, 0); - - if (WSAStartup(wVersionRequested, &wsaData) != 0) { - fprintf(stderr, "Could not load winsock2 v2.0 compatible DLL"); - exit(1); - } -#endif - - progname = argv[0]; - host[HOSTNAMESZ] = '\0'; - if (gethostname(host, HOSTNAMESZ + 1) < 0) { - fprintf(stderr, "Can't find own hostname\n"); - done(1); - } - if ((hp = gethostbyname(host)) == 0) { - fprintf(stderr, "Can't get ip address for host %s\n", host); - done(1); - } - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-help") == 0) { - usage(); - done(0); - } else if (strcmp(argv[i], "-this-node-name") == 0) { - i++; - this_node_name = argv[i]; - } else if (strcmp(argv[i], "-peer-node") == 0) { - i++; - peer_node = argv[i]; - } else if (strcmp(argv[i], "-cookie") == 0) { - i++; - cookie = argv[i]; - } else { - fprintf(stderr, "Error : invalid argument \"%s\"\n", argv[i]); - usage(); - done(1); - } - } - - if (this_node_name == NULL || peer_node == NULL || cookie == NULL) { - fprintf(stderr, "Error: missing option\n"); - usage(); - done(1); - } - - /* Behead hostname at first dot */ - for (i=0; host[i] != '\0'; i++) { - if (host[i] == '.') { host[i] = '\0'; break; } - } - sprintf(this_node, "%s@%s", this_node_name, host); - - fprintf(stderr, "c_server: this node: \"%s\"\n", this_node); - fprintf(stderr, "c_server: peer node: \"%s\"\n", peer_node); - - /* initialize erl_interface */ - erl_init(NULL, 0); - - for (tries = 0; tries < MAXTRIES; tries++) { - /* connect to peer node */ - ires = erl_connect_xinit(host, this_node_name, this_node, - (struct in_addr *)*hp->h_addr_list, - cookie, 0); - fprintf(stderr, "c_server: erl_connect_xinit(): %d\n", ires); - - fd = erl_connect(peer_node); - fprintf(stderr, "c_server: erl_connect(): %d\n", fd); - if (fd >= 0) - break; - fprintf(stderr, "c_server: cannot connect, retrying\n"); - } - if (fd < 0) { - fprintf(stderr, "c_server: cannot connect, exiting\n"); - done(1); - } - env = CORBA_Environment_alloc(INBUFSZ, OUTBUFSZ); - env->_fd = fd; - - status = 1; - loop = 1; - my_gettimeofday(&start); - while (status >= 0 && loop > 0) { - status = ei_receive_encoded(env->_fd, &env->_inbuf, &env->_inbufsz, - &msg, &env->_iin); - switch(status) { - case ERL_SEND: - case ERL_REG_SEND: - /* get result */ - m_i__switch(NULL, env); - switch(env->_major) { - case CORBA_NO_EXCEPTION: - break; - case CORBA_SYSTEM_EXCEPTION: - fprintf(stderr, "Request failure, reason : %s\n", - (char *) CORBA_exception_value(env)); - CORBA_exception_free(env); - break; - default: /* Should not happen */ - CORBA_exception_free(env); - break; - } - /* send back result data */ - if (env->_iout > 0) - ei_send_encoded(env->_fd, &env->_caller, env->_outbuf, - env->_iout); - loop = 0; - break; - case ERL_TICK: - break; - default: - if (status < 0) { - fprintf(stderr, "Status negative: %d\n", status); - loop = 0; - } - break; - } - } - my_gettimeofday(&stop); - showtime(&start, &stop); - - erl_close_connection(fd); - - CORBA_free(env->_inbuf); - CORBA_free(env->_outbuf); - CORBA_free(env); - if (status < 0) - done(-status); - else - done(0); -} - -static void usage() -{ - fprintf(stderr, "Usage: %s [-help] -this-node-name " - "-peer-node -cookie \n", progname); - fprintf(stderr, "Example:\n %s -this-node-name kalle " - "-peer-node olle@home -cookie oa678er\n", progname); -} - -static void done(int r) -{ -#ifdef __WIN32__ - WSACleanup(); -#endif - exit(r); -} - -static void showtime(MyTimeval *start, MyTimeval *stop) -{ - MyTimeval elapsed; - - elapsed.tv_sec = stop->tv_sec - start->tv_sec; - elapsed.tv_usec = stop->tv_usec - start->tv_usec; - while (elapsed.tv_usec < 0) { - elapsed.tv_sec -= 1; - elapsed.tv_usec += 1000000; - } - fprintf(stderr,"%ld.%06ld seconds\n",elapsed.tv_sec, elapsed.tv_usec); -} - - - -static void my_gettimeofday(MyTimeval *tv) -#ifdef __WIN32__ -#define EPOCH_JULIAN_DIFF 11644473600i64 -{ - SYSTEMTIME t; - FILETIME ft; - LONGLONG lft; - - GetSystemTime(&t); - SystemTimeToFileTime(&t, &ft); - memcpy(&lft, &ft, sizeof(lft)); - tv->tv_usec = (long) ((lft / 10i64) % 1000000i64); - tv->tv_sec = (long) ((lft / 10000000i64) - EPOCH_JULIAN_DIFF); -} -#elif defined VXWORKS -{ - int rate = sysClkRateGet(); /* Ticks per second */ - unsigned long ctick = tickGet(); - tv->tv_sec = ctick / rate; /* secs since reboot */ - tv->tv_usec = ((ctick - (tv->tv_sec * rate))*1000000)/rate; -} -#else -{ - gettimeofday(tv, NULL); -} -#endif diff --git a/lib/ic/test/erl_client_c_server_proto_SUITE_data/callbacks.c b/lib/ic/test/erl_client_c_server_proto_SUITE_data/callbacks.c deleted file mode 100644 index bed1dc2dd3..0000000000 --- a/lib/ic/test/erl_client_c_server_proto_SUITE_data/callbacks.c +++ /dev/null @@ -1,611 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2004-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include -#include -#ifndef __WIN32__ -# include -#endif -#include -#include -#include -#include -#include -#include "m_i__s.h" - - - -/* OK */ - -void my_void_test(CORBA_Object oe_obj, - CORBA_Environment *oe_env) -{ - /* printf("void test !\n"); */ -} - -m_i_void_test__rs* m_i_void_test__cb(CORBA_Object oe_obj, - CORBA_Environment *oe_env) -{ - return (m_i_void_test__rs*) (my_void_test); -} - - - -/* OK */ - -void my_long_test(CORBA_Object oe_obj, - long* a, - long* b, - long* c, - CORBA_Environment *oe_env) -{ - /* printf("long test !\n"); */ -} - - -m_i_long_test__rs* m_i_long_test__cb(CORBA_Object oe_obj, - long* a, - long* b, - long* c, - CORBA_Environment *oe_env) -{ - *a = *b; - *c = *b; - return (m_i_long_test__rs*) (my_long_test); -} - -/* OK */ - -void my_longlong_test(CORBA_Object oe_obj, - CORBA_long_long* a, - CORBA_long_long* b, - CORBA_long_long* c, - CORBA_Environment *oe_env) -{ - /* printf("long test !\n"); */ -} - -m_i_longlong_test__rs* m_i_longlong_test__cb(CORBA_Object oe_obj, - CORBA_long_long* a, - CORBA_long_long* b, - CORBA_long_long* c, - CORBA_Environment *oe_env) -{ - *a = *b; - *c = *b; - return (m_i_longlong_test__rs*) (my_longlong_test); -} - -/* OK */ -void my_ulong_test(CORBA_Object oe_obj, - unsigned long* a, - unsigned long* b, - unsigned long* c, - CORBA_Environment *oe_env) -{ - /* printf("ulong test !\n"); */ -} - -m_i_ulong_test__rs* m_i_ulong_test__cb(CORBA_Object oe_obj, - unsigned long* a, - unsigned long* b, - unsigned long* c, - CORBA_Environment *oe_env) -{ - *a = *b; - *c = *b; - return (m_i_ulong_test__rs*) (my_ulong_test); -} - -/* OK */ -void my_ulonglong_test(CORBA_Object oe_obj, - CORBA_unsigned_long_long* a, - CORBA_unsigned_long_long* b, - CORBA_unsigned_long_long* c, - CORBA_Environment *oe_env) -{ - /* printf("ulong test !\n"); */ -} - -m_i_ulonglong_test__rs* m_i_ulonglong_test__cb(CORBA_Object oe_obj, - CORBA_unsigned_long_long* a, - CORBA_unsigned_long_long* b, - CORBA_unsigned_long_long* c, - CORBA_Environment *oe_env) -{ - *a = *b; - *c = *b; - return (m_i_ulonglong_test__rs*) (my_ulonglong_test); -} - -m_i_ushort_test__rs* m_i_ushort_test__cb(CORBA_Object oe_obj, - unsigned short* a, - unsigned short* b, - unsigned short* c, - CORBA_Environment *oe_env) -{ - *a = *b; - *c = *b; - return (m_i_ushort_test__rs*) NULL; -} - - -/* OK */ -void my_double_test(CORBA_Object oe_obj, - double* a, - double* b, - double* c, - CORBA_Environment *oe_env) -{ - /* printf("double test !\n"); */ -} - -m_i_double_test__rs* m_i_double_test__cb(CORBA_Object oe_obj, - double* a, - double* b, - double* c, - CORBA_Environment *oe_env) -{ - *a = *b; - *c = *b; - return (m_i_double_test__rs*) (my_double_test); -} - -/* OK */ -m_i_char_test__rs* m_i_char_test__cb(CORBA_Object oe_obj, - char* a, - char* b, - char* c, - CORBA_Environment *oe_env) -{ - m_i_char_test__rs* rs = NULL; - - *a = *b; - *c = *b; - return rs; -} - - -/* OK */ -m_i_wchar_test__rs* m_i_wchar_test__cb(CORBA_Object oe_obj, - CORBA_wchar* a, - CORBA_wchar* b, - CORBA_wchar* c, - CORBA_Environment *oe_env) -{ - m_i_wchar_test__rs* rs = NULL; - - *a = *b; - *c = *b; - return rs; -} - -/* OK */ -m_i_octet_test__rs* m_i_octet_test__cb(CORBA_Object oe_obj, - char* a, - char* b, - char* c, - CORBA_Environment *oe_env) -{ - m_i_octet_test__rs* rs = NULL; - - *a = *b; - *c = *b; - return rs; -} - -/* OK */ -m_i_bool_test__rs* m_i_bool_test__cb(CORBA_Object oe_obj, - CORBA_boolean* a, - CORBA_boolean* b, - CORBA_boolean* c, - CORBA_Environment *oe_env) -{ - m_i_bool_test__rs* rs = NULL; - - *a = *b; - *c = *b; - return rs; -} - -/* OK */ -void my_struct_test(CORBA_Object oe_obj, - m_b* a, - m_b* b, - m_b* c, - CORBA_Environment *oe_env) -{ - /* printf("struct test !\n"); */ -} - -m_i_struct_test__rs* m_i_struct_test__cb(CORBA_Object oe_obj, - m_b* a, - m_b* b, - m_b* c, - CORBA_Environment *oe_env) -{ - *a = *b; - *c = *b; - return (m_i_struct_test__rs*) (my_struct_test); -} - -/* OK */ -m_i_struct2_test__rs* m_i_struct2_test__cb(CORBA_Object oe_obj, - m_es* a, - m_es* b, - m_es* c, - CORBA_Environment *oe_env) -{ - m_i_struct2_test__rs* rs = NULL; - - *a = *b; - *c = *b; - return rs; -} - -/* OK */ -/* XXX Commented out -m_i_struct3_test__rs* m_i_struct3_test__cb(CORBA_Object oe_obj, - m_simple* a, - m_simple* b, - m_simple* c, - CORBA_Environment *oe_env) -{ - m_i_struct3_test__rs* rs = NULL; - *a = *b; - *c = *b; - return rs; -} -*/ - -/* OK */ -m_i_seq1_test__rs* m_i_seq1_test__cb(CORBA_Object oe_obj, - m_bseq** a, - m_bseq* b, - m_bseq** c, - CORBA_Environment *oe_env) -{ - m_i_seq1_test__rs* rs = NULL; - - *a = b; - *c = b; - return rs; -} - - -/* OK */ -m_i_seq2_test__rs* m_i_seq2_test__cb(CORBA_Object oe_obj, - m_aseq** a, - m_aseq* b, - m_aseq** c, - CORBA_Environment *oe_env) -{ - m_i_seq2_test__rs* rs = NULL; - - *a = b; - *c = b; - return rs; -} - -/* OK */ -m_i_seq3_test__rs* m_i_seq3_test__cb(CORBA_Object oe_obj, - m_lseq** a, - m_lseq* b, - m_lseq** c, - CORBA_Environment *oe_env) -{ - m_i_seq3_test__rs* rs = NULL; - - *a = b; - *c = b; - return rs; -} - -/* OK */ -m_i_seq4_test__rs* m_i_seq4_test__cb(CORBA_Object oe_obj, - m_ssstr3** a, - m_ssstr3* b, - m_ssstr3** c, - CORBA_Environment *oe_env) -{ - m_i_seq4_test__rs* rs = NULL; - - *a = b; - *c = b; - return rs; -} - -/* OK */ -m_i_seq5_test__rs* m_i_seq5_test__cb(CORBA_Object oe_obj, - m_ssarr3** a, - m_ssarr3* b, - m_ssarr3** c, - CORBA_Environment *oe_env) -{ - m_i_seq5_test__rs* rs = NULL; - - *a = b; - *c = b; - return rs; -} - -/* OK */ -m_i_array1_test__rs* m_i_array1_test__cb(CORBA_Object oe_obj, - m_arr1 a, - m_arr1 b, - m_arr1 c, - CORBA_Environment *oe_env) -{ - int i; - m_i_array1_test__rs* rs = NULL; - - for (i = 0; i < 500; i++) { - a[i] = b[i]; - c[i] = b[i]; - } - return rs; -} - -/* OK */ -m_i_array2_test__rs* m_i_array2_test__cb(CORBA_Object oe_obj, - m_dd a, - m_dd b, - m_dd c, - CORBA_Environment *oe_env) -{ - int i,j; - m_i_array2_test__rs* rs = NULL; - - for (i = 0; i < 2; i++) - for (j = 0; j < 3; j++) { - a[i][j] = b[i][j]; - c[i][j] = b[i][j]; - } - return rs; -} - - -/* OK */ -m_i_enum_test__rs* m_i_enum_test__cb(CORBA_Object oe_obj, - m_fruit* a, - m_fruit* b, - m_fruit* c, - CORBA_Environment *oe_env) -{ - m_i_enum_test__rs* rs = NULL; - - *a = *b; - *c = *b; - return rs; -} - -/* OK */ -m_i_string1_test__rs* m_i_string1_test__cb(CORBA_Object oe_obj, - char ** a, - char * b, - char ** c, - CORBA_Environment *oe_env) -{ - m_i_string1_test__rs* rs = NULL; - - /*printf("\nString in ------> %s\n\n",b);*/ - *a = b; - *c = b; - return rs; -} - -/* OK */ -m_i_string2_test__rs* m_i_string2_test__cb(CORBA_Object oe_obj, - m_sseq** a, - m_sseq* b, - m_sseq** c, - CORBA_Environment *oe_env) -{ - m_i_string2_test__rs* rs = NULL; - - *a = b; - *c = b; - return rs; -} - -/* OK */ -m_i_string3_test__rs* m_i_string3_test__cb(CORBA_Object oe_obj, - char ** a, - char * b, - char ** c, - CORBA_Environment *oe_env) -{ - m_i_string3_test__rs* rs = NULL; - - *a = b; - *c = b; - return rs; -} - -m_i_string4_test__rs* m_i_string4_test__cb(CORBA_Object oe_obj, - m_strRec** a, - m_strRec* b, - m_strRec** c, - CORBA_Environment *oe_env) -{ - *a = b; - *c = b; - - return (m_i_string4_test__rs*) NULL; -} - -/* OK */ -m_i_wstring1_test__rs* m_i_wstring1_test__cb(CORBA_Object oe_obj, - CORBA_wchar ** a, - CORBA_wchar * b, - CORBA_wchar ** c, - CORBA_Environment *oe_env) -{ - int tmp; - m_i_wstring1_test__rs* rs = NULL; - - /*printf("\nString in ------> %s\n\n",b);*/ - - for(tmp = 0; tmp < 5; tmp++) - fprintf(stderr,"\np[%d] = %ld\n", tmp, b[tmp]); - *a = b; - *c = b; - return rs; -} - - -/* OK */ -m_i_pid_test__rs* m_i_pid_test__cb(CORBA_Object oe_obj, - erlang_pid* a, - erlang_pid* b, - erlang_pid* c, - CORBA_Environment *oe_env) -{ - m_i_pid_test__rs* rs = NULL; - - *a = *b; - *c = *b; - return rs; -} - -/* OK */ -m_i_port_test__rs* m_i_port_test__cb(CORBA_Object oe_obj, - erlang_port* a, - erlang_port* b, - erlang_port* c, - CORBA_Environment *oe_env) -{ - m_i_port_test__rs* rs = NULL; - - strcpy((*a).node,(*b).node); - (*a).id = (*b).id; - (*a).creation = 0; - - strcpy((*c).node,(*b).node); - (*c).id = (*b).id; - (*c).creation = 0; - return rs; -} - -/* OK */ -m_i_ref_test__rs* m_i_ref_test__cb(CORBA_Object oe_obj, - erlang_ref* a, - erlang_ref* b, - erlang_ref* c, - CORBA_Environment *oe_env) -{ - - m_i_ref_test__rs* rs = NULL; - - strcpy((*a).node,(*b).node); - /*(*a).id = (*b).id;*/ - (*a).len = (*b).len; - (*a).n[0] = (*b).n[0]; - (*a).n[1] = (*b).n[1]; - (*a).n[2] = (*b).n[2]; - (*a).creation = 0; - - strcpy((*c).node,(*b).node); - /*(*c).id = (*b).id;*/ - (*c).len = (*b).len; - (*c).n[0] = (*b).n[0]; - (*c).n[1] = (*b).n[1]; - (*c).n[2] = (*b).n[2]; - (*c).creation = 0; - return rs; -} - -/* OK */ -m_i_term_test__rs* m_i_term_test__cb(CORBA_Object oe_obj, - ETERM** a, - ETERM** b, - ETERM** c, - CORBA_Environment *oe_env) -{ - m_i_term_test__rs* rs = NULL; - - *a = *b; - *c = *b; - return rs; -} - -m_i_typedef_test__rs* m_i_typedef_test__cb(CORBA_Object oe_obj, - long* a, - ETERM** b, - erlang_port* c, - ETERM** d , - erlang_port* e, - CORBA_Environment *oe_env) -{ - m_i_typedef_test__rs* rs = NULL; - - *d = *b; - strcpy((*e).node,(*c).node); - (*e).id = (*c).id; - (*e).creation = 0; - *a = 4711; - return rs; -} - -/* OK */ -m_i_inline_sequence_test__rs* m_i_inline_sequence_test__cb( - CORBA_Object oe_obj, - m_s** a, - m_s* b, - m_s** c, - CORBA_Environment *oe_env) -{ - m_i_inline_sequence_test__rs* rs = NULL; - - *a = b; - *c = b; - return rs; -} - -/* OK */ -m_i_term_sequence_test__rs* m_i_term_sequence_test__cb( - CORBA_Object oe_obj, - m_etseq** a, - m_etseq* b, - m_etseq** c, - CORBA_Environment *oe_env) -{ - m_i_term_sequence_test__rs* rs = NULL; - - *a = b; - *c = b; - return rs; -} - - -/* OK */ -m_i_term_struct_test__rs* m_i_term_struct_test__cb(CORBA_Object oe_obj, - m_et* a, - m_et* b, - m_et* c, - CORBA_Environment *oe_env) -{ - m_i_term_struct_test__rs* rs = NULL; - - *a = *b; - *c = *b; - return rs; -} - diff --git a/lib/ic/test/erl_client_c_server_proto_SUITE_data/erl_c_test.idl b/lib/ic/test/erl_client_c_server_proto_SUITE_data/erl_c_test.idl deleted file mode 100644 index ef9556dd42..0000000000 --- a/lib/ic/test/erl_client_c_server_proto_SUITE_data/erl_c_test.idl +++ /dev/null @@ -1,175 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 2004-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -#include "erlang.idl" - - -const short TestConst = 1; - -module m { - - const short TestConst = 2; - - struct b { - long l; - char c; - }; - - struct simple { - long l; - b b_t; - }; - - enum fruit {orange, banana, apple, peach, pear}; - - typedef sequence lseq; - - typedef sequence bseq; - - struct a { - long l; - bseq y; - double d; - }; - - typedef sequence aseq; - - typedef sequence sseq; - typedef string str; - typedef long myLong; - - typedef long arr1[500], dd[2][3]; - - typedef erlang::term apa; - typedef erlang::port banan; - - typedef sequence etseq; - - struct s { - long l; - sequence sl; - }; - - struct es { - fruit f; - myLong l; - }; - - struct et { - erlang::term e; - long l; - }; - - - typedef sequence str1; - typedef string<12> str2; - typedef char str3[3]; - - typedef sequence sstr3; // sequence of string - typedef sequence ssstr3; // sequence of sequences of strings - - typedef long arr3[3]; // array of long - typedef sequence sarr3; // sequence of array - typedef sequence ssarr3; // sequence of sequnces of arrays of strings - - struct strRec{ - boolean bb; - string str4; - long str7[3][2]; - sequence str5; - string<12> str6; - str3 str8; - str2 str9; - str1 str10; - }; - - - struct dyn { - long l; - sequence sl; - }; - typedef dyn arr2[1][2]; - - - interface i { - - const short TestConst = 3; - - //arr2 suck(in arr2 x, out arr2 y ); - - ///////////////////////////////// attribute long l; - - // simple types - void void_test(); - long long_test(in long a, out long a1); - long long longlong_test(in long long a, out long long a1); - unsigned short ushort_test(in unsigned short a, out unsigned short a1); - unsigned long ulong_test(in unsigned long a, out unsigned long a1); - unsigned long long ulonglong_test(in unsigned long long a, out unsigned long long a1); - double double_test(in double a, out double a1); - char char_test(in char a, out char a1); - wchar wchar_test(in wchar a, out wchar a1); - octet octet_test(in octet a, out octet a1); - boolean bool_test(in boolean a, out boolean a1); - - // Seq. and struct tests - b struct_test(in b a, out b a1); - es struct2_test(in es a, out es a1); - //simple struct3_test(in simple x, out simple y); - bseq seq1_test(in bseq a, out bseq a1); - aseq seq2_test(in aseq a, out aseq a1); - lseq seq3_test(in lseq a, out lseq a1); - ssstr3 seq4_test(in ssstr3 a, out ssstr3 a1); - ssarr3 seq5_test(in ssarr3 a, out ssarr3 a1); - - // Array tests - arr1 array1_test(in arr1 a, out arr1 a1); - dd array2_test(in dd a, out dd a1); - - // enum test - fruit enum_test(in fruit a, out fruit a1); - - // string tests - string string1_test(in string a, out string a1); - wstring wstring1_test(in wstring a, out wstring a1); - sseq string2_test(in sseq a, out sseq a1); - str string3_test(in str a, out str a1); - strRec string4_test(in strRec a, out strRec a1); - - // Special erlang types - erlang::pid pid_test(in erlang::pid a, out erlang::pid a1); - erlang::port port_test(in erlang::port a, out erlang::port a1); - erlang::ref ref_test(in erlang::ref a, out erlang::ref a1); - erlang::term term_test(in erlang::term a, out erlang::term a1); - - // typedef test - long typedef_test(in apa a, in banan b, out apa a1, out banan b1); - - // inlined seq. test - s inline_sequence_test(in s a, out s a1); - - // term seq. test - etseq term_sequence_test(in etseq a, out etseq a1); - // term struct test - et term_struct_test(in et a, out et a1); - - }; - -}; diff --git a/lib/ic/test/erl_client_c_server_proto_SUITE_data/erl_client.erl b/lib/ic/test/erl_client_c_server_proto_SUITE_data/erl_client.erl deleted file mode 100644 index 5fe80cdd7a..0000000000 --- a/lib/ic/test/erl_client_c_server_proto_SUITE_data/erl_client.erl +++ /dev/null @@ -1,332 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% --module(erl_client). - --export([void_test/2, long_test/2, longlong_test/2, ushort_test/2, - ulong_test/2, ulonglong_test/2, double_test/2, char_test/2, - wchar_test/2, octet_test/2, bool_test/2, struct_test/2, - struct2_test/2, seq1_test/2, seq2_test/2, seq3_test/2, - seq4_test/2, seq5_test/2, array1_test/2, array2_test/2, - enum_test/2, string1_test/2, wstring1_test/2, string2_test/2, - string3_test/2, string4_test/2, pid_test/2, port_test/2, - ref_test/2, term_test/2, typedef_test/2, - inline_sequence_test/2, term_sequence_test/2, - term_struct_test/2 - -]). - --include("m.hrl"). --include("m_i.hrl"). --include("oe_erl_c_test.hrl"). - -%%b -void_test(Node, Timeout) -> - Ret = m_i:void_test({olsson, Node}, Timeout), - Ret == void. % XXX Not documented -%%e - -%%b -long_test(Node, Timeout) -> - In = max_long(), - {Ret, Out} = m_i:long_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -longlong_test(Node, Timeout) -> - In = 65537, - {Ret, Out} = m_i:longlong_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -ushort_test(Node, Timeout) -> - In = max_ushort(), - {Ret, Out} = m_i:ushort_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -ulong_test(Node, Timeout) -> - In = max_ulong(), - {Ret, Out} = m_i:ulong_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -ulonglong_test(Node, Timeout) -> - In = 65537, - {Ret, Out} = m_i:ulonglong_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -double_test(Node, Timeout) -> - In = 37768.93, - {Ret, Out} = m_i:double_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -char_test(Node, Timeout) -> - In = 80, - {Ret, Out} = m_i:char_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -wchar_test(Node, Timeout) -> - In = 4097, - {Ret, Out} = m_i:wchar_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -octet_test(Node, Timeout) -> - In = 255, - {Ret, Out} = m_i:octet_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -bool_test(Node, Timeout) -> - In = false, - {Ret, Out} = m_i:bool_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -struct_test(Node, Timeout) -> - In = #m_b{l = max_long(), c = $a}, - {Ret, Out} = m_i:struct_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -struct2_test(Node, Timeout) -> - In = #m_es{ f = banana, l = max_long()}, - {Ret, Out} = m_i:struct2_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -seq1_test(Node, Timeout) -> - B1 = #m_b{l = max_long(), c = $a}, - B2 = #m_b{l = min_long(), c = $b}, - In = [B1, B2], - {Ret, Out} = m_i:seq1_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -seq2_test(Node, Timeout) -> - B = #m_b{l = max_long(), c = $a}, - A = #m_a{l = min_long(), y = [B, B], d = 4711.31}, - In = [A, A, A], - {Ret, Out} = m_i:seq2_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -seq3_test(Node, Timeout) -> - In = [max_long(), min_long(), max_long()], - {Ret, Out} = m_i:seq3_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -seq4_test(Node, Timeout) -> - In = [["hej", "hopp"], ["ditt", "feta", "nylle"]], - {Ret, Out} = m_i:seq4_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -seq5_test(Node, Timeout) -> - Arr3 = mk_array(3, max_long()), - In = [[Arr3, Arr3], [Arr3, Arr3, Arr3]], - {Ret, Out} = m_i:seq5_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -array1_test(Node, Timeout) -> - In = mk_array(500, min_long()), - {Ret, Out} = m_i:array1_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -array2_test(Node, Timeout) -> - In = mk_array(2, mk_array(3, min_long())), - {Ret, Out} = m_i:array2_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -enum_test(Node, Timeout) -> - In = banana, - {Ret, Out} = m_i:enum_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -string1_test(Node, Timeout) -> - In = "Die Paula muss beim Tango immer weinen", - {Ret, Out} = m_i:string1_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -wstring1_test(Node, Timeout) -> - In = [1047| "ie Paula muss beim Tango immer weinen"], - {Ret, Out} = m_i:wstring1_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -string2_test(Node, Timeout) -> - In = ["Lass doch die Blumen,", "Konrad!"], - {Ret, Out} = m_i:string2_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -string3_test(Node, Timeout) -> - In = "Seeman, lass uns freuden!", - {Ret, Out} = m_i:string3_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -string4_test(Node, Timeout) -> - - In = #m_strRec{ - bb = true, - str4 = "Paula war zu Hause in ihrem Stadtchen als die beste Tanzerin" - "bekannt", - str7 = mk_array(3, mk_array(2, max_long())), - str5 = [$a, $b, $c, $d, $e, $f], - str6 = "123456789012", - str8 = {$x, $y, $x}, - str9 = "123456789012", - str10 = [$a, $b, $c, $d, $e, $f] - }, - {Ret, Out} = m_i:string4_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -pid_test(Node, Timeout) -> - In = self(), - {Ret, Out} = m_i:pid_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -port_test(Node, Timeout) -> - In = get(port_test_port), - {Ret, Out} = m_i:port_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -ref_test(Node, Timeout) -> - In = make_ref(), - {Ret, Out} = m_i:ref_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -term_test(Node, Timeout) -> - In = {[a, b], 17, kalle}, - {Ret, Out} = m_i:term_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -typedef_test(Node, Timeout) -> - In1 = {nisse, [1, 2], olsson}, - In2 = get(port_test_port), - {Ret, Out1, Out2} = m_i:typedef_test({olsson, Node}, Timeout, In1, In2), - %% XXX Should check that Ret is an integer. - (Out1 == In1) and (Out2 == In2). -%%e - -%%b -inline_sequence_test(Node, Timeout) -> - In = #m_s{l = min_long(), sl = [max_long(), min_long()]}, - {Ret, Out} = m_i:inline_sequence_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -term_sequence_test(Node, Timeout) -> - In = lists:duplicate(17, {nisse, [1, 2], {kalle, olsson}}), - {Ret, Out} = m_i:term_sequence_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - -%%b -term_struct_test(Node, Timeout) -> - In = #m_et{e = {nisse, ["abcde"], {kalle, olsson}}, l = 4711}, - {Ret, Out} = m_i:term_struct_test({olsson, Node}, Timeout, In), - (Ret == In) and (Out == In). -%%e - - -%% Locals - -mk_array(Es) -> - list_to_tuple(Es). - -mk_array(N, E) -> - mk_array(lists:duplicate(N, E)). - -%% max_short() -> -%% power_of_two(15) - 1. -max_long() -> - power_of_two(31) - 1. -max_longlong() -> - power_of_two(63) - 1. -max_ushort() -> - power_of_two(16) - 1. -max_ulong() -> - power_of_two(32) - 1. -max_ulonglong() -> - power_of_two(64) - 1. - -%% min_short() -> -%% -power_of_two(15). -min_long() -> - -power_of_two(31). -%% min_longlong() -> -%% -power_of_two(63). -%% min_ushort() -> -%% 0. -%% min_ulong() -> -%% 0. -%% min_ulonglong() -> -%% 0. - -power_of_two(N) -> - round(math:pow(2, N)). - diff --git a/lib/ic/test/erl_client_c_server_proto_SUITE_data/my.c b/lib/ic/test/erl_client_c_server_proto_SUITE_data/my.c deleted file mode 100644 index aff03253d6..0000000000 --- a/lib/ic/test/erl_client_c_server_proto_SUITE_data/my.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2004-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -#include "ic.h" -#include "m_i.h" - -int my_prepare_request_decoding(CORBA_Environment *env) -{ - return oe_prepare_request_decoding(env); -} - -int my_prepare_reply_encoding(CORBA_Environment *env) -{ - return oe_prepare_reply_encoding(env); -} - - - diff --git a/lib/ic/test/ic.cover b/lib/ic/test/ic.cover deleted file mode 100644 index 5a679c8b6f..0000000000 --- a/lib/ic/test/ic.cover +++ /dev/null @@ -1,2 +0,0 @@ -{incl_app,ic,details}. - diff --git a/lib/ic/test/ic.spec b/lib/ic/test/ic.spec deleted file mode 100644 index 22905dcee4..0000000000 --- a/lib/ic/test/ic.spec +++ /dev/null @@ -1 +0,0 @@ -{suites,"../ic_test",all}. diff --git a/lib/ic/test/ic.spec.vxworks b/lib/ic/test/ic.spec.vxworks deleted file mode 100644 index b15260ab70..0000000000 --- a/lib/ic/test/ic.spec.vxworks +++ /dev/null @@ -1,2 +0,0 @@ -{topcase, {dir, "../ic_test"}}. -{skip,{ic_pp_SUITE,"Uses gcc"}}. diff --git a/lib/ic/test/ic_SUITE.erl b/lib/ic/test/ic_SUITE.erl deleted file mode 100644 index 42c1dbb415..0000000000 --- a/lib/ic/test/ic_SUITE.erl +++ /dev/null @@ -1,894 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%%---------------------------------------------------------------------- -%%% Purpose : Test suite for the IDL compiler -%%%---------------------------------------------------------------------- - --module(ic_SUITE). --include_lib("common_test/include/ct.hrl"). - --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2]). - - --include_lib("orber/src/orber_ifr.hrl"). --include_lib("orber/src/ifr_objects.hrl"). --include_lib("orber/include/ifr_types.hrl"). - - -%% The type cases --export([ type_norm/1]). - -%% The syntax case --export([]). --export([syntax1/1, syntax2/1, syntax3/1, syntax4/1, syntax5/1, syntax6/1]). - -%% The constant cases --export([]). --export([const_norm/1, const_bad_tk/1, const_bad_type/1]). --export([const_bad_comb/1]). - -%% The union cases --export([]). --export([union_norm/1, union_type/1, union_mult_err/1, union_case_mult/1]). --export([union_default/1]). - -%% The enum cases --export([]). --export([enum_norm/1]). - -%% The struct cases --export([]). --export([struct_norm/1]). - -%% The oneway cases --export([]). --export([oneway_norm/1, oneway_raises/1, oneway_out/1, oneway_void/1, oneway_followed/1]). - -%% The attributes cases --export([]). --export([attr_norm/1]). - -%% The raises registration case --export([raises_reg/1]). - - -%% The typeID case - -%% general stuff --export([]). --export([typeid/1, undef_id/1, dir/1, nasty_names/1, coss/1, mult_ids/1]). --export([forward/1, include/1, app_test/1]). - -%% inheritance stuff --export([ inherit_norm/1, inherit_warn/1, inherit_err/1]). - -%% Standard options to the ic compiler, NOTE unholy use of OutDir - --define(OUT(X), filename:join([proplists:get_value(priv_dir, Config), gen, to_list(X)])). - - -%% Top of cases - -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - [app_test, {group, const}, {group, union}, - {group, enum}, {group, attr}, {group, type}, - {group, struct}, {group, general}, {group, inherit}, - {group, oneway}, {group, syntax}, raises_reg]. - -groups() -> - [{const, [], - [const_norm, const_bad_tk, const_bad_type, - const_bad_comb]}, - {union, [], - [union_norm, union_type, union_mult_err, - union_case_mult, union_default]}, - {enum, [], [enum_norm]}, {struct, [], [struct_norm]}, - {general, [], - [typeid, undef_id, mult_ids, forward, include, - nasty_names]}, - {inherit, [], - [inherit_norm, inherit_warn, inherit_err]}, - {oneway, [], - [oneway_norm, oneway_out, oneway_raises, oneway_void, - oneway_followed]}, - {attr, [], [attr_norm]}, {type, [], [type_norm]}, - {syntax, [], - [syntax1, syntax2, syntax3, syntax4, syntax5, syntax6]}]. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -app_test(_Config) -> - ok=test_server:app_test(ic), - ok. - -%%--------------------------------------------------------------------- -%% -%% Test of constant expressions. -%% - -%% Checks normal constant types and values -const_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(const_norm), - File = filename:join(DataDir, c_norm), - ok = ic:gen(File, stdopts(OutDir)), - {ok, []} = ic:gen(File, stdopts(OutDir)++[silent2]), - ok = compile(OutDir, const_norm_files()), - ok. - -%% Checks when the constant value doesn't match the declared type -const_bad_tk(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(slask), - File = filename:join(DataDir, c_err1), - error = ic:gen(File, stdopts(OutDir)), - {error, [], R} = - ic:gen(File, stdopts(OutDir)++[silent2]), - check_errors(18, bad_tk_match, R), - ok. - -%% Checks operands of ops are of correct type -const_bad_type(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(slask), - File = filename:join(DataDir, c_err2), - error = ic:gen(File, stdopts(OutDir)), - {error, [], R} = - ic:gen(File, stdopts(OutDir)++[silent2]), - check_errors(4, bad_type, R), - ok. - -%% Checks operands of ops are of conflicting types -const_bad_comb(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(slask), - File = filename:join(DataDir, c_err3), - error = ic:gen(File, stdopts(OutDir)), - {error, [], R} = - ic:gen(File, stdopts(OutDir)++[silent2]), - check_errors(3, bad_type_combination, R), - ok. - - -%% Checks that normal union declarations works. -union_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(union_norm), - File = filename:join(DataDir, u_norm), - - ok = ic:gen(File, stdopts(OutDir)), - {ok, []} = ic:gen(File, stdopts(OutDir)++[silent2]), - ok = compile(OutDir, union_norm_files()), - ok. - - -%% Checks OTP-2007 -%% Checks that default cases are correct in type code. -union_default(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(union_default), - File = filename:join(DataDir, u_default), - - ok = ic:gen(File, stdopts(OutDir)), - {ok, []} = ic:gen(File, stdopts(OutDir)++[silent2]), - ok = compile(OutDir, union_default_files(), [load]), - TkList = i1:oe_get_interface(), - check_label("op0", 0, TkList), - check_label("op1", 1, TkList), - check_label("op2", 2, TkList), - check_label("op3", -1, TkList), - ok. - -check_label(Id, N, List) -> - case lists:keysearch(Id, 1, List) of - {value, {_, {{_, _, _, _, D, L}, _, _}}} -> - if D /= N -> - test_server:fail({bad_default_num, D, N}); - D /= -1 -> - case lists:nth(D+1, L) of - T when element(1, T) == default -> - ok; - _Que -> - test_server:fail({bad_default_list, D, L}) - end; - true -> - %% D = N = -1, just check that there is no default label - case lists:keysearch(default, 1, L) of - false -> - ok; - _ -> - test_server:fail({bad_default_label, D, L}) - end - end; - _ -> - test_server:fail({'no_such_op!', Id, List}) - end. - -%% Checks that errors are detected. Check that mismatch between case -%% value and declared discriminator type is detected. -union_type(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(slask), - File = filename:join(DataDir, u_type), - error = ic:gen(File, stdopts(OutDir)), - {error, [], R} = - ic:gen(File, stdopts(OutDir)++[silent2]), - check_errors(28, bad_case_type, R), - ok. - - -%% Check that multiple declared declarators are caught. -%% Also check that if the discriminator is an enum, then the enum name -%% must not be used as a declarator in the union switch (declarator -%% as opposed to label). -union_mult_err(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(slask), - File = filename:join(DataDir, u_mult), - error = ic:gen(File, stdopts(OutDir)), - {error, [], R} = - ic:gen(File, stdopts(OutDir)++[silent2]), - check_errors(8, multiply_defined, R), - ok. - -%% Check that multiply defined case labels are found in the -%% correct order -union_case_mult(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(slask), - File = filename:join(DataDir, u_case_mult), - error = ic:gen(File, stdopts(OutDir)), - {error, [], R} = - ic:gen(File, stdopts(OutDir)++[silent2]), - check_errors(7, multiple_cases, R), - ok. - - -%%-------------------------------------------------------------------- -%% -%% Enum cases -%% -%%Checks that normal enum declarations works. -enum_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(enum_norm), - File = filename:join(DataDir, enum), - - ok = ic:gen(File, stdopts(OutDir)), - {ok, []} = ic:gen(File, stdopts(OutDir)++[silent2]), - ok = compile(OutDir, enum_norm_files()), - ok. - - -%%-------------------------------------------------------------------- -%% -%% Struct cases -%% -%% Checks that normal struct declarations works. -struct_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(struct_norm), - File = filename:join(DataDir, struct), - - ok = ic:gen(File, stdopts(OutDir)), - {ok, []} = ic:gen(File, stdopts(OutDir)++[silent2]), - ok = compile(OutDir, struct_norm_files()), - Mod = ridiculous_name_to_avoid_clash_svenne, - TestFile = filename:join(OutDir, Mod), - ok = gen_struct_file(TestFile, Mod), - ok = compile(OutDir, [Mod], [load]), -%% {ok, Mod, []} = compile:file(TestFile, -%% [{i, OutDir}, {outdir, OutDir}, -%% return, load]), - ok = Mod:test(), - ok. - - -%%-------------------------------------------------------------------- -%% -%% General cases -%% - -%% coss (add sometimes, takes 440 seconds!) -%% Check that type id's are generated correctly -typeid(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(typeid), - File = filename:join(DataDir, typeid), - - ok = ic:gen(File, stdopts(OutDir)), - {ok, []} = ic:gen(File, stdopts(OutDir)++[silent2]), - ok = compile(OutDir, typeid_files(), [load]), - "IDL:I1:1.0" = 'I1':'typeID'(), - "IDL:M1/I1:1.0" = 'M1_I1':'typeID'(), - "IDL:M2/M1/I1:1.0" = 'M2_M1_I1':'typeID'(), - "IDL:M3/M2/M1/I1:1.0" = 'M3_M2_M1_I1':'typeID'(), - ok. - - -%%% This test case is removed because there's no way to test this from -%%% an automated test suite. -%% Check that relative directories work, absolute is used in -%% all other cases in the suite. -dir(Config) when is_list(Config) -> - ok; -dir(Config) -> - DataDir = proplists:get_value(data_dir, Config), - - %% Needs a unique directory (any better way?) - OutDir = mk_unique("oe_the_dir"), - - %% More unique names - File = filename:join(DataDir, mk_unique("oe_the_file")), - Const = mk_unique("oe_the_constant"), - Mod = list_to_atom(File), - Func = list_to_atom(Const), - - %% Generate a unique IDL file with a single constant - gen_file(File, Const), - - ok = ic:gen(File, stdopts(OutDir)), - ok = compile(OutDir, [load]), - 19955 = Mod:Func(), - {ok, []} = ic:gen(File, stdopts(OutDir)++[silent2]), - ok = compile(OutDir, [load]), - 19955 = Mod:Func(), - - ok = ic:gen(File), -%%% ok = compile(".", [load]), - ok. - -%% Check that various undefied id's are detected correctly -undef_id(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(slask), - File = filename:join(DataDir, undef_id), - error = ic:gen(File, stdopts(OutDir)), - {error, [], R} = - ic:gen(File, stdopts(OutDir)++[silent2]), - check_errors(16, tk_not_found, R), - ok. - -%% Check that multiply defined ids are caught. -mult_ids(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(slask), - File = filename:join(DataDir, mult_ids), - error = ic:gen(File, stdopts(OutDir)), - {error, [], R} = - ic:gen(File, stdopts(OutDir)++[silent2]), - check_errors(22, multiply_defined, R), - ok. - - -%% Check that various nasty names can be generated. -%% Try to provoke name clashes and name conflicts with -%% Erlang and IDL -nasty_names(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(nasty_names), - File = filename:join(DataDir, nasty), - - ok = ic:gen(File, stdopts(OutDir)), - {ok, []} = ic:gen(File, stdopts(OutDir)++[silent2]), - ok = compile(OutDir, nasty_names_files(), [load]), - ok. - -%% Check that the Coss standard specification works. -coss(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(coss), - File = filename:join(DataDir, 'Coss'), - - ok = ic:gen(File, stdopts(OutDir)), - {ok, [_W1]} = ic:gen(File, stdopts(OutDir)++[silent2]), - ok = compile(OutDir, []), - ok. - -%% Check that forward declaratios work. -forward(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(forward), - File = filename:join(DataDir, forward), - - ok = ic:gen(File, stdopts(OutDir)), - {ok, []} = ic:gen(File, stdopts(OutDir)++[silent2]), - ok = compile(OutDir, forward_files(), [load]), - ok. - -%% Check that various undefied id's are detected correctly -include(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(slask), - File = filename:join(DataDir, include), - error = ic:gen(File, stdopts(OutDir)++[{preproc_flags,"-I" ++ DataDir}]), - {error, [], R} = - ic:gen(File, stdopts(OutDir)++[{preproc_flags,"-I" ++ DataDir},silent2]), - case lists:map(fun(D) -> - filename:rootname(filename:basename(element(3, D))) - end, - lists:sort(R)) of - ["include", - "include2", - "include2", - "include3"] -> - ok; - RRR -> - test_server:fail({bad_include_file, RRR}) - end, - ok. - - - - -%%-------------------------------------------------------------------- -%% -%% Inhertit cases -%% - -%% Checks that normal inheritance works. -inherit_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(inherit_norm), - File = filename:join(DataDir, inherit), - - ok = ic:gen(File, stdopts(OutDir)), - {ok, _Ws} = ic:gen(File, stdopts(OutDir)++[silent2]), - ok = compile(OutDir, inherit_norm_files(), [load]), - - %% Now check constant values: - 9 = m1_I1:c1(), - - 9 = m1_I2:c1(), - 14 = m1_I2:c2(), - 27 = m1_I2:c3(), - - 50 = m1_I3:c1(), - 14 = m1_I3:c2(), - 27 = m1_I3:c3(), - 91 = m1_I3:c4(), - 100 = m1_I3:c5(), - ok. - -%% Check that various inheritance shadowing is detected -inherit_warn(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(slask), - File = filename:join(DataDir, inherit_warn), - ok = ic:gen(File, stdopts(OutDir)), - {ok, R} = - ic:gen(File, stdopts(OutDir)++[silent2]), - check_errors(7, inherit_name_shadow, R), - ok. - -%% Check that various inheritance errors is detected -inherit_err(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(slask), - File = filename:join(DataDir, inherit_err), - error = ic:gen(File, stdopts(OutDir)), - {error, _Ws, R} = - ic:gen(File, stdopts(OutDir)++[silent2]), - check_errors(21, inherit_name_collision, R), - ok. - - -%% Checks that normal oneway operations works. -oneway_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(oneway_norm), - File = filename:join(DataDir, one), - - ok = ic:gen(File, stdopts(OutDir)), - ok = compile(OutDir, oneway_norm_files(), [load]), - {ok, []} = ic:gen(File, stdopts(OutDir)++[silent2]), - ok = compile(OutDir, oneway_norm_files(), [load]), - ok. - -%% Check that non-void oneways are detected. -oneway_void(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(slask), - File = filename:join(DataDir, one_void), - error = ic:gen(File, stdopts(OutDir)), - {error, [], R} = - ic:gen(File, stdopts(OutDir)++[silent2]), - check_errors(2, bad_oneway_type, R), - ok. - -%% Check that oneways cannot raise exceptions. -oneway_raises(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(slask), - File = filename:join(DataDir, one_raises), - error = ic:gen(File, stdopts(OutDir)), - {error, [], R} = - ic:gen(File, stdopts(OutDir)++[silent2]), - check_errors(3, oneway_raises, R), - ok. - -%% Check that illegal out parameters are detected -oneway_out(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(slask), - File = filename:join(DataDir, one_out), - error = ic:gen(File, stdopts(OutDir)), - {error, [], R} = - ic:gen(File, stdopts(OutDir)++[silent2]), - check_errors(2, oneway_outparams, R), - ok. - -%% Checks that normal oneways, followed by other operations. -oneway_followed(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(oneway_followed), - File = filename:join(DataDir, one_followed), - - ok = ic:gen(File, stdopts(OutDir)), - ok = compile(OutDir, oneway_followed_files(), [load]), - {ok, []} = ic:gen(File, stdopts(OutDir)++[silent2]), - ok = compile(OutDir, oneway_followed_files(), [load]), - ok. - - -%% Checks that normal attr operations works. -attr_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(attr_norm), - File = filename:join(DataDir, attr), - - ok = ic:gen(File, stdopts(OutDir)), - ok = compile(OutDir, attr_norm_files(), [load]), - {ok, []} = ic:gen(File, stdopts(OutDir)++[silent2]), - ok = compile(OutDir, attr_norm_files(), [load]), - ok. - - -%% Checks all types are handled. -type_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(type_norm), - File = filename:join(DataDir, type), - - ok = ic:gen(File, stdopts(OutDir)), - ok = compile(OutDir, type_norm_files(), [load]), - {ok, []} = ic:gen(File, stdopts(OutDir)++[silent2]), - ok = compile(OutDir, type_norm_files(), [load]), - ok. - -syntax1(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(slask), - File = filename:join(DataDir, syntax1), - - error = ic:gen(File, stdopts(OutDir)), - {error, [], R} = - ic:gen(File, stdopts(OutDir)++[silent2]), - check_errors(1, parse_error, R), - ok. - -syntax2(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(slask), - File = filename:join(DataDir, syntax2), - - error = ic:gen(File, stdopts(OutDir)), - {error, [], R} = - ic:gen(File, stdopts(OutDir)++[silent2]), - check_errors(1, parse_error, R), - ok. - -syntax3(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(slask), - File = filename:join(DataDir, syntax3), - - error = ic:gen(File, stdopts(OutDir)), - {error, [], R} = - ic:gen(File, stdopts(OutDir)++[silent2]), - check_errors(1, parse_error, R), - ok. - -syntax4(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(slask), - File = filename:join(DataDir, syntax4), - - error = ic:gen(File, stdopts(OutDir)), - {error, [], R} = - ic:gen(File, stdopts(OutDir)++[silent2]), - check_errors(1, parse_error, R), - ok. - -syntax5(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(slask), - File = filename:join(DataDir, syntax5), - - error = ic:gen(File, stdopts(OutDir)), - {error, [], R} = - ic:gen(File, stdopts(OutDir)++[silent2]), - check_errors(1, parse_error, R), - ok. - -syntax6(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(slask), - File = filename:join(DataDir, syntax6), - - error = ic:gen(File, stdopts(OutDir)), - {error, [], R} = - ic:gen(File, stdopts(OutDir)++[silent2]), - check_errors(1, parse_error, R), - ok. - - - -%%-------------------------------------------------------------------- -%% -%% Checks RAISES to be registered under IFR operation registration -%% ( OTP-2102 ) -%% - -%% Check that exceptions are really registered to operations. -raises_reg(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(raises_reg_check), - File = filename:join(DataDir, raises_reg), - - ok = ic:gen(File, stdopts(OutDir)), - {ok, []} = ic:gen(File, stdopts(OutDir)++[silent2]), - ok = compile(OutDir, raises_reg_files(), [load]), - - set_up('oe_raises_reg'), - - io:format("~n##### Starting the test case #####~n"), - io:format("Checking for existance of exception : ~s~n",["IDL:Raises_RegModule/Exception_1:1.0"]), - raises_register_check("IDL:Raises_RegModule/R_R/op:1.0","IDL:Raises_RegModule/Exception_1:1.0"), - - io:format("Checking for existance of exception : ~s~n",["IDL:Raises_RegModule/Exception_2:1.0"]), - raises_register_check("IDL:Raises_RegModule/R_R/op:1.0","IDL:Raises_RegModule/Exception_2:1.0"), - - io:format("Checking for existance of exception : ~s~n",["IDL:Raises_RegModule/XXXXXXXX:1.0"]), - raises_register_check("IDL:Raises_RegModule/R_R/op:1.0","IDL:RaisesModule/XXXXXXXX:1.0"), - - set_down('oe_raises_reg'), - - ok. - -set_up(Register) -> - io:format("Setting up.....~n"), - mnesia:stop(), - mnesia:delete_schema([node()]), - mnesia:create_schema([node()]), - mnesia:start(), - orber:install([node()]), - orber:start(), - io:format("Running OE_register()~n"), - Register:'oe_register'(). - -set_down(Register) -> - io:format("Running OE_unregister()~n"), - Register:'oe_unregister'(), - io:format("Setting down.....~n"), - orber:stop(), - orber:uninstall(), - mnesia:stop(), - mnesia:delete_schema([node()]). - - -raises_register_check(OpId,ExcId) -> - case is_valid_exc(OpId,ExcId) of - true -> - ok; % Because right exception where found, - % the test succeeds for normal cases. - false -> - ok; % Because the exception tested, is not - % registered for that operation. - FailReason -> - test_server:fail({FailReason, OpId, ExcId}) - % Because the test descovered errors in a previous - % stage, or no exceptions where registered att all. - % ( This testcase assumes that operations to be - % checked allways raise excption(s) ) - end. - -is_valid_exc(OpId,ExcId) -> - OE_IFR = orber_ifr:find_repository(), - OpDef = orber_ifr:'Repository_lookup_id'(OE_IFR,OpId), - ExcDefList = orber_ifr:get_exceptions(OpDef), - case ExcDefList of - [] -> - no_exceptions_registered; - _ -> - ExcDef=orber_ifr:lookup_id(OE_IFR,ExcId), - lists:member(ExcDef,ExcDefList) - end. - -%%-------------------------------------------------------------------- -%% -%% Utilities - - -stdopts(OutDir) -> - [{outdir, OutDir},{maxerrs, infinity}]. - -mk_unique(Prefix) -> - {A,B,C} = now(), - Prefix++"_"++integer_to_list(A)++"_"++integer_to_list(B)++"_"++ - integer_to_list(C). - -gen_file(File, Const) -> - {ok, Fd} = file:open(File++".idl", [write]), - io:format(Fd, "interface ~s {~n", [File]), - io:format(Fd, " const long ~s = 19955;~n", [Const]), - io:format(Fd, "};~n", []), - file:close(Fd). - - -%% Compile all files in Dir. Used for checking that valid Erlang has -%% been generated. -%%compile(Dir) -> -%% compile(Dir, []). -%%compile(Dir, Opts) -> -%% {ok, Cwd} = file:get_cwd(), -%% catch do_compile(Dir, Opts), -%% file:set_cwd(Cwd). - -%%do_compile(Dir, Opts) -> -%% ok = file:set_cwd(Dir), -%% up_to_date = ts_make_erl:all(Opts), -%% ok. - -compile(Dir, Files) -> - compile(Dir, Files, []). - -compile(Dir, Files, Opts) -> - {ok, Cwd} = file:get_cwd(), - file:set_cwd(Dir), - io:format("Changing to ~p~n", [Dir]), - case catch do_compile(Files, Opts) of - ok -> - file:set_cwd(Cwd); - Err -> - file:set_cwd(Cwd), - test_server:fail(Err) - end. - -do_compile([], _Opts) -> ok; -do_compile([F | Fs], Opts) -> - io:format("Compiling ~p", [F]), - case compile:file(F, Opts) of - ok -> - io:format(" ok~n", []), - do_load(F, Opts), - do_compile(Fs, Opts); - {ok, _} -> - io:format(" ok~n", []), - do_load(F, Opts), - do_compile(Fs, Opts); - {ok, _, _} -> - io:format(" ok~n", []), - do_load(F, Opts), - do_compile(Fs, Opts); - Err -> - io:format(" error: ~p~n", [Err]), - Err - end. - -do_load(File, Opts) -> - case lists:member(load, Opts) of - true -> - io:format("Loading file ~p", [File]), - code:purge(File), - R = code:load_abs(File), - io:format("Loaded: ~p", [R]); - false -> - ok - end. - - -%% Check that ErrList consists of exactly Num errors of type ErrType -check_errors(Num, ErrType, ErrList) -> - Num = length(ErrList), - lists:foreach(fun(T) -> - case catch element(1, element(4, T)) of - ErrType -> ok; - Else -> - test_server:fail({bad, ErrType, Else}) - end end, ErrList). - -to_list(X) when is_atom(X) -> atom_to_list(X); -to_list(X) -> X. - - -%% File must be an atom -gen_struct_file(File, Mod) -> - - {ok, Fd} = file:open(to_list(File)++".erl", [write]), - io:format(Fd, "~n", []), - io:format(Fd, "-module(~p).~n", [Mod]), - io:format(Fd, "-export([test/0]).~n", []), - io:format(Fd, "-include(\"oe_struct.hrl\").~n", []), - io:format(Fd, "test() ->~n", []), - io:format(Fd, " A = #'S1'{a=99, b=$a, s=\"123456789\"},~n", []), - io:format(Fd, " B = #'S2'{a=9, b=#'S2_S3'{a=1, b=9, b1=5, c=$2},~n", []), - io:format(Fd, " c=[#'S1'{a=1}, #'S1'{a=2}],~n", []), - io:format(Fd, -" c2=[#'S1'{a=2}, #'S1'{a=3}, #'S1'{a=2}, #'S1'{a=3}]},~n", []), - io:format(Fd, " C = #'S2_S3'{a=11, b=999, b1=19},~n", []), - io:format(Fd, " D = #s4{a=7},~n", []), - io:format(Fd, " E = {1, #'U1_S5'{a=3}},~n", []), - io:format(Fd, " F = {2, {$b, #'U1_U2_s6'{a=6, b=false}}},~n", []), - io:format(Fd, " ok.~n", []), - file:close(Fd). - - -union_norm_files() -> ['oe_u_norm']. -union_default_files() -> ['oe_u_default', i1]. - -typeid_files() -> ['oe_typeid', 'M3_M2_M1_I1', 'M2_M1_I1', 'M1_I1', 'I1']. - -struct_norm_files() -> ['oe_struct']. -oneway_norm_files() -> ['oe_one', 'I1']. -oneway_followed_files() -> ['oe_one_followed', 'I1']. -nasty_names_files() -> ['oe_nasty', 'I2', 'I1']. - -inherit_norm_files() -> [m1_I3, m1_I2, m1_I1, 'oe_inherit', 'I4', 'I3', - 'I2', 'I1']. - -forward_files() -> [i1, 'oe_forward']. -enum_norm_files() -> ['oe_enum']. -const_norm_files() -> ['oe_c_norm']. -attr_norm_files() -> ['oe_attr', 'I1', 'I2']. -type_norm_files() -> ['oe_type']. - -raises_reg_files() -> ['oe_raises_reg']. - - - - - - - - - - - - - - - - diff --git a/lib/ic/test/ic_SUITE_data/Corba.idl b/lib/ic/test/ic_SUITE_data/Corba.idl deleted file mode 100644 index 6b81132500..0000000000 --- a/lib/ic/test/ic_SUITE_data/Corba.idl +++ /dev/null @@ -1,1013 +0,0 @@ -// This file contains OMG IDL from CORBA V2.0, July 1995. -// Includes IDL for CORBA Core -// (Interface Repository, ORB Interface, Basic Object Adapter Interface) -// and CORBA Interoperability (IOP, GIOP, IIOP, and DCE CIOP modules) - -// Complete OMG IDL for Interface Repository starts on pg 6-42, CORBA V2.0 July 1995 -// IRObject interface described on pg 6-9 CORBA V2.0, July 1995 -// Contained interface: pg 6-11 CORBA V2, 7-95 -// Container interface: pg 6-12 thru 6-15 CORBA V2, 7-95 -// IDLType interface: pg 6-15 CORBA V2, 7-95 -// Repository interface: pg 6-16 CORBA V2, 7-95 -// ModuleDef interface: pg 6-17 CORBA V2, 7-95 -// ConstantDef interface: pg 6-18 CORBA V2, 7-95 -// TypeDef interface: pg 6-19 CORBA V2, 7-95 -// StructDef interface: pg 6-19 CORBA V2, 7-95 -// UnionDef interface: pg 6-19 CORBA V2, 7-95 -// EnumDef interface: pg 6-20 CORBA V2, 7-95 -// AliasDef interface: pg 6-21 CORBA V2, 7-95 -// PrimitiveDef interface: pg 6-21 CORBA V2, 7-95 -// StringDef interface: pg 6-22 CORBA V2, 7-95 -// SequenceDef interface: pg 6-22 CORBA V2, 7-95 -// ArrayDef interface: pg 6-23 CORBA V2, 7-95 -// ExceptionDef interface: pg 6-24 CORBA V2, 7-95 -// AttributeDef interface: pg 6-25 CORBA V2, 7-95 -// OperationDef interface: pg 6-26 CORBA V2, 7-95 -// InterfaceDef interface: pg 6-28 CORBA V2, 7-95 -// TypeCode interface (PIDL): pg 6-34 CORBA V2, 7-95 -// ORB interface: pg 6-40 CORBA V2, 7-95 - -#ifndef __CORBA_IDL -#define __CORBA_IDL - -// #pragma prefix "omg.org" -module CORBA { - - interface TypeCode; - typedef string Identifier; - typedef string ScopedName; - typedef string RepositoryId; - - /* - * start of section added by Christian Blum - */ - - typedef enum new_type {NO,USER,SYSTEM_EXCEPTION} exception_type; - - /** - * no definition for this type - */ - interface ImplementationDef - { - }; - - /** - * no definition for this type - */ - //interface Principal - struct Principal - { - string str; - }; - - /** - * no definition for this type - */ - interface Environment - { - - }; - - typedef unsigned long Flags; - typedef unsigned long Status; - - struct NamedValue // PIDL - { - Identifier name; // argument name - any argument; // argument - long len; // length/count of argument value - Flags arg_modes; // argument mode flags - - }; - - typedef sequence NVList; /* C */ - - interface Request // PIDL - { - - Status add_arg ( - in Identifier name, // argument name - in TypeCode arg_type, // argument datatype - // in void * value, // argument value to be added - in any value_LOOK_AT_SOURCE, // changed by blum - in long len, // length/count of argument value - in Flags arg_flags // argument flags - ); - - Status invoke ( - in Flags invoke_flags // invocation flags - ); - - Status delete (); - Status send ( - in Flags invoke_flags // invocation flags - ); - - Status get_response ( - in Flags response_flags // response flags - ); - - }; - - - interface Context // PIDL - { - - Status set_one_value ( - in Identifier prop_name, // property name to add - in string value // property value to add - ); - - Status set_values ( - in NVList values // property values to be changed - ); - - Status get_values ( - in Identifier start_scope, // search scope - in Flags op_flags, // operation flags - in Identifier prop_name, // name of property(s) to retrieve - out NVList values // requested property(s) - ); - - Status delete_values ( - in Identifier prop_name // name of property(s) to delete - ); - - Status create_child ( - in Identifier ctx_name, // name of context object - out Context child_ctx // newly created context object - ); - - Status delete ( - in Flags del_flags // flags controlling deletion - ); - - }; - - /* - * end of section added by Christian Blum - */ - - - enum DefinitionKind { - dk_none, dk_all, - dk_Attribute, dk_Constant, dk_Exception, dk_Interface, - dk_Module, dk_Operation, dk_Typedef, - dk_Alias, dk_Struct, dk_Union, dk_Enum, - dk_Primitive, dk_String, dk_Sequence, dk_Array, - dk_Repository - }; - - - interface IRObject { - // read interface - readonly attribute DefinitionKind def_kind; - - // write interface - void destroy (); - }; - - - - typedef string VersionSpec; - - interface Contained; - interface Repository; - interface Container; - - interface Contained : IRObject { - // read/write interface - - attribute RepositoryId id; - attribute Identifier name; - attribute VersionSpec version; - - // read interface - - readonly attribute Container defined_in; - readonly attribute ScopedName absolute_name; - readonly attribute Repository containing_repository; - - struct Description { - DefinitionKind kind; - any value; - }; - - Description describe (); - - // write interface - - void move ( - in Container new_container, - in Identifier new_name, - in VersionSpec new_version - ); - }; - - - interface ModuleDef; - interface ConstantDef; - interface IDLType; - interface StructDef; - interface UnionDef; - interface EnumDef; - interface AliasDef; - interface InterfaceDef; - typedef sequence InterfaceDefSeq; - - typedef sequence ContainedSeq; - - struct StructMember { - Identifier name; - TypeCode type; - IDLType type_def; - }; - typedef sequence StructMemberSeq; - - struct UnionMember { - Identifier name; - any label; - TypeCode type; - IDLType type_def; - }; - typedef sequence UnionMemberSeq; - - typedef sequence EnumMemberSeq; - - interface Container : IRObject { - // read interface - - Contained lookup ( in ScopedName search_name); - - ContainedSeq contents ( - in DefinitionKind limit_type, - in boolean exclude_inherited - ); - - ContainedSeq lookup_name ( - in Identifier search_name, - in long levels_to_search, - in DefinitionKind limit_type, - in boolean exclude_inherited - ); - - struct Description { - Contained contained_object; - DefinitionKind kind; - any value; - }; - - typedef sequence DescriptionSeq; - - DescriptionSeq describe_contents ( - in DefinitionKind limit_type, - in boolean exclude_inherited, - in long max_returned_objs - ); - - // write interface - - ModuleDef create_module ( - in RepositoryId id, - in Identifier name, - in VersionSpec version - ); - - ConstantDef create_constant ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType type, - in any value - ); - - StructDef create_struct ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in StructMemberSeq members - ); - - UnionDef create_union ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType discriminator_type, - in UnionMemberSeq members - ); - - EnumDef create_enum ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in EnumMemberSeq members - ); - - AliasDef create_alias ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType original_type - ); - - InterfaceDef create_interface ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in InterfaceDefSeq base_interfaces - ); - }; - - - - interface IDLType : IRObject { - readonly attribute TypeCode type; - }; - - - - interface PrimitiveDef; - interface StringDef; - interface SequenceDef; - interface ArrayDef; - - enum PrimitiveKind { - pk_null, pk_void, pk_short, pk_long, pk_ushort, pk_ulong, - pk_float, pk_double, pk_boolean, pk_char, pk_octet, - pk_any, pk_TypeCode, pk_Principal, pk_string, pk_objref - }; - - interface Repository : Container { - // read interface - - Contained lookup_id (in RepositoryId search_id); - - PrimitiveDef get_primitive (in PrimitiveKind kind); - - // write interface - - StringDef create_string (in unsigned long bound); - - SequenceDef create_sequence ( - in unsigned long bound, - in IDLType element_type - ); - - ArrayDef create_array ( - in unsigned long length, - in IDLType element_type - ); - }; - - - interface ModuleDef : Container, Contained { - }; - - struct ModuleDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - }; - - - interface ConstantDef : Contained { - readonly attribute TypeCode type; - attribute IDLType type_def; - attribute any value; - }; - - struct ConstantDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - TypeCode type; - any value; - }; - - - interface TypedefDef : Contained, IDLType { - }; - - struct TypeDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - TypeCode type; - }; - - - interface StructDef : TypedefDef { - attribute StructMemberSeq members; - }; - - - interface UnionDef : TypedefDef { - readonly attribute TypeCode discriminator_type; - attribute IDLType discriminator_type_def; - attribute UnionMemberSeq members; - }; - - - interface EnumDef : TypedefDef { - attribute EnumMemberSeq members; - }; - - - interface AliasDef : TypedefDef { - attribute IDLType original_type_def; - }; - - - interface PrimitiveDef: IDLType { - readonly attribute PrimitiveKind kind; - }; - - - interface StringDef : IDLType { - attribute unsigned long bound; - }; - - - interface SequenceDef : IDLType { - attribute unsigned long bound; - readonly attribute TypeCode element_type; - attribute IDLType element_type_def; - }; - - interface ArrayDef : IDLType { - attribute unsigned long length; - readonly attribute TypeCode element_type; - attribute IDLType element_type_def; - }; - - - interface ExceptionDef : Contained { - readonly attribute TypeCode type; - attribute StructMemberSeq members; - }; - struct ExceptionDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - TypeCode type; - }; - - - - enum AttributeMode {ATTR_NORMAL, ATTR_READONLY}; - - interface AttributeDef : Contained { - readonly attribute TypeCode type; - attribute IDLType type_def; - attribute AttributeMode mode; - }; - - struct AttributeDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - TypeCode type; - AttributeMode mode; - }; - - - - enum OperationMode {OP_NORMAL, OP_ONEWAY}; - - enum ParameterMode {PARAM_IN, PARAM_OUT, PARAM_INOUT}; - struct ParameterDescription { - Identifier name; - TypeCode type; - IDLType type_def; - ParameterMode mode; - }; - typedef sequence ParDescriptionSeq; - - typedef Identifier ContextIdentifier; - typedef sequence ContextIdSeq; - - typedef sequence ExceptionDefSeq; - typedef sequence ExcDescriptionSeq; - - interface OperationDef : Contained { - readonly attribute TypeCode result; - attribute IDLType result_def; - attribute ParDescriptionSeq params; - attribute OperationMode mode; - attribute ContextIdSeq contexts; - attribute ExceptionDefSeq exceptions; - }; - - struct OperationDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - TypeCode result; - OperationMode mode; - ContextIdSeq contexts; - ParDescriptionSeq parameters; - ExcDescriptionSeq exceptions; - }; - - - - typedef sequence RepositoryIdSeq; - typedef sequence OpDescriptionSeq; - typedef sequence AttrDescriptionSeq; - - interface InterfaceDef : Container, Contained, IDLType { - // read/write interface - - attribute InterfaceDefSeq base_interfaces; - - // read interface - - boolean is_a (in RepositoryId interface_id); - - struct FullInterfaceDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - OpDescriptionSeq operations; - AttrDescriptionSeq attributes; - RepositoryIdSeq base_interfaces; - TypeCode type; - }; - - FullInterfaceDescription describe_interface(); - - // write interface - - AttributeDef create_attribute ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType type, - in AttributeMode mode - ); - - OperationDef create_operation ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType result, - in OperationMode mode, - in ParDescriptionSeq params, - in ExceptionDefSeq exceptions, - in ContextIdSeq contexts - ); - }; - - struct InterfaceDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - RepositoryIdSeq base_interfaces; - }; - - - - enum TCKind { - tk_null, tk_void, - tk_short, tk_long, tk_ushort, tk_ulong, - tk_float, tk_double, tk_boolean, tk_char, - tk_octet, tk_any, tk_TypeCode, tk_Principal, tk_objref, - tk_struct, tk_union, tk_enum, tk_string, - tk_sequence, tk_array, tk_alias, tk_except - }; - - interface TypeCode { // PIDL - exception Bounds {}; - exception BadKind {}; - - // for all TypeCode kinds - boolean equal (in TypeCode tc); - TCKind kind (); - - // for tk_objref, tk_struct, tk_union, tk_enum, tk_alias, and tk_except - RepositoryId id () raises (BadKind); - - // for tk_objref, tk_struct, tk_union, tk_enum, tk_alias, and tk_except - Identifier name () raises (BadKind); - - // for tk_struct, tk_union, tk_enum, and tk_except - unsigned long member_count () raises (BadKind); - Identifier member_name (in unsigned long index) raises (BadKind, Bounds); - - // for tk_struct, tk_union, and tk_except - TypeCode member_type (in unsigned long index) raises (BadKind, Bounds); - - // for tk_union - any member_label (in unsigned long index) raises (BadKind, Bounds); - TypeCode discriminator_type () raises (BadKind); - long default_index () raises (BadKind); - - // for tk_string, tk_sequence, and tk_array - unsigned long length () raises (BadKind); - - // for tk_sequence, tk_array, and tk_alias - TypeCode content_type () raises (BadKind); - - // deprecated interface - long param_count (); - any parameter (in long index) raises (Bounds); - }; - - - /* - * following line added by Christian Blum - */ - interface BOA; - - interface ORB { - // other operations ... - - TypeCode create_struct_tc ( - in RepositoryId id, - in Identifier name, - in StructMemberSeq members - ); - - TypeCode create_union_tc ( - in RepositoryId id, - in Identifier name, - in TypeCode discriminator_type, - in UnionMemberSeq members - ); - - TypeCode create_enum_tc ( - in RepositoryId id, - in Identifier name, - in EnumMemberSeq members - ); - - TypeCode create_alias_tc ( - in RepositoryId id, - in Identifier name, - in TypeCode original_type - ); - - TypeCode create_exception_tc ( - in RepositoryId id, - in Identifier name, - in StructMemberSeq members - ); - - TypeCode create_interface_tc ( - in RepositoryId id, - in Identifier name - ); - - TypeCode create_string_tc ( - in unsigned long bound - ); - - TypeCode create_sequence_tc ( - in unsigned long bound, - in TypeCode element_type - ); - - TypeCode create_recursive_sequence_tc ( - in unsigned long bound, - in unsigned long offset - ); - - TypeCode create_array_tc ( - in unsigned long length, - in TypeCode element_type - ); - - /* - * following line commented out by Christian Blum - */ - // }; - - // The ORB interface (PIDL) is described in Chapter 7, CORBA V2.0 July 1995 - // Object interface (object reference operations): pg 7-3 CORBA V2, 7-95 - // ORB initialization: pg 7-7 CORBA V2, 7-95 - // Object Adapter and Basic Object Adapter initialization: pg 7-8 CORBA V2 7-95 - // Getting initial references: pg 7-10 CORBA V2 7-95 - //PIDL - - /* - * following line commented out by Christian Blum - */ - //interface ORB { - - - string object_to_string (in Object obj); - Object string_to_object (in string str); - - Status create_list ( - in long count, - out NVList new_list - ); - Status create_operation_list ( - in OperationDef oper, - out NVList new_list - ); - Status get_default_context (out Context ctx); - - // Initializing the ORB - typedef string ORBid; - typedef sequence arg_list; - ORB ORB_init (inout arg_list argv, in ORBid orb_identifier); - - // Initializing an object adapter and the Basic Object Adapter - typedef string OAid; - - // Template for OA initialization operations - // _init (inout arg_list argv, - // in OAid oa_identifier); - - - - BOA BOA_init (inout arg_list argv, - in OAid boa_identifier); - - - - // Getting initial object references - typedef string ObjectId; - typedef sequence ObjectIdList; - - exception InvalidName {}; - - ObjectIdList list_initial_services (); - - Object resolve_initial_references (in ObjectId identifier) - raises (InvalidName); - }; - - // had to be changed..., Gerald Brose 1996 - interface ORBject { - - ImplementationDef get_implementation (); - InterfaceDef get_interface (); - boolean is_nil(); - Object duplicate (); - void release (); - boolean is_a (in string logical_type_id); - boolean non_existent(); - boolean is_equivalent (in Object other_object); - unsigned long hash(in unsigned long maximum); - - - Status create_request ( - in Context ctx, - in Identifier operation, - in NVList arg_list, - inout NamedValue result, - out Request request, - in Flags req_flags - ); - }; - - - // Basic Object Adapter interface described in Chapter 8, CORBA V2.0, July 1995 - // interface InterfaceDef; // from Interface Repository // PIDL - // interface ImplementationDef; // from Implementation Repository - // interface Object; // an object reference - // interface Principal; // for the authentication service - typedef sequence ReferenceData; - - interface BOA { - Object create ( - in ReferenceData id, - in InterfaceDef intf, - in ImplementationDef impl - ); - void dispose (in Object obj); - ReferenceData get_id (in Object obj); - - void change_implementation (in Object obj, - in ImplementationDef impl - ); - - Principal get_principal (in Object obj, - in Environment ev - ); - - void set_exception (in exception_type major, // NO, USER, - //or SYSTEM_EXCEPTION - in string userid, // exception type id - in any param_LOOK_AT_SOURCE - // in void *param // pointer to associated data - ); - - void impl_is_ready (in ImplementationDef impl); - void deactivate_impl (in ImplementationDef impl); - void obj_is_ready (in Object obj, in ImplementationDef impl); - void deactivate_obj (in Object obj); - }; -}; - -// IOP module described in chap 10 CORBA V2, 7-95 -module IOP{ // IDL - // - // Standard Protocol Profile tag values - // - typedef unsigned long ProfileId; - const ProfileId TAG_INTERNET_IOP = 0; - const ProfileId TAG_MULTIPLE_COMPONENTS = 1; - - struct TaggedProfile { - ProfileId tag; - sequence profile_data; - }; - - // - // an Interoperable Object Reference is a sequence of - // object-specific protocol profiles, plus a type ID. - // - struct IOR { - string type_id; - sequence profiles; - }; - - // - // Standard way of representing multicomponent profiles. - // This would be encapsulated in a TaggedProfile. - // - typedef unsigned long ComponentId; - struct TaggedComponent { - ComponentId tag; - sequence component_data; - }; - typedef sequence MultipleComponentProfile; - - - typedef unsigned long ServiceID; - - struct ServiceContext { - ServiceID context_id; - sequence context_data; - }; - typedef sequence ServiceContextList; - - const ServiceID TransactionService = 0; - - - -}; -// GIOP module described in CORBA V2, 7-95 chap 12 -// Complete IDL for GIOP module in CORBA -// V2.0, 7-95 p 10-29 -// GIOP message header: CORBA V2, 7-95 p 12-16 -// GIOP request header: CORBA V2, 7-95 p 12-17 -// GIOP reply header: CORBA V2, 7-95 p 12-19 -// GIOP cancel request and locate request: CORBA V2, 7-95 pp 12-20 -- 12-21 -// GIOP locate reply: CORBA V2, 7-95 p 12-22 -module GIOP { // IDL - enum MsgType { - Request, Reply, CancelRequest, - LocateRequest, LocateReply, - CloseConnection, MessageError - }; - - struct Version { - char major; - char minor; - }; - - struct MessageHeader { - char magic [4]; - Version GIOP_version; - boolean byte_order; - octet message_type; - unsigned long message_size; - }; - - struct RequestHeader { - ::IOP::ServiceContextList service_context; - unsigned long request_id; - boolean response_expected; - sequence object_key; - string operation; - - /* - * ::CORBA:: added for correct scope - */ - ::CORBA::Principal requesting_principal; - }; - - enum ReplyStatusType { - NO_EXCEPTION, - USER_EXCEPTION, - SYSTEM_EXCEPTION, - LOCATION_FORWARD - }; - - struct ReplyHeader { - ::IOP::ServiceContextList service_context; - unsigned long request_id; - ReplyStatusType reply_status; - }; - - struct CancelRequestHeader { - unsigned long request_id; - }; - - struct LocateRequestHeader { - unsigned long request_id; - sequence object_key; - }; - - enum LocateStatusType { - UNKNOWN_OBJECT, - OBJECT_HERE, - OBJECT_FORWARD - }; - - struct LocateReplyHeader { - unsigned long request_id; - LocateStatusType locate_status; - }; -}; -// IIOP module described in CORBA V2, 7-95 chap 12 -// Complete IDL for IIOP module: CORBA V2, 7-95 p 12-31 -module IIOP { // IDL - struct Version { - char major; - char minor; - }; - - struct ProfileBody { - Version iiop_version; - string host; - unsigned short port; - sequence object_key; - }; -}; -// DCE CIOP module described in CORBA V2, 7-95 chap 13 -// IDL for DCE CIOP module: CORBA V2, 7-95 p 13-2 -module DCE_CIOP { - struct InvokeRequestHeader { - boolean byte_order; - ::IOP::ServiceContextList service_context; - sequence object_key; - string endpoint_id; - string operation; - ::CORBA::Principal principal; - sequence client_context; - - // in and inout parameters follow - }; - enum InvokeResponseStatus { - INVOKE_NO_EXCEPTION, - INVOKE_USER_EXCEPTION, - INVOKE_SYSTEM_EXCEPTION, - INVOKE_LOCATION_FORWARD, - INVOKE_TRY_AGAIN - }; - - struct InvokeResponseHeader { - boolean byte_order; - ::IOP::ServiceContextList service_context; - InvokeResponseStatus status; - - // if status = INVOKE_NO_EXCEPTION, - // result then inouts and outs follow - - // if status = INVOKE_USER_EXCEPTION or - // INVOKE_SYSTEM_EXCEPTION, an exception follows - - // if status = INVOKE_LOCATION_FORWARD, an - // ::IOP::MultipleComponentsProfile follows - }; - - struct LocateRequestHeader { - boolean byte_order; - sequence object_key; - string endpoint_id; - string operation; - - // no body follows - }; - - module IOP { - - /* - * ::IOP:: added to get the right scope - */ - const ::IOP::ComponentId TAG_OBJECT_KEY = 10; - const ::IOP::ComponentId TAG_ENDPOINT_ID = 11; - const ::IOP::ComponentId TAG_LOCATION_POLICY = 12; - // illegal IDL - /* const octet LOCATE_NEVER = 0; - const octet LOCATE_OBJECT = 1; - const octet LOCATE_OPERATION = 2; - const octet LOCATE_ALWAYS = 3; - */ - }; -}; - -#endif diff --git a/lib/ic/test/ic_SUITE_data/Coss.idl b/lib/ic/test/ic_SUITE_data/Coss.idl deleted file mode 100644 index c84d4a8247..0000000000 --- a/lib/ic/test/ic_SUITE_data/Coss.idl +++ /dev/null @@ -1,1537 +0,0 @@ -// This file contains OMG IDL and PIDL for the Common Object Services. -// CosNaming Module, p 3-6 CORBAservices, Naming Service V1.0, 3/94 - -// A few minor changes for the JacORB distribution: -// -// added am enclosing COSS module and changed scoped names accordingly -// -// corrected a few syntax errors -// -// commented out: -// #includes -// forward declaration of Object - -#include "Corba.idl" - -module COSS { - -module CosNaming { - - typedef string Istring; - struct NameComponent { - Istring id; - Istring kind; - }; - - typedef sequence Name; - - enum BindingType {nobject, ncontext}; - - struct Binding { - Name binding_name; - BindingType binding_type; - }; - - typedef sequence BindingList; - interface BindingIterator; - - interface NamingContext { - - enum NotFoundReason { missing_node, not_context, not_object}; - - exception NotFound { - NotFoundReason why; - Name rest_of_name; - }; - - exception CannotProceed { - NamingContext cxt; - Name rest_of_name; - }; - - exception InvalidName{}; - exception AlreadyBound {}; - exception NotEmpty{}; - - void bind(in Name n, in Object obj) - raises(NotFound, CannotProceed, InvalidName, AlreadyBound); - void rebind(in Name n, in Object obj) - raises(NotFound, CannotProceed, InvalidName); - void bind_context(in Name n, in NamingContext nc) - raises(NotFound, CannotProceed, InvalidName, AlreadyBound); - void rebind_context(in Name n, in NamingContext nc) - raises(NotFound, CannotProceed, InvalidName); - Object resolve (in Name n) - raises(NotFound, CannotProceed, InvalidName); - void unbind(in Name n) - raises(NotFound, CannotProceed, InvalidName); - NamingContext new_context(); - NamingContext bind_new_context(in Name n) - raises(NotFound, AlreadyBound, CannotProceed, InvalidName); - void destroy( ) - raises(NotEmpty); - void list (in unsigned long how_many, - out BindingList bl, out BindingIterator bi); - }; - - interface BindingIterator { - boolean next_one(out Binding b); - boolean next_n(in unsigned long how_many, - out BindingList bl); - void destroy(); - }; -}; - -// Names Library interface in PIDL, CORBAservices p 3- 14, Naming Service V1.0 3/94 -/* -interface LNameComponent { // PIDL - exception NotSet{}; - string get_id() - raises(NotSet); - void set_id(in string i); - string get_kind() - raises(NotSet); - void set_kind(in string k); - void destroy(); -}; - -interface LName { // PIDL - exception NoComponent{}; - exception OverFlow{}; - exception InvalidName{}; - LName insert_component(in unsigned long i, - in LNameComponent n) - raises(NoComponent, OverFlow); - LNameComponent get_component(in unsigned long i) - raises(NoComponent); - LNameComponent delete_component(in unsigned long i) - raises(NoComponent); - unsigned long num_components(); - boolean equal(in LName ln); - boolean less_than(in LName ln); - Name to_idl_form() - raises(InvalidName); - void from_idl_form(in Name n); - void destroy(); -}; - -LName create_lname(); // C/C++ -LNameComponent create_lname_component(); // C/C++ -*/ - -// CosEventComm Module, CORBAservices p 4-8, Event Service V1.0 3/94 - -module CosEventComm { - - exception Disconnected{}; - - interface PushConsumer { - void push (in any data) raises(Disconnected); - void disconnect_push_consumer(); - }; - - interface PushSupplier { - void disconnect_push_supplier(); - }; - - interface PullSupplier { - any pull () raises(Disconnected); - any try_pull (out boolean has_event) - raises(Disconnected); - void disconnect_pull_supplier(); - }; - - interface PullConsumer { - void disconnect_pull_consumer(); - }; - -}; - -// CosEventChannelAdmin Module, p 4-15 CORBAservices, Event -// Service V1.0, 3/94 - -// #include "CosEventComm.idl" - -module CosEventChannelAdmin { - - exception AlreadyConnected {}; - exception TypeError {}; - - interface ProxyPushConsumer: ::COSS::CosEventComm::PushConsumer { - void connect_push_supplier( - in ::COSS::CosEventComm::PushSupplier push_supplier) - raises(AlreadyConnected); - }; - - interface ProxyPullSupplier: ::COSS::CosEventComm::PullSupplier { - void connect_pull_consumer( - in ::COSS::CosEventComm::PullConsumer pull_consumer) - raises(AlreadyConnected); - }; - - interface ProxyPullConsumer: ::COSS::CosEventComm::PullConsumer { - void connect_pull_supplier( - in ::COSS::CosEventComm::PullSupplier pull_supplier) - raises(AlreadyConnected,TypeError); - }; - - interface ProxyPushSupplier: ::COSS::CosEventComm::PushSupplier { - void connect_push_consumer( - in ::COSS::CosEventComm::PushConsumer - push_consumer) - raises(AlreadyConnected, TypeError); - }; - - - interface ConsumerAdmin { - ProxyPushSupplier obtain_push_supplier(); - ProxyPullSupplier obtain_pull_supplier(); - }; - - interface SupplierAdmin { - ProxyPushConsumer obtain_push_consumer(); - ProxyPullConsumer obtain_pull_consumer(); - }; - - interface EventChannel { - ConsumerAdmin for_consumers(); - SupplierAdmin for_suppliers(); - void destroy(); - }; - -}; - - -// CosTyped Event Module, p 4-22 CORBAservices, Event Service -// V1.0, 3/94 - -// // #include "CosEventComm.idl" - -module CosTypedEventComm { - - interface TypedPushConsumer : ::COSS::CosEventComm::PushConsumer { - Object get_typed_consumer(); - }; - - interface TypedPullSupplier : ::COSS::CosEventComm::PullSupplier { - Object get_typed_supplier(); - }; - -}; - -// CosTypedEventChannelAdmin Module, p 4- 25 CORBAservices, -// Event Service V1.0, 3/94 - -// // #include "CosEventChannel.idl" -// // #include "CosTypedEventComm.idl" -module CosTypedEventChannelAdmin { - exception InterfaceNotSupported {}; - exception NoSuchImplementation {}; - typedef string Key; - - interface TypedProxyPushConsumer : - ::COSS::CosEventChannelAdmin::ProxyPushConsumer, - ::COSS::CosTypedEventComm::TypedPushConsumer { }; - - interface TypedProxyPullSupplier : - ::COSS::CosEventChannelAdmin::ProxyPullSupplier, - ::COSS::CosTypedEventComm::TypedPullSupplier { }; - - interface TypedSupplierAdmin : - ::COSS::CosEventChannelAdmin::SupplierAdmin { - TypedProxyPushConsumer obtain_typed_push_consumer( - in Key supported_interface) - raises(InterfaceNotSupported); - ::COSS::CosEventChannelAdmin::ProxyPullConsumer obtain_typed_pull_consumer ( - in Key uses_interface) - raises(NoSuchImplementation); - }; - - interface TypedConsumerAdmin : - ::COSS::CosEventChannelAdmin::ConsumerAdmin { - TypedProxyPullSupplier obtain_typed_pull_supplier( - in Key supported_interface) - raises (InterfaceNotSupported); - ::COSS::CosEventChannelAdmin::ProxyPushSupplier obtain_typed_push_supplier( - in Key uses_interface) - raises(NoSuchImplementation); - }; - - interface TypedEventChannel { - TypedConsumerAdmin for_consumers(); - TypedSupplierAdmin for_suppliers(); - void destroy (); - }; -}; - - -// CosPersistencePID Module, p 5-20 CORBAservices, -// Persistent Object Service V1.0, 3/94 - -//#ifndef __COSPERSISTENCE -//#define __COSPERSISTENCE - -module CosPersistencePID { - - interface PID { - attribute string datastore_type; - string get_PIDString(); - }; -}; - - -// CosPersistencePDS Module, p 5-20 CORBAservices, -// Persistent Object Service V1.0, 3/94 - -// #include "CosPersistencePID.idl" - -module CosPersistencePDS { - -// interface Object; - interface PDS { - PDS connect (in Object obj, - in ::COSS::CosPersistencePID::PID p); - void disconnect (in Object obj, - in ::COSS::CosPersistencePID::PID p); - void store (in Object obj, - in ::COSS::CosPersistencePID::PID p); - void restore (in Object obj, - in ::COSS::CosPersistencePID::PID p); - void delete (in Object obj, - in ::COSS::CosPersistencePID::PID p); - }; -}; - - -// CosPersistencePO Module, p 5-12 CORBAservices, -// Persistent Object Service V1.0, 3/94 - -// // #include "CosPersistencePDS.idl" -// CosPersistencePDS.idl -// // #includes CosPersistencePID.idl - -module CosPersistencePO { - - interface PO { - attribute ::COSS::CosPersistencePID::PID p; - ::COSS::CosPersistencePDS::PDS connect ( - in ::COSS::CosPersistencePID::PID p); - void disconnect (in ::COSS::CosPersistencePID::PID p); - void store (in ::COSS::CosPersistencePID::PID p); - void restore (in ::COSS::CosPersistencePID::PID p); - void delete (in ::COSS::CosPersistencePID::PID p); - }; - - interface SD { - void pre_store(); - void post_restore(); - }; -}; - - -// CosPersistencePOM Module, p 5-15 CORBAservices, -// Persistent Object Service V1.0, 3/94 - -// #include "CosPersistencePDS.idl" - -// CosPersistencePDS.idl // #includes CosPersistencePID.idl - -module CosPersistencePOM { - -// interface Object; - - interface POM { - ::COSS::CosPersistencePDS::PDS connect ( - in Object obj, - in ::COSS::CosPersistencePID::PID p); - void disconnect ( - in Object obj, - in ::COSS::CosPersistencePID::PID p); - void store ( - in Object obj, - in ::COSS::CosPersistencePID::PID p); - void restore ( - in Object obj, - in ::COSS::CosPersistencePID::PID p); - void delete ( - in Object obj, - in ::COSS::CosPersistencePID::PID p); - }; - }; - -// CosPersistencePDS_DA Module, p 5-22 CORBAservices, -// Persistent Object Service, V1.0, 3/94 - -// #include "CosPersistencePDS.idl" -// CosPersistencePDS.idl // #includes CosPersistencePID.idl - -module CosPersistencePDS_DA { - - typedef string DAObjectID; - - interface PID_DA : ::COSS::CosPersistencePID::PID { - attribute DAObjectID oid; - }; - - interface DAObject { - boolean dado_same(in DAObject d); - DAObjectID dado_oid(); - PID_DA dado_pid(); - void dado_remove(); - void dado_free(); - }; - - interface DAObjectFactory { - DAObject create(); - }; - - interface DAObjectFactoryFinder { - DAObjectFactory find_factory(in string key); - }; - - interface PDS_DA : ::COSS::CosPersistencePDS::PDS { - DAObject get_data(); - void set_data(in DAObject new_data); - DAObject lookup(in DAObjectID id); - PID_DA get_pid(); - PID_DA get_object_pid(in DAObject dao); - DAObjectFactoryFinder data_factories(); - }; - - typedef sequence AttributeNames; - interface DynamicAttributeAccess { - AttributeNames attribute_names(); - any attribute_get(in string name); - void attribute_set(in string name, in any value); - }; - - typedef string ClusterID; - typedef sequence ClusterIDs; - interface PDS_ClusteredDA : PDS_DA{ - ClusterID cluster_id(); - string cluster_kind(); - ClusterIDs clusters_of(); - PDS_ClusteredDA create_cluster(in string kind); - PDS_ClusteredDA open_cluster(in ClusterID cluster); - PDS_ClusteredDA copy_cluster( - in PDS_DA source); - }; -}; - -// CosPersistenceDDO Module, p 5-32 CORBAservices, Persistent Object Service V1.0, 3/94 - -// #include "CosPersistencePID.idl" -module CosPersistenceDDO { - - interface DDO { - attribute string object_type; - attribute ::COSS::CosPersistencePID::PID p; - short add_data(); - short add_data_property (in short data_id); - short get_data_count(); - short get_data_property_count (in short data_id); - void get_data_property (in short data_id, - in short property_id, - out string property_name, - out any property_value); - void set_data_property (in short data_id, - in short property_id, - in string property_name, - in any property_value); - void get_data (in short data_id, - out string data_name, - out any data_value); - void set_data (in short data_id, - in string data_name, - in any data_value); - }; -}; - -// CosPersistenceDS_CLI module, p 5-34 CORBAservices, -// Persistent Object Service V1.0, 3/94 - -// #include "CosPersistenceDDO.idl" -// CosPersistenceDDO.idl // #includes CosPersistencePID.idl - -module CosPersistenceDS_CLI { - interface UserEnvironment { - void set_option (in long option,in any value); - void get_option (in long option,out any value); - void release(); - }; - - interface Connection { - void set_option (in long option,in any value); - void get_option (in long option,out any value); - }; - - interface ConnectionFactory { - Connection create_object ( - in UserEnvironment user_envir); - }; - - interface Cursor { - void set_position (in long position,in any value); - ::COSS::CosPersistenceDDO::DDO fetch_object(); - }; - - interface CursorFactory { - Cursor create_object ( - in Connection connection); - }; - - interface PID_CLI : ::COSS::CosPersistencePID::PID { - attribute string datastore_id; - attribute string id; - }; - - - - interface Datastore_CLI { - void connect (in Connection connection, - in string datastore_id, - in string user_name, - in string authentication); - void disconnect (in Connection connection); - Connection get_connection ( - in string datastore_id, - in string user_name); - void add_object (in Connection connection, - in ::COSS::CosPersistenceDDO::DDO data_obj); - void delete_object ( - in Connection connection, - in ::COSS::CosPersistenceDDO::DDO data_obj); - void update_object ( - in Connection connection, - in ::COSS::CosPersistenceDDO::DDO data_obj); - void retrieve_object( - in Connection connection, - in ::COSS::CosPersistenceDDO::DDO data_obj); - Cursor select_object( - in Connection connection, - in string key); - void transact (in UserEnvironment user_envir, - in short completion_type); - void assign_PID (in PID_CLI p); - void assign_PID_relative ( - in PID_CLI source_pid, - in PID_CLI target_pid); - boolean is_identical_PID ( - in PID_CLI pid_1, - in PID_CLI pid_2); - string get_object_type (in PID_CLI p); - void register_mapping_schema (in string schema_file); - Cursor execute (in Connection connection, - in string command); - }; - -}; - - -// CosLifeCycle Module, p 6-10 CORBAservices, LifeCycle Service V1.0, 3/94 - -// #include "Naming.idl" - -module CosLifeCycle -{ - typedef ::COSS::CosNaming::Name Key; - typedef Object Factory; - typedef sequence Factories; - typedef struct NVP { - ::COSS::CosNaming::Istring name; - any value; - } NameValuePair; - typedef sequence Criteria; - - exception NoFactory { - Key search_key; - }; - exception NotCopyable { string reason; }; - exception NotMovable { string reason; }; - exception NotRemovable { string reason; }; - exception InvalidCriteria{ - Criteria invalid_criteria; - }; - exception CannotMeetCriteria { - Criteria unmet_criteria; - }; - - - interface FactoryFinder { - Factories find_factories(in Key factory_key) - raises(NoFactory); - }; - - interface LifeCycleObject { - LifeCycleObject copy(in FactoryFinder there, - in Criteria the_criteria) - raises(NoFactory, NotCopyable, InvalidCriteria, - CannotMeetCriteria); - void move(in FactoryFinder there, - in Criteria the_criteria) - raises(NoFactory, NotMovable, InvalidCriteria, - CannotMeetCriteria); - void remove() - raises(NotRemovable); - }; - - interface GenericFactory { - boolean supports(in Key k); - Object create_object( - in Key k, - in Criteria the_criteria) - raises (NoFactory, InvalidCriteria, - CannotMeetCriteria); - }; -}; - - - -// LifeCycleService Module, p 6- 55 CORBAservices, Life Cycle -// Service V1.0, 3/94 - -// #include "LifeCycle.idl" - -module LifeCycleService { - - typedef sequence <::COSS::CosLifeCycle::NameValuePair> PolicyList; - typedef sequence <::COSS::CosLifeCycle::Key> Keys; - typedef sequence <::COSS::CosLifeCycle::NameValuePair> PropertyList; - typedef sequence <::COSS::CosNaming::NameComponent> NameComponents; - - interface LifeCycleServiceAdmin { - - attribute PolicyList policies; - - void bind_generic_factory( - in ::COSS::CosLifeCycle::GenericFactory gf, - in ::COSS::CosNaming::NameComponent name, - in Keys key_set, - in PropertyList other_properties) - raises (::COSS::CosNaming::NamingContext::AlreadyBound, ::COSS::CosNaming::NamingContext::InvalidName); - - void unbind_generic_factory( - in ::COSS::CosNaming::NameComponent name) - raises (::COSS::CosNaming::NamingContext::NotFound, ::COSS::CosNaming::NamingContext::InvalidName); - - ::COSS::CosLifeCycle::GenericFactory resolve_generic_factory( - in ::COSS::CosNaming::NameComponent name) - raises (::COSS::CosNaming::NamingContext::NotFound, ::COSS::CosNaming::NamingContext::InvalidName); - - NameComponents list_generic_factories(); - - boolean match_service (in ::COSS::CosLifeCycle::GenericFactory f); - - string get_hint(); - - void get_link_properties( - in ::COSS::CosNaming::NameComponent name, - out Keys key_set, - out PropertyList other_properties) - raises (::COSS::CosNaming::NamingContext::NotFound, ::COSS::CosNaming::NamingContext::InvalidName); - }; -}; - -// CosTransactions Module, p 10-66 -// CORBAservices, Transaction Service V1.0, 3/94 - -module CosTransactions { -// DATATYPES -enum Status { - StatusActive, - StatusMarkedRollback, - StatusPrepared, - StatusCommitted, - StatusRolledBack, - StatusUnknown, - StatusNoTransaction -}; - -enum Vote { - VoteCommit, - VoteRollback, - VoteReadOnly -}; - -// Standard exceptions -exception TransactionRequired {}; -exception TransactionRolledBack {}; -exception InvalidTransaction {}; - -// Heuristic exceptions -exception HeuristicRollback {}; -exception HeuristicCommit {}; -exception HeuristicMixed {}; -exception HeuristicHazard {}; - -// Exception from Orb operations -exception WrongTransaction {}; - -// Other transaction-specific exceptions -exception SubtransactionsUnavailable {}; -exception NotSubtransaction {}; -exception Inactive {}; -exception NotPrepared {}; -exception NoTransaction {}; -exception InvalidControl {}; -exception Unavailable {}; - -// Forward references for interfaces defined later in module -interface Control; -interface Terminator; -interface Coordinator; -interface Resource; -interface RecoveryCoordinator; -interface SubtransactionAwareResource; -interface TransactionFactory; -interface TransactionalObject; -interface Current; - -// Current transaction pseudo object (PIDL) - interface Current { - void begin() - raises(SubtransactionsUnavailable); - void commit(in boolean report_heuristics) - raises( - NoTransaction, - HeuristicMixed, - HeuristicHazard - ); - void rollback() - raises(NoTransaction); - void rollback_only() - raises(NoTransaction); - - Status get_status(); - string get_transaction_name(); - void set_timeout(in unsigned long seconds); - - Control get_control(); - Control suspend(); - void resume(in Control which) - raises(InvalidControl); - }; - - interface TransactionFactory { - Control create(in unsigned long time_out); - }; - - interface Control { - Terminator get_terminator() - raises(Unavailable); - Coordinator get_coordinator() - raises(Unavailable); - }; - - interface Terminator { - void commit(in boolean report_heuristics) - raises( - HeuristicMixed, - HeuristicHazard - ); - void rollback(); - }; - - - interface Coordinator { - - Status get_status(); - Status get_parent_status(); - Status get_top_level_status(); - - boolean is_same_transaction(in Coordinator tc); - boolean is_related_transaction(in Coordinator tc); - boolean is_ancestor_transaction(in Coordinator tc); - boolean is_descendant_transaction(in Coordinator tc); - boolean is_top_level_transaction(); - - unsigned long hash_transaction(); - unsigned long hash_top_level_tran(); - - RecoveryCoordinator register_resource(in Resource r) - raises(Inactive); - - void register_subtran_aware(in SubtransactionAwareResource r) - raises(Inactive, NotSubtransaction); - - void rollback_only() - raises(Inactive); - - string get_transaction_name(); - - Control create_subtransaction() - raises(SubtransactionsUnavailable, Inactive); - }; - - interface RecoveryCoordinator { - Status replay_completion(in Resource r) - raises(NotPrepared); - }; - -}; // end module CosTransactions - - -// CosConcurrency Control Module, p 7-8 CORBAservices, -// Concurrency Control Service V1.0, 3/94 - -// #include -module CosConcurrencyControl { - - enum lock_mode { - read, - write, - upgrade, - intention_read, - intention_write - }; - - exception LockNotHeld{}; - - interface LockCoordinator - { - void drop_locks(); - }; - - interface LockSet - { - void lock(in lock_mode mode); - boolean try_lock(in lock_mode mode); - - void unlock(in lock_mode mode) - raises(LockNotHeld); - void change_mode(in lock_mode held_mode, - in lock_mode new_mode) - raises(LockNotHeld); - LockCoordinator get_coordinator( - in ::COSS::CosTransactions::Coordinator which); - }; - - interface TransactionalLockSet - { - void lock(in ::COSS::CosTransactions::Coordinator current, - in lock_mode mode); - boolean try_lock(in ::COSS::CosTransactions::Coordinator current, - in lock_mode mode); - void unlock(in ::COSS::CosTransactions::Coordinator current, - in lock_mode mode) - raises(LockNotHeld); - void change_mode(in ::COSS::CosTransactions::Coordinator current, - in lock_mode held_mode, - in lock_mode new_mode) - raises(LockNotHeld); - LockCoordinator get_coordinator( - in ::COSS::CosTransactions::Coordinator which); - }; - - interface LockSetFactory - { - LockSet create(); - LockSet create_related(in LockSet which); - TransactionalLockSet create_transactional(); - TransactionalLockSet create_transactional_related(in - TransactionalLockSet which); - }; -}; - -// CosObjectIdentity Module, p 9-19 CORBAservices, Relationship -// Service V1.0, 3/94 - - -module CosObjectIdentity { - - typedef unsigned long ObjectIdentifier; - - interface IdentifiableObject { - readonly attribute ObjectIdentifier constant_random_id; - boolean is_identical ( - in IdentifiableObject other_object); - }; - -}; - - -// CosRelationships Module, p 9-21 CORBAservices, Relationship -// Service V1.0, 3/94 - -// #include - -module CosRelationships { - - interface RoleFactory; - interface RelationshipFactory; - interface Relationship; - interface Role; - interface RelationshipIterator; - - typedef Object RelatedObject; - typedef sequence Roles; - typedef string RoleName; - typedef sequence RoleNames; - - struct NamedRole {RoleName name; Role aRole;}; - typedef sequence NamedRoles; - - struct RelationshipHandle { - Relationship the_relationship; - ::COSS::CosObjectIdentity::ObjectIdentifier constant_random_id; - }; - typedef sequence RelationshipHandles; - - interface RelationshipFactory { - struct NamedRoleType { - RoleName name; - ::CORBA::InterfaceDef named_role_type; - }; - typedef sequence NamedRoleTypes; - readonly attribute ::CORBA::InterfaceDef relationship_type; - readonly attribute unsigned short degree; - readonly attribute NamedRoleTypes named_role_types; - exception RoleTypeError {NamedRoles culprits;}; - exception MaxCardinalityExceeded { - NamedRoles culprits;}; - exception DegreeError {unsigned short required_degree;}; - exception DuplicateRoleName {NamedRoles culprits;}; - exception UnknownRoleName {NamedRoles culprits;}; - - Relationship create (in NamedRoles named_roles) - raises (RoleTypeError, - MaxCardinalityExceeded, - DegreeError, - DuplicateRoleName, - UnknownRoleName); - }; - - interface Relationship : - ::COSS::CosObjectIdentity::IdentifiableObject { - exception CannotUnlink { - Roles offending_roles; - }; - readonly attribute NamedRoles named_roles; - void destroy () raises(CannotUnlink); - }; - - interface Role { - exception UnknownRoleName {}; - exception UnknownRelationship {}; - exception RelationshipTypeError {}; - exception CannotDestroyRelationship { - RelationshipHandles offenders; - }; - exception ParticipatingInRelationship { - RelationshipHandles the_relationships; - }; - readonly attribute RelatedObject related_object; - RelatedObject get_other_related_object ( - in RelationshipHandle rel, - in RoleName target_name) - raises (UnknownRoleName, - UnknownRelationship); - Role get_other_role (in RelationshipHandle rel, - in RoleName target_name) - raises (UnknownRoleName, UnknownRelationship); - void get_relationships ( - in unsigned long how_many, - out RelationshipHandles rels, - out RelationshipIterator iterator); - void destroy_relationships() - raises(CannotDestroyRelationship); - void destroy() raises(ParticipatingInRelationship); - boolean check_minimum_cardinality (); - void link (in RelationshipHandle rel, - in NamedRoles named_roles) - raises(RelationshipFactory::MaxCardinalityExceeded, - RelationshipTypeError); - void unlink (in RelationshipHandle rel) - raises (UnknownRelationship); - }; - - interface RoleFactory { - exception NilRelatedObject {}; - exception RelatedObjectTypeError {}; - readonly attribute ::CORBA::InterfaceDef role_type; - readonly attribute unsigned long max_cardinality; - readonly attribute unsigned long min_cardinality; -// the following isn't allowed in IDL, -// readonly attribute sequence <::CORBA::InterfaceDef> related_object_types; - typedef sequence <::CORBA::InterfaceDef> InterfaceDefSeq; - readonly attribute InterfaceDefSeq related_object_types; - Role create_role (in RelatedObject related_object) - raises (NilRelatedObject, RelatedObjectTypeError); - }; - - interface RelationshipIterator { - boolean next_one (out RelationshipHandle rel); - boolean next_n (in unsigned long how_many, - out RelationshipHandles rels); - void destroy (); - }; - -}; - -// CosCompoundExternalization Module, p 8-20 CORBAservices, -// Externalization Service V1.0, 3/94 - -// #include -// #include - -// CosGraphs Module, p 9-39 CORBAservices, Relationship Service -// V1.0, 3/94 - -// #include -// #include - -module CosGraphs { - - interface TraversalFactory; - interface Traversal; - interface TraversalCriteria; - interface Node; - interface NodeFactory; - interface Role; - interface EdgeIterator; - - struct NodeHandle { - Node the_node; - ::COSS::CosObjectIdentity::ObjectIdentifier constant_random_id; - }; - typedef sequence NodeHandles; - - struct NamedRole { - Role the_role; - ::COSS::CosRelationships::RoleName the_name; - }; - typedef sequence NamedRoles; - - struct EndPoint { - NodeHandle the_node; - NamedRole the_role; - }; - typedef sequence EndPoints; - - struct Edge { - EndPoint from; - ::COSS::CosRelationships::RelationshipHandle the_relationship; - EndPoints relatives; - }; - typedef sequence Edges; - - enum PropagationValue {deep, shallow, none, inhibit}; - enum Mode {depthFirst, breadthFirst, bestFirst}; - - interface TraversalFactory { - Traversal create_traversal_on ( - in NodeHandle root_node, - in TraversalCriteria the_criteria, - in Mode how); - }; - - interface Traversal { - typedef unsigned long TraversalScopedId; - struct ScopedEndPoint { - EndPoint point; - TraversalScopedId id; - }; - typedef sequence ScopedEndPoints; - struct ScopedRelationship { - ::COSS::CosRelationships::RelationshipHandle - scoped_relationship; - TraversalScopedId id; - }; - struct ScopedEdge { - ScopedEndPoint from; - ScopedRelationship the_relationship; - ScopedEndPoints relatives; - }; - typedef sequence ScopedEdges; - boolean next_one (out ScopedEdge the_edge); - boolean next_n (in short how_many, - out ScopedEdges the_edges); - void destroy (); - }; - - interface TraversalCriteria { - struct WeightedEdge { - Edge the_edge; - unsigned long weight; - sequence next_nodes; - }; - typedef sequence WeightedEdges; - void visit_node(in NodeHandle a_node, - in Mode search_mode); - boolean next_one (out WeightedEdge the_edge); - boolean next_n (in short how_many, - out WeightedEdges the_edges); - void destroy(); - }; - - interface Node: ::COSS::CosObjectIdentity::IdentifiableObject { - typedef sequence Roles; - exception NoSuchRole {}; - exception DuplicateRoleType {}; - - readonly attribute ::COSS::CosRelationships::RelatedObject - related_object; - readonly attribute Roles roles_of_node; - Roles roles_of_type ( - in ::CORBA::InterfaceDef role_type); - void add_role (in Role a_role) - raises (DuplicateRoleType); - void remove_role (in ::CORBA::InterfaceDef of_type) - raises (NoSuchRole); - }; - - interface NodeFactory { - Node create_node (in Object related_object); - }; - - interface Role : ::COSS::CosRelationships::Role { - void get_edges ( in long how_many, - out Edges the_edges, - out EdgeIterator the_rest); - }; - - interface EdgeIterator { - boolean next_one (out Edge the_edge); - boolean next_n ( in unsigned long how_many, - out Edges the_edges); - void destroy (); - }; - -}; - - - -// CosStream Module, 8-15 CORBAservices, -// Externalization Service V1.0, 3/94 - -// #include -// #include -// #include -module CosStream { - exception ObjectCreationError{}; - exception StreamDataFormatError{}; - interface StreamIO; - - interface Streamable: ::COSS::CosObjectIdentity::IdentifiableObject - { - readonly attribute ::COSS::CosLifeCycle::Key external_form_id; - void externalize_to_stream( - in StreamIO targetStreamIO); - void internalize_from_stream( - in StreamIO sourceStreamIO, - in ::COSS::CosLifeCycle::FactoryFinder there) - raises( ::COSS::CosLifeCycle::NoFactory, - ObjectCreationError, - StreamDataFormatError ); - }; - - interface StreamableFactory { - Streamable create_uninitialized(); - }; - - - interface StreamIO { - void write_string(in string aString); - void write_char(in char aChar); - void write_octet(in octet anOctet); - void write_unsigned_long( - in unsigned long anUnsignedLong); - void write_unsigned_short( - in unsigned short anUnsignedShort); - void write_long(in long aLong); - void write_short(in short aShort); - void write_float(in float aFloat); - void write_double(in double aDouble); - void write_boolean(in boolean aBoolean); - void write_object(in Streamable aStreamable); - // void write_graph(in ::COSS::CosCompoundExternalization::Node aNode); - string read_string() - raises(StreamDataFormatError); - char read_char() - raises(StreamDataFormatError ); - octet read_octet() - raises(StreamDataFormatError ); - unsigned long read_unsigned_long() - raises(StreamDataFormatError ); - unsigned short read_unsigned_short() - raises( StreamDataFormatError ); - long read_long() - raises(StreamDataFormatError ); - short read_short() - raises(StreamDataFormatError ); - float read_float() - raises(StreamDataFormatError ); - double read_double() - raises(StreamDataFormatError ); - boolean read_boolean() - raises(StreamDataFormatError ); - Streamable read_object( - in ::COSS::CosLifeCycle::FactoryFinder there, - in Streamable aStreamable) - raises(StreamDataFormatError ); -// void read_graph( -// in ::COSS::CosCompoundExternalization::Node starting_node, -// in ::COSS::CosLifeCycle::FactoryFinder there) -// raises(StreamDataFormatError ); - }; -}; - -module CosCompoundExternalization { - interface Node; - interface Role; - interface Relationship; - interface PropagationCriteriaFactory; - - struct RelationshipHandle { - Relationship theRelationship; - ::COSS::CosObjectIdentity::ObjectIdentifier constantRandomId; - }; - - interface Node : ::COSS::CosGraphs::Node, ::COSS::CosStream::Streamable{ - void externalize_node (in ::COSS::CosStream::StreamIO sio); - void internalize_node (in ::COSS::CosStream::StreamIO sio, - in ::COSS::CosLifeCycle::FactoryFinder there, - out ::COSS::CosGraphs::Node::Roles rolesOfNode) - raises (::COSS::CosLifeCycle::NoFactory); - }; - - interface Role : ::COSS::CosGraphs::Role { - void externalize_role (in ::COSS::CosStream::StreamIO sio); - void internalize_role (in ::COSS::CosStream::StreamIO sio); - ::COSS::CosGraphs::PropagationValue externalize_propagation ( - in RelationshipHandle rel, - in ::COSS::CosRelationships::RoleName toRoleName, - out boolean sameForAll); - }; - - interface Relationship : - ::COSS::CosRelationships::Relationship { - void externalize_relationship ( - in ::COSS::CosStream::StreamIO sio); - void internalize_relationship( - in ::COSS::CosStream::StreamIO sio, - in ::COSS::CosGraphs::NamedRoles newRoles); - ::COSS::CosGraphs::PropagationValue externalize_propagation ( - in ::COSS::CosRelationships::RoleName fromRoleName, - in ::COSS::CosRelationships::RoleName toRoleName, - out boolean sameForAll); - }; - - interface PropagationCriteriaFactory { - ::COSS::CosGraphs::TraversalCriteria create_for_externalize( ); - }; - -}; - -// CosExternalization Module, 8-12 CORBAservices, -// Externalization Service V1.0, 3/94 - - -// #include -// #include -module CosExternalization { - exception InvalidFileNameError{}; - exception ContextAlreadyRegistered{}; - interface Stream: ::COSS::CosLifeCycle::LifeCycleObject{ - void externalize( - in ::COSS::CosStream::Streamable theObject); - ::COSS::CosStream::Streamable internalize( - in ::COSS::CosLifeCycle::FactoryFinder there) - raises( ::COSS::CosLifeCycle::NoFactory, - ::COSS::CosStream::StreamDataFormatError ); - void begin_context() - raises( ContextAlreadyRegistered); - void end_context(); - void flush(); - }; - interface StreamFactory { - Stream create(); - }; - interface FileStreamFactory { - Stream create( - in string theFileName) - raises( InvalidFileNameError ); - }; -}; - -// CosContainment Module, p 9- 48 CORBAservices, Relationship -// Service V1.0, 3/94 - -// #include - -module CosContainment { - - interface Relationship : - ::COSS::CosRelationships::Relationship {}; - - interface ContainsRole : ::COSS::CosGraphs::Role {}; - - interface ContainedInRole : ::COSS::CosGraphs::Role {}; - -}; - -// CosExternalizationContainment Module, p 8-26 CORBAservices, -// Externalization Service V1.0, 3/94 - -// #include -// #include - -module CosExternalizationContainment { - - interface Relationship : - ::COSS::CosCompoundExternalization::Relationship, - ::COSS::CosContainment::Relationship {}; - - interface ContainsRole : - ::COSS::CosCompoundExternalization::Role, - ::COSS::CosContainment::ContainsRole {}; - - interface ContainedInRole : - ::COSS::CosCompoundExternalization::Role, - ::COSS::CosContainment::ContainedInRole {}; -}; - -// CosReference Module, p 9-50 CORBAservices, -// Relationship Service V1.0, 3/94 - -// #include - -module CosReference { - - interface Relationship : - ::COSS::CosRelationships::Relationship {}; - - interface ReferencesRole : ::COSS::CosGraphs::Role {}; - - interface ReferencedByRole : ::COSS::CosGraphs::Role {}; - -}; - -// CosExternalizationReference Module, p 8-28 CORBAservices, -// Externalization Service V1.0, 3/94 - -// #include -// #include - -module CosExternalizationReference { - - interface Relationship : - ::COSS::CosCompoundExternalization::Relationship, - ::COSS::CosReference::Relationship {}; - - interface ReferencesRole : - ::COSS::CosCompoundExternalization::Role, - ::COSS::CosReference::ReferencesRole {}; - - interface ReferencedByRole : - ::COSS::CosCompoundExternalization::Role, - ::COSS::CosReference::ReferencedByRole {}; -}; - -// PIDL for CosTSInteroperation Module, p 10-59 -// CORBAservices, Transaction Service V1.0, 3/94 -module CosTSInteroperation { // PIDL - struct otid_t { - long formatID; /*format identifier. 0 is OSI TP */ - long bequal_length; - sequence tid; - }; - struct TransIdentity { - ::COSS::CosTransactions::Coordinator coordinator; - ::COSS::CosTransactions::Terminator terminator; - otid_t otid; - }; - struct PropagationContext { - unsigned long timeout; - TransIdentity current; - sequence parents; - any implementation_specific_data; - }; -}; - -// PIDL for CosTSPortability Module, p 10-63 -// CORBAservices, Transaction Service V1.0, 3/94 - -module CosTSPortability { // PIDL - typedef long ReqId; - - interface Sender { - void sending_request(in ReqId id, - out ::COSS::CosTSInteroperation::PropagationContext ctx); - void received_reply(in ReqId id, - in ::COSS::CosTSInteroperation::PropagationContext ctx, - in ::CORBA::Environment env); - }; - - interface Receiver { - void received_request(in ReqId id, - in ::COSS::CosTSInteroperation::PropagationContext ctx); - void sending_reply(in ReqId id, - out::COSS::CosTSInteroperation::PropagationContext ctx); - }; -}; - -// CosCompoundLifeCycle Module, p 6-30 CORBAservices, -// Life Cycle Service V1.0, 3/94 - -// #include -// #include -// #include - -module CosCompoundLifeCycle { - interface OperationsFactory; - interface Operations; - interface Node; - interface Role; - interface Relationship; - interface PropagationCriteriaFactory; - - enum Operation {copy, move, remove}; - - struct RelationshipHandle { - Relationship the_relationship; - ::COSS::CosObjectIdentity::ObjectIdentifier constant_random_id; - }; - - interface OperationsFactory { - Operations create_compound_operations(); - }; - - interface Operations { - Node copy ( - in Node starting_node, - in ::COSS::CosLifeCycle::FactoryFinder there, - in ::COSS::CosLifeCycle::Criteria the_criteria) - raises (::COSS::CosLifeCycle::NoFactory, - ::COSS::CosLifeCycle::NotCopyable, - ::COSS::CosLifeCycle::InvalidCriteria, - ::COSS::CosLifeCycle::CannotMeetCriteria); - void move ( - in Node starting_node, - in ::COSS::CosLifeCycle::FactoryFinder there, - in ::COSS::CosLifeCycle::Criteria the_criteria) - raises (::COSS::CosLifeCycle::NoFactory, - ::COSS::CosLifeCycle::NotMovable, - ::COSS::CosLifeCycle::InvalidCriteria, - ::COSS::CosLifeCycle::CannotMeetCriteria); - void remove (in Node starting_node) - raises (::COSS::CosLifeCycle::NotRemovable); - void destroy(); - }; - - interface Node : ::COSS::CosGraphs::Node { - exception NotLifeCycleObject {}; - void copy_node ( in ::COSS::CosLifeCycle::FactoryFinder there, - in ::COSS::CosLifeCycle::Criteria the_criteria, - out Node new_node, - out ::COSS::CosGraphs::Node::Roles roles_of_new_node) - raises (::COSS::CosLifeCycle::NoFactory, - ::COSS::CosLifeCycle::NotCopyable, - ::COSS::CosLifeCycle::InvalidCriteria, - ::COSS::CosLifeCycle::CannotMeetCriteria); - void move_node (in ::COSS::CosLifeCycle::FactoryFinder there, - in ::COSS::CosLifeCycle::Criteria the_criteria) - raises (::COSS::CosLifeCycle::NoFactory, - ::COSS::CosLifeCycle::NotMovable, - ::COSS::CosLifeCycle::InvalidCriteria, - ::COSS::CosLifeCycle::CannotMeetCriteria); - void remove_node () - raises (::COSS::CosLifeCycle::NotRemovable); - ::COSS::CosLifeCycle::LifeCycleObject get_life_cycle_object() - raises (NotLifeCycleObject); - }; - - interface Role : ::COSS::CosGraphs::Role { - Role copy_role (in ::COSS::CosLifeCycle::FactoryFinder there, - in ::COSS::CosLifeCycle::Criteria the_criteria) - raises (::COSS::CosLifeCycle::NoFactory, - ::COSS::CosLifeCycle::NotCopyable, - ::COSS::CosLifeCycle::InvalidCriteria, - ::COSS::CosLifeCycle::CannotMeetCriteria); - void move_role (in ::COSS::CosLifeCycle::FactoryFinder there, - in ::COSS::CosLifeCycle::Criteria the_criteria) - raises (::COSS::CosLifeCycle::NoFactory, - ::COSS::CosLifeCycle::NotMovable, - ::COSS::CosLifeCycle::InvalidCriteria, - ::COSS::CosLifeCycle::CannotMeetCriteria); - ::COSS::CosGraphs::PropagationValue life_cycle_propagation ( - in Operation op, - in RelationshipHandle rel, - in ::COSS::CosRelationships::RoleName to_role_name, - out boolean same_for_all); - }; - - interface Relationship : - ::COSS::CosRelationships::Relationship { - Relationship copy_relationship ( - in ::COSS::CosLifeCycle::FactoryFinder there, - in ::COSS::CosLifeCycle::Criteria the_criteria, - in ::COSS::CosGraphs::NamedRoles new_roles) - raises (::COSS::CosLifeCycle::NoFactory, - ::COSS::CosLifeCycle::NotCopyable, - ::COSS::CosLifeCycle::InvalidCriteria, - ::COSS::CosLifeCycle::CannotMeetCriteria); - void move_relationship ( - in ::COSS::CosLifeCycle::FactoryFinder there, - in ::COSS::CosLifeCycle::Criteria the_criteria) - raises (::COSS::CosLifeCycle::NoFactory, - ::COSS::CosLifeCycle::NotMovable, - ::COSS::CosLifeCycle::InvalidCriteria, - ::COSS::CosLifeCycle::CannotMeetCriteria); - ::COSS::CosGraphs::PropagationValue life_cycle_propagation ( - in Operation op, - in ::COSS::CosRelationships::RoleName from_role_name, - in ::COSS::CosRelationships::RoleName to_role_name, - out boolean same_for_all); - }; - - interface PropagationCriteriaFactory { - ::COSS::CosGraphs::TraversalCriteria create(in Operation op); - }; - -}; - -// CosLifeCycleContainment Module, p 6-42 CORBAservices, -// Life Cycle Service V1.0, 3/94 - -// #include -// #include - -module CosLifeCycleContainment { - - interface Relationship : - ::COSS::CosCompoundLifeCycle::Relationship, - ::COSS::CosContainment::Relationship {}; - - interface ContainsRole : - ::COSS::CosCompoundLifeCycle::Role, - ::COSS::CosContainment::ContainsRole {}; - - interface ContainedInRole : - ::COSS::CosCompoundLifeCycle::Role, - ::COSS::CosContainment::ContainedInRole {}; -}; - -// CosLifeCycleReference Module, p 6-44 CORBAservices, -// Life Cycle Service V1.0, 3/94 - -// #include -// #include - -module CosLifeCycleReference { - - interface Relationship : - ::COSS::CosCompoundLifeCycle::Relationship, - ::COSS::CosReference::Relationship {}; - - interface ReferencesRole : - ::COSS::CosCompoundLifeCycle::Role, - ::COSS::CosReference::ReferencesRole {}; - - interface ReferencedByRole : - ::COSS::CosCompoundLifeCycle::Role, - ::COSS::CosReference::ReferencedByRole {}; -}; - - -}; // end module COSS diff --git a/lib/ic/test/ic_SUITE_data/attr.idl b/lib/ic/test/ic_SUITE_data/attr.idl deleted file mode 100644 index 0a1edc787c..0000000000 --- a/lib/ic/test/ic_SUITE_data/attr.idl +++ /dev/null @@ -1,30 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -interface I1 { - attribute long a1, a2; - attribute char a3; -}; - -interface I2 : I1 { - attribute short a4; - readonly attribute char a5; -}; - diff --git a/lib/ic/test/ic_SUITE_data/c_err1.idl b/lib/ic/test/ic_SUITE_data/c_err1.idl deleted file mode 100644 index d50c51c807..0000000000 --- a/lib/ic/test/ic_SUITE_data/c_err1.idl +++ /dev/null @@ -1,64 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// -// This file forces the bad_tk_match. This triggers when the type of -// the expression does not match the declared type of the constant -// - -const long c1 = TRUE; -const unsigned short c1b= TRUE; -const boolean c2 = +5; -const long c3 = 'c'; -const float c5 = 3; -const unsigned long c6 = -2; // Maybe not checked in compiler or suite - -const boolean c4 = 1 | 2; - - -// Now define some correct constants for use in reference checking - -const long longC = -9; -const short shortC = -9; -const unsigned long ulongC = 1; -const unsigned short ushortC = 0; - -const float floatC = 5.1; -const double doubleC = -2.111; - -const boolean boolC = TRUE; - -const char charC = 'f'; -const string stringC = "hej"; -const string<9> stringCb = "hejdu"; - -// Check the reference errors - -const long c19 = floatC; -const short c20 = doubleC; -const unsigned long c21 = charC; -const unsigned short c22 = stringC; -const float c23 = stringCb; -const double c24 = boolC; -const boolean c25 = longC; -const char c26 = shortC; -const string c27 = ushortC; -const string<9> c28 = ulongC; -const long c29 = 3+floatC; diff --git a/lib/ic/test/ic_SUITE_data/c_err2.idl b/lib/ic/test/ic_SUITE_data/c_err2.idl deleted file mode 100644 index 84c12421ef..0000000000 --- a/lib/ic/test/ic_SUITE_data/c_err2.idl +++ /dev/null @@ -1,31 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// -// Checks bad type of operands -// - - -const long c1 = 1 + TRUE; -const boolean c3 = TRUE | FALSE | 19.8; -const long c4 = 1 << TRUE; -const long c5 = TRUE >> TRUE; - - diff --git a/lib/ic/test/ic_SUITE_data/c_err3.idl b/lib/ic/test/ic_SUITE_data/c_err3.idl deleted file mode 100644 index 910f7abcf1..0000000000 --- a/lib/ic/test/ic_SUITE_data/c_err3.idl +++ /dev/null @@ -1,29 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// -// Checks ill-formed expressions (type conflict in operands) -// - - -const long c1 = 5|TRUE; -const long c2 = 5&TRUE; -const long c3 = 5^TRUE; - diff --git a/lib/ic/test/ic_SUITE_data/c_norm.idl b/lib/ic/test/ic_SUITE_data/c_norm.idl deleted file mode 100644 index b573ac3f3d..0000000000 --- a/lib/ic/test/ic_SUITE_data/c_norm.idl +++ /dev/null @@ -1,164 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// -// Check normal values and expressions for constants -// - -// Integer types -const long co1 = 077; -const long ch1 = 0xf1; -const long ch2 = 0XAB; -const long c1 = 1; -const short c2 = 3; -const unsigned long c3 = 1; -const unsigned short c4 = 3; - -// Unary ops -const long c1hb = -0x1; -const long c1b = -1; -const short c2b = -3; -const long c1c = +1; -const short c2c = +3; -// ~ not supported - -// Check binary ops -const long c1d = 9+1-3; -const long c1hd = 9+1-0xf3; -const short c2d = 7+3; -const short c2e = 7*3; -const long c1e = 1 | 7; -const long c1f = 7 & 9; -const long c1g = (1 | 7) & 9; -const long c1h = 1^7; - -//floats -const float c5 = 1.9; -const double c6 = 1.9; -const float c5b = -1.9; -const double c6b = -1.9; - -// Check type operand casting -const float c5c = 1/(9+2) * 2; -const double c6c = 1.9-1; -//const double c6d = 1; // Does not work yet - -// Booleans and expressions -const boolean c7 = TRUE; -const boolean c7b = FALSE; -const boolean c7c = TRUE | FALSE; -const boolean c7d = TRUE & FALSE; -const boolean c7e = TRUE&TRUE | FALSE&TRUE; -const boolean c7f = TRUE&TRUE ^ FALSE&TRUE; - -// Character and string -const char c8 = 'c'; -const char c8b = '\n'; -const string c9 = "hej"; -const string<9> c9b = "hejdu"; - - -// -// Check that value references work -// - -const long rc1 = c1g; -const long rc1h = c1h + 9; -const short rc2 = c2; -const unsigned long rc3 = c3; -const unsigned short rc4 = c4; - - -const float rc5c = c5c; -const double rc6c = c6c; -const double rc6d = c6c+1.3; - -const boolean rc7 = c7; -const boolean rc7c = c7c | TRUE; - -const char rc8 = c8; -const char rc8b = c8b; -const string rc9 = c9; -const string<9> rc9b = c9b; - - - - -// -// Now check that all typerefs work -// - -typedef long longT; -typedef short shortT; -typedef unsigned long ulongT; -typedef unsigned short ushortT; - -typedef float floatT; -typedef double doubleT; - -typedef char charT; -typedef string stringT; - -typedef boolean booleanT; - -const longT cc1 = 1; -const shortT cc2 = 3; -const ::longT cc1b = -1; -const ::shortT cc2b = -3; - -const floatT cc5 = 1.9; -const doubleT cc6 = 1.9; -const floatT cc5b = -1.9; -const doubleT cc6b = -1.9; -const floatT cc5c = 1/(9+2) * 2; -const doubleT cc6c = 1.9-1; - -const booleanT cc7 = TRUE; -const booleanT cc7b = TRUE; -const booleanT cc7c = TRUE | FALSE; -const booleanT cc7d = TRUE & FALSE; -const booleanT cc7e = TRUE&TRUE | FALSE&TRUE; - - -const charT cc8 = 'c'; -const charT cc8b = '\n'; -const stringT cc9 = "hej"; -const stringT cc9b = "hejdu"; - - -// -// Check value casting -// -const long longC = -9; -const short shortC = -9; -const unsigned long ulongC = 1; -const unsigned short ushortC = 0; - -const float floatC = 5.1; -const double doubleC = -2.111; - -const long c20 = shortC; -const long c21 = ulongC; -const long c22 = ushortC; -const short c23 = ushortC; -const double c34 = floatC; - - - diff --git a/lib/ic/test/ic_SUITE_data/enum.idl b/lib/ic/test/ic_SUITE_data/enum.idl deleted file mode 100644 index 397212baf8..0000000000 --- a/lib/ic/test/ic_SUITE_data/enum.idl +++ /dev/null @@ -1,33 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - - -enum E1 {kalle, sune}; - -enum E2 { el0, el1, el2, el3, el4, el5, el6, el7, el8, el9, el10, el11, el12, el13, -el14, el15, el16, el17, el18, el19, el20, el21, el22, el23, el24, el25, el26, el27, -el28, el29, el30, el31, el32, el33, el34, el35, el36, el37, el38, el39, el40, el41, -el42, el43, el44, el45, el46, el47, el48, el49, el50, el51, el52, el53, el54, el55, -el56, el57, el58, el59}; - - - - - diff --git a/lib/ic/test/ic_SUITE_data/forward.idl b/lib/ic/test/ic_SUITE_data/forward.idl deleted file mode 100644 index e9e8edb89e..0000000000 --- a/lib/ic/test/ic_SUITE_data/forward.idl +++ /dev/null @@ -1,35 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// -// Check that forward declarations are handled correctly -// - - -interface i1; - - -interface i1 { - typedef long T; -}; - - -interface i1; - diff --git a/lib/ic/test/ic_SUITE_data/include.idl b/lib/ic/test/ic_SUITE_data/include.idl deleted file mode 100644 index 292de177c2..0000000000 --- a/lib/ic/test/ic_SUITE_data/include.idl +++ /dev/null @@ -1,31 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// Check that errors are given with the correct file name reference - -#include "include2.idl" - - -typedef T1 T7; -typedef long T7; -typedef long T111; - - - diff --git a/lib/ic/test/ic_SUITE_data/include2.idl b/lib/ic/test/ic_SUITE_data/include2.idl deleted file mode 100644 index 37caa0bf54..0000000000 --- a/lib/ic/test/ic_SUITE_data/include2.idl +++ /dev/null @@ -1,27 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// Check that errors are given with the correct file name reference - -#include "include3.idl" - - -typedef T7 T1; - diff --git a/lib/ic/test/ic_SUITE_data/include3.idl b/lib/ic/test/ic_SUITE_data/include3.idl deleted file mode 100644 index 18424b3318..0000000000 --- a/lib/ic/test/ic_SUITE_data/include3.idl +++ /dev/null @@ -1,26 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// Check that errors are given with the correct file name reference - -typedef T7 T1; - - - diff --git a/lib/ic/test/ic_SUITE_data/inherit.idl b/lib/ic/test/ic_SUITE_data/inherit.idl deleted file mode 100644 index 93fd4b42ba..0000000000 --- a/lib/ic/test/ic_SUITE_data/inherit.idl +++ /dev/null @@ -1,69 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - - -interface I1 { - typedef long T1; - typedef struct S1 {long a; boolean b;} T2; - typedef string StringT, StringT_arr[10]; - - T1 op1( in StringT a, inout char b, out StringT_arr c ); - T2 op2( in char a, inout char b, out StringT_arr c ); - - const T1 LongC = 10; - const StringT StringC = "Hola bambino"; - -}; - - -interface I2 : I1 { - T1 op3( in long a); - - const long c1 = LongC; - const string c2 = StringC; -}; - -interface I3 : I1 {}; - -interface I4 : I3, I2 {}; // Check that branced inherit works - - - -// Now use cnstants to check that inheritance works as expected - -module m1 { - interface I1 { - typedef long T1; - - const T1 c1 = 9; - }; - - interface I2 : I1 { - const T1 c2 = c1+5; // c2 = 14 - const long c3 = c2+c1+4; // c3 = 27 - }; - - interface I3 : I2, I1 { - const long c1 = 50; // Overrides I1::c1 - const T1 c4 = c1+c2+c3; // c4=91 - const T1 c5 = I1::c1+c1+c2+c3; // 100 - }; -}; - diff --git a/lib/ic/test/ic_SUITE_data/inherit_err.idl b/lib/ic/test/ic_SUITE_data/inherit_err.idl deleted file mode 100644 index 3b4989dd8b..0000000000 --- a/lib/ic/test/ic_SUITE_data/inherit_err.idl +++ /dev/null @@ -1,72 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// -// Ops and attributes must not be redefined (shadowed) - -interface I1 { - long op1( in long a, inout char b, out boolean c ); - long op2( in char a, inout char b, out boolean c ); - attribute long a1, a2; - readonly attribute char a3; -}; - -interface I2 : I1 { - long op1( in float a, inout char b, out boolean c ); - long op2( in char a, inout char b, out boolean c ); - attribute long a1, a2; - readonly attribute char a3; -}; - -interface I3 : I1 { - long op3 (in string<19> b); -}; - - -interface I4 : I3 { - long op1( in float a, inout char b, out boolean c ); - long op2( in char a, inout char b, out boolean c ); - attribute long a1, a2; - readonly attribute char a3; - - long op3 (in string<19> b); -}; - - -interface I11 { - long op1( in float a, inout char b, out boolean c ); - long op2( in char a, inout char b, out boolean c ); - attribute long a1, a2; - readonly attribute char a3; -}; - - - -interface I5 : I1, I11 {}; - -interface I6 : I1 { - const long op1=0; - const long op2=0; - const long a1=0; - const long a2=0; - const long a3=0; -}; - - diff --git a/lib/ic/test/ic_SUITE_data/inherit_warn.idl b/lib/ic/test/ic_SUITE_data/inherit_warn.idl deleted file mode 100644 index 07f57f1a7d..0000000000 --- a/lib/ic/test/ic_SUITE_data/inherit_warn.idl +++ /dev/null @@ -1,65 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// -// Checks that shadow warnings comes out as expected -// - - -interface I1 { - typedef long T1; - typedef struct S1 {long a; boolean b;} T2; - typedef string StringT, StringT_arr[10]; - - T1 op1( in StringT a, inout char b, out StringT_arr c ); - T2 op2( in char a, inout char b, out StringT_arr c ); - - const T1 LongC = 10; - const StringT StringC = "Hola bambino"; - -}; - - -interface I2 : I1 { - typedef char T1; // Shadows I1::T1 - const boolean StringC = FALSE; // shadows I1::StringC - - T1 op3( in long a); - - const long c1 = LongC; - const boolean c2 = StringC; -}; - -interface I3 : I2 {}; // More shadows - -interface I4 : I1 { - T1 op4(); - const T1 c2 = 66; -}; - -interface I5 : I4 { - typedef string T1; // Shadows I1::T1 - const char LongC = 'a'; // Shadows I1::LongC -}; - - -interface I6 : I4, I3 { -}; - diff --git a/lib/ic/test/ic_SUITE_data/mult_ids.idl b/lib/ic/test/ic_SUITE_data/mult_ids.idl deleted file mode 100644 index 577e1031fb..0000000000 --- a/lib/ic/test/ic_SUITE_data/mult_ids.idl +++ /dev/null @@ -1,93 +0,0 @@ - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -// -// Check that multiply defined identifiers are detected -// - -typedef long T1; -typedef long T1; -typedef long T2; -exception T2 {}; - - -//Exceptions -exception Exc1 {}; -exception Exc1 {}; - - -// Enums -enum E1 {kalle}; -enum E1 {kalle}; -enum E2 {kalle, sune, kalle}; - - -// Structs -struct S1 {long a;}; -struct S1 {long a;}; -struct S2 {long a; short a;}; -struct S3 {long a,b; short a;}; -struct S4 {long a,a; short a;}; - - -// Constants -const long c1 = 0; -const long c1 = 0; - - -// Interfaces - -interface i1 {}; -interface i1 {}; - -interface i2 { - attribute long a1; - attribute long a1; -}; - -interface i3 { - attribute long a1, a2; - attribute long a2; -}; - -interface i4 { - attribute long a1, a1; -}; - -interface i5 { - long op1(); - long op1(); - - long op2(in long a, inout char a); -}; - - -// Unions - -union U1 switch (long) {case 1: long a;}; -union U1 switch (long) {case 1: long a;}; - -union U2 switch (long) { -case 1: long a; -default: char a; -}; - - - - - diff --git a/lib/ic/test/ic_SUITE_data/nasty.idl b/lib/ic/test/ic_SUITE_data/nasty.idl deleted file mode 100644 index e55060f762..0000000000 --- a/lib/ic/test/ic_SUITE_data/nasty.idl +++ /dev/null @@ -1,61 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// -// Checks nasty name collisions -// - -typedef string T; - - -#define nasty01 version -#define nasty02 preproc -#define nasty03 pragma -#define nasty04 compile -#define nasty05 if -#define nasty06 receive -#define nasty07 foldr -#define nasty08 length -#define nasty09 ID - -interface I1 { - attribute T nasty01; - attribute T nasty02; - attribute T nasty03; - attribute T nasty04; - attribute T nasty05; - attribute T nasty06; - attribute T nasty07; - attribute T nasty08; - attribute T nasty09; -}; - -interface I2 { - T nasty01(); - T nasty02(); - T nasty03(); - T nasty04(); - T nasty05(); - T nasty06(); - T nasty07(); - T nasty08(); - T nasty09(); -}; - diff --git a/lib/ic/test/ic_SUITE_data/one.idl b/lib/ic/test/ic_SUITE_data/one.idl deleted file mode 100644 index 7fb9808767..0000000000 --- a/lib/ic/test/ic_SUITE_data/one.idl +++ /dev/null @@ -1,30 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// Test oneway operations - -interface I1 { - long op1(in char a, inout boolean b, out string c); - oneway void op2(in char a, in boolean b, in string c); - oneway void op3(); -}; - - - diff --git a/lib/ic/test/ic_SUITE_data/one_followed.idl b/lib/ic/test/ic_SUITE_data/one_followed.idl deleted file mode 100644 index 17074f7e55..0000000000 --- a/lib/ic/test/ic_SUITE_data/one_followed.idl +++ /dev/null @@ -1,55 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// Test oneway operations followed by other operations - -interface I1 { - oneway void op1(); - oneway void op2(in char a, in boolean b, in string c); - long op3(in char a, inout boolean b, out string c); -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/ic/test/ic_SUITE_data/one_out.idl b/lib/ic/test/ic_SUITE_data/one_out.idl deleted file mode 100644 index 1e75c2d962..0000000000 --- a/lib/ic/test/ic_SUITE_data/one_out.idl +++ /dev/null @@ -1,29 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// Test oneway operations not using in out params - -interface I1 { - oneway void op1(in char a, inout boolean b, in string c); - oneway void op2(in char a, out boolean b, in string c); -}; - - - diff --git a/lib/ic/test/ic_SUITE_data/one_raises.idl b/lib/ic/test/ic_SUITE_data/one_raises.idl deleted file mode 100644 index 4cd7ae00bb..0000000000 --- a/lib/ic/test/ic_SUITE_data/one_raises.idl +++ /dev/null @@ -1,33 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// Test oneway operations not using in out params - -exception hell {boolean burn; unsigned long for_how_long;}; -exception high_water {long mark;}; - -interface I1 { - oneway void op1(in char a) raises (hell); - oneway void op2(in char a) raises (hell); - oneway void op3() raises (hell, high_water); -}; - - - diff --git a/lib/ic/test/ic_SUITE_data/one_void.idl b/lib/ic/test/ic_SUITE_data/one_void.idl deleted file mode 100644 index 6e8c39197c..0000000000 --- a/lib/ic/test/ic_SUITE_data/one_void.idl +++ /dev/null @@ -1,31 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// Test oneway operations not using in out params - -typedef long T; - -interface I1 { - oneway char op1(in char a); - oneway T op2(in char a); -}; - - - diff --git a/lib/ic/test/ic_SUITE_data/raises_reg.idl b/lib/ic/test/ic_SUITE_data/raises_reg.idl deleted file mode 100644 index 52aba10b8d..0000000000 --- a/lib/ic/test/ic_SUITE_data/raises_reg.idl +++ /dev/null @@ -1,53 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -#ifndef _RAISES_REG_IDL -#define _RAISES_REG_IDL - -module Raises_RegModule { - - exception Exception_1 {}; - - exception Exception_2 {}; - - interface R_R { - - void op() - raises(Raises_RegModule::Exception_1,Raises_RegModule::Exception_2); - - }; - -}; - -#endif - - - - - - - - - - - - - - - diff --git a/lib/ic/test/ic_SUITE_data/struct.idl b/lib/ic/test/ic_SUITE_data/struct.idl deleted file mode 100644 index 011c2404d9..0000000000 --- a/lib/ic/test/ic_SUITE_data/struct.idl +++ /dev/null @@ -1,54 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - - -struct S1 { - long a; - char b; - string<9> s; -}; - -struct S2 { - long a; - struct S3 { - long a; - short b, b1; - char c; - } b; - sequence c, c2, c3, c4, c5, c6, c7; -}; - - -// Check that structs are detected down in other types - - -typedef struct s4 {long a;} T1; -union U1 switch (long) { -case 1: - struct S5 {unsigned short a;} a; -case 2: - union U2 switch (char) { - case 'a': - boolean a; - case 'b': - struct s6 {long a; boolean b;} c; - } b; -}; - diff --git a/lib/ic/test/ic_SUITE_data/syntax1.idl b/lib/ic/test/ic_SUITE_data/syntax1.idl deleted file mode 100644 index 2de35a6ddf..0000000000 --- a/lib/ic/test/ic_SUITE_data/syntax1.idl +++ /dev/null @@ -1,29 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// -// Check syntax errors -// - - -typedef long T1 _; - - - diff --git a/lib/ic/test/ic_SUITE_data/syntax2.idl b/lib/ic/test/ic_SUITE_data/syntax2.idl deleted file mode 100644 index 39f28392e6..0000000000 --- a/lib/ic/test/ic_SUITE_data/syntax2.idl +++ /dev/null @@ -1,28 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -struct S2 { - long a_arr[99]; - struct S3 { - long a;_arr[99] - boolean b_arr[99]; - } b; -}; - - diff --git a/lib/ic/test/ic_SUITE_data/syntax3.idl b/lib/ic/test/ic_SUITE_data/syntax3.idl deleted file mode 100644 index 2bb9ac7229..0000000000 --- a/lib/ic/test/ic_SUITE_data/syntax3.idl +++ /dev/null @@ -1,21 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -typdef long T1; - diff --git a/lib/ic/test/ic_SUITE_data/syntax4.idl b/lib/ic/test/ic_SUITE_data/syntax4.idl deleted file mode 100644 index e41ad60ed6..0000000000 --- a/lib/ic/test/ic_SUITE_data/syntax4.idl +++ /dev/null @@ -1,24 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -union U1 switch (long) { -case 1: long a; -2: short b; -}; - diff --git a/lib/ic/test/ic_SUITE_data/syntax5.idl b/lib/ic/test/ic_SUITE_data/syntax5.idl deleted file mode 100644 index 6468f0adc0..0000000000 --- a/lib/ic/test/ic_SUITE_data/syntax5.idl +++ /dev/null @@ -1,23 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -union U1 switch (enum E1 {kalle, sune}) { -case kalle: long a; -sune: short b; -}; diff --git a/lib/ic/test/ic_SUITE_data/syntax6.idl b/lib/ic/test/ic_SUITE_data/syntax6.idl deleted file mode 100644 index 6012cc868c..0000000000 --- a/lib/ic/test/ic_SUITE_data/syntax6.idl +++ /dev/null @@ -1,21 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -constant long c1 = 0; diff --git a/lib/ic/test/ic_SUITE_data/type.idl b/lib/ic/test/ic_SUITE_data/type.idl deleted file mode 100644 index 6109661c4f..0000000000 --- a/lib/ic/test/ic_SUITE_data/type.idl +++ /dev/null @@ -1,191 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// -// Check all types in IDL -// - -typedef long T01; -typedef unsigned long T02; -typedef short T03; -typedef unsigned short T04; -typedef float T05; -typedef double T06; -typedef char T07; -typedef boolean T08; -typedef octet T09; -typedef any T10; -typedef Object T11; -typedef T01 T12; - -// Template types -typedef sequence T21; -typedef sequence T22; -typedef sequence T23; -typedef sequence T24; -typedef sequence T25; -typedef sequence T26; -typedef sequence T27; -typedef sequence T28; -typedef sequence T29; -typedef sequence T30; -typedef sequence T31; -typedef sequence T32; -typedef sequence > > T33; - -struct S1 { - long a; - boolean b; -}; - -struct S2 { - long a; - struct S3 { - long a; - boolean b; - } b; -}; - -union U1 switch (enum E1 {kalle1, sune1}) { -case kalle1: long a; -default: boolean b; -case sune1: octet c; -}; - -union U2 switch (enum E2 {kalle2, sune2}) { -case kalle2: long a; -default: struct S4 { long a; short b;} b; -case sune2: octet c; -}; - -// Typedefs of above types - -typedef struct S11 { - long a; - boolean b; -} T41; - -typedef struct S21 { - long a; - struct S3 { - long a; - boolean b; - } b; -} T42; - -typedef union U11 switch (enum E3 {kalle3, sune3}) { -case kalle3: long a; -default: boolean b; -case sune3: octet c; -} T43; - -typedef union U21 switch (enum E4 {kalle4, sune4}) { -case kalle4: long a; -default: struct S4 { long a; short b;} b; -case sune4: octet c; -} T44; - - - - -// Array versions - -typedef long T01_arr[99]; -typedef unsigned long T02_arr[99]; -typedef short T03_arr[99]; -typedef unsigned short T04_arr[99]; -typedef float T05_arr[99]; -typedef double T06_arr[99]; -typedef char T07_arr[99]; -typedef boolean T08_arr[99]; -typedef octet T09_arr[99]; -typedef any T10_arr[99]; -typedef Object T11_arr[99]; -typedef T01 T12_arr[99]; - -typedef sequence T21_arr[99]; -typedef sequence T22_arr[99]; -typedef sequence T23_arr[99]; -typedef sequence T24_arr[99]; -typedef sequence T25_arr[99]; -typedef sequence T26_arr[99]; -typedef sequence T27_arr[99]; -typedef sequence T28_arr[99]; -typedef sequence T29_arr[99]; -typedef sequence T30_arr[99]; -typedef sequence T31_arr[99]; -typedef sequence T32_arr[99]; -typedef sequence > > T33_arr[99]; - -struct S12 { - long a; - boolean b_arr[99]; -}; - -struct S22 { - long a_arr[99]; - struct S3 { - long a_arr[99]; - boolean b_arr[99]; - } b; -}; - -union U12 switch (enum E12 {kalle12, sune12}) { -case kalle12: long a_arr[99]; -default: boolean b; -case sune12: octet c; -}; - -union U22 switch (enum E22 {kalle22, sune22}) { -case kalle22: long a; -default: struct S4 { long a; short b;} b_arr[99]; -case sune22: octet c; -}; - -// Typedefs of above types - -typedef struct S13 { - long a_arr[99]; - boolean b; -} T41_arr[99]; - -typedef struct S23 { - long a; - struct S3 { - long a; - boolean b_arr[99]; - char c; - } b; -} T42_arr[99]; - -typedef union U13 switch (enum E13 {kalle13, sune13}) { -case kalle13: long a; -default: boolean b_arr[99]; -case sune13: octet c; -} T43_arr[99]; - -typedef union U23 switch (enum E23 {kalle23, sune23}) { -case kalle23: long a_arr[99]; -default: struct S4 { long a; short b;} b_arr[99]; -case sune23: octet c_arr[99]; -} T44_arr[99]; - - - diff --git a/lib/ic/test/ic_SUITE_data/typeid.idl b/lib/ic/test/ic_SUITE_data/typeid.idl deleted file mode 100644 index 9a5ce28bdf..0000000000 --- a/lib/ic/test/ic_SUITE_data/typeid.idl +++ /dev/null @@ -1,29 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -interface I1 {}; - -module M1 { interface I1 {};}; - -module M2 { module M1 { interface I1 {};};}; - -module M3 { module M2 { module M1 { interface I1 {};};};}; - - diff --git a/lib/ic/test/ic_SUITE_data/u_case_mult.idl b/lib/ic/test/ic_SUITE_data/u_case_mult.idl deleted file mode 100644 index 3d1523b5f5..0000000000 --- a/lib/ic/test/ic_SUITE_data/u_case_mult.idl +++ /dev/null @@ -1,55 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// Check that case labels are not duplicated - -union U1 switch (long) { -case 1 : long a; -case 1 : short b; -}; - -union U2 switch (char) { -case 'c' : long a; -case 'c' : short b; -}; - -union U2b switch (char) { -case 'c' : -case 'c' : long a; -case 'e': long b; -case 'c': long c; -}; - -union U3 switch (enum E1 {kalle, kula}) { -case kula : long a; -case kula : short b; -}; - -union U4 switch (boolean) { -case TRUE : long a; -case TRUE : short b; -}; - -union U5 switch (boolean) { -case TRUE : long a; -default: short p; -default: short pp; -}; - diff --git a/lib/ic/test/ic_SUITE_data/u_default.idl b/lib/ic/test/ic_SUITE_data/u_default.idl deleted file mode 100644 index 050b876aad..0000000000 --- a/lib/ic/test/ic_SUITE_data/u_default.idl +++ /dev/null @@ -1,52 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// -// Checking that default labels are correct in TK -// - -interface i1 { - union U1 switch (long) { - default: long a; - case 1: case 2: long b; - }; - - union U2 switch (long) { - case 0: default: long a; - case 1: case 2: long b; - }; - - union U3 switch (long) { - case -1: long aa; - case 0: default: long a; - case 1: case 2: long b; - }; - - union U4 switch (long) { - case -1: long aa; - case 0: long a; - case 1: case 2: long b; - }; - - U1 op0(); - U2 op1(); - U3 op2(); - U4 op3(); -}; diff --git a/lib/ic/test/ic_SUITE_data/u_mult.idl b/lib/ic/test/ic_SUITE_data/u_mult.idl deleted file mode 100644 index 3ab47c40a5..0000000000 --- a/lib/ic/test/ic_SUITE_data/u_mult.idl +++ /dev/null @@ -1,62 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - - -// Check multiply defined declarators - -enum E2 {kal, kula, E1}; // legal, but used below - -// Now check that declarator a is multiply defined in all unions below -union U0 switch (long) { -case 0: long a; -case 1: short a; -}; -union U00 switch (char) { -case 'c' : long a; -case 'f' : char c; -case 'b' : short a; -}; -union U000 switch (boolean) { -case TRUE: long a; -case FALSE: short a; -}; -union U0000 switch (E2) { -case kal: long a; -case kula: short a; -}; - - - - -// Check that enum name duplication is found. - -union U1 switch (enum E1 {kalle, kula, E1}) { -case E1 : long a; // legal -case kalle : short E1; // illegal -}; - - -// This is legal, but ended up here anyway - -union U2 switch(::E2) { -case kal : long a; -case kula : short b; -default : boolean E1; -}; diff --git a/lib/ic/test/ic_SUITE_data/u_norm.idl b/lib/ic/test/ic_SUITE_data/u_norm.idl deleted file mode 100644 index b2f146f45a..0000000000 --- a/lib/ic/test/ic_SUITE_data/u_norm.idl +++ /dev/null @@ -1,64 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - - -union U1 switch (long) { -case 1: long a; -case 2: case 3: short b; -}; - - -union U2 switch (unsigned short) { -case 10: boolean a; -case 188: char b; -default: string c; -}; - - -union U3 switch (enum E1 {kalle, kula, boll}) { -case kalle: long a; -case kula: U2 b; -}; - -enum E2 {Cissi, Anders}; - -union U4 switch (::E2) { -case Cissi: U1 a; -default: case Anders: unsigned long b; -}; - -union U5 switch(char) { -case 'e': long a; -case 'b': case 'f': char b; -default: struct S {long a; boolean b;} c; -}; - - -// Now check that references can be used as case values - -const long c1 = 9; -const long c2 = 10; - -union U6 switch (long) { -case c1: boolean a; -case ::c2: boolean b; -}; - - diff --git a/lib/ic/test/ic_SUITE_data/u_type.idl b/lib/ic/test/ic_SUITE_data/u_type.idl deleted file mode 100644 index 8a46b9375f..0000000000 --- a/lib/ic/test/ic_SUITE_data/u_type.idl +++ /dev/null @@ -1,83 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - - -// -// Check that case values match declared discriminator type -// - - -const long longC = 0; -const short shortC = 0; -const char charC = 'c'; -const string stringC = "Yacht"; - -enum E1 {kalle, kula}; - -union U1 switch (long) { -case 'c' : long a; -case TRUE : long b; -case stringC : long d; -case kalle : long f; -}; - -union U2 switch (unsigned long) { -case 'c' : long a; -case TRUE : long b; -case stringC : long d; -case kalle : long f; -}; - -union U3 switch (short) { -case 'c' : long a; -case TRUE : long b; -case stringC : long d; -case kalle : long f; -}; - -union U4 switch (unsigned short) { -case 'c' : long a; -case TRUE : long b; -case stringC : long d; -case kalle : long f; -}; - -union U5 switch (char) { -case TRUE : long b; -case stringC : long d; -case shortC : long e; -case kalle : long f; -}; - - -union U6 switch (E1) { -case 'c' : long a; -case TRUE : long b; -case stringC : long d; -case shortC : long e; -}; - -union U7 switch (enum E2 {ja, nej, kanske}) { -case 'c' : long a; -case TRUE : long b; -case stringC : long d; -case shortC : long e; -}; - diff --git a/lib/ic/test/ic_SUITE_data/undef_id.idl b/lib/ic/test/ic_SUITE_data/undef_id.idl deleted file mode 100644 index a09598f0a7..0000000000 --- a/lib/ic/test/ic_SUITE_data/undef_id.idl +++ /dev/null @@ -1,64 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1997-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// -// Check that undefined ids are detected -// - -typedef T7 T1; - -const char c1 = ::c0; -const T01 c2 = 'h'; -const T7 c3 = 9; - -interface i1 { - T17 op(); - long op2( in T7 a); - attribute T7 a1, a2; - readonly attribute T17 a3; -}; - -union U1 switch (long) { -case 1: long a; -case ::g : short b; -}; - -union U2 switch (enum E1 {kalle, kula}) { -case kula1: long a; -case kalle : short b; -}; - -union U3 switch (long) { -case kula2: long a; -case ::E3::kalle : short b; -case ::E4::kalle : short c; -}; - -enum E2 {kalle2, kula2}; - -union U4 switch (E2) { -case kula1: long a; -case kula1: long b; -case c3: short c; -}; - - - - diff --git a/lib/ic/test/ic_be_SUITE.erl b/lib/ic/test/ic_be_SUITE.erl deleted file mode 100644 index d5d3038a6e..0000000000 --- a/lib/ic/test/ic_be_SUITE.erl +++ /dev/null @@ -1,75 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%%---------------------------------------------------------------------- -%%% Purpose : Test suite for the backends of the IDL compiler -%%%---------------------------------------------------------------------- - --module(ic_be_SUITE). --include_lib("common_test/include/ct.hrl"). - - --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2,plain/1]). - - --define(OUT(X), filename:join([proplists:get_value(priv_dir, Config), gen, to_list(X)])). - - -%% Top of cases - -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - [plain]. - -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -%% Checking code for the plain backend. -plain(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(slask), - File = filename:join(DataDir, plain), - ok = ic:gen(File,stdopts(OutDir)++[{be,erl_plain}]), - ok. - -%%-------------------------------------------------------------------- -%% -%% Utilities -stdopts(OutDir) -> - [{outdir, OutDir}, {maxerrs, infinity}]. - -to_list(X) when is_atom(X) -> atom_to_list(X); -to_list(X) -> X. - diff --git a/lib/ic/test/ic_be_SUITE_data/plain.idl b/lib/ic/test/ic_be_SUITE_data/plain.idl deleted file mode 100644 index 1ee20eeb1f..0000000000 --- a/lib/ic/test/ic_be_SUITE_data/plain.idl +++ /dev/null @@ -1,34 +0,0 @@ - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -module m { - - struct s { - long x; - long y; - }; - - interface i { - - void foo( in s a, out short b ); - - }; - -}; - diff --git a/lib/ic/test/ic_pp_SUITE.erl b/lib/ic/test/ic_pp_SUITE.erl deleted file mode 100644 index be37953126..0000000000 --- a/lib/ic/test/ic_pp_SUITE.erl +++ /dev/null @@ -1,569 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% Purpose : Test suite for the IDL preprocessor -%%---------------------------------------------------------------------- - --module(ic_pp_SUITE). --include_lib("common_test/include/ct.hrl"). - - - -%% Standard options to the ic compiler, NOTE unholy use of OutDir - --define(OUT(X), filename:join([proplists:get_value(priv_dir, Config), gen, to_list(X)])). --define(GCC, "g++"). --define(GCC_VER, "2.95.3"). - --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). --export([arg_norm/1]). --export([cascade_norm/1]). --export([comment_norm/1]). --export([concat_norm/1]). --export([define_norm/1]). --export([if_norm/1]). --export([if_zero/1]). --export([misc_norm/1]). --export([improp_nest_constr_norm/1]). --export([inc_norm/1]). --export([line_norm/1]). --export([nopara_norm/1]). --export([predef_norm/1]). --export([predef_time_norm/1]). --export([self_ref_norm/1]). --export([separate_norm/1]). --export([swallow_sc_norm/1]). --export([unintended_grp_norm/1]). --export([cases/0, init_per_suite/1, end_per_suite/1]). - - -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - cases(). - -groups() -> - [{arg, [], [arg_norm]}, {cascade, [], [cascade_norm]}, - {comment, [], [comment_norm]}, - {concat, [], [concat_norm]}, - {define, [], [define_norm]}, {inc, [], [inc_norm]}, - {improp_nest_constr, [], [improp_nest_constr_norm]}, - {misc, [], [misc_norm]}, {line, [], [line_norm]}, - {nopara, [], [nopara_norm]}, - {predef, [], [predef_norm]}, - {predef_time, [], [predef_time_norm]}, - {self_ref, [], [self_ref_norm]}, - {separate, [], [separate_norm]}, - {swallow_sc, [], [swallow_sc_norm]}, - {unintended_grp, [], [unintended_grp_norm]}, - {'if', [],[if_norm, if_zero]}]. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -init_per_suite(Config) -> - if - is_list(Config) -> - case os:type() of - {win32, _} -> - {skipped, "Very unplesent to run on windows"}; - _ -> - check_gcc(Config) - end; - true -> - exit("Config not a list") - end. - -check_gcc(Config) -> - case os:find_executable(?GCC) of - false -> - {skipped, - lists:flatten(io_lib:format("Can not run without ~s in path", - [?GCC]))}; - _ -> - case trim(os:cmd(?GCC++" --version")) of - ?GCC_VER++[] -> - Config; - ?GCC_VER++[D|_] when is_integer(D), D>=$0, D=<$9 -> - fail_gcc(?GCC_VER++[D]); - ?GCC_VER++_ -> - Config; - Ver -> - fail_gcc(Ver) - end - end. - -fail_gcc(Ver) -> - {skipped, lists:flatten(io_lib:format("Need ~s v~s, not ~s", - [?GCC, ?GCC_VER, Ver]))}. - -trim(S) -> lists:reverse(skip_white(lists:reverse(skip_white(S)))). - -skip_white([$\s|T]) -> skip_white(T); -skip_white([$\n|T]) -> skip_white(T); -skip_white([$\r|T]) -> skip_white(T); -skip_white([$\t|T]) -> skip_white(T); -skip_white(L) -> L. - - -end_per_suite(Config) -> - Config. - - -cases() -> - [{group, arg}, {group, cascade}, {group, comment}, - {group, concat}, {group, define}, {group, misc}, {group, 'if'}, - {group, improp_nest_constr}, {group, inc}, - {group, line}, {group, nopara}, {group, predef}, - {group, predef_time}, {group, self_ref}, - {group, separate}, {group, swallow_sc}, - {group, unintended_grp}]. - - - -%%-------------------------------------------------------------------- -%% arg -%%-------------------------------------------------------------------- -%% Checks arguments for #define. -arg_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - _OutDir = ?OUT(arg_norm), - File = filename:join(DataDir, arg), - - ok = test_file(File, DataDir), - ok. - - -%%-------------------------------------------------------------------- -%% cascade -%%-------------------------------------------------------------------- -%% Check cascade #define. -cascade_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - _OutDir = ?OUT(cascade_norm), - File = filename:join(DataDir, cascade), - - ok = test_file(File, DataDir), - ok. - - -%%-------------------------------------------------------------------- -%% comment -%%-------------------------------------------------------------------- -%% Check comments. -comment_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - _OutDir = ?OUT(comment_norm), - File = filename:join(DataDir, comment), - - ok = test_file(File, DataDir), - ok. - - -%%-------------------------------------------------------------------- -%% concat -%%-------------------------------------------------------------------- -%% Check concatinations, i.e ## . -concat_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - _OutDir = ?OUT(concat_norm), - File = filename:join(DataDir, concat), - - ok = test_file(File, DataDir), - ok. - - -%%-------------------------------------------------------------------- -%% define -%%-------------------------------------------------------------------- -%% Check misceleaneous #define. -define_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - _OutDir = ?OUT(define_norm), - File = filename:join(DataDir, define), - - ok = test_file(File, DataDir), - ok. - - -%%-------------------------------------------------------------------- -%% if -%%-------------------------------------------------------------------- -%% Check #if, #elif, and #endif. -if_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - _OutDir = ?OUT(if_norm), - File = filename:join(DataDir, 'if'), - - ok = test_file(File, DataDir), - ok. - -%% Check #if 0 -if_zero(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - _OutDir = ?OUT(if_zero), - File = filename:join(DataDir, if_zero), - - ok = test_file(File, DataDir), - ok. - - -%%-------------------------------------------------------------------- -%% inc -%%-------------------------------------------------------------------- -%% Check #include. -inc_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - _OutDir = ?OUT(inc_norm), - File = filename:join(DataDir, inc), - - ok = test_file(File, DataDir), - ok. - - - -%%-------------------------------------------------------------------- -%% improp_nest_constr -%%-------------------------------------------------------------------- -%% Check improperly nested constructs. -improp_nest_constr_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - _OutDir = ?OUT(improp_nest_constr_norm), - File = filename:join(DataDir, improp_nest_constr), - - ok = test_file(File, DataDir), - ok. - - -%%-------------------------------------------------------------------- -%% misc -%%-------------------------------------------------------------------- -%% Misceleaneous checks. -misc_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - _OutDir = ?OUT(misc_norm), - File = filename:join(DataDir, misc), - - ok = test_file(File, DataDir), - ok. - - -%%-------------------------------------------------------------------- -%% line -%%-------------------------------------------------------------------- -%% Checks #line. -line_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - _OutDir = ?OUT(line_norm), - File = filename:join(DataDir, line), - - ok = test_file(File, DataDir), - ok. - - -%%-------------------------------------------------------------------- -%% nopara -%%-------------------------------------------------------------------- -%% Checks #define with no parameters. -nopara_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - _OutDir = ?OUT(nopara_norm), - File = filename:join(DataDir, nopara), - - ok = test_file(File, DataDir), - ok. - - -%%-------------------------------------------------------------------- -%% predef -%%-------------------------------------------------------------------- -%% Checks predefined macros. Note: not __TIME__ and __DATE__. -predef_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - _OutDir = ?OUT(predef_norm), - File = filename:join(DataDir, predef), - - ok = test_file(File, DataDir), - ok. - - -%%-------------------------------------------------------------------- -%% predef_time -%%-------------------------------------------------------------------- -%% Checks the predefined macros __TIME__ and __DATE__. -predef_time_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - _OutDir = ?OUT(predef_time_norm), - File = filename:join(DataDir, predef_time), - - ok = test_file(File, DataDir), - ok. - - -%%-------------------------------------------------------------------- -%% self_ref -%%-------------------------------------------------------------------- -%% Checks self referring macros. -self_ref_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - _OutDir = ?OUT(self_ref_norm), - File = filename:join(DataDir, self_ref), - - ok = test_file(File, DataDir), - ok. - - -%%-------------------------------------------------------------------- -%% separate -%%-------------------------------------------------------------------- -%% Checks separete expansion of macro arguments. -separate_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - _OutDir = ?OUT(separate_norm), - File = filename:join(DataDir, separate), - - ok = test_file(File, DataDir), - ok. - - -%%-------------------------------------------------------------------- -%% swallow_sc -%%-------------------------------------------------------------------- -%% Checks swallowing an undesirable semicolon. -swallow_sc_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - _OutDir = ?OUT(swallow_sc_norm), - File = filename:join(DataDir, swallow_sc), - - ok = test_file(File, DataDir), - ok. - - -%%-------------------------------------------------------------------- -%% unintended_grp -%%-------------------------------------------------------------------- -%% Checks unintended grouping of arithmetic. -unintended_grp_norm(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - _OutDir = ?OUT(unintended_grp_norm), - File = filename:join(DataDir, unintended_grp), - - ok = test_file(File, DataDir), - ok. - - -test_file(FileT, DataDir) -> - case test_file_1(FileT, DataDir) of - ok -> ok; - Chars -> - io:put_chars(Chars), - {error,{FileT,DataDir}} - end. - -test_file_1(FileT, DataDir) -> - Tok = string:tokens(FileT, "/"), - FileName = lists:last(Tok), - File = FileT++".idl", - - test_server:format("File ~p~n",[File]), - test_server:format("FileName ~p~n",[FileName]), - - Flags = "-I"++DataDir, - - test_server:format("Flags ~p~n",[Flags]), - - Erl = pp_erl(File, Flags), - Gcc = pp_gcc(File, Flags), - - case Erl of - {error,_ErlError} -> - test_server:format("Internal_pp Result ~n==================~n~p~n~n",[Erl]); - {warning, _ErlWar} -> - test_server:format("Internal_pp Result ~n==================~n~p~n~n",[Erl]); - _ -> - test_server:format("Internal_pp Result ~n==================~n~s~n~n",[Erl]) - end, - - case Gcc of - {error,GccError} -> - Error = string:tokens(GccError, "\n"), - test_server:format(?GCC" Result ~n==========~n~p~n~n", - [Error]); - _ -> - test_server:format(?GCC" Result ~n==========~n~s~n~n",[Gcc]) - end, - - - - case {Erl,Gcc} of - {{warning,W}, {error,X}} -> - case is_ok(W,X) of - yes -> - ok; - no -> - io_lib:format("Internal_pp found Warning = ~p ~n" - ?GCC" found Error = ~p~n",[W,X]) - end; - - - {{warning,W}, _} -> - io_lib:format(?GCC" did not find warnings while ~n" - "Internal_pp found the following Warning = ~p~n",[W]); - - {{error,E}, {error,X}} -> - case is_ok(E,X) of - yes -> - ok; - no -> - io_lib:format("Internal_pp found Error = ~p ~n" - ?GCC" found Error = ~p~n",[E,X]) - end; - - {{error,E}, _} -> - case FileName of - "if" -> - case if_res(E) of - ok -> - ok; - _ -> - io_lib:format(?GCC" did not find errors while ~n" - "Internal_pp found the following Error = ~p~n",[E]) - end; - _ -> - io_lib:format(?GCC" did not find errors while ~n" - "Internal_pp found the following Error = ~p~n",[lists:flatten(E)]) - end; - - {_, {error,X}} -> - io_lib:format("Internal_pp did not find errors while ~n" - ?GCC" found the following Error = ~p~n",[X]); - - _ -> - - file:write_file("/tmp/Erl.pp",list_to_binary(Erl)), - file:write_file("/tmp/Gcc.pp",list_to_binary(Gcc)), - - Res = os:cmd("diff -b -w /tmp/Erl.pp /tmp/Gcc.pp"), - test_server:format("///////////{error,E} E ~p FileName~p~n",[Res,FileName]), - case {Res, FileName} of - {[], _} -> - test_server:format("Diff = [] OK!!!!!!~n"), - ok; - {_, "predef_time"} -> - Tokens = string:tokens(Res,"\n"), - test_server:format("///////////{error,E} Tokens~p~n",[Tokens]), - case Tokens of - ["3c3",_,"---",_,"5c5",_,"---",_,"9c9",_,"---",_] -> - ok; - _ -> - io_lib:format("Diff Result = ~p~n",[Res]) - end; - _ -> - io_lib:format("Diff Result = ~p~n",[Res]) - end - end. - - - - - -pp_erl(File, Flags) -> - case ic_pp:run(File,Flags) of - {ok, [$#, $ , $1 | Rest], []} -> - [$#, $ , $1 | Rest]; - {ok, [$#, $ , $1 | _Rest], Warning} -> - {warning,Warning}; - {error,Error} -> - {error,Error} - end. - -pp_gcc(File, Flags) -> - Cmd = ?GCC" -x c++ -E", - Line = Cmd++" "++Flags++" "++File, - - case os:cmd(Line) of - [$#, $ , $1 | Rest] -> - [$#, $ , $1 | Rest]; - Res -> - - case string:str(Res,"# 1 \"") of - 0 -> - {error,Res}; - X -> - {error, string:sub_string(Res, 1, X-1)} - end - end. - - -is_ok([],_Gcc) -> - yes; -is_ok([{FileName,Line,Text}|T],Gcc) -> - Str = FileName++":"++integer_to_list(Line)++": "++Text, - case string:str(Gcc,Str) of - 0 -> - io:format("~n is_ok Internal_pp missed Error = ~s~n",[Str]), - no; - _X -> - is_ok(T,Gcc) - end; -is_ok([Str|T],Gcc) -> - case string:str(Gcc,Str) of - 0 -> - io:format("~n is_ok Internal_pp missed Error = ~s~n",[Str]), - no; - _X -> - is_ok(T,Gcc) - end. - - -to_list(X) when is_atom(X) -> atom_to_list(X); -to_list(X) -> X. - - - -if_res(E) -> - if_res(E,1). - -if_res([H|T],Nr) -> - %% Dir = "/clearcase/otp/libraries/ic/test/ic_pp_SUITE_data/if.idl", - case {Nr, H} of - {1, {_Dir, 2, "only '#if 0' is implemented at present"}} -> - if_res(T,Nr+1); - {2, {_Dir, 3, "only '#if 0' is implemented at present"}} -> - if_res(T,Nr+1); - {3, {_Dir, 5, "`else' command is not implemented at present"}} -> - if_res(T,Nr+1); - {4, {_Dir, 9, "`elif' command is not implemented at present"}} -> - if_res(T,Nr+1); - {5, {_Dir, 11, "`else' command is not implemented at present"}} -> - ok; - _ -> - error - end; -if_res(_, _) -> - error. - - - diff --git a/lib/ic/test/ic_pp_SUITE_data/arg.idl b/lib/ic/test/ic_pp_SUITE_data/arg.idl deleted file mode 100644 index 42d8457f2c..0000000000 --- a/lib/ic/test/ic_pp_SUITE_data/arg.idl +++ /dev/null @@ -1,39 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -#define xstr (s) str(s) -#define str(s) #s -#define foo 4 - -xstr(foo); - -#define x(kalle)stina -x(kurt) -x - -#define y(kalle) stina -y(kurt) -y - -#define a(kalle) stina -a(kurt) -a - -#define b (kalle) stina -b(kurt) diff --git a/lib/ic/test/ic_pp_SUITE_data/cascade.idl b/lib/ic/test/ic_pp_SUITE_data/cascade.idl deleted file mode 100644 index f96f2a0bd7..0000000000 --- a/lib/ic/test/ic_pp_SUITE_data/cascade.idl +++ /dev/null @@ -1,30 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -#define BUFS 1020 -#define TABS BUFS -#undef BUFS -#define BUFS 37 - - -main() -{ - TABS; - -} diff --git a/lib/ic/test/ic_pp_SUITE_data/comment.idl b/lib/ic/test/ic_pp_SUITE_data/comment.idl deleted file mode 100644 index 9b5e310e6c..0000000000 --- a/lib/ic/test/ic_pp_SUITE_data/comment.idl +++ /dev/null @@ -1,73 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -#define T 12 -#define F T - -//comment -/*exception except {};*/ - -// comment - // comment -/* another */ - /* another */ -/* still -another */ - /* still - another */ -__LINE__ -/* yet \ - another */ -// yet \ - another -__LINE__ - -#include "all.c" -#include -#include /* comment */ "all.c" -#include /* comment */ -#include "all.c" /* comment */ -#include /* comment */ -#include // "all.c" -#include // -#include "all.c" // comment -#include // comment -#include "all/*cc*/.c" -#include - -main() -{ - printf(" %d \n",F); - a(); - -} -//comment -/*exception hell {};*/ -#undef T -#define T "3/*com\ -ment*/4" -a() -{ - printf(" %d \n",F); - printf(" %d \n",T); -} - -b() -{} - diff --git a/lib/ic/test/ic_pp_SUITE_data/concat.idl b/lib/ic/test/ic_pp_SUITE_data/concat.idl deleted file mode 100644 index eb1f6aa1ad..0000000000 --- a/lib/ic/test/ic_pp_SUITE_data/concat.idl +++ /dev/null @@ -1,61 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -#define sune kurt -#define a(name) a #name name##_command -#define b(name) b #name name## _command -#define c(name) c #name name ##_command -#define d(name) d #name name ## _command -#define e(name) e #name command ## _command -#define f(name) f #name command ## %_command -#define g(name) g #name name ## %_command -#define h(name) h #name %_command ## name -#define i(name) i #name name ## _ ## name -#define j(name) j #name name ## name -#define k(name) k #name name ## name -#define l(name) l #name !name ## name -#define m(name) m #name name ## !name -#define n(name) n #name !name ## !name -#define o(name) stina -#define p(name) name -#define q1(name) q1 #name j(name) ## j(name) -#define q2(name) q2 #name j(name) -#define q3(name) q3 #name !! ## j(name) -#define q4(name) q4 #name ## j(name) - -a(quit) -b(quit) -c(quit) -d(quit) -e(quit) -f(quit) -g(sune) -h(sune) -i(sune) -j(sune) -l(sune) -m(sune) -n(sune) -k(j(sune)) -k(o(sune)) -k(p(sune)) -q1(sune) -q2(sune) -q3(sune) -q4(sune) diff --git a/lib/ic/test/ic_pp_SUITE_data/define.idl b/lib/ic/test/ic_pp_SUITE_data/define.idl deleted file mode 100644 index 76a3b5ec22..0000000000 --- a/lib/ic/test/ic_pp_SUITE_data/define.idl +++ /dev/null @@ -1,42 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -#define 8 -#define -#define a -#define _a -#define b dfs -#define 9 fdas -#define a8 -#define A -#define (c) fadfas -#define )c) fadfas -#define % c) fadfas -#define d(p) kfdsa -#define e(p) sinus(p) -#warning warning line -#define w%er percent -#define q() no_para -#warning warning line -#undef -#undef 8 -#undef a -#undef b -#undef _a d(kk) - diff --git a/lib/ic/test/ic_pp_SUITE_data/if.idl b/lib/ic/test/ic_pp_SUITE_data/if.idl deleted file mode 100644 index 437ea7c2e1..0000000000 --- a/lib/ic/test/ic_pp_SUITE_data/if.idl +++ /dev/null @@ -1,33 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -#define kurt 12 -#if !true -#if X == 1 -ett -#else -else -#endif -true -#elif kurt -trueelif -#else -trueelse -#endif -end diff --git a/lib/ic/test/ic_pp_SUITE_data/if_zero.idl b/lib/ic/test/ic_pp_SUITE_data/if_zero.idl deleted file mode 100644 index a0184f8bff..0000000000 --- a/lib/ic/test/ic_pp_SUITE_data/if_zero.idl +++ /dev/null @@ -1,32 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -#if 0 -pelle = mallan -#endif -pelle = stina -#if 0 -kalle = stina -#endif -kalle = mallan -#if 0 -kurt = fia -#endif -fia = kurt - diff --git a/lib/ic/test/ic_pp_SUITE_data/improp_nest_constr.idl b/lib/ic/test/ic_pp_SUITE_data/improp_nest_constr.idl deleted file mode 100644 index b658811277..0000000000 --- a/lib/ic/test/ic_pp_SUITE_data/improp_nest_constr.idl +++ /dev/null @@ -1,31 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -#define double(x) (2*(x)) -#define call_with_1(x) x(1) - -#define strange(file) fprintf (file, "%s %d", - -main() -{ - call_with_1(double); - strange(stderr) p, 35) - -} - diff --git a/lib/ic/test/ic_pp_SUITE_data/inc.idl b/lib/ic/test/ic_pp_SUITE_data/inc.idl deleted file mode 100644 index e13875b10c..0000000000 --- a/lib/ic/test/ic_pp_SUITE_data/inc.idl +++ /dev/null @@ -1,69 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -int x; - -#include "head.h" -#warning line nr -main() -{ - printf(test()); -} - - - - - - - - -#define C false -#define Z on -#include "inc2.h" -#undef Z -"Ca" C -"Za" Z -#include "inc2.h" -"Cb" C -"Zb" Z - -main() -{ -#define Q(a,b) sinus(a,b kurt ## b) - if (Q(34,56)=='NULL') printf(" T AAA%sEEEE \n",Q); - printf(" %d \n",F); - a(); -} -//comment -/*exception -hell {};*/ -#undef T -#define T "3/*com\ment*/4" -#define T 33 -#define F again -a () -{ - printf(" %d \n",F); - printf(" %d \n",T); -} - -b() -{} - diff --git a/lib/ic/test/ic_pp_SUITE_data/included1.idl b/lib/ic/test/ic_pp_SUITE_data/included1.idl deleted file mode 100644 index f3cc40f549..0000000000 --- a/lib/ic/test/ic_pp_SUITE_data/included1.idl +++ /dev/null @@ -1,36 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 2000-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -#ifndef INCLUDED1_IDL -#define INCLUDED1_IDL - - -#ifndef SOMETHING -#endif - - -struct s { - - long l; - -}; - - - -#endif diff --git a/lib/ic/test/ic_pp_SUITE_data/included2.idl b/lib/ic/test/ic_pp_SUITE_data/included2.idl deleted file mode 100644 index 6a718ce021..0000000000 --- a/lib/ic/test/ic_pp_SUITE_data/included2.idl +++ /dev/null @@ -1,42 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 2000-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -#ifndef INCLUDED2_IDL -#define INCLUDED2_IDL - -#include "included1.idl" - - -#ifdef SOMETHING -#endif - - -module m { - - struct t { - - s st; - - }; - - -}; - - -#endif diff --git a/lib/ic/test/ic_pp_SUITE_data/includer.idl b/lib/ic/test/ic_pp_SUITE_data/includer.idl deleted file mode 100644 index d4fabd024a..0000000000 --- a/lib/ic/test/ic_pp_SUITE_data/includer.idl +++ /dev/null @@ -1,46 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 2000-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -#ifndef INCLUDER_IDL -#define INCLUDER_IDL - -#include "included1.idl" -#include "included2.idl" - -#ifdef SOMETHING -#endif - - - -module n { - - interface j { - - s op(in m::t inpar); - - }; - -}; - - - - -#endif - - diff --git a/lib/ic/test/ic_pp_SUITE_data/line.idl b/lib/ic/test/ic_pp_SUITE_data/line.idl deleted file mode 100644 index 83783dff03..0000000000 --- a/lib/ic/test/ic_pp_SUITE_data/line.idl +++ /dev/null @@ -1,46 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -#line -#line 8 -#line 8a -#line 12 abc.c -#line 12 "kurt.c" -#warning fdafdsaf - - -#define T 12 -#define F T -#define Q(a) sinus(a) -#undef Q -# -#line 12 -#warning test of warning -#warning second of warning -#warning third of warning -#pragma kurt -#ident kurt -#kurt fdsafd -#line 20 -main() -{ - if (Q(34,56)=='NULL') printf(" T AAA%sEEEE \n",Q); - printf(" %d \n",F); -} -sune diff --git a/lib/ic/test/ic_pp_SUITE_data/misc.idl b/lib/ic/test/ic_pp_SUITE_data/misc.idl deleted file mode 100644 index 512ccb16b1..0000000000 --- a/lib/ic/test/ic_pp_SUITE_data/misc.idl +++ /dev/null @@ -1,45 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -#define str(s) #s -str(fool); -str(foo); -str(kurt); -#define xstr(s) str(s) -#define foo 4 -#define kurt sune -#define sune 17 - -xstr(fool); -xstr(foo); -xstr(kurt); - -#define a(b) b #8b -#define r(b) b # -#define t(b) b ## a -a(sinus) - -#define ww #www -ww - -#define x 14 + y -#define y 12 + #x -x - -#define e(a) cosinus(a) diff --git a/lib/ic/test/ic_pp_SUITE_data/nopara.idl b/lib/ic/test/ic_pp_SUITE_data/nopara.idl deleted file mode 100644 index 9d5253bf38..0000000000 --- a/lib/ic/test/ic_pp_SUITE_data/nopara.idl +++ /dev/null @@ -1,36 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -#11a -#define xstr str(s) + kurt*2; -#define asdf pragma -#asdf -#define asd #pragma asd - -#10 -#12 8kurt - -#define sss "stringing in the rain" -#define ddd "string -ing in the rain" asd -#line 20 -#include "head.h" qqqq -#include %!# -#include - diff --git a/lib/ic/test/ic_pp_SUITE_data/predef.idl b/lib/ic/test/ic_pp_SUITE_data/predef.idl deleted file mode 100644 index 8805501d66..0000000000 --- a/lib/ic/test/ic_pp_SUITE_data/predef.idl +++ /dev/null @@ -1,34 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -#define b(q,w) kurt q w - - -b(__LINE__, __FILE__) -__LINE__ -__FILE__ - - - -b(__INCLUDE_LEVEL__, __BASE_FILE__) -__INCLUDE_LEVEL__ -__BASE_FILE__ - -Line __LINE__ -#include "predef.h" diff --git a/lib/ic/test/ic_pp_SUITE_data/predef_time.idl b/lib/ic/test/ic_pp_SUITE_data/predef_time.idl deleted file mode 100644 index 7ce8d2a313..0000000000 --- a/lib/ic/test/ic_pp_SUITE_data/predef_time.idl +++ /dev/null @@ -1,25 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -#define b(q,w) kurt q w -b(__DATE__, __TIME__) -__DATE__ -__TIME__ - -#include "predef_time.h" diff --git a/lib/ic/test/ic_pp_SUITE_data/self_ref.idl b/lib/ic/test/ic_pp_SUITE_data/self_ref.idl deleted file mode 100644 index 50f8a04e69..0000000000 --- a/lib/ic/test/ic_pp_SUITE_data/self_ref.idl +++ /dev/null @@ -1,27 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -#define foo (4 + foo) - - -main() -{ - foo; - -} diff --git a/lib/ic/test/ic_pp_SUITE_data/separate.idl b/lib/ic/test/ic_pp_SUITE_data/separate.idl deleted file mode 100644 index 6151a41709..0000000000 --- a/lib/ic/test/ic_pp_SUITE_data/separate.idl +++ /dev/null @@ -1,38 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -#define xstr(s) str(s) -#define str(s) #s -#define foo 4 -#define str1(s) #s lose(s) -#define foo1 4 - -main() -{ - str(foo); - str1(foo1); - xstr(foo); - -#define qxstr(s) qstr(s) - qxstr(qfoo); -#define qstr(s) #s - qstr( 4 ) ; -#define qfoo 4 - qstr(qfoo); -} diff --git a/lib/ic/test/ic_pp_SUITE_data/swallow_sc.idl b/lib/ic/test/ic_pp_SUITE_data/swallow_sc.idl deleted file mode 100644 index a42fcc6295..0000000000 --- a/lib/ic/test/ic_pp_SUITE_data/swallow_sc.idl +++ /dev/null @@ -1,38 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -/* comment \ - ends */ -// comment\ -ends -Line __LINE__ -#define SKIP_SPACES(p, limit) \ -{register char *lim = (limit); \ - while (p != lim) { \ - if (*p++ != ' ') { \ - p--; break; }}} - - -main() -{ - if (*p != 0) - SKIP_SPACES (ppp, lim); - else - a = 17; -} diff --git a/lib/ic/test/ic_pp_SUITE_data/unintended_grp.idl b/lib/ic/test/ic_pp_SUITE_data/unintended_grp.idl deleted file mode 100644 index ba744ac938..0000000000 --- a/lib/ic/test/ic_pp_SUITE_data/unintended_grp.idl +++ /dev/null @@ -1,30 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -#define ceil_div( xz, yz) (xz + yz - 1) / yz -#define ceil_div2(xz, yz) ((xz) + (yz) - 1) / (yz) - -#define b kurt - -main() -{ - ceil_div(b & c, sizeof(int)); - ceil_div2(b & c, sizeof(int)); - -} diff --git a/lib/ic/test/ic_pragma_SUITE.erl b/lib/ic/test/ic_pragma_SUITE.erl deleted file mode 100644 index bb95e59109..0000000000 --- a/lib/ic/test/ic_pragma_SUITE.erl +++ /dev/null @@ -1,301 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: ic_pragma_SUITE.erl -%% -%% Description: -%% Test suite for the IFR object registration when -%% pragmas are engaged -%% -%%----------------------------------------------------------------- --module(ic_pragma_SUITE). - --include_lib("common_test/include/ct.hrl"). --include_lib("orber/include/corba.hrl"). -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, - init_per_suite/1, end_per_suite/1]). --export([ifr_pragma_reg/1, pragma_error/1, uggly_pragmas/1]). - - -%%----------------------------------------------------------------- -%% Macros -%%----------------------------------------------------------------- --define(REMAP_EXCEPT(F), case catch F of - {'EXCEPTION', E} -> exit(E); - R -> R - end). -%% Standard options to the ic compiler, NOTE unholy use of OutDir - --define(OUT(X), filename:join([proplists:get_value(priv_dir, Config), gen, to_list(X)])). - - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - cases(). - -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -cases() -> - [ifr_pragma_reg, pragma_error, uggly_pragmas]. - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- -init_per_suite(Config) -> - io:format("Setting up.....~n"), - mnesia:stop(), - mnesia:delete_schema([node()]), - mnesia:create_schema([node()]), - mnesia:start(), - orber:install([node()]), - orber:start(), - if - is_list(Config) -> - Config; - true -> - exit("Config not a list") - end. - -end_per_suite(Config) -> - io:format("Setting down.....~n"), - orber:stop(), - orber:uninstall(), - mnesia:stop(), - mnesia:delete_schema([node()]), - Config. - - - - -%%----------------------------------------------------------------- -%% Test Case: IFR registration with pragmas -%%----------------------------------------------------------------- -%% Checks that IFR object is correctly registered under pragma engagement. -ifr_pragma_reg(Config) when is_list(Config) -> - ?REMAP_EXCEPT(ifr_pragma_reg_run(Config)). - -ifr_pragma_reg_run(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(ifr_pragma_reg), - File0 = filename:join(DataDir, reg_m0), - ok = ic:gen(File0, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}]), - ok = compile(OutDir, ifr_pragma_files()), - code:add_pathz(OutDir), - - %% OE_register for all files - ok = 'oe_reg_m0':'oe_register'(), - - %% Pragma registration test - OE_IFR = orber_ifr:find_repository(), - io:format("~n##### Starting the test case #####~n"), - check_pragma_effect(OE_IFR,"IDL:M1/T1:1.0"), - check_pragma_effect(OE_IFR,"DCE:d62207a2-011e-11ce-88b4-0800090b5d3e:3"), - check_pragma_effect(OE_IFR,"IDL:P2/T3:1.0"), - check_pragma_effect(OE_IFR,"IDL:P1/M2/T4:2.4"), - - %% OE_unregister for all files - ok = 'oe_reg_m0':'oe_unregister'(), - code:del_path(OutDir), - ok. - - -ifr_pragma_files() -> ['oe_reg_m0']. - - -check_pragma_effect(OE_IFR,ID) -> - io:format("Checking for existance of : ~s~n",[ID]), - case orber_ifr:lookup_id(OE_IFR,ID) of - [] -> - test_server:fail(ID ++ " does not exist"), - false; - {Def,_} -> - io:format("Id refers to = {~p,#Bin}~n",[Def]), - true - end. - - - - -%%----------------------------------------------------------------- -%% Test Case: Syntactical / Semantical error pragma definitions -%%----------------------------------------------------------------- -%% Finds errornous pragma definitions under compilation. -pragma_error(Config) when is_list(Config) -> - ?REMAP_EXCEPT(pragma_error_run(Config)). - -pragma_error_run(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(pragma_error), - File1 = filename:join(DataDir, reg_m1), - File2 = filename:join(DataDir, reg_m2), - File3 = filename:join(DataDir, reg_m3), - File4 = filename:join(DataDir, reg_m4), - File5 = filename:join(DataDir, reg_m5), - File6 = filename:join(DataDir, reg_m6), - - error = ic:gen(File1, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}] ), - - error = ic:gen(File2, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}] ), - - error = ic:gen(File3, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}] ), - - ok = ic:gen(File4, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}] ), - - error = ic:gen(File5, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}] ), - - error = ic:gen(File6, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}] ), - ok. - - - - -%%----------------------------------------------------------------- -%% Test Case: IFR registration with realy uggly placed pragmas -%%----------------------------------------------------------------- -%% Checks that IFR object is correctly registered under really uggly pragma engagement. -uggly_pragmas(Config) when is_list(Config) -> - ?REMAP_EXCEPT(uggly_pragmas_run(Config)). - -uggly_pragmas_run(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(ifr_pragma_reg), - File0 = filename:join(DataDir, uggly), - - ok = ic:gen(File0, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}]), - - ok = compile(OutDir, uggly_pragma_files()), - code:add_pathz(OutDir), - - %% OE_register for all files - ok = 'oe_uggly':'oe_register'(), - - %% Pragma registration test - OE_IFR = orber_ifr:find_repository(), - io:format("~n##### Starting the test case #####~n"), - - check_pragma_effect(OE_IFR, "IDL:M:1.0"), - check_pragma_effect(OE_IFR, "LOCAL:SomeLocalId:10"), - check_pragma_effect(OE_IFR, "LOCAL:SomeLocalId:11"), - check_pragma_effect(OE_IFR, "LOCAL:SomeLocalId:17"), - check_pragma_effect(OE_IFR, "LOCAL:SomeLocalId:34"), - check_pragma_effect(OE_IFR, "IDL:Exc1:2.2"), - check_pragma_effect(OE_IFR, "IDL:Exc2:2.2"), - check_pragma_effect(OE_IFR, "IDL:S:1.0"), - check_pragma_effect(OE_IFR, "IDL:U:1.0"), - check_pragma_effect(OE_IFR, "LOCAL:SomeLocalId:23"), - - %% OE_unregister for all files - ok = 'oe_uggly':'oe_unregister'(), - - code:del_path(OutDir), - ok. - - -uggly_pragma_files() -> ['oe_uggly']. - - - - -%%---------------------------- - - -stdopts(OutDir) -> - [{outdir, OutDir}, {maxerrs, infinity}]. - - -compile(Dir, Files) -> - compile(Dir, Files, []). - -compile(Dir, Files, Opts) -> - {ok, Cwd} = file:get_cwd(), - file:set_cwd(Dir), - io:format("Changing to ~p~n", [Dir]), - case catch do_compile(Files, Opts) of - ok -> - file:set_cwd(Cwd); - Err -> - file:set_cwd(Cwd), - test_server:fail(Err) - end. - -do_compile([], _Opts) -> ok; -do_compile([F | Fs], Opts) -> - io:format("Compiling ~p", [F]), - case compile:file(F, Opts) of - ok -> - io:format(" ok~n", []), - do_load(F, Opts), - do_compile(Fs, Opts); - {ok, _} -> - io:format(" ok~n", []), - do_load(F, Opts), - do_compile(Fs, Opts); - {ok, _, _} -> - io:format(" ok~n", []), - do_load(F, Opts), - do_compile(Fs, Opts); - Err -> - io:format(" error: ~p~n", [Err]), - Err - end. - -do_load(File, Opts) -> - case lists:member(load, Opts) of - true -> - io:format("Loading file ~p", [File]), - code:purge(File), - R = code:load_abs(File), - io:format("Loaded: ~p", [R]); - false -> - ok - end. - - -to_list(X) when is_atom(X) -> atom_to_list(X); -to_list(X) -> X. - - - diff --git a/lib/ic/test/ic_pragma_SUITE_data/reg_m0.idl b/lib/ic/test/ic_pragma_SUITE_data/reg_m0.idl deleted file mode 100644 index a7a90edc92..0000000000 --- a/lib/ic/test/ic_pragma_SUITE_data/reg_m0.idl +++ /dev/null @@ -1,78 +0,0 @@ - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// Normal pragmas - -module M1 { - - typedef long T1; - - typedef long T2; - -#pragma ID T2 "DCE:d62207a2-011e-11ce-88b4-0800090b5d3e:3" - -}; - - -#pragma prefix "P1" - -module M2 { - - module M3 { - -#pragma prefix "P2" - - interface I1 { - void Op( in short b, - out short c); - }; - typedef long T3; - }; - - - typedef long T4; - -#pragma version T4 2.4 - -}; - - - -/* - - Specified types with the following scoped names - and RepositoryIds - - ::M1::T1 IDL:M1/T1:1.0 - - ::M1::T2 DCE:d62207a2-011e-11ce-88b4-0800090b5d3e:3 - - ::M2::M3::T3 IDL:P2/T3:1.0 - - ::M2::T4 IDL:P1/M2/T4:2.4 - -*/ - - - - - - - - diff --git a/lib/ic/test/ic_pragma_SUITE_data/reg_m1.idl b/lib/ic/test/ic_pragma_SUITE_data/reg_m1.idl deleted file mode 100644 index e222dcddc7..0000000000 --- a/lib/ic/test/ic_pragma_SUITE_data/reg_m1.idl +++ /dev/null @@ -1,76 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -// Bad pragma IDs - -// Completelly bad id -module M1 { - - typedef long T1; - - typedef long T2; - -#pragma ID T2 "CompletelyBadId" - -}; - - -// Bad id, should start with DCE -module M2 { - - typedef long T1; - - typedef long T2; - -#pragma ID T2 "BAD:d62207a2-011e-11ce-88b4-0800090b5d3e:3" - -}; - - -// Bad version in ID : not a short number -module M3 { - - typedef long T1; - - typedef long T2; - -#pragma ID T2 "DCE:d62207a2-011e-11ce-88b4-0800090b5d3e:ABCD" - -}; - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/ic/test/ic_pragma_SUITE_data/reg_m2.idl b/lib/ic/test/ic_pragma_SUITE_data/reg_m2.idl deleted file mode 100644 index 351e662ac7..0000000000 --- a/lib/ic/test/ic_pragma_SUITE_data/reg_m2.idl +++ /dev/null @@ -1,41 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -// Bad pragma versions - - -// Bad major version : not a short number -module M1 { - - typedef long T4; - -#pragma version T4 2000000000.4 - -}; - -// Bad minor version : not a short number -module M2 { - - typedef long T4; - -#pragma version T4 2.4000000000000 - -}; - - diff --git a/lib/ic/test/ic_pragma_SUITE_data/reg_m3.idl b/lib/ic/test/ic_pragma_SUITE_data/reg_m3.idl deleted file mode 100644 index 4f876da8bc..0000000000 --- a/lib/ic/test/ic_pragma_SUITE_data/reg_m3.idl +++ /dev/null @@ -1,39 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -// Bad pragma prefixs - -module M2 { - - module M3 { - -#pragma prefix P2 // Should be "P2" - - interface I1 { - void foo( in short b, - out short c); - }; - typedef long T3; - }; - - - typedef long T4; -}; - - diff --git a/lib/ic/test/ic_pragma_SUITE_data/reg_m4.idl b/lib/ic/test/ic_pragma_SUITE_data/reg_m4.idl deleted file mode 100644 index 9de19b645b..0000000000 --- a/lib/ic/test/ic_pragma_SUITE_data/reg_m4.idl +++ /dev/null @@ -1,65 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -// Unrecognmizable pragmas - -module M1 { - - typedef long T1; - - typedef long T2; - - - // Should be ID directive - -#pragma ShouldBeId T2 "DCE:d62207a2-011e-11ce-88b4-0800090b5d3e:3" - -}; - - // Should be prefix directive - -#pragma ShouldBePrefix "P1" - -module M2 { - - module M3 { - - // Should be prefix directive - -#pragma ShouldBePrefix "P2" - - interface I1 { - void foo( in short b, - out short c); - }; - typedef long T3; - }; - - - typedef long T4; - - - // Should be version - -#pragma ShouldBeVersion T4 2.4 - -}; - - - diff --git a/lib/ic/test/ic_pragma_SUITE_data/reg_m5.idl b/lib/ic/test/ic_pragma_SUITE_data/reg_m5.idl deleted file mode 100644 index 85ff419689..0000000000 --- a/lib/ic/test/ic_pragma_SUITE_data/reg_m5.idl +++ /dev/null @@ -1,29 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// Version not in valid form : major.ninor - -module M1 { - - typedef long T4; - - #pragma version T4 2 - -}; diff --git a/lib/ic/test/ic_pragma_SUITE_data/reg_m6.idl b/lib/ic/test/ic_pragma_SUITE_data/reg_m6.idl deleted file mode 100644 index 4f876da8bc..0000000000 --- a/lib/ic/test/ic_pragma_SUITE_data/reg_m6.idl +++ /dev/null @@ -1,39 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -// Bad pragma prefixs - -module M2 { - - module M3 { - -#pragma prefix P2 // Should be "P2" - - interface I1 { - void foo( in short b, - out short c); - }; - typedef long T3; - }; - - - typedef long T4; -}; - - diff --git a/lib/ic/test/ic_pragma_SUITE_data/reg_m7.idl b/lib/ic/test/ic_pragma_SUITE_data/reg_m7.idl deleted file mode 100644 index 038b670dd9..0000000000 --- a/lib/ic/test/ic_pragma_SUITE_data/reg_m7.idl +++ /dev/null @@ -1,63 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% - -// Very uggly pragmas - - -#pragma prefix "P1" // Normal pragma - -module M4 { - - module M5 { - -#pragma prefix "P2" // Inside a parameter list - - interface I1 { - void Op( - #pragma prefix "P2" // Inside a parameter list - in short b, - #pragma prefix "P2" // Inside a parameter list - out short c - #pragma prefix "P2" // Inside a parameter list - ); - }; - typedef long T3; - }; - -}; - - - -/* - - Specified types with the following scoped names - and RepositoryIds - - ::M4::M5::T3 IDL:P2/T3:1.0 - -*/ - - - - - - - - diff --git a/lib/ic/test/ic_pragma_SUITE_data/uggly.idl b/lib/ic/test/ic_pragma_SUITE_data/uggly.idl deleted file mode 100644 index d12909c00e..0000000000 --- a/lib/ic/test/ic_pragma_SUITE_data/uggly.idl +++ /dev/null @@ -1,205 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -// Really uggly pragmas - - -struct S { - -#pragma ID TDL1 "LOCAL:SomeLocalId:1" -#pragma ID TDL1 "LOCAL:SomeLocalId:2" - -long a - -#pragma ID TDL1 "LOCAL:SomeLocalId:3" -#pragma ID TDL1 "LOCAL:SomeLocalId:4" - -; - -#pragma ID TDL1 "LOCAL:SomeLocalId:5" -#pragma ID TDL1 "LOCAL:SomeLocalId:6" - -long b - -#pragma ID TDL1 "LOCAL:SomeLocalId:7" -#pragma ID TDL1 "LOCAL:SomeLocalId:8" - -; - - -#pragma ID TDL1 "LOCAL:SomeLocalId:9" -#pragma ID TDL1 "LOCAL:SomeLocalId:10" - -}; - - -typedef long TDL1; - - -exception Exc1{ - -#pragma version Exc1 2.2 -#pragma ID TDL2 "LOCAL:SomeLocalId:11" - -}; - - -typedef long TDL2; - - -exception Exc2 { - -#pragma version Exc2 2.2 -#pragma ID TDL3 "LOCAL:SomeLocalId:11" - - long a - -#pragma ID TDL3 "LOCAL:SomeLocalId:12" -#pragma ID TDL3 "LOCAL:SomeLocalId:13" - - ; - -#pragma ID TDL3 "LOCAL:SomeLocalId:14" -#pragma ID TDL3 "LOCAL:SomeLocalId:15" - - long b - -#pragma ID TDL3 "LOCAL:SomeLocalId:16" - - ; - -#pragma ID TDL3 "LOCAL:SomeLocalId:17" - - -}; - -typedef long TDL3; - -enum E { -#pragma ID E "LOCAL:SomeLocalId:18" - a -#pragma ID E "LOCAL:SomeLocalId:19" - , -#pragma ID E "LOCAL:SomeLocalId:20" - b -#pragma ID E "LOCAL:SomeLocalId:21" -, -#pragma ID E "LOCAL:SomeLocalId:22" - c -#pragma ID E "LOCAL:SomeLocalId:23" -}; - - - -union U switch (long) { - -#pragma ID TDL4 "LOCAL:SomeLocalId:24" - - case 1: - -#pragma ID TDL4 "LOCAL:SomeLocalId:25" - - long a - -#pragma ID TDL4 "LOCAL:SomeLocalId:26" - -; - -#pragma ID TDL4 "LOCAL:SomeLocalId:27" - - case 2: - -#pragma ID TDL4 "LOCAL:SomeLocalId:28" - - case 3: - -#pragma ID TDL4 "LOCAL:SomeLocalId:29" - -long b - -#pragma ID TDL4 "LOCAL:SomeLocalId:30" - -; - -#pragma ID TDL4 "LOCAL:SomeLocalId:31" - - default : - -#pragma ID TDL4 "LOCAL:SomeLocalId:32" - -long c - -#pragma ID TDL4 "LOCAL:SomeLocalId:33" - -; - -#pragma ID TDL4 "LOCAL:SomeLocalId:34" - -}; - - -typedef long TDL4; - - - -module M { - - interface I { - - void fun1( - -#pragma version fun1 3.0 -#pragma ID TDL5 "LOCAL:SomeLocalId:35" - - in short b - -#pragma ID TDL5 "LOCAL:SomeLocalId:36" -#pragma ID TDL5 "LOCAL:SomeLocalId:37" - - , - -#pragma ID TDL5 "LOCAL:SomeLocalId:38" -#pragma ID TDL5 "LOCAL:SomeLocalId:39" - - out short c - -#pragma ID TDL5 "LOCAL:SomeLocalId:40" -#pragma ID TDL5 "LOCAL:SomeLocalId:41" - - ); - - - typedef long TDL5; - - - void fun2( - -#pragma ID TDL6 "LOCAL:SomeLocalId:42" -#pragma ID TDL6 "LOCAL:SomeLocalId:43" - - ); - - typedef long TDL6; - - }; - - - -}; - diff --git a/lib/ic/test/ic_register_SUITE.erl b/lib/ic/test/ic_register_SUITE.erl deleted file mode 100644 index 69eb923f85..0000000000 --- a/lib/ic/test/ic_register_SUITE.erl +++ /dev/null @@ -1,422 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: ic_register_SUITE.erl -%% -%% Description: -%% Test suite for the IFR object registration -%% -%%----------------------------------------------------------------- --module(ic_register_SUITE). - --include_lib("common_test/include/ct.hrl"). --include_lib("orber/include/corba.hrl"). -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, - init_per_suite/1, end_per_suite/1, ifr_reg_unreg/1]). --export([ifr_inheritence_reg/1,ifr_reg_unreg_with_inheritence/1]). --export([ifr_reg_unreg_with_inheritence_bad_order/1]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% Macros -%%----------------------------------------------------------------- --define(REMAP_EXCEPT(F), case catch F of - {'EXCEPTION', E} -> exit(E); - R -> R - end). -%% Standard options to the ic compiler, NOTE unholy use of OutDir - --define(OUT(X), filename:join([proplists:get_value(priv_dir, Config), gen, to_list(X)])). - - -%%----------------------------------------------------------------- -%% Func: all/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - cases(). - -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -cases() -> - [ifr_reg_unreg, ifr_reg_unreg_with_inheritence, - ifr_reg_unreg_with_inheritence_bad_order, - ifr_inheritence_reg]. - -%%----------------------------------------------------------------- -%% Init and cleanup functions. -%%----------------------------------------------------------------- - -init_per_suite(Config) -> - io:format("Setting up.....~n"), - mnesia:stop(), - mnesia:delete_schema([node()]), - mnesia:create_schema([node()]), - mnesia:start(), - orber:install([node()]), - orber:start(), - if - is_list(Config) -> - Config; - true -> - exit("Config not a list") - end. - -end_per_suite(Config) -> - io:format("Setting down.....~n"), - orber:stop(), - orber:uninstall(), - mnesia:stop(), - mnesia:delete_schema([node()]), - Config. - - - -%%----------------------------------------------------------------- -%% Test Case: IFR type registration -%%----------------------------------------------------------------- -%% Checks that the generated register/unregister -%% code for the IFR is correct. -ifr_reg_unreg(Config) when is_list(Config) -> - ?REMAP_EXCEPT(ifr_reg_unregt_run(Config)). - -ifr_reg_unregt_run(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(ifr_reg_unreg), - File0 = filename:join(DataDir, reg_m8), - File1 = filename:join(DataDir, reg_m9), - File2 = filename:join(DataDir, reg_m10), - ok = ic:gen(File0, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}] ), - {ok, []} = ic:gen(File0, stdopts(OutDir)++[silent2, {preproc_flags, - "-I" ++ DataDir}]), - ok = ic:gen(File1, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}] ), - {ok, []} = ic:gen(File1, stdopts(OutDir)++[silent2, {preproc_flags, - "-I" ++ DataDir}]), - ok = ic:gen(File2, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}] ), - {ok, []} = ic:gen(File2, stdopts(OutDir)++[silent2, {preproc_flags, - "-I" ++ DataDir}]), - ok = compile(OutDir, ifr_reg_unreg_files()), - code:add_pathz(OutDir), - ok = 'oe_reg_m8':'oe_register'(), - ok = 'oe_reg_m9':'oe_register'(), - ok = 'oe_reg_m10':'oe_register'(), - ok = 'oe_reg_m10':'oe_unregister'(), - ok = 'oe_reg_m9':'oe_unregister'(), - ok = 'oe_reg_m8':'oe_unregister'(), - code:del_path(OutDir), - ok. - -ifr_reg_unreg_files() -> ['oe_reg_m8', 'oe_reg_m9', 'oe_reg_m10']. - - - -%%----------------------------------------------------------------- -%% Test Case: IFR registration when object inheritence -%% is applied and registered. -%%----------------------------------------------------------------- -%% Checks that the generated register/unregister -%% code for the IFR is correct, and works even when -%% the object inheritence is registered. This fixes -%% two bugs in ifr that caused crash when trying to -%% use OE_register/OE_unregister in a sequence of -%% compiled files that contained interfaces who -%% inherited others in sequence. -ifr_reg_unreg_with_inheritence(Config) when is_list(Config) -> - ?REMAP_EXCEPT(ifr_reg_unreg_with_inheritence_run(Config)). - -ifr_reg_unreg_with_inheritence_run(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(ifr_reg_unreg), - File0 = filename:join(DataDir, reg_m8), - File1 = filename:join(DataDir, reg_m9), - File2 = filename:join(DataDir, reg_m10), - File3 = filename:join(DataDir, reg_m11), - File4 = filename:join(DataDir, reg_m12), - ok = ic:gen(File0, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}] ), - {ok, []} = ic:gen(File0, stdopts(OutDir)++[silent2, {preproc_flags, - "-I" ++ DataDir}]), - ok = ic:gen(File1, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}] ), - {ok, []} = ic:gen(File1, stdopts(OutDir)++[silent2, {preproc_flags, - "-I" ++ DataDir}]), - ok = ic:gen(File2, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}] ), - {ok, []} = ic:gen(File2, stdopts(OutDir)++[silent2, {preproc_flags, - "-I" ++ DataDir}]), - ok = ic:gen(File3, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}] ), - {ok, []} = ic:gen(File3, stdopts(OutDir)++[silent2, {preproc_flags, - "-I" ++ DataDir}]), - ok = ic:gen(File4, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}] ), - {ok, []} = ic:gen(File4, stdopts(OutDir)++[silent2, {preproc_flags, - "-I" ++ DataDir}]), - ok = compile(OutDir, ifr_reg_unreg_with_inheritence_files()), - code:add_pathz(OutDir), - ok = 'oe_reg_m8':'oe_register'(), - ok = 'oe_reg_m9':'oe_register'(), - ok = 'oe_reg_m10':'oe_register'(), - ok = 'oe_reg_m11':'oe_register'(), - ok = 'oe_reg_m12':'oe_register'(), - ok = 'oe_reg_m8':'oe_unregister'(), - ok = 'oe_reg_m9':'oe_unregister'(), - ok = 'oe_reg_m10':'oe_unregister'(), - ok = 'oe_reg_m11':'oe_unregister'(), - ok = 'oe_reg_m12':'oe_unregister'(), - code:del_path(OutDir), - ok. - -ifr_reg_unreg_with_inheritence_files() -> - ['oe_reg_m8', 'oe_reg_m9', 'oe_reg_m10', 'oe_reg_m11', 'oe_reg_m12']. - - - - - -%%----------------------------------------------------------------- -%% Test Case: IFR registration when object inheritence -%% is applied and registered in a bad order. -%% Modules included and used from an ifr object -%% are not allready registered when the current -%% object is getting registered. -%%----------------------------------------------------------------- -ifr_reg_unreg_with_inheritence_bad_order(Config) when is_list(Config) -> - ?REMAP_EXCEPT(ifr_reg_unreg_with_inheritence_bad_order_run(Config)). - -ifr_reg_unreg_with_inheritence_bad_order_run(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(ifr_reg_unreg), - File1 = filename:join(DataDir, reg_m9), - File2 = filename:join(DataDir, reg_m10), - File4 = filename:join(DataDir, reg_m12), - ok = ic:gen(File1, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}] ), - {ok, []} = ic:gen(File1, stdopts(OutDir)++[silent2, {preproc_flags, - "-I" ++ DataDir}]), - ok = ic:gen(File2, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}] ), - {ok, []} = ic:gen(File2, stdopts(OutDir)++[silent2, {preproc_flags, - "-I" ++ DataDir}]), - ok = ic:gen(File4, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}] ), - {ok, []} = ic:gen(File4, stdopts(OutDir)++[silent2, {preproc_flags, - "-I" ++ DataDir}]), - ok = compile(OutDir, ifr_reg_unreg_with_inheritence_files()), - code:add_pathz(OutDir), - case catch 'oe_reg_m12':'oe_register'() of - {'EXIT',Reason1} -> - io:format("IFR object missing detected : ~p~n",[Reason1]), - true; - _ -> - test_server:fail("Failed to detect object missing : IDL:M1:1.0~n") - end, - ok = 'oe_reg_m9':'oe_register'(), - case catch 'oe_reg_m10':'oe_register'() of - {'EXIT',Reason2} -> - io:format("IFR object missing detected : ~p~n",[Reason2]), - true; - _ -> - test_server:fail("Failed to detect object missing : IDL:M0:1.0~n") - end, - ok = 'oe_reg_m9':'oe_unregister'(), - code:del_path(OutDir), - ok. - -%%----------------------------------------------------------------- -%% Test Case: IFR registration with inheritence is correctly registered -%%----------------------------------------------------------------- -ifr_inheritence_reg(Config) when is_list(Config) -> - ?REMAP_EXCEPT(ifr_inh_reg_run(Config)). - -ifr_inh_reg_run(Config) -> - DataDir = proplists:get_value(data_dir, Config), - OutDir = ?OUT(ifr_reg_unreg), - File0 = filename:join(DataDir, reg_m8), - File1 = filename:join(DataDir, reg_m9), - File2 = filename:join(DataDir, reg_m10), - File3 = filename:join(DataDir, reg_m11), - File4 = filename:join(DataDir, reg_m12), - ok = ic:gen(File0, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}] ), - {ok, []} = ic:gen(File0, stdopts(OutDir)++[silent2, {preproc_flags, - "-I" ++ DataDir}]), - ok = ic:gen(File1, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}] ), - {ok, []} = ic:gen(File1, stdopts(OutDir)++[silent2, {preproc_flags, - "-I" ++ DataDir}]), - ok = ic:gen(File2, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}] ), - {ok, []} = ic:gen(File2, stdopts(OutDir)++[silent2, {preproc_flags, - "-I" ++ DataDir}]), - ok = ic:gen(File3, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}] ), - {ok, []} = ic:gen(File3, stdopts(OutDir)++[silent2, {preproc_flags, - "-I" ++ DataDir}]), - ok = ic:gen(File4, stdopts(OutDir)++[{preproc_flags, - "-I" ++ DataDir}] ), - {ok, []} = ic:gen(File4, stdopts(OutDir)++[silent2, {preproc_flags, - "-I" ++ DataDir}]), - ok = compile(OutDir, ifr_reg_unreg_with_inheritence_files()), - code:add_pathz(OutDir), - %% OE_register for all files - ok = 'oe_reg_m8':'oe_register'(), - ok = 'oe_reg_m9':'oe_register'(), - ok = 'oe_reg_m10':'oe_register'(), - ok = 'oe_reg_m11':'oe_register'(), - ok = 'oe_reg_m12':'oe_register'(), - - %% Inheritence registration test - OE_IFR = orber_ifr:find_repository(), - %% Interfaces that not inherit from other interfaces - [] = get_inh(OE_IFR, "IDL:m0/i0:1.0"), - [] = get_inh(OE_IFR, "IDL:m1/i1:1.0"), - [] = get_inh(OE_IFR, "IDL:m3/i3:1.0"), - %% Interfaces that inherit from other interfaces - ["IDL:m1/i1:1.0"] = get_inh(OE_IFR, "IDL:m2/i2:1.0"), - ["IDL:m1/i1:1.0","IDL:m2/i2:1.0"] = get_inh(OE_IFR, "IDL:m4/i4:1.0"), - ["IDL:m3/i3:1.0"] = get_inh(OE_IFR, "IDL:m4/i5:1.0"), - - %% OE_unregister for all files - ok = 'oe_reg_m8':'oe_unregister'(), - ok = 'oe_reg_m9':'oe_unregister'(), - ok = 'oe_reg_m10':'oe_unregister'(), - ok = 'oe_reg_m11':'oe_unregister'(), - ok = 'oe_reg_m12':'oe_unregister'(), - code:del_path(OutDir), - ok. - - -get_inh(OE_IFR,ID) -> - OE_CURRENT = orber_ifr:lookup_id(OE_IFR,ID), - INH_LIST = orber_ifr:get_base_interfaces(OE_CURRENT), - case INH_LIST of - [] -> - io:format("~nInterface ~p inherits from nobody.~n",[ID]), - []; - _ -> - print_inh_list_ids(ID, INH_LIST, []) - end. - -print_inh_list_ids(_ID, [], Acc) -> - lists:reverse(Acc); -print_inh_list_ids(ID, [H|T], Acc) -> - io:format("~n"), - Parent = orber_ifr:get_id(H), - io:format("Interface ~p inherits from ~p.~n", [ID, Parent]), - print_inh_list_ids(ID, T, [Parent|Acc]). - - - - -stdopts(OutDir) -> - [{outdir, OutDir}, {maxerrs, infinity}]. - - -compile(Dir, Files) -> - compile(Dir, Files, []). - -compile(Dir, Files, Opts) -> - {ok, Cwd} = file:get_cwd(), - file:set_cwd(Dir), - io:format("Changing to ~p~n", [Dir]), - case catch do_compile(Files, Opts) of - ok -> - file:set_cwd(Cwd); - Err -> - file:set_cwd(Cwd), - test_server:fail(Err) - end. - -do_compile([], _Opts) -> ok; -do_compile([F | Fs], Opts) -> - io:format("Compiling ~p", [F]), - case compile:file(F, Opts) of - ok -> - io:format(" ok~n", []), - do_load(F, Opts), - do_compile(Fs, Opts); - {ok, _} -> - io:format(" ok~n", []), - do_load(F, Opts), - do_compile(Fs, Opts); - {ok, _, _} -> - io:format(" ok~n", []), - do_load(F, Opts), - do_compile(Fs, Opts); - Err -> - io:format(" error: ~p~n", [Err]), - Err - end. - -do_load(File, Opts) -> - case lists:member(load, Opts) of - true -> - io:format("Loading file ~p", [File]), - code:purge(File), - R = code:load_abs(File), - io:format("Loaded: ~p", [R]); - false -> - ok - end. - - -to_list(X) when is_atom(X) -> atom_to_list(X); -to_list(X) -> X. - - - - - - - - - - - - - - - - - - diff --git a/lib/ic/test/ic_register_SUITE_data/reg_m10.idl b/lib/ic/test/ic_register_SUITE_data/reg_m10.idl deleted file mode 100644 index cc9156ae0c..0000000000 --- a/lib/ic/test/ic_register_SUITE_data/reg_m10.idl +++ /dev/null @@ -1,38 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -// -// IDL for testing register/unregister in the IFR when using included specs -// -#include "reg_m9.idl" - -typedef sequence Sequence1; - -#include "reg_m8.idl" - -module m2 { - - interface i2 : m1::i1 - { - short op3( in long a, inout char b, out long c ); - }; - - -}; - diff --git a/lib/ic/test/ic_register_SUITE_data/reg_m11.idl b/lib/ic/test/ic_register_SUITE_data/reg_m11.idl deleted file mode 100644 index 6a6c49a48e..0000000000 --- a/lib/ic/test/ic_register_SUITE_data/reg_m11.idl +++ /dev/null @@ -1,33 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -// -// IDL for testing register/unregister in the IFR when using included specs -// - -module m3 { - - interface i3 - { - short op4( in long a, inout char b, out long c ); - }; - - -}; - diff --git a/lib/ic/test/ic_register_SUITE_data/reg_m12.idl b/lib/ic/test/ic_register_SUITE_data/reg_m12.idl deleted file mode 100644 index 0c5f8083b5..0000000000 --- a/lib/ic/test/ic_register_SUITE_data/reg_m12.idl +++ /dev/null @@ -1,41 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -// -// IDL for testing register/unregister in the IFR when using included specs -// Special case with multiple inheritence. -// -#include "reg_m10.idl" -#include "reg_m11.idl" - -module m4 { - - interface i4 : m2::i2 - { - short op5( in long a, inout char b, out long c ); - }; - - interface i5 : m3::i3 - { - short op6( in long a, inout char b, out long c ); - }; - - -}; - diff --git a/lib/ic/test/ic_register_SUITE_data/reg_m8.idl b/lib/ic/test/ic_register_SUITE_data/reg_m8.idl deleted file mode 100644 index 5129b6b636..0000000000 --- a/lib/ic/test/ic_register_SUITE_data/reg_m8.idl +++ /dev/null @@ -1,33 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -// -// IDL for testing register/unregister in the IFR when using included specs -// -module m0 { - - interface i0 { - void op1( in short c ); - float op2( in char a); - - }; - - -}; - diff --git a/lib/ic/test/ic_register_SUITE_data/reg_m9.idl b/lib/ic/test/ic_register_SUITE_data/reg_m9.idl deleted file mode 100644 index c077d289b6..0000000000 --- a/lib/ic/test/ic_register_SUITE_data/reg_m9.idl +++ /dev/null @@ -1,33 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 1998-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -// -// IDL for testing register/unregister in the IFR when using included specs -// -module m1 { - - interface i1 { - void op1( in short c ); - float op2( in char a); - - }; - - -}; - diff --git a/lib/ic/test/ic_smoke.spec b/lib/ic/test/ic_smoke.spec deleted file mode 100644 index ec3b5758b1..0000000000 --- a/lib/ic/test/ic_smoke.spec +++ /dev/null @@ -1 +0,0 @@ -{suites,"../ic_test",[ic_SUITE]}. diff --git a/lib/ic/test/java_client_erl_server_SUITE.erl b/lib/ic/test/java_client_erl_server_SUITE.erl deleted file mode 100644 index 9fe52249ba..0000000000 --- a/lib/ic/test/java_client_erl_server_SUITE.erl +++ /dev/null @@ -1,319 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2003-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%%---------------------------------------------------------------------- -%%% Purpose : Test suite for the backends of the IDL compiler -%%%---------------------------------------------------------------------- - --module(java_client_erl_server_SUITE). --include_lib("common_test/include/ct.hrl"). - - --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, - init_per_suite/1,end_per_suite/1, - init_per_testcase/2,end_per_testcase/2]). --export([marshal_ll/1,marshal_ull/1, - marshal_l/1,marshal_ul/1, - marshal_s/1,marshal_us/1, - marshal_c/1,marshal_wc/1, - marshal_str/1, - marshal_any_3/1,marshal_any_2/1]). - - -%% Top of cases - -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - cases(). - -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -cases() -> - [marshal_ll, marshal_ull, marshal_l, marshal_ul, - marshal_s, marshal_us, marshal_c, marshal_wc, - marshal_str, marshal_any_3, marshal_any_2]. - -init_per_suite(Config) when is_list(Config) -> - case case code:priv_dir(jinterface) of - {error,bad_name} -> - false; - P -> - case filelib:wildcard(filename:join(P, "*.jar")) of - [_|_] -> - true; - [] -> - false - end - end - of - true -> - case find_executable(["java"]) of - false -> - {skip,"Found no Java VM"}; - Path -> - [{java,Path}|Config] - end; - false -> - {skip,"No jinterface application"} - end. - - -find_executable([]) -> - false; -find_executable([E|T]) -> - case os:find_executable(E) of - false -> find_executable(T); - Path -> Path - end. - -end_per_suite(Config) -> Config. - - - -%% Add/remove code path and watchdog before/after each test case. -%% -init_per_testcase(_Case, Config) -> - DataDir = proplists:get_value(data_dir, Config), - code:add_patha(DataDir), - - %% Since other test suites use the module m_i et,al, we have - %% to make sure we are using the right modules. - code:purge(m_i), - code:purge(m_i_impl), - code:purge(oe_java_erl_test), - code:load_file(m_i), - code:load_file(m_i_impl), - code:load_file(oe_java_erl_test), - - WatchDog = test_server:timetrap(test_server:seconds(20)), - [{watchdog, WatchDog}| Config]. - -end_per_testcase(_Case, Config) -> - DataDir = proplists:get_value(data_dir, Config), - code:del_path(DataDir), - WatchDog = proplists:get_value(watchdog, Config), - test_server:timetrap_cancel(WatchDog). - - - -%%-------------------------------------------------------------------- -%% -%% Test cases - -%% Testing marshalling of IDL long long -marshal_ll(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - {ok,Server} = m_i:oe_create_link([], {local,marshal_ll}), - ok = java(proplists:get_value(java, Config), DataDir, "JavaClient", - ["JavaClient",node(),erlang:get_cookie(),marshal_ll]), - ok = m_i:stop(Server), - ok. - -%% Testing marshalling of IDL unsigned long long -marshal_ull(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - {ok,Server} = m_i:oe_create_link([], {local,marshal_ull}), - ok = java(proplists:get_value(java, Config), DataDir, "JavaClient", - ["JavaClient",node(),erlang:get_cookie(),marshal_ull]), - ok = m_i:stop(Server), - ok. - -%% Testing marshalling of IDL long -marshal_l(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - {ok,Server} = m_i:oe_create_link([], {local,marshal_l}), - ok = java(proplists:get_value(java, Config), DataDir, "JavaClient", - ["JavaClient",node(),erlang:get_cookie(),marshal_l]), - ok = m_i:stop(Server), - ok. - -%% Testing marshalling of IDL unsigned long -marshal_ul(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - {ok,Server} = m_i:oe_create_link([], {local,marshal_ul}), - ok = java(proplists:get_value(java, Config), DataDir, "JavaClient", - ["JavaClient",node(),erlang:get_cookie(),marshal_ul]), - ok = m_i:stop(Server), - ok. - -%% Testing marshalling of IDL short -marshal_s(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - {ok,Server} = m_i:oe_create_link([], {local,marshal_s}), - ok = java(proplists:get_value(java, Config), DataDir, "JavaClient", - ["JavaClient",node(),erlang:get_cookie(),marshal_s]), - ok = m_i:stop(Server), - ok. - -%% Testing marshalling of IDL unsigned short -marshal_us(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - {ok,Server} = m_i:oe_create_link([], {local,marshal_us}), - ok = java(proplists:get_value(java, Config), DataDir, "JavaClient", - ["JavaClient",node(),erlang:get_cookie(),marshal_us]), - ok = m_i:stop(Server), - ok. - -%% Testing marshalling of IDL char -marshal_c(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - {ok,Server} = m_i:oe_create_link([], {local,marshal_c}), - ok = java(proplists:get_value(java, Config), DataDir, "JavaClient", - ["JavaClient",node(),erlang:get_cookie(),marshal_c]), - ok = m_i:stop(Server), - ok. - -%% Testing marshalling of IDL char -marshal_wc(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - {ok,Server} = m_i:oe_create_link([], {local,marshal_wc}), - ok = java(proplists:get_value(java, Config), DataDir, "JavaClient", - ["JavaClient",node(),erlang:get_cookie(),marshal_wc]), - ok = m_i:stop(Server), - ok. - -%% Testing marshalling of IDL string -marshal_str(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - {ok,Server} = m_i:oe_create_link([], {local,marshal_str}), - ok = java(proplists:get_value(java, Config), DataDir, -%%% "-DOtpConnection.trace=4 " - "JavaClient", - ["JavaClient",node(),erlang:get_cookie(),marshal_str]), - ok = m_i:stop(Server), - ok. - -%% Testing marshalling of IDL any -marshal_any_3(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - {ok,Server} = m_i:oe_create_link([], {local,marshal_any_3}), - ok = java(proplists:get_value(java, Config), DataDir, "JavaClient", - ["JavaClient",node(),erlang:get_cookie(),marshal_any_3]), - ok = m_i:stop(Server), - ok. - -marshal_any_2(Config) when is_list(Config) -> - DataDir = proplists:get_value(data_dir, Config), - {ok,Server} = m_i:oe_create_link([], {local,marshal_any_2}), - ok = java(proplists:get_value(java, Config), DataDir, "JavaClient", - ["JavaClient",node(),erlang:get_cookie(),marshal_any_2]), - ok = m_i:stop(Server), - ok. - -%%-------------------------------------------------------------------- -%% -%% Utilities - - -java(Java, Dir, ClassAndArgs) -> - cmd(Java++" -classpath \""++classpath(Dir)++"\" "++ClassAndArgs). - -java(Java, Dir, Class, Args) -> - java(Java, Dir, Class++" "++to_string(Args)). - -to_string([H|T]) when is_integer(H) -> - integer_to_list(H)++" "++to_string(T); -to_string([H|T]) when is_atom(H) -> - atom_to_list(H)++" "++to_string(T); -to_string([H|T]) when is_list(H) -> - lists:flatten(H)++" "++to_string(T); -to_string([]) -> []. - -% javac(Dir, File) -> -% cmd("javac -d "++Dir++" -classpath "++classpath(Dir)++" "++ -% filename:join(Dir, File)). - -classpath(Dir) -> - PS = - case os:type() of - {win32, _} -> ";"; - _ -> ":" - end, - Dir++PS++ - filename:join([code:lib_dir(ic),"priv","ic.jar"])++PS++ - filename:join([code:lib_dir(jinterface),"priv","OtpErlang.jar"])++PS++ - os:getenv("CLASSPATH", ""). - -cmd(Cmd) -> - PortOpts = [{line,80},eof,exit_status,stderr_to_stdout], - io:format(" ~ts~n", [Cmd]), - case catch open_port({spawn,Cmd}, PortOpts) of - Port when is_port(Port) -> - Result = cmd_loop(Port, []), - io:format("~n", [Result]), - case Result of - 0 -> ok; - ExitCode when is_integer(ExitCode) -> {error,ExitCode}; - Error -> Error - end; - {'EXIT',Reason} -> - {error,Reason} - end. - -cmd_loop(Port, Line) -> - receive - {Port,eof} -> - receive - {Port,{exit_status,ExitStatus}} -> - ExitStatus - after 1 -> - undefined - end; - {Port,{exit_status,ExitStatus}} -> - receive - {Port,eof} -> - ok after 1 -> ok end, - ExitStatus; - {Port,{data,{Tag,Data}}} -> - case Tag of - eol -> - io:put_chars([Line|cr_to_nl(Data)]), - io:nl(), - cmd_loop(Port, []); - noeol -> - cmd_loop(Port, [Line|cr_to_nl(Data)]) - end; - {'EXIT',Port,Reason} -> - {error,Reason}; - Other -> - io:format("WARNING: Unexpected at ~s:~p: ~p~n", - [?MODULE_STRING,?LINE,Other]), - cmd_loop(Port, Line) - end. - -%% Convert lonely CR to NL, and CRLF to NL -%% -cr_to_nl([$\r,$\n|T]) -> - [$\n|cr_to_nl(T)]; -cr_to_nl([$\r|T]) -> - [$\n|cr_to_nl(T)]; -cr_to_nl([C|T]) -> - [C|cr_to_nl(T)]; -cr_to_nl([]) -> - []. diff --git a/lib/ic/test/java_client_erl_server_SUITE_data/JavaClient.java b/lib/ic/test/java_client_erl_server_SUITE_data/JavaClient.java deleted file mode 100644 index 8092d7c627..0000000000 --- a/lib/ic/test/java_client_erl_server_SUITE_data/JavaClient.java +++ /dev/null @@ -1,760 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 2003-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -public class JavaClient { - - public static void main(String[] argv) - { - System.out.println("Hello World!"); - if (argv.length < 4) { - System.out.println("Too few arguments!"); - System.exit(1); - } - // for (int j = 0; j < argv.length; j++) - // System.out.println(argv[j]); - try { - if (argv[3].equals("marshal_ll")) { - System.out.println("marshal_ll"); - marshal_ll(argv[0], argv[1], argv[2], argv[3]); - } - else if (argv[3].equals("marshal_ull")) { - marshal_ull(argv[0], argv[1], argv[2], argv[3]); - } - else if (argv[3].equals("marshal_l")) { - marshal_l(argv[0], argv[1], argv[2], argv[3]); - } - else if (argv[3].equals("marshal_ul")) { - marshal_ul(argv[0], argv[1], argv[2], argv[3]); - } - else if (argv[3].equals("marshal_s")) { - marshal_s(argv[0], argv[1], argv[2], argv[3]); - } - else if (argv[3].equals("marshal_us")) { - marshal_us(argv[0], argv[1], argv[2], argv[3]); - } - else if (argv[3].equals("marshal_c")) { - marshal_c(argv[0], argv[1], argv[2], argv[3]); - } - else if (argv[3].equals("marshal_wc")) { - marshal_wc(argv[0], argv[1], argv[2], argv[3]); - } - else if (argv[3].equals("marshal_str")) { - marshal_str(argv[0], argv[1], argv[2], argv[3]); - } - else if (argv[3].equals("marshal_any_3")) { - marshal_any_3(argv[0], argv[1], argv[2], argv[3]); - } - else if (argv[3].equals("marshal_any_2")) { - marshal_any_2(argv[0], argv[1], argv[2], argv[3]); - } - else { - System.out.println("Unknown test: "+argv[3]); - System.exit(2); - } - } catch (java.lang.Exception e) { - System.out.println("Exception!: "+e); - System.exit(3); - } - System.exit(0); - } - - - - static void marshal_ll(String selfNode, String peerNode, - String cookie, String serverName) - throws java.lang.Exception - { - m._iStub i = new m._iStub(selfNode, peerNode, cookie, serverName); - // Just warming up.. - System.out.println("Just warming up.."+i); - verify_ll(i, 3, 2, 1); - verify_ll(i, 5, 4, 3); - verify_ll(i, -128, 0, 1); - // The small integer border - verify_ll(i, 255, 0, 1); - verify_ll(i, 256, 0, 1); - // The integer border - verify_ll(i, (1L<<26)-1L, 0L, 1); - verify_ll(i, 1L<<26, 0L, 1); - verify_ll(i, -(1L<<26), 0L, 1); - verify_ll(i, (1L<<27)-1L, 0L, 1); - verify_ll(i, 1L<<27, 0L, 1); - verify_ll(i, -(1L<<27), 0L, 1); - // Bignum byte borders - verify_ll(i, (1L<<32)-1L, 0L, 1); - verify_ll(i, 1L<<32, 0L, 1); - verify_ll(i, -(1L<<32)+1L, 0L, 1); - verify_ll(i, -(1L<<32), 0L, 1); - verify_ll(i, (1L<<40)-1L, 0L, 1); - verify_ll(i, 1L<<40, 0L, 1); - verify_ll(i, -(1L<<40)+1L, 0L, 1); - verify_ll(i, -(1L<<40), 0L, 1); - verify_ll(i, (1L<<48)-1L, 0L, 1); - verify_ll(i, 1L<<48, 0L, 1); - verify_ll(i, -(1L<<48)+1L, 0L, 1); - verify_ll(i, -(1L<<48), 0L, 1); - // Java long border - verify_ll(i, java.lang.Long.MAX_VALUE, 0L, 1); - verify_ll(i, java.lang.Long.MIN_VALUE, 0L, 1); - verify_ll(i, -1L, 0L, 1); - // Impossible decodes - verify_ll_bad(i, java.lang.Long.MAX_VALUE, -1L, 1); - verify_ll_bad(i, java.lang.Long.MIN_VALUE, 1L, 1); - verify_ll_bad(i, java.lang.Long.MIN_VALUE, 0L, -1); - verify_ll_bad(i, java.lang.Long.MAX_VALUE, -1L, 2); - verify_ll_bad(i, java.lang.Long.MIN_VALUE, 0L, 2); - } - - static void marshal_ull(String selfNode, String peerNode, - String cookie, String serverName) - throws java.lang.Exception - { - m._iStub i = new m._iStub(selfNode, peerNode, cookie, serverName); - // Just warming up.. - verify_ull(i, 3, 2, 1); - verify_ull(i, 5, 4, 3); - // The small integer border - verify_ull(i, 255, 0, 1); - verify_ull(i, 256, 0, 1); - // The integer border - verify_ull(i, (1L<<26)-1L, 0L, 1); - verify_ull(i, 1L<<26, 0L, 1); - verify_ull(i, (1L<<27)-1L, 0L, 1); - verify_ull(i, 1L<<27, 0L, 1); - // Bignum byte borders - verify_ull(i, (1L<<32)-1L, 0L, 1); - verify_ull(i, 1L<<32, 0L, 1); - verify_ull(i, (1L<<40)-1L, 0L, 1); - verify_ull(i, 1L<<40, 0L, 1); - verify_ull(i, (1L<<48)-1L, 0L, 1); - verify_ull(i, 1L<<48, 0L, 1); - // Java long border - verify_ull(i, java.lang.Long.MAX_VALUE, 0L, 1); - verify_ull(i, java.lang.Long.MIN_VALUE, 0L, 1); - verify_ull(i, -1L, 0L, 1); - verify_ull(i, java.lang.Long.MAX_VALUE, - java.lang.Long.MIN_VALUE, 1); - // Impossible decodes - verify_ull_bad(i, -1L, -1L, 1); - verify_ull_bad(i, java.lang.Long.MAX_VALUE, -1L, 2); - } - - static void marshal_l(String selfNode, String peerNode, - String cookie, String serverName) - throws java.lang.Exception - { - m._iStub i = new m._iStub(selfNode, peerNode, cookie, serverName); - // Just warming up.. - verify_l(i, 3, 2, 1); - verify_l(i, 5, 4, 3); - verify_l(i, -128, 0, 1); - // The small integer border - verify_l(i, 255, 0, 1); - verify_l(i, 256, 0, 1); - // The integer border - verify_l(i, (1<<26)-1, 0, 1); - verify_l(i, 1<<26, 0, 1); - verify_l(i, -(1<<26), 0, 1); - verify_l(i, (1<<27)-1, 0, 1); - verify_l(i, 1<<27, 0, 1); - verify_l(i, -(1<<27), 0, 1); - // Java int border - verify_l(i, java.lang.Integer.MAX_VALUE, 0, 1); - verify_l(i, java.lang.Integer.MIN_VALUE, 0, 1); - // Impossible decodes - verify_l_bad(i, java.lang.Integer.MAX_VALUE, -1, 1); - verify_l_bad(i, java.lang.Integer.MIN_VALUE, 1, 1); - verify_l_bad(i, java.lang.Integer.MIN_VALUE, 0, -1); - } - - static void marshal_ul(String selfNode, String peerNode, - String cookie, String serverName) - throws java.lang.Exception - { - m._iStub i = new m._iStub(selfNode, peerNode, cookie, serverName); - // Just warming up.. - verify_ul(i, 3, 2, 1); - verify_ul(i, 5, 4, 3); - // The small integer border - verify_ul(i, 255, 0, 1); - verify_ul(i, 256, 0, 1); - // The integer border - verify_ul(i, (1<<26)-1, 0, 1); - verify_ul(i, 1<<26, 0, 1); - verify_ul(i, (1<<27)-1, 0, 1); - verify_ul(i, 1<<27, 0, 1); - // Java int border - verify_ul(i, java.lang.Integer.MAX_VALUE, 0, 1); - verify_ul(i, java.lang.Integer.MIN_VALUE, 0, 1); - verify_ul(i, -1, 0, 1); - verify_ul(i, java.lang.Integer.MAX_VALUE, - java.lang.Integer.MIN_VALUE, 1); - // Impossible decodes - verify_ul_bad(i, -1, -1, 1); - } - - static void marshal_s(String selfNode, String peerNode, - String cookie, String serverName) - throws java.lang.Exception - { - m._iStub i = new m._iStub(selfNode, peerNode, cookie, serverName); - // Just warming up.. - verify_s(i, 3, 2, 1); - verify_s(i, 5, 4, 3); - verify_s(i, -128, 0, 1); - // The small integer border - verify_s(i, 255, 0, 1); - verify_s(i, 256, 0, 1); - // Java short border - verify_s(i, java.lang.Short.MAX_VALUE, 0, 1); - verify_s(i, java.lang.Short.MIN_VALUE, 0, 1); - // Impossible decodes - verify_s_bad(i, java.lang.Short.MAX_VALUE, -1, 1); - verify_s_bad(i, java.lang.Short.MIN_VALUE, 1, 1); - verify_s_bad(i, java.lang.Short.MIN_VALUE, 0, -1); - } - - static void marshal_us(String selfNode, String peerNode, - String cookie, String serverName) - throws java.lang.Exception - { - m._iStub i = new m._iStub(selfNode, peerNode, cookie, serverName); - // Just warming up.. - verify_us(i, 3, 2, 1); - verify_us(i, 5, 4, 3); - // The small integer border - verify_us(i, 255, 0, 1); - verify_us(i, 256, 0, 1); - // Java short border - verify_us(i, java.lang.Short.MAX_VALUE, 0, 1); - verify_us(i, java.lang.Short.MIN_VALUE, 0, 1); - verify_us(i, -1, 0, 1); - verify_us(i, java.lang.Short.MAX_VALUE, - java.lang.Short.MIN_VALUE, 1); - // Impossible decodes - verify_us_bad(i, -1, -1, 1); - } - - static void marshal_c(String selfNode, String peerNode, - String cookie, String serverName) - throws java.lang.Exception - { - m._iStub i = new m._iStub(selfNode, peerNode, cookie, serverName); - // Just warming up.. - verify_c(i, '\3', '\2', 1); - verify_c(i, '\5', '\4', 3); - // The small integer border - verify_c(i, '\u00FF', '\0', 1); - verify_c(i, '\u0100', '\0', 1); - // Java char border - verify_c(i, java.lang.Character.MAX_VALUE, '\0', 1); - verify_c(i, java.lang.Character.MIN_VALUE, '\0', 1); - verify_c(i, java.lang.Character.MAX_VALUE, - java.lang.Character.MIN_VALUE, 1); - // Impossible decodes - verify_c_bad(i, '\u8000', '\0', 2); - } - - static void marshal_wc(String selfNode, String peerNode, - String cookie, String serverName) - throws java.lang.Exception - { - m._iStub i = new m._iStub(selfNode, peerNode, cookie, serverName); - // Just warming up.. - verify_wc(i, '\3', '\2', 1); - verify_wc(i, '\5', '\4', 3); - // The small integer border - verify_wc(i, '\u00FF', '\0', 1); - verify_wc(i, '\u0100', '\0', 1); - // Java char border - verify_wc(i, java.lang.Character.MAX_VALUE, '\0', 1); - verify_wc(i, java.lang.Character.MIN_VALUE, '\0', 1); - verify_wc(i, java.lang.Character.MAX_VALUE, - java.lang.Character.MIN_VALUE, 1); - // Impossible decodes - verify_c_bad(i, '\u8000', '\0', 2); - } - - static void marshal_str(String selfNode, String peerNode, - String cookie, String serverName) - throws java.lang.Exception - { - m._iStub i = new m._iStub(selfNode, peerNode, cookie, serverName); - // Just warming up.. - verify_str(i, 100, 100); - verify_str(i, 100, 1); - // Erlang string border - verify_str(i, 65535, 1); - verify_str(i, 2, 65535); - // Erlang string border out - verify_str(i, 65536, 1); - verify_str(i, 65536, 65536); - } - - static void marshal_any_3(String selfNode, String peerNode, - String cookie, String serverName) - throws java.lang.Exception - { - m._iStub i = new m._iStub(selfNode, peerNode, cookie, serverName); - com.ericsson.otp.ic.Any x = new com.ericsson.otp.ic.Any(); - com.ericsson.otp.ic.Any y = new com.ericsson.otp.ic.Any(); - com.ericsson.otp.ic.Any z = new com.ericsson.otp.ic.Any(); - - x.insert_longlong(java.lang.Long.MAX_VALUE); - y.insert_longlong(1L); - z.insert_longlong(java.lang.Long.MAX_VALUE-1L); - System.out.println("verify_any_3 longlong max"); - verify_any_3(i, x, y, 1, z); - - x.insert_longlong(java.lang.Long.MIN_VALUE); - y.insert_longlong(-1L); - z.insert_longlong(java.lang.Long.MIN_VALUE+1L); - System.out.println("verify_any_3 longlong min"); - verify_any_3(i, x, y, 1, z); - - x.insert_ulonglong(-1L); - y.insert_longlong(1L); - z.insert_ulonglong(-2L); - System.out.println("verify_any_3 ulonglong max"); - verify_any_3(i, x, y, 1, z); - - x.insert_ulonglong(0L); - y.insert_longlong(-1L); - z.insert_ulonglong(1L); - System.out.println("verify_any_3 ulonglong min"); - verify_any_3(i, x, y, 1, z); - - x.insert_long(java.lang.Integer.MAX_VALUE); - y.insert_long(1); - z.insert_long(java.lang.Integer.MAX_VALUE-1); - System.out.println("verify_any_3 long max"); - verify_any_3(i, x, y, 1, z); - - x.insert_long(java.lang.Integer.MIN_VALUE); - y.insert_long(-1); - z.insert_long(java.lang.Integer.MIN_VALUE+1); - System.out.println("verify_any_3 long min"); - verify_any_3(i, x, y, 1, z); - - x.insert_ulong(-1); - y.insert_long(1); - z.insert_ulong(-2); - System.out.println("verify_any_3 ulong max"); - verify_any_3(i, x, y, 1, z); - - x.insert_ulong(0); - y.insert_long(-1); - z.insert_ulong(1); - System.out.println("verify_any_3 ulong min"); - verify_any_3(i, x, y, 1, z); - - x.insert_short(java.lang.Short.MAX_VALUE); - y.insert_short((short)1); - z.insert_short((short)(java.lang.Short.MAX_VALUE-1)); - System.out.println("verify_any_3 short max"); - verify_any_3(i, x, y, 1, z); - - x.insert_short(java.lang.Short.MIN_VALUE); - y.insert_short((short)-1); - z.insert_short((short)(java.lang.Short.MIN_VALUE+1)); - System.out.println("verify_any_3 short min"); - verify_any_3(i, x, y, 1, z); - - x.insert_ushort((short)-1); - y.insert_short((short)1); - z.insert_ushort((short)-2); - System.out.println("verify_any_3 ushort max"); - verify_any_3(i, x, y, 1, z); - - x.insert_ushort((short)0); - y.insert_short((short)-1); - z.insert_ushort((short)1); - System.out.println("verify_any_3 ushort min"); - verify_any_3(i, x, y, 1, z); - - x.insert_char('\377'); - y.insert_char('\1'); - z.insert_char('\376'); - System.out.println("verify_any_3 char max"); - verify_any_3(i, x, y, 1, z); - - x.insert_wchar('\uFFFF'); - y.insert_wchar('\u0001'); - z.insert_wchar('\uFFFE'); - System.out.println("verify_any_3 char max"); - verify_any_3(i, x, y, 1, z); - } - - static void marshal_any_2(String selfNode, String peerNode, - String cookie, String serverName) - throws java.lang.Exception - { - m._iStub i = new m._iStub(selfNode, peerNode, cookie, serverName); - m.s s = new m.s(); - com.ericsson.otp.ic.Any a = new com.ericsson.otp.ic.Any(); - // - s.ull_x = -1L; - s.ll_x = java.lang.Long.MAX_VALUE; - s.ll_y = 1L; - s.ull_z = -2L; - s.ll_z = java.lang.Long.MAX_VALUE-1L; - // - s.ul_x = -1; - s.l_x = java.lang.Integer.MAX_VALUE; - s.l_y = 1; - s.ul_z = -2; - s.l_z = java.lang.Integer.MAX_VALUE-1; - // - s.us_x = (short)-1; - s.s_x = java.lang.Short.MAX_VALUE; - s.s_y = (short)1; - s.us_z = (short)-2; - s.s_z = (short)(java.lang.Short.MAX_VALUE-1); - // - s.c_x = '\377'; - s.c_y = '\1'; - s.c_z = '\376'; - s.wc_x = '\uFFFF'; - s.wc_y = '\u0001'; - s.wc_z = '\uFFFE'; - m.sHelper.insert(a, s); - verify_any_2(i, a, 1); - - s.ull_x = 0L; - s.ll_x = java.lang.Long.MIN_VALUE; - s.ll_y = -1L; - s.ull_z = 1L; - s.ll_z = java.lang.Long.MIN_VALUE+1L; - // - s.ul_x = 0; - s.l_x = java.lang.Integer.MIN_VALUE; - s.l_y = -1; - s.ul_z = 1; - s.l_z = java.lang.Integer.MIN_VALUE+1; - // - s.us_x = (short)0; - s.s_x = java.lang.Short.MIN_VALUE; - s.s_y = (short)-1; - s.us_z = (short)1; - s.s_z = (short)(java.lang.Short.MIN_VALUE+1); - // - s.c_x = '\0'; - s.c_y = '\0'; - s.c_z = '\0'; - s.wc_x = '\u0000'; - s.wc_y = '\u0000'; - s.wc_z = '\u0000'; - m.sHelper.insert(a, s); - verify_any_2(i, a, 1); - } - - - static void verify_ll(m._iStub i, long x, long y, int b) - throws java.lang.Exception - { - m.s a = new m.s(); - System.out.println("verify_ll "+a); - a.ll_x = x; - a.ll_y = y; - long expected = (x - y)*(short)b; - long result = i.marshal_ll(a, (short)b); - if (result == expected) { - System.out.println("verify_ll("+x+", "+y+", "+b+") => " - +result); - } else { - System.out.println("verify_ll("+x+", "+y+", "+b+") => " - +result+" != "+expected); - System.exit(4); - } - } - - static void verify_ull(m._iStub i, long x, long y, int b) - throws java.lang.Exception - { - m.s a = new m.s(); - a.ull_x = x; - a.ll_y = y; - long expected = (x - y)*(short)b; - long result = i.marshal_ull(a, (short)b); - if (result == expected) { - System.out.println("verify_ull("+x+", "+y+", "+b+") => " - +result); - } else { - System.out.println("verify_ull("+x+", "+y+", "+b+") => " - +result+" != "+expected); - System.exit(4); - } - } - - static void verify_l(m._iStub i, int x, int y, int b) - throws java.lang.Exception - { - m.s a = new m.s(); - a.l_x = x; - a.l_y = y; - int expected = (x - y)*(short)b; - int result = i.marshal_l(a, (short)b); - if (result == expected) { - System.out.println("verify_l("+x+", "+y+", "+b+") => " - +result); - } else { - System.out.println("verify_l("+x+", "+y+", "+b+") => " - +result+" != "+expected); - System.exit(4); - } - } - - static void verify_ul(m._iStub i, int x, int y, int b) - throws java.lang.Exception - { - m.s a = new m.s(); - a.ul_x = x; - a.l_y = y; - int expected = (x - y)*(short)b; - int result = i.marshal_ul(a, (short)b); - if (result == expected) { - System.out.println("verify_ul("+x+", "+y+", "+b+") => " - +result); - } else { - System.out.println("verify_ul("+x+", "+y+", "+b+") => " - +result+" != "+expected); - System.exit(4); - } - } - - static void verify_s(m._iStub i, int x, int y, int b) - throws java.lang.Exception - { - m.s a = new m.s(); - a.s_x = (short)x; - a.s_y = (short)y; - short expected = (short)((x - y)*(short)b); - short result = i.marshal_s(a, (short)b); - if (result == expected) { - System.out.println("verify_s("+x+", "+y+", "+b+") => " - +result); - } else { - System.out.println("verify_s("+x+", "+y+", "+b+") => " - +result+" != "+expected); - System.exit(4); - } - } - - static void verify_us(m._iStub i, int x, int y, int b) - throws java.lang.Exception - { - m.s a = new m.s(); - a.us_x = (short)x; - a.s_y = (short)y; - short expected = (short)((x - y)*(short)b); - short result = i.marshal_us(a, (short)b); - if (result == expected) { - System.out.println("verify_us("+x+", "+y+", "+b+") => " - +result); - } else { - System.out.println("verify_us("+x+", "+y+", "+b+") => " - +result+" != "+expected); - System.exit(4); - } - } - - static void verify_c(m._iStub i, char x, char y, int b) - throws java.lang.Exception - { - m.s a = new m.s(); - a.c_x = x; - a.c_y = y; - char expected = (char)(((int)x - (int)y)*(short)b); - char result = i.marshal_c(a, (short)b); - if (result == expected) { - System.out.println("verify_c("+x+", "+y+", "+b+") => " - +result); - } else { - System.out.println("verify_c("+x+", "+y+", "+b+") => " - +result+" != "+expected); - System.exit(4); - } - } - - static void verify_wc(m._iStub i, char x, char y, int b) - throws java.lang.Exception - { - m.s a = new m.s(); - a.wc_x = x; - a.wc_y = y; - char expected = (char)(((int)x - (int)y)*(short)b); - char result = i.marshal_wc(a, (short)b); - if (result == expected) { - System.out.println("verify_wc("+x+", "+y+", "+b+") => " - +result); - } else { - System.out.println("verify_wc("+x+", "+y+", "+b+") => " - +result+" != "+expected); - System.exit(4); - } - } - - static void verify_str(m._iStub i, int a_len, int b_len) - throws java.lang.Exception - { - String a = mk_str(a_len); - String b = mk_str(b_len); - String expected = a + b; - String result = i.strcat(a, b); - if (result.equals(expected)) { - System.out.println("verify_str(\""+a+"\", \""+b+"\") => \"" - +result+"\""); - } else { - System.out.println("verify_str(\""+a+"\", \""+b+"\") => \"" - +result+"\" != \""+expected.length()+"\""); - System.exit(4); - } - } - - static String mk_str(int len) - throws StringIndexOutOfBoundsException - { - StringBuffer s = new StringBuffer(); - // 17 characters is prime relative all bases of two - on purpose - do s.append("qwertyuiopasdfghj"); while (s.length() < len); - return s.substring(0, len); - } - - static void verify_any_3(m._iStub i, - com.ericsson.otp.ic.Any x, - com.ericsson.otp.ic.Any y, - int b, - com.ericsson.otp.ic.Any expected) - throws java.lang.Exception - { - com.ericsson.otp.ic.Any result = i.marshal_any_3(x, y, (short)b); - if (! expected.equal(result)) { - System.exit(4); - } - } - - static void verify_any_2(m._iStub i, com.ericsson.otp.ic.Any a, int b) - throws java.lang.Exception - { - com.ericsson.otp.ic.Any result = i.marshal_any_2(a, (short)b); - if (! a.equal(result)) { - System.exit(4); - } - } - - - - static void verify_ll_bad(m._iStub i, long x, long y, int b) - throws java.lang.Exception - { - try { - verify_ll(i, x, y, b); - System.out.println("Expected exception missing!"); - System.exit(5); - } catch (com.ericsson.otp.erlang.OtpErlangDecodeException e) { - System.out.println("Expected exception: "+e); - } - } - - static void verify_ull_bad(m._iStub i, long x, long y, int b) - throws java.lang.Exception - { - try { - verify_ull(i, x, y, b); - System.out.println("Expected exception missing!"); - System.exit(5); - } catch (com.ericsson.otp.erlang.OtpErlangDecodeException e) { - System.out.println("Expected exception: "+e); - } - } - - static void verify_l_bad(m._iStub i, int x, int y, int b) - throws java.lang.Exception - { - try { - verify_l(i, x, y, b); - System.out.println("Expected exception missing!"); - System.exit(5); - } catch (com.ericsson.otp.erlang.OtpErlangDecodeException e) { - System.out.println("Expected exception: "+e); - } - } - - static void verify_ul_bad(m._iStub i, int x, int y, int b) - throws java.lang.Exception - { - try { - verify_ul(i, x, y, b); - System.out.println("Expected exception missing!"); - System.exit(5); - } catch (com.ericsson.otp.erlang.OtpErlangDecodeException e) { - System.out.println("Expected exception: "+e); - } - } - - static void verify_s_bad(m._iStub i, int x, int y, int b) - throws java.lang.Exception - { - try { - verify_s(i, x, y, b); - System.out.println("Expected exception missing!"); - System.exit(5); - } catch (com.ericsson.otp.erlang.OtpErlangDecodeException e) { - System.out.println("Expected exception: "+e); - } - } - - static void verify_us_bad(m._iStub i, int x, int y, int b) - throws java.lang.Exception - { - try { - verify_us(i, x, y, b); - System.out.println("Expected exception missing!"); - System.exit(5); - } catch (com.ericsson.otp.erlang.OtpErlangDecodeException e) { - System.out.println("Expected exception: "+e); - } - } - - static void verify_c_bad(m._iStub i, char x, char y, int b) - throws java.lang.Exception - { - try { - verify_c(i, x, y, b); - System.out.println("Expected exception missing!"); - System.exit(5); - } catch (com.ericsson.otp.erlang.OtpErlangDecodeException e) { - System.out.println("Expected exception: "+e); - } - } - - static void verify_wc_bad(m._iStub i, char x, char y, int b) - throws java.lang.Exception - { - try { - verify_wc(i, x, y, b); - System.out.println("Expected exception missing!"); - System.exit(5); - } catch (com.ericsson.otp.erlang.OtpErlangDecodeException e) { - System.out.println("Expected exception: "+e); - } - } - -} diff --git a/lib/ic/test/java_client_erl_server_SUITE_data/Makefile.src b/lib/ic/test/java_client_erl_server_SUITE_data/Makefile.src deleted file mode 100644 index bcc59e87db..0000000000 --- a/lib/ic/test/java_client_erl_server_SUITE_data/Makefile.src +++ /dev/null @@ -1,101 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2003-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -# Makefile.src for java_client_erl_server test -# Note: This file *must* work for both Unix and Windows -# -# We use both `rm' (Unix) and `del' (Windows) for removing files, but -# with a `-' in front so that the error in not finding `rm' (`del') on -# Windows (Unix) is ignored. -# -# VxWorks? XXX -# - -.SUFFIXES: -.SUFFIXES: .erl .idl .@EMULATOR@ .java - - -JAVAC = @JAVAC@ -ERLC = erlc - -# ic variables available from ts: -# -# ic_libpath: @ic_libpath@ -# ic_include_path: @ic_include_path@ - -IC_INCLUDE_PATH = @ic_include_path@ -IC_CLASSPATH = @ic_classpath@ - -JINTERFACE_CLASSPATH = @jinterface_classpath@ - -CLASSPATH = .@PS@$(IC_CLASSPATH)@PS@$(JINTERFACE_CLASSPATH)@PS@ - -GEN_JAVA_FILES = \ - m@DS@_iImplBase.java \ - m@DS@_iStub.java \ - m@DS@i.java m@DS@iHelper.java m@DS@iHolder.java \ - m@DS@s.java m@DS@sHelper.java m@DS@sHolder.java - -GEN_HRL_FILES = \ - m.hrl \ - m_i.hrl \ - oe_java_erl_test.hrl - -GEN_ERL_FILES = \ - m_i.erl \ - oe_java_erl_test.erl - -JAVA_FILES = $(GEN_JAVA_FILES) JavaClient.java -CLASS_FILES = $(JAVA_FILES:.java=.class) -ERL_FILES = $(GEN_ERL_FILES) m_i_impl.erl -EBINS = $(ERL_FILES:.erl=.@EMULATOR@) - -@IFEQ@ (@jinterface@,not_found) -all: -@ELSE@ -all: $(CLASS_FILES) $(EBINS) -@ENDIF@ - -$(GEN_ERL_FILES) $(GEN_HRL_FILES): java_erl_test.built_erl -$(GEN_JAVA_FILES): java_erl_test.built_java -$(CLASS_FILES): $(GEN_JAVA_FILES) -$(EBINS): $(GEN_ERL_FILES) $(GEN_HRL_FILES) - -clean: - -rm -f $(GEN_JAVA_FILES) $(CLASS_FILES) \ - $(GEN_ERL_FILES) $(GEN_HRL_FILES) $(EBINS) \ - java_erl_test.built_erl java_erl_test.built_java - -del /F /Q $(GEN_JAVA_FILES) $(CLASS_FILES) \ - $(GEN_ERL_FILES) $(GEN_HRL_FILES) $(EBINS) \ - java_erl_test.built_erl java_erl_test.built_java - -java_erl_test.built_java: java_erl_test.idl - $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,java}" java_erl_test.idl - echo done > java_erl_test.built_java - -$(CLASS_FILES) : $(JAVA_FILES) - $(JAVAC) -classpath $(CLASSPATH) $(JAVA_FILES) - -java_erl_test.built_erl: java_erl_test.idl - $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,erl_genserv}" java_erl_test.idl - echo done > java_erl_test.built_erl - -.erl.@EMULATOR@: - $(ERLC) -I $(IC_INCLUDE_PATH) $< diff --git a/lib/ic/test/java_client_erl_server_SUITE_data/java_erl_test.idl b/lib/ic/test/java_client_erl_server_SUITE_data/java_erl_test.idl deleted file mode 100644 index 55194cf911..0000000000 --- a/lib/ic/test/java_client_erl_server_SUITE_data/java_erl_test.idl +++ /dev/null @@ -1,69 +0,0 @@ - - -// %CopyrightBegin% -// -// Copyright Ericsson AB 2003-2016. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// %CopyrightEnd% -module m { - - struct s { - long long ll_x; - unsigned long long ull_x; - long long ll_y; - long long ll_z; - unsigned long long ull_z; - - long l_x; - unsigned long ul_x; - long l_y; - long l_z; - unsigned long ul_z; - - short s_x; - unsigned short us_x; - short s_y; - short s_z; - unsigned short us_z; - - char c_x; - char c_y; - char c_z; - - wchar wc_x; - wchar wc_y; - wchar wc_z; - }; - - interface i { - long long marshal_ll( in s a, in short b ); - unsigned long long marshal_ull( in s a, in short b ); - - long marshal_l( in s a, in short b ); - unsigned long marshal_ul( in s a, in short b ); - - short marshal_s( in s a, in short b ); - unsigned short marshal_us( in s a, in short b ); - - char marshal_c( in s a, in short b ); - wchar marshal_wc( in s a, in short b ); - - string strcat( in string a, in string b ); - - any marshal_any_3( in any x, in any y, in short b ); - any marshal_any_2( in any a, in short b ); - }; - -}; diff --git a/lib/ic/test/java_client_erl_server_SUITE_data/m_i_impl.erl b/lib/ic/test/java_client_erl_server_SUITE_data/m_i_impl.erl deleted file mode 100644 index 31b4c1dd7a..0000000000 --- a/lib/ic/test/java_client_erl_server_SUITE_data/m_i_impl.erl +++ /dev/null @@ -1,170 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2003-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%%-------------------------------------------------------------------- --module(m_i_impl). - --export([marshal_ll/3,marshal_ull/3, - marshal_l/3,marshal_ul/3, - marshal_s/3,marshal_us/3, - marshal_c/3,marshal_wc/3, - strcat/3, - marshal_any_3/4,marshal_any_2/3]). --export([init/1,terminate/2,code_change/3]). - --include("m.hrl"). - --define(TK_M_S, {tk_struct, - "IDL:m/s:1.0", - "s", - [{"ll_x",tk_longlong}, - {"ull_x",tk_ulonglong}, - {"ll_y",tk_longlong}, - {"ll_z",tk_longlong}, - {"ull_z",tk_ulonglong}, - {"l_x",tk_long}, - {"ul_x",tk_ulong}, - {"l_y",tk_long}, - {"l_z",tk_long}, - {"ul_z",tk_ulong}, - {"s_x",tk_short}, - {"us_x",tk_ushort}, - {"s_y",tk_short}, - {"s_z",tk_short}, - {"us_z",tk_ushort}, - {"c_x",tk_char}, - {"c_y",tk_char}, - {"c_z",tk_char}, - {"wc_x",tk_wchar}, - {"wc_y",tk_wchar}, - {"wc_z",tk_wchar}|_]}). - - - -marshal_ll(State, #m_s{ll_x = X, ll_y = Y}=_A, B) when integer(B) -> - R = (X - Y)*B, - io:format("~p", [{?MODULE,?LINE,[X,Y,B,R]}]), - {reply, R, State}. - -marshal_ull(State, #m_s{ull_x = X, ll_y = Y}=_A, B) when integer(B) -> - R = (X - Y)*B, - io:format("~p", [{?MODULE,?LINE,[X,Y,B,R]}]), - {reply, R, State}. - - -marshal_l(State, #m_s{l_x = X, l_y = Y}=_A, B) when integer(B) -> - R = (X - Y)*B, - io:format("~p", [{?MODULE,?LINE,[X,Y,B,R]}]), - {reply, R, State}. - -marshal_ul(State, #m_s{ul_x = X, l_y = Y}=_A, B) when integer(B) -> - R = (X - Y)*B, - io:format("~p", [{?MODULE,?LINE,[X,Y,B,R]}]), - {reply, R, State}. - - -marshal_s(State, #m_s{s_x = X, s_y = Y}=_A, B) when integer(B) -> - R = (X - Y)*B, - io:format("~p", [{?MODULE,?LINE,[X,Y,B,R]}]), - {reply, R, State}. - -marshal_us(State, #m_s{us_x = X, s_y = Y}=_A, B) when integer(B) -> - R = (X - Y)*B, - io:format("~p", [{?MODULE,?LINE,[X,Y,B,R]}]), - {reply, R, State}. - - -marshal_c(State, #m_s{c_x = X, c_y = Y}=_A, B) when integer(B) -> - R = (X - Y)*B, - io:format("~p", [{?MODULE,?LINE,[X,Y,B,R]}]), - {reply, R, State}. - -marshal_wc(State, #m_s{wc_x = X, wc_y = Y}=_A, B) when integer(B) -> - R = (X - Y)*B, - io:format("~p", [{?MODULE,?LINE,[X,Y,B,R]}]), - {reply, R, State}. - -strcat(State, A, B) when list(A), list(B) -> - R = A++B, - io:format("~p", [{?MODULE,?LINE,[length(A),length(B),A,B,R]}]), - {reply, R, State}; -strcat(State, A, B) -> - io:format("~p", [{?MODULE,?LINE,[A,B]}]), - {reply, [], State}. - -marshal_any_3(State, {any,TkX,_}=X, {any,_,_}=Y, B) when integer(B) -> - R = any(mul(sub(any(X), any(Y)), B), TkX), - io:format("~p", [{?MODULE,?LINE,[X,Y,B,R]}]), - {reply, R, State}. - -marshal_any_2(State, - {any,TkA,#m_s{ll_x=LL_X, ull_x=ULL_X, ll_y=LL_Y, - l_x=L_X, ul_x=UL_X, l_y=L_Y, - s_x=S_X, us_x=US_X, s_y=S_Y, - c_x=C_X, c_y=C_Y, - wc_x=WC_X, wc_y=WC_Y} = A}, - B) when integer(B) -> - {check_type_code,?TK_M_S} = {check_type_code,TkA}, - ULL_Z = (ULL_X - LL_Y) * B, - LL_Z = (LL_X - LL_Y) * B, - UL_Z = (UL_X - L_Y) * B, - L_Z = (L_X - L_Y) * B, - US_Z = (US_X - S_Y) * B, - S_Z = (S_X - S_Y) * B, - C_Z = (C_X - C_Y) * B, - WC_Z = (WC_X - WC_Y) * B, - R = A#m_s{ll_z=LL_Z, ull_z=ULL_Z, - l_z=L_Z, ul_z=UL_Z, - s_z=S_Z, us_z=US_Z, - c_z=C_Z, wc_z=WC_Z}, - io:format("~p", [{?MODULE,?LINE,[A,B,R]}]), - {reply, {any,TkA,R}, State}. - - - -init(_Env) -> - {ok, []}. - -terminate(_Reason, _State) -> - ok. - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - - -any({any,tk_longlong,X}) -> X; -any({any,tk_long,X}) -> X; -any({any,tk_short,X}) -> X; -any({any,tk_ulonglong,X}) -> X; -any({any,tk_ulong,X}) -> X; -any({any,tk_ushort,X}) -> X; -any({any,tk_char,X}) -> X; -any({any,tk_wchar,X}) -> X. - -any(X, Tk) when integer(X) -> {any,Tk,X}. - -sub(X, Y) when integer(X), integer(Y) -> - X - Y. - -mul(X, Y) when integer(X), integer(Y) -> - X * Y. - -napp(0, L) -> L; -napp(N, L) when integer(N), N >= 1 -> napp(N-1, L)++L. diff --git a/lib/ic/vsn.mk b/lib/ic/vsn.mk deleted file mode 100644 index d35d1dce1e..0000000000 --- a/lib/ic/vsn.mk +++ /dev/null @@ -1 +0,0 @@ -IC_VSN = 4.4.4 diff --git a/lib/orber/AUTHORS b/lib/orber/AUTHORS deleted file mode 100644 index a77bdcf140..0000000000 --- a/lib/orber/AUTHORS +++ /dev/null @@ -1,8 +0,0 @@ -Original Authors: -Lars Thorsen -Per Danielsson -Peter Lundell -Niclas Eklund -Babbis Xagorarakis - -Contributors: diff --git a/lib/orber/COSS/CosNaming/CosNaming_BindingIterator_impl.erl b/lib/orber/COSS/CosNaming/CosNaming_BindingIterator_impl.erl deleted file mode 100644 index 760c003f82..0000000000 --- a/lib/orber/COSS/CosNaming/CosNaming_BindingIterator_impl.erl +++ /dev/null @@ -1,94 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: CosNaming_BindingIterator_impl.erl -%% -%%----------------------------------------------------------------- --module('CosNaming_BindingIterator_impl'). - --include_lib("orber/include/corba.hrl"). --include("CosNaming.hrl"). --include("orber_cosnaming.hrl"). - - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([init/1, terminate/2, code_change/3]). --export([next_one/1, next_n/2, destroy/1]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% External interface functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: init/1 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -init(State) -> - {ok, State}. - -%%----------------------------------------------------------------- -%% Func: terminate/2 -%% Args: -%% Returns: -%%----------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -next_one([]) -> - NoBinding = #'CosNaming_Binding'{binding_name=[], - binding_type=nobject}, - {reply, {false, NoBinding}, []}; -next_one([Binding]) -> - {reply, {true, Binding}, []}; -next_one([Binding|Rest]) -> - {reply, {true, Binding}, Rest}. - -next_n([], _) -> - {reply, {false, []}, []}; -next_n(List, HowMany) -> - {More, Acc, NewList} = split(List, HowMany, []), - {reply, {More, Acc}, NewList}. - -split([], _, Acc) -> - {false, Acc, []}; -split(Rest, 0, Acc) -> - {true, Acc, Rest}; -split([H|T], N, Acc) -> - split(T, N-1, [H|Acc]). - - -destroy(OE_State) -> - {stop, normal, ok, OE_State}. - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- diff --git a/lib/orber/COSS/CosNaming/CosNaming_NamingContextExt_impl.erl b/lib/orber/COSS/CosNaming/CosNaming_NamingContextExt_impl.erl deleted file mode 100644 index 88049a509f..0000000000 --- a/lib/orber/COSS/CosNaming/CosNaming_NamingContextExt_impl.erl +++ /dev/null @@ -1,756 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2017. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: CosNaming_NamingContextExt_impl.erl -%% Modified: -%% -%%----------------------------------------------------------------- -%% README: -%% (1) -%% -%%----------------------------------------------------------------- --module('CosNaming_NamingContextExt_impl'). - -%%---------------------------------------------------------------------- -%% Include files -%%---------------------------------------------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). --include("CosNaming.hrl"). --include("CosNaming_NamingContext.hrl"). --include("CosNaming_NamingContextExt.hrl"). --include("orber_cosnaming.hrl"). - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- -%% Mandatory callbacks --export([init/1, - terminate/2, - code_change/3]). - -%% Inherrit from CosNaming::NamingContext --export([bind/4, - rebind/4, - bind_context/4, - rebind_context/4, - resolve/3, - unbind/3, - new_context/2, - bind_new_context/3, - list/3, - destroy/2]). - -%% CosNaming::NamingContextExt --export([to_string/3, - to_name/3, - to_url/4, - resolve_str/3]). - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- --export([dump/0, - install/2]). - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- -%% DEBUG INFO --define(DEBUG_LEVEL, 5). - -%%====================================================================== -%% External functions -%%====================================================================== -%%---------------------------------------------------------------------% -%% Function : init/1 -%% Description: Initiates the server -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%%---------------------------------------------------------------------- -init([]) -> - {ok, term_to_binary('undefined')}; - -init(DBKey) -> - _F = ?write_function(#orber_CosNaming{name_context=DBKey, - nameindex=[]}), - write_result(mnesia:transaction(_F)), - {ok, DBKey}. - -%%---------------------------------------------------------------------% -%% Function : terminate -%% Description: Shutdown the server -%% Returns : any (ignored by gen_server) -%%---------------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -%%---------------------------------------------------------------------% -%% Function : code_change -%% Description: Convert process state when code is changed -%% Returns : {ok, State} -%%---------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%---------------------------------------------------------------------% -%% Function : install -%% Arguments : Timeout - abort if timeout triggered. -%% Options - mnesia options -%% Description: -%% Returns : -%%---------------------------------------------------------------------- -install(Timeout, Options) -> - %% Fetch a list of the defined tables to see if 'CosNaming' is defined. - AllTabs = mnesia:system_info(tables), - DB_tables_created = - case lists:member('orber_CosNaming', AllTabs) of - true -> - case lists:member({local_content, true}, - Options) of - true-> - mnesia:add_table_copy('orber_CosNaming', - node(), - ram_copies); - _-> - mnesia:create_table('orber_CosNaming',[{attributes, - record_info(fields, - 'orber_CosNaming')} - |Options]) - end; - _ -> - mnesia:create_table('orber_CosNaming',[{attributes, - record_info(fields, - 'orber_CosNaming')} - |Options]) - end, - Wait = mnesia:wait_for_tables(['orber_CosNaming'], Timeout), - %% Check if any error has occured yet. If there are errors, return them. - - if - DB_tables_created == {atomic, ok}, - Wait == ok -> - _F = ?write_function(#orber_CosNaming{name_context= - term_to_binary('undefined'), - nameindex=[]}), - write_result(mnesia:transaction(_F)); - true -> - {error, [DB_tables_created, Wait]} - end. - - -%%---------------------------------------------------------------------- -%% Interface CosNaming::NamingContext -%%---------------------------------------------------------------------- -%%---------------------------------------------------------------------- -%% Function : bind -%% Arguments : -%% Description: -%% Returns : -%%---------------------------------------------------------------------- -bind(OE_THIS, OE_State, [N], Obj) -> - SubobjKey = corba:get_subobject_key(OE_THIS), - _BF = - fun() -> - case mnesia:wread({orber_CosNaming, SubobjKey}) of - [#orber_CosNaming{nameindex = X}] -> - case lists:keysearch(N, 1, X) of - {value, _} -> - {'EXCEPTION', #'CosNaming_NamingContext_AlreadyBound'{}}; - false -> - mnesia:write(#orber_CosNaming{name_context=SubobjKey, - nameindex=[{N, nobject, Obj} | X]}) - end; - Other -> - orber:dbg("[~p] ~p:bind(~p, ~p);~n" - "DB access returned ~p", - [?LINE, ?MODULE, N, SubobjKey, Other], ?DEBUG_LEVEL), - {'EXCEPTION', #'CosNaming_NamingContext_CannotProceed'{rest_of_name=[N], - cxt=OE_THIS}} - end - end, - case mnesia:transaction(_BF) of - {atomic, {'EXCEPTION', E}} -> - corba:raise(E); - {atomic, ok} -> - {reply, ok, OE_State}; - Other -> - orber:dbg("[~p] ~p:bind(~p, ~p);~n" - "DB transaction returned ~p", - [?LINE, ?MODULE, N, SubobjKey, Other], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; -bind(OE_THIS, OE_State, [H|T], Obj) -> - SubobjKey = corba:get_subobject_key(OE_THIS), - _RF = ?read_function({orber_CosNaming, SubobjKey}), - case orber_cosnaming_utils:query_result(mnesia:transaction(_RF)) of - error -> - corba:raise(#'CosNaming_NamingContext_CannotProceed'{rest_of_name=[H|T], - cxt=OE_THIS}); - X -> - case lists:keysearch(H, 1, X) of - {value, {H, ncontext, NC}} when is_record(NC, 'IOP_IOR') -> - {reply, 'CosNaming_NamingContext':bind(NC, T, Obj), OE_State}; - {value, {H, ncontext, NC}} -> - bind(NC, OE_State, T, Obj); - _ -> - corba:raise(#'CosNaming_NamingContext_CannotProceed' - {rest_of_name=[H|T], cxt=OE_THIS}) - end - end; -bind(_OE_THIS, _OE_State, [], _Obj) -> - orber:dbg("[~p] CosNaming_NamingContextExt:bind();~n" - "Invoked this operation with an empty list", - [?LINE], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_YES}). - -%%---------------------------------------------------------------------- -%% Function : rebind -%% Arguments : -%% Description: -%% Returns : -%%---------------------------------------------------------------------- -rebind(OE_THIS, OE_State, [N], Obj) -> - SubobjKey = corba:get_subobject_key(OE_THIS), - _RBF = - fun() -> - case mnesia:wread({orber_CosNaming, SubobjKey}) of - [#orber_CosNaming{nameindex = X}] -> - KList = - case lists:keysearch(N, 1, X) of - {value, {N, _, _V}} -> - lists:keyreplace(N, 1, X, {N, nobject, Obj}); - false -> - [{N, nobject, Obj} | X] - end, - mnesia:write(#orber_CosNaming{name_context=SubobjKey, - nameindex=KList}); - Other -> - orber:dbg("[~p] ~p:rebind(~p, ~p);~n" - "DB access returned ~p", - [?LINE, ?MODULE, N, SubobjKey, Other], ?DEBUG_LEVEL), - {'EXCEPTION', #'CosNaming_NamingContext_CannotProceed'{rest_of_name=[N], - cxt=OE_THIS}} - end - end, - case mnesia:transaction(_RBF) of - {atomic, {'EXCEPTION', E}} -> - corba:raise(E); - {atomic, ok} -> - {reply, ok, OE_State}; - Other -> - orber:dbg("[~p] ~p:rebind(~p, ~p);~n" - "DB transaction returned ~p", - [?LINE, ?MODULE, N, SubobjKey, Other], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; -rebind(OE_THIS, OE_State, [H|T], Obj) -> - SubobjKey = corba:get_subobject_key(OE_THIS), - _RF = ?read_function({orber_CosNaming, SubobjKey}), - case orber_cosnaming_utils:query_result(mnesia:transaction(_RF)) of - error -> - corba:raise(#'CosNaming_NamingContext_CannotProceed'{rest_of_name=[H|T], - cxt=OE_THIS}); - X -> - case lists:keysearch(H, 1, X) of - {value, {H, ncontext, NC}} when is_record(NC, 'IOP_IOR') -> - {reply, 'CosNaming_NamingContext':rebind(NC, T, Obj), OE_State}; - {value, {H, ncontext, NC}} -> - rebind(NC, OE_State, T, Obj); - _ -> - corba:raise(#'CosNaming_NamingContext_CannotProceed' - {rest_of_name=[H|T], cxt=OE_THIS}) - end - end; -rebind(_OE_THIS, _OE_State, [], _Obj) -> - orber:dbg("[~p] CosNaming_NamingContextExt:rebind();~n" - "Invoked this operation with an empty list", - [?LINE], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_YES}). - -%%---------------------------------------------------------------------- -%% Function : bind_context -%% Arguments : -%% Description: -%% Returns : -%%---------------------------------------------------------------------- -bind_context(OE_THIS, OE_State, [N], Obj) -> - SubobjKey = corba:get_subobject_key(OE_THIS), - _BCF = - fun() -> - case mnesia:wread({orber_CosNaming, SubobjKey}) of - [#orber_CosNaming{nameindex = X}] -> - case lists:keysearch(N, 1, X) of - {value, _} -> - {'EXCEPTION', #'CosNaming_NamingContext_AlreadyBound'{}}; - false -> - mnesia:write(#orber_CosNaming{name_context=SubobjKey, - nameindex= - [{N, ncontext, Obj} | X]}) - end; - Other -> - orber:dbg("[~p] ~p:bind_context(~p, ~p);~n" - "DB access returned ~p", - [?LINE, ?MODULE, N, SubobjKey, Other], ?DEBUG_LEVEL), - {'EXCEPTION', #'CosNaming_NamingContext_CannotProceed'{rest_of_name=[N], - cxt=OE_THIS}} - end - end, - case mnesia:transaction(_BCF) of - {atomic, {'EXCEPTION', E}} -> - corba:raise(E); - {atomic, ok} -> - {reply, ok, OE_State}; - Other -> - orber:dbg("[~p] ~p:bind_context(~p, ~p);~n" - "DB transaction returned ~p", - [?LINE, ?MODULE, N, SubobjKey, Other], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; -bind_context(OE_THIS, OE_State, [H|T], Obj) -> - SubobjKey = corba:get_subobject_key(OE_THIS), - _RF = ?read_function({orber_CosNaming, SubobjKey}), - case orber_cosnaming_utils:query_result(mnesia:transaction(_RF)) of - error -> - corba:raise(#'CosNaming_NamingContext_CannotProceed'{rest_of_name=[H|T], - cxt=OE_THIS}); - X -> - case lists:keysearch(H, 1, X) of - {value, {H, ncontext, NC}} when is_record(NC, 'IOP_IOR') -> - {reply, 'CosNaming_NamingContext':bind_context(NC, T, Obj), - OE_State}; - {value, {H, ncontext, NC}} -> - bind_context(NC, OE_State, T, Obj); - _ -> - corba:raise(#'CosNaming_NamingContext_CannotProceed' - {rest_of_name=[H|T], cxt=OE_THIS}) - end - end; -bind_context(_OE_THIS, _OE_State, [], _Obj) -> - orber:dbg("[~p] CosNaming_NamingContextExt:bind_context();~n" - "Invoked this operation with an empty list", - [?LINE], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_YES}). - -%%---------------------------------------------------------------------- -%% Function : rebind_context -%% Arguments : -%% Description: -%% Returns : -%%---------------------------------------------------------------------- -rebind_context(OE_THIS, OE_State, [N], Obj) -> - SubobjKey = corba:get_subobject_key(OE_THIS), - _RBCF = - fun() -> - case mnesia:wread({orber_CosNaming, SubobjKey}) of - [#orber_CosNaming{nameindex = X}] -> - KList = - case lists:keysearch(N, 1, X) of - {value, {N, _, _V}} -> - lists:keyreplace(N, 1, X, {N, ncontext, Obj}); - false -> - [{N, ncontext, Obj} | X] - end, - mnesia:write(#orber_CosNaming{name_context=SubobjKey, - nameindex= KList}); - Other -> - orber:dbg("[~p] ~p:rebind_context(~p, ~p);~n" - "DB access returned ~p", - [?LINE, ?MODULE, N, SubobjKey, Other], ?DEBUG_LEVEL), - {'EXCEPTION', #'CosNaming_NamingContext_CannotProceed'{rest_of_name=[N], - cxt=OE_THIS}} - end - end, - case mnesia:transaction(_RBCF) of - {atomic, {'EXCEPTION', E}} -> - corba:raise(E); - {atomic, ok} -> - {reply, ok, OE_State}; - Other -> - orber:dbg("[~p] ~p:rebind_context(~p, ~p);~n" - "DB transaction returned ~p", - [?LINE, ?MODULE, N, SubobjKey, Other], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; -rebind_context(OE_THIS, OE_State, [H|T], Obj) -> - SubobjKey = corba:get_subobject_key(OE_THIS), - _RF = ?read_function({orber_CosNaming, SubobjKey}), - case orber_cosnaming_utils:query_result(mnesia:transaction(_RF)) of - error -> - corba:raise(#'CosNaming_NamingContext_CannotProceed'{rest_of_name=[H|T], - cxt=OE_THIS}); - X -> - case lists:keysearch(H, 1, X) of - {value, {H,ncontext, NC}} when is_record(NC, 'IOP_IOR') -> - {reply, 'CosNaming_NamingContext':rebind_context(NC, T, Obj), - OE_State}; - {value, {H,ncontext, NC}} -> - rebind_context(NC, OE_State, T, Obj); - _ -> - corba:raise(#'CosNaming_NamingContext_CannotProceed' - {rest_of_name=[H|T], cxt=OE_THIS}) - end - end; -rebind_context(_OE_THIS, _OE_State, [], _Obj) -> - orber:dbg("[~p] CosNaming_NamingContextExt:rebind_context();~n" - "Invoked this operation with an empty list", - [?LINE], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_YES}). - -%%---------------------------------------------------------------------- -%% Function : resolve -%% Arguments : -%% Description: -%% Returns : -%%---------------------------------------------------------------------- -resolve(OE_THIS, OE_State, [N]) -> - SubobjKey = corba:get_subobject_key(OE_THIS), - _RF = ?read_function({orber_CosNaming, SubobjKey}), - case orber_cosnaming_utils:query_result(mnesia:transaction(_RF)) of - error -> - corba:raise(#'CosNaming_NamingContext_CannotProceed'{rest_of_name=[N], - cxt=OE_THIS}); - X -> - case lists:keysearch(N, 1, X) of - {value, {N, _, Value}} -> - {reply, Value, OE_State}; - false -> - corba:raise(#'CosNaming_NamingContext_NotFound' - {rest_of_name=[N], why='not_object'}) - end - end; -resolve(OE_THIS, OE_State, [H|T]) -> - SubobjKey = corba:get_subobject_key(OE_THIS), - _RF = ?read_function({orber_CosNaming, SubobjKey}), - case orber_cosnaming_utils:query_result(mnesia:transaction(_RF)) of - error -> - corba:raise(#'CosNaming_NamingContext_CannotProceed'{rest_of_name=[H|T], - cxt=OE_THIS}); - X -> - case lists:keysearch(H, 1, X) of - {value, {H, ncontext, NC}} when is_record(NC, 'IOP_IOR') -> - {reply, 'CosNaming_NamingContext':resolve(NC, T), OE_State}; - {value, {H, ncontext, NC}} -> - resolve(NC, OE_State, T); - _ -> - corba:raise(#'CosNaming_NamingContext_CannotProceed' - {rest_of_name=[H|T], cxt=OE_THIS}) - end - end; -resolve(_OE_THIS, _OE_State, []) -> - orber:dbg("[~p] CosNaming_NamingContextExt:resolve();~n" - "Invoked this operation with an empty list", - [?LINE], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_YES}). - -%%---------------------------------------------------------------------- -%% Function : unbind -%% Arguments : -%% Description: -%% Returns : -%%---------------------------------------------------------------------- -unbind(OE_THIS, OE_State, [N]) -> - SubobjKey = corba:get_subobject_key(OE_THIS), - _UBF = - fun() -> - case mnesia:wread({orber_CosNaming, SubobjKey}) of - [#orber_CosNaming{nameindex = X}] -> - KList = lists:keydelete(N, 1, X), - mnesia:write(#orber_CosNaming{name_context=SubobjKey, - nameindex= KList}); - Other -> - orber:dbg("[~p] ~p:unbind(~p, ~p);~n" - "DB transaction returned ~p", - [?LINE, ?MODULE, N, SubobjKey, Other], ?DEBUG_LEVEL), - {'EXCEPTION', #'CosNaming_NamingContext_CannotProceed'{rest_of_name=[N], - cxt=OE_THIS}} - end - end, - case mnesia:transaction(_UBF) of - {atomic, {'EXCEPTION', E}} -> - corba:raise(E); - {atomic, ok} -> - {reply, ok, OE_State}; - Other -> - orber:dbg("[~p] ~p:unbind(~p, ~p);~n" - "DB transaction returned ~p", - [?LINE, ?MODULE, N, SubobjKey, Other], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; -unbind(OE_THIS, OE_State, [H|T]) -> - SubobjKey = corba:get_subobject_key(OE_THIS), - _RF = ?read_function({orber_CosNaming, SubobjKey}), - case orber_cosnaming_utils:query_result(mnesia:transaction(_RF)) of - error -> - corba:raise(#'CosNaming_NamingContext_CannotProceed'{rest_of_name=[H|T], - cxt=OE_THIS}); - X -> - case lists:keysearch(H, 1, X) of - {value, {H, ncontext, NC}} when is_record(NC, 'IOP_IOR') -> - {reply, 'CosNaming_NamingContext':unbind(NC, T), OE_State}; - {value, {H, ncontext, NC}} -> - unbind(NC, OE_State, T); - _ -> - corba:raise(#'CosNaming_NamingContext_CannotProceed' - {rest_of_name=[H|T], cxt=OE_THIS}) - end - end; -unbind(_OE_THIS, _OE_State, []) -> - orber:dbg("[~p] CosNaming_NamingContextExt:unbind();~n" - "Invoked this operation with an empty list", - [?LINE], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_YES}). - - -%%---------------------------------------------------------------------- -%% Function : new_context -%% Arguments : -%% Description: -%% Returns : -%%---------------------------------------------------------------------- -new_context(_OE_THIS, OE_State) -> - DBKey = term_to_binary({{erlang:system_time(), - erlang:unique_integer()}, - node()}), - %% Create a record in the table and set the key to a newly - {reply, - 'CosNaming_NamingContextExt':oe_create(DBKey, - [{pseudo, true}|?CREATE_OPTS]), - OE_State}. - -%%---------------------------------------------------------------------- -%% Function : bind_new_context -%% Arguments : -%% Description: -%% Returns : -%%---------------------------------------------------------------------- -bind_new_context(OE_THIS, OE_State, N) -> - DBKey = term_to_binary({{erlang:system_time(), - erlang:unique_integer()}, - node()}), - %% Create a record in the table and set the key to a newly - %% generated objectkey. - %%?PRINTDEBUG("bind_new_context"), - NewCtx = 'CosNaming_NamingContextExt':oe_create(DBKey, - [{pseudo, true}|?CREATE_OPTS]), - %% Bind the created name context to a name - case catch bind_context(OE_THIS, OE_State, N, NewCtx) of - {'EXCEPTION', E} -> - 'CosNaming_NamingContextExt':destroy(NewCtx), - corba:raise(E); - {reply, ok, _} -> - {reply, NewCtx, OE_State} - end. - - -%%---------------------------------------------------------------------- -%% Function : list -%% Arguments : -%% Description: -%% Returns : -%%---------------------------------------------------------------------- -list(OE_THIS, OE_State, HowMany) -> - SubobjKey = corba:get_subobject_key(OE_THIS), - _RF = ?read_function({orber_CosNaming, SubobjKey}), - case orber_cosnaming_utils:query_result(mnesia:transaction(_RF)) of - error -> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}); - X -> - case convert_list(X, HowMany, 0, []) of - {false, List} -> - {reply, {ok, List, ?ORBER_NIL_OBJREF}, OE_State}; - {true, List, Rest} -> - %% By setting HowMany to '-1' it will never match - %% the Counter. Hence, the whole list will be transformed. - {false, List2} = convert_list(Rest, -1, 0, []), - BIterator = 'CosNaming_BindingIterator': - oe_create(List2, ?CREATE_OPTS), - {reply, {ok, List, BIterator}, OE_State} - end - end. - -convert_list([], _, _, Acc) -> - {false, Acc}; -convert_list(Rest, Counter, Counter, Acc) -> - {true, Acc, Rest}; -convert_list([{N, T, _O}|Rest], HowMany, Counter, Acc) -> - convert_list(Rest, HowMany, Counter+1, - [#'CosNaming_Binding'{binding_name=[N], - binding_type=T}|Acc]). - -%%---------------------------------------------------------------------- -%% Function : destroy -%% Arguments : -%% Description: -%% Returns : -%%---------------------------------------------------------------------- -destroy(OE_THIS, OE_State) -> - SubobjKey = corba:get_subobject_key(OE_THIS), - try begin - true = (byte_size(SubobjKey) < 20), - undefined = binary_to_term(SubobjKey) - end - of - _ -> - corba:raise(#'NO_PERMISSION'{completion_status=?COMPLETED_NO}) - catch - error:_ -> %% Not atom 'undefined', carry on... - _DF = - fun() -> - case mnesia:wread({orber_CosNaming, SubobjKey}) of - [#orber_CosNaming{nameindex = []}] -> - mnesia:delete({orber_CosNaming, SubobjKey}); - Other when is_list(Other) -> - orber:dbg("[~p] ~p:destroy(~p);~n" - "DB access returned ~p", - [?LINE, ?MODULE, SubobjKey, Other], ?DEBUG_LEVEL), - {'EXCEPTION', #'CosNaming_NamingContext_NotEmpty'{}} - end - end, - case mnesia:transaction(_DF) of - {atomic, {'EXCEPTION', E}} -> - corba:raise(E); - {atomic, ok} -> - {reply, ok, OE_State}; - Other -> - orber:dbg("[~p] ~p:destroy(~p);~n" - "DB transaction returned ~p", - [?LINE, ?MODULE, SubobjKey, Other], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end - end. - -%%---------------------------------------------------------------------- -%% Interface CosNaming::NamingContextExt -%%---------------------------------------------------------------------- -%%---------------------------------------------------------------------- -%% Function : to_string -%% Arguments : Name -%% Description: -%% Returns : StringName | -%% {'EXCEPTION', NamingContext::InvalidName{}} -%%---------------------------------------------------------------------- -to_string(_OE_This, OE_State, Name) -> - {reply, orber_cosnaming_utils:name2string(Name), OE_State}. - - -%%---------------------------------------------------------------------- -%% Function : to_name -%% Arguments : StringName -%% Description: -%% Returns : Name | -%% {'EXCEPTION', NamingContext::InvalidName{}} -%%---------------------------------------------------------------------- -to_name(_OE_This, OE_State, StringName) -> - {reply, orber_cosnaming_utils:string2name(StringName), OE_State}. - - -%%---------------------------------------------------------------------- -%% Function : to_url -%% Arguments : Address -%% StringName -%% Description: -%% Returns : URLString | -%% {'EXCEPTION', NamingContext::InvalidName{}} -%% {'EXCEPTION', NamingContextExt::InvalidAddress{}} -%%---------------------------------------------------------------------- -to_url(_, _, "", _) -> - %% Empty address not allowed. - corba:raise(#'CosNaming_NamingContextExt_InvalidAddress'{}); -to_url(_OE_This, OE_State, Address, "") -> - %% Empty stringname => use corbaloc - orber_cosnaming_utils:check_addresses(Address), - {reply, "corbaloc:"++orber_cosnaming_utils:escape_string(Address), OE_State}; -to_url(_OE_This, OE_State, Address, StringName) -> - %% Non-empty stringname => use corbaname - orber_cosnaming_utils:check_addresses(Address), - orber_cosnaming_utils:check_name(StringName), - {reply, - "corbaname:"++orber_cosnaming_utils:escape_string(Address)++"#"++ - orber_cosnaming_utils:escape_string(StringName), - OE_State}. - -%%---------------------------------------------------------------------- -%% Function : resolve_str -%% Arguments : StringName -%% Description: -%% Returns : Object | -%% {'EXCEPTION', NamingContext::InvalidName{}} -%% {'EXCEPTION', NamingContext::NotFound{why, rest_of_name}} -%% {'EXCEPTION', NamingContext::CannotProceed{cxt, rest_of_name}} -%%---------------------------------------------------------------------- -resolve_str(OE_This, OE_State, StringName) -> - Name = orber_cosnaming_utils:string2name(StringName), - resolve(OE_This, OE_State, Name). - -%%====================================================================== -%% Internal functions -%%====================================================================== -%% Check a write transaction -write_result({atomic,ok}) -> ok; -write_result(_What) -> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). - - -%%---------------------------------------------------------------------- -%% Debugging functions -%%---------------------------------------------------------------------- -dump() -> - case catch mnesia:dirty_first('orber_CosNaming') of - {'EXIT', R} -> - io:format("Exited with ~p\n",[R]); - Key -> - dump_print(Key), - dump_loop(Key) - end. - -dump_loop(PreviousKey) -> - case catch mnesia:dirty_next('orber_CosNaming', PreviousKey) of - {'EXIT', R} -> - io:format("Exited with ~p\n",[R]); - '$end_of_table' -> - ok; - Key -> - dump_print(Key), - dump_loop(Key) - end. - -dump_print(Key) -> - case catch mnesia:dirty_read({'orber_CosNaming', Key}) of - {'EXIT', R} -> - io:format("Exited with ~p\n",[R]); - [X] -> - io:format("name_context: ~p\n-----------------------------\n" - " nameindex structure\n-----------------------------\n~p\n\n", - [binary_to_term(X#orber_CosNaming.name_context), - X#orber_CosNaming.nameindex]); - _ -> - ok - end. - -%%-------------------------- END OF MODULE ----------------------------- diff --git a/lib/orber/COSS/CosNaming/Makefile b/lib/orber/COSS/CosNaming/Makefile deleted file mode 100644 index 108663396c..0000000000 --- a/lib/orber/COSS/CosNaming/Makefile +++ /dev/null @@ -1,153 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1997-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -EBIN=../../ebin - -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../../vsn.mk -VSN=$(ORBER_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/orber-$(VSN) -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- - -MODULES = \ - CosNaming_NamingContextExt_impl \ - CosNaming_BindingIterator_impl \ - lname \ - lname_component \ - orber_cosnaming_utils - -ERL_FILES = $(MODULES:%=%.erl) -HRL_FILES = lname.hrl \ - orber_cosnaming.hrl -GEN_ERL_FILES = \ - oe_cos_naming.erl \ - CosNaming_Name.erl \ - CosNaming_NamingContext.erl \ - CosNaming_BindingIterator.erl \ - CosNaming_NameComponent.erl \ - CosNaming_Binding.erl \ - CosNaming_BindingList.erl \ - CosNaming_NamingContext_NotFound.erl \ - CosNaming_NamingContext_AlreadyBound.erl \ - CosNaming_NamingContext_CannotProceed.erl \ - CosNaming_NamingContext_InvalidName.erl \ - CosNaming_NamingContext_NotEmpty.erl - -GEN_EXT_ERL_FILES = \ - oe_cos_naming_ext.erl \ - CosNaming_NamingContextExt.erl \ - CosNaming_NamingContextExt_InvalidAddress.erl - -GEN_HRL_FILES = \ - oe_cos_naming.hrl \ - CosNaming.hrl \ - CosNaming_NamingContext.hrl \ - CosNaming_BindingIterator.hrl - -GEN_EXT_HRL_FILES = \ - oe_cos_naming_ext.hrl \ - CosNaming_NamingContextExt.hrl - -GEN_FILES = $(GEN_ERL_FILES) $(GEN_HRL_FILES) \ - $(GEN_EXT_ERL_FILES) $(GEN_EXT_HRL_FILES) - -TARGET_FILES = \ - $(GEN_EXT_ERL_FILES:%.erl=$(EBIN)/%.$(EMULATOR)) \ - $(GEN_ERL_FILES:%.erl=$(EBIN)/%.$(EMULATOR)) \ - $(MODULES:%=$(EBIN)/%.$(EMULATOR)) - -IDL_FILE = cos_naming.idl \ - cos_naming_ext.idl - -APP_FILE = -#APP_SRC = $(APP_FILE).src -#APP_TARGET = $(EBIN)/$(APP_FILE) - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/orber/ebin -# The -pa option is just used temporary until erlc can handle -# includes from other directories than ../include . -ERL_COMPILE_FLAGS += \ - $(ERL_IDL_FLAGS) \ - -I$(ERL_TOP)/lib/orber/include \ - +'{parse_transform,sys_pre_attributes}' \ - +'{attribute,insert,app_vsn,"orber_$(ORBER_VSN)"}' - -YRL_FLAGS = - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -opt: $(TARGET_FILES) $(APP_TARGET) - -debug: - @${MAKE} TYPE=debug - -clean: - rm -f $(TARGET_FILES) $(GEN_FILES) $(APP_TARGET) IDL-GENERATED - rm -f errs core *~ - -$(APP_TARGET): $(APP_SRC) - $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $(APP_SRC) > $(APP_TARGET) - -docs: - -# ---------------------------------------------------- -# Special Build Targets -# ---------------------------------------------------- -IDL-GENERATED: cos_naming_ext.idl cos_naming.idl - $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{this,"CosNaming::NamingContext"}' \ - +'{this,"CosNaming::NamingContextExt"}' cos_naming_ext.idl - $(V_at)erlc $(ERL_IDL_FLAGS) +'{this,"CosNaming::NamingContext"}' cos_naming.idl - $(V_at)>IDL-GENERATED - -$(GEN_FILES): IDL-GENERATED - -$(TARGET_FILES): IDL-GENERATED - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - - -release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)/ebin" - $(INSTALL_DATA) $(TARGET_FILES) $(APP_TARGET) "$(RELSYSDIR)/ebin" - $(INSTALL_DIR) "$(RELSYSDIR)/COSS/CosNaming" - $(INSTALL_DATA) $(ERL_FILES) $(HRL_FILES) $(IDL_FILE) "$(RELSYSDIR)/COSS/CosNaming" - $(INSTALL_DATA) $(GEN_FILES) "$(RELSYSDIR)/COSS/CosNaming" - - -release_docs_spec: - diff --git a/lib/orber/COSS/CosNaming/cos_naming.idl b/lib/orber/COSS/CosNaming/cos_naming.idl deleted file mode 100644 index 3cd6c99c23..0000000000 --- a/lib/orber/COSS/CosNaming/cos_naming.idl +++ /dev/null @@ -1,77 +0,0 @@ -// Naming Service v1.0 described in CORBAservices: -// Common Object Services Specification, chapter 3 -// OMG IDL for CosNaming Module, p 3-6 - -#pragma prefix "omg.org" - -module CosNaming -{ - typedef string Istring; - struct NameComponent { - Istring id; - Istring kind; - }; - - typedef sequence Name; - - enum BindingType {nobject, ncontext}; - - struct Binding { - Name binding_name; - BindingType binding_type; - }; - - typedef sequence BindingList; - - - interface BindingIterator; - interface NamingContext; - - interface NamingContext { - - enum NotFoundReason { missing_node, not_context, not_object}; - - exception NotFound { - NotFoundReason why; - Name rest_of_name; - }; - - exception CannotProceed { - NamingContext cxt; - Name rest_of_name; - }; - - exception InvalidName{}; - exception AlreadyBound {}; - exception NotEmpty{}; - - void bind(in Name n, in Object obj) - raises(NotFound, CannotProceed, InvalidName, AlreadyBound); - void rebind(in Name n, in Object obj) - raises(NotFound, CannotProceed, InvalidName); - void bind_context(in Name n, in NamingContext nc) - raises(NotFound, CannotProceed,InvalidName, AlreadyBound); - void rebind_context(in Name n, in NamingContext nc) - raises(NotFound, CannotProceed, InvalidName); - Object resolve (in Name n) - raises(NotFound, CannotProceed, InvalidName); - void unbind(in Name n) - raises(NotFound, CannotProceed, InvalidName); - NamingContext new_context(); - NamingContext bind_new_context(in Name n) - raises(NotFound, AlreadyBound, CannotProceed, InvalidName); - void destroy( ) - raises(NotEmpty); - void list (in unsigned long how_many, - out BindingList bl, - out BindingIterator bi); - }; - - interface BindingIterator { - boolean next_one(out Binding b); - boolean next_n(in unsigned long how_many, - out BindingList bl); - void destroy(); - }; -}; - diff --git a/lib/orber/COSS/CosNaming/cos_naming_ext.idl b/lib/orber/COSS/CosNaming/cos_naming_ext.idl deleted file mode 100644 index 8099a0005c..0000000000 --- a/lib/orber/COSS/CosNaming/cos_naming_ext.idl +++ /dev/null @@ -1,37 +0,0 @@ -// Naming Service v1.0 described in CORBAservices: -// Common Object Services Specification, chapter 3 -// OMG IDL for CosNaming Module, p 3-6 - -#ifndef _COSNAMINGEXT_IDL_ -#define _COSNAMINGEXT_IDL_ - - -#include - -#pragma prefix "omg.org" - -module CosNaming -{ - interface NamingContextExt:NamingContext { - - typedef string StringName; - typedef string Address; - typedef string URLString; - - StringName to_string(in Name n) - raises(InvalidName); - - Name to_name(in StringName sn) - raises(InvalidName); - - exception InvalidAddress{}; - - URLString to_url(in Address addr,in StringName sn) - raises(InvalidAddress, InvalidName); - - Object resolve_str(in StringName n) - raises(NotFound, CannotProceed, InvalidName); - }; -}; - -#endif//_COSNAMINGEXT_IDL_ diff --git a/lib/orber/COSS/CosNaming/lname.erl b/lib/orber/COSS/CosNaming/lname.erl deleted file mode 100644 index 41f9f68d20..0000000000 --- a/lib/orber/COSS/CosNaming/lname.erl +++ /dev/null @@ -1,134 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: lname.erl -%%----------------------------------------------------------------- --module(lname). - --include_lib("orber/include/corba.hrl"). --include("CosNaming.hrl"). --include("lname.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([create/0, insert_component/3, get_component/2, delete_component/2, - num_component/1, equal/2, less_than/2, - to_idl_form/1, from_idl_form/1, check_name/1, new/1]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%% DEBUG INFO --define(DEBUG_LEVEL, 5). - -%%----------------------------------------------------------------- -%% External interface functions -%%----------------------------------------------------------------- -create() -> - []. - -insert_component(_, I, _) when I < 1-> - corba:raise(#'LName_NoComponent'{}); -insert_component([], I, _) when I > 1-> - corba:raise(#'LName_NoComponent'{}); -insert_component(Name, 1, Component) when is_record(Component, - 'CosNaming_NameComponent') -> - [Component |Name]; -insert_component([H|T], I, Component) when is_record(Component, - 'CosNaming_NameComponent') -> - [H |insert_component(T, I-1, Component)]; -insert_component(_, _, Component) -> - orber:dbg("[~p] ~p:insert_component(~p); Not a NameComponent.~n", - [?LINE, ?MODULE, Component], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -get_component(_, I) when I < 1-> - corba:raise(#'LName_NoComponent'{}); -get_component([], _) -> - corba:raise(#'LName_NoComponent'{}); -get_component([H|_T], 1) -> - H; -get_component([_|T], I) -> - get_component(T, I-1). - -delete_component(_, I) when I < 1-> - corba:raise(#'LName_NoComponent'{}); -delete_component([], _) -> - corba:raise(#'LName_NoComponent'{}); -delete_component([_|T], 1) -> - T; -delete_component([H|T], I) -> - [H | delete_component(T, I-1)]. - -num_component(Name) -> - num_component(Name, 0). - -equal(Name, N) -> - N == Name. - -less_than(Name, N) -> - Name < N. - -to_idl_form(Name) -> - case check_name(Name) of - false -> - corba:raise(#'LName_InvalidName'{}); - true -> - Name - end. - -from_idl_form(Name) -> - Name. - -%%destroy() -> % not needed in erlang -%% ok. - -%%----------------------------------------------------------------- -%% External Functions not in the CosNaming standard -%%----------------------------------------------------------------- -new([]) -> - []; -new([{Id, Kind} | List]) -> - [lname_component:new(Id, Kind) | new(List)]; -new([Id |List]) when is_list(Id) -> - [lname_component:new(Id) | new(List)]. - -%%----------------------------------------------------------------- -%% Internal Functions -%%----------------------------------------------------------------- -num_component([], N) -> - N; -num_component([_|T], N) -> - num_component(T, N+1). - -check_name([]) -> - true; -check_name([H|T]) -> - case catch lname_component:get_id(H) of - {'EXCEPTION', _E} -> - false; - _ -> - check_name(T) - end. diff --git a/lib/orber/COSS/CosNaming/lname.hrl b/lib/orber/COSS/CosNaming/lname.hrl deleted file mode 100644 index 0c0eef86ab..0000000000 --- a/lib/orber/COSS/CosNaming/lname.hrl +++ /dev/null @@ -1,34 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: lname.hrl -%%----------------------------------------------------------------- - -%% LName interface exceptions --record('LName_NoComponent', {'OE_ID'="PIDL:LName/NoComponent:1.0"}). --record('LName_InvalidName', {'OE_ID'="PIDL:LName/InvalidName:1.0"}). -% This exception is not used in our implementation. --record('LName_Overflow', {'OE_ID'="PIDL:LName/Overflow:1.0"}). - -%% LNameComponent interface exceptions --record('LNameComponent_NotSet', - {'OE_ID'="PIDL:LNameComponent/NotSet:1.0"}). diff --git a/lib/orber/COSS/CosNaming/lname_component.erl b/lib/orber/COSS/CosNaming/lname_component.erl deleted file mode 100644 index 4dead49a78..0000000000 --- a/lib/orber/COSS/CosNaming/lname_component.erl +++ /dev/null @@ -1,84 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: lname_component.erl -%%----------------------------------------------------------------- --module(lname_component). - --include_lib("orber/include/corba.hrl"). --include("lname.hrl"). --include("CosNaming.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([get_id/1, set_id/2, get_kind/1, set_kind/2, create/0, new/1, new/2]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% External interface functions -%%----------------------------------------------------------------- -create() -> - #'CosNaming_NameComponent'{id="", kind=""}. - -get_id(NC) when is_record(NC, 'CosNaming_NameComponent'), - NC#'CosNaming_NameComponent'.id == undefined -> - corba:raise(#'LNameComponent_NotSet'{}); -get_id(NC) when is_record(NC, 'CosNaming_NameComponent'), - NC#'CosNaming_NameComponent'.id == "" -> - corba:raise(#'LNameComponent_NotSet'{}); -get_id(NC) when is_record(NC, 'CosNaming_NameComponent') -> - NC#'CosNaming_NameComponent'.id. - -set_id(NC, Id) when is_record(NC, 'CosNaming_NameComponent') andalso is_list(Id)-> - NC#'CosNaming_NameComponent'{id=Id}. - -get_kind(NC) when is_record(NC, 'CosNaming_NameComponent') andalso - NC#'CosNaming_NameComponent'.kind == undefined -> - corba:raise(#'LNameComponent_NotSet'{}); -get_kind(NC) when is_record(NC, 'CosNaming_NameComponent') andalso - NC#'CosNaming_NameComponent'.kind == "" -> - corba:raise(#'LNameComponent_NotSet'{}); -get_kind(NC) when is_record(NC, 'CosNaming_NameComponent') -> - NC#'CosNaming_NameComponent'.kind. - -set_kind(NC, Kind) when is_record(NC, 'CosNaming_NameComponent') andalso is_list(Kind) -> - NC#'CosNaming_NameComponent'{kind=Kind}. - -%%destroy() -> % not needed in erlang -%% true. - -%%----------------------------------------------------------------- -%% External Functions not in the CosNaming standard -%%----------------------------------------------------------------- -new(Id) when is_list(Id) -> - #'CosNaming_NameComponent'{id=Id, kind=""}. -new(Id, Kind) when is_list(Id) andalso is_list(Kind) -> - #'CosNaming_NameComponent'{id=Id, kind=Kind}. - -%%----------------------------------------------------------------- -%% Internal Functions -%%----------------------------------------------------------------- diff --git a/lib/orber/COSS/CosNaming/orber_cosnaming.hrl b/lib/orber/COSS/CosNaming/orber_cosnaming.hrl deleted file mode 100644 index 2950f7a11f..0000000000 --- a/lib/orber/COSS/CosNaming/orber_cosnaming.hrl +++ /dev/null @@ -1,64 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%-------------------------------------------------------------------- - --ifndef(ORBER_COSNAMING_HRL). --define(ORBER_COSNAMING_HRL, true). - -%%----------------------------------------------------------------- -%% Mnesia Table definition record -%%----------------------------------------------------------------- --record('orber_CosNaming', {name_context, nameindex}). - -%%----------------------------------------------------------------- -%% Macros -%%----------------------------------------------------------------- - --define(CREATE_OPTS, [{no_security, orber:partial_security()}]). - -%%-define(dirty_query_context, true). - -%% This macro returns a read fun suitable for evaluation in a transaction --define(read_function(Objkey), - fun() -> - mnesia:read(Objkey) - end). - -%% This macro returns a write fun suitable for evaluation in a transaction --define(write_function(R), - fun() -> - mnesia:write(R) - end). - -%% This macro returns a delete fun suitable for evaluation in a transaction --define(delete_function(R), - fun() -> - mnesia:delete(R) - end). - --ifdef(dirty_query_context). --define(query_check(Q_res), Q_res). --else. --define(query_check(Q_res), {atomic, Q_res}). --endif. - --endif. diff --git a/lib/orber/COSS/CosNaming/orber_cosnaming_utils.erl b/lib/orber/COSS/CosNaming/orber_cosnaming_utils.erl deleted file mode 100644 index c21e46036b..0000000000 --- a/lib/orber/COSS/CosNaming/orber_cosnaming_utils.erl +++ /dev/null @@ -1,762 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: orber_cosnaming_utils.erl -%% Modified: -%% -%%----------------------------------------------------------------- --module(orber_cosnaming_utils). - --include("orber_cosnaming.hrl"). --include("CosNaming.hrl"). --include("CosNaming_NamingContext.hrl"). --include("CosNaming_NamingContextExt.hrl"). --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([query_result/1]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([addresses/1, name/1, - check_addresses/1, check_name/1, - key/1, select_type/1, lookup/1, lookup/2, - escape_string/1, unescape_string/1, - name2string/1, string2name/1]). - -%%----------------------------------------------------------------- -%% Records -%%----------------------------------------------------------------- - -%%----------------------------------------------------------------- -%% Defines -%%----------------------------------------------------------------- -%% DEFAULT VALUES: -%% -%% IIOP: -%% - port: 2809 -%% - iiop version: 1.0 --define(DEF_VERS, {1,0}). --define(DEF_PORT, 2809). --define(DEF_KEY, "NameService"). --define(HTTP_DEF_PORT, 80). - -%% DEBUG INFO --define(DEBUG_LEVEL, 5). - -%%----------------------------------------------------------------- -%% External interface functions -%%----------------------------------------------------------------- -%% Check a read transaction -query_result({atomic, Qres}) -> - case Qres of - [Hres] -> - Hres#orber_CosNaming.nameindex; - [Hres|Tres] -> - orber:dbg("[~p] orber_cosnaming_utils:query_result(~p);~n" - "Multiple Hits: ~p", [?LINE, Qres, [Hres|Tres]], ?DEBUG_LEVEL), - error; - [] -> - orber:dbg("[~p] orber_cosnaming_utils:query_result();~n" - "No hit", [?LINE], ?DEBUG_LEVEL), - error; - Other -> - orber:dbg("[~p] orber_cosnaming_utils:query_result(~p);~n" - "Mnesia Access Failed ~p", [?LINE, Qres, Other], ?DEBUG_LEVEL), - error - end; -query_result({aborted, Qres}) -> - orber:dbg("[~p] orber_cosnaming_utils:query_result(~p);~n" - "Mnesia Access Aborted", [?LINE, Qres], ?DEBUG_LEVEL), - error; -query_result(What) -> - orber:dbg("[~p] orber_cosnaming_utils:query_result(~p);~n" - "Mnesia Access Failed", [?LINE, What], ?DEBUG_LEVEL), - error. - - -%%---------------------------------------------------------------------- -%% Function : check_addresses -%% Arguments : -%% Description: -%% Returns : -%%---------------------------------------------------------------------- -check_addresses(Str) -> - {_, Rest2} = addresses(Str), - case key(Rest2) of - {_, []} -> - ok; - What -> - orber:dbg("[~p] orber_cosnaming_utils:check_addresses(~p);~n" - "Key ~p", [?LINE, Str, What], ?DEBUG_LEVEL), - corba:raise(#'CosNaming_NamingContextExt_InvalidAddress'{}) - end. - -%%---------------------------------------------------------------------- -%% Function : check_name -%% Arguments : -%% Description: -%% Returns : -%%---------------------------------------------------------------------- -check_name(Str) -> - name(Str). - -%%---------------------------------------------------------------------- -%% Function : select_type -%% Arguments : A corbaloc/corbaname-string. -%% Description: -%% Returns : A tuple which contain data about what connection we want to use | -%% {'EXCEPTION', #'CosNaming_NamingContextExt_InvalidAddress'{}} -%%---------------------------------------------------------------------- -select_type([$c, $o, $r, $b, $a, $l, $o, $c, $:|Rest1]) -> - {Addresses, Rest2} = addresses(Rest1), - case key(Rest2) of - {Key, []} -> - {corbaloc, Addresses, Key}; - What -> - orber:dbg("[~p] orber_cosnaming_utils:select_type(~p);~n" - "Key ~p", [?LINE, Rest1, What], ?DEBUG_LEVEL), - corba:raise(#'CosNaming_NamingContextExt_InvalidAddress'{}) - end; -select_type([$c, $o, $r, $b, $a, $n, $a, $m, $e, $:|Rest1]) -> - {Addresses, Rest2} = addresses(Rest1), - {Key, Rest3} = key(Rest2), - Name = name(Rest3), - {corbaname, Addresses, Key, string2name(Name)}; - -select_type([$f, $i, $l, $e, $:, $/ |Rest]) -> - file(Rest); -select_type([$f, $t, $p, $:, $/, $/ |Rest]) -> - ftp(Rest); -select_type([$h, $t, $t, $p, $:, $/, $/ |Rest]) -> - http(Rest); - -select_type(What) -> - orber:dbg("[~p] orber_cosnaming_utils:select_type(~p);~n" - "Malformed or unsupported type.", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'CosNaming_NamingContextExt_InvalidAddress'{}). - - -%%---------------------------------------------------------------------- -%% Function : addresses -%% Arguments : A corbaloc string. -%% Description: -%% Returns : A list of addresses an the remaining part possibly containg -%% a Key and a stringified Name -%%---------------------------------------------------------------------- -addresses(Str) -> - addresses(address(protocol, Str, [], []), []). - -addresses({false, rir, Rest}, []) -> - {rir, Rest}; -addresses({false, Adr, Rest}, Addresses) -> - {lists:reverse([Adr|Addresses]), Rest}; -addresses({true, Adr, Rest}, Addresses) -> - addresses(address(protocol, Rest, [], []), [Adr|Addresses]). -%% Which protocol. -address(protocol, [$:|T], [], []) -> - address(version, T, [], [iiop]); -address(protocol, [$i, $i, $o, $p, $:|T], [], []) -> - address(version, T, [], [iiop]); -address(protocol, [$s,$s,$l, $i, $o, $p, $:|T], [], []) -> - address(version, T, [], [ssliop]); -address(protocol, [$r, $i, $r, $:|T], [], []) -> - {false, rir, T}; -address(protocol, What, _, _) -> - orber:dbg("[~p] orber_cosnaming_utils:address(~p);~n" - "Malformed or unsupported protocol.", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'CosNaming_NamingContextExt_InvalidAddress'{}); - - -%% Parsed one address, no version found or port found. -address(version, [$,|T], Acc, Previous) -> - {true, lists:reverse([?DEF_PORT, lists:reverse(Acc), ?DEF_VERS|Previous]), T}; -address(version, [$/|T], Acc, Previous) -> - {false, lists:reverse([?DEF_PORT, lists:reverse(Acc), ?DEF_VERS|Previous]), T}; -%% Found iiop version. -address(version, [$@|T], Acc, Previous) -> - case Acc of - [Minor, $., Major] -> - address(address, T, [], [{Major-$0, Minor-$0}|Previous]); - What -> - orber:dbg("[~p] orber_cosnaming_utils:address(~p);~n" - "Malformed or unsupported version.", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'CosNaming_NamingContextExt_InvalidAddress'{}) - end; - -%% Found no iiop version, switch to ipv6. -address(version, [$[|T], [], Previous) -> - address(ipv6, T, [], [?DEF_VERS|Previous]); - -%% Found no iiop version, switch to port. In this case Acc contains the -%% Host. -address(version, [$:|T], Acc, Previous) -> - address(port, T, [], [lists:reverse(Acc), ?DEF_VERS|Previous]); - -%% Found IPv6 -address(address, [$[|T], [], Previous) -> - address(ipv6, T, [], Previous); - -%% Found port -address(address, [$:|T], Acc, Previous) -> - address(port, T, [], [lists:reverse(Acc)|Previous]); - -address(ipv6, [$]|T], Acc, Previous) -> - address(address, T, Acc, Previous); - -%% Parsed one address, port not found. -address(address, [$,|T], [], Previous) -> - {true, lists:reverse([?DEF_PORT|Previous]), T}; -address(address, [$/|T], [], Previous) -> - {false, lists:reverse([?DEF_PORT|Previous]), T}; -address(address, [$,|T], Acc, Previous) -> - {true, lists:reverse([?DEF_PORT, lists:reverse(Acc)|Previous]), T}; -address(address, [$/|T], Acc, Previous) -> - {false, lists:reverse([?DEF_PORT, lists:reverse(Acc)|Previous]), T}; - -%% Parsed one address. -address(port, [$/|T], Acc, Previous) -> - case catch list_to_integer(lists:reverse(Acc)) of - Port when is_integer(Port) -> - {false, lists:reverse([Port|Previous]), T}; - What -> - orber:dbg("[~p] orber_cosnaming_utils:address(~p);~n" - "Malformed port.", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'CosNaming_NamingContextExt_InvalidAddress'{}) - end; -address(port, [$,|T], Acc, Previous) -> - case catch list_to_integer(lists:reverse(Acc)) of - Port when is_integer(Port) -> - {true, lists:reverse([Port|Previous]), T}; - What -> - orber:dbg("[~p] orber_cosnaming_utils:address(~p);~n" - "Malformed port.", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'CosNaming_NamingContextExt_InvalidAddress'{}) - end; - -%% EOS, check how far we have reached so far and add necessary default values. -address(version, [], Acc, Previous) -> - {false, lists:reverse([?DEF_PORT, lists:reverse(Acc), ?DEF_VERS|Previous]), []}; -address(port, [], [], Previous) -> - {false, lists:reverse([?DEF_PORT|Previous]), []}; -address(port, [], Acc, Previous) -> - case catch list_to_integer(lists:reverse(Acc)) of - Port when is_integer(Port) -> - {false, lists:reverse([Port|Previous]), []}; - What -> - orber:dbg("[~p] orber_cosnaming_utils:address(~p);~n" - "Malformed port.", [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'CosNaming_NamingContextExt_InvalidAddress'{}) - end; -address(address, [], [], Previous) -> - {false, lists:reverse([?DEF_PORT|Previous]), []}; -address(address, [], Acc, Previous) -> - {false, lists:reverse([?DEF_PORT, lists:reverse(Acc)|Previous]), []}; - -address(Type, [H|T], Acc, Previous) -> - address(Type, T, [H|Acc], Previous). - -%%---------------------------------------------------------------------- -%% Function : key -%% Arguments : A string which contain a Key we want to use and, if defined, -%% stringified NameComponent sequence. -%% Description: -%% Returns : The Key and the remaining part, i.e., a stringified -%% NameComponent sequence. -%%---------------------------------------------------------------------- -key(Str) -> - key(Str, []). -key([], []) -> - {?DEF_KEY, []}; -key([], Acc) -> - {lists:reverse(Acc), []}; -key([$#|T], []) -> - {?DEF_KEY, T}; -key([$#|T], Acc) -> - {lists:reverse(Acc), T}; -key([$/|T], []) -> - key(T, []); -key([H|T], Acc) -> - key(T, [H|Acc]). - -%%---------------------------------------------------------------------- -%% Function : name -%% Arguments : A string describing a NameComponent sequence. -%% Description: -%% Returns : The input string | -%% {'EXCEPTION', #'CosNaming_NamingContext_InvalidName'{}} -%%---------------------------------------------------------------------- -name(Str) -> - name(Str, []). -name([], Acc) -> - lists:reverse(Acc); -name([$., $/|_T], _) -> - corba:raise(#'CosNaming_NamingContext_InvalidName'{}); -name([$/, $/|_T], _) -> - corba:raise(#'CosNaming_NamingContext_InvalidName'{}); -name([$/|T], []) -> - name(T, []); -name([H|T], Acc) -> - name(T, [H|Acc]). - - -%%---------------------------------------------------------------------- -%% Function : file -%% Arguments : A string describing connection parameters. -%% Description: -%% Returns : A tuple consisting of data extracted from the given string. -%%---------------------------------------------------------------------- -file(File) -> - {file, File}. - -%%---------------------------------------------------------------------- -%% Function : ftp -%% Arguments : A string describing connection parameters. -%% Description: -%% Returns : A tuple consisting of data extracted from the given string. -%%---------------------------------------------------------------------- -ftp(Address) -> - %% Perhaps we should run some checks here? - {ftp, Address}. - -%%---------------------------------------------------------------------- -%% Function : http -%% Arguments : A string describing connection parameters. -%% Description: -%% Returns : A tuple consisting of data extracted from the given string. -%%---------------------------------------------------------------------- -http(Address) -> - case string:tokens(Address, ":") of - [Host, Rest] -> - %% At his stage we know that address contains a Port number. - {Port, Key} = split_to_slash(Rest, []), - case catch list_to_integer(Port) of - PortInt when is_integer(PortInt) -> - {http, Host, PortInt, Key}; - _ -> - orber:dbg("[~p] orber_cosnaming_utils:http(~p);~n" - "Malformed key; should be http://Host:Port/path/name.html~n" - "or http://Host/path/name.html", - [?LINE, Address], ?DEBUG_LEVEL), - corba:raise(#'CosNaming_NamingContextExt_InvalidAddress'{}) - end; - [Address] -> - %% Use default port - {Host, Key} = split_to_slash(Address, []), - {http, Host, ?HTTP_DEF_PORT, Key}; - _What -> - orber:dbg("[~p] orber_cosnaming_utils:http(~p);~n" - "Malformed key; should be http://Host:Port/path/name.html~n" - "or http://Host/path/name.html", - [?LINE, Address], ?DEBUG_LEVEL), - corba:raise(#'CosNaming_NamingContextExt_InvalidAddress'{}) - end. - -split_to_slash([], _Acc) -> - orber:dbg("[~p] orber_cosnaming_utils:split_to_slash();~n" - "No Key given Host:Port/Key.html", [?LINE], ?DEBUG_LEVEL), - corba:raise(#'CosNaming_NamingContextExt_InvalidAddress'{}); -split_to_slash([$/|Rest], Acc) -> - {lists:reverse(Acc), [$/|Rest]}; -split_to_slash([H|T], Acc) -> - split_to_slash(T, [H|Acc]). - -%%---------------------------------------------------------------------- -%% Function : lookup -%% Arguments : A tuple which contain data about what connection we want to use. -%% Description: -%% Returns : Object | -%% {'EXCEPTION', E} -%%---------------------------------------------------------------------- -lookup(Data) -> - lookup(Data, []). - -lookup({corbaname, rir, _Key, []}, Ctx) -> - %% If no object key supplied NameService is defined to be default. - corba:resolve_initial_references("NameService", Ctx); -lookup({corbaname, rir, Key, Name}, Ctx) -> - NS = corba:resolve_initial_references(Key, Ctx), - 'CosNaming_NamingContext':resolve(NS, Ctx, Name); - -lookup({corbaloc, rir, Key}, Ctx) -> - corba:resolve_initial_references(Key, Ctx); - -lookup({corbaname, [], _Key, _Name}, _Ctx) -> - corba:raise(#'CosNaming_NamingContextExt_InvalidAddress'{}); -lookup({corbaname, Addresses, Key, ""}, Ctx) -> - %% Not Name-string defined, which is the same as corbaloc. - lookup({corbaloc, Addresses, Key}, Ctx); -lookup({corbaname, [[iiop, Vers, Host, Port]|Addresses], Key, Name}, Ctx) -> - NS = iop_ior:create_external(Vers, key2id(Key), Host, Port, Key), - case catch 'CosNaming_NamingContext':resolve(NS, Ctx, Name) of - {'EXCEPTION', _} -> - lookup({corbaname, Addresses, Key, Name}, Ctx); - Obj -> - Obj - end; -%%% Corbaname via SSL -lookup({corbaname, [[ssliop, Vers, Host, Port]|Addresses], Key, Name}, Ctx) -> - SSLComponent = - #'IOP_TaggedComponent'{tag=?TAG_SSL_SEC_TRANS, - component_data=#'SSLIOP_SSL'{target_supports = 2, - target_requires = 2, - port = Port}}, - NS = iop_ior:create_external(Vers, key2id(Key), Host, Port, Key, [SSLComponent]), - case catch 'CosNaming_NamingContext':resolve(NS, Ctx, Name) of - {'EXCEPTION', _} -> - lookup({corbaname, Addresses, Key, Name}, Ctx); - Obj -> - Obj - end; -lookup({corbaname, [_|Addresses], Key, Name}, Ctx) -> - lookup({corbaname, Addresses, Key, Name}, Ctx); - -lookup({corbaloc, [], _Key}, _Ctx) -> - corba:raise(#'CosNaming_NamingContextExt_InvalidAddress'{}); -lookup({corbaloc, [[iiop, Vers, Host, Port]|Addresses], Key}, Ctx) -> - ObjRef = iop_ior:create_external(Vers, key2id(Key), Host, Port, Key), - OldVal = put(orber_forward_notify, true), - case catch corba_object:non_existent(ObjRef, Ctx) of - {location_forward, Result} -> - put(orber_forward_notify, OldVal), - Result; - false -> - put(orber_forward_notify, OldVal), - ObjRef; - true -> - put(orber_forward_notify, OldVal), - lookup({corbaloc, Addresses, Key}, Ctx); - _ -> - %% May be located on a version using '_not_existent' - %% see CORBA2.3.1 page 15-34 try again. - case catch corba_object:not_existent(ObjRef, Ctx) of - {location_forward, Result} -> - put(orber_forward_notify, OldVal), - Result; - false -> - put(orber_forward_notify, OldVal), - ObjRef; - _ -> - put(orber_forward_notify, OldVal), - lookup({corbaloc, Addresses, Key}, Ctx) - end - end; - -%%% Corbaloc via SSL -lookup({corbaloc, [[ssliop, Vers, Host, Port]|Addresses], Key}, Ctx) -> - SSLComponent = - #'IOP_TaggedComponent'{tag=?TAG_SSL_SEC_TRANS, - component_data=#'SSLIOP_SSL'{target_supports = 2, - target_requires = 2, - port = Port}}, - ObjRef = iop_ior:create_external(Vers, key2id(Key), Host, Port, Key, [SSLComponent]), - OldVal = put(orber_forward_notify, true), - - case catch corba_object:non_existent(ObjRef, Ctx) of - {location_forward, Result} -> - put(orber_forward_notify, OldVal), - Result; - false -> - put(orber_forward_notify, OldVal), - ObjRef; - true -> - put(orber_forward_notify, OldVal), - lookup({corbaloc, Addresses, Key}, Ctx); - _ -> - %% May be located on a version using '_not_existent' - %% see CORBA2.3.1 page 15-34 try again. - case catch corba_object:not_existent(ObjRef, Ctx) of - {location_forward, Result} -> - put(orber_forward_notify, OldVal), - Result; - false -> - put(orber_forward_notify, OldVal), - ObjRef; - _ -> - put(orber_forward_notify, OldVal), - lookup({corbaloc, Addresses, Key}, Ctx) - end - end; - -lookup({corbaloc, [_|Addresses], Key}, Ctx) -> - lookup({corbaloc, Addresses, Key}, Ctx); - - -lookup({file, File}, _Ctx) -> - case file:read_file(File) of - {ok, IOR} -> - binary_to_list(IOR); - {error, Reason} -> - orber:dbg("[~p] orber_cosnaming_utils:lookup(~p);~n" - "Failed to access file: ~p.", - [?LINE, File, Reason], ?DEBUG_LEVEL), - corba:raise(#'CosNaming_NamingContext_InvalidName'{}) - end; -lookup({http, Host, Port, Key}, _Ctx) -> - SetupTimeout = orber:iiop_setup_connection_timeout(), - SendTimeout = orber:iiop_timeout(), - {ok, Socket} = create_connection(Host, Port, SetupTimeout), - Request = "GET " ++ Key ++ " HTTP/1.0\r\n\r\n", - case gen_tcp:send(Socket, Request) of - ok -> - receive_msg(Socket, [], SendTimeout); - {error, Reason} -> - orber:dbg("[~p] orber_cosnaming_utils:lookup();~n" - "Failed to send request: ~p.", - [?LINE, Reason], ?DEBUG_LEVEL), - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO}) - end; -lookup({ftp, _Address}, _Ctx) -> - corba:raise(#'CosNaming_NamingContextExt_InvalidAddress'{}); -lookup(_, _Ctx) -> - corba:raise(#'CosNaming_NamingContextExt_InvalidAddress'{}). - - -receive_msg(Socket, Acc, Timeout) -> - receive - {tcp_closed, Socket} -> - case re:split(Acc,"\r\n\r\n",[{return,list}]) of - [_Header, Body] -> - Body; - What -> - orber:dbg("[~p] orber_cosnaming_utils:receive_msg();~n" - "HTTP server closed the connection before sending a complete reply: ~p.", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO}) - end; - {tcp, Socket, Response} -> - receive_msg(Socket, Acc ++ Response, Timeout); - {tcp_error, Socket, Reason} -> - orber:dbg("[~p] orber_cosnaming_utils:receive_msg();~n" - "connection failed: ~p.", - [?LINE, Reason], ?DEBUG_LEVEL), - gen_tcp:close(Socket), - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO}) - after Timeout -> - gen_tcp:close(Socket), - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO}) - end. - -create_connection(Host, Port, Timeout) -> - case gen_tcp:connect(Host,Port,[{packet,0},{reuseaddr,true}], Timeout) of - {ok,Socket} -> - {ok,Socket}; - Error -> - orber:dbg("[~p] orber_cosnaming_utils:create_connection(~p, ~p, ~p);~n" - "Reason: ~p", - [?LINE, Host, Port, Timeout, Error], ?DEBUG_LEVEL), - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO}) - end. - -%%---------------------------------------------------------------------- -%% Function : key2id -%% Arguments : An objectkey (e.g. NameService) -%% Description: -%% Returns : The associated IFR-id -%%---------------------------------------------------------------------- -key2id(Key) -> - %% We need this test to avoid returning an exit if an XX:typeID() - %% fails (e.g. the module doesn't exist). - case catch key2id_helper(Key) of - {ok, Id} -> - Id; - _ -> - "" - end. - - -key2id_helper("NameService") -> - {ok, 'CosNaming_NamingContext':typeID()}; -key2id_helper("RootPOA") -> - {ok, "IDL:omg.org/PortableServer/POA:1.0"}; -key2id_helper("POACurrent") -> - {ok, "IDL:omg.org/PortableServer/Current:1.0"}; -key2id_helper("InterfaceRepository") -> - {ok, "IDL:omg.org/CORBA/Repository:1.0"}; -key2id_helper("TradingService") -> - {ok, "IDL:omg.org/CosTrading/Lookup:1.0"}; -key2id_helper("TransactionCurrent") -> - {ok, "IDL:omg.org/CosTransactions/Current:1.0"}; -key2id_helper("DynAnyFactory") -> - {ok, "IDL:omg.org/DynamicAny/DynAnyFactory:1.0"}; -key2id_helper("ORBPolicyManager") -> - {ok, "IDL:omg.org/CORBA/PolicyManager:1.0"}; -key2id_helper("PolicyCurrent") -> - {ok, "IDL:omg.org/CORBA/PolicyCurrent:1.0"}; -key2id_helper("NotificationService") -> - {ok, "IDL:omg.org/CosNotifyChannelAdmin/EventChannelFactory:1.0"}; -key2id_helper("TypedNotificationService") -> - {ok, "IDL:omg.org/CosTypedNotifyChannelAdmin::TypedEventChannelFactory:1.0"}; -key2id_helper("CodecFactory") -> - {ok, "IDL:omg.org/IOP/CodecFactory:1.0"}; -key2id_helper("PICurrent") -> - {ok, "IDL:omg.org/PortableInterceptors/Current:1.0"}; -%% Should we use SecurityLevel1 instead?? This key can be either. -key2id_helper("SecurityCurrent") -> - {ok, "IDL:omg.org/SecurityLevel2/Current:1.0"}; -%% Unknown - use the empty string. Might not work for all other ORB's but it's -%% the only option we've got. -key2id_helper(_) -> - {ok, ""}. - - - -%%---------------------------------------------------------------------- -%% Function : name2string -%% Arguments : A sequence of NameComponents -%% Description: -%% Returns : A string describing the sequence. -%%---------------------------------------------------------------------- -name2string(Name) -> - name2string(lists:reverse(Name), []). -name2string([], Acc) -> - lists:flatten(Acc); -name2string([#'CosNaming_NameComponent'{id="", kind=""}], Acc) -> - name2string([], [$.|Acc]); -name2string([#'CosNaming_NameComponent'{id=ID, kind=""}], Acc) -> - name2string([], [convert_reserved(ID)|Acc]); -name2string([#'CosNaming_NameComponent'{id=ID, kind=Kind}], Acc) -> - name2string([], [convert_reserved(ID), $., convert_reserved(Kind)|Acc]); -name2string([#'CosNaming_NameComponent'{id="", kind=""}|T], Acc) -> - name2string(T, [$/, $.|Acc]); -name2string([#'CosNaming_NameComponent'{id=ID, kind=""}|T], Acc) -> - name2string(T, [$/, convert_reserved(ID)|Acc]); -name2string([#'CosNaming_NameComponent'{id=ID, kind=Kind}|T], Acc) -> - name2string(T, [$/, convert_reserved(ID), $., convert_reserved(Kind)|Acc]); -name2string(What, Acc) -> - orber:dbg("[~p] orber_cosnaming_utils:name2string(~p)~n" - "Malformed NameComponent: ~p", - [?LINE, Acc, What], ?DEBUG_LEVEL), - corba:raise(#'CosNaming_NamingContext_InvalidName'{}). - -%% '/' and '.' are reserved as separators but can be overridden by using '\'. -convert_reserved([]) -> - []; -convert_reserved([$/|T]) -> - [$\\, $/|convert_reserved(T)]; -convert_reserved([$.|T]) -> - [$\\, $.|convert_reserved(T)]; -convert_reserved([$\\, H|T]) -> - [$\\, H|convert_reserved(T)]; -convert_reserved([H|T]) -> - [H|convert_reserved(T)]. - - -%%---------------------------------------------------------------------- -%% Function : string2name -%% Arguments : A string describing a sequence of NameComponents. -%% Description: -%% Returns : A sequence of NameComponents -%%---------------------------------------------------------------------- -string2name([]) -> - []; -string2name(Str) -> - {NC, Rest} = get_NC(id, Str, [], []), - [NC|string2name(Rest)]. - -get_NC(id, [], ID, _Kind) -> - {#'CosNaming_NameComponent'{id=lists:reverse(ID), kind=""}, []}; -get_NC(kind, [], ID, Kind) -> - {#'CosNaming_NameComponent'{id=lists:reverse(ID), kind=lists:reverse(Kind)}, []}; -%% // is not allowed; must be /./ -get_NC(id, [$/|_T], [], _) -> - orber:dbg("[~p] orber_cosnaming_utils:get_NC();~n" - "'//' not allowed, use '/./'", [?LINE], ?DEBUG_LEVEL), - corba:raise(#'CosNaming_NamingContext_InvalidName'{}); -get_NC(id, [$., $/|T], [], _) -> - {#'CosNaming_NameComponent'{id="", kind=""}, T}; -%% End of this ID/Kind; in this case kind eq. "". -get_NC(id, [$/|T], ID, _Kind) -> - {#'CosNaming_NameComponent'{id=lists:reverse(ID), kind=""}, T}; -get_NC(kind, [$/|T], ID, Kind) -> - {#'CosNaming_NameComponent'{id=lists:reverse(ID), kind=lists:reverse(Kind)}, T}; -%% ID exist but it's not allowed to write "id1./id2.kind2". -get_NC(id, [$., $/|_T], _, _) -> - orber:dbg("[~p] orber_cosnaming_utils:get_NC();~n" - "'id1./id2.kind2' not allowed, use 'id1/id2.kind2'", - [?LINE], ?DEBUG_LEVEL), - corba:raise(#'CosNaming_NamingContext_InvalidName'{}); -get_NC(id, [$\\, $., H|T], ID, Kind) -> - get_NC(id, T, [H, $.|ID], Kind); -get_NC(id, [$\\, $/, H|T], ID, Kind) -> - get_NC(id, T, [H, $/|ID], Kind); -get_NC(kind, [$\\, $., H|T], ID, Kind) -> - get_NC(kind, T, ID, [H|Kind]); -get_NC(kind, [$\\, $/, H|T], ID, Kind) -> - get_NC(kind, T, ID, [H|Kind]); -get_NC(id, [$.|T], ID, Kind) -> - get_NC(kind, T, ID, Kind); -get_NC(id, [H|T], ID, Kind) -> - get_NC(id, T, [H|ID], Kind); -get_NC(kind, [H|T], ID, Kind) -> - get_NC(kind, T, ID, [H|Kind]); -get_NC(Type, Data, ID, Kind) -> - orber:dbg("[~p] orber_cosnaming_utils:get_NC(~p, ~p, ~p, ~p);~n" - "Unknown", [?LINE, Type, Data, ID, Kind], ?DEBUG_LEVEL), - corba:raise(#'CosNaming_NamingContext_InvalidName'{}). - - -%% Converts \< to '%3c' -escape_string(Str) -> - escape_string(Str, []). -escape_string([], Acc) -> - lists:reverse(Acc); -escape_string([$\\, Char |T], Acc) -> - escape_string(T, [code_character(16#0f band Char), - code_character(16#0f band (Char bsr 4)),$%|Acc]); -escape_string([Char|T], Acc) -> - escape_string(T, [Char|Acc]). - - -code_character(N) when N < 10 -> - $0 + N; -code_character(N) -> - $a + (N - 10). - -%% Converts '%3c' to \< -unescape_string(Str) -> - unescape_string(Str, []). -unescape_string([], Acc) -> - lists:reverse(Acc); -unescape_string([$%, H1, H2 |T], Acc) -> - I1 = hex2int(H1), - I2 = hex2int(H2), - I = I1 * 16 + I2, - unescape_string(T, [I, $\\|Acc]); -unescape_string([H|T], Acc) -> - unescape_string(T, [H|Acc]). - -hex2int(H) when H >= $a -> - 10 + H - $a; -hex2int(H) when H >= $A -> - 10 + H -$A; -hex2int(H) -> - H - $0. - -%%-------------------------- END OF MODULE ----------------------------- diff --git a/lib/orber/Makefile b/lib/orber/Makefile deleted file mode 100644 index 7db588f206..0000000000 --- a/lib/orber/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1997-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include vsn.mk -VSN=$(ORBER_VSN) - -# ---------------------------------------------------- -# Common Macros -# ---------------------------------------------------- - -SUB_DIRECTORIES = COSS/CosNaming src java_src c_src examples doc/src priv - -SPECIAL_TARGETS = - -# ---------------------------------------------------- -# Default Subdir Targets -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_subdir.mk - diff --git a/lib/orber/c_src/InitialReference.cc b/lib/orber/c_src/InitialReference.cc deleted file mode 100644 index 053f3c9c8e..0000000000 --- a/lib/orber/c_src/InitialReference.cc +++ /dev/null @@ -1,206 +0,0 @@ -/** - * - * 1997-2007 - * Ericsson AB, All Rights Reserved - * - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * The Initial Developer of the Original Code is Ericsson AB. - * - */ -/** - * InitialReference is a class which generates the INIT reference - * which can be used by the InitialReferences interface. - * - * creation date: 1997-11-04 - */ -#include "InitialReference.hh" - -InitialReference::InitialReference() -{ - host = 0; - iorString = 0; -}; - -InitialReference::~InitialReference() -{ - if(host){ - delete host; - delete iorString; - } -}; - - /** - * Returns the stringified objectreference to the initial reference server - */ -char* InitialReference::stringified_ior(char* newhost, int newport) -{ - STRINGSTREAM iorByteString; - STRINGSTREAM profileData; - - STRINGBUF *s; - STRINGBUF *profileDataBuf; - STRINGBUF *iorByteStringBuf; - long profileDataLength = 0; - char *str; - - // byte_order followed by ' {"", [{0, ' - // char iorBytesFirstPart[] = {0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0}; - char iorBytesFirstPart[48] = {0,0,0,0,0,0,0,32,73,68,76,58,79,114,98,101,114,47,73,110,105,116,105,97,108,82,101,102,101,114,101,110,99,101,115,58,49,46,48,0,0,0,0,1,0,0,0,0}; - // the objectkey "INIT - char iorBytesLastPart[8] = {0,0,0,4,73,78,73,84}; - - // Fix the ProfileData struct. - char pdPrefix[4] = {0,1,0,0}; - char hsize[4]; - char profileDataLengthBytes[4]; - char portbytes[2]; - long hostLength = strlen(newhost); - - - if(host) - if(strcmp(newhost, host) == 0 && newport == port) - return iorString; - else { - delete host; - delete iorString; - } - host = new char[hostLength+1]; - memcpy(host, newhost, hostLength+1); - port = newport; - - enc_ulong(hostLength + 1, hsize); - enc_ushort(port, portbytes); - - profileDataBuf = profileData.rdbuf(); - - profileDataBuf->sputn(pdPrefix, 4); - profileDataBuf->sputn(hsize, 4); - profileDataBuf->sputn(host, hostLength); - profileDataBuf->sputc(0); - profileDataLength = 4 + 4 + hostLength + 1; - - profileDataLength = align(profileDataBuf, profileDataLength, 2); - - profileDataBuf->sputn(portbytes, 2); - profileDataLength += 2; - - profileDataLength = align(profileDataBuf, profileDataLength, 4); - - profileDataBuf->sputn(iorBytesLastPart, 8); - profileDataLength += 8; - //cout << "pd length: " << profileDataLength << "\n"; - - enc_ulong(profileDataLength, profileDataLengthBytes); - - // Fix the whole IOR - - iorByteStringBuf = iorByteString.rdbuf(); - - iorByteStringBuf->sputn(iorBytesFirstPart, 48); - iorByteStringBuf->sputn(profileDataLengthBytes, 4); -#ifdef HAVE_SSTREAM - iorByteStringBuf->sputn(profileData.str().data(), profileDataLength); -#else - str = profileData.str(); - iorByteStringBuf->sputn(str, profileDataLength); - delete str; -#endif - - createIOR(iorByteString, 48 + 4 + profileDataLength); - - return iorString; -} - - -void InitialReference::enc_ushort(int s, char *byteArray) -{ - byteArray[0] = (char) ((s >> 8) & 0xFF); - byteArray[1] = (char) ((s >> 0) & 0xFF); - - return; -} - -void InitialReference::enc_ulong(long l, char *byteArray) -{ - byteArray[0] = (char) ((l >> 24) & 0xFF); - byteArray[1] = (char) ((l >> 16) & 0xFF); - byteArray[2] = (char) ((l >> 8) & 0xFF); - byteArray[3] = (char) ((l >> 0) & 0xFF); - - return; -} - -void InitialReference::createIOR(strstream& byte, long length) -{ - STRINGBUF *stringbuf; - STRINGSTREAM string; - - int i; -#ifdef HAVE_SSTREAM - const char *c; - const char *bytestr = byte.str().c_str(); -#else - char *c; - char *bytestr = byte.str(); -#endif - int b, n1, n2, c1, c2; - - stringbuf = string.rdbuf(); - stringbuf->sputn("IOR:",4); - - for(i = 0, c = bytestr; i < length; c++, i++) - { - b = *c; - if(b<0) b+= 256; - n1 = b / 16; - n2 = b % 16; - c1 = (n1 < 10) ? ('0' + n1) : ('a' + (n1 - 10)); - c2 = (n2 < 10) ? ('0' + n2) : ('a' + (n2 - 10)); - - stringbuf->sputc(c1); - stringbuf->sputc(c2); - - } - - stringbuf->sputc(0); - - delete bytestr; - -#ifdef HAVE_SSTREAM - iorString = (char *)string.str().c_str(); -#else - iorString = string.str(); -#endif - - return; -} - -long InitialReference::align(STRINGBUF* sbuf, long currentLength, - int alignment) -{ - long length = currentLength; - - int remainder = alignment - (currentLength % alignment); - if (remainder == alignment) return length; - - for (int i = 0; i < remainder; i++) - { - sbuf->sputc(0); - length++; - } - return length; -} - - diff --git a/lib/orber/c_src/InitialReference.hh b/lib/orber/c_src/InitialReference.hh deleted file mode 100644 index 79725522db..0000000000 --- a/lib/orber/c_src/InitialReference.hh +++ /dev/null @@ -1,60 +0,0 @@ -/** - * - * 1997-2007 - * Ericsson AB, All Rights Reserved - * - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * The Initial Developer of the Original Code is Ericsson AB. - * - */ -/* - * InitialReference is a class for creating an external IOR for the object - * reference INIT. - */ -#ifndef _INITIALREFERENCE_HH -#define _INITIALREFERENCE_HH -#include -#include - -#if HAVE_SSTREAM -#include -typedef std::stringstream STRINGSTREAM; -typedef std::stringbuf STRINGBUF; -#else -#include -typedef strstream STRINGSTREAM; -typedef strstreambuf STRINGBUF; -#endif - -class InitialReference { -private: - char* iorString; - char* host; - int port; - - void enc_ushort(int s, char *byteArray); - void enc_ulong(long l, char *byteArray); - void createIOR(STRINGSTREAM& byte, long length); - long align(STRINGBUF* sbuf, long currentLength, int alignment); - -public: - InitialReference(); - ~InitialReference(); - - char* stringified_ior(char* host, int port); - -}; - -#endif diff --git a/lib/orber/c_src/Makefile b/lib/orber/c_src/Makefile deleted file mode 100644 index bad1d3ddb0..0000000000 --- a/lib/orber/c_src/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1997-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -# Invoke with GNU make or clearmake -C gnu. -# - -include $(ERL_TOP)/make/run_make.mk diff --git a/lib/orber/c_src/Makefile.in b/lib/orber/c_src/Makefile.in deleted file mode 100644 index 980e780451..0000000000 --- a/lib/orber/c_src/Makefile.in +++ /dev/null @@ -1,100 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1997-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -CXX = @CXX@ -CC = @CC@ -LIBS = @LIBS@ - -OBJDIR = ../priv/obj/$(TARGET) - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(ORBER_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/orber-$(VSN) - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -CC_FILES = \ - InitialReference.cc - -HH_FILES = \ - InitialReference.hh - -ALL_CFLAGS = @CFLAGS@ @DEFS@ $(CFLAGS) - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- - -debug opt: $(OBJDIR) orber - -ifeq ($(findstring win32,$(TARGET)),win32) -orber: - $(V_colon)echo "Nothing to build on NT" -else -orber: - $(V_colon)echo "Nothing to build" -endif - -clean: - -docs: - -# ---------------------------------------------------- -# Special Build Targets -# ---------------------------------------------------- - -$(OBJDIR): - -mkdir -p $(OBJDIR) - -$(OBJDIR)/%.o: %.c - $(V_CC) -c -o $@ $(ALL_CFLAGS) $< - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -ifeq ($(findstring win32,$(TARGET)),win32) -release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)/priv/src" - $(INSTALL_DIR) "$(RELSYSDIR)/priv/include" - $(INSTALL_PROGRAM) $(CC_FILES) "$(RELSYSDIR)/priv/src" - $(INSTALL_PROGRAM) $(HH_FILES) "$(RELSYSDIR)/priv/include" -else -release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)/priv/src" - $(INSTALL_DIR) "$(RELSYSDIR)/priv/include" - $(INSTALL_DATA) $(CC_FILES) "$(RELSYSDIR)/priv/src" - $(INSTALL_DATA) $(HH_FILES) "$(RELSYSDIR)/priv/include" -endif - - -release_docs_spec: diff --git a/lib/orber/c_src/main.cc b/lib/orber/c_src/main.cc deleted file mode 100644 index 109aaf824a..0000000000 --- a/lib/orber/c_src/main.cc +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * 1997-2007 - * Ericsson AB, All Rights Reserved - * - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * The Initial Developer of the Original Code is Ericsson AB. - * - */ - -#include "InitialReference.hh" - -main() -{ - InitialReference ir; - - cout << ir.stringified_ior("fingolfin", 4001) << "\n"; - - -} diff --git a/lib/orber/doc/etc/.gitignore b/lib/orber/doc/etc/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/orber/doc/html/.gitignore b/lib/orber/doc/html/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/orber/doc/javadoc/.gitignore b/lib/orber/doc/javadoc/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/orber/doc/man1/.gitignore b/lib/orber/doc/man1/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/orber/doc/man3/.gitignore b/lib/orber/doc/man3/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/orber/doc/pdf/.gitignore b/lib/orber/doc/pdf/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/orber/doc/src/CosNaming.xml b/lib/orber/doc/src/CosNaming.xml deleted file mode 100644 index 251e721df1..0000000000 --- a/lib/orber/doc/src/CosNaming.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - -
- - 19972017 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosNaming - - - - 1997-06-10 - A -
- CosNaming - The CosNaming service is a collection of interfaces that together define the naming service. - -

The naming service provides the principal mechanism for clients to find - objects in an ORB based world. The naming service provides an initial naming - context that functions as the root context for all names. Given this context - clients can navigate in the name space.

-

Types that are declared on the CosNaming level are:

- Name; - -enum BindingType {nobject, ncontext}; - -struct Binding { - Name binding_name; - BindingType binding_type; -}; - -typedef sequence BindingList; - ]]> -

To get access to the record definitions for the structs use:

- -include_lib("orber/COSS/CosNaming.hrl"). -

Names are not an ORB object but the can be structured in components as seen by - the definition above. There are no requirements on names so the service can support - many different conventions and standards.

-

There are two different interfaces supported in the service:

- - NamingContext - BindingIterator - -
- -
- diff --git a/lib/orber/doc/src/CosNaming_BindingIterator.xml b/lib/orber/doc/src/CosNaming_BindingIterator.xml deleted file mode 100644 index 69b0f42b22..0000000000 --- a/lib/orber/doc/src/CosNaming_BindingIterator.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - -
- - 1997 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNaming_BindingIterator - - - - 1997-06-10 - A -
- CosNaming_BindingIterator - This interface supports iteration over a name binding list. - -

This interface allows a client to iterate over the Bindinglist it has been - initiated with.

-

The type NameComponent used below is defined as:

- - -record('CosNaming_NameComponent', {id, kind=""}). - -

id and kind are strings.

-

The type Binding used below is defined as:

- - -record('CosNaming_Binding', {binding_name, binding_type}). - -

binding_name is a Name = [NameComponent] and - binding_type is an enum which - has the values nobject and ncontext.

-

Both these records are defined in the file CosNaming.hrl and it - is included with:

- - -include_lib("orber/COSS/CosNaming/CosNaming.hrl"). - -
- - - next_one(BindinIterator) -> Return - Return a binding - - BindingIterator = #objref - Return = {bool(), Binding} - - -

This operation returns the next binding and a boolean. The latter - is set to true if the binding is valid otherwise false. If the boolean - is false there are no more bindings to retrieve.

-
-
- - next_n(BindinIterator, HowMany) -> Return - Return a binding list - - BindingIterator = #objref - HowMany = int() - BindingList = [Binding] - Return = {bool(), BindingList} - - -

This operation returns a binding list with at most HowMany bindings. - If there are no more bindings it returns false otherwise true.

-
-
- - destroy(BindingIterator) -> Return - Destroy the iterator object - - BindingIterator = #objref - Return = ok - - -

This operation destroys the binding iterator.

-
-
-
- -
- diff --git a/lib/orber/doc/src/CosNaming_NamingContext.xml b/lib/orber/doc/src/CosNaming_NamingContext.xml deleted file mode 100644 index 4c83e6a240..0000000000 --- a/lib/orber/doc/src/CosNaming_NamingContext.xml +++ /dev/null @@ -1,243 +0,0 @@ - - - - -
- - 19972017 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosNaming_NamingContext - - - - 1997-06-10 - A -
- CosNaming_NamingContext - This interface supports different bind and access functions for names in a context. - -

This is the object that defines name scopes, names must be unique within a - naming context. Objects may have multiple names and may exist in multiple - naming contexts. Name context may be named in other contexts and cycles are - permitted.

-

The type NameComponent used below is defined as:

- -record('CosNaming_NameComponent', {id, kind=""}). -

where id and kind are strings.

-

The type Binding used below is defined as:

- -record('CosNaming_Binding', {binding_name, binding_type}). -

where binding_name is a Name and binding_type is an enum which - has the values nobject and ncontext.

-

Both these records are defined in the file CosNaming.hrl and it - is included with:

- -include_lib("orber/COSS/CosNaming/CosNaming.hrl"). -

There are a number of exceptions that can be returned from functions in this - interface.

- - -

NotFound is defined as

- --record('CosNaming_NamingContext_NotFound', - {rest_of_name, why}). -
- -

CannotProceed is defined as

- --record('CosNaming_NamingContext_CannotProceed', - {rest_of_name, cxt}). - -
- -

InvalidName is defined as

- --record('CosNaming_NamingContext_InvalidName', {}). - -
- -

NotFound is defined as

- -record('CosNaming_NamingContext_NotFound', {}). -
- -

AlreadyBound is defined as

- -record('CosNaming_NamingContext_AlreadyBound', {}). -
- -

NotEmpty is defined as

- -record('CosNaming_NamingContext_NotEmpty', {}). -
-
-

These exceptions are defined in the file CosNaming_NamingContext.hrl and it - is included with:

- --include_lib("orber/COSS/CosNaming/CosNaming_NamingContext.hrl"). - -
- - - bind(NamingContext, Name, Object) -> Return - Bind a Name to an Object - - NameContext = #objref - Name = [NameComponent] - Object = #objref - Return = ok - - -

Creates a binding of a name and an object in the naming context. - Naming contexts that are bound using bind() do not participate - in name resolution.

-
-
- - rebind(NamingContext, Name, Object) -> Return - Bind an Object to the Name even if the Name already is bound - - NamingContext = #objref - Name = [NameComponent] - Object = #objref - Return = ok - - -

Creates a binding of a name and an object in the naming context even - if the name is already bound. Naming contexts that are bound using - rebind() do not participate in name resolution.

-
-
- - bind_context(NamingContext1, Name, NamingContex2) -> Return - Bind a Name to an NamingContext - - NamingContext1 = NamingContext2 =#objref - Name = [NameComponent] - Return = ok - - -

The bind_context function creates a binding of a name and a naming context in - the current context. - Naming contexts that are bound using bind_context() participate - in name resolution.

-
-
- - rebind_context(NamingContext1, Name, NamingContex2) -> Return - Bind an NamingContext to the Name even if the Name already is bound - - NamingContext1 = NamingContext2 =#objref - Name = [NameComponent] - Return = ok - - -

The rebind_context function creates a binding of a name and a naming context in - the current context even if the name already is bound. - Naming contexts that are bound using rebind_context() participate - in name resolution.

-
-
- - resolve(NamingContext, Name) -> Return - Retrieve an Object bound to Name - - NamingContext = #objref - Name = [NameComponent] - Return = Object - Object = #objref - - -

The resolve function is the way to retrieve an object bound to a name in - the naming context. The given name must match exactly the bound name. The - type of the object is not returned, clients are responsible for narrowing - the object to the correct type.

-
-
- - unbind(NamingContext, Name) -> Return - Remove the binding for a Name - - NamingContext = #objref - Name = [NameComponent] - Return = ok - - -

The unbind operation removes a name binding from the naming context.

-
-
- - new_context(NamingContext) -> Return - Create a new NamingContext - - NamingContext = #objref - Return = #objref - - -

The new_context operation creates a new naming context.

-
-
- - bind_new_context(NamingContext, Name) -> Return - Create a new NamingContext and bind it to a Name - - NamingContext = #objref - Name = [NameComponent] - Return = #objref - - -

The new_context operation creates a new naming context and binds it to - Name in the current context.

-
-
- - destroy(NamingContext) -> Return - Destroy a NamingContext - - NamingContext = #objref - Return = ok - - -

The destroy operation disposes the NamingContext object and removes it from the - name server. The context must be empty e.g. not contain any bindings to be - removed.

-
-
- - list(NamingContext, HowMany) -> Return - List returns a all bindings in the context - - NamingContext = #objref - HowMany = int() - Return = {ok, BindingList, BindingIterator} - BindingList = [Binding] - BindingIterator = #objref - - -

The list operation returns a BindingList with a number of bindings up-to - HowMany from the context. It also returns a BindinIterator which can be used to - step through the list. If the total number of existing bindings are less - than, or equal to, the HowMany parameter a NIL object reference - is returned.

-

- -

One must destroy the BindingIterator, unless it is a NIL object - reference, by using 'BindingIterator':destroy(). Otherwise one can get - dangling objects.

-
-
-
-
- -
- diff --git a/lib/orber/doc/src/CosNaming_NamingContextExt.xml b/lib/orber/doc/src/CosNaming_NamingContextExt.xml deleted file mode 100644 index 2af3deadda..0000000000 --- a/lib/orber/doc/src/CosNaming_NamingContextExt.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - - -
- - 20002017 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - CosNaming_NamingContextExt - - - - 2000-08-16 - A -
- CosNaming_NamingContextExt - This interface contains operation for converting a Name sequence to a string and back. - -

To get access to the record definitions for the structures use:

-

- --include_lib("orber/COSS/CosNaming/CosNaming.hrl"). - -

This module also exports the functions described in:

- - -

CosNaming_NamingContext

-
-
-
- - - to_string(NamingContext, Name) -> Return - Stringify a Namesequence to a string - - NameContext = #objref - Name = [NameComponent] - Return = string() | {'EXCEPTION', NamingContext::InvalidName{}} - - -

Stringifies a Name sequence to a string.

-
-
- - to_name(NamingContext, NameString) -> Return - Convert a stringified Nameto a Namesequence - - NameContext = #objref - NameString = string() - Return = [NameComponent] | {'EXCEPTION', NamingContext::InvalidName{}} - - -

Converts a stringified Name to a Name sequence.

-
-
- - to_url(NamingContext, AddressString, NameString) -> Return - Return an URL string constructed from the given Address and Name strings - - NameContext = #objref - Address = NameString = string() - Return = URLString | {'EXCEPTION', NamingContext::InvalidName{}} | {'EXCEPTION', NamingContextExt::InvalidAddress{}} - - -

This operation takes a corbaloc string and a stringified Name - sequence as input and returns a fully formed URL string.

-
-
- - resolve_str(NamingContext, NameString) -> Return - Return the object associated, if any, with the given name string - - NameContext = #objref - NameString = string() - Return = #objref | {'EXCEPTION', NamingContext::InvalidName{}} | {'EXCEPTION', NamingContext::NotFound{why, rest_of_name}} | {'EXCEPTION', NamingContext::CannotProceed{cxt, rest_of_name}} - - -

This operation takes a stringified Name sequence as input and - returns the associated, if any, object.

-
-
-
- -
- diff --git a/lib/orber/doc/src/Makefile b/lib/orber/doc/src/Makefile deleted file mode 100644 index c77345f12b..0000000000 --- a/lib/orber/doc/src/Makefile +++ /dev/null @@ -1,172 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1997-2017. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../../vsn.mk -VSN=$(ORBER_VSN) -APPLICATION=orber - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN) - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- -XML_APPLICATION_FILES = ref_man.xml -XML_REF3_FILES = \ - any.xml \ - corba.xml \ - corba_object.xml \ - orber.xml \ - CosNaming.xml \ - CosNaming_NamingContext.xml \ - CosNaming_NamingContextExt.xml \ - CosNaming_BindingIterator.xml \ - lname.xml \ - lname_component.xml \ - orber_ifr.xml \ - orber_tc.xml \ - Module_Interface.xml \ - interceptors.xml \ - fixed.xml \ - orber_diagnostics.xml \ - orber_acl.xml - -XML_PART_FILES = \ - part.xml - -XML_CHAPTER_FILES = \ - ch_contents.xml \ - ch_introduction.xml \ - ch_orber_kernel.xml \ - ch_ifr.xml \ - ch_install.xml \ - ch_idl_to_erlang_mapping.xml \ - ch_naming_service.xml \ - ch_stubs.xml \ - ch_security.xml \ - notes.xml \ - ch_exceptions.xml \ - ch_interceptors.xml \ - ch_orberweb.xml \ - ch_debugging.xml - -BOOK_FILES = book.xml - -XML_FILES = $(BOOK_FILES) $(XML_APPLICATION_FILES) $(XML_REF3_FILES) \ - $(XML_PART_FILES) $(XML_CHAPTER_FILES) - -TECHNICAL_DESCR_FILES = - -GIF_FILES = \ - name.gif \ - orbs.gif \ - theORB.gif \ - iiop.gif \ - dependent.gif \ - interceptor_operations.gif \ - menuframe.gif \ - dataframe1.gif \ - dataframe2.gif \ - dataframe3.gif \ - dataframe4.gif \ - dataframe5.gif \ - dataframe6.gif \ - dataframe7.gif \ - dataframe8.gif \ - firewall_nat.gif - -# ---------------------------------------------------- - -INTERNAL_HTML_FILES = $(TECHNICAL_DESCR_FILES:%.xml=$(HTMLDIR)/%.html) - -HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \ - $(XML_CHAPTER_FILES:%.xml=$(HTMLDIR)/%.html) \ - $(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html) - -INFO_FILE = ../../info -EXTRA_FILES = \ - $(DEFAULT_GIF_FILES) \ - $(DEFAULT_HTML_FILES) \ - $(XML_REF3_FILES:%.xml=$(HTMLDIR)/%.html) - -MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3) - -HTML_REF_MAN_FILE = $(HTMLDIR)/index.html - -TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -XML_FLAGS += -DVIPS_FLAGS += - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -$(HTMLDIR)/%.gif: %.gif - $(INSTALL_DATA) $< $@ - - -docs: pdf html man - -$(TOP_PDF_FILE): $(XML_FILES) - -pdf: $(TOP_PDF_FILE) - -html: gifs $(HTML_REF_MAN_FILE) - -clean clean_docs: - rm -rf $(HTMLDIR)/* - rm -f $(MAN3DIR)/* - rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) - rm -f errs core *~ - rm -f $(JD_HTML) $(JD_PACK) - -man: $(MAN3_FILES) - -gifs: $(GIF_FILES:%=$(HTMLDIR)/%) - -debug opt: - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_docs_spec: docs - $(INSTALL_DIR) "$(RELSYSDIR)/doc/pdf" - $(INSTALL_DATA) $(TOP_PDF_FILE) "$(RELSYSDIR)/doc/pdf" - $(INSTALL_DIR) "$(RELSYSDIR)/doc/html" - $(INSTALL_DATA) $(HTMLDIR)/* \ - "$(RELSYSDIR)/doc/html" - $(INSTALL_DATA) $(INFO_FILE) "$(RELSYSDIR)" - $(INSTALL_DIR) "$(RELEASE_PATH)/man/man3" - $(INSTALL_DATA) $(MAN3DIR)/* "$(RELEASE_PATH)/man/man3" - -release_spec: diff --git a/lib/orber/doc/src/Module_Interface.xml b/lib/orber/doc/src/Module_Interface.xml deleted file mode 100644 index a809bcf02f..0000000000 --- a/lib/orber/doc/src/Module_Interface.xml +++ /dev/null @@ -1,356 +0,0 @@ - - - - -
- - 1999 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - Module_Interface - - - - 1999-09-03 - A -
- Module_Interface - Orber generated stubs/skeletons. - -

This module contains the stub/skeleton functions generated by IC.

-

Starting a Orber server can be done in three ways:

- - Normal - when the server dies Orber forgets all knowledge of the server. - Supervisor child - adding the configuration parameter {sup_child, true} - the oe_create_link/2 function returns {ok, Pid, ObjRef} which - can be handled by the application supervisor/stdlib-1.7 or later. - Persistent object reference - adding the configuration parameters {persistent, true} - and {regname, {global, term()}} Orber will remember the object reference until the - server terminates with reason normal or shutdown. Hence, - if the server is started as a transient supervisor child we do not - receive a 'OBJECT_NOT_EXIST' exception when it has crashed and is being restarted. - -

The Orber stub can be used to start a pseudo object, which will create a non-server implementation. - A pseudo object introduce some limitations:

- - The functions oe_create_link/2 is equal to oe_create/2, i.e., - no link can or will be created. - The BIF:s self() and process_flag(trap_exit,true) behaves incorrectly. - The IC option {{impl, "M::I"}, "other_impl"} has no effect. The call-back - functions must be implemented in a file called M_I_impl.erl - The IC option from has no effect. - The call-back functions must be implemented as if the IC option - {this, "M::I"} was used. - Server State changes have no effect. The user can provide information via - the Env start parameter and the State returned from init/2 will be the State - passed in following invocations. - If a call-back function replies with the Timeout parameter set it have no effect. - Operations defined as oneway are blocking until the operation replies. - The option {pseudo, true} overrides all other start options. - Only the functions, besides own definitions, init/2 (called via oe_create*/2) and - terminate/2 (called via corba:dispose/1) must be implemented. - -

By adopting the rules for pseudo objects described above we can use oe_create/2 - to create server or pseudo objects, by excluding or including the - option {pseudo, true}, without changing the call-back module. -

-

If you start a object without {regname, RegName} it can only be accessed through the returned object key. - Started with a {regname, RegName} the name is registered locally or globally. -

- -

To avoid flooding Orber with old object references start erlang using the flag - -orber objectkeys_gc_time Time, which will remove all object references - related to servers being dead for Time seconds. To avoid extra overhead, i.e., performing - garbage collect if no persistent objects are started, the objectkeys_gc_time default value - is infinity. For more information, see the orber and corba documentation.

-
-
- - - Module_Interface:typeID() -> TypeId - Return the Type ID related to this stub/skeleton - - TypeId = string(), e.g., "IDL:Module/Interface:1.0" - - -

Returns the Type ID related to this stub/skeleton

-
-
- - Module_Interface:oe_create() -> ObjRef - Start a Orber server. - - ObjRef = #object reference - - -

Start a Orber server.

-
-
- - Module_Interface:oe_create_link() -> ObjRef - Start a linked Orber server. - - ObjRef = #object reference - - -

Start a linked Orber server.

-
-
- - Module_Interface:oe_create(Env) -> ObjRef - Start a Orber server. - - Env = term() - ObjRef = #object reference - - -

Start a Orber server passing Env to init/1.

-
-
- - Module_Interface:oe_create_link(Env) -> ObjRef - Start a linked Orber server. - - Env = term() - ObjRef = #object reference - - -

Start a linked Orber server passing Env to init/1.

-
-
- - Module_Interface:oe_create(Env, Options) -> ObjRef - Start a Orber stub/skeleton - - Env = term() - ObjRef = #object reference - Options = [{sup_child, false} | {persistent, Bool} | {regname, RegName} | {pseudo, Bool} | {local_typecheck, Bool} | {survive_exit, Bool} | {create_options, [CreateOpts]}] - Bool = true | false - RegName = {global, term()} | {local, atom()} - CreateOpts = {debug, [Dbg]} | {timeout, Time} - Dbg = trace | log | statistics | {log_to_file, FileName} - - -

Start a Orber server passing Env to init/1.

-

If the option {pseudo, true} is used, all other options are overridden. - As default, this option is set to false.

-

This function cannot be used for starting a server as supervisor child. - If started as persistent, the options [{persistent, true}, {regname, {global, term()}}] must be used and - Orber will only forget the object reference if it terminates with reason normal or shutdown.

-

The option {local_typecheck, boolean()}, which overrides the - Local Typechecking - environment flag, turns on or off typechecking. If activated, - parameters, replies and raised exceptions will be checked to ensure that - the data is correct, when invoking operations on CORBA Objects within - the same Orber domain. Due to the extra overhead, this option - MAY ONLY be used during testing and development.

-

{survive_exit, boolean()} overrides the - EXIT Tolerance - environment flag. If activated, the server will not terminate, even though - the call-back module returns EXIT.

-

Time specifies how long time, in milliseconds, the server is allowed to - spend initializing. For more information about the Dbg options, - see the sys module.

-
-
- - Module_Interface:oe_create_link(Env, Options) -> Return - Start a Orber stub/skeleton - - Env = term() - Return = ObjRef | {ok, Pid, ObjRef} - ObjRef = #object reference - Options = [{sup_child, Bool} | {persistent, Bool} | {regname, RegName} | {pseudo, Bool} | {local_typecheck, Bool} | {survive_exit, Bool} | {create_options, [CreateOpts]}] - Bool = true | false - RegName = {global, term()} | {local, atom()} - CreateOpts = {debug, [Dbg]} | {timeout, Time} - Dbg = trace | log | statistics | {log_to_file, FileName} - - - - - -

Start a linked Orber server passing Env to init/1.

-

If the option {pseudo, true} is used, all other options are overridden and no link will be created. - As default, this option is set to false.

-

This function can be used for starting a server as persistent or supervisor child. At the moment - [{persistent, true}, {regname, {global, term()}}] must be used to start - a server as persistent, i.e., if a server died and is in the process of being restarted - a call to the server will not raise 'OBJECT_NOT_EXIST' exception. - Orber will only forget the object reference if it terminates with reason normal or shutdown, - hence, the server must be started as transient (for more information see the - supervisor documentation).

-

The options {local_typecheck, boolean()} and {survive_exit, boolean()} - behaves in the same way as for oe_create/2.

-

Time specifies how long time, in milliseconds, the server is allowed to - spend initializing. For more information about the Dbg options, - see the sys module.

-
-
- - Module_Interface:own_functions(ObjRef, Arg1, ..., ArgN) -> Reply - Module_Interface:own_functions(ObjRef, Options, Arg1, ..., ArgN) -> Reply - User defined function which is not a part of Orber - - ObjRef = #object reference - Options = [Option] | Timeout - Option = {timeout, Timeout} | {context, [Context]} - Timeout = infinity | integer(milliseconds) - Context = #'IOP_ServiceContext'{context_id = CtxId, context_data = CtxData} - CtxId = ?ORBER_GENERIC_CTX_ID - CtxData = {interface, Interface} | {userspecific, term()} | {configuration, Options} - Interface = string() - Options = [{Key, Value}] - Key = ssl_client_verify | ssl_client_depth | ssl_client_certfile | ssl_client_cacertfile | - ssl_client_password | ssl_client_keyfile | ssl_client_ciphers | ssl_client_cachetimeout - Value = allowed value associated with the given key - ArgX = specified in the IDL-code. - Reply = specified in the IDL-code. - - -

The default value for the Timeout option is infinity. - IPv4 or IPv6 addresses are accepted as local Interface.

-

The configuration context is used to override the global - SSL client side - configuration.

-

To gain access to #'IOP_ServiceContext'{} record and the - ?ORBER_GENERIC_CTX_ID macro, you must add - -include_lib("orber/include/corba.hrl"). to your module.

-
-
-
- -
- CALLBACK FUNCTIONS -

The following functions should be exported from a CORBA - callback module. Note, a complete template of the call-back module can - be generated automatically by compiling the IDL-file with the IC option - {be,erl_template}. One should also add - the same compile options, for example this or from, - used when generating the stub/skeleton modules.

-
- - - Module_Interface_impl:init(Env) -> CallReply - User defined function which is not a part of Orber - - Env = term() - CallReply = {ok, State} | {ok, State, Timeout} | ignore | {stop, StopReason} - State = term() - Timeout = int() >= 0 | infinity - StopReason = term() - - -

Whenever a new server is started, init/1 is the first function called in the specified call-back module.

-
-
- - Module_Interface_impl:terminate(Reason, State) -> ok - User defined function which is not a part of Orber - - Reason = term() - State = term() - - -

This call-back function is called whenever the server is about to terminate.

-
-
- - Module_Interface_impl:code_change(OldVsn, State, Extra) -> CallReply - User defined function which is not a part of Orber - - OldVsn = undefined | term() - State = term() - Extra = term() - CallReply = {ok, NewState} - NewState = term() - - -

Update the internal State.

-
-
- - Module_Interface_impl:handle_info(Info, State) -> CallReply - User defined function which is not a part of Orber - - Info = term() - State = term() - CallReply = {noreply, State} | {noreply, State, Timeout} | {stop, StopReason, State} - Timeout = int() >= 0 | infinity - StopReason = normal | shutdown | term() - - -

If the configuration parameter {{handle_info, "Module::Interface"}, true} - is passed to IC and process_flag(trap_exit,true) is set in the init() - call-back this function must be exported.

- -

To be able to handle the Timeout option in CallReply in the call-back - module the configuration parameter {{handle_info, "Module::Interface"}, true} must - be passed to IC.

-
-
-
- - Module_Interface_impl:own_functions(State, Arg1, ..., ArgN) -> CallReply - Module_Interface_impl:own_functions(This, State, Arg1, ..., ArgN) -> CallReply - Module_Interface_impl:own_functions(This, From, State, Arg1, ..., ArgN) -> ExtCallReply - Module_Interface_impl:own_functions(From, State, Arg1, ..., ArgN) -> ExtCallReply - User defined function which is not a part of Orber - - This = the servers #object reference - State = term() - ArgX = specified in the IDL-code. - CallReply = {reply, Reply, State} | {reply, Reply, State, Timeout} | {stop, StopReason, Reply, State} | {stop, StopReason, State} | corba:raise(Exception) - ExtCallReply = CallReply | corba:reply(From, Reply), {noreply, State} | corba:reply(From, Reply), {noreply, State, Timeout} - Reply = specified in the IDL-code. - Timeout = int() >= 0 | infinity - StopReason = normal | shutdown | term() - - -

All two-way functions must return one of the listed replies or raise any of - the exceptions listed in the IDL code (i.e. raises(...)). - If the IC compile options this and/or from are used, - the implementation must accept the This and/or From - parameters.

-
-
- - Module_Interface_impl:own_functions(State, Arg1, ..., ArgN) -> CastReply - Module_Interface_impl:own_functions(This, State, Arg1, ..., ArgN) -> CastReply - User defined function which is not a part of Orber - - This = the servers #object reference - State = term() - CastReply = {noreply, State} | {noreply, State, Timeout} | {stop, StopReason, State} - ArgX = specified in the IDL-code. - Reply = specified in the IDL-code. - Timeout = int() >= 0 | infinity - StopReason = normal | shutdown | term() - - -

All one-way functions must return one of the listed replies. - If the IC compile option this is used, - the implementation must accept the This parameter.

-
-
-
- -
- diff --git a/lib/orber/doc/src/Orber/InitialReference.java b/lib/orber/doc/src/Orber/InitialReference.java deleted file mode 100644 index 35a8c2437b..0000000000 --- a/lib/orber/doc/src/Orber/InitialReference.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1997-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -/** - * InitialReference is a class which generates the INIT reference - * which can be used by the InitialReferences interface. - */ -package Orber; - -public class InitialReference -{ - - /** - * Constructor. - */ - public InitialReference(){;} - - /** - * Returns the stringified objectreference to the initial reference server - */ - public String stringified_ior(String host, int port) - { - String iorByteString; - String profileData; - String iorString; - - // byte_order followed by ' {"", [{0, ' - // char iorBytesFirstPart[] = {0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0}; - char iorBytesFirstPart[] = {0,0,0,0,0,0,0,32,73,68,76,58,79,114,98,101,114,47,73,110,105,116,105,97,108,82,101,102,101,114,101,110,99,101,115,58,49,46,48,0,0,0,0,1,0,0,0,0}; - // the objectkey "INIT - char iorBytesLastPart[] = {0,0,0,4,73,78,73,84}; - - // Fix the ProfileData struct. - char pdPrefix[] = {0,1,0,0}; - char nullbyte[] = {0}; - profileData = new String(pdPrefix) + enc_ulong(host.length() + 1) + host + new String(nullbyte); - profileData = align(profileData, 2); - profileData += enc_ushort(port); - profileData = align(profileData, 4); - profileData += new String(iorBytesLastPart); - // Fix the whole IOR - iorByteString = new String(iorBytesFirstPart) + enc_ulong(profileData.length()) + - profileData; - - // System.out.print("Start[" + profileData.length() + "]"); - // System.out.print("["); - // for(int x = 0; x < iorByteString.length(); x++) - // { - // System.out.print((int) iorByteString.charAt(x) + ","); - // } - // System.out.println("]"); - - iorString = createIOR(iorByteString); - // System.out.println(iorString); - return iorString; - } - - - private String enc_ushort(int s) - { - char byteArray[] = {(char) ((s >>> 8) & 0xFF), - (char) ((s >>> 0) & 0xFF)}; - - return new String(byteArray); - } - - private String enc_ulong(int l) - { - char byteArray[] = {(char) ((l >>> 24) & 0xFF), - (char) ((l >>> 16) & 0xFF), - (char) ((l >>> 8) & 0xFF), - (char) ((l >>> 0) & 0xFF)}; - - return new String(byteArray); - - } - - private String createIOR(String bytes) - { - int i; - StringBuffer sb = new StringBuffer("IOR:"); - - for(i = 0; i < bytes.length(); i++) - { - int b = bytes.charAt(i); - if(b<0) b+= 256; - int n1 = b / 16; - int n2 = b % 16; - int c1 = (n1 < 10) ? ('0' + n1) : ('a' + (n1 - 10)); - int c2 = (n2 < 10) ? ('0' + n2) : ('a' + (n2 - 10)); - sb.append((char)c1); - sb.append((char)c2); - } - - return sb.toString(); - } - - private String align(String buffer, int alignment) - { - String s = buffer; - char nullbyte[] = {0}; - - int remainder = alignment - (buffer.length() % alignment); - if (remainder == alignment) return s; - - for (int i = 0; i < remainder; i++) - { - s += new String(nullbyte); - } - return s; - } - - -} diff --git a/lib/orber/doc/src/Orber/Makefile b/lib/orber/doc/src/Orber/Makefile deleted file mode 100644 index 16a3994499..0000000000 --- a/lib/orber/doc/src/Orber/Makefile +++ /dev/null @@ -1,71 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1997-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk - -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../../vsn.mk -VSN=$(ORBER_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/orber-$(VSN) - -# -# JAVA macros -# -JAVA_CLASSES = \ - InitialReference - -JAVA_FILES= $(JAVA_CLASSES:%=%.java) - -CLASSPATH = ../.. - -# ---------------------------------------------------- -# Flags -# ---------------------------------------------------- -JAVA_OPTIONS = - -# ---------------------------------------------------- -# Make Rules -# ---------------------------------------------------- - -debug opt: - -clean: - -docs: - -# ---------------------------------------------------- -# Release Targets -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: opt - $(INSTALL_DIR) $(RELSYSDIR)/java_src/Orber - $(INSTALL_DATA) $(JAVA_FILES) $(RELSYSDIR)/java_src/Orber - -release_docs_spec: - diff --git a/lib/orber/doc/src/any.xml b/lib/orber/doc/src/any.xml deleted file mode 100644 index c94a2132d8..0000000000 --- a/lib/orber/doc/src/any.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - -
- - 19982017 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - any - - - - 1998-04-20 - A -
- any - the corba any type - -

This module contains functions that gives an interface to the CORBA any type.

-

Note that the any interface in orber does not contain a destroy - function because the any type is represented as an Erlang record and - therefor will be removed by the garbage collector when not in use.

-

The type TC used below describes an IDL type and is a tuple according - to the to the Erlang language mapping.

-

The type Any used below is defined as:

- -record(any, {typecode, value}). -

where typecode is a TC tuple and value is an Erlang term of - the type defined by the typecode field.

-
- - - create() -> Result - create(Typecode, Value) -> Result - Create an any record - - Typecode = TC - Value = term() - Result = Any - - -

The create/0 function creates an empty any record and the create/2 - function creates an initialized record.

-
-
- - set_typecode(A, Typecode) -> Result - Set the typecode field - - A = Any - Typecode = TC - Result = Any - - -

This function sets the typecode of A and returns a - new any record.

-
-
- - get_typecode(A) -> Result - Fetch the typecode - - A = Any - Result = TC - - -

This function returns the typecode of A.

-
-
- - set_value(A, Value) -> Result - Set the value field - - A = Any - Value = term() - Result = Any - - -

This function sets the value of A and returns a - new any record.

-
-
- - get_value(A) -> Result - Fetch the value - - A = Any - Result = term() - - -

This function returns the value of A. -

-
-
-
- -
- diff --git a/lib/orber/doc/src/book.xml b/lib/orber/doc/src/book.xml deleted file mode 100644 index 81bd5a8f65..0000000000 --- a/lib/orber/doc/src/book.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - -
- - 19972016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - orber - - - 1998-04-25 - 2.0 -
- - - Orber - - - - - - - - - - - - - - -
- diff --git a/lib/orber/doc/src/ch_contents.xml b/lib/orber/doc/src/ch_contents.xml deleted file mode 100644 index b783e63aee..0000000000 --- a/lib/orber/doc/src/ch_contents.xml +++ /dev/null @@ -1,173 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - The Orber Application - - - 1998-05-05 - B - ch_contents.xml -
- -
- Content Overview -

The Orber documentation is divided into three sections: -

- - -

PART ONE - The User's Guide -

-Description of the Orber Application including IDL-to-Erlang - language mapping, services and a small tutorial demonstrating - the development of a simple service.

-
- -

PART TWO - Release Notes -

-A concise history of Orber.

-
- -

PART THREE - The Reference Manual -

- A quick reference guide, including a - brief description, to all the functions available in Orber.

-
-
-
- -
- Brief Description of the User's Guide -

The User's Guide contains the following parts:

- - -

ORB kernel and IIOP support

-
- -

Interface Repository

-
- -

IDL to Erlang mapping

-
- -

CosNaming Service

-
- -

Resolving initial reference from Java or C++

-
- -

Tutorial - creating a simple service

-
- -

CORBA Exceptions

-
- -

Interceptors

-
- -

OrberWeb

-
- -

Debugging -

-
-
- -
- ORB Kernel and IIOP Support -

The ORB kernel which has IIOP support will allow the creation - of persistent server objects in Erlang. These objects can also - be accessed via Erlang and Java environments. For the moment a - Java enabled ORB is needed to generate Java from IDL to use - Java server objects (this has been tested using OrbixWeb).

-
- -
- Interface Repository -

The IFR is an interface repository used for some type-checking - when coding/decoding IIOP. The IFR is capable of storing all - interfaces and declarations of OMG IDL.

-
- -
- IDL to Erlang Mapping -

The OMG IDL mapping for Erlang, which is necessary to access the - functionality of Orber, is described, The mapping structure is - included as the basic and the constructed OMG IDL types - references, invocations and Erlang characteristics. An example is - also provided.

-
- -
- CosNaming Service -

Orber contains a CosNaming compliant service.

-
- -
- Resolving Initial References from Java or C++ -

A couple of classes are added to Orber to simplify initial - reference access from Java or C++. -

-

Resolving initial reference from Java

- A class with only one method which returns an Interoperable Object Referenceon the - external string format to the INIT object (see "Interoperable - Naming Service" specification).

-

Resolving initial reference from C++

- - A class (and header file) with only one method which returns - an IOR on the external string format to the INIT object (see - "Interoperable Naming Service" specification).

-
- -
- Orber Stub/Skeleton -

An example which describes the API and behavior of Orber stubs and skeletons.

-
- -
- CORBA Exceptions -

A listing of all system exceptions supported by Orber and how one should - handle them. This chapter also describe how to generate user defined - exceptions.

-
- -
- Interceptors -

Descibes how to implement and activate interceptors.

-
- -
- OrberWeb -

Offers the possibility to administrate and supervise Orber via a GUI.

-
- -
- Debugging -

Describes how to use different tools when debugging and/or developing - new applications using Orber. Also includes a FAQ, which deal with - the most common mistakes when using Orber. -

-
-
-
- diff --git a/lib/orber/doc/src/ch_debugging.xml b/lib/orber/doc/src/ch_debugging.xml deleted file mode 100644 index debac4313e..0000000000 --- a/lib/orber/doc/src/ch_debugging.xml +++ /dev/null @@ -1,210 +0,0 @@ - - - - -
- - 20012017 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Debugging - - - 2001-11-29 - - ch_debugging.xml -
- -
- Tools and FAQ -

Persons who use Orber for the first time may find it hard to tell what goes - wrong when trying to setup communication between an Orber-ORB and ORB:s supplied - by another vendor or another Orber-ORB. The purpose of this chapter is to inform - about the most common mistakes and what tools one can use to overcome these - problems.

- -
- Tools -

To begin with, Orber can be configured to run in debug mode. There are four ways - to set this parameter:

- - erl -orber orber_debug_level 10 - can be added to a start-script. - corba:orb_init([{orber_debug_level, 10}]) - this operation must - be invoked before starting Orber. - orber:configure(orber_debug_level, 10) - this operation can - be invoked at any time. - OrberWeb - via the Configuration menu one can easily change - the configuration. For more information, see the OrberWeb chapter in this - User's Guide. - -

When Orber runs i debug mode, printouts will be generated if anything abnormal occurs - (not necessarily an error). An error message typically looks like:

- -=ERROR REPORT==== 29-Nov-2001::14:09:55 === -=================== Orber ================= -[410] corba:common_create(orber_test_server, [{pseudo,truce}]); -not a boolean(truce). -=========================================== - -

In the example above, we tried to create an object with an incorrect option (i.e. should - have been {pseudo,true}).

-

If you are not able to solve the problem, you should include all generated reports when - contacting support or using the erlang-questions mailing list.

-

It is easy to forget to, for example, set all fields in a struct, which - one may not discover when developing an application using Orber. When using - a typed language, such faults would cause a compile time error. To avoid - these mistakes, Orber allows the user to activate automatic typechecking - of all local invocations of CORBA Objects. For this feature to be really - useful, the user must create test suites which cover as much as - possible. For example, invoking an operation with invalid or incorrect - arguments should also be tested. This option can be activated for one object - or all object via:

- - 'MyModuyle_MyInterface':oe_create(Env, [{local_typecheck, true}]) - - This approach will only activate, or deactivate, typechecking for - the returned instance. Naturally, this option can also be passed - to oe_create_link/2, corba:create/4 and - corba:create_link/4. - erl -orber flags 2 - can be added to a start-script. - All object invocations will be typechecked, unless overridden by the - previous option. - corba:orb_init([{flags, 16#0002}]) - this operation must - be invoked before starting Orber. Behaves as the previous - option. - -

If incorrect data is passed or returned, Orber uses the error_logger - to generate logs, which can look like:

- -=ERROR REPORT==== 10-Jul-2002::12:36:09 === -========= Orber Typecheck Request ========= -Invoked......: MyModule_MyInterface:foo/1 -Typecode.....: [{tk_enum,"IDL:MyModule/enumerant:1.0", - "enumerant", - ["one","two"]}] -Arguments....: [three] -Result.......: {'EXCEPTION',{'MARSHAL',[],102,'COMPLETED_NO'}} -=========================================== - -

Note, that the arity is equivalent to the IDL-file. In the example above, - an undefined enumerant was used. In most cases, it is useful to set the - configuration parameter orber_debug_level 10 as well. Due to the - extra overhead, this option MAY ONLY be used during testing and - development. - For more information, see also - configuration settings.

-

It is also possible to trace all communication between an Orber-ORB and, for example, - a Java-ORB, communicating via IIOP. All you need to do is to activate an - interceptor. Normally, the users must - implement the interceptor themselves, but for your convenience Orber includes three - pre-compiled interceptors called orber_iiop_tracer, - orber_iiop_tracer_silent and orber_iiop_tracer_stealth.

- -

Logging all traffic is expensive. Hence, only use the supplied - interceptors during test and development.

-
-

The orber_iiop_tracer and orber_iiop_tracer_silent interceptors - uses the error_logger module to generate the logs. If the traffic - is intense you probably want to write the reports to a log-file. - This is done by, for example, invoking:

- -erl> error_logger:tty(false). -erl> error_logger:logfile({open, "/tmp/IIOPTrace"}). - -

The IIOPTrace file will contain, if you use the orber_iiop_tracer - interceptor, reports which looks like:

- -=INFO REPORT==== 13-Jul-2005::18:22:39 === -=============== new_out_connection ======= -Node : myNode@myHost -From : 192.0.0.10:47987 -To : 192.0.0.20:4001 -========================================== - -=INFO REPORT==== 29-Nov-2001::15:26:28 === -=============== out_request ============== -Connection: {"192.0.0.20",4001,"192.0.0.10",47987} -Operation : resolve -Parameters: [[{'CosNaming_NameComponent', - "AIK","SwedishIcehockeyChampions"}]] -Context : [{'IOP_ServiceContext',1, - {'CONV_FRAME_CodeSetContext',65537,65801}}] -========================================== - -

The orber_iiop_tracer_silent will not log GIOP encoded data. To activate - one the interceptors, you have two options:

- - erl -orber interceptors "{native,[orber_iiop_tracer]}" - can be added to a start-script. - corba:orb_init([{interceptors, {native, [orber_iiop_tracer_silent]}}]) - this operation must - be invoked before starting Orber. - -

It is also possible to active and deactivate an interceptor during - run-time, but this will only affect currently existing connections. - For more information, consult Orber's Reference Manual regarding the - operations orber:activate_audit_trail/0/1 and - orber:activate_audit_trail/0/1.

-
- -
- FAQ -

Q: When my client, typically written in C++ or Java, invoke narrow on an Orber object reference it fails?

-

A: You must register your application in the IFR by invoking oe_register(). - If the object was created by a COS-application, you must run install - (e.g. cosEventApp:install()).

-

A: Confirm, by consulting the IDL specifications, that the received object reference really - inherit from the interface you are trying to narrow it to.

-

-

Q: I am trying to register my application in the IFR but it fails. Why?

-

A: If one, or more, interface in your IDL-specification inherits from - other interface(s), you must register them before registering your - application. Note, this also apply when you inherit interfaces - supported by a COS-application. Hence, they must be installed prior to - registration of your application.

-

-

Q: I have a Orber client and server residing on two different Orber instances but I only get the 'OBJECT_NOT_EXIST' exception, even though I am sure that the object is still alive?

-

A: If the two Orber-ORB's are not intended to be a part of multi-node ORB, make sure that the - two Orber-ORB's have different domain names set (see - configuration settings). The easiest way - to confirm this is to invoke orber:info() on each node.

-

-

Q: When I'm trying to install and/or start Orber it fails?

-

A: Make sure that no other Orber-ORB is already running on the same node. If so, - change the iiop_port configuration parameter (see - configuration settings).

-

-

Q: My Orber server is invoked via IIOP but Orber cannot marshal the reply?

-

A: Consult your IDL file to confirm that your replies are of the correct - type. If it is correct and the return type is, for example, - a struct, make sure you have set every field in the struct. If - you do not do that it will be set to the atom 'undefined', which - most certainly is not correct.

-

-

A: Check that you handle inout and out parameters correctly - (see the IDL specification). For example, a function which have one - out-parameter and should return void, then your call-back module - should return {reply, {ok, OutParam}, State}. Note, even though - the return value is void (IDL) you must reply with ok.

-

-

Q: I cannot run Orber as a multi-node ORB?

-

A: Make sure that the Erlang distribution have been started for each - node and the cookies are correct. For more information, - consult the System Documentation

-

-
-
-
- diff --git a/lib/orber/doc/src/ch_exceptions.xml b/lib/orber/doc/src/ch_exceptions.xml deleted file mode 100644 index 17657d0d4a..0000000000 --- a/lib/orber/doc/src/ch_exceptions.xml +++ /dev/null @@ -1,238 +0,0 @@ - - - - -
- - 20012017 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CORBA System and User Defined Exceptions - - - 2000-12-19 - - ch_exceptions.xml -
- -
- System Exceptions -

Orber, or any other ORB, may raise a System Exceptions. - These exceptions contain status- and minor-fields and may not appear in the - operations raises exception IDL-definition.

- -
- Status Field -

The status field indicates if the request was completed or not and will be - assigned one of the following Erlang atoms:

- - - Status - Description - - - 'COMPLETED_YES' - The operation was invoked on the target object but an error occurred after the object replied. This occur, for example, if a server replies but Orber is not able to marshal and send the reply to the client ORB. - - - 'COMPLETED_NO' - Orber failed to invoke the operation on the target object. This occur, for example, if the object no longer exists. - - - 'COMPLETED_MAYBE' - Orber invoked the operation on the target object but an error occurred and it is impossible to decide if the request really reached the object or not. - - System Exceptions Status -
-
- -
- Minor Field -

The minor field contains an integer (VMCID), which is related to a more - specific reason why an invocation failed. The function - orber:exception_info/1 can be used to map the minor code to a string. - Note, for VMCID:s not assigned by the OMG or Orber, the documentation - for that particular ORB must be consulted.

-
- -
- Supported System Exceptions -

The OMG CORBA specification defines the following exceptions:

- - 'BAD_CONTEXT' - if a request does not contain a correct - context this exception is raised. - 'BAD_INV_ORDER' - this exception indicates that operations - has been invoked operations in the wrong order, which would cause, - for example, a dead-lock. - 'BAD_OPERATION' - raised if the target object exists, but - that the invoked operation is not supported. - 'BAD_PARAM' - is thrown if, for example, a parameter is out - of range or otherwise considered illegal. - 'BAD_TYPECODE' - if illegal type code is passed, for example, - encapsulated in an any data type the 'BAD_TYPECODE' exception - will be raised. - 'BAD_QOS' - raised whenever an object cannot support the - required quality of service. - 'CODESET_INCOMPATIBLE' - raised if two ORB's cannot - communicate due to different representation of, for example, - char and/or wchar. - 'COMM_FAILURE' - raised if an ORB is unable to setup - communication or it is lost while an operation is in progress. - 'DATA_CONVERSION' - raised if an ORB cannot convert data - received to the native representation. See also the - 'CODESET_INCOMPATIBLE' exception. - 'FREE_MEM' - the ORB failed to free dynamic memory and - failed. - 'IMP_LIMIT' - an implementation limit was exceeded in the - ORB at run time. A object factory may, for example, limit the - number of object clients are allowed to create. - 'INTERNAL' - an internal failure occurred in an ORB, which - is unrecognized. You may consider contacting the ORB providers - support. - 'INTF_REPOS' - the ORB was not able to reach the interface - repository, or some other failure relating to the interface - repository is detected. - 'INITIALIZE' - the ORB initialization failed due to, for - example, network or configuration error. - 'INVALID_TRANSACTION' - is raised if the request carried an - invalid transaction context. - 'INV_FLAG' - an invalid flag was passed to an operation, - which caused, for example, a connection to be closed. - 'INV_IDENT' - this exception indicates that an IDL - identifier is incorrect. - 'INV_OBJREF' - this exception is raised if an object - reference is malformed or a nil reference (see - also corba:create_nil_objref/0). - 'INV_POLICY' - the invocation cannot be made due to an - incompatibility between policy overrides that apply to the - particular invocation. - 'MARSHAL' - this exception may be raised by the client- or - server-side when either ORB is unable to marshal/unmarshal requests or - replies. - 'NO_IMPLEMENT' - if the operation exists but no implementation - exists, this exception is raised. - 'NO_MEMORY' - the ORB has run out of memory. - 'NO_PERMISSION' - the caller has insufficient privileges, - such as, for example, bad SSL certificate. - 'NO_RESOURCES' - a general platform resource limit - exceeded. - 'NO_RESPONSE' - no response available of a deferred - synchronous request. - 'OBJ_ADAPTER' - indicates administrative mismatch; the object - adapter is not able to associate an object with the implementation - repository. - 'OBJECT_NOT_EXIST' - the object have been disposed or - terminated; clients should remove all copies of the object reference - and initiate desired recovery process. - 'PERSIST_STORE' - the ORB was not able to establish a - connection to its persistent storage or data contained in the - the storage is corrupted. - 'REBIND' - a request resulted in, for example, a - 'LOCATION_FORWARD' message; if the policies are incompatible - this exception is raised. - 'TIMEOUT' - raised if a request fail to complete within the - given time-limit. - 'TRANSACTION_MODE' - a transaction policy mismatch detected. - 'TRANSACTION_REQUIRED' - a transaction is required for the - invoked operation but the request contained no transaction context. - 'TRANSACTION_ROLLEDBACK' - the transaction associated with - the request has already been rolled back or will be. - 'TRANSACTION_UNAVAILABLE' - no transaction context can be - supplied since the ORB is unable to contact the Transaction - Service. - 'TRANSIENT' - the ORB could not determine the current status - of an object since it could not be reached. The error may be - temporary. - 'UNKNOWN' - is thrown if an implementation throws a - non-CORBA, or unrecognized, exception. - -
-
- -
- User Defined Exceptions -

User exceptions is defined in IDL-files and is listed in operations raises - exception listing. For example, if we have the following IDL code:

- -module MyModule { - - exception MyException {}; - exception MyExceptionMsg { string ExtraInfo; }; - - interface MyInterface { - - void foo() - raises(MyException); - - void bar() - raises(MyException, MyExceptionMsg); - - void baz(); - }; -}; - -
- -
- Throwing Exceptions -

To be able to raise MyException or MyExceptionMsg exceptions, - the generated MyModule.hrl must be included, and typical usage is:

- --module('MyModule_MyInterface_impl'). --include("MyModule.hrl"). - -bar(State) -> - case TestingSomething of - ok -> - {reply, ok, State}; - {error, Reason} when list(Reason) -> - corba:raise(#'MyModule_MyExceptionMsg'{'ExtraInfo' = Reason}); - error -> - corba:raise(#'MyModule_MyException'{}) - end. - -
- -
- Catching Exceptions -

Depending on which operation we invoke we must be able to handle:

- - foo - MyException or a system exception. - bar - MyException, MyExceptionMsg or a system - exception. - baz - a system exception. - -

Catching and matching exceptions can bee done in different ways:

- - case catch 'MyModule_MyInterface':bar(MIReference) of - ok -> - %% The operation raised no exception. - ok; - {'EXCEPTION', #'MyModule_MyExceptionMsg'{'ExtraInfo' = Reason}} -> - %% If we want to log the Reason we must extract 'ExtraInfo'. - error_logger:error_msg("Operation 'bar' raised: ~p~n", [Reason]), - ... do something ...; - {'EXCEPTION', E} when record(E, 'OBJECT_NOT_EXIST') -> - ... do something ...; - {'EXCEPTION', E} -> - ... do something ... - end. - -
-
- diff --git a/lib/orber/doc/src/ch_idl_to_erlang_mapping.xml b/lib/orber/doc/src/ch_idl_to_erlang_mapping.xml deleted file mode 100644 index eaa88f24f1..0000000000 --- a/lib/orber/doc/src/ch_idl_to_erlang_mapping.xml +++ /dev/null @@ -1,1504 +0,0 @@ - - - - -
- - 19972017 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - OMG IDL to Erlang Mapping - - - 1998-10-10 - - ch_idl_to_erlang_mapping.xml -
- -
- OMG IDL to Erlang Mapping - Overview -

The purpose of OMG IDL, Interface Definition Language, mapping - is to act as translator between platforms and languages. An IDL - specification is supposed to describe data types, object types etc.

-

CORBA is independent of the programming language used to construct - clients or implementations. In order to use the ORB, it is - necessary for programmers to know how to access ORB functionality - from their programming languages. It translates different IDL constructs - to a specific programming language. This chapter - describes the mapping of OMG IDL constructs to the Erlang programming - language.

-
- -
- OMG IDL Mapping Elements -

A complete language mapping will allow the programmer to have - access to all ORB functionality in a way that is convenient for - a specified programming language. -

-

All mapping must define the following elements: -

- - All OMG IDL basic and constructed types - References to constants defined in OMG IDL - References to objects defined in OMG IDL - Invocations of operations, including passing of - parameters and receiving of results - Exceptions, including what happens when an operation - raises an exception and how the exception parameters are - accessed - Access to attributes - Signatures for operations defined by the ORB, such as - dynamic invocation interface, the object adapters etc. - Scopes; - OMG IDL has several levels of scopes, which are mapped to Erlang's - two scopes. - -
- -
- Getting Started -

To begin with, we should decide which type of objects (i.e. servers) we - need and if two, or more, should export the same functionality. Let us - assume that we want to create a system for DB (database) access for different - kind of users. For example, anyone with a valid password may extract - data, but only a few may update the DB. Usually, an application - is defined within a module, and all global datatypes are defined - on the top-level. To begin with we create a module and the interfaces we - need:

- -// DB IDL -#ifndef _DB_IDL_ -#define _DB_IDL_ -// A module is simply a container -module DB { - - // An interface maps to a CORBA::Object. - interface CommonUser { - - }; - - // Inherit the Consumer interface - interface Administrator : CommonUser { - - }; - - interface Access { - - }; - -}; -#endif -

Since the Administrator should be able to do the same things as the - CommonUser, the previous inherits from the latter. The Access - interface will grant access to the DB. - Now we are ready to define the functionality and data types we need. But, this - requires that we know a little bit more about the OMG IDL.

- -

The OMG defines a set of reserved case insensitive key-words, which may - NOT be used as identifiers (e.g. module name). For more - information, see - Reserved Compiler Names and Keywords

-
-
- -
- Basic OMG IDL Types -

The OMG IDL mapping is strongly typed and, even if you have a good knowledge - of CORBA types, it is essential to read carefully the following mapping to - Erlang types.

-

The mapping of basic types is straightforward. Note that the - OMG IDL double type is mapped to an Erlang float which does not - support the full double value range.

- - - OMG IDL type - Erlang type - Note - - - float - Erlang float - - - - double - Erlang float - value range not supported - - - short - Erlang integer - -2^15 .. 2^15-1 - - - unsigned short - Erlang integer - 0 .. 2^16-1 - - - long - Erlang integer - -2^31 .. 2^31-1 - - - unsigned long - Erlang integer - 0 .. 2^32-1 - - - long long - Erlang integer - -2^63 .. 2^63-1 - - - unsigned long long - Erlang integer - 0 .. 2^64-1 - - - char - Erlang integer - ISO-8859-1 - - - wchar - Erlang integer - UTF-16 (ISO-10646-1:1993) - - - boolean - Erlang atom - true/false - - - octet - Erlang integer - - - - any - Erlang record - #any{typecode, value} - - - long double - Not supported - - - - Object - Orber object reference - Internal Representation - - - void - Erlang atom - ok - - OMG IDL basic types -
-

The any value is written as a record with the field typecode which - contains the Type Code is a full definition of a type representation, - see also the Type Code table, - and the value field itself.

-

Functions with return type void will return the atom ok.

-
- -
- Template OMG IDL Types and Complex Declarators -

Constructed types all have native mappings as shown in the table - below.

- - - Type - IDL code - Maps to - Erlang code - - - string - typedef string S;

-void op(in S a);
- Erlang string - ok = op(Obj, "Hello World"), -
- - wstring - typedef wstring S;

-void op(in S a);
- Erlang list of Integers - ok = op(Obj, "Hello World"), -
- - sequence - typedef sequence <long, 3> S;

-void op(in S a);
- Erlang list - ok = op(Obj, [1, 2, 3]), -
- - array - typedef string S[2];

-void op(in S a);
- Erlang tuple - ok = op(Obj, {"one", "two"}), -
- - fixed - typedef fixed<3,2> myFixed;

-void op(in myFixed a);
- Erlang tuple - MF = fixed:create(3, 2, 314),

-ok = op(Obj, MF),
-
- OMG IDL Template and Complex Declarators -
- -
- String/WString Data Types -

A string consists of all possible 8-bit quantities except null. - Most ORB:s uses, including Orber, the character set Latin-1 (ISO-8859-1). - The wstring type is represented as a list of integers, where - each integer represents a wide character. In this case Orber uses, as - most other ORB:s, the UTF-16 (ISO-10646-1:1993) character set.

-

When defining a a string or wstring they can be of limited length or - null terminated:

- myString10; -typedef wstring<10> myWString10; - ]]> -

If we want to define a char/string or wchar/wstring constant, we can - use octal (\OOO - one, two or three octal digits), - hexadecimal (\xHH - one or two hexadecimal digits) and unicode (\uHHHH - - one, two, three or four hexadecimal digits.) representation as well. - For example:

- -const string SwedensBestSoccerTeam = "\101" "\x49" "\u004B"; -const wstring SwedensBestHockeyTeam = L"\101\x49\u004B"; -const char aChar = '\u004B'; -const wchar aWchar = L'\u004C'; - -

Naturally, we can use "Erlang", L"Rocks", 'A' - and L'A' as well.

-
- -
- Sequence Data Type -

A sequence can be defined to be of a maximum length or unbounded, and may - contain Basic and Template types and scoped names:

- aShortSequence; -typedef sequence aLongSequence; -typedef sequence anEvenLongerSequence; - ]]> -
- -
- Array Data Type -

Arrays are multidimensional, fixed-size arrays. The indices is language - mapping specific, which is why one should not pass them as arguments - to another ORB.

- -typedef long myMatrix[2][3]; - -
- -
- Fixed Data Type -

A Fixed Point literal consists of an integer part (decimal digits), - decimal point and a fraction part (decimal digits), - followed by a D or d. Either the integer part or the - fraction part may be missing; the decimal point may be missing, - but not d/D. The integer part must be a positive integer less than 32. - The Fraction part must be a positive integer less than or equal to - the Integer part.

- -const fixed myFixed1 = 3.14D; -const fixed myFixed2 = .14D; -const fixed myFixed3 = 0.14D; -const fixed myFixed4 = 3.D; -const fixed myFixed5 = 3D; - -

It is also possible to use unary (+-) and binary (+-*/) operators:

- -const fixed myFixed6 = 3D + 0.14D; -const fixed myFixed7 = -3.14D; - -

The Fixed Point examples above are, so called, anonymous - definitions. In later CORBA specifications these have been deprecated - as function parameters or return values. Hence, we strongly recommend that - you do not use them. Instead, you should use:

- myFixed53; -const myFixed53 myFixed53constant = 03.140d; -typedef fixed<3,2> myFixed32; -const myFixed32 myFixed32constant = 3.14d; - -myFixed53 foo(in myFixed32 MF); // OK -void bar(in fixed<5,3> MF); // Illegal - ]]> -
-

For more information, see Fixed in - Orber's Reference Manual.

-

Now we continue to work on our IDL specification. To begin with, we want - to limit the size of the logon parameters (Id and password). Since the - UserID and Password parameters, only will be used when - invoking operations on the Access interface, we may choose to define - them within the scope that interface. To keep it simple our DB will contain - employee information. Hence, as the DB key we choose an integer - (EmployeeNo).

- UserID; - typedef string<10> Password; - - CommonUser logon(in UserID ID, in Password PW); - - }; - -}; -#endif ]]> -

But what should, for example, the lookup operation return? One option - is to use the any data type. But, depending on what kind of data it - encapsulates, this datatype can be rather expensive to use. We might find a - solution to our problems among the Constructed IDL types.

-
- -
- Constructed OMG IDL Types -

Constructed types all have native mappings as shown in the table - below.

- - - Type - IDL code - Maps to - Erlang code - - - struct - struct myStruct {

-long a;

-short b;

-};

-void op(in myStruct a);
- Erlang record - ok = op(Obj, #'myStruct'{a=300, b=127}), -
- - union - union myUnion switch(long) {

-case 1: long a;

-};

-void op(in myUnion a);
- Erlang record - ok = op(Obj, #'myUnion'{label=1, value=66}), -
- - enum - enum myEnum {one, two};

-void op(in myEnum a);
- Erlang atom - ok = op(Obj, one), -
- OMG IDL constructed types -
- -
- Struct Data Type -

A struct may have Basic, Template, Scoped Names and Constructed - types as members. By using forward declaration we can define a recursive struct:

- myStructSeq; -struct myStruct { - myStructSeq chain; -}; - -// Deprecated definition (anonymous) not supported by IC -struct myStruct { - sequence chain; -}; - ]]> -
- -
- Enum Data Type -

The maximum number of identifiers which may defined in an enumeration - is 2³². The order in which the identifiers are named in the - specification of an enumeration defines the relative order of the - identifiers.

-
- -
- Union Data Type -

A union may consist of:

- - Identifier - Switch - may be an integer, char, boolean, enum or scoped name. - Body - with or without a default case; may appear at - most once. - -

A case label must match the defined type of the discriminator, and may only - contain a default case if the values given in the non-default labels do - not cover the entire range of the union's discriminant type. For example:

- -// Illegal default; all cases covered by -// non-default cases. -union BooleanUnion switch(boolean) { - case TRUE: long TrueValue; - case FALSE: long FalseValue; - default: long DefaultValue; -}; -// OK -union BooleanUnion2 switch(boolean) { - case TRUE: long TrueValue; - default: long DefaultValue; -}; - -

It is not necessary to list all possible values of the union discriminator - in the body. Hence, the value of a union is the value of the discriminator - and, in given order, one of the following:

- - If the discriminator match a label, explicitly listed in a - case statement, the value must be of the same type. - If the union contains a default label, the value must match the - type of the default label. - No value. Orber then inserts the Erlang atom undefined - in the value field when receiving a union from an external - ORB. - -

The above can be summed up to:

- -// If the discriminator equals 1 or 2 the value -// is a long. Otherwise, the atom undefined. -union LongUnion switch(long) { - case 1: - case 2: long TrueValue; -}; -// If the discriminator equals 1 or 2 the value -// is a long. Otherwise, a boolean. -union LongUnion2 switch(long) { - case 1: - case 2: long TrueValue; - default: boolean DefaultValue; -}; - -

In the same way as structs, unions can be recursive if forward - declaration is used (anonymous types is deprecated and not supported):

- myUnionSeq; -union myUnion switch (long) { - case 1 : myUnionSeq chain; - default: boolean DefaultValue; -}; - ]]> - - -

Recursive types (union and struct) require Light IFR. I.e. the - IC option {light_ifr, true} is used and that Orber is configured in such a way that - Light IFR is activated. Recursive TypeCode is currently not supported, which is - why these cannot be encapsulated in an any data type.

-
- -
- -

Every field in, for example, a struct must be initiated. Otherwise - it will be set to the atom undefined, which Orber cannot - encode when communicating via IIOP. In the example above, invoking - the operation with #'myStruct'{a=300} will fail (equal to - #'myStruct'{a=300, b=undefined})

-
-

Now we can continue to work on our IDL specification. To begin with, we should - determine the return value of the lookup operation. Since the any - type can be rather expensive we can use a struct or a union instead. - If we intend to return the same information about a employee every time we can - use a struct. Let us assume that the DB contains the name, address, employee - number and department.

- UserID; - typedef string<10> Password; - - // Since Administrator inherits from CommonUser - // the returned Object can be of either type. - CommonUser logon(in UserID ID, in Password PW); - - }; - -}; -#endif ]]> -

We can also define exceptions (i.e. not system exception) thrown by - each interface. Since exceptions are thoroughly described in the chapter - System and User Defined Exceptions, - we choose not to. Hence, we are now ready to compile our IDL-file by - invoking:

-
-$ erlc DB.idl
-    
-

or:

-
-$ erl
-Erlang (BEAM) emulator version 5.1.1 [threads:0]
-
-Eshell V5.1.1  (abort with ^G)
-1> ic:gen('DB').
-ok
-2> halt().
-    
-

The next step is to implement our servers. But, to be able to do that, - we need to know how we can access data type definitions. For example, - since a struct is mapped to an Erlang record we must include an hrl-file - in our callback module.

-
- -
- Scoped Names and Generated Files - -
- Scoped Names -

Within a scope all identifiers must be unique. The following kinds of - definitions form scopes in the OMG IDL:

- - module - interface - operation - valuetype - struct - union - exception - -

For example, since enumerants do not form a scope, the following IDL code - is not valid:

- -module MyModule { - // 'two' is not unique - enum MyEnum {one, two}; - enum MyOtherEnum {two, three}; -}; - -

But, since Erlang only has two levels of scope, module and - function, the OMG IDL scope is mapped as follows:

- - Function Scope - used for constants, operations and attributes. - Erlang Module Scope - the Erlang module scope - handles the remaining OMG IDL scopes. - -

An Erlang module, corresponding to an IDL global name, is derived by - converting occurrences of "::" to underscore, and eliminating - the leading "::". Hence, accessing MyEnum from another module, one - use MyModule::MyEnum

-

For example, an operation foo defined in interface I, which - is defined in module M, would be written in IDL as M::I::foo - and as 'M_I':foo in Erlang - foo is the function - name and 'M_I' is the name of the Erlang module. Applying this - knowledge to a stripped version of the DB.idl gives:

- UserID; - typedef string<10> Password; - - // Since Administrator inherits from CommonUser - // the returned Object can be of either type. - // This operation is exported from: - // DB_Access.erl - CommonUser logon(in UserID ID, in Password PW); - - }; - -}; -#endif ]]> -

Using underscores in IDL names can lead to ambiguities - due to the name mapping described above. It is advisable to - avoid the use of underscores in identifiers. For example, the following - definition would generate two structures named x_y_z.

- -module x { - - struct y_z { - ... - }; - - interface y { - - struct z { - ... - }; - }; -}; - -
- -
- Generated Files -

Several files can be generated for each scope.

- - An Erlang source code file (.erl) is generated - for top level scope as well as the Erlang header file. - An Erlang header file (.hrl) will be generated for - each scope. The header file will contain record definitions - for all struct, union and exception - types in that scope. - Modules that contain at least one constant definition, - will produce Erlang source code files (.erl). - That Erlang file will contain constant functions for - that scope. - Modules that contain no constant definitions are considered - empty and no code will be produced for them, but only for - their included modules/interfaces. - Interfaces will produce Erlang source code files (.erl), - this code will contain all operation stub code and implementation - functions. - In addition to the scope-related files, an Erlang source file will - be generated for each definition of the types struct, - union and exception (these are the types that - will be represented in Erlang as records). - This file will contain special access functions for that record. - The top level scope will produce two files, one header file - (.hrl) and one Erlang source file (.erl). - These files are named as the IDL file, prefixed with oe_. - -

After compiling DB.idl, the following files have been generated:

- - oe_DB.hrl and oe_DB.erl for the top scope level. - DB.hrl for the module DB. - DB_Access.hrl and DB_Access.erl for the interface - DB_Access. - DB_CommonUser.hrl and DB_CommonUser.erl for the interface - DB_CommonUser. - DB_Administrator.hrl and DB_Administrator.erl for the interface - DB_Administrator. - DB_employee.erl for the structure employee in module - DB. - -

Since the employee struct is defined in the top level scope, - the Erlang record definition is found in DB.hrl. IC also generates - stubs/skeletons (e.g. DB_CommonUser.erl) and access functions for - some datatypes (e.g. DB_employee.erl). How the stubs/skeletons are - used is thoroughly described in - Stubs/Skeletons and - Module_Interface.

-
-
- -
- Typecode, Identity and Name Access Functions -

As mentioned in a previous section, struct, union and - exception types yield record definitions and access code - for that record. - For struct, union, exception, array and - sequence types, a special file is generated that holds access - functions for TypeCode, Identity and Name. - These functions are put in the file corresponding to the scope where - they are defined. For example, the module DB_employee.erl, - representing the employee struct, exports the following functions:

- - tc/0 - returns the type code for the struct. - id/0 - returns the IFR identity of the struct. In this case - the returned value is "IDL:DB/employee:1.0", but - if the struct was defined in the scope of CommonUser, - the result would be "IDL:DB/CommonUser/employee:1.0". - However, the user usually do not need to know the Id, just - which Erlang module contains the correct Id. - name/0 - returns the scoped name of the struct. The employee - struct name is "DB_employee". - -

Type codes give a complete description of the type including all its components and structure.are, for example, used in Any values. - Hence, we can encapsulate the employee struct in an any - type by:

- -%% Erlang code -.... -AnEmployee = #'DB_employee'{'No' = 1, - 'Name' = "Adam Ivan Kendall", - 'Address' = "Rasunda, Solna", - 'Dpt' = 'Department1'}, -EmployeeTC = 'DB_employee':tc(), -EmployeeAny = any:create(EmployeeTC, AnEmployee), -.... - -

For more information, see the - Type Code listing.

-
- -
- References to Constants -

Constants are generated as Erlang functions, and are accessed by a - single function call. The functions are put in the file - corresponding to the scope where they are defined. There is no - need for an object to be started to access a constant.

-

Example:

- -// m.idl -module m { - const float pi = 3.14; - - interface i { - const float pi = 3.1415; - }; -}; - -

Since the two constants are defined in different scopes, the IDL code - above is valid, but not necessarily a good approach. After compiling - m.idl, the constant definitions can be extracted by invoking:

-
-$ erlc m.idl
-$ erlc m.erl
-$ erl
-Erlang (BEAM) emulator version 5.1.1 [threads:0]
-
-Eshell V5.1.1  (abort with ^G)
-1> m:pi().
-3.14
-2> m_i:pi().
-3.1415
-3> halt().
-    
-
- -
- References to Objects Defined in OMG IDL -

Objects are accessed by object references. An object reference - is an opaque Erlang term created and maintained by the ORB.

-

Objects are implemented by providing implementations for all - operations and attributes of the Object, see operation implementation.

-
- -
- Exceptions -

Exceptions are handled as Erlang catch and throws. Exceptions - are translated to messages over an IIOP bridge but converted - back to a throw on the receiving side. Object implementations - that invoke operations on other objects must be aware of the - possibility of a non-local return. This includes invocation of - ORB and IFR services. See also the - Exceptions section.

-

Exception parameters are mapped as an Erlang record and accessed - as such.

-

An object implementation that raises an exception will use the - corba:raise/1 function, passing the exception record as - parameter.

-
- -
- Access to Attributes -

Attributes are accessed through their access functions. An - attribute implicitly defines the _get and _set - operations. These operations are handled in the same way as - normal operations. The _get operation is defined as a readonly - attribute.

- -readonly attribute long RAttribute; -attribute long RWAttribute; - -

The RAttribute requires that you implement, in your call-back module, - _get_RAttribute. For the RWAttribute it is necessary to implement - _get_RWAttribute and _set_RWAttribute.

-
- -
- Invocations of Operations - -

A standard Erlang gen_server behavior is used for - object implementation. The gen_server state is then - used as the object internal state. Implementation of the object - function is achieved by implementing its methods and attribute operations. - These functions will usually have the internal state as their first parameter, - followed by any in and inout parameters.

-

Do not confuse the - object internal state with its object reference. The object internal state is - an Erlang term which has a format defined by the user.

- -

It is not always the case that the internal state will be the first parameter, as stubs can use their own object reference as the first parameter (see the IC documentation).

-
-

A function call will invoke an operation. The first - parameter of the function should be the object reference and then - all in and inout parameters follow in the same - order as specified in the IDL specification. The result will be a return value - unless the function has inout or out parameters specified; - in which case, a tuple of the return value, followed by the parameters will - be returned.

-

Example:

- -// IDL -module m { - interface i { - readonly attribute long RAttribute; - attribute long RWAttribute; - long foo(in short a); - long bar(in char c, inout string s, out long count); - void baz(out long Id); - }; -}; - -

Is used in Erlang as :

- -%% Erlang code -.... -Obj = ... %% get object reference -RAttr = m_i:'_get_RAttribute'(Obj), -RWAttr = m_i:'_get_RWAttribute'(Obj), -ok = m_i:'_set_RWAttribute'(Obj, Long), -R1 = m_i:foo(Obj, 55), -{R2, S, Count} = m_i:bar(Obj, $a, "hello"), -.... - -

Note how the inout parameter is passed and - returned. There is no way to use a single occurrence of a - variable for this in Erlang. Also note, that ok, Orber's - representation of the IDL-type void, must be returned by - baz and '_set_RWAttribute'. - These operations can be implemented in the call-back module as:

- -'_set_RWAttribute'(State, Long) -> - {reply, ok, State}. - -'_get_RWAttribute'(State) -> - {reply, Long, State}. - -'_get_RAttribute'(State) -> - {reply, Long, State}. - -foo(State, AShort) -> - {reply, ALong, State}. - -bar(State, AShort, AString) -> - {reply, {ALong, "MyString", ALong}, State}. - -baz(State) -> - {reply, {ok, AId}, State}. - -

The operations may require more arguments (depends on IC options used). For - more information, see Stubs/Skeletons - and Module_Interface.

- -

A function can also be defined to be oneway, i.e. - asynchronous. But, since the behavior of a oneway operation is not - defined in the OMG specifications (i.e. the behavior can differ depending on - which other ORB Orber is communicating with), one should avoid using it.

-
-
- -
- Implementing the DB Application -

Now we are ready to implement the call-back modules. There are three modules - we must create:

- - DB_Access_impl.erl - DB_CommonUser_impl.erl - DB_Administrator_impl.erl - -

An easy way to accomplish that, is to use the IC backend erl_template, - which will generate a complete call-back module. One should also add - the same compile options, for example this or from, - used when generating the stub/skeleton modules:

- -$> erlc +"{be,erl_template}" DB.idl - -

We begin with implementing the DB_Access_impl.erl module, which, - if we used erl_template, will look like the following. All we need - to do is to add the logic to the logon operation.

- -%% -%% $Id$ -%% -%%---------------------------------------------------------------------- -%% Module : DB_Access_impl.erl -%% -%% Source : /home/user/example/DB.idl -%% -%% Description : -%% -%% Creation date: 2005-05-20 -%% -%%---------------------------------------------------------------------- --module('DB_Access_impl'). - --export([logon/3]). - -%%---------------------------------------------------------------------- -%% Internal Exports -%%---------------------------------------------------------------------- --export([init/1, - terminate/2, - code_change/3, - handle_info/2]). - -%%---------------------------------------------------------------------- -%% Include Files -%%---------------------------------------------------------------------- - - -%%---------------------------------------------------------------------- -%% Macros -%%---------------------------------------------------------------------- - - -%%---------------------------------------------------------------------- -%% Records -%%---------------------------------------------------------------------- --record(state, {}). - -%%====================================================================== -%% API Functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : logon/3 -%% Arguments : State - term() -%% ID = String() -%% PW = String() -%% Returns : ReturnValue = OE_Reply -%% OE_Reply = Object_Ref() -%% Raises : -%% Description: -%%---------------------------------------------------------------------- -logon(State, ID, PW) -> - %% Check if the ID/PW is valid and what - %% type of user it is (Common or Administrator). - OE_Reply - = case check_user(ID, PW) of - {ok, administrator} -> - 'DB_Administrator':oe_create(); - {ok, common} -> - 'DB_CommonUser':oe_create(); - error -> - %% Here we should throw an exception - corba:raise(....) - end, - {reply, OE_Reply, State}. - -%%====================================================================== -%% Internal Functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : init/1 -%% Arguments : Env = term() -%% Returns : {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Raises : - -%% Description: Initiates the server -%%---------------------------------------------------------------------- -init(_Env) -> - {ok, #state{}}. - - -%%---------------------------------------------------------------------- -%% Function : terminate/2 -%% Arguments : Reason = normal | shutdown | term() -%% State = term() -%% Returns : ok -%% Raises : - -%% Description: Invoked when the object is terminating. -%%---------------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - - -%%---------------------------------------------------------------------- -%% Function : code_change/3 -%% Arguments : OldVsn = undefined | term() -%% State = NewState = term() -%% Extra = term() -%% Returns : {ok, NewState} -%% Raises : - -%% Description: Invoked when the object should update its internal state -%% due to code replacement. -%%---------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - - -%%---------------------------------------------------------------------- -%% Function : handle_info/2 -%% Arguments : Info = normal | shutdown | term() -%% State = NewState = term() -%% Returns : {noreply, NewState} | -%% {noreply, NewState, Timeout} | -%% {stop, Reason, NewState} -%% Raises : - -%% Description: Invoked when, for example, the server traps exits. -%%---------------------------------------------------------------------- -handle_info(_Info, State) -> - {noreply, State}. - ]]> -

Since DB_Administrator inherits from DB_CommonUser, - we must implement delete in the DB_Administrator_impl.erl - module, and lookup in DB_Administrator_impl.erlandDB_CommonUser_impl.erl. But wait, is that really necessary? Actually, - it is not. We simple use the IC compile option impl:

-
-$ erlc +'{{impl, "DB::CommonUser"}, "DBUser_impl"}'\
- +'{{impl, "DB::Administrator"}, "DBUser_impl"}' DB.idl
-$ erlc *.erl
-    
-

Instead of creating, and not the least, maintaining two call-back modules, - we only have to deal with DBUser_impl.erl. If we generated the - templates, we simply rename DB_Administrator_impl.erl to - DBUser_impl.erl. See also the - Exceptions chapter. - In the following example, only the implementation of the API functions - are shown:

- -%%====================================================================== -%% API Functions -%%====================================================================== -%%---------------------------------------------------------------------- -%% Function : delete/2 -%% Arguments : State - term() -%% ENo = unsigned_Long() -%% Returns : ReturnValue = ok -%% Raises : -%% Description: -%%---------------------------------------------------------------------- -delete(State, ENo) -> - %% How we access the DB, for example mnesia, is not shown here. - case delete_employee(No) of - ok -> - {reply, ok, State}; - error -> - %% Here we should throw an exception if - %% there is no match. - corba:raise(....) - end. - -%%---------------------------------------------------------------------- -%% Function : lookup/2 -%% Arguments : State - term() -%% ENo = unsigned_Long() -%% Returns : ReturnValue = OE_Reply -%% OE_Reply = #'DB_employee'{No,Name,Address,Dpt} -%% No = unsigned_Long() -%% Name = String() -%% Address = String() -%% Dpt = Department -%% Department = 'Department1' | 'Department2' -%% Raises : -%% Description: -%%---------------------------------------------------------------------- -lookup(State, ENo) -> - %% How we access the DB, for example mnesia, is not shown here. - case lookup_employee(ENo) of - %% We assume that we receive a 'DB_employee' struct - {ok, Employee} -> - OE_Reply = Employee, - {reply, OE_Reply, State}; - error -> - %% Here we should throw an exception if - %% there is no match. - corba:raise(....) - end. - -

After you have compiled both call-back modules, and implemented the missing - functionality (e.g. lookup_employee/1), we can test our application:

- -%% Erlang code -.... -%% Create an Access object -Acc = 'DB_Access':oe_create(), - -%% Login is Common user and Administrator -Adm = 'DB_Access':logon(A, "admin", "pw"), -Com = 'DB_Access':logon(A, "comm", "pw"), - -%% Lookup existing employee -Employee = 'DB_Administrator':lookup(Adm, 1), -Employee = 'DB_CommonUser':lookup(Adm, 1), - -%% If we try the same using the DB_CommonUser interface -%% it result in an exit since that operation is not exported. -{'EXIT', _} = (catch 'DB_CommonUser':delete(Adm, 1)), - -%% Try to delete the employee via the CommonUser Object -{'EXCEPTION', _} = (catch 'DB_Administrator':delete(Com, 1)), - -%% Invoke delete operation on the Administrator object -ok = 'DB_Administrator':delete(Adm, 1), -.... - -
- -
- Reserved Compiler Names and Keywords - -

The use of some names is strongly discouraged due to - ambiguities. However, the use of some names is prohibited - when using the Erlang mapping , as they are strictly reserved for IC.

-

IC reserves all identifiers starting with OE_ and oe_ - for internal use.

-

Note also, that an identifier in IDL can contain alphabetic, - digits and underscore characters, but the first character - must be alphabetic. -

-

The OMG defines a set of reserved words, shown below, for use as keywords. - These may not be used as, for example, identifiers. The keywords - which are not in bold face was introduced in the OMG CORBA-3.0 - specification.

- - - abstract - exception - inout - provides - truncatable - - - any - emits - interface - public - typedef - - - attribute - enum - local - publishes - typeid - - - boolean - eventtype - long - raises - typeprefix - - - case - factory - module - readonly - unsigned - - - char - FALSE - multiple - setraises - union - - - component - finder - native - sequence - uses - - - const - fixed - Object - short - ValueBase - - - consumes - float - octet - string - valuetype - - - context - getraises - oneway - struct - void - - - custom - home - out - supports - wchar - - - default - import - primarykey - switch - wstring - - - double - in - private - TRUE - - - OMG IDL keywords -
-

The keywords listed above must be written exactly as shown. Any usage - of identifiers that collide with a keyword is illegal. For example, - long is a valid keyword; Long and LONG are - illegal as keywords and identifiers. But, since the OMG must be able - to expand the IDL grammar, it is possible to use Escaped Identifiers. For example, it is not unlikely that native - have been used in IDL-specifications as identifiers. One option is to - change all occurrences to myNative. Usually, it is necessary - to change programming language code that depends upon that IDL as well. - Since Escaped Identifiers just disable type checking (i.e. if it is a reserved - word or not) and leaves everything else unchanged, it is only necessary to - update the IDL-specification. To escape an identifier, simply prefix it - with _. The following IDL-code is illegal:

- -typedef string native; -interface i { - void foo(in native Arg); - }; -}; - -

With Escaped Identifiers the code will look like:

- -typedef string _native; -interface i { - void foo(in _native Arg); - }; -}; - -
- -
- Type Code Representation - -

Type Codes are used in any values. To avoid mistakes, you should - use access functions exported by the Data Types modules - (e.g. struct, union etc) or the orber_tc - module.

- - - Type Code - Example - - - tk_null - - - - tk_void - - - - tk_short - - - - tk_long - - - - tk_longlong - - - - tk_ushort - - - - tk_ulong - - - - tk_ulonglong - - - - tk_float - - - - tk_double - - - - tk_boolean - - - - tk_char - - - - tk_wchar - - - - tk_octet - - - - tk_any - - - - tk_TypeCode - - - - tk_Principal - - - - {tk_objref, IFRId, Name} - {tk_objref, "IDL:M1\I1:1.0", "I1"} - - - {tk_struct, IFRId, Name, [{ElemName, ElemTC}]} - {tk_struct, "IDL:M1\S1:1.0", "S1", [{"a", tk_long}, {"b", tk_char}]} - - - {tk_union, IFRId, Name, DiscrTC, DefaultNr, [{Label, ElemName, ElemTC}]}

-Note: DefaultNr tells which of tuples in the case list that is default, or -1 if no default
- {tk_union, "IDL:U1:1.0", "U1", tk_long, 1, [{1, "a", tk_long}, {default, "b", tk_char}]} -
- - {tk_enum, IFRId, Name, [ElemName]} - {tk_enum, "IDL:E1:1.0", "E1", ["a1", "a2"]} - - - {tk_string, Length} - {tk_string, 5} - - - {tk_wstring, Length} - {tk_wstring, 7} - - - {tk_fixed, Digits, Scale} - {tk_fixed, 3, 2} - - - {tk_sequence, ElemTC, Length} - {tk_sequence, tk_long, 4} - - - {tk_array, ElemTC, Length} - {tk_array, tk_char, 9} - - - {tk_alias, IFRId, Name, TC} - {tk_alias, "IDL:T1:1.0", "T1", tk_short} - - - {tk_except, IFRId, Name, [{ElemName, ElemTC}]} - {tk_except, "IDL:Exc1:1.0", "Exc1", [{"a", tk_long}, {"b", {tk_string, 0}}]} - - Type Code tuples -
-
-
- diff --git a/lib/orber/doc/src/ch_ifr.xml b/lib/orber/doc/src/ch_ifr.xml deleted file mode 100644 index 09302ab6cc..0000000000 --- a/lib/orber/doc/src/ch_ifr.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Interface Repository - - - 1998-10-10 - - ch_ifr.xml -
- -
- Interface Repository(IFR) -

The IFR is an interface repository built on the Mnesia - application. Orber uses the IFR for some type-checking - when coding/decoding IIOP. The IFR is capable of storing all - interfaces and declarations of OMG IDL. -

-

The interface repository is mainly used for dynamical - interfaces, and as none are currently supported this function - is only really used for retrieving information about interfaces.

-

Functions relating to the manipulation of the IFR including, - initialization of the IFR, as well as, locating, creating and - destroying initial references are detailed further in the Manual - Pages. -

-
-
- diff --git a/lib/orber/doc/src/ch_install.xml b/lib/orber/doc/src/ch_install.xml deleted file mode 100644 index 65faa91ccf..0000000000 --- a/lib/orber/doc/src/ch_install.xml +++ /dev/null @@ -1,1001 +0,0 @@ - - - - -
- - 19972017 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Installing Orber - - - - - - 1998-09-28 - - ch_install.xml -
- -
- Installation Process -

This chapter describes how to install Orber in an Erlang - Environment.

- -
- Preparation -

To begin with, you must decide if you want to run Orber as a:

- - Single node (non-distributed) - all communication with other - Orber instances and ORB's supplied by other vendors use the OMG - GIOP protocol. - Multi node (distributed) - all Orber nodes, within the same - domain, communicate via the Erlang distribution protocol. - For all other Orber instances, i.e. not part of the same domain, - and ORB's supplied by other vendors, the OMG GIOP protocol - is used. - -

Which approach to use is highly implementation specific, but a few - things you should consider:

- - All nodes within an Orber domain should have the same - security level. - If the capacity is greater than load (volume of traffic) - a single-node Orber might be a good solution. - In some cases the distributed system architecture requires a - single-node is the structure of the ORB or ORBs as defined during the install process is called the "installation".. - A multi-node Orber makes it possible to load balance - and create a more fault tolerant system. The Objects - can also have a uniform view if you use distributed - Mnesia tables. - Since the GIOP protocol creates a larger overhead than the - Erlang distribution protocol, the performance will be better - when communicating with Objects within the same Orber domain - compared with inter ORB communication (GIOP). - -

You also have to decide if you want Orber to store internal data using - disc_copies and/or ram_copies. Which storage type you should - depends if/how you intend to use Mnesia in your application. If you - intend to use disc_copies you must start with creating a Mnesia - schema, which contain information about the location of the Erlang nodes - where Orber is planned to be run. For more background information, - see the Mnesia documentation.

-

In some cases it is absolutely necessary to change the default configuration - of Orber. For example, if two Orber-ORB's shall be able to communicate - via GIOP, they must have a unique domain domain. Consult the - configuration settings - section. If you encounter any problems; see the chapter about - Debugging in this User's Guide.

-
- -
- Jump Start Orber -

The easiest way to start Orber is to use orber:jump_start(Port), - which start a single-node ORB with (most likely) a unique - domain (i.e. "IP-number:Port"). This function may only be used - during development and testing. For any other situation, install and - start Orber as described in the following sections. - The listen port, i.e. iiop_port configuration parameter, is set to - the supplied Port.

- -

How Orber is configured when using orber:jump_start(Port) - may change at any time without warning. Hence, this operation must - not be used in systems delivered to a customer.

-
-
- -
- Install Single Node Orber -

Since a single node Orber communicate via the OMG GIOP protocol it is not - necessary to start the Erlang distribution (i.e. using -name/-sname).

-

If we use ram_copies there is no need for creating a disk based - schema. Simply use:

- -erl> mnesia:start(). -erl> corba:orb_init([{domain, "MyRAMSingleNodeORB"}]). -erl> orber:install([node()], [{ifr_storage_type, ram_copies}]). -erl> orber:start(). - -

If you installation requires disc_copies you must begin with - creating a Mnesia schema. Otherwise, the installation is similar - to a RAM installation:

- -erl> mnesia:create_schema([node()]). -erl> mnesia:start(). -erl> corba:orb_init([{domain, "MyDiskSingleNodeORB"}]). -erl> orber:install([node()], [{ifr_storage_type, disc_copies}, - {nameservice_storage_type, disc_copies}]). -erl> orber:start(). - -

You can still choose to store the IFR data as ram_copies, but then - the data must be re-installed (i.e. invoke orber:install/2) - if the node is restarted. Hence, since the IFR data is rather static - you should use disc_copies. For more information see the - orber section in the reference manual.

-

If you do not need to change Orber's configuration you can skip - orb_init/1. - But, you should at least set the IIOP timeout parameters.

-
- -
- Install RAM Based Multi Node Orber -

Within a domain Orber uses the Erlang distribution protocol. Hence, you - must start it first by, for example, using:

- -hostA> erl -sname nodeA - -

In this example, we assume that we want to use two nodes; nodeA and - nodeB. Since Mnesia must know which other nodes should a part - of the distribution we either need to add the Mnesia configuration - parameter extra_db_nodes or use mnesia:change_config/2. To - begin with, Mnesia must be started on all nodes before we can install - Orber:

- -nodeA@hostA> mnesia:start(). -nodeA@hostA> mnesia:change_config(extra_db_nodes, - [nodeA@hostA, nodeB@hostB]). - -

After that the above have been repeated on nodeB we must - first make sure that both nodes will use the same domain name, then - we can install Orber:

- -nodeA@hostA> corba:orb_init([{domain, "MyRAMMultiNodeORB"}]). -nodeA@hostA> orber:install([nodeA@hostA, nodeB@hostB], - [{ifr_storage_type, ram_copies}]). -nodeA@hostA> orber:start(). - -

Note that you can only invoke orber:install/1/2 on one of the - nodes. Now we can start Orber on the other node:

- -nodeB@hostB> corba:orb_init([{domain, "MyRAMMultiNodeORB"}]). -nodeB@hostB> orber:start(). - -
- -
- Install Disk Based Multi Node Orber -

As for RAM based multi-node Orber installations, the Erlang distribution - must be started (e.g. erl -sname nodeA). The major difference is that - when it is disk based a Mnesia schema must be created:

- -nodeA@hostA> mnesia:create_schema([nodeA@hostA, nodeB@hostB]). -nodeA@hostA> mnesia:start(). - -

In this example, we assume that we want to use two nodes; nodeA and - nodeB. Since it is not possible to create a schema on more than - one node. Hence, all we have to do is to start Mnesia (i.e. invoke - mnesia:start()) on nodeB.

-

After Mnesia have been started on all nodes, you must confirm that all - nodes have the same domain name, then Orber is ready to be installed:

- -nodeA@hostA> corba:orb_init([{domain, "MyDiskMultiNodeORB"}]). -nodeA@hostA> orber:install([nodeA@hostA, nodeB@hostB], - [{ifr_storage_type, disc_copies}]). -nodeA@hostA> orber:start(). - -

Note that you can only invoke orber:install/1/2 on one of the - nodes. Now we can start Orber on the other node:

- -nodeB@hostB> corba:orb_init([{domain, "MyDiskMultiNodeORB"}]). -nodeB@hostB> orber:start(). - -
- -
- -
- Configuration - -

It is essential that one configure Orber properly, to avoid, for example, - malicious attacks and automatically terminate IIOP connections no longer - in use. An easy way to extract information about Orber's configuration - parameters is to invoke the operation - orber:info/1/2. - Orber offer the following configuration parameters:

- - - Key - Range - Default - - - domain - string() - "ORBER" - - - iiop_port - integer() >= 0 - 4001 - - - nat_iiop_port - integer() > 0 | {local, integer(), [{integer(), integer()}]} - The same as iiop_port - - - iiop_out_ports - 0 | {integer(),integer()} - 0 - - - iiop_out_ports_attempts - integer() > 0 - 1 - - - iiop_out_ports_random - true | false - false - - - iiop_max_fragments - integer() > 0 | infinity - infinity - - - iiop_max_in_requests - integer() > 0 | infinity - infinity - - - iiop_max_in_connections - integer() > 0 - infinity - - - iiop_backlog - integer() > 0 - 5 - - - iiop_packet_size - integer() > 0 | infinity - infinity - - - ip_address - string() | {multiple, [string()]} - All interfaces - - - ip_address_local - string() - Defined by the underlying system - - - nat_ip_address - string() | {multiple, [string()]} | {local, string(), [{string(), string()}]} - The same as ip_address - - - objectkeys_gc_time - integer() > 0 | infinity - infinity - - - giop_version - {1,0} | {1,1} | {1,2} - {1,1} - - - iiop_setup_connection_timeout - integer() > 0 | infinity - infinity - - - iiop_connection_timeout - integer() > 0 | infinity - infinity - - - iiop_in_connection_timeout - integer() > 0 | infinity - infinity - - - iiop_out_keepalive - true | false - false - - - iiop_in_keepalive - true | false - false - - - iiop_timeout - integer() > 0 | infinity - infinity - - - interceptors - {native, [atom()]} - - - - - local_interceptors - {native, [atom()]} - - - - - orbInitRef - [string()] | undefined - undefined - - - orbDefaultInitRef - string() | undefined - undefined - - - orber_debug_level - 0 - 10 - 0 - - - flags - integer() >= 0 - 0 - - - iiop_acl - [{atom(), string()}] | [{atom(), string(), [string()]}] - [] - - - secure - no | ssl - no - - - ssl_generation - 2 | 3 - 2 - - - iiop_ssl_port - integer() >= 0 - 4002 - - - iiop_ssl_accept_timeout - integer() > 0 | infinity - infinity - - - iiop_ssl_backlog - integer() > 0 - 5 - - - iiop_ssl_ip_address_local - string() - Defined by the underlying system - - - nat_iiop_ssl_port - integer() > 0 | {local, integer(), [{integer(), integer()}]} - The same as iiop_ssl_port - - - ssl_server_options - list() - See the SSL application - for valid options. - - - ssl_client_options - list() - See the SSL application - for valid options. - - - iiop_ssl_out_keepalive - true | false - false - - - iiop_ssl_in_keepalive - true | false - false - - Orber Configuration Parameters -
-

-

-

Comments on the table 'Orber Configuration Parameters':

- - domain - Since Orber domains, they are supposed to communicate via IIOP, - MUST have unique names, communication will - fail if two domains have the same name. The domain name MAY NOT - contain ^G (i.e. \007). - iiop_port - If set to 0 the OS will pick any vacant port. -

-Note:On a UNIX system it is preferable to - have a IIOP port higher than 1023, since it is not recommended to - run Erlang as a root user.
- nat_iiop_port - The value is either an integer or {local, DefaultNATPort, [{Port, NATPort}]}. See also - Firewall Configuration. - iiop_out_ports - When set to 0 any available port will be used. - If a range is specified, Orber will only - use the local ports within the interval when trying to connect to - another ORB (Orber acts as a client ORB). If all ports are in use - communication will fail. Hence, it is absolutely necessary to - set iiop_connection_timeout as well. Otherwise, connections - no longer in use will block further communication. If one use, for - example, erl -orber iiop_out_ports "{5000,5020}", Orber - will only use port 5000 to 5020 when connecting. - If communicating via SSL, make sure you use a version that supports - the local {port, Port} option. See also - Firewall Configuration. - iiop_out_ports_random - Requires that iiop_out_ports define a port range. If that is the - case Orber will select a port randomly from that sequence. - iiop_out_ports_attempts - Requires that iiop_out_ports define a port range. If so Orber will - accept a number of timeouts, defined by this parameter, when trying to connect - to another ORB. - iiop_max_fragments - Limits the number of IIOP fragments allowed per request. - iiop_max_in_requests - Limits the number of concurrent incoming requests per incoming connection. - iiop_max_in_connections - Limits the number of concurrent incoming connections. - iiop_backlog - Defines the maximum length the queue of pending incoming - connections may grow to. - iiop_packet_size - Defines the maximum size of incoming requests. - If this limit is exceeded, the connection is closed. - ip_address - This option is used if orber only should - listen on a specific ip interface on a multi-interface host or if - exported IOR:s should contain multiple components. The value is - the IPv4 or IPv6 address as a string or {multiple, IPList}. - The latter requires that the object is available via the all IP addresses - found in the list. - ip_address_local - This option defines the default local interface Orber will - use when connecting to another ORB via IIOP, i.e., Orber act as the - client side ORB. The value is a IPv4 or IPv6 address as a string. - It is possible to override ip_address_local by defining - iiop_acl or passing the Orber generic interface Context. - If this option is not used, the underlying OS will choose which interface to - use. For more information, see the - Interface Configuration - section. - nat_ip_address - The value is the ip address as - a string (IPv4 or IPv6), {multiple, IPList} or - {local, DefaultNATIPAddress, [{IPAddress, NATIPAddress}]}. See also - Firewall Configuration. - objectkeys_gc_time - This option should be set if objects are started - using the option {persistent, true}. - The value is integer() seconds. - giop_version - Defines the default GIOP protocol version. - iiop_setup_connection_timeout - The value is an integer (seconds) or the atom infinity. - This option is only valid for client-side - connections. If this option is set, attempts to connect to other ORB's - will timeout after the given time limit. Note, if the time limit is large - the TCP protocol may timeout before the supplied value. - iiop_connection_timeout - The value is an integer (timeout in seconds between 0 and 1000000) - or the atom infinity. This option is only valid for client object - connections, i.e., will have no effect on server connections. Setting this - option will cause client connections to be terminated, if and only if, - there are no pending requests. If there are a client still waiting for - a reply, Orber will try again after the given seconds have passed. The main - purpose for this option is to reduce the number of open connections; it is, - for example, not necessary to keep a connection, only used once a day, - open at all time. - iiop_in_connection_timeout - The same as for iiop_connection_timeout. The only difference is - that this option only affects incoming connections (i.e. Orber act as - server-side ORB). - iiop_out_keepalive - Enables periodic transmission on a connected socket, when no other - data is being exchanged. If the other end does not respond, the - connection is considered broken and will be terminated. - When enabled the SO_KEEPALIVE socket level option is set. - iiop_in_keepalive - The same as for iiop_out_keepalive. The only difference is - that this option only affects incoming connections. - iiop_timeout - The value is an integer (timeout in seconds between 0 and 1000000) - or the atom infinity. This option is only valid on the client side. - Setting this option, cause all intra-ORB requests to timeout and - raise a system exception, e.g. TIMEOUT, if no replies are delivered - within the given time limit. - interceptors - If one set this parameter, e.g., - erl -orber interceptors "{native, ['myInterceptor']}", - Orber will use the supplied interceptor(s) for all inter-ORB - communication. 'myInterceptor' is the module name of the - interceptor. For more information, see the interceptor chapter - in the User's Guide and the Reference Manual. - local_interceptors - If defined, its value will be - used when activating local interceptors via - Orber Environment Flags. - If not defined, but the flag is set, Orber will use the value of - the interceptors parameter. - orbInitRef - Setting this option, e.g., - erl -orber orbInitRef [\"NameService=corbaloc::host.com/NameService\"], - will alter the location from where corba:resolve_initial_references(Key) - tries to find an object matching the given Key. The keys will also appear when - invoking corba:list_initial_services(). This variable overrides - orbDefaultInitRef - orbDefaultInitRef - If a matching Key for orbInitRef is not - found, and this variable is set, it determines the location from where - orber:resolve_initial_references(Key) tries to find an object - matching the given Key. Usage: - erl -orber orbDefaultInitRef \"corbaloc::host.com\". - orber_debug_level - The range is 0 to 10. - Using level 10 is the most verbose configuration. - This option will generate reports, using the error_logger, - for abnormal situations. It is not recommended to use this option - for delivered systems since some of the reports is not to be considered - as errors. The main purpose is to assist during development. - flags - No flags are activated in the default case. - The available configuration settings are described in - Orber Environment Flags. - iiop_acl - This option must be activated by setting - Orber Environment Flags parameter. - The value of this parameter shall be a list of [{Direction, Filter}] - and/or [{Direction, Filter, [Interfaces]}]. The Direction, - tcp_in, ssl_in, tcp_out or ssl_out, determines if - the Access Control List (ACL) applies to incoming or outgoing connections - and IIOP or IIOP over SSL. The Filter uses a extended format of - Classless Inter Domain Routing (CIDR). For example, "123.123.123.10" limits - the connection to that particular host, while "123.123.123.10/17" allows - connections to or from any host equal to the 17 most significant bits. Orber - also allow the user to specify a certain port or port range, for example, - "123.123.123.10/17#4001" and "123.123.123.10/17#4001/5001" - respectively. IPv4 or none compressed IPv6 strings are accepted.

- - The list of Interfaces, IPv4 or IPv6 strings, may only contain - one address for outgoing connections. For incoming connections, - the Interfaces list may contain several IP strings. If set for - outgoing connections, and access is granted, Orber will use that local - interface when connecting to the server-side ORB. For incoming connections, - the client-side ORB is required to use one of the listed interfaces locally. - If it fail to do so, access will be denied. The module - orber_acl provides operations for - evaluating the access control for filters and addresses. See also the - Interface Configuration - and - Firewall Configuration - chapters.
- secure - Determines the security mode Orber will use, which is either - no if it is an insecure domain or the type of security - mechanism used. Currently, per default, Orber is compliant with - CSIv1 level 0, which means IIOP via SSL/TLS. - The security chapter later in this manual describes how to get security - in Orber and how the options are used. - ssl_generation - Defines which SSL version, i.e. available API, is installed. The - default value, 2, refers to SSL-3.1 or later, but earlier than SSL-4.0. - If set to 3 SSL-4.0, or later, must be available. Currently it not possible - to use 1, it is only reserved for future use. - iiop_ssl_port - If set, the value must be an - integer greater than zero and not equal to iiop_port. - iiop_ssl_accept_timeout - The value is an integer (timeout in seconds) or the atom infinity and - determine how long the SSL handshake may take. This option should - be set to avoid if a client never initiate the handshake. - iiop_ssl_backlog - Defines the maximum length the queue of pending incoming - connections may grow to. - iiop_ssl_ip_address_local - This option defines the default local interface Orber will - use when connecting to another ORB via IIOP SSL, i.e., Orber act as the - client side ORB. The value is a IPv4 or IPv6 address as a string. - It is possible to override iiop_ssl_ip_address_local by defining - iiop_acl or passing the Orber generic interface Context. - If this option is not used, the underlying OS will choose which interface to - use. For more information, see the - Interface Configuration - section. - nat_iiop_ssl_port - If set, the value must be an integer greater than zero or - {local, DefaultNATPort, [{Port, NATPort}]}. See also - Firewall Configuration. - ssl_server_options - A list of the SSL options when Orber is the server. - In general it's just to remove the 'ssl_server_' prefix from the old options, - i.e. ssl_server_verify will just be verify in this option list. - See the SSL application for the correct list of possible - options and their values. - - ssl_client_options - A list of the SSL options when Orber is the client. - In general it's just to remove the ssl_client_ prefix from the old options, - i.e. ssl_client_depth will just be depth in this option list. - See the SSL application for the correct list of possible - options and their values. - - iiop_ssl_out_keepalive - Enables periodic transmission on a connected socket, when no other - data is being exchanged. If the other end does not respond, the - connection is considered broken and will be terminated. - When enabled the SO_KEEPALIVE socket level option is set. Requires that - the installed SSL version support the keepalive option - and that the ssl_generation points to this version. - iiop_ssl_in_keepalive - The same as for iiop_ssl_out_keepalive. The only difference is - that this option only affects incoming connections. -
-

It is possible to invoke operations using the extra timeout parameter:

-
-erl> module_interface:function(ObjRef, Timeout, ..Arguments..).
-erl> module_interface:function(ObjRef, [{timeout, Timeout}], ..Arguments..).
-erl> module_interface:function(ObjRef, ..Arguments..).    
-

The extra Timeout argument will override the configuration parameter - iiop_timeout. It is, however, not possible to use infinity - to override the Timeout parameter. The Timeout option is also valid for - objects which resides within the same A domain containing several Erlang nodes, which are communicating by using the Erlang internal format. An Orber domain looks as one ORB from the environment..

-

The iiop_setup_connection_timeout, iiop_timeout, - iiop_connection_timeout and iiop_in_connection_timeout - variables should be used. The specified values is implementation specific, - i.e., WAN or LAN, but they should range from - iiop_setup_connection_timeout to iiop_connection_timeout.

-

To change these settings in the configuration file, the - -config flag must be added to the erl command. See the - Reference Manual - config(4) for further information. The values can also - be sent separately as - options to the Erlang node when it is started, see the Reference - Manual - erl(1) for further information.

- -
- - Orber Environment Flags -

The Environment Flags allows the user to activate debugging - facilities or change Orber's behavior. The latter may result in that - Orber is no longer compliant with the OMG standard, which may be necessary - when communicating with a non-compliant ORB.

- - - Hexadecimal Value - OMG Compliant - Description - - - 0001 - no - Exclude CodeSet Component - - - 0002 - yes - Local Typechecking - - - 0004 - yes - Use Host Name in IOR - - - 0008 - yes - Enable NAT - - - 0020 - yes - Local Interceptors - - - 0080 - yes - Light IFR - - - 0100 - yes - Use IPv6 - - - 0200 - yes - EXIT Tolerance - - - 0400 - yes - Enable Incoming ACL - - - 0800 - yes - Enable Outgoing ACL - - - 1000 - yes - Use Current Interface in IOR - - Orber Environment Flags -
-

Any combination of the flags above may be used and changes the - behavior as follows:

- - Exclude CodeSet Component - instruct Orber to exclude - the CodeSet component in exported IOR:s. When activated, no - negotiating regarding character and wide character conversions - between the client and the server will occur. This flag will, - most likely, cause problems if your IDL specification contains - the data types wchar and/or wstring. - Local Typechecking - - If activated, parameters, replies and raised exceptions - will be checked to ensure that the data is correct. If an error - occurs, the error_logger is used to generate reports. - One MAY NOT use this option for delivered systems due - to the extra overhead. Since this option activates typechecking - for all objects generated on the target node, it is also possible - to use the option {local_typecheck, boolean()}, when - invoking oe_create/2, oe_create_link/2, - corba:create/4 or corba:create_link/4, to override - the configuration parameter. - Use Host Name in IOR - normally Orber inserts the IP-number - in IOR:s when they are exported. In some cases, this will cause - the clients to open two connections instead of one. - Enable NAT - if this flag is set, it is possible to use - the NAT (Network Address Translation) configuration parameters - (nat_iiop_port, nat_iiop_ssl_port and - nat_ip_address). - Local Interceptors - use interceptors for local - invocations. - Light IFR - if the IFR is not explicitly used and this - flag is set, Orber will use a minimal IFR to reduce memory usage - and installation time. - Use IPv6 - when this option is activated, Orber will use - IPv6 for inter-ORB communication. - EXIT Tolerance - servers will survive even though the - call-back module caused an EXIT. - Enable Incoming ACL - activates access control for incoming - connections. - Enable Outgoing ACL - activates access control for outgoing - connections. - Use Current Interface in IOR - when set, Orber will add - the interface the request came via to exported local IOR:s. - -

Invoking the operation - orber:info/1/2 will display the currently - set flags in a readable way.

-
-
- -
- Firewall Configuration - -

Firewalls are used to protect objects from clients in other networks or - sub-networks, but also to restrict which hosts internal objects may connect to - (i.e. inbound protection and outbound protection). A firewall - can limit access based on:

- - Transport Level - performs access control decisions based on - address information in TCP headers. - Application Level - understands GIOP messages and the specific - transport level inter-ORB Protocol supported e.g. IIOP. - -

This section describes how to configure a Transport Level firewall. It - must have prior knowledge of the source to destination mappings, and - conceptually has a configuration table containing tuples of the form: - ({inhost:inport}, {outhost:outport}). If there are no port restrictions - it is rather easy to configure the firewall. Otherwise, we must consider the - following alternatives:

- - Incoming Requests - Orber only uses the port-numbers specified - by the configuration parameters iiop_port and - iiop_ssl_port. Other ORB's may use several ports but it should - be possible to change this behavior. Consult the other ORBs - documentation. - Outgoing Requests - Most ORB's, Orber included, - ask the OS to supply a vacant local port when connecting to the - server-side ORB. It is possible to change this behavior when using - Orber (i.e. set the configuration parameter iiop_out_ports). - - -

Using the option iiop_out_ports may result in that Orber runs out of - valid ports numbers. For example, other applications may steal some of the - ports or the number of concurrent outgoing connections to other ORBs may be - higher than expected. To reduce, but not eliminate, the risk you should use - iiop_connection_timeout.

-
-

Firewall configuration example:

-
-# "Plain" IIOP
-To: Orber-IPNo:(iiop_port)     From: ORB-IPNo:X
-To: ORB-IPNo:Z                 From: Orber-IPNo:(iiop_out_ports | Any Port)
-
-# IIOP via SSL
-To: Orber-IPNo:(iiop_port)     From: ORB-IPNo:X
-To: Orber-IPNo:(iiop_ssl_port) From: ORB-IPNo:Y
-To: ORB-IPNo:Z                 From: Orber-IPNo:(iiop_out_ports | Any Port)
-    
-

If the communication take place via a - TCP Firewall with NAT - (Network Address Translation), we must activate this behavior and define - the external address and/or ports.

- - - -TCP Firewall With NAT - -

Using NAT makes it possible to use different host data for different network - domains. This way we can share Internet Protocol address resources or - obscure resources. To enable this feature the - Enable NAT flag must be set and - nat_iiop_port, nat_iiop_ssl_port and nat_ip_address - configured, which maps to iiop_port, iiop_ssl_port and - ip_address respectively. Hence, the firewall must be configured to - translate the external to the internal representation correctly. If these NAT parameters - are assigned a single port number or IP address, only those will be used when - an IOR is exported to another ORB. When ip_address is set to - {multiple, [IPAddress]}, nat_ip_address should be configured in the same - way, so that each NAT IP address can be translated to a valid address by the firewall. - If objects are supposed to be accessible via different interfaces and port, see also - Interface Configuration, - the options {local, DefaultNATIPAddress, [{IPAddress, NATIPAddress}]} and/or - {local, DefaultNATPort, [{Port, NATPort}]} shall be used. The default NAT IP address - and port, should be translated to the value of ip_address_local and the default - listen port by the firewall. If the IP address and/or port is not found in the list, - the default values will be inserted in the IOR. The firewall must be able to translate - these correctly.

-

If it is necessary to limit the access to an ORB within a secure network, - but other applications running on the same host may not be blocked out, - one can use a Application Level firewall or Orber Access Control - List (ACL). The latter makes it possible for the user to define which hosts - may communicate, either as server or client, with Orber. This is achieved by - defining the configuration parameter - iiop_acl. The Classless Inter - Domain Routing (CIDR) Filter determines which peer interfaces and - ports the other ORB may use.

- - - Filter - Peer Interface(s) - Peer Port(s) - - - "10.1.1.1" - 10.1.1.1 - any - - - "10.1.1.1/8" - 10.0.0.0-10.255.255.255 - any - - - "10.1.1.1/8#4001" - 10.0.0.0-10.255.255.255 - 4001 - - - "10.1.1.1/8#4001/5001" - 10.0.0.0-10.255.255.255 - 4001-5001 - - Orber ACL Filters -
-

Orber ACL, also allows the user to define which local interface(s) may be used, - but will not detect spoofing. The operation - orber_acl:match/2/3 makes it easy to - verify whether access would be granted or not. For example, if Orber would - be started with the ACL [{tcp_out, "10.1.1.1/8#4001/5001"}], then - orber_acl:match/2 would behave as follows:

- -erl> orber_acl:match({11,1,1,1}, tcp_out). -false - -erl> orber_acl:match({10,1,1,1}, tcp_out). -true - -erl> orber_acl:match({11,1,1,1}, tcp_out, true). -{false,[],0} - -erl> orber_acl:match({10,1,1,1}, tcp_out, true). -{true,[],{4001,5001}} - -

Only if the returned boolean is true the extra return values makes a - difference. In the example above, {true,[],{4001,5001}} means that - Orber may connect to "10.1.1.1", using any local interface, - if the server-side ORB listens for incoming connect requests on a port - within the range 4001-5001. Note, invoking the orber_acl:match/2/3 - operation, will not result in a connect attempt by Orber. The reason for - this, is that this function may be used on a live node as well as in test - environment. Hence, if a local interface is currently not available or no - server-side ORB available via the given host/port(s), will not be detected - by Orber.

-
- -
- Interface Configuration - -

In many cases it is sufficient to simply configure the underlying OS which - local interfaces shall be used for all applications. But, in some cases - it is required, due to, for example, the firewall configuration, that different - local interfaces are used for different applications. Some times, it is even - necessary to use a specific interface for a single CORBA object. This section - describe how one can alter this in different ways.

-

The default behavior is that Orber lets the OS configuration decide which interface - will be added in IOR:s exported to another ORB and the local interface used - when connecting to another ORB (Orber act as client side ORB). The latter can be - overridden by setting the configuration parameters iiop_ssl_ip_address_local - and/or ip_address_local, which will affect IIOP via SSL and IIOP - respectively. These parameters can be overridden by using the Orber generic - interface Context or defining an ACL (Access Control List). The latter - always takes precedence if a local interface is included (e.g. - [{tcp_out, "10.0.0.0/8", ["10.0.0.1"]}]). If the interface is excluded - (e.g. [{tcp_out, "10.0.0.0/8"}]), the interface chosen will, in the following - order, be determined by - #'IOP_ServiceContext'{}, ip_address_local/iiop_ssl_ip_address_local or - the configuration of the underlying system.

-

Adding the interface context, for generated stubs/skeletons, is done in the - following way:

- -Ctx = #'IOP_ServiceContext'{context_id = ?ORBER_GENERIC_CTX_ID, - context_data = {interface, "10.0.0.1"}}, -'CosNaming_NamingContext':resolve(NS, [{context, [Ctx]}], Name), - -

It is also possible to add the context to - corba:string_to_object/2, corba:resolve_initial_references/2, corba:resolve_initial_references_remote/3, corba:list_initial_services_remote/2, corba_object:not_existent/2, corba_object:non_existent/2 and corba_object:is_a/3. - The operations exported by corba_object are affected - if the supplied IOR is external. The function corba:string_to_object/2 - might require the interface context if a corbaloc or a corbaloc - string is passed (See the - INS chapter), - while corba:resolve_initial_references_remote/3 and - corba:list_initial_services_remote/2 always connect to another ORB and - it might be necessary to add the context. - The remaining corba operations are affected if calls are re-directed - by setting the orbInitRef and/or orbDefaultInitRef configuration - parameters. For more information, see the Reference Manual for each module.

-

Configuring which interface(s) that shall be used when exporting an IOR to - another ORB, is determined by nat_ip_address, setting the flag - 16#1000 - and ip_address, in that order. Orber listens for incoming connections - either via all interfaces or the interface defined by ip_address. It is - also possible to add and remove extra listen interfaces by using - orber:add_listen_interface/2/3 and orber:remove_listen_interface/1. - In this case one should set the 16#1000 flag and, if necessary, set the - configuration parameters - {local, DefaultNATIPAddress, [{IPAddress, NATIPAddress}]} and/or - {local, DefaultNATPort, [{Port, NATPort}]}.

-
-
- diff --git a/lib/orber/doc/src/ch_interceptors.xml b/lib/orber/doc/src/ch_interceptors.xml deleted file mode 100644 index 4a9f8e69ca..0000000000 --- a/lib/orber/doc/src/ch_interceptors.xml +++ /dev/null @@ -1,278 +0,0 @@ - - - - -
- - 20012017 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Orber Interceptors - Nick - - 2001-08-16 - - ch_interceptors.xml -
- -
- Using Interceptors -

For Inter-ORB communication, e.g., via IIOP, it is possible - to intercept requests and replies. To be able to use Interceptors - Orber the configuration parameter interceptors must be defined.

- -
- Configure Orber to Use Interceptors -

The configuration parameter interceptors must be defined, e.g., - as command line option:

- -erl -orber interceptors "{native, ['myInterceptor']}" - -

It is possible to use more than one interceptor; simply add them to the - list and they will be invoked in the same order as they appear in the list.

-

One can also active and deactivate an interceptor during - run-time, but this will only affect currently existing connections. - For more information, consult Orber's Reference Manual regarding the - operations orber:activate_audit_trail/0/1 and - orber:activate_audit_trail/0/1.

-
- -
- Creating Interceptors -

Each supplied interceptor must export the following functions:

- - new_out_connection/3/5 - one of these operations is called when - a client application calls an object residing on remote ORB. - If an interceptor exports both versions, arity 3 and 5, which - operation that will be invoked is Orber internal. - new_in_connection/3/5 - one of these operations is invoked - when a client side ORB tries to set up a connection to the target ORB. - If an interceptor exports both versions, arity 3 and 5, which - operation that will be invoked is Orber internal. - out_request/6 - supplies all request data on the client side - ORB. - out_request_encoded/6 - similar to out_request - but the request body is encode. - in_request_encoded/6 - after a new request arrives at the - target ORB the request data is passed to the interceptor in - encoded format. - in_request/6 - prior to invoking the operation on the - target object, the interceptor in_request is called. - out_reply/6 - after the target object replied the - out_reply operation is called with the result of the object - invocation. - out_reply_encoded/6 - before sending a reply back to the - client side ORB this operation is called with the result in - encoded format. - in_reply_encoded/6 - after the client side ORB receives - a reply this function is called with the reply in encoded - format. - in_reply/6 - before delivering the reply to the client - this operation is invoked. - closed_in_connection/1 - when a connection is terminated - on the client side this function is called. - closed_out_connection/1 - if an outgoing connection is - terminated this operation will be invoked. - -

The operations new_out_connection, new_in_connection, - closed_in_connection and closed_out_connection operations - are only invoked once per connection. The remaining operations - are called, as shown below, for every Request/Reply to/from remote - CORBA Objects.

- - - -The Invocation Order of Interceptor Functions. - -
-
- -
- Interceptor Example -

Assume we want to create a simple access service which purpose is to:

- - Only allow incoming request from ORB's residing on a certain set of - nodes. - Restrict the objects any client may invoke operations on. - Only allow outgoing requests to call a limited set of external - ORB's. - Add a checksum to each binary request/reply body. - -

To restricts the access we use a protected and named ets-table - holding all information. How the ets-table is initiated and maintained - is implementation specific, but it contain - {Node, ObjectTable, ChecksumModule} where Node is used as - ets-key, ObjectTable is a reference to another ets-table in which - we store which objects the clients are allowed to invoke operations on - and ChecksumModule determines which module we should use to handle - the checksums.

- -new_in_connection(Arg, Host, Port) -> - %% Since we only use one interceptor we do not care about the - %% input Arg since it is set do undefined by Orber. - case ets:lookup(in_access_table, Host) of - [] -> - %% We may want to log the Host/Port to see if someone tried - %% to hack in to our system. - exit("Access not granted"); - [{Host, ObjTable, ChecksumModule}] -> - {ObjTable, ChecksumModule} - end. - -

The returned tuple, i.e., {ObjTable, ChecksumModule}, will be passed - as the first argument whenever invoking one of the interceptor functions. - Unless the connection attempt did not fail we are now ready for receiving - requests from the client side ORB.

-

When a new request comes in the first interceptor function to be invoked is - in_request_encoded. We will remove the checksum from the coded - request body in the following way:

- -in_request_encoded({ObjTable, ChecksumModule}, ObjKey, Ctx, Op, Bin, Extra) -> - NewBin = ChecksumModule:remove_checksum(Bin), - {NewBin, Extra}. - -

If the checksum check fails the ChecksumModule should invoke exit/1. - But if the check succeeded we are now ready to check if the client-ORB - objects are allowed to invoke operations on the target object. Please note, - it is possible to run both checks in in_request_encoded. Please - note, the checksum calculation must be relatively fast to ensure a - good throughput.

-

If we want to we can restrict any clients to only use a subset of operations - exported by a server:

- -in_request({ObjTable, ChecksumModule}, ObjKey, Ctx, Op, Params, Extra) -> - case ets:lookup(ObjTable, {ObjKey, Op}) of - [] -> - exit("Client tried to invoke illegal operation"); - [SomeData] -> - {Params, Extra} - end. - -

At this point Orber are now ready to invoke the operation on the target - object. Since we do not care about what the reply is the out_reply - function do nothing, i.e.:

- -out_reply(_, _, _, _, Reply, Extra) -> - {Reply, Extra}. - -

If the client side ORB expects a checksum to be added to the reply we - add it by using:

- -out_reply_encoded({ObjTable, ChecksumModule}, ObjKey, Ctx, Op, Bin, Extra) -> - NewBin = ChecksumModule:add_checksum(Bin), - {NewBin, Extra}. - - -

If we manipulate the binary as above the behavior must - be Bin == remove_checksum(add_checksum(Bin)).

-
-

For outgoing requests the principle is the same. Hence, it is not further - described here. The complete interceptor module would look like:

- --module(myInterceptor). - -%% Interceptor functions. --export([new_out_connection/3, - new_in_connection/3, - closed_in_connection/1, - closed_out_connection/1, - in_request_encoded/6, - in_reply_encoded/6, - out_reply_encoded/6, - out_request_encoded/6, - in_request/6, - in_reply/6, - out_reply/6, - out_request/6]). - -new_in_connection(Arg, Host, Port) -> - %% Since we only use one interceptor we do not care about the - %% input Arg since it is set do undefined by Orber. - case ets:lookup(in_access_table, Host) of - [] -> - %% We may want to log the Host/Port to see if someone tried - %% to hack in to our system. - exit("Access not granted"); - [{Host, ObjTable, ChecksumModule}] -> - {ObjTable, ChecksumModule} - end. - -new_out_connection(Arg, Host, Port) -> - case ets:lookup(out_access_table, Host) of - [] -> - exit("Access not granted"); - [{Host, ObjTable, ChecksumModule}] -> - {ObjTable, ChecksumModule} - end. - -in_request_encoded({_, ChecksumModule}, ObjKey, Ctx, Op, Bin, Extra) -> - NewBin = ChecksumModule:remove_checksum(Bin), - {NewBin, Extra}. - -in_request({ObjTable, _}, ObjKey, Ctx, Op, Params, Extra) -> - case ets:lookup(ObjTable, {ObjKey, Op}) of - [] -> - exit("Client tried to invoke illegal operation"); - [SomeData] -> - {Params, Extra} - end. - -out_reply(_, _, _, _, Reply, Extra) -> - {Reply, Extra}. - -out_reply_encoded({_, ChecksumModule}, ObjKey, Ctx, Op, Bin, Extra) -> - NewBin = ChecksumModule:add_checksum(Bin), - {NewBin, Extra}. - -out_request({ObjTable, _}, ObjKey, Ctx, Op, Params, Extra) -> - case ets:lookup(ObjTable, {ObjKey, Op}) of - [] -> - exit("Client tried to invoke illegal operation"); - [SomeData] -> - {Params, Extra} - end. - -out_request_encoded({_, ChecksumModule}, ObjKey, Ctx, Op, Bin, Extra) -> - NewBin = ChecksumModule:add_checksum(Bin), - {NewBin, Extra}. - -in_reply_encoded({_, ChecksumModule}, ObjKey, Ctx, Op, Bin, Extra) -> - NewBin = ChecksumModule:remove_checksum(Bin), - {NewBin, Extra}. - -in_reply(_, _, _, _, Reply, Extra) -> - {Reply, Extra}. - -closed_in_connection(Arg) -> - %% Nothing to clean up. - Arg. - -closed_out_connection(Arg) -> - %% Nothing to clean up. - Arg. - - -

One can also use interceptors for debugging purposes, e.g., - print which objects and operations are invoked with which arguments - and the outcome of the operation. In conjunction with the configuration - parameter orber_debug_level it is rather easy to find out what - went wrong or just to log the traffic.

-
-
-
- diff --git a/lib/orber/doc/src/ch_introduction.xml b/lib/orber/doc/src/ch_introduction.xml deleted file mode 100644 index f04fedd0a7..0000000000 --- a/lib/orber/doc/src/ch_introduction.xml +++ /dev/null @@ -1,145 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Introduction to Orber - Megan Lynch - - 1998-09-21 - - ch_introduction.xml -
- -
- Overview -

The Orber application is a CORBA compliant Object Request Brokers - (ORB), which provides CORBA functionality in an Erlang - environment. Essentially, the ORB channels communication or - transactions between nodes in a - heterogeneous environment. -

-

Common Object Request Broker Architecture is a common communication standard developed by the OMG (Object Management Group)(Common Object Request Broker - Architecture) provides an interface definition language allowing - efficient system integration and also supplies standard - specifications for some services. -

-

The Orber application contains the following parts:

- - -

ORB kernel and IIOP support

-
- -

Interface Repository

-
- -

Interface Definition Language Mapping for Erlang

-
- -

CosNaming Service

-
-
- -
- Benefits -

Orber provides CORBA functionality in an Erlang environment that enables: -

- - -

Platform interoperability and transparency

-

Orber enables communication between - OTP applications or Erlang environment applications and - other platforms; for example, Windows NT, Solaris - etc, allowing platform transparency. This is especially helpful in situations where there - are many users with different platforms. For example, - booking airline tickets would require the airline database - and hundreds of travel agents (who may not have the same - platform) to book seats on flights.

-
- -

Application level interoperability and transparency

-

As Orber is a CORBA compliant application, its purpose is - to provide interoperability and transparency on the application - level. - Orber simplifies the distributed system software by defining the - environment as objects, which in effect, views - everything as identical regardless of programming - languages.

- Previously, time-consuming programming was - required to facilitate communication between different languages. - However, with CORBA compliant Orber the Application - Programmer is relieved of this task. This makes - communication on an application level relatively transparent to the user.

-
-
-
- -
- Purpose and Dependencies -

The system architecture and OTP dependencies of Orber are illustrated in figure 1 below:

- - - -Figure 1: Orber Dependencies and Structure. - -

Orber is dependent on Mnesia (see the Mnesia - documentation) - an Erlang database management application - used to store object information.

- -

Although Orber does not have a run-time - application dependency to IC (an Interface Definition Language - IDL is the OMG specified interface definition language, used to define the CORBA object interfaces.compiler for - Erlang), it is necessary when building - services and applications. See the IC documentation for - further details.

-
- - - -Figure 2: ORB interface between Java and Erlang Environment Nodes. - -

This simplified illustration in figure 2 demonstrates how Orber can facilitate communication in a heterogeneous environment. The Erlang Nodes running - OTP and the other Node running applications written in Java can - communicate via an Object Request Broker - ORB open software bus architecture specified by the OMG which allows object components to communicate in a heterogeneous environment.(Object Request Broker). Using - Orber means that CORBA functions can be used to achieve this - communication. -

-

For example, if one of the above nodes requests an object, it does not - need to know if that object is located on the same, or - different, Erlang or Java nodes. The ORB will channel the - information creating platform and application transparency for - the user. -

-
- -
- Prerequisites -

To fully understand the concepts presented in the - documentation, it is recommended that the user is familiar - with distributed programming and CORBA (Common Object Request - Broker Architecture). -

-

Recommended reading includes Open Telecom Platform Documentation Set and Concurrent Programming in Erlang. -

-
-
-
- diff --git a/lib/orber/doc/src/ch_naming_service.xml b/lib/orber/doc/src/ch_naming_service.xml deleted file mode 100644 index 991402ae86..0000000000 --- a/lib/orber/doc/src/ch_naming_service.xml +++ /dev/null @@ -1,465 +0,0 @@ - - - - -
- - 19972017 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - CosNaming Service - - - 1998-10-10 - - ch_naming_service.xml -
- -
- Overview of the CosNaming Service -

The CosNaming Service is a service developed to help users and - programmers identify objects by human readable names rather than by a - reference. By binding a name to a naming context (another object), a - contextual reference is formed. This is helpful when navigating in the - object space. In addition, identifying objects by name allows you to evolve - and/or relocate objects without client code modification.

-

The CosNaming service has some concepts that are important:

- - -

name binding - a name to object association.

-
- -

naming context - is an object that contains a set of - name bindings in which each name is unique. Different names can be - bound to the same object. -

-
- -

to bind a name - is to create a name binding in a given - context.

-
- -

to resolve a name - is to determine the object associated - with the name in a given context.

-
-
-

A name is always resolved in a context, there no absolute names exist. - Because a context is like any other object, it can also be bound to - a name - in a naming context. - This will result in a naming graph (a directed graph with notes and - labeled edges). The graph allows more complex names to refer to an - object. Given a context, you can use a sequence to reference an object. - This sequence is henceforth referred to as name and the - individual - elements in the sequence as name components. All but the - last name component are bound to naming contexts. -

-

The diagram in figure 1 illustrates how the Naming Service provides a - contextual relationship between objects, NamingContexts and - NameBindings to create an object locality, as the - object itself, has no name. -

- - - -Figure 1: Contextual object relationships using the Naming Service. - -

The naming contexts provide a directory of contextual - reference and naming for objects (an object can appear to - have more than one name). -

-

In figure 1 the object to the right can either be - called alpha from one context or gamma from another. -

-

The Naming Service has an initial naming context, which is shown - in the diagram as the top-most object in the naming graph. - It has two names beta and epsilon, which are bound to other - naming contexts. The initial naming context is a well known location - used to share a common name space between multiple programs. - You can traverse the naming graph until you reach a name, which is - bound to an object, which is not a naming context. -

-

We recommend reading chapter 12, CORBA Fundamentals and Programming, for detailed information regarding the - Naming Service.

-
- -
- The Basic Use-cases of the Naming Service -

The basic use-cases of the Naming Service are: -

- - Fetch initial reference to the naming service. - Creating a naming context. - Binding and unbinding names to objects. - Resolving a name to an object. - Listing the bindings of a naming context. - Destroying a naming context. - - -
- Fetch Initial Reference to the Naming Service -

In order to use the naming service you have to fetch an - initial reference to it. This is done with:

- -NS = corba:resolve_initial_references("NameService"). - - -

NS in the other use-cases refers to this initial reference.

-
-
- -
- Creating a Naming Context -

There are two functions for creating a naming context. - The first function, which only creates a naming context object is:

- -NC = 'CosNaming_NamingContext':new_context(NS). - -

The other function creates a naming context and binds it to a name in - an already existing naming context (the initial context in this - example): -

- -NC = 'CosNaming_NamingContext':bind_new_context(NS, lname:new(["new"])). - -
- -
- Binding and Unbinding Names to Objects -

The following steps illustrate how to bind/unbind an object reference - to/from a name. For the example below, assume that the NamingContexts - in the path are already bound to the name /workgroup/services, - and that reference to the services context are in the variable - Sc.

- - -

Use the naming library functions to create a name

- -Name = lname:new(["object"]). - -
- -

Use CosNaming::NamingContext::bind() to bind a name to an object

- -'CosNaming_NamingContext':bind(Sc, Name, Object). - -
- -

Use CosNaming::NamingContext::unbind() to remove the NameBinding from an object

- -'CosNaming_NamingContext':unbind(Sc, Name). - -
-
- -

Objects can have more than one name, to indicate different paths to - the same object.

-
-
- -
- Resolving a Name to an Object -

The following steps show how to retrieve the object reference to the service context - above (/workgroup/services).

- - -

Use the naming library functions to create a name path:

- -Name = lname:new(["workgroup", "services"]). - -
- -

Use CosNaming::NamingContext::resolve() to to resolve the name to an object

- -Sc = 'CosNaming_NamingContext':resolve(NS, Name). - -
-
-

An alternative is to use:

- -Sc = corba:string_to_object("corbaname:rir:/NameService#workgroup/services/"). - -

The corbaname schema is described further in the Interoperable - Naming Service section.

-
- -
- Listing the Bindings in a NamingContext - - -

Use CosNaming::NamingContext::list() to list all the bindings in a context

-

The following code retrieves and lists up to 10 bindings from a context.

- -{BList, BIterator} = 'CosNaming_NamingContext':list(Sc, 10). - -lists:foreach(fun({{Id, Kind},BindingType}) -> case BindingType of - nobject -> - io:format("id: %s, kind: %s, type: object~n", [Id, Kind]); - _ -> - io:format("id: %s, kind: %s, type: ncontext~n", [Id, Kind]) - end end, - Blist). - -
-
- -

Normally a The binding iterator (Like a book mark) indicates which objects have been read from the list.is helpful in situations where you have a large number of objects - in a list, as the programmer then can traverse it more easily. - In Erlang it is not needed, because lists are easily handled in the - language itself.

-
- -

Remember that the BindingIterator (BIterator in the example) is an object and therefore - must be removed otherwise dangling processes will occur. - Use CosNaming::BindingIterator::destroy() to remove it.

-
- -'CosNaming_NamingContext':destroy(BIterator). - -
- -
- Destroying a Naming Context -

The naming contexts are persistent and must be explicitly removed. - (they are also removed if all Orber nodes in the domain are stopped).

- - -

Use CosNaming::NamingContext::destroy() to remove a NamingContext

- -'CosNaming_NamingContext':destroy(Sc). - -
-
-
-
- -
- Interoperable Naming Service - -

The OMG specifies URL schemes, which represent a CORBA object and a CORBA object - bound in a NamingContext, for resolving references from other ORB:s. As of today, - three schemes are defined:

- - IOR - corbaloc - corbaname - - -
- IOR -

A stringified IOR is a valid URL format but difficult for humans to handle - through non-electronic means. This URL format does not depend on a specific - Name Service and, thus, is robust and insulates the client from the encapsulated - transport information and object key used to reference the object.

-
- -
- corbaloc -

The notation of this scheme is similar to the more well known URL HTTP, and - the full corbaloc BNF is:

- = "corbaloc:"["/"] - = [","]* - = | - = | - = ":" - = rir - = - = ":" - = - = | ":" - = ":" - = "iiop" - = [":"] - = | | "[""]" - = ".""@" | empty_string - = number - = number - = number - = string - = string - = string - = for example NameService - ]]> -

The corbaloc scheme consists of 3 parts:

- - Protocol - as of today iiop or rir is supported. - Using rir means that we will resolve the given Key locally, i.e., - the same as using corba:resolve_initial_references("NameService"). - IIOP address - this address can be divided into Version, Host - and Port. If the version or port are left out they will be set to the default - values 1.0 and 2809 respectively. - KeyString - an object key, e.g., "NameService". If no Key is - supplied the default value "NameService" will be used. - -

A corbaloc can be passed used together with - corba:string_to_object("corbaloc::1.0@erlang.org:4001/NameService") or set as the - configuration variables orbInitilRef or orbDefaultInitilRef and calling - corba:resolve_initial_references("NameService"). For more information see the Orber - installation chapter. corbaloc can also be used together with corbaname - to gain an easy access to a Name Service.

-

Currently, the OMG defines a set of reserved keys and the type of object, - listed below, they should be associated with. The NameService - key may not be changed in Orber. If you want to add one of the - reserved keys as an initial service, simply use:

- -1> Factory = cosNotificationApp:start_global_factory(). -2> corba:add_initial_service("NotificationService", Factory). - -

This object can then be easily resolved by any other ORB, supporting - the Interoperable Naming Service, by using:

- -3> NF = corba:string_to_object("corbaloc::1.0@erlang.org:4001/NotificationService"). - - - - String Name - Object Type - - - RootPOA - PortableServer::POA - - - POACurrent - PortableServer::Current - - - InterfaceRepository - CORBA::Repository - - - NameService - CosNaming::NamingContext - - - TradingService - CosTrading::Lookup - - - SecurityCurrent - SecurityLevel1::Current/SecurityLevel2::Current - - - TransactionCurrent - CosTransaction::Current - - - DynAnyFactory - DynamicAny::DynAnyFactory - - - ORBPolicyManager - CORBA::PolicyManager - - - PolicyCurrent - CORBA::PolicyCurrent - - - NotificationService - CosNotifyChannelAdmin::EventChannelFactory - - - TypedNotificationService - CosTypedNotifyChannelAdmin::TypedEventChannelFactory - - - CodecFactory - IOP::CodecFactory - - - PICurrent - PortableInterceptors::Current - - Currently reserved key strings -
-
- -
- corbaname -

The corbaname URL scheme is an extension of the corbaloc scheme, and - the full corbaname BNF is:

- = "corbaname:"["/"]["#"] - = as described above. - = as described above. - ]]> -

The string_name, concatenated to the corbaloc string, identifies - a binding in a naming context. A name component consists of two parts, i.e., - id and kind, which is represented as follows:

- - - String Name - Name Sequence - Comment - - - "id1/./id3.kind3" - [{"id1",""},{"",""},{"id3","kind3"}] - The first component has no kind defined while the second component's both fields are empty. - - - "id1//id3.kind3" - ERROR - Not allowed, must insert a '.' between the '//'. - - - "id1.kind1/." - [{"id1","kind1"},{"",""}] - The first component's fields are both set while the second component's both fields are empty. - - - "id1.kind1/id2." - ERROR - An Id with a trailing '.' is not allowed. - - - "i\\/d1/i\\.d2" - [{"i/d1",""},{"i.d2",""}] - Since '.' and '/' are used to separate the components, these tokens must be escaped to be correctly converted. - - Stringified Name representation -
-

After creating a stringified Name we can either use:

- -NameStr = "org.erlang", -NS = corba:resolve_initial_references("NameService"), -Obj = 'CosNaming_NamingContextExt':resolve_str(NS, NameStr), - -

or concatenate the Name String using:

- -NameStr = "Swedish/Soccer/Champions", -Address = "corbaname:iiop:1.0@www.aik.se:2000/NameService", -NS = corba:resolve_initial_references("NameService"), -URLStr = 'CosNaming_NamingContextExt':to_url(NS, Address, NameStr), -Obj = corba:string_to_object(URLStr), - -

Using the first alternative, the configuration variables orbInitilRef and - orbDefaultInitilRef, will determine which other ORB's or the local - Name Service Orber will try to resolve the given string from. The second - alternative allows us to override any settings of the configuration variables.

-

The function to_url/3 will perform any necessary escapes compliant with - IETF/RFC 2396. US-ASCII alphanumeric characters and - - are not escaped.

-
-
-
- diff --git a/lib/orber/doc/src/ch_orber_kernel.xml b/lib/orber/doc/src/ch_orber_kernel.xml deleted file mode 100644 index 396e1360fd..0000000000 --- a/lib/orber/doc/src/ch_orber_kernel.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - The Orber Application - - - 1998-10-05 - - ch_orber_kernel.xml -
- -
- ORB Kernel and IIOP -

This chapter gives a brief overview of the ORB and its relation - to objects in a distributed environment and the usage of Domains - in Orber. - Also Internet-Inter ORB Protocol (Internet-Inter ORB Protocol) is discussed and how this - protocol facilitates communication between ORBs to - allow the accessory of persistent server objects in Erlang.

-
- -
- The Object Request Broker (ORB) -

An ORB kernel can be best described as the middle-ware, which - creates relationships between clients and servers, but is - defined by its interfaces. This allows transparency for the - user, as they do not have to be aware of where the requested - object is located. Thus, the programmer can work with any other - platform provided that an IDL mapping and interfaces exist. -

-

The IDL mapping which is described in a later chapter is the - translator between other platforms, and languages. However, it - is the ORB, which provides objects with a structure by which - they can communicate with other objects. -

-

ORBs intercept and direct messages from one object, pass this - message using IIOP to another ORB, which then directs the - message to the indicated object. -

-

An ORB is the base on which interfaces, communication stubs - and mapping can be built to enable communication between - objects. Orber uses A domain allows a more efficient communication protocol to be used between objects not on the same node without the need of an ORBto group objects of different nodes -

-

How the ORB provides communication is shown very simply in figure 1 below:

- - - -Figure 1: How the Object Request Broker works. - -

The domain in Orber gives an extra aspect to the distributed object - environment as each domain has one ORB, but it is distributed over - a number of object in different nodes. The domain binds objects on - nodes more closely than distributed objects in different domains. The - advantage of a domain is that a faster communication exists between - nodes and objects of the same domain. An internal communication protocol - (other than IIOP) allows a - more efficient communication between these objects.

- -

Unlike objects, domains can only have one name - so that no communication ambiguities exist between domains.

-
-
- -
- Internet Inter-Object Protocol (IIOP) -

IIOP is a communication protocol developed by the OMG to - facilitate communication in a distributed object-oriented - environment. -

-

Figure 2 below demonstrates how IIOP works between objects:

- - - -Figure 2: IIOP communication between domains and objects. - - -

Within the Orber domains the objects communicate without - using the IIOP. However, the user is unaware of the difference in protocols, as this difference is not visible.

-
-
-
- diff --git a/lib/orber/doc/src/ch_orberweb.xml b/lib/orber/doc/src/ch_orberweb.xml deleted file mode 100644 index c9dcc382e6..0000000000 --- a/lib/orber/doc/src/ch_orberweb.xml +++ /dev/null @@ -1,221 +0,0 @@ - - - - -
- - 20012017 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - OrberWeb - Nick - - 2001-11-22 - - ch_orberweb.xml -
- -
- Using OrberWeb -

OrberWeb is intended to make things easier when developing and - testing applications using Orber. The user is able to interact - with Orber via a GUI by using a web browser.

-

OrberWeb requires that the application WebTool is available and - started on at least one node; if so OrberWeb can usually be used to - to access Orber nodes supporting the Interoperable Naming - Service. How to start OrberWeb is described in - Starting OrberWeb

-

The OrberWeb GUI consists of a Menu Frame and a - Data Frames.

- -
- The Menu Frame -

The menu frame consists of:

- - Node List - which node to access. - Configuration - see how Orber on the current node is configured. - Name Service - browse the NameService and add/remove a Context/Object. - IFR Types - see which types are registered in IFR. - Create Object - create a new object and, possibly, store it in the NameService. - -

- - - The Menu Frame. - -

Which nodes we can access is determined by what is returned when invoking [node()|nodes()]. - If you cannot see a desired node in the list, you have to call net_adm:ping(Node). - But this requires that the node is started with the distribution switched on - (e.g. erl -sname myNode); this also goes for the node OrberWeb is running on.

-
- -
- The Configuration Data Frame -

When accessing the Configuration page OrberWeb presents a table containing the - configuration settings for the target node.

-

- - - Configuration Settings. - -

It is also possible to change those configuration parameters which can be changed when Orber - is already started. The Key-Value pairs is given as a list of tuples, e.g., - [{orber_debug_level, 5}, {iiop_timeout, 60}, {giop_version, {1,2}}]. If one tries to update a parameter - which may not be changed an error message will be displayed.

-
- -
- The IFR Data Frame -

All types registered in the IFR (Interface Repository) which have an associated IFR-id - can be viewed via the IFR Data Frame. This gives the user an easy way to confirm that - all necessary IDL-specifications have been properly registered. All available types are - listed when choosing IFR Types in the menu frame:

-

- - - Select Type. - -

After selecting a type all definitions of that particular type will be displayed. If no such - bindings exists the table will be empty.

-

Since Orber adds definitions to the IFR when it is installed (e.g. CosNaming), not only - types defined by the user will show up in the table. In the figure below you find the - the NameService exceptions listed.

-

- - - List Registered Exceptions. - -
- -
- The NameService Data Frame -

The NameService main purpose is to make possible to bind object references, which - can client applications can resolve and invoke operations on. Initially, the NameService - is empty. The most common scenario, is that user applications create Contexts and add objects - in the NameService. OrberWeb allows the user to do the very same thing.

-

When referencing an object or context you must use stringified NameComponents. - For more information see the Interoperable Naming Service. - In the following example we will use the string org/erlang/TheObjectName, where - org and erlang will be contexts and TheObjectName - the name the object will be bound to.

-

Since the NameService is empty in the beginning, the only thing we can do is creating - a new context. Simply write org in the input field and press New Context. - If OrberWeb was able to create the context or not, is shown in the completion message. - If successful, just press the Go Back button. Now, a link named org should - be listed in the table. In the right column the context type is displayed. Contexts are - associated with ncontext and objects with nobject.

-

- - - Add a New Context. - -

To create the next level context (i.e. erlang), simply follow the link and repeat the procedure. - If done correctly, a table containing the same data as the following figure should be the result - if you follow the erlang link. Note, that the path is displayed in the yellow - field.

-

-

If a context does not contain any sub-contexts or object bindings, it is possible to - delete the context. If these requirements are met, a Delete Context button will appear. - A completion status message will be displayed after deleting the context.

-

- - - Delete Context. - -

Now it is possible to bind an object using the complete name string. To find out how this is - done using OrberWeb see Object Creation. - For now, we will just assume that an object have been created and bound as TheObjectName.

-

- - - Object Stored in the NameService. - -

If you follow the TheObjectName link, data about the bound object will be - presented. Note, depending on which type of object it is, the information given differs. - It would, for example, not be possible to display a Pid for all types of objects since - it might reside on a Java-ORB. In the figure below a CosNotification FilterFactory have - been bound under the name org/erlang/TheObjectName.

-

- - - Object Data. - -

OrberWeb also makes it possible to remove a binding and dispose the associated object. - Pressing Unbind the binding will be removed but the object will still exist. - But, if the Unbind and Dispose button is pressed, the binding will be removed - and the object terminated.

-
- -
- The Object Creation Data Frame - -

This part makes it possible to create a new object and, if wanted, store it the - NameService.

-

- - - Create a New Object. - - - Module - simply type the name of the module of the object type - you want to create. If the module begins with a capital letter, we normally must - write 'Module_Interface'. But, when using OrberWeb, you shall NOT. - Since we cannot create linked objects this is not an option. - Arguments - the supplied arguments must be written as a single Erlang term. - That is, as a list or tuple containing other Erlang terms. The arguments will be - passed to the init function of the object. It is, however, not possible - to use Erlang records. If OrberWeb is not able to parse the arguments, an error message - will be displayed. If left empty, an empty list will be passed. - Options - the options can be the ones listed under - Module_Interface in Orber's Reference manual. - Hence, they are not further described here. But, as an example, in the figure above - we started the object as globally registered. If no options supplied the object - will be started as default. - Name String - if left empty the object will not be registered in the - NameService. Hence, it is important that you can access the object in another way, - otherwise a zombie process is created. In the previous section we used the name string - org/erlang/TheObjectName. If we choose the same name here, the listed contexts - (i.e. org and erlang) must be created before we can create - and bind the object to TheObjectName. If this requirement is not met, OrberWeb - cannot bind the object. Hence, the object will be terminated and an error message - displayed. - Operation to use - which option choosed will determine the behavior of OrberWeb. - If you choose bind and a binding already exists an error message will be - displayed and the newly started object terminated. But if you choose rebind - any existing binding will over-written. - -
-
- -
- Starting OrberWeb - -

You may choose to start OrberWeb on node, on which Orber is running or not. But - the Erlang distribution must be started (e.g. by using -sname aNodeName). Now, all - you have to do is to invoke:

- -erl> webtool:start(). -WebTool is available at http://localhost:8888/ -Or http://127.0.0.1:8888/ - -

Type one of the URL:s in your web-browser. If you want to access the WebTool application - from different machine, just replace localhost with its name. For more information, - see the WebTool documentation.

-
-
- diff --git a/lib/orber/doc/src/ch_security.xml b/lib/orber/doc/src/ch_security.xml deleted file mode 100644 index 151e417079..0000000000 --- a/lib/orber/doc/src/ch_security.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - -
- - 19992016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - How to use security in Orber - - - 1999-09-01 - - ch_security.xml -
- -
- Security in Orber - -
- Introduction -

Orber SSL provides authentication, privacy and integrity for your - Erlang applications. Based on the Secure Sockets Layer protocol, the - Orber SSL ensures that your Orber clients and servers can - communicate securely over any network. - This is done by tunneling IIOP through an SSL connection. To get - the node secure you will also need to have a firewall which - only lets through connections to certain ports.

-
- -
- Enable Usage of Secure Connections -

To enable a secure Orber domain you have to set the configuration variable - secure which currently only can have one of two values; - no if no security for IIOP should be used and ssl if - secure connections is needed (ssl is currently the only supported - security mechanism).

-

The default is no security.

-
- -
- Configurations when Orber is Used on the Server Side -

There is a variable to conficure Orber's SSL behavior on the server side.

- - ssl_server_options - which is a list of options to ssl. - See the SSL application for further - descriptions on these options. - -

There also exist an API function for accessing the value of this variable:

- - orber:ssl_server_options/0 - -
- -
- Configurations when Orber is Used on the Client Side -

When the Orber enabled application is the client side in the secure connection the - different configurations can be set per client process instead and not for the whole domain - as for incoming calls.

-

There is a variable to set default values for the domain but they can be changed - per client process.

- - ssl_client_options - which is a list of options to ssl. - See the SSL application for further - descriptions on these options. - -

There also exist two API functions for accessing and changing the values of this - variable in the client processes.

-

Access function:

- - orber:ssl_client_options/0 - -

Modify function:

- - orber:set_ssl_client_options/1 - -
-
-
- diff --git a/lib/orber/doc/src/ch_stubs.xml b/lib/orber/doc/src/ch_stubs.xml deleted file mode 100644 index 9290c127f9..0000000000 --- a/lib/orber/doc/src/ch_stubs.xml +++ /dev/null @@ -1,284 +0,0 @@ - - - - -
- - 19992017 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Orber Stubs/Skeletons - - - 1999-09-03 - A - ch_stubs.xml -
- -
- Orber Stubs and Skeletons Description -

This example describes the API and behavior of Orber stubs and skeletons. -

- -
- Server Start -

Orber servers can be started in several ways. The chosen start functions determines - how the server can be accessed and its behavior. -

-

Using Module_Interface:oe_create() or oe_create_link(): -

- - No initial data can be passed. - Cannot be used as a supervisor child start function. - Only accessible through the object reference returned by the start function. - The object reference is no longer valid if the server dies and is restarted. - -

Using Module_Interface:oe_create(Env) or oe_create_link(Env):

- - Initial data can be passed using Env. - Cannot be used as a supervisor child start function. - Only accessible through the object reference returned by the start function. - The object reference is no longer valid if the server dies and is restarted. - -

Using Module_Interface:oe_create(Env, Options):

- - Initial data can be passed using Env. - Cannot be used as a supervisor child start function. - Accessible through the object reference returned by the start function. If the option - {regname, RegName} is used the object reference stays valid even if the - server has been restarted. - If the options {persistent, true} and {regname, {global, Name}} is used, - the result from an object invocation will be the exception 'OBJECT_NOT_EXIST' - only if the object has terminated with reason - normal or shutdown. If the object is in the process of restarting, the result - will be {error, Reason} or a system exception is raised. - The option {pseudo, true} makes it possible to start create non-server objects. - There are, however, some limitations, which are further described in the - Pseudo objects section. - -

Using Module_Interface:oe_create_link(Env, Options):

- - Initial data can be passed using Env. - Can be used as a supervisor child start function if the option {sup_child, true} used. - Accessible through the object reference returned by the start function. If the option - {regname, RegName} is used the object reference stays valid even if the - server has been restarted. - If the options {persistent, true} and {regname, {global, Name}} is used, - the result from an object invocation will be the exception 'OBJECT_NOT_EXIST' - only if the object has terminated with reason - normal or shutdown. If the object is in the process of restarting, the result - will be {error, Reason} or a system exception is raised. - For starting a server as a supervisor child you should use the options - [{persistent, true}, {regname, {global, Name}}, {sup_child, true}] and of type transient. - This configuration allows you to delegate restarts to the supervisor and still be able to - use the same object reference and be able to see if the server is permanently terminated. - Please note you must use supervisor/stdlib-1.7 or later and that the it returns - {ok, Pid, Object} instead of just Object. - Using the option {pseudo, true} have the same effect as using - oe_create/2. - - -

To avoid flooding Orber with old object references start erlang using the flag - -orber objectkeys_gc_time Time, which will remove all object references - related to servers being dead for Time seconds. To avoid extra overhead, i.e., performing - garbage collect if no persistent objects are started, the objectkeys_gc_time default value - is infinity. For more information, see the orber and corba documentation.

-
- -

Orber still allow oe_create(Env, {Type,RegName}) and oe_create_link(Env, {Type,RegName}) to be used, - but may not in future releases.

-
-
- -
- Pseudo Objects -

This section describes Orber pseudo objects. -

-

The Orber stub can be used to start a pseudo object, which will create a non-server implementation. - A pseudo object introduce some limitations:

- - The functions oe_create_link/2 is equal to oe_create/2, i.e., - no link can or will be created. - The BIF:s self() and process_flag(trap_exit,true) behaves incorrectly. - The IC option {{impl, "M::I"}, "other_impl"} has no effect. The call-back - functions must be implemented in a file called M_I_impl.erl - The call-back functions must be implemented as if the IC option - {this, "M::I"} was used. - The gen_server State changes have no effect. The user can provide information via - the Env start parameter and the State returned from init/2 will be the State - passed in following invocations. - The server reply Timeout has no effect. - The compile option from has no effect. - The option {pseudo, true} overrides all other start options. - Only the functions, besides own definitions, init/2 (called via oe_create*/2) and - terminate/2 (called via corba:dispose/1) must be implemented. - -

By adopting the rules for pseudo objects described above we can use oe_create/2 - to create server or pseudo objects, by excluding or including the - option {pseudo, true}, without changing the call-back module.

-

To create a pseudo object do the following:

- -fingolfin 127> erl -Erlang (BEAM) emulator version 4.9 - -Eshell V4.9 (abort with ^G) -1> ic:gen(myDefinition, [{this, "MyModule::MyInterface"}]). -Erlang IDL compiler version 20 -ok -2> make:all(). -Recompile: oe_MyDefinition -Recompile: MyModule_MyInterface -Recompile: MyModule_MyInterface_impl -up_to_date -3> PseudoObj = MyModule_MyInterface:oe_create(Env, [{pseudo, true}]). - -

The call-back functions must be implemented as MyFunction(OE_THIS, State, Args), - and called by MyModule_MyInterface:MyFunction(PseudoObj, Args).

-
- -
- Call-back Module -

This section provides an example of how a call-back module may be implemented.

- -

Arguments and Replies are determined by the IDL-code and, hence, not - further described here.

-
- -%%%----------------------------------------------------------- -%%% File : Module_Interface_impl.erl -%%% Author : -%%% Purpose : -%%% Created : -%%%----------------------------------------------------------- - --module('Module_Interface_impl'). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib(".. .."). - -%%--------------- EXPORTS------------------------------------- -%% Arity depends on IC configuration parameters and the IDL -%% specification. --export([own_function/X]). - - -%%--------------- gen_server specific ------------------------ --export([init/1, terminate/2, code_change/3, handle_info/2]). - -%%------------------------------------------------------------ -%% function : server specific -%%------------------------------------------------------------ -init(InitialData) -> - %% 'trap_exit' optional (have no effect if pseudo object). - process_flag(trap_exit,true), - - %%--- Possible replies --- - %% Reply and await next request - {ok, State}. - - %% Reply and if no more requests within Time the special - %% timeout message should be handled in the - %% Module_Interface_impl:handle_info/2 call-back function (use the - %% IC option {{handle_info, "Module::Interface"}, true}). - {ok, State, Timeout} - - %% Return ignore in order to inform the parent, especially if it is a - %% supervisor, that the server, as an example, did not start in - %% accordance with the configuration data. - ignore - %% If the initializing procedure fails, the reason - %% is supplied as StopReason. - {stop, StopReason} - -terminate(Reason, State) -> - ok. - -code_change(OldVsn, State, Extra) -> - {ok, NewState}. - -%% If use IC option {{handle_info, "Module::Interface"}, true}. -%% (have no effect if pseudo object). -handle_info(Info, State) -> - %%--- Possible replies --- - %% Await the next invocation. - {noreply, State}. - %% Stop with Reason. - {stop, Reason, State}. - -%%--- two-way ------------------------------------------------ -%% If use IC option {this, "Module:Interface"} -%% (Required for pseudo objects) -own_function(This, State, .. Arguments ..) -> -%% IC options this and from -own_function(This, From, State, .. Arguments ..) -> -%% IC option from -own_function(From, State, .. Arguments ..) -> - %% Send explicit reply to client. - corba:reply(From, Reply), - %%--- Possible replies --- - {noreply, State} - {noreply, State, Timeout} - - -%% If not use IC option {this, "Module:Interface"} -own_function(State, .. Arguments ..) -> - %%--- Possible replies --- - %% Reply and await next request - {reply, Reply, State} - - %% Reply and if no more requests within Time the special - %% timeout message should be handled in the - %% Module_Interface_impl:handle_info/2 call-back function (use the - %% IC option {{handle_info, "Module::Interface"}, true}). - {reply, Reply, State, Timeout} - - %% Stop the server and send Reply to invoking object. - {stop, StopReason, Reply, State} - - %% Stop the server and send no reply to invoking object. - {stop, StopReason, State} - - %% Raise exception. Any changes to the internal State is lost. - corba:raise(Exception). - -%%--- one-way ------------------------------------------------ -%% If use IC option {this, "Module:Interface"} -%% (Required for pseudo objects) -own_function(This, State, .. Arguments ..) -> - -%% If not use IC option {this, "Module:Interface"} -own_function(State, .. Arguments ..) -> - %%--- Possible results --- - {noreply, State} - - %% Release and if no more requests within Time the special - %% timeout message should be handled in the - %% Module_Interface_impl:handle_info/2 call-back function (use the - %% IC option {{handle_info, "Module::Interface"}, true}). - {noreply, State, Timeout} - - %% Stop the server with StopReason. - {stop, StopReason, State} - -%%--------------- END OF MODULE ------------------------------ - -
-
-
- diff --git a/lib/orber/doc/src/corba.xml b/lib/orber/doc/src/corba.xml deleted file mode 100644 index fbfb55f2f2..0000000000 --- a/lib/orber/doc/src/corba.xml +++ /dev/null @@ -1,454 +0,0 @@ - - - - -
- - 19972017 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - corba - - - - - - 1997-06-10 - A -
- corba - The functions on CORBA module level - -

This module contains functions that are specified on the CORBA module - level. It also contains some functions for creating and disposing - objects.

-
- - - create(Module, TypeID) -> Object - create(Module, TypeID, Env) -> Object - create(Module, TypeID, Env, Optons1) -> Object - create_link(Module, TypeID) -> Object - create_link(Module, TypeID, Env) -> Object - create_link(Module, TypeID, Env, Options2) -> Reply - Create and start a new server object - - Module = atom() - TypeID = string() - Env = term() - Options1 = [{persistent, Bool} | {regname, RegName} | {local_typecheck, Bool}] - Options2 = [{sup_child, Bool} | {persistent, Bool} | {regname, RegName} | {pseudo, Bool} | {local_typecheck, Bool}] - RegName = {local, atom()} | {global, term()} - Reply = #objref | {ok, Pid, #objref} - Bool = true | false - Object = #objref - - -

These functions start a new server object. If you start it - without RegName it can only be accessed through the - returned object key. Started with a RegName the name is - registered locally or globally.

-

TypeID is the repository ID of the server object type and - could for example look like "IDL:StackModule/Stack:1.0".

-

Module is the name of the interface API module.

-

Env is the arguments passed which will be passed to the - implementations init call-back function.

-

A server started with create/2, create/3 or create/4 does not care - about the parent, which means that the parent is not handled - explicitly in the generic process part.

-

A server started with create_link2, create_link/3 or create_link/4 - is initially linked to the caller, the parent, and it will - terminate whenever the parent process terminates, and with the same - reason as the parent. If the server traps exits, the terminate/2 - call-back function is called in order to clean up before the - termination. These functions should be used if the server is a - worker in a supervision tree.

-

If you use the option {sup_child, true} create_link/4 will return - {ok, Pid, #objref}, otherwise #objref, and make it possible - to start a server as a supervisor child (stdlib-1.7 or later).

-

If you use the option {persistent, true} you also must use the option - {regname, {global, Name}}. This combination makes it possible to tell - the difference between a server permanently terminated or in the process of restarting.

-

The option {pseudo, true}, allow us to create an object which is not a - server. Using {pseudo, true} overrides all other start options. - For more information see section Module_Interface.

-

If a server is started using the option {persistent, true} the object key - will not be removed unless it terminates with reason normal or shutdown. - Hence, if persistent servers is used as supervisor children they should be transient - and the objectkeys_gc_time should be modified (default equals infinity).

-

The option {local_typecheck, boolean()}, which overrides the - Local Typechecking - environment flag, turns on or off typechecking. If activated, - parameters, replies and raised exceptions will be checked to ensure that - the data is correct, when invoking operations on CORBA Objects within - the same Orber domain. Due to the extra overhead, this option - MAY ONLY be used during testing and development.

- -Example: - - corba:create('StackModule_Stack', "IDL:StackModule/Stack:1.0", {10, test}) - -
-
- - dispose(Object) -> ok - Stop a server object - - Object = #objref - - -

This function is used for terminating the execution of a - server object. Invoking this operation on a NIL object reference, - e.g., the return value of corba:create_nil_objref/0, always - return ok. For valid object references, invoking this operation - more than once, will result in a system exception.

-
-
- - create_nil_objref() -> Object - Stop a server object - - Object = #objref representing NIL. - - -

Creates an object reference that represents the NIL value. - Attempts to invoke operations using the returned object reference - will return a system exception.

-
-
- - create_subobject_key(Object, Key) -> Result - Add an Erlang term to a private key field - - Object = #objref - Key = term() - Result = #objref - - -

This function is used to create a subobject in a server object. - It can for example be useful when one wants unique access to - separate rows in a mnesia or an ETS table. The Result is - an object reference that will be seen as a unique reference to - the outside world but will access the same server object where one - can use the get_subobject_key/1 function to get the private - key value.

-

Key is stored in the object reference Object. - If it is a binary it will be stored as is and otherwise it is - converted to a binary before storage.

-
-
- - get_subobject_key(Object) -> Result - Fetch the contents of the private key field - - Object = #objref - Result = #binary - - -

This function is used to fetch a subobject key from the object - reference Object. The result is a always a binary, if it - was an Erlang term that was stored with create_subobject_key/2 - one can to do binary_to_term/1 to get the real value.

-
-
- - get_pid(Object) -> Result - Get the process id from an object key - - Object = #objref - Result = #pid | {error, Reason} | {'EXCEPTION',E} - - -

This function is to get the process id from an object, which is a - must when CORBA objects is started/handled in a supervisor tree. - The function will throw exceptions if the key is not found or - some other error occurs.

-
-
- - raise(Exception) - Generate an Erlang throw - - Exception = record() - - -

This function is used for raising corba exceptions as an - Erlang user generated exit signal. It will throw the tuple - {'EXCEPTION', Exception}.

-
-
- - reply(To, Reply) -> true - Send explicit reply to client - - To = client reference - Reply = IDL type - - -

This function can be used by a CORBA object to explicitly send - a reply to a client that invoked a two-way operation. If this operation - is used, it is not possible to return a reply in the call-back - module. -

-To must be the From argument provided to the - callback function, which requires that the IC option from - was used when compiling the IDL-file.

-
-
- - resolve_initial_references(ObjectId) -> Object - resolve_initial_references(ObjectId, Contexts) -> Object - Return the object reference for the given object id - - ObjectId = string() - Contexts = [Context] - Context = #'IOP_ServiceContext'{context_id = CtxId, context_data = CtxData} - CtxId = ?ORBER_GENERIC_CTX_ID - CtxData = {interface, Interface} | {userspecific, term()} | {configuration, Options} - Interface = string() - Options = [{Key, Value}] - Key = ssl_client_options - Value = allowed value associated with the given key - Object = #objref - - -

This function returns the object reference associated with the given - object id. Initially, only "NameService" is available. To add or remove - services use add_initial_service/2 or remove_initial_service/1.

-

The configuration context is used to override the global - SSL client side - configuration.

-
-
- - add_initial_service(ObjectId, Object) -> boolean() - Add a new initial service and associate it with the given id - - ObjectId = string() - Object = #objref - - -

This operation allows us to add initial services, which can be accessed by - using resolve_initial_references/1 or the corbaloc schema. - If using an Id defined by the OMG, the given object must be of the - correct type; for more information see the - Interoperable Naming Service. - Returns false if the given id already exists.

-
-
- - remove_initial_service(ObjectId) -> boolean() - Remove association between the given id and service - - ObjectId = string() - - -

If we don not want a certain service to be accessible, invoking this function - will remove the association. Returns true if able to terminate the - binding. If no such binding existed false is returned.

-
-
- - list_initial_services() -> [ObjectId] - Return a list of supported object id's - - ObjectId = string() - - -

This function returns a list of allowed object id's.

-
-
- - resolve_initial_references_remote(ObjectId, Address) -> Object - resolve_initial_references_remote(ObjectId, Address, Contexts) -> Object - Return the object reference for the given object id - - ObjectId = string() - Address = [RemoteModifier] - RemoteModifier = string() - Contexts = [Context] - Context = #'IOP_ServiceContext'{context_id = CtxId, context_data = CtxData} - CtxId = ?ORBER_GENERIC_CTX_ID - CtxData = {interface, Interface} | {userspecific, term()} | {configuration, Options} - Interface = string() - Options = [{Key, Value}] - Key = ssl_client_options - Value = allowed value associated with the given key - Object = #objref - - -

This function returns the object reference for the object id asked - for. - The remote modifier string has the following format: - "iiop://"<host>":"<port> where <host> = <DNS hostname> | - <IPv4 address> | "["<IPv6 address>"]". -

-

The configuration context is used to override the global - SSL client side - configuration.

- -

This operation is not supported by most ORB's. Hence, use - corba:string_to_object/1 instead.

-
-
-
- - list_initial_services_remote(Address) -> [ObjectId] - list_initial_services_remote(Address, Contexts) -> [ObjectId] - Return a list of supported object id's - - Address = [RemoteModifier] - RemoteModifier = string() - Contexts = [Context] - Context = #'IOP_ServiceContext'{context_id = CtxId, context_data = CtxData} - CtxId = ?ORBER_GENERIC_CTX_ID - CtxData = {interface, Interface} | {userspecific, term()} | {configuration, Options} - Interface = string() - Options = [{Key, Value}] - Key = ssl_client_options - Value = allowed value associated with the given key - ObjectId = string() - - -

This function returns a list of allowed object id's. - The remote modifier string has the following format: - "iiop://"<host>":"<port> where <host> = <DNS hostname> | - <IPv4 address> | "["<IPv6 address>"]". -

-

The configuration context is used to override the global - SSL client side - configuration.

- -

This operation is not supported by most ORB's. Hence, avoid - using it.

-
-
-
- - object_to_string(Object) -> IOR_string - Convert the object reference to the external string representation - - Object = #objref - IOR_string = string() - - -

This function returns the object reference as the external string - representation of an IOR.

-
-
- - string_to_object(IOR_string) -> Object - string_to_object(IOR_string, Contexts) -> Object - Convert the external string representation to an object reference - - IOR_string = string() - Contexts = [Context] - Context = #'IOP_ServiceContext'{context_id = CtxId, context_data = CtxData} - CtxId = ?ORBER_GENERIC_CTX_ID - CtxData = {interface, Interface} | {userspecific, term()} | {configuration, Options} - Interface = string() - Options = [{Key, Value}] - Key = ssl_client_options - Value = allowed value associated with the given key - Object = #objref - - -

This function takes a corbaname, corbaloc or an IOR on the - external string representation and returns the object reference.

-

To lookup the NameService reference, simply use:

- corbaloc:iiop:1.2@123.0.0.12:4001/NameService -

We can also resolve an object from the NameService by using:

- corbaname:iiop:1.2@123.0.0.12:4001/NameService#org/Erlang/MyObj -

To lookup the NameService reference with an IPv6 address, simply use:

- corbaloc:iiop:1.2@[FEC1:0:3:0:0312:44AF:FAB1:3D01]:4001/NameService -

For more information about corbaname and corbaloc, see - the User's Guide (Interoperable Naming Service).

-

The configuration context is used to override the global - SSL client side - configuration.

-

How to handle the interface context is further described in the User's Guide.

-
-
- - print_object(Data [, Type]) -> ok | {'EXCEPTION', E} | {'EXIT', R} | string() - Print the supplied object - - Data = IOR_string | #objref (local or external) | corbaloc/corbaname string - Type = IoDevice | error_report | {error_report, Reason} | info_msg | {info_msg, Comment} | string - IoDevice = see the io-module - Reason = Comment = string() - - -

The object represented by the supplied data is dissected and presented - in a more readable form. The Type parameter is optional; if not supplied - standard output is used. For error_report and info_msg - the error_logger module is used, with or without Reason or Comment. - If the atom string is supplied this function will return a flat - list. The IoDevice is passed to the operation io:format/2.

-

If the supplied object is a local reference, the output is equivalent - to an object exported from the node this function is invoked on.

-
-
- - add_alternate_iiop_address(Object, Host, Port) -> NewObject | {'EXCEPTION', E} - Add ALTERNATE_IIOP_ADDRESS component to the supplied local object - - Object = NewObject = local #objref - Host = string() - Port = integer() - - -

This operation creates a new instance of the supplied object - containing an ALTERNATE_IIOP_ADDRESS component. Only the new instance - contains the new component. When this object is passed to another - ORB, which supports the ALTERNATE_IIOP_ADDRESS, requests will be routed - to the alternate address if it is not possible to communicate with - the main address.

-

The ALTERNATE_IIOP_ADDRESS component requires that IIOP-1.2 is used. - Hence, make sure both Orber and the other ORB is correctly configured.

-

- -

Make sure that the given Object is accessible via the - alternate Host/port. For example, if the object is correctly started as - local or pseudo, the object should be available on all - nodes within a multi-node Orber installation. Since only one instance - exists for other object types, it will not be possible to access it - if the node it was started on terminates.

-
-
-
- - orb_init(KeyValueList) -> ok | {'EXIT', Reason} - Configure Orber before starting it - - KeyValueList = [{Key, Value}] - Key = any key listed in the configuration chapter - Value = allowed value associated with the given key - - -

This function allows the user to configure Orber in, for example, - an Erlang shell. Orber may NOT be started prior to invoking - this operation. For more information, see - configuration settings - in the User's Guide.

-
-
-
- -
- diff --git a/lib/orber/doc/src/corba_object.xml b/lib/orber/doc/src/corba_object.xml deleted file mode 100644 index 09a4b0bc3c..0000000000 --- a/lib/orber/doc/src/corba_object.xml +++ /dev/null @@ -1,194 +0,0 @@ - - - - -
- - 1997 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - corba_object - - - - - - 1997-11-10 - A -
- corba_object - The CORBA Object interface functions - -

This module contains the CORBA Object interface functions that can be - called for all objects.

-
- - - get_interface(Object) -> InterfaceDef - Fetch the interface description - - Object = #objref - InterfaceDef = term() - - -

This function returns the full interface description for an object.

-
-
- - is_nil(Object) -> boolean() - Return true, if the given object is a NIL object reference, otherwise false - - Object = #objref - - -

This function checks if the object reference has a nil object value, - which denotes no object. It is the reference that is tested and no - object implementation is involved in the test.

-
-
- - is_a(Object, Logical_type_id) -> Return - is_a(Object, Logical_type_id, Contexts) -> Return - Return true if the target object is an, or inherit from, object of the given type - - Object = #objref - Logical_type_id = string() - Contexts = [Context] - Context = #'IOP_ServiceContext'{context_id = CtxId, context_data = CtxData} - CtxId = ?ORBER_GENERIC_CTX_ID - CtxData = {interface, Interface} | {userspecific, term()} | {configuration, Options} - Interface = string() - Options = [{Key, Value}] - Key = ssl_client_options - Value = allowed value associated with the given key - Return = boolean() | {'EXCEPTION', E} - - -

The Logical_type_id is a string that is a share type - identifier (repository id). The function returns true if the object - is an instance of that type or an ancestor of the "most derived" - type of that object.

-

The configuration context is used to override the global - SSL client side - configuration.

-

Note: Other ORB suppliers may not support this function completely - according to the OMG specification. Thus, a is_a call may - raise an exception or respond unpredictable if the Object is - located on a remote node.

-
-
- - is_remote(Object) -> boolean() - Determine whether or not an object reference is remote - - Object = #objref - - -

This function returns true if an object reference is remote - otherwise false.

-
-
- - non_existent(Object) -> Return - non_existent(Object, Contexts) -> Return - Return false if the target object do not exist, otherwise true - - Object = #objref - Contexts = [Context] - Context = #'IOP_ServiceContext'{context_id = CtxId, context_data = CtxData} - CtxId = ?ORBER_GENERIC_CTX_ID - CtxData = {interface, Interface} | {userspecific, term()} | {configuration, Options} - Interface = string() - Options = [{Key, Value}] - Key = ssl_client_options - Value = allowed value associated with the given key - Return = boolean() | {'EXCEPTION', E} - - -

This function can be used to test if the object has been destroyed. - It does this without invoking any application level code. The ORB - returns true if it knows that the object is destroyed otherwise - false.

-

The configuration context is used to override the global - SSL client side - configuration.

-

Note: The OMG have specified two different operators, _not_existent (CORBA version 2.0 and 2.2) and - _non_existent (CORBA version 2.3), to be used for this function. It is not mandatory to support - both versions. Thus, a non_existent call may raise an exception or respond unpredictable - if the Object is located on a remote node. Depending on which version, ORB:s you intend to - communicate with supports, you can either use this function or not_existent/1.

-
-
- - not_existent(Object) -> Return - not_existent(Object, Contexts) -> Return - Return false if the target object do not exist, otherwise true - - Object = #objref - Contexts = [Context] - Context = #'IOP_ServiceContext'{context_id = CtxId, context_data = CtxData} - CtxId = ?ORBER_GENERIC_CTX_ID - CtxData = {interface, Interface} | {userspecific, term()} | {configuration, Options} - Interface = string() - Options = [{Key, Value}] - Key = ssl_client_options - Value = allowed value associated with the given key - Return = boolean() | {'EXCEPTION', E} - - -

This function is implemented due to Interoperable purposes. Behaves as - non_existent except the operator _not_existent is used when - communicating with other ORB:s.

-

The configuration context is used to override the global - SSL client side - configuration.

-
-
- - is_equivalent(Object, OtherObject) -> boolean() - Return true if the target object and the supplied object easily can be determined to be equal, otherwise false - - Object = #objref - OtherObject = #objref - - -

This function is used to determine if two object references are - equivalent so far the ORB easily can determine. It returns - true if the target object reference is equal to the - other object reference and false otherwise.

-
-
- - hash(Object, Maximum) -> int() - Return a hash value based on the target object - - Object = #objref - Maximum = int() - - -

This function returns a hash value based on the object reference - that not will change during the lifetime of the object. - The Maximum parameter denotes the upper bound of the value.

-
-
-
- -
- diff --git a/lib/orber/doc/src/dataframe1.gif b/lib/orber/doc/src/dataframe1.gif deleted file mode 100644 index 21bd0afbc5..0000000000 Binary files a/lib/orber/doc/src/dataframe1.gif and /dev/null differ diff --git a/lib/orber/doc/src/dataframe2.gif b/lib/orber/doc/src/dataframe2.gif deleted file mode 100644 index 26778932b4..0000000000 Binary files a/lib/orber/doc/src/dataframe2.gif and /dev/null differ diff --git a/lib/orber/doc/src/dataframe3.gif b/lib/orber/doc/src/dataframe3.gif deleted file mode 100644 index db8ffef7d1..0000000000 Binary files a/lib/orber/doc/src/dataframe3.gif and /dev/null differ diff --git a/lib/orber/doc/src/dataframe4.gif b/lib/orber/doc/src/dataframe4.gif deleted file mode 100644 index f64c7f3733..0000000000 Binary files a/lib/orber/doc/src/dataframe4.gif and /dev/null differ diff --git a/lib/orber/doc/src/dataframe5.gif b/lib/orber/doc/src/dataframe5.gif deleted file mode 100644 index 80e17945a2..0000000000 Binary files a/lib/orber/doc/src/dataframe5.gif and /dev/null differ diff --git a/lib/orber/doc/src/dataframe6.gif b/lib/orber/doc/src/dataframe6.gif deleted file mode 100644 index fb1c5d7827..0000000000 Binary files a/lib/orber/doc/src/dataframe6.gif and /dev/null differ diff --git a/lib/orber/doc/src/dataframe7.gif b/lib/orber/doc/src/dataframe7.gif deleted file mode 100644 index 1e18078f0a..0000000000 Binary files a/lib/orber/doc/src/dataframe7.gif and /dev/null differ diff --git a/lib/orber/doc/src/dataframe8.gif b/lib/orber/doc/src/dataframe8.gif deleted file mode 100644 index ef95c9a11f..0000000000 Binary files a/lib/orber/doc/src/dataframe8.gif and /dev/null differ diff --git a/lib/orber/doc/src/dependent.gif b/lib/orber/doc/src/dependent.gif deleted file mode 100644 index c65c427421..0000000000 Binary files a/lib/orber/doc/src/dependent.gif and /dev/null differ diff --git a/lib/orber/doc/src/example_part.xml b/lib/orber/doc/src/example_part.xml deleted file mode 100644 index 61c9524cc3..0000000000 --- a/lib/orber/doc/src/example_part.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - -
- - 20022016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Service Implementation - Niclas Eklund - - 2002-06-25 - A -
- -

This chapter describe how to implement Orber based CORBA services.

-
- -
- diff --git a/lib/orber/doc/src/firewall_nat.gif b/lib/orber/doc/src/firewall_nat.gif deleted file mode 100644 index 3a80aac724..0000000000 Binary files a/lib/orber/doc/src/firewall_nat.gif and /dev/null differ diff --git a/lib/orber/doc/src/fixed.xml b/lib/orber/doc/src/fixed.xml deleted file mode 100644 index ef4d1bd604..0000000000 --- a/lib/orber/doc/src/fixed.xml +++ /dev/null @@ -1,160 +0,0 @@ - - - - -
- - 20022017 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - fixed - - - - - - 2002-05-22 - A -
- fixed - the corba fixed type - -

This module contains functions that gives an interface to the CORBA fixed type.

-

The type Fixed used below is defined as:

- --record(fixed, {digits, scale, value}). - -

where digits is the total amount of digits it consists of and - scale is the number of fractional digits. The value field - contains the actual Fixed value represented as an integer. The limitations - of each field are:

- - Digits - integer(), -1 > Digits < 32 - Scale - integer(), -1 > Scale =< Digits - Value - integer(), range (31 digits): ±9999999999999999999999999999999 - -

Since the Value part is represented by an integer, it is vital that the - Digits and Scale values are correct. This also means that trailing zeros - cannot be left out in some cases:

- - fixed<5,3> eq. 03.140d eq. 3140 - fixed<3,2> eq. 3.14d eq. 314 - -

Leading zeros can be left out.

-

For your convenience, this module exports functions which handle - unary (-) and binary (+-*/) operations legal for the Fixed type. - Since a unary + have no effect, this module do not export such a - function. Any of the binary operations may cause an overflow (i.e. more than - 31 significant digits; leading and trailing zeros are not considered - significant). If this is the case, the Digit and Scale values are adjusted - and the Value truncated (no rounding performed). This behavior is - compliant with the OMG CORBA specification. Each binary operation have - the following upper bounds:

- - Fixed1 + Fixed2 - ]]> - Fixed1 - Fixed2 - ]]> - Fixed1 * Fixed2 - ]]> - Fixed1 / Fixed2 - ]]> - -

A quotient may have an arbitrary number of decimal places, which is - denoted by a scale of Sinf.

-
- - - create(Digits, Scale, Value) -> Result - Create a fixed type - - Result = Fixed Type | {'EXCEPTION', #'BAD_PARAM'{}} - - -

This function creates a new instance of a Fixed Type. If - the limitations is not fulfilled (e.g. overflow) an exception is - raised.

-
-
- - get_typecode(Fixed) -> Result - Create TypeCode representing the supplied fixed type - - Result = TypeCode | {'EXCEPTION', #'BAD_PARAM'{}} - - -

Returns the TypeCode which represents the supplied Fixed type. - If the parameter is not of the correct type, an exception is raised.

-
-
- - add(Fixed1, Fixed2) -> Result - Add the supplied Fixed types - - Result = Fixed1 + Fixed2 | {'EXCEPTION', #'BAD_PARAM'{}} - - -

Performs a Fixed type addition. - If the parameters are not of the correct type, an exception is raised.

-
-
- - subtract(Fixed1, Fixed2) -> Result - Subtract Fixed2 from Fixed1 - - Result = Fixed1 - Fixed2 | {'EXCEPTION', #'BAD_PARAM'{}} - - -

Performs a Fixed type subtraction. - If the parameters are not of the correct type, an exception is raised.

-
-
- - multiply(Fixed1, Fixed2) -> Result - Multiply Fixed1 with Fixed2 - - Result = Fixed1 * Fixed2 | {'EXCEPTION', #'BAD_PARAM'{}} - - -

Performs a Fixed type multiplication. - If the parameters are not of the correct type, an exception is raised.

-
-
- - divide(Fixed1, Fixed2) -> Result - Divide Fixed1 with Fixed2 - - Result = Fixed1 / Fixed2 | {'EXCEPTION', #'BAD_PARAM'{}} - - -

Performs a Fixed type division. - If the parameters are not of the correct type, an exception is raised.

-
-
- - unary_minus(Fixed) -> Result - Negate the supplied Fixed Type - - Result = -Fixed | {'EXCEPTION', #'BAD_PARAM'{}} - - -

Negates the supplied Fixed type. - If the parameter is not of the correct type, an exception is raised.

-
-
-
- -
- diff --git a/lib/orber/doc/src/ifr_notes.txt b/lib/orber/doc/src/ifr_notes.txt deleted file mode 100644 index 54f79be8cd..0000000000 --- a/lib/orber/doc/src/ifr_notes.txt +++ /dev/null @@ -1,53 +0,0 @@ --*-Mode: Outline;-*- - -* Transactions. - Transaction handling (or the use of mnesia:async_dirty) is not very - good at error checking. Code to handle errors from transactions must - be added. Right now it is not possible to mix atomic transactions - with dirty 'transactions' (i.e. async_dirty) and still check the - results consistently. This must be fixed if we are to read with - async_dirty instead of transaction, since we still want to do all - the writes with transaction and not async_dirty. - (This point might be moot. Simple reads are now done with - mnesia:dirty_read/1 outside of transactions). - -* Unresolved issues. - There are some places in the source code marked with '***' where the - code should be verified. It mostly concerns minor unresolved - unclarities in the specification. - -** orber_ifr_contained.erl - In move/4 there is a call to orber_ifr_contained:lookup_name/5. The - third argument, Levels_to_search, is set to -1, which means search - all contained objects. This is probably correct. - -** orber_ifr_interfacedef.erl - The function describe_interface/1 describes the interface without - its inherited interfaces. It is not clear whether this is correct or - not. It is possible to get a description of the inherited interfaces - by mapping describe_interface/1 on the list if interfaces returned - by get_base_interfaces/1. Also, since the structs - InterfaceDescription and FullInterfaceDescription both have a field - named base_interfaces, it is possible to get a description of the - inherited attributes by examining that field and applying a describe - function. - -** orber_ifr_orb.erl - create_union_tc/4 sets the fifth element in the typecode tuple to - -1, meaning no default case. - -** orber_ifr_repository.erl - The PrimitiveDef with kind pk_objref has an empty Id and an empty - Name. This is perhaps not correct. - -** orber_ifr_typecode.erl - None of the functions in this module are fully implemented and they - should not be used. - -** orber_ifr_uniondef.erl -*** '_set_members'/2 - What should the value of the discriminator-typecode be when updating - the type attribute? (CORBA 2.0, p 6-20). For now we just leave it - unchanged, but this is perhaps not the right thing to do. - -* Exceptions should give more information about the failure. diff --git a/lib/orber/doc/src/iiop.gif b/lib/orber/doc/src/iiop.gif deleted file mode 100644 index d2f2fd128c..0000000000 Binary files a/lib/orber/doc/src/iiop.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/GridBagEx.gif b/lib/orber/doc/src/images/GridBagEx.gif deleted file mode 100644 index 16c326d88c..0000000000 Binary files a/lib/orber/doc/src/images/GridBagEx.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/OpenBookIcon.gif b/lib/orber/doc/src/images/OpenBookIcon.gif deleted file mode 100644 index 86384f7733..0000000000 Binary files a/lib/orber/doc/src/images/OpenBookIcon.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/blue-ball-small.gif b/lib/orber/doc/src/images/blue-ball-small.gif deleted file mode 100644 index d4c5cde5b0..0000000000 Binary files a/lib/orber/doc/src/images/blue-ball-small.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/blue-ball.gif b/lib/orber/doc/src/images/blue-ball.gif deleted file mode 100644 index edc29b786c..0000000000 Binary files a/lib/orber/doc/src/images/blue-ball.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/class-index.gif b/lib/orber/doc/src/images/class-index.gif deleted file mode 100644 index 7f276bcb24..0000000000 Binary files a/lib/orber/doc/src/images/class-index.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/constructor-index.gif b/lib/orber/doc/src/images/constructor-index.gif deleted file mode 100644 index 435cac4238..0000000000 Binary files a/lib/orber/doc/src/images/constructor-index.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/constructors.gif b/lib/orber/doc/src/images/constructors.gif deleted file mode 100644 index d1a6ae507c..0000000000 Binary files a/lib/orber/doc/src/images/constructors.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/cyan-ball-small.gif b/lib/orber/doc/src/images/cyan-ball-small.gif deleted file mode 100644 index 7f74357443..0000000000 Binary files a/lib/orber/doc/src/images/cyan-ball-small.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/cyan-ball.gif b/lib/orber/doc/src/images/cyan-ball.gif deleted file mode 100644 index 97ca1f2b6e..0000000000 Binary files a/lib/orber/doc/src/images/cyan-ball.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/error-index.gif b/lib/orber/doc/src/images/error-index.gif deleted file mode 100644 index 22835ff8c6..0000000000 Binary files a/lib/orber/doc/src/images/error-index.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/exception-index.gif b/lib/orber/doc/src/images/exception-index.gif deleted file mode 100644 index e3830d9c52..0000000000 Binary files a/lib/orber/doc/src/images/exception-index.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/green-ball-small.gif b/lib/orber/doc/src/images/green-ball-small.gif deleted file mode 100644 index 17fea5b32b..0000000000 Binary files a/lib/orber/doc/src/images/green-ball-small.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/green-ball.gif b/lib/orber/doc/src/images/green-ball.gif deleted file mode 100644 index 71e1b2ec2d..0000000000 Binary files a/lib/orber/doc/src/images/green-ball.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/interface-index.gif b/lib/orber/doc/src/images/interface-index.gif deleted file mode 100644 index bf93dda9e3..0000000000 Binary files a/lib/orber/doc/src/images/interface-index.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/magenta-ball-small.gif b/lib/orber/doc/src/images/magenta-ball-small.gif deleted file mode 100644 index bd0584b3c6..0000000000 Binary files a/lib/orber/doc/src/images/magenta-ball-small.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/magenta-ball.gif b/lib/orber/doc/src/images/magenta-ball.gif deleted file mode 100644 index 5da03b84d2..0000000000 Binary files a/lib/orber/doc/src/images/magenta-ball.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/method-index.gif b/lib/orber/doc/src/images/method-index.gif deleted file mode 100644 index a05e705116..0000000000 Binary files a/lib/orber/doc/src/images/method-index.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/methods.gif b/lib/orber/doc/src/images/methods.gif deleted file mode 100644 index 949e01b8a3..0000000000 Binary files a/lib/orber/doc/src/images/methods.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/package-index.gif b/lib/orber/doc/src/images/package-index.gif deleted file mode 100644 index f894d4210d..0000000000 Binary files a/lib/orber/doc/src/images/package-index.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/red-ball-small.gif b/lib/orber/doc/src/images/red-ball-small.gif deleted file mode 100644 index f6b3c372ca..0000000000 Binary files a/lib/orber/doc/src/images/red-ball-small.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/red-ball.gif b/lib/orber/doc/src/images/red-ball.gif deleted file mode 100644 index dca9296014..0000000000 Binary files a/lib/orber/doc/src/images/red-ball.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/variable-index.gif b/lib/orber/doc/src/images/variable-index.gif deleted file mode 100644 index 65cc029e72..0000000000 Binary files a/lib/orber/doc/src/images/variable-index.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/variables.gif b/lib/orber/doc/src/images/variables.gif deleted file mode 100644 index e8a735399a..0000000000 Binary files a/lib/orber/doc/src/images/variables.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/yellow-ball-small.gif b/lib/orber/doc/src/images/yellow-ball-small.gif deleted file mode 100644 index 8e5f57cdfc..0000000000 Binary files a/lib/orber/doc/src/images/yellow-ball-small.gif and /dev/null differ diff --git a/lib/orber/doc/src/images/yellow-ball.gif b/lib/orber/doc/src/images/yellow-ball.gif deleted file mode 100644 index 2b8c0bb3d6..0000000000 Binary files a/lib/orber/doc/src/images/yellow-ball.gif and /dev/null differ diff --git a/lib/orber/doc/src/interceptor_operations.gif b/lib/orber/doc/src/interceptor_operations.gif deleted file mode 100644 index cd72f7fcb7..0000000000 Binary files a/lib/orber/doc/src/interceptor_operations.gif and /dev/null differ diff --git a/lib/orber/doc/src/interceptors.xml b/lib/orber/doc/src/interceptors.xml deleted file mode 100644 index 0aade8ffb4..0000000000 --- a/lib/orber/doc/src/interceptors.xml +++ /dev/null @@ -1,284 +0,0 @@ - - - - -
- - 20012016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - interceptors - - - - - - 1999-09-03 - A -
- interceptors - Describe the functions which must be exported by any supplied Orber native interceptor. - -

This module contains the mandatory functions for user supplied native - interceptors and their intended behavior. See also the User's Guide.

- -

Using Interceptors may reduce the through-put significantly - if the supplied interceptors invoke expensive operations. Hence, - one should always supply interceptors which cause as little overhead - as possible.

-
- -

It is possible to alter the Data, Bin and Args - parameter for the in_reply and out_reply, - in_reply_encoded, in_request_encoded, - out_reply_encoded and out_request_encoded, - in_request and out_request respectively. But, - if it is done incorrectly, the consequences can be serious.

-
- -

The Extra parameter is set to 'undefined' by Orber when calling - the first interceptor and may be set to any Erlang term. If an - interceptor change this parameter it will be passed on to the next - interceptor in the list uninterpreted.

-
- -

The Ref parameter is set to 'undefined' by Orber when calling - new_in_connection or new_out_connection using - the first interceptor. The user supplied interceptor may set NewRef - to any Erlang term. If an interceptor change this parameter it will be - passed on to the next interceptor in the list uninterpreted.

-
-
- - - new_in_connection(Ref, PeerHost, PeerPort) -> NewRef - new_in_connection(Ref, PeerHost, PeerPort, SocketHost, SocketPort) -> NewRef - Invoke when a new client ORB wants to setup a connection - - Ref = term() | undefined - PeerHost = SocketHost = string(), e.g., "myHost@myServer" or "192.0.0.10" - PeerPort = SocketPort = integer() - NewRef = term() | {'EXIT', Reason} - - -

When a new connection is requested by a client side ORB this operation - is invoked. If more than one interceptor is supplied, e.g., - {native, ['myInterceptor1', 'myInterceptor2']}, the return value - from 'myInterceptor1' is passed to 'myInterceptor2' as Ref. - Initially, Orber uses the atom 'undefined' as Ref parameter - when calling the first interceptor. The return value from the last - interceptor, in the example above 'myInterceptor2', is passed - to all other functions exported by the interceptors. Hence, - the Ref parameter can, for example, be used as a unique - identifier to mnesia or ets where information/restrictions for - this connection is stored.

-

The PeerHost and PeerPort variables supplied data of - the client ORB which requested a new connection. SocketHost - and SocketPort are the local interface and port the client - connected to.

-

If, for some reason, we do not allow the client ORB to connect - simply invoke exit(Reason).

-
-
- - new_out_connection(Ref, PeerHost, PeerPort) -> NewRef - new_out_connection(Ref, PeerHost, PeerPort, SocketHost, SocketPort) -> NewRef - Invoke when setting up a new connection to a server side ORB - - Ref = term() | undefined - PeerHost = SocketHost = string(), e.g., "myHost@myServer" or "192.0.0.10" - PeerPort = SocketPort = integer() - NewRef = term() | {'EXIT', Reason} - - -

When a new connection is set up this function is invoked. Behaves - just like new_in_connection; the only difference is that - the PeerHost and PeerPort variables identifies the target ORB's bootstrap - data and SocketHost and SocketPort are the local interface and port - the client ORB connected via.

-
-
- - closed_in_connection(Ref) -> NewRef - Invoke when an existing connection to a client side ORB have been terminated - - Ref = term() - NewRef = term() - - -

When an existing connection is terminated this operation is invoked. - The main purpose of this function is to make it possible for a user - to clean up all data associated with the associated connection.

-

The input parameter Ref is the return value from - new_in_connection/3.

-
-
- - closed_out_connection(Ref) -> NewRef - Invoke when an existing connection to a server side ORB have been terminated - - Ref = term() - NewRef = term() - - -

When an existing connection is terminated this operation is invoked. - The main purpose of this function is to make it possible for a user - to clean up all data associated with the associated connection.

-

The input parameter Ref is the return value from - new_out_connection/3.

-
-
- - in_reply(Ref, Obj, Ctx, Op, Data, Extra) -> Reply - Invoke when replies arrives at the client side ORB - - Ref = term() - Obj = #objref - Ctx = [#'IOP_ServiceContext'{}] - Op = atom() - Data = [Result, OutParameter1, ..., OutPramaterN] - Reply = {NewData, NewExtra} - - -

When replies are delivered from the server side ORB to the client side - ORB this operation is invoked. The Data parameter is a list in which - the first element is the return value value from the target object and - the rest is a all parameters defined as out or inout in - the IDL-specification.

-
-
- - in_reply_encoded(Ref, Obj, Ctx, Op, Bin, Extra) -> Reply - Invoke when replies arrives at the client side ORB with undecoded reply body - - Ref = term() - Obj = #objref - Ctx = [#'IOP_ServiceContext'{}] - Op = atom() - Bin = #binary - Reply = {NewBin, NewExtra} - - -

When replies are delivered from the server side ORB to the client side - ORB this operation is invoked. The Bin parameter is the reply - body still uncoded.

-
-
- - in_request(Ref, Obj, Ctx, Op, Args, Extra) -> Reply - Invoke when requests arrive at the server side ORB - - Ref = term() - Obj = #objref - Ctx = [#'IOP_ServiceContext'{}] - Op = atom() - Args = [Argument] - defined in the IDL-specification - Reply = {NewArgs, NewExtra} - - -

When a new request arrives at the server side ORB this operation is - invoked.

-
-
- - in_request_encoded(Ref, Obj, Ctx, Op, Bin, Extra) -> Reply - Invoke when requests arrive at the server side ORB with undecoded request body - - Ref = term() - Obj = #objref - Ctx = [#'IOP_ServiceContext'{}] - Op = atom() - Bin = #binary - Reply = {NewBin, NewExtra} - - -

When a new request arrives at the server side ORB this operation is - invoked before decoding the request body.

-
-
- - out_reply(Ref, Obj, Ctx, Op, Data, Extra) -> Reply - Invoke after the target object replied - - Ref = term() - Obj = #objref - Ctx = [#'IOP_ServiceContext'{}] - Op = atom() - Data = [Result, OutParameter1, ..., OutPramaterN] - Reply = {NewData, NewExtra} - - -

After the target object have been invoked this operation is invoked - with the result. The Data parameter is a list in which - the first element is the return value value from the target object and - the rest is a all parameters defined as out or inout in - the IDL-specification.

-
-
- - out_reply_encoded(Ref, Obj, Ctx, Op, Bin, Extra) -> Reply - Invoke after the target object replied with the reply encoded - - Ref = term() - Obj = #objref - Ctx = [#'IOP_ServiceContext'{}] - Op = atom() - Bin = #binary - Reply = {NewBin, NewExtra} - - -

This operation is similar to out_reply; the only difference is - that the reply body have been encoded.

-
-
- - out_request(Ref, Obj, Ctx, Op, Args, Extra) -> Reply - Invoke on the client side ORB before encoding and sending the request - - Ref = term() - Obj = #objref - Ctx = [#'IOP_ServiceContext'{}] - Op = atom() - Args = [Argument] - defined in the IDL-specification - Reply = {NewArgs, NewExtra} - - -

Before a request is sent to the server side ORB, out_request is - invoked.

-
-
- - out_request_encoded(Ref, Obj, Ctx, Op, Bin, Extra) -> Reply - Invoke on the client side ORB before sending the request - - Ref = term() - Obj = #objref - Ctx = [#'IOP_ServiceContext'{}] - Op = atom() - Bin = #binary - Reply = {NewBin, NewExtra} - - -

This operation is similar to out_request; the only - difference is that the request body have been encoded.

-
-
-
- -
- diff --git a/lib/orber/doc/src/intro_part.xml b/lib/orber/doc/src/intro_part.xml deleted file mode 100644 index 7e5520e42e..0000000000 --- a/lib/orber/doc/src/intro_part.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - -
- - 2002 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - Introduction to Orber and the IFR - Niclas Eklund - - 2002-06-25 - A -
- -

This chapter contains an introduction to Orber and the IFR - (Interface Repository).

-
- - - -
- diff --git a/lib/orber/doc/src/lname.xml b/lib/orber/doc/src/lname.xml deleted file mode 100644 index c0c9be1a85..0000000000 --- a/lib/orber/doc/src/lname.xml +++ /dev/null @@ -1,166 +0,0 @@ - - - - -
- - 19972017 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - lname - - - - - - 1997-06-10 - A -
- lname - Interface that supports the name pseudo-objects. - -

This interface is a part of the names library which is used to hide the - representation of names. In Orbers Erlang mapping the pseudo-object names - and the real IDL names have the same representation but it is desirable that - the clients uses the names library so they will not be dependent of the representation. - The lname interface supports handling of names e.g. adding and removing name - components.

-

Note that the lname interface in orber does not contain a destroy function because - the Names are represented as standard Erlang lists and therefor will be removed - by the garbage collector when not in use.

-

The type NameComponent used below is defined as:

- --record('CosNaming_NameComponent', {id, kind=""}). - -

id and kind are strings.

-

The record is defined in the file CosNaming.hrl and it - is included with:

- --include_lib("orber/COSS/CosNaming/CosNaming.hrl"). - -
- - - create() -> Return - Create a new name - - Return = [NameComponent] - - -

This function returns a new name.

-
-
- - insert_component(Name, N, NameComponent) -> Return - Insert a new name component in a name - - Name = [NameComponent] - N = int() - Return = Name - - -

This function returns a name where the new name component has been inserted as - component N in Name.

-
-
- - get_component(Name, N) -> Return - Get a name component from a name - - Name = [NameComponent] - N = int() - Return = NameComponent - - -

This function returns the N:th name component in Name.

-
-
- - delete_component(Name, N) -> Return - Delete a name component from a name - - Name = [NameComponent] - N = int() - Return = Name - - -

This function deletes the N:th name component from Name and returns - the new name.

-
-
- - num_component(Name) -> Return - Count the number of name components in a name - - Name = [NameComponent] - Return = int() - - -

This function returns a the number of name components in Name.

-
-
- - equal(Name1, Name2) -> Return - Test if two names are equal - - Name1 = Name2 = [NameComponent] - Return = bool() - - -

This function returns true if the two names are equal and false otherwise.

-
-
- - less_than(Name1, Name2) -> Return - Test if one name is lesser than the other - - Name1 = Name2 = [NameComponent] - Return = bool() - - -

This function returns true if Name1 are lesser than Name2 and false otherwise.

-
-
- - to_idl_form(Name) -> Return - Transform a pseudo name to an IDL name - - Name = [NameComponent] - Return = Name - - -

This function just checks if Name is a correct IDL name before returning it - because the name representation is the same for pseudo and IDL names in orber.

-
-
- - from_idl_form(Name) -> Return - Transform an IDL name to a pseudo name - - Name = [NameComponent] - Return = Name - - -

This function just returns the Name because the name representation is the - same for pseudo and IDL names in orber.

-
-
-
- -
- diff --git a/lib/orber/doc/src/lname_component.xml b/lib/orber/doc/src/lname_component.xml deleted file mode 100644 index 8b8001c0fb..0000000000 --- a/lib/orber/doc/src/lname_component.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - -
- - 19972017 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - lname_component - - - - - - 1997-06-10 - A -
- lname_component - Interface that supports the name pseudo-objects. - -

This interface is a part of the name library, which is used to hide the - representation of names. In Orbers Erlang mapping the pseudo-object names - and the real IDL names have the same representation but it is desirable that - the clients uses the names library so they will not be dependent of the representation. - The lname_component interface supports handling of name components e.g. set and get - of the struct members.

-

Note that the lname_component interface in orber does not contain a destroy - function because the NameComponents are represented as Erlang records and - therefor will be removed by the garbage collector when not in use.

-

The type NameComponent used below is defined as:

- --record('CosNaming_NameComponent', {id, kind=""}). - -

id and kind are strings.

-

The record is defined in the file CosNaming.hrl and it - is included with:

- --include_lib("orber/COSS/CosNaming/CosNaming.hrl"). - -
- - - create() -> Return - Create a new name component - - Return = NameComponent - - -

This function returns a new name component.

-
-
- - get_id(NameComponent) -> Return - Get the id field of a name component - - Return = string() - - -

This function returns the id string of a name component.

-
-
- - set_id(NameComponent, Id) -> Return - Set the id field of a name component - - Id = string() - Return = NameComponent - - -

This function sets the id string of a name component and returns the component.

-
-
- - get_kind(NameComponent) -> Return - Get the kind field of a name component - - Return = string() - - -

This function returns the id string of a name component.

-
-
- - set_kind(NameComponent, Kind) -> Return - Set the kind field of a name component - - Kind = string() - Return = NameComponent - - -

This function sets the kind string of a name component and returns the component.

-
-
-
- -
- diff --git a/lib/orber/doc/src/menuframe.gif b/lib/orber/doc/src/menuframe.gif deleted file mode 100644 index 57a437e6b0..0000000000 Binary files a/lib/orber/doc/src/menuframe.gif and /dev/null differ diff --git a/lib/orber/doc/src/name.gif b/lib/orber/doc/src/name.gif deleted file mode 100644 index d2df460092..0000000000 Binary files a/lib/orber/doc/src/name.gif and /dev/null differ diff --git a/lib/orber/doc/src/notes.xml b/lib/orber/doc/src/notes.xml deleted file mode 100644 index 35da4f73da..0000000000 --- a/lib/orber/doc/src/notes.xml +++ /dev/null @@ -1,860 +0,0 @@ - - - - -
- - 19972016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Orber Release Notes - - - - - - 99-02-12 - A - notes.xml -
- -
Orber 3.8.4 - -
Fixed Bugs and Malfunctions - - -

Removed all old unused files in the documentation. -

-

- Own Id: OTP-14475 Aux Id: ERL-409, PR-1493

-
- -

Removed the man warnings by using the code tag - instead of c tag.

-

- Own Id: OTP-14673

-
-
-
- -
- -
Orber 3.8.3 - -
Improvements and New Features - - -

- Fix some dialyzer warnings

-

- Own Id: OTP-14006

-
-
-
- -
- -
Orber 3.8.2 - -
Improvements and New Features - - -

- Internal changes

-

- Own Id: OTP-13551

-
-
-
- -
- -
Orber 3.8.1 - -
Improvements and New Features - - -

Suppress Dialyzer warnings.

-

- Own Id: OTP-12862

-
-
-
- -
- -
Orber 3.8 - -
Improvements and New Features - - -

Remove the usage of erlang:now() from all Corba - applications and use the new rand module instead of - random.

-

- Own Id: OTP-12687

-
-
-
- -
- -
Orber 3.7.1 - -
Fixed Bugs and Malfunctions - - -

Fixed problem with IPv6 addresses in Service Context - when orber is default configured for IPv4.

-

- Own Id: OTP-12193

-
-
-
- -
- -
Orber 3.7 - -
Fixed Bugs and Malfunctions - - -

The following functions have been corrected so they - work properly with IPv6 addresses.

- corba:resolve_initial_references_remote/2/3 - corba:list_initial_references_remote/1/2 - corba:string_to_object/1/2 -

- Own Id: OTP-12016

-
- -

A couple of macros were malformed, missing commas: - PROFILEBODY_1_1_TYPEDEF and PROFILEBODY_1_2_TYPEDEF. - Thanks to Vlad Dumitrescu.

-

- Own Id: OTP-12062

-
-
-
- - -
Improvements and New Features - - -

It is now possible to add listen interfaces for IPv6 - when orber is default configured for IPv4 and the other - way around. For more information, consult the User's - Guide and the orber module Reference Manual.

-

- Own Id: OTP-12007

-
-
-
- -
- -
Orber 3.6.27 - -
Fixed Bugs and Malfunctions - - -

- Some local implementations of removing the last element - from a list are replaced by lists:droplast/1. Note - that this requires at least stdlib-2.0, which is - the stdlib version delivered in OTP 17.0. (Thanks to Hans - Svensson)

-

- Own Id: OTP-11678

-
-
-
- -
- -
Orber 3.6.26.1 - -
Improvements and New Features - - -

Postscript files no longer needed for the generation - of PDF files have been removed.

-

- Own Id: OTP-11016

-
-
-
- -
- -
Orber 3.6.26 - -
Fixed Bugs and Malfunctions - - -

- Fix bug in corbaloc/corbaname over ssl.

-

- Own Id: OTP-10675

-
-
-
- -
- -
Orber 3.6.25 - -
Improvements and New Features - - -

Some examples overflowing the width of PDF pages have - been corrected.

-

- Own Id: OTP-10665

-
-
-
- -
Known Bugs and Problems - - -

- Own Id: OTP-10675 Aux Id: seq12154 -

-
-
-
-
- -
Orber 3.6.24 - -
Fixed Bugs and Malfunctions - - -

- Fix number of arguments in orber dbg printout

-

- Own Id: OTP-9887

-
- -

The descriptions of ssl_server_options and - ssl_client_options are corrected.
Seq. Id: - seq12018

-

- Own Id: OTP-9966 Aux Id: OTP-9773

-
-
-
- -
- -
Orber 3.6.23 - -
Fixed Bugs and Malfunctions - - -

Remove usage of ssl:seed/1 in orber test cases.

-

- Own Id: OTP-9728

-
-
-
- - -
Improvements and New Features - - -

Erlang/OTP can now be built using parallel make if you - limit the number of jobs, for instance using 'make - -j6' or 'make -j10'. 'make -j' does not - work at the moment because of some missing - dependencies.

-

- Own Id: OTP-9451

-
- -

The SSL option handling has been changed. There are - now two new orber options ssl_server_options and - ssl_client_options which takes a list of options - to the socket.

The old options are now - deprecated and removed from the documentation but they - can still be used for backward compatibility as long as - the two new options not are used.

If - ssl_server_options and ssl_client_options - contain an TCP option that orber needs to set to a - specific value it will be skipped and a warning will be - written to the error_log.

-

- Own Id: OTP-9773 Aux Id: seq11932

-
-
-
- -
- -
Orber 3.6.22 - -
Fixed Bugs and Malfunctions - - -

XML files have been corrected.

-

- Own Id: OTP-9550 Aux Id: OTP-9541

-
-
-
- -
- -
- Orber 3.6.21 - -
- Improvements and New Features - - -

- Eliminated Dialyzer warnings.

-

- Own Id: OTP-9326 Aux Id:

-
-
-
-
- -
- Orber 3.6.20 - -
- Improvements and New Features - - -

- Eliminated Dialyzer warnings when using exit or throw.

-

- Own Id: OTP-9050 Aux Id:

-
-
-
-
- -
- Orber 3.6.19 - -
- Improvements and New Features - - -

- Partial support for recursive structs and unions. - Only available for the erl_corba backend and requires - that Light IFR is used. I.e. the IC option {light_ifr, true} - and that Orber is configured in such a way that Light IFR - is activated. Recursive TypeCode is currently not supported.

-

- Own Id: OTP-8868 Aux Id: seq11633

-
-
-
-
- Fixed Bugs and Malfunctions - - -

The SSL option {ssl_imp, old} was not used if ssl_generation was - set to 2. Only R14B was affected by this.

-

Own Id: OTP-8994 Aux Id: seq11747

-
-
-
-
- -
- Orber 3.6.18 -
- Fixed Bugs and Malfunctions - - -

A corbaloc http string could return an EXIT message, instead - of a system exception, if the HTTP server closed the socket - without returning a complete message. I.e. header and a body - containing a stringified IOR.

-

Own Id: OTP-8900 Aux Id: seq11704

-
-
-
-
- -
- Orber 3.6.17 - -
- Improvements and New Features - - -

- Eliminated warnings for auto-imported BIF clashes.

-

- Own Id: OTP-8840

-
-
-
-
- -
- Orber 3.6.16 - -
- Improvements and New Features - - -

- Test suites published.

-

- Own Id: OTP-8543O Aux Id:

-
-
-
- -
- Fixed Bugs and Malfunctions - - -

Added missing trailing bracket to define in hrl-file.

-

Own Id: OTP-8489 Aux Id:

-
-
-
-
- -
- Orber 3.6.15 - -
- Improvements and New Features - - -

- Added the configuration parameters iiop_out_ports_attempts and - iiop_out_ports_random.

-

- Own Id: OTP-8448 Aux Id: seq11498

-
- -

- Removed obsolete SSL dependency.

-

- Own Id: OTP-8374 Aux Id:

-
- -

- Removed the usage of the codeinclude tag in the documentation.

-

- Own Id: OTP-8409 Aux Id:

-
-
-
- -
- Fixed Bugs and Malfunctions - - -

Removed superfluous VT in the documentation.

-

Own Id: OTP-8353 Aux Id:

-
- -

Removed superfluous backslash in the documentation.

-

Own Id: OTP-8354 Aux Id:

-
-
-
-
- -
- Orber 3.6.14 - -
- Improvements and New Features - - -

- The documentation is now built with open source tools (xsltproc and fop) - that exists on most platforms. One visible change is that the frames are removed.

-

- Own Id: OTP-8201 Aux Id:

-
-
-
-
- -
- Orber 3.6.13 - -
- Improvements and New Features - - -

Obsolete guards, e.g. record vs is_record, has been changed - to avoid compiler warnings.

-

Own Id: OTP-7987

-
-
-
-
- -
- Orber 3.6.12 - -
- Improvements and New Features - - -

Only the source instance of InitialReference.java is now - included. Users are adviced to use the Interoperable - Naming Service (INS) instead. INS is a part of the OMG - standard specification.

-

*** POTENTIAL INCOMPATIBILITY ***

-

Own Id: OTP-7906 Aux Id: seq11243

-
-
-
-
- -
- Orber 3.6.11 - -
- Improvements and New Features - - -

Updated file headers.

-

Own Id: OTP-7837

-
-
-
-
- -
- Orber 3.6.10 - -
- Improvements and New Features - - -

Documentation source included in open source releases.

-

Own Id: OTP-7595

-
-
-
-
- -
- Orber 3.6.9 - -
- Improvements and New Features - - -

Updated file headers.

-

Own Id: OTP-7011

-
- -

Now compliant with the new behavior of stdlib.

-

Own Id: OTP-7030 Aux Id: seq10827

-
-
-
-
- -
- Orber 3.6.8 - -
- Improvements and New Features - - -

When a local port range has been defined (i.e. iiop_out_ports), - Orber set the socket option reuseaddr to true and after one - timed out connection attempt no other port in the given range - is used for that particular connect attempt.

-

Own Id: OTP-6844 Aux Id:

-
- -

Possible to override global SSL parameters when using - local interfaces.

-

Own Id: OTP-6869 Aux Id: seq10742

-
-
-
-
- Fixed Bugs and Malfunctions - - -

The parameter ssl_client_ciphers was used on the server side as well - instead of ssl_server_ciphers.

-

Own Id: OTP-6868 Aux Id:

-
- -

The configuration parameter iiop_max_in_requests was ignored, until - the first incoming request arrived, if iiop_packet_size was set.

-

Own Id: OTP-6912 Aux Id:

-
-
-
-
- -
- Orber 3.6.7 - -
- Improvements and New Features - - -

The documentation source has been converted from SGML to XML.

-

Own Id: OTP-6754 Aux Id:

-
-
-
-
- -
- Orber 3.6.6 - -
- Improvements and New Features - - -

It is now possible to configure incoming connections which - overrides some global configuration parameters. See - orber:add_listen_interface/2/3.

-

Own Id: OTP-6696 Aux Id:

-
-
-
-
- -
- Orber 3.6.5 - -
- Improvements and New Features - - -

Removed some unused code.

-

Own Id: OTP-6527 Aux Id:

-
-
-
-
- -
- Orber 3.6.4 - -
- Improvements and New Features - - -

Orber can now be configured so that different NAT parameters - can be specified for different interfaces.

-

Own Id: OTP-6165 Aux Id:

-
- -

It is now possible to set the keepalive option for incoming - and outgoing IIOP connections. For more information, see the - Configuration chapter in the User's Guide.

-

Own Id: OTP-6370 Aux Id: seq10532

-
- -

The new function orber:close_connection/1/2 allows a client - to close connections to an object residing on a remote ORB.

-

Own Id: OTP-6371 Aux Id: seq10532

-
- -

Orber now use the SSL two-phase accept strategy to avoid - that new incoming connections via SSL are not blocked - by a previous connect attempt that never initiated the - SSL handshake. Note, the configuration parameter - iiop_ssl_accept_timeout should be set (default infinity). - For more information, see the Configuration chapter in the - User's Guide. If Orber is started in secure mode, the - installed SSL version must support ssl:ssl_accept/1/2 and - ssl:transport_accept/1/2.

-

Own Id: OTP-6372 Aux Id: seq10105

-
-
-
- -
- Fixed Bugs and Malfunctions - - -

The operation orber_ifr:contents/2 could only handle dk_All.

-

Own Id: OTP-6385 Aux Id:

-
-
-
-
- -
- Orber 3.6.3 - -
- Improvements and New Features - - -

When installing Orber it is now possible to set the priority - for Orber internal Mnesia tables. For more information, see the - Reference Manual regarding orber:install/2.

-

Own Id: OTP-5907 Aux Id: seq10156

-
- -

The operation corba_object:is_a/2/3 now only connect to a remote - ORB if necessary (i.e. the target object inherits from objects - associated with the given IFR id).

-

Own Id: OTP-5908

-
-
-
- -
- Fixed Bugs and Malfunctions - - -

The operation corba_object:is_remote/1 always returned - true, which was introduced in orber-3.2.10.

-

Own Id: OTP-5909

-
-
-
-
- -
- Orber 3.6.2 - -
- Improvements and New Features - - -

Native interceptors may now export new_in_connection and - new_out_connection operations with arity 5. If this is the - case, information about the local interface and port is - passed to the interceptor. Orber's built in interceptors - have been changed to include this information as well.

-

Own Id: OTP-5671

-
-
-
- -
- Fixed Bugs and Malfunctions - - -

In some cases, e.g. incorrect GIOP headers or a CancelRequest - containing a non-existing RequestId, the incoming connection - would be terminated.

-

Own Id: OTP-5672 Aux Id: seq10037

-
- -

If combining the 'Use Current Interface in IOR' and - 'Use IPv6' flags, exported IOR:s contained an incorrect - host address.

-

Own Id: OTP-5673

-
-
-
-
- -
- Orber 3.6.1 - -
- Improvements and New Features - - -

Reduced overhead when using outgoing ACL with a local interface - defined.

-

Own Id: OTP-5659

-
- -

Added guards to ensure that, when so required, a list - of IOP_ServiceContext's is passed instead of, for example, - just the context record.

-

Own Id: OTP-5660

-
-
-
- -
- Fixed Bugs and Malfunctions - - -

The documentation referred to two different context definitions, - the incorrect ServiceContext and the correct IOP_ServiceContext. - The hrl file PATH/include/corba.hrl also contained the incorrect - record definition. This has now been updated so that only - IOP_ServiceContext is used and referred to.

-

Own Id: OTP-5658

-
-
-
-
- -
- Orber 3.6 - -
- Improvements and New Features - - -

It is now possible to define a Access Control List (ACL), - which limits the host and ports Orber may connect to or - accept connections from.

-

Own Id: OTP-5567

-
- -

It is now possible to add, and remove, listen interfaces. - For more information, consult the User's Guide and the - orber module Reference Manual.

-

Own Id: OTP-5568

-
- -

It is now possible to activate and deactivate Audit/Trail - logging. One of the three built in interceptors will be used - depending on the requested verbosity.

-

Own Id: OTP-5569

-
- -

It is now possible to configure Orber to add the interface, - to exported local IOR:s, a Request came via.

-

Own Id: OTP-5570

-
- -

It is now possible to instruct Orber which local interface an outgoing Request - shall be sent via. To accomplish this the Orber generic context must be - added added to each invocation.

-

Own Id: OTP-5571

-
- -

It is now possible to define a default local interface, - which Orber will use when connecting to another ORB.

-

Own Id: OTP-5583

-
-
-
-
-
- diff --git a/lib/orber/doc/src/orber.xml b/lib/orber/doc/src/orber.xml deleted file mode 100644 index d8c6936515..0000000000 --- a/lib/orber/doc/src/orber.xml +++ /dev/null @@ -1,653 +0,0 @@ - - - - -
- - 19972016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - orber - - - - - - 1997-06-10 - A -
- orber - The main module of the Orber application - -

This module contains the functions for starting and stopping the - application. It also has some utility functions to get some of - the configuration information from running application.

-
- - - start() -> ok - start(Type) -> ok - Start the Orber application - - Type = temporary | permanent - - -

Starts the Orber application (it also starts mnesia if it is not running). - Which Type parameter is supplied determines the behavior. If not - supplied Orber is started as temporary. - See the Reference Manual application(3) for further information.

-
-
- - jump_start(Attributes) -> ok | {'EXIT', Reason} - Start the Orber application during tests - - Attributes = Port | Options - Port = integer() - Options = [{Key, Value}] - Key = any key listed in the configuration chapter - Value = allowed value associated with the given key - - -

Installs and starts the Orber and the Mnesia applications with the configuration - parameters domain and iiop_port set to "IP-number:Port" - and the supplied Port respectively. Theses settings are in most cases - sufficient to ensure that no clash with any other Orber instance occur. - If this operation fails, check if the listen port (iiop_port) is already - in use. This function MAY ONLY be used during development and - tests; how Orber is configured when using this operation may change - at any time without warning.

-
-
- - stop() -> ok - Stop the Orber application - -

Stops the Orber application.

-
-
- - info() -> ok - info(IoType) -> ok | {'EXIT', Reason} | string() - Generate Info Report, which contain Orber's configuration settings - - IoType = info_msg | string | io | {io, IoDevice} - - -

Generates an Info Report, which contain Orber's configuration settings. - If no IoType is supplied, info_msg is used (see the - error_logger documentation). When the atom string is supplied this - function will return a flat list. For io and {io, IoDevice}, - io:format/1 and io:format/3 is used respectively.

-
-
- - exception_info(Exception) -> {ok, string()} | {error, Reason} - Return a printable string, which describes the supplied exception - -

Returns a printable string, which describes the supplied exception - in greater detail. Note, this function is mainly intended for - system exceptions.

-
-
- - is_system_exception(Exception) -> true | false - Return true if the supplied exception is a system defined exception otherwise false - -

Returns true if the supplied exception is a system defined - exception, otherwise false.

-
-
- - get_tables() -> [Tables] - Get the Mnesia tables Orber uses. - -

Returns a list of the Orber specific Mnesia tables. This list is - required to restore Mnesia if it has been partitioned.

-
-
- - get_ORBInitRef() -> string() | undefined - Get the initial reference address. - -

This function returns undefined if we will resolve references locally, - otherwise a string describing which host we will contact if the Key given - to corba:resolve_initial_references/1 matches the Key set - in this configuration variable. For more information - see the user's guide.

-
-
- - get_ORBDefaultInitRef() -> string() | undefined - Get the initial reference address. - -

This function returns undefined if we will resolve references locally, - otherwise a string describing which host, or hosts, from which we - will try to resolve the Key given to - corba:resolve_initial_references/1. For more information - see the user's guide.

-
-
- - domain() -> string() - Display the Orber domain name - -

This function returns the domain name of the current Orber domain - as a string.

-
-
- - iiop_port() -> int() - Display the IIOP port number - -

This function returns the port-number, which is used by the IIOP - protocol. It can be configured by setting the application variable - iiop_port, if it is not set it will have the default number - 4001.

-
-
- - iiop_out_ports() -> 0 | {Min, Max} - Display the ports Orber may use when connecting to another ORB - -

The return value of this operation is what the configuration - parameter iiop_out_ports - has been set to.

-
-
- - - iiop_out_ports_random() -> true | false - Determine if Orber should select local ports randomly - -

Return the value of the configuration parameter - iiop_out_ports_random.

-
-
- - - iiop_out_ports_attempts() -> int() - Display if Orber should accept more than one timeout connecting to another ORB - -

Return the value of the configuration parameter - iiop_out_ports_attempts.

-
-
- - - - iiop_ssl_port() -> int() - Display the IIOP port number used for secure connections - -

This function returns the port-number, which is used by the secure IIOP - protocol. It can be configured by setting the application variable - iiop_ssl_port, if it is not set it will have the default number - 4002 if Orber is to configured to run in secure mode. Otherwise it returns -1.

-
-
- - iiop_timeout() -> int() (milliseconds) - Display the IIOP timeout value - -

This function returns the timeout value after which outgoing IIOP requests terminate. - It can be configured by setting the application variable - iiop_timeout TimeVal (seconds), if it is not set it will have the default value - infinity. If a request times out a system exception, e.g. - TIMEOUT, is raised.

-

Note: the iiop_timeout configuration parameter (TimeVal) may only range between 0 and 1000000 seconds. - Otherwise, the default value is used.

-

Note: Earlier IC versions required that the compile option {timeout,"module::interface"}, - was used, which allow the user to add an extra timeout parameter, e.g., - module_interface:function(ObjRef, Timeout, ... Arguments ...) or - module_interface:function(ObjRef, [{timeout, Timeout}], ... Arguments ...), - instead of module_interface:function(ObjRef, ... Arguments ...). - This is no longer the case and if the extra Timeout is used, - argument will override the configuration parameter iiop_timeout. - It is, however, not possible - to use infinity to override the Timeout parameter. The Timeout - option is also valid for objects which resides within the same Orber domain.

-
-
- - iiop_connection_timeout() -> int() (milliseconds) - Display the IIOP connection timeout value - -

This function returns the timeout value after which outgoing IIOP connections terminate. - It can be configured by setting the application variable - iiop_connection_timeout TimeVal (seconds), if it is not set it will have the default value - infinity. The connection will not be terminated if there are - pending requests.

-

Note: the iiop_connection_timeout configuration parameter (TimeVal) may only range between 0 and 1000000 seconds. - Otherwise, the default value is used.

-
-
- - iiop_connections() -> Result - iiop_connections(Direction) -> Result - List all existing connections to/from other ORB's - - Direction = in | out | inout - Result = [{Host, Port}] | [{Host, Port, Interface}] | {'EXIT',Reason} - Host = string() - Port = integer() - Interface = string() - Reason = term() - - -

The list returned by this operation contain tuples of remote hosts/ports - Orber is currently connected to. If no Direction is not supplied, both - incoming and outgoing connections are included.

-

If a specific local interface has been defined for the connection, - this will be added to the returned tuple.

-
-
- - iiop_connections_pending() -> Result - List all connections to another ORB currently being set up - - Result = [{Host, Port}] | [{Host, Port, Interface}] | {'EXIT',Reason} - Host = string() - Port = integer() - Interface = string() - Reason = term() - - -

In some cases a connection attempt (i.e. trying to communicate with - another ORB) may block due to a number of reasons. This operation - allows the user to check if this is the case. The returned list - contain tuples of remote hosts/ports. Normally, the list is empty.

-

If a specific local interface has been defined for the connection, - this will be added to the returned tuple.

-
-
- - iiop_in_connection_timeout() -> int() (milliseconds) - Display the IIOP connection timeout value for incoming connections - -

This function returns the timeout value after which incoming IIOP - connections terminate. It can be configured by setting the application - variable iiop_in_connection_timeout TimeVal (seconds), if it is - not set it will have the default value infinity. The connection - will not be terminated if there are pending requests.

-

Note: the iiop_in_connection_timeout configuration parameter (TimeVal) may - only range between 0 and 1000000 seconds. Otherwise, the default value is - used.

-
-
- - iiop_acl() -> Result - Return the ACL configuration - - Result = [{Direction, Filter}] | [{Direction, Filter, [Interface]}] - Direction = tcp_in | ssl_in | tcp_out | ssl_out - Filter = string() - Interface = string() - - -

Returns the ACL configuration. The Filter uses a extended format of - Classless Inter Domain Routing (CIDR). For example, "123.123.123.10" limits - the connection to that particular host, while "123.123.123.10/17" allows - connections to or from any host equal to the 17 most significant bits. Orber - also allow the user to specify a certain port or port range, for example, - "123.123.123.10/17#4001" and "123.123.123.10/17#4001/5001" - respectively. IPv4 or none compressed IPv6 strings are accepted.

- - The list of Interfaces, IPv4 or IPv6 strings, are currently only used - for outgoing connections and may only contain one address. If set and - access is granted, Orber will use that local interface when connecting to the - other ORB. The module orber_acl - provides operations for evaluating the access control for filters and addresses.

-
-
- - activate_audit_trail() -> Result - activate_audit_trail(Verbosity) -> Result - Activate IIOP audit/trail - - Verbosity = stealth | normal | verbose - Result = ok | {error, Reason} - Reason = string() - - -

Activates audit/trail for all existing incoming and outgoing IIOP - connections. The Verbosity parameter, stealth, - normal or verbose, determines which of the built in - interceptors is used (orber_iiop_tracer_stealth, - orber_iiop_tracer_silent or orber_iiop_tracer respectively). - If no verbosity level is supplied, then the normal will be used.

-

In case Orber is configured to use other interceptors, the audit/trail - interceptors will simply be added to that list.

-
-
- - deactivate_audit_trail() -> Result - Deactivate IIOP audit/trail - - Result = ok | {error, Reason} - Reason = string() - - -

Deactivates audit/trail for all existing incoming and outgoing IIOP - connections. In case Orber is configured to use other interceptors, - those will still be used.

-
-
- - add_listen_interface(IP, Type) -> Result - add_listen_interface(IP, Type, Port) -> Result - add_listen_interface(IP, Type, ConfigurationParameters) -> Result - Add a new listen process for incoming connection - - IP = string - Type = normal | ssl - Port = integer() > 0 - ConfigurationParameters = [{Key, Value}] - Key = flags | ip_family | iiop_in_connection_timeout | iiop_max_fragments | iiop_max_in_requests | interceptors | iiop_port | iiop_ssl_port | ssl_server_options - Value = as described in the User's Guide or below - Result = {ok, Ref} | {error, Reason} | {'EXCEPTION', #'BAD_PARAM'{}} - Ref = #Ref - Reason = string() - - -

Create a new process that handle requests for creating a new incoming - IIOP connection via the given interface and port. If the latter is - excluded, Orber will use the value of the iiop_port or - iiop_ssl_port configuration parameters. - The Type parameter determines if it is - supposed to be IIOP or IIOP via SSL. If successful, the returned - #Ref shall be passed to orber:remove_listen_interface/1 - when the connection shall be terminated.

-

It is also possible to supply configuration parameters that override - the global configuration. The iiop_in_connection_timeout, - iiop_max_fragments, iiop_max_in_requests and - interceptors parameters simply overrides the global - counterparts (See the - Configuration chapter - in the User's Guide). - But for the following parameters there are a few restrictions:

- - flags - currently it is only possible to override the global - setting for the Use Current Interface in IOR and - Exclude CodeSet Component flags. - ip_family - can be set to inet or inet6 and is - used to get a listen interface that uses another IP version than the default - set with flags at startup. - iiop_port - requires that Use Current Interface in IOR - is activated and the supplied Type is normal. If so, - exported IOR:s will contain the IIOP port defined by this configuration - parameter. Otherwise, the global setting will be used. - iiop_ssl_port - almost equivalent to iiop_port. - The difference is that Type shall be ssl and that - exported IOR:s will contain the IIOP via SSL port defined by this configuration - parameter. - -

If it is not possible to add a listener based on the supplied interface - and port, the error message is one of the ones described in inet - and/or ssl documentation.

-
-
- - remove_listen_interface(Ref) -> ok - Terminate listen process for incoming connection - - Ref = #Ref - - -

Terminates the listen process, associated with the supplied #Ref, - for incoming a connection. The Ref parameter is the return value from - the orber:add_listen_interface/2/3 operation. When terminating - the connection, all associated requests will not deliver a reply to - the clients.

-
-
- - close_connection(Connection) -> Result - close_connection(Connection, Interface) -> Result - Terminate outgoing connection(s) - - Connection = Object | [{Host, Port}] - Object = #objref (external) - Host = string() - Port = string() - Interface = string() - Result = ok | {'EXCEPTION', #'BAD_PARAM'{}} - - -

Will try to close all outgoing connections to the host/port combinations - found in the supplied object reference or the given list of hosts/ports. - If a #'IOP_ServiceContext'{} containing a local interface has been - used when communicating with the remote object - (see also Module_Interface), - that interface shall be passed as the second argument. Otherwise, connections - via the default local interface, will be terminated.

-

- -

Since several clients maybe communicates via the same connection, - they will be affected when invoking this operation. Other clients may - re-create the connection by invoking an operation on the target object.

-
-
-
- - secure() -> no | ssl - Display the security mode Orber is running in - -

This function returns the security mode Orber is running in, which is either no if it is an - insecure domain or the type of security mechanism used. For the moment the only security - mechanism is ssl. This is configured by setting the application variable - secure.

-
-
- - ssl_server_options() -> list() - Display the SSL server options - -

This function returns the list of SSL options set for the Orber domain as server. - This is configured by setting the application variable - ssl_server_options.

-
-
- - ssl_client_options() -> list() - Display the SSL client options - -

This function returns the list of SSL options used in outgoing calls in the current process. - The default value is configured by setting the application variable - ssl_client_options.

-
-
- - set_ssl_client_options(Options) -> ok - Set the SSL options for the client - - Options = list() - - -

This function takes a list of SSL options as parameter and sets - it for the current process.

-
-
- - objectkeys_gc_time() -> int() (seconds) - Display the Object Keys GC time value - -

This function returns the timeout value after which after which terminated object keys, - related to servers started with the configuration parameter {persistent, true}, - will be removed. - It can be configured by setting the application variable objectkeys_gc_time TimeVal (seconds), - if it is not set it will have the default value infinity.

-

Objects terminating with reason normal or shutdown are removed automatically.

-

Note: the objectkeys_gc_time configuration parameter (TimeVal) may only range between 0 and 1000000 seconds. - Otherwise, the default value is used.

-
-
- - orber_nodes() -> RetVal - Displays which nodes that this orber domain consist of. - - RetVal = [node()] - - -

This function returns the list of node names that this orber - domain consists of.

-
-
- - install(NodeList) -> ok - install(NodeList, Options) -> ok - Install the Orber application - - NodeList = [node()] - Options = [Option] - Option = {install_timeout, Timeout} | {ifr_storage_type, TableType} | {nameservice_storage_type, TableType} | {initialreferences_storage_type, TableType} | {load_order, Priority} - Timeout = infinity | integer() - TableType = disc_copies | ram_copies - Priority = integer() - - -

This function installs all the necessary mnesia tables and - load default data in some of them. If one or more Orber tables - already exists the installation fails. The function - uninstall may be used, if it is safe, i.e., no other - application is running Orber.

-

Preconditions:

- - a mnesia schema must exist before the installation - mnesia is running on the other nodes if the new installation - shall be a multi node domain - -

Mnesia will be started by the function if it is not already running on - the installation node and if it was started it will be stopped - afterwards.

-

The options that can be sent to the installation program is:

- - {install_timeout, Timeout} - this timeout is how long we - will wait for the tables to be created. The Timeout value can be - infinity or an integer number in milliseconds. - Default is infinity. - {ifr_storage_type, TableType} - this option sets the - type of tables used for the interface repository. - The TableType can be disc_copies or ram_copies. Default is - disc_copies. - {initialreferences_storage_type, TableType} - this option - sets the type of table used for storing initial references. - The TableType can be disc_copies or ram_copies. Default is - ram_copies. - {nameservice_storage_type, TableType} - the default - behavior of Orber is to install the NameService as ram_copies. - This option makes it possible to change this to disc_copies. But - the user should be aware of that if a node is restarted, all - local object references stored in the NameService is not valid. - Hence, you cannot switch to disc_copies and expect exactly the same - behavior as before. - {load_order, Priority} - per default the priority is set to 0. - Using this option it will change the priority of in which order - Mnesia will load Orber internal tables. For more information, - consult the Mnesia documentation. - -
-
- - uninstall() -> ok - Uninstall the Orber application - -

This function stops the Orber application, terminates all server - objects and removes all Orber related mnesia tables.

-

Note: Since other applications may be running on the same node - using mnesia uninstall will not stop the mnesia application.

-
-
- - add_node(Node, Options) -> RetVal - Add a new node to a group of Orber nodes. - - Node = node() - Options = IFRStorageType | [KeyValue] - IFRStorageType = StorageType - StorageType = disc_copies | ram_copies - KeyValue = {ifr_storage_type, StorageType} | {initialreferences_storage_type, StorageType} | {nameservice_storage_type, StorageType} | {type, Type} - Type = temporary | permanent - RetVal = ok | exit() - - -

This function add given node to a existing Orber node group and starts - Orber on the new node. orber:add_node is called from a member in the Orber - node group.

-

Preconditions for new node:

- - Erlang started on the new node using the option -mnesia extra_db_nodes, e.g., - erl -sname new_node_name -mnesia extra_db_nodes ConnectToNodes_List - The new node's domain name is the same for the nodes we want to connect to. - Mnesia is running on the new node (no new schema created). - If the new node will use disc_copies the schema type must be changed using: - mnesia:change_table_copy_type(schema, node(), disc_copies). - -

Orber will be started by the function on the new node.

-

Fails if:

- - Orber already installed on given node. - Mnesia not started as described above on the new node. - Impossible to copy data in Mnesia tables to the new node. - Not able to start Orber on the new node, due to, for example, the - iiop_port is already in use. - -

The function do not remove already copied tables after a failure. - Use orber:remove_node to remove these tables.

-
-
- - remove_node(Node) -> RetVal - Removes a node from a group of Orber nodes. - - Node = node() - RetVal = ok | exit() - - -

This function removes given node from a Orber node group. The Mnesia - application is not stopped.

-
-
- - configure(Key, Value) -> ok | {'EXIT', Reason} - Change Orber configuration. - - Key = orbDefaultInitRef | orbInitRef | giop_version | iiop_timeout | iiop_connection_timeout | iiop_setup_connection_timeout | iiop_in_connection_timeout | objectkeys_gc_time | orber_debug_level - Value = allowed value associated with the given key - - -

This function allows the user to configure Orber in, for example, - an Erlang shell. It is possible to invoke configure at any time - the keys specified above.

-

Any other key must be set before installing and starting Orber.

-

Trying to change the configuration in any other way is NOT - allowed since it may affect the behavior of Orber.

-

For more information regarding allowed values, see - configuration settings - in the User's Guide.

-

- -

Configuring the IIOP timeout values will not affect already - existing connections. If you want a guaranteed uniform behavior, you - must set these parameters from the start.

-
-
-
-
- -
- diff --git a/lib/orber/doc/src/orber_acl.xml b/lib/orber/doc/src/orber_acl.xml deleted file mode 100644 index 5feda83ef6..0000000000 --- a/lib/orber/doc/src/orber_acl.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - -
- - 2005 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - orber_acl - - - - - - 2005-05-19 - A -
- orber_acl - Orber ACL operations - -

This module contains functions intended for analyzing Access - Control List (ACL) filters. The filters uses a extended format of - Classless Inter Domain Routing (CIDR). - For example, "123.123.123.10" limits - the connection to that particular host, while "123.123.123.10/17" allows - connections to or from any host equal to the 17 most significant bits. Orber - also allow the user to specify a certain port or port range, for example, - "123.123.123.10/17#4001" and "123.123.123.10/17#4001/5001" - respectively. IPv4 or none compressed IPv6 strings are accepted.

-
- - - match(IP, Direction) -> boolean() - match(IP, Direction, GetInfo) -> Reply - Verify if the IP address versus the current configuration - - IP = tuple() | [integer()] - Direction = tcp_in | ssl_in | tcp_out | ssl_out - GetInfo = boolean() - Reply = boolean() | {boolean(), [Interface], PortInfo} - Interface = string() - PortInfo = integer() | {integer(), integer()} - - -

If GetInfo is not supplied or set to false, this operation returns - a boolean which tells if the IPv4 or IPv6 address would pass the ACL - filter, defined by the iiop_acl configuration parameter, or not. - When GetInfo is set to true, a tuple which, besides the boolean - that tells if access was granted, also include the defined - interfaces and port(s). This operation requires that Orber is running and - can be used on a live node to determine if Orber has been properly configured.

-
-
- - verify(IP, Filter, Family) -> Reply - Verify if the IP address versus the Filter - - IP = string() - Filter = string() - Family = inet | inet6 - Reply = true | {false, From, To} | {error, string()} - From = string() - To = string() - - -

This operation returns true if the IPv4 or IPv6 address would pass the - supplied ACL. If that is not the case, a tuple containing the accepted range - is returned. This operation should only be used for test purposes.

-
-
- - range(Filter, Family) -> Reply - Get range of Filter - - Filter = string() - Family = inet | inet6 - Reply = {ok, From, To} | {error, string()} - From = string() - To = string() - - -

Returns the range of accepted IP addresses based on the supplied filter. - This operation should only be used for test purposes.

-
-
-
- -
- diff --git a/lib/orber/doc/src/orber_diagnostics.xml b/lib/orber/doc/src/orber_diagnostics.xml deleted file mode 100644 index 3aad304535..0000000000 --- a/lib/orber/doc/src/orber_diagnostics.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - -
- - 20032016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - orber_diagnostics - - - - - - 2003-04-17 - A -
- orber_diagnostics - Diagnostics API for Orber - -

This module contains functions which makes it possible to run simple - tests.

-

- -

Functions exported by this module may only be used during - test and development phase.

-
-
- - - nameservice() -> Result - nameservice(Flags) -> Result - Display all objects stored in the Name Service - - Flags = integer() - Result = ok | {'EXCEPTION', E} - - -

Displays all objects stored in the NameService. Existent checks are, per - default, also performed on all local objects. This can also be activated - for external objects by setting the flag 16#01. The displayed - information is the stringified Name described in - CosNaming_NamingContextExt, - non existent status (true | false | external | undefined) and the IFR-Id:

- -host/ -host/resources/ -host/resources/MyObj/ [false] IDL:MyMod/MyIntf:1.0 -
-
- - missing_modules() -> Count - Echo missing modules required by Orber - - Count = integer() - - -

This operation list missing modules generated by IC and required by - Orber. Requires that all API:s are registered in the IFR.

-
-
-
- -
- diff --git a/lib/orber/doc/src/orber_ifr.xml b/lib/orber/doc/src/orber_ifr.xml deleted file mode 100644 index a667d7d9e4..0000000000 --- a/lib/orber/doc/src/orber_ifr.xml +++ /dev/null @@ -1,1035 +0,0 @@ - - - - -
- - 19972016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - orber_ifr - - - - - 1997-10-13 - A -
- orber_ifr - The Interface Repository stores representations of IDL information - -

This module contains functions for managing the Interface - Repository (IFR). This documentation should be used in conjunction - with the documentation in chapter 6 of 2.3. - Whenever the term IFR object is used in this manual page, it - refers to a pseudo object used only for interaction with the IFR - rather than a CORBA object.

-
- -
- Initialization of the IFR -

The following functions are used to initialize the Interface - Repository and to obtain the initial reference to the - repository.

-
- - - init(Nodes,Timeout) -> ok - Intialize the IFR - - Nodes = list() - Timeout = integer() | infinity - - -

This function should be called to initialize the IFR. It - creates the necessary mnesia-tables. A mnesia schema should - exist, and mnesia must be running.

-
-
- - find_repository() -> #IFR_Repository_objref - Find the IFR object reference for the Repository - -

Find the IFR object reference for the Repository. This - reference should be used when adding objects to the IFR, and - when extracting information from the IFR. - The first time this function is called, it will create the - repository and all the primitive definitions.

-
-
-
- -
- General methods -

The following functions are the methods of the IFR. The first - argument is always an #IFR_objref, i.e. the IFR (pseudo)object - on which to apply this method. These functions are useful when - the type of IFR object is not know, but they are somewhat slower - than the specific functions listed below which only accept a - particular type of IFR object as the first argument.

-
- - - get_def_kind(Objref) -> Return - Return the definition kind of the IFR object - - Objref = #IFR_objref - Return = atom() (one of dk_none, dk_all, dk_Attribute, dk_Constant, dk_Exception, dk_Interface, dk_Module, dk_Operation, dk_Typedef, dk_Alias, dk_Struct, dk_Union, dk_Enum, dk_Primitive, dk_String, dk_Wstring, dk_Fixed, dk_Sequence, dk_Array, dk_Repository) - - -

Objref is an IFR object of any kind. Returns the definition - kind of the IFR object.

-
-
- - destroy(Objref) -> Return - Destroy, except IRObject, Contained and Container, target object and its contents - - Objref = #IFR_object - Return = tuple() - - -

Objref is an IFR object of any kind except IRObject, - Contained and Container. Destroys that object and its - contents (if any). Returns whatever mnesia:transaction - returns.

-
-
- - get_id(Objref) -> Return - Return the target object's repository id - - Objref = #IFR_object - Return = string() - - -

Objref is an IFR object of any kind that inherits from - Contained. Returns the repository id of that object.

-
-
- - set_id(Objref,Id) -> ok - Set the target object's repository id - - Objref = #IFR_object - Id = string() - - -

Objref is an IFR object of any kind that inherits from - Contained. Sets the repository id of that object.

-
-
- - get_name(Objref) -> Return - Return the name of the target object - - Objref = #IFR_object - Return = string() - - -

Objref is an IFR object of any kind that inherits from - Contained. Returns the name of that object.

-
-
- - set_name(Objref,Name) -> ok - Set given name to target object - - Objref = #IFR_object - Name = string() - - -

Objref is an IFR object of any kind that inherits from - Contained. Sets the name of that object.

-
-
- - get_version(Objref) -> Return - Return the version of the target object - - Objref = #IFR_object - Return = string() - - -

Objref is an IFR object of any kind that inherits from - Contained. Returns the version of that object.

-
-
- - set_version(Objref,Version) -> ok - Set given version of the target object - - Objref = #IFR_object - Version = string() - - -

Objref is an IFR object of any kind that inherits from - Contained. Sets the version of that object.

-
-
- - get_defined_in(Objref) -> Return - Return the Container the target object is contained in - - Objref = #IFR_object - Return = #IFR_Container_objref - - -

Objref is an IFR object of any kind that inherits from - Contained. Returns the Container object that the object is - defined in.

-
-
- - get_absolute_name(Objref) -> Return - Return the absolute name of the target object - - Objref = #IFR_object - Return = string() - - -

Objref is an IFR object of any kind that inherits from - Contained. Returns the absolute (scoped) name of that - object.

-
-
- - get_containing_repository(Objref) -> Return - Get the most derived Contained object associated with the target object - - Objref = #IFR_object - Return = #IFR_Repository_objref - - -

Objref is an IFR object of any kind that inherits from - Contained. Returns the Repository that is eventually reached - by recursively following the object's defined_in attribute.

-
-
- - describe(Objref) -> Return - Return a tuple which describe the target object - - Objref = #IFR_object - Return = tuple() (a contained_description record) | {exception, _} - - -

Objref is an IFR object of any kind that inherits from - Contained. Returns a tuple describing the object.

-
-
- - move(Objref,New_container,New_name,New_version) -> Return - Move the target object from its current location to given Container, name and version - - Objref = #IFR_objref - New_container = #IFR_Container_objref - New_name = string() - New_version = string() - Return = ok | {exception, _} - - -

Objref is an IFR object of any kind that inherits from - Contained. New_container is an IFR object of any kind that - inherits from Container. Removes Objref from its current - Container, and adds it to New_container. The name attribute - is changed to New_name and the version attribute is changed - to New_version.

-
-
- - lookup(Objref,Search_name) -> Return - Return the IFR object identified by the given name - - Objref = #IFR_objref - Search_name = string() - Return = #IFR_object - - -

Objref is an IFR object of any kind that inherits from - Container. Returns an IFR object identified by search_name - (a scoped name).

-
-
- - contents(Objref,Limit_type,Exclude_inherited) -> Return - Return the content of the target object limited by the given constraints - - Objref = #IFR_objref - Limit_type = atom() (one of dk_none, dk_all, dk_Attribute, dk_Constant, dk_Exception, dk_Interface, dk_Module, dk_Operation, dk_Typedef, dk_Alias, dk_Struct, dk_Union, dk_Enum, dk_Primitive, dk_String, dk_Wstring, dk_Fixed, dk_Sequence, dk_Array, dk_Repository) - Exclude_inherited = atom() (true or false) - Return = list() (a list of IFR#_objects) - - -

Objref is an IFR object of any kind that inherits from - Container. Returns the contents of that IFR object.

-
-
- - lookup_name(Objref,Search_name,Levels_to_search, Limit_type, Exclude_inherited) -> Return - Return a list of IFR objects matching the given name - - Objref = #IFR_objref - Search_name = string() - Levels_to_search = integer() - Limit_type = atom() (one of dk_none, dk_all, dk_Attribute, dk_Constant, dk_Exception, dk_Interface, dk_Module, dk_Operation, dk_Typedef, dk_Alias, dk_Struct, dk_Union, dk_Enum, dk_Primitive, dk_String, dk_Wstring, dk_Fixed, dk_Sequence, dk_Array, dk_Repository) - Exclude_inherited = atom() (true or false) - Return = list() (a list of #IFR_objects) - - -

Objref is an IFR object of any kind that inherits from - Container. Returns a list of #IFR_objects with an id - matching Search_name.

-
-
- - describe_contents(Objref, Limit_type, Exclude_inherited, Max_returned_objs) -> Return - Return a list of descriptions of the IFR objects contained by the target Container object - - Objref = #IFR_objref - Limit_type = atom() (one of dk_none, dk_all, dk_Attribute, dk_Constant, dk_Exception, dk_Interface, dk_Module, dk_Operation, dk_Typedef, dk_Alias, dk_Struct, dk_Union, dk_Enum, dk_Primitive, dk_String, dk_Wstring, dk_Fixed, dk_Sequence, dk_Array, dk_Repository) - Exclude_inherited = atom() (true or false) - Return = list() (a list of tuples (contained_description records) | {exception, _} - - -

Objref is an IFR object of any kind that inherits from - Container. Returns a list of descriptions of the IFR objects - in this Container's contents.

-
-
- - create_module(Objref,Id,Name,Version) -> Return - Create an IFR object of given type - - Objref = #IFR_objref - Id = string() - Name = string() - Version = string() - Return = #IFR_ModuleDef_objref - - -

Objref is an IFR object of any kind that inherits from - Container. Creates an IFR object of the type ModuleDef.

-
-
- - create_constant(Objref,Id,Name,Version,Type,Value) -> Return - Create a ConstantDef IFR object - - Objref = #IFR_objref - Id = string() - Name = string() - Version = string() - Type = #IFR_IDLType_objref - Value = any() - Return = #IFR_ConstantDef_objref - - -

Objref is an IFR object of any kind that inherits from - Container. Creates an IFR object of the type ConstantDef.

-
-
- - create_struct(Objref,Id,Name,Version,Members) -> Return - Create a StructDef IFR object - - Objref = #IFR_objref - Id = string() - Name = string() - Version = string() - Members = list() (list of structmember records) - Return = #IFR_StructDef_objref - - -

Objref is an IFR object of any kind that inherits from - Container. Creates an IFR object of the type StructDef.

-
-
- - create_union(Objref,Id,Name,Version,Discriminator_type,Members) -> Return - Create a UnionDef IFR object - - Objref = #IFR_objref - Id = string() - Name = string() - Version = string() - Discriminator_type = #IFR_IDLType_Objref - Members = list() (list of unionmember records) - Return = #IFR_UnionDef_objref - - -

Objref is an IFR object of any kind that inherits from - Container. Creates an IFR object of the type UnionDef.

-
-
- - create_enum(Objref,Id,Name,Version,Members) -> Return - Create a EnumDef IFR object - - Objref = #IFR_objref - Id = string() - Name = string() - Version = string() - Members = list() (list of strings) - Return = #IFR_EnumDef_objref - - -

Objref is an IFR object of any kind that inherits from - Container. Creates an IFR object of the type EnumDef.

-
-
- - create_alias(Objref,Id,Name,Version,Original_type) -> Return - Create a AliasDef IFR object - - Objref = #IFR_objref - Id = string() - Name = string() - Version = string() - Original_type = #IFR_IDLType_Objref - Return = #IFR_AliasDef_objref - - -

Objref is an IFR object of any kind that inherits from - Container. Creates an IFR object of the type AliasDef.

-
-
- - create_interface(Objref,Id,Name,Version,Base_interfaces) -> Return - Create a InterfaceDef IFR object - - Objref = #IFR_objref - Id = string() - Name = string() - Version = string() - Base_interfaces = list() (a list of IFR_InterfaceDef_objrefs that this interface inherits from - Return = #IFR_InterfaceDef_objref - - -

Objref is an IFR object of any kind that inherits from - Container. Creates an IFR object of the type InterfaceDef.

-
-
- - create_exception(Objref,Id,Name,Version,Members) -> Return - Create a ExceptionDef IFR object - - Objref = #IFR_objref - Id = string() - Name = string() - Version = string() - Members = list() (list of structmember records) - Return = #IFR_ExceptionDef_objref - - -

Objref is an IFR object of any kind that inherits from - Container. Creates an IFR object of the type ExceptionDef.

-
-
- - get_type(Objref) -> Return - Return the typecode of the target object - - Objref = #IFR_objref - Return = tuple() (a typecode tuple) - - -

Objref is an IFR object of any kind that inherits from - IDLType or an IFR object of the kind ConstantDef, - ExceptionDef or AttributeDef. Returns the typecode of the - IFR object.

-
-
- - lookup_id(Objref,Search_id) -> Return - Return the IFR object matching the given id - - Objref = #IFR_Repository_objref - Search_id = string() - Return = #IFR_objref - - -

Returns an IFR object matching the Search_id.

-
-
- - get_primitive(Objref,Kind) -> Return - Return a PrimitiveDef of the specified kind - - Objref = #IFR_Repository_objref - Kind = atom() (one of pk_null, pk_void, pk_short, pk_long, pk_ushort, pk_ulong, pk_float, pk_double, pk_boolean, pk_char, pk_octet, pk_any, pk_TypeCode, pk_Principal, pk_string, pk_wstring, pk_fixed, pk_objref) - Return = #IFR_PrimitiveDef_objref - - -

Returns a PrimitiveDef of the specified kind.

-
-
- - create_string(Objref,Bound) -> Return - Create an IFR objref of the type StringDef - - Objref = #IFR_Repository_objref - Bound = integer() (unsigned long /= 0) - Return = #IFR_StringDef_objref - - -

Creates an IFR objref of the type StringDef.

-
-
- - create_wstring(Objref,Bound) -> Return - Create an IFR objref of the type WstringDef - - Objref = #IFR_Repository_objref - Bound = integer() (unsigned long /= 0) - Return = #IFR_WstringDef_objref - - -

Creates an IFR objref of the type WstringDef.

-
-
- - create_fixed(Objref,Digits,Scale) -> Return - Create an IFR objref of the type FixedDef - - Objref = #IFR_Repository_objref - Digits = Scale = integer() - Return = #IFR_FixedDef_objref - - -

Creates an IFR objref of the type FixedDef.

-
-
- - create_sequence(Objref,Bound,Element_type) -> Return - Create an IFR objref of the type SequenceDef - - Objref = #IFR_Repository_objref - Bound = integer() (unsigned long) - Element_type = #IFR_IDLType_objref - Return = #IFR_SequenceDef_objref - - -

Creates an IFR objref of the type SequenceDef.

-
-
- - create_array(Objref,Length,Element_type) -> Return - Create an IFR objref of the type ArrayDef - - Objref = #IFR_Repository_objref - Bound = integer() (unsigned long) - Element_type = #IFR_IDLType_objref - Return = #IFR_ArrayDef_objref - - -

Creates an IFR objref of the type ArrayDef.

-
-
- - create_idltype(Objref,Typecode) -> Return - Create an IFR objref of the type IDLType - - Objref = #IFR_Repository_objref - Typecode = tuple() (a typecode tuple) - Return = #IFR_IDLType_objref - - -

Creates an IFR objref of the type IDLType.

-
-
- - get_type_def(Objref) -> Return - Return an IFR object of the type IDLType describing the type of the target object - - Objref = #IFR_objref - Return = #IFR_IDLType_objref - - -

Objref is an IFR object of the kind ConstantDef or - AttributeDef. Returns an IFR object of the type IDLType - describing the type of the IFR object.

-
-
- - set_type_def(Objref,TypeDef) -> Return - Set given TypeDef of the target object - - Objref = #IFR_objref - TypeDef = #IFR_IDLType_objref - Return = ok | {exception, _} - - -

Objref is an IFR object of the kind ConstantDef or - AttributeDef. Sets the type_def of the IFR Object.

-
-
- - get_value(Objref) -> Return - Return the value attribute of the target ConstantDef object - - Objref = #IFR_ConstantDef_objref - Return = any() - - -

Returns the value attribute of an IFR Object of the type ConstantDef.

-
-
- - set_value(Objref,Value) -> Return - Set the value attribute of the target ConstantDef object - - Objref = #IFR_ConstantDef_objref - Value = any() - Return = ok | {exception, _} - - -

Sets the value attribute of an IFR Object of the type ConstantDef.

-
-
- - get_members(Objref) -> Return - Return the members of the target object - - Objref = #IFR_objref - Return = list() - - -

Objref is an IFR object the kind StructDef, UnionDef, - EnumDef or ExceptionDef. - For StructDef, UnionDef and ExceptionDef: Returns a list of - structmember records that are the constituent parts of the - object. - For EnumDef: Returns a list of strings describing the - enumerations.

-
-
- - set_members(Objref,Members) -> Return - Set the members attribute of the target object - - Objref = #IFR_objref - Members = list() - Return = ok | {exception, _} - - -

Objref is an IFR object the kind StructDef, UnionDef, - EnumDef or ExceptionDef. - For StructDef, UnionDef and ExceptionDef: Members is a list - of structmember records. - For EnumDef: Members is a list of strings describing the - enumerations. - Sets the members attribute, which are the constituent parts of the - exception.

-
-
- - get_discriminator_type(Objref) -> Return - Get the discriminator typecode of the target object - - Objref = #IFR_UnionDef_objref - Return = tuple() (a typecode tuple) - - -

Returns the discriminator typecode of an IFR object of the type - UnionDef.

-
-
- - get_discriminator_type_def(Objref) -> Return - Return IDLType object describing the discriminator type of the target object - - Objref = #IFR_UnionDef_objref - Return = #IFR_IDLType_objref - - -

Returns an IFR object of the type IDLType describing the - discriminator type of an IFR object of the type UnionDef.

-
-
- - set_discriminator_type_def(Objref,TypeDef) -> Return - Set the attribute discriminator_type_def for the target object to the given TypeDef - - Objref = #IFR_UnionDef_objref - Return = #IFR_IDLType_objref - - -

Sets the attribute discriminator_type_def, an IFR object of - the type IDLType describing the discriminator type of an IFR - object of the type UnionDef.

-
-
- - get_original_type_def(Objref) -> Return - Return an IFR object of the type IDLType describing the original type - - Objref = #IFR_AliasDef_objref - Return = #IFR_IDLType_objref - - -

Returns an IFR object of the type IDLType describing the - original type.

-
-
- - set_original_type_def(Objref,TypeDef) -> Return - Set the original_type_def attribute which describes the original type - - Objref = #IFR_AliasDef_objref - Typedef = #IFR_IDLType_objref - Return = ok | {exception, _} - - -

Sets the original_type_def attribute which describes the - original type.

-
-
- - get_kind(Objref) -> Return - Return an atom describing the primitive type - - Objref = #IFR_PrimitiveDef_objref - Return = atom() - - -

Returns an atom describing the primitive type (See CORBA 2.0 - p 6-21).

-
-
- - get_bound(Objref) -> Return - Get the maximum size of the target object - - Objref = #IFR_objref - Return = integer (unsigned long) - - -

Objref is an IFR object the kind StringDef or SequenceDef. - For StringDef: returns the maximum number of characters in - the string. - For SequenceDef: Returns the maximum number of elements in - the sequence. Zero indicates an unbounded sequence.

-
-
- - set_bound(Objref,Bound) -> Return - Set the maximum size of the target object - - Objref = #IFR_objref - Bound = integer (unsigned long) - Return = ok | {exception, _} - - -

Objref is an IFR object the kind StringDef or SequenceDef. - For StringDef: Sets the maximum number of characters in the - string. Bound must not be zero. - For SequenceDef: Sets the maximum number of elements in the - sequence. Zero indicates an unbounded sequence.

-
-
- - get_element_type(Objref) -> Return - Return the typecode of the elements in the IFR object - - Objref = #IFR_objref - Return = tuple() (a typecode tuple) - - -

Objref is an IFR object the kind SequenceDef or ArrayDef. - Returns the typecode of the elements in the IFR object.

-
-
- - get_element_type_def(Objref) -> Return - Return an IFR object of the type IDLType describing the type of the elements in Objref - - Objref = #IFR_objref - Return = #IFR_IDLType_objref - - -

Objref is an IFR object the kind SequenceDef or ArrayDef. - Returns an IFR object of the type IDLType describing the - type of the elements in Objref.

-
-
- - set_element_type_def(Objref,TypeDef) -> Return - Set the element_type_def attribute of the target object to the given TypeDef - - Objref = #IFR_objref - TypeDef = #IFR_IDLType_objref - Return = ok | {exception, _} - - -

Objref is an IFR object the kind SequenceDef or ArrayDef. - Sets the element_type_def attribute, an IFR object of the - type IDLType describing the type of the elements in Objref.

-
-
- - get_length(Objref) -> Return - Return the number of elements in the array - - Objref = #IFR_ArrayDef_objref - Return = integer() (unsigned long) - - -

Returns the number of elements in the array.

-
-
- - set_length(Objref,Length) -> Return - Set the number of elements in the array - - Objref = #IFR_ArrayDef_objref - Length = integer() (unsigned long) - - -

Sets the number of elements in the array.

-
-
- - get_mode(Objref) -> Return - Get the mode of the target object (AttributeDef or OperationDef) - - Objref = #IFR_objref - Return = atom() - - -

Objref is an IFR object the kind AttributeDef or OperationDef. - For AttributeDef: Return is an atom ('ATTR_NORMAL' or - 'ATTR_READONLY') specifying the read/write access for this - attribute. - For OperationDef: Return is an atom ('OP_NORMAL' or - 'OP_ONEWAY') specifying the mode of the operation.

-
-
- - set_mode(Objref,Mode) -> Return - Set the mode of the target object (AttributeDef or OperationDef) to the given mode - - Objref = #IFR_objref - Mode = atom() - Return = ok | {exception, _} - - -

Objref is an IFR object the kind AttributeDef or OperationDef. - For AttributeDef: Sets the read/write access for this - attribute. Mode is an atom ('ATTR_NORMAL' or - 'ATTR_READONLY'). - For OperationDef: Sets the mode of the operation. Mode is an - atom ('OP_NORMAL' or 'OP_ONEWAY').

-
-
- - get_result(Objref) -> Return - Return typecode describing the type of the value returned by the operation - - Objref = #IFR_OperationDef_objref - Return = tuple() (a typecode tuple) - - -

Returns a typecode describing the type of the value returned by the - operation.

-
-
- - get_result_def(Objref) -> Return - Return an IFR object of the type IDLType describing the type of the result - - Objref = #IFR_OperationDef_objref - Return = #IFR_IDLType_objref - - -

Returns an IFR object of the type IDLType describing the type of the - result.

-
-
- - set_result_def(Objref,ResultDef) -> Return - Set the type_def attribute of the target object to the given ResultDef - - Objref = #IFR_OperationDef_objref - ResultDef = #IFR_IDLType_objref - Return = ok | {exception, _} - - -

Sets the type_def attribute, an IFR Object of the type IDLType - describing the result.

-
-
- - get_params(Objref) -> Return - Return a list of parameter description records describing the parameters of the target OperationDef - - Objref = #IFR_OperationDef_objref - Return = list() (list of parameter description records) - - -

Returns a list of parameter description records, which describes the - parameters of the OperationDef.

-
-
- - set_params(Objref,Params) -> Return - Set the params attribute of the target object to the given parameter description records - - Objref = #IFR_OperationDef_objref - Params = list() (list of parameter description records) - Return = ok | {exception, _} - - -

Sets the params attribute, a list of parameter description records.

-
-
- - get_contexts(Objref) -> Return - Return a list of context identifiers for the operation - - Objref = #IFR_OperationDef_objref - Return = list() (list of strings) - - -

Returns a list of context identifiers for the operation.

-
-
- - set_contexts(Objref,Contexts) -> Return - Set the context attribute for the operation - - Objref = #IFR_OperationDef_objref - Contexts = list() (list of strings) - Return = ok | {exception, _} - - -

Sets the context attribute for the operation.

-
-
- - get_exceptions(Objref) -> Return - Return a list of exception types that can be raised by the target object - - Objref = #IFR_OperationDef_objref - Return = list() (list of #IFR_ExceptionDef_objrefs) - - -

Returns a list of exception types that can be raised by this - operation.

-
-
- - set_exceptions(Objref,Exceptions) -> Return - Set the exceptions attribute for the target object - - Objref = #IFR_OperationDef_objref - Exceptions = list() (list of #IFR_ExceptionDef_objrefs) - Return = ok | {exception, _} - - -

Sets the exceptions attribute for this operation.

-
-
- - get_base_interfaces(Objref) -> Return - Return a list of InterfaceDefs from which the target InterfaceDef object inherit - - Objref = #IFR_InterfaceDef_objref - Return = list() (list of #IFR_InterfaceDef_objrefs) - - -

Returns a list of InterfaceDefs from which this InterfaceDef inherits.

-
-
- - set_base_interfaces(Objref,BaseInterfaces) -> Return - Set the BaseInterfaces attribute - - Objref = #IFR_InterfaceDef_objref - BaseInterfaces = list() (list of #IFR_InterfaceDef_objrefs) - Return = ok | {exception, _} - - -

Sets the BaseInterfaces attribute.

-
-
- - is_a(Objref,Interface_id) -> Return - Return a boolean if the target InterfaceDef match or inherit from the given id - - Objref = #IFR_InterfaceDef_objref - Interface_id = #IFR_InterfaceDef_objref - Return = atom() (true or false) - - -

Returns true if the InterfaceDef either is identical to or - inherits from Interface_id.

-
-
- - describe_interface(Objref) -> Return - Return a full inter face description record describing the InterfaceDef - - Objref = #IFR_InterfaceDef_objref - Return = tuple() (a fullinterfacedescription record) - - -

Returns a full inter face description record describing the InterfaceDef.

-
-
- - create_attribute(Objref,Id,Name,Version,Type,Mode) -> Return - Create an IFR object of the type AttributeDef contained in the target InterfaceDef object - - Objref = #IFR_InterfaceDef_objref - Id = string() - Name = string() - Version = string() - Type = #IFR_IDLType_objref - Mode = atom() ('ATTR_NORMAL' or 'ATTR_READONLY') - Return = #IFR_AttributeDef_objref - - -

Creates an IFR object of the type AttributeDef contained in this - InterfaceDef.

-
-
- - create_operation(Objref,Id,Name,Version,Result,Mode,Params, Exceptions,Contexts) -> Return - Create an IFR object of the type OperationDef contained in the target InterfaceDef object - - Objref = #IFR_InterfaceDef_objref - Id = string() - Name = string() - Version = string() - Result = #IFR_IDLType_objref - Mode = atom() ('OP_NORMAL' or 'OP_ONEWAY') - Params = list() (list of parameter description records) - Exceptions = list() (list of #IFR_ExceptionDef_objrefs) - Contexts = list() (list of strings) - Return = #IFR_OperationDef_objref - - -

Creates an IFR object of the type OperationDef contained in this - InterfaceDef.

-
-
-
- -
- diff --git a/lib/orber/doc/src/orber_tc.xml b/lib/orber/doc/src/orber_tc.xml deleted file mode 100644 index 0cab8a5e4b..0000000000 --- a/lib/orber/doc/src/orber_tc.xml +++ /dev/null @@ -1,259 +0,0 @@ - - - - -
- - 1998 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - orber_tc - Lars Thorsén - Lars Thorsén - - Lars Thorsén - - 1998-04-20 - A -
- orber_tc - Help functions for IDL typecodes - -

This module contains some functions that gives support in creating - IDL typecodes that can be used in for example the any types typecode field. - For the simple types it is meaningless to use this API but the functions exist - to get the interface complete.

-

The type TC used below describes an IDL type and is a tuple according - to the to the Erlang language mapping.

-
- - - null() -> TC - void() -> TC - short() -> TC - unsigned_short() -> TC - long() -> TC - unsigned_long() -> TC - long_long() -> TC - unsigned_long_long() -> TC - wchar() -> TC - float() -> TC - double() -> TC - boolean() -> TC - char() -> TC - octet() -> TC - any() -> TC - typecode() -> TC - principal() -> TC - Return the IDL typecode - -

These functions return the IDL typecodes for simple types.

-
-
- - object_reference(Id, Name) -> TC - Return the object_reference IDL typecode - - Id = string() - the repository ID - Name = string() - the type name of the object - - -

Function returns the IDL typecode for object_reference.

-
-
- - struct(Id, Name, ElementList) -> TC - Return the struct IDL typecode - - Id = string() - the repository ID - Name = string() - the type name of the struct - ElementList = [{MemberName, TC}] - a list of the struct elements - MemberName = string() - the element name - - -

Function returns the IDL typecode for struct.

-
-
- - union(Id, Name, DiscrTC, Default, ElementList) -> TC - Return the union IDL typecode - - Id = string() - the repository ID - Name = string() - the type name of the union - DiscrTC = TC - the typecode for the unions discriminant - Default = integer() - a value that indicates which tuple in the element list that is default (value < 0 means no default) - ElementList = [{Label, MemberName, TC}] - a list of the union elements - Label = term() - the label value should be of the DiscrTCtype - MemberName = string() - the element name - - -

Function returns the IDL typecode for union.

-
-
- - enum(Id, Name, ElementList) -> TC - Return the enum IDL typecode - - Id = string() - the repository ID - Name = string() - the type name of the enum - ElementList = [MemberName] - a list of the enums elements - MemberName = string() - the element name - - -

Function returns the IDL typecode for enum.

-
-
- - string(Length) -> TC - Return the string IDL typecode - - Length = integer() - the length of the string (0 means unbounded) - - -

Function returns the IDL typecode for string.

-
-
- - wstring(Length) -> TC - Return the wstring IDL typecode - - Length = integer() - the length of the wstring (0 means unbounded) - - -

Function returns the IDL typecode for wstring.

-
-
- - fixed(Digits, Scale) -> TC - Return the fixed IDL typecode - - Digits = Scale = integer() - the digits and scale parameters of a Fixed type - - -

Function returns the IDL typecode for fixed.

-
-
- - sequence(ElemTC, Length) -> TC - Return the sequence IDL typecode - - ElemTC = TC - the typecode for the sequence elements - Length = integer() - the length of the sequence (0 means unbounded) - - -

Function returns the IDL typecode for sequence.

-
-
- - array(ElemTC, Length) -> TC - Return the array IDL typecode - - ElemTC = TC - the typecode for the array elements - Length = integer() - the length of the array - - -

Function returns the IDL typecode for array.

-
-
- - alias(Id, Name, AliasTC) -> TC - Return the alias IDL typecode - - Id = string() - the repository ID - Name = string() - the type name of the alias - AliasTC = TC - the typecode for the type which the alias refer to - - -

Function returns the IDL typecode for alias.

-
-
- - exception(Id, Name, ElementList) -> TC - Return the exception IDL typecode - - Id = string() - the repository ID - Name = string() - the type name of the exception - ElementList = [{MemberName, TC}] - a list of the exception elements - MemberName = string() - the element name - - -

Function returns the IDL typecode for exception.

-
-
- - get_tc(Object) -> TC - get_tc(Id) -> TC - Fetch typecode - - Object = record() - an IDL specified struct, union or exception - Id = string() - the repository ID - - -

If the get_tc/1 gets a record that is and IDL specified - struct, union or exception as a parameter it returns the - typecode.

-

If the parameter is a repository ID it uses the Interface Repository - to get the typecode.

-
-
- - check_tc(TC) -> boolean() - Check syntax of an IDL typecode - -

Function checks the syntax of an IDL typecode.

-
-
-
- -
- diff --git a/lib/orber/doc/src/orbs.gif b/lib/orber/doc/src/orbs.gif deleted file mode 100644 index 47f2c85441..0000000000 Binary files a/lib/orber/doc/src/orbs.gif and /dev/null differ diff --git a/lib/orber/doc/src/part.xml b/lib/orber/doc/src/part.xml deleted file mode 100644 index ef84b8c05a..0000000000 --- a/lib/orber/doc/src/part.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - -
- - 19972016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Orber User's Guide - - - 1998-04-26 - 2.2 -
- -

The Orber application is an Erlang implementation of a - CORBA Object Request Broker.

-
- - - - - - - - - - - - - -
- diff --git a/lib/orber/doc/src/ref_man.xml b/lib/orber/doc/src/ref_man.xml deleted file mode 100644 index 6fa409538d..0000000000 --- a/lib/orber/doc/src/ref_man.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - -
- - 19972016 - Ericsson AB. All Rights Reserved. - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - - Orber Reference Manual - - - 1998-05-05 - 2.0 -
- -

The Orber application is an Erlang implementation of a - CORBA Object Request Broker.

-
- - - - - - - - - - - - - - - - - -
- diff --git a/lib/orber/doc/src/theORB.gif b/lib/orber/doc/src/theORB.gif deleted file mode 100644 index 976672b8df..0000000000 Binary files a/lib/orber/doc/src/theORB.gif and /dev/null differ diff --git a/lib/orber/doc/src/tools_debugging_part.xml b/lib/orber/doc/src/tools_debugging_part.xml deleted file mode 100644 index 94af44833c..0000000000 --- a/lib/orber/doc/src/tools_debugging_part.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - -
- - 2002 - 2016 - Ericsson AB, All Rights Reserved - - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - The Initial Developer of the Original Code is Ericsson AB. - - - Tools, Debugging and FAQ - Niclas Eklund - - 2002-06-25 - A -
- -

This chapter describe the available tools and debugging facilities for Orber. - Also contain a FAQ listing of the most common mistakes.

-
- - -
- diff --git a/lib/orber/ebin/.gitignore b/lib/orber/ebin/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/orber/examples/Makefile b/lib/orber/examples/Makefile deleted file mode 100644 index bf1ff13707..0000000000 --- a/lib/orber/examples/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1997-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(ORBER_VSN) - -# ---------------------------------------------------- -# Common Macros -# ---------------------------------------------------- - -SUB_DIRECTORIES = Stack - -SPECIAL_TARGETS = - -# ---------------------------------------------------- -# Default Subdir Targets -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_subdir.mk - diff --git a/lib/orber/examples/Stack/InitialReferences.idl b/lib/orber/examples/Stack/InitialReferences.idl deleted file mode 100644 index 7c1dddc7c4..0000000000 --- a/lib/orber/examples/Stack/InitialReferences.idl +++ /dev/null @@ -1,12 +0,0 @@ -typedef string ObjectId; -typedef sequence ObjectIdList; - -module Orber { -interface InitialReferences { - - Object get(in ObjectId id); - - ObjectIdList list(); - -}; -}; diff --git a/lib/orber/examples/Stack/Makefile b/lib/orber/examples/Stack/Makefile deleted file mode 100644 index 5348c624e3..0000000000 --- a/lib/orber/examples/Stack/Makefile +++ /dev/null @@ -1,128 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1997-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk - -EBIN= ../../ebin - -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../../vsn.mk -VSN=$(ORBER_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/orber-$(VSN) - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- - -IDL_FILES = \ - stack.idl \ - InitialReferences.idl - -GEN_ERL_MODULES = \ - oe_stack \ - StackModule_Stack \ - StackModule_StackFactory \ - StackModule_EmptyStack - -MODULES= \ - StackModule_Stack_impl \ - StackModule_StackFactory_impl \ - stack_factory \ - stack_client - -GEN_HRL_FILES = \ - oe_stack.hrl \ - StackModule.hrl \ - StackModule_Stack.hrl \ - StackModule_StackFactory.hrl - -HRL_FILES= - -ERL_FILES= $(MODULES:%=%.erl) - -GEN_FILES = $(GEN_ERL_MODULES:%=%.erl) $(GEN_HRL_FILES) - -JAVA_CLASSES = \ - StackClient - -JAVA_FILES= $(JAVA_CLASSES:%=%.java) -CLASS_FILES= $(JAVA_CLASSES:%=%.class) - -TARGET_FILES = \ - $(GEN_ERL_MODULES:%=$(EBIN)/%.$(EMULATOR)) \ - $(MODULES:%=$(EBIN)/%.$(EMULATOR)) - -TEST_TARGET_FILES = - -CPP_FILES = StackClient.cc - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/orber/ebin -pa $(ERL_TOP)/lib/ic/ebin -# The -pa option is just used temporary until erlc can handle -# includes from other directories than ../include . -ERL_COMPILE_FLAGS += \ - $(ERL_IDL_FLAGS) \ - -pa $(ERL_TOP)/lib/orber -I$(ERL_TOP)/lib/orber - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -debug opt: $(TARGET_FILES) - -clean: - rm -f $(TARGET_FILES) $(GEN_ERL_MODULES:%=%.erl) $(GEN_HRL_FILES) $(CLASS_FILES) IDL-GENERATED - rm -f errs core *~ - -docs: - -test: $(TEST_TARGET_FILES) - -IDL-GENERATED: stack.idl - $(gen_verbose)erlc $(ERL_IDL_FLAGS) stack.idl - $(V_at)>IDL-GENERATED - -$(GEN_FILES): IDL-GENERATED - -$(TARGET_FILES): IDL-GENERATED - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - - -release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)/examples/Stack" - $(INSTALL_DATA) $(ERL_FILES) $(JAVA_FILES) $(CPP_FILES) $(IDL_FILES) "$(RELSYSDIR)/examples/Stack" - - -release_docs_spec: - - diff --git a/lib/orber/examples/Stack/StackClient.cc b/lib/orber/examples/Stack/StackClient.cc deleted file mode 100644 index 4d393390c4..0000000000 --- a/lib/orber/examples/Stack/StackClient.cc +++ /dev/null @@ -1,97 +0,0 @@ -/** - * - * 2000-2007 - * Ericsson AB, All Rights Reserved - * - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * The Initial Developer of the Original Code is Ericsson AB. - * - */ -/** - * This module gives an example how it is possible to setup a connection - * Orbix3.0.1 and Orber3.0.2 - */ - - -#define USE_IIOP - -#include -#include -#include -#include - -#include "NamingService.hh" -#include "InitialReference.hh" -#include "InitialReferences.hh" -#include "stack.hh" - - -int main(int argc, char** argv) { - - CORBA::Object_ptr nsRef, initRef, objRef; - InitialReference init; - Orber::InitialReferences_var initp; - CosNaming::NamingContext_var Ns; - CosNaming::NameComponent nc; - CosNaming::Name_var name; - StackModule::StackFactory_var stackFac; - StackModule::Stack_var stack; - - if (argc < 3) { - cout << "usage: " << argv[0] << " " << " " << endl; - exit (-1); - } - - string srvHost = argv[1]; - long srvPort = atoi(argv[2]); - - cout << "Using host: " << srvHost << " Port: " << srvPort << endl; - - try - { - // Create Initial reference (objectkey "INIT"). - const string s = init.stringified_ior(srvHost, srvPort); - initRef = CORBA::Orbix.string_to_object(s); - initp = Orber::InitialReferences::_narrow(initRef); - nsRef = initp->get("NameService"); - Ns = CosNaming::NamingContext::_narrow(nsRef); - - // Create a name component. - name = new CosNaming::Name(1); - name->length(1); - name[0].id = CORBA::string_dup("StackFactory"); - name[0].kind = CORBA::string_dup(""); - - // Look up the Object in the NamingService. - objRef = Ns->resolve(name); - stackFac = StackModule::StackFactory::_narrow(objRef); - stack = stackFac->create_stack(); - - // push & pop - stack->push(8); - stack->push(7); - stack->push(6); - cout << "Stack: " << stack->pop() - << " " << stack->pop() - << " " << stack->pop() << endl; - - } catch(...) { - cerr << "call failed" << endl; - cerr << "Unexpected exception " << endl; - exit(1); - } - cout << "Completed successfully" << endl; - return 0; -} diff --git a/lib/orber/examples/Stack/StackClient.java b/lib/orber/examples/Stack/StackClient.java deleted file mode 100644 index 55e967a330..0000000000 --- a/lib/orber/examples/Stack/StackClient.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1997-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -/* - * Stack example. - */ - -package StackModule; -import org.omg.CORBA.*; -import org.omg.CORBA.SystemException; -import org.omg.CORBA.ORB.*; - -public class StackClient -{ - public static void main(String args[]) - { - org.omg.CORBA.Object objRef; - StackFactory sfRef = null; - Stack sRef = null; - // The argument can look like - // "corbaname::host:4001/#StackFactory" - String corbaName = new String(args[0]); - try{ - ORB orb = ORB.init(args, null); - - objRef = orb.string_to_object(corbaName); - sfRef = StackFactoryHelper.narrow(objRef); - sRef = sfRef.create_stack(); - - sRef.push(4); - sRef.push(7); - sRef.push(1); - sRef.push(1); - - try{ - System.out.println(sRef.pop()); - System.out.println(sRef.pop()); - System.out.println(sRef.pop()); - System.out.println(sRef.pop()); - // The following operation shall - // return an EmptyStack exception - System.out.println(sRef.pop()); - } - catch(EmptyStack es) { - System.out.println("Empty stack"); - }; - - sfRef.destroy_stack(sRef); - } - catch(SystemException se) - { - System.out.println("Unexpected exception: " + se.toString()); - return; - } - } -} diff --git a/lib/orber/examples/Stack/StackModule_StackFactory_impl.erl b/lib/orber/examples/Stack/StackModule_StackFactory_impl.erl deleted file mode 100644 index 76e449971f..0000000000 --- a/lib/orber/examples/Stack/StackModule_StackFactory_impl.erl +++ /dev/null @@ -1,41 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% StackModule_StackFactory_impl example file. - --module('StackModule_StackFactory_impl'). --include_lib("orber/include/corba.hrl"). --export([create_stack/1, destroy_stack/2, init/1, terminate/2]). - - -init(_Env) -> - {ok, []}. - -terminate(_From, _Reason) -> - ok. - -create_stack(State) -> - %% Just a create we don't want a link. - {reply, 'StackModule_Stack':oe_create(), State}. - -destroy_stack(State, Stack) -> - {reply, corba:dispose(Stack), State}. diff --git a/lib/orber/examples/Stack/StackModule_Stack_impl.erl b/lib/orber/examples/Stack/StackModule_Stack_impl.erl deleted file mode 100644 index ff4dc90829..0000000000 --- a/lib/orber/examples/Stack/StackModule_Stack_impl.erl +++ /dev/null @@ -1,47 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% StackModule_Stack_impl example file. - --module('StackModule_Stack_impl'). --include_lib("orber/include/corba.hrl"). --include("StackModule.hrl"). --export([pop/1, push/2, empty/1, init/1, terminate/2]). - - -init(_Env) -> - {ok, []}. - -terminate(_From, _Reason) -> - ok. - -push(Stack, Val) -> - {reply, ok, [Val | Stack]}. - -pop([Val | Stack]) -> - {reply, Val, Stack}; -pop([]) -> - corba:raise(#'StackModule_EmptyStack'{}). - -empty(_) -> - {reply, ok, []}. - diff --git a/lib/orber/examples/Stack/stack.idl b/lib/orber/examples/Stack/stack.idl deleted file mode 100644 index f21f93917b..0000000000 --- a/lib/orber/examples/Stack/stack.idl +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef _STACK_IDL -#define _STACK_IDL - -module StackModule { - - exception EmptyStack {}; - - interface Stack { - - long pop() raises(StackModule::EmptyStack); - - void push(in long value); - - void empty(); - - }; - - interface StackFactory { - - StackModule::Stack create_stack(); - void destroy_stack(in StackModule::Stack s); - - }; - -}; - -#endif diff --git a/lib/orber/examples/Stack/stack_client.erl b/lib/orber/examples/Stack/stack_client.erl deleted file mode 100644 index 6e32195b1b..0000000000 --- a/lib/orber/examples/Stack/stack_client.erl +++ /dev/null @@ -1,56 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% stack_client example file. - --module('stack_client'). - --export([run/0]). - - -run() -> - case catch corba:string_to_object("corbaname:rir:/NameService#StackFactory") of - {'EXCEPTION', _E} -> - io:format("The stack factory server is not registered~n",[]); - SF -> - %% Create the stack - SS = 'StackModule_StackFactory':create_stack(SF), - - 'StackModule_Stack':push(SS, 4), - 'StackModule_Stack':push(SS, 7), - 'StackModule_Stack':push(SS, 1), - 'StackModule_Stack':push(SS, 1), - Res = 'StackModule_Stack':pop(SS), - io:format("~w~n", [Res]), - Res1 = 'StackModule_Stack':pop(SS), - io:format("~w~n", [Res1]), - Res2 = 'StackModule_Stack':pop(SS), - io:format("~w~n", [Res2]), - Res3 = 'StackModule_Stack':pop(SS), - io:format("~w~n", [Res3]), - - %% Remove the stack - 'StackModule_StackFactory':destroy_stack(SF, SS) - - end. - - diff --git a/lib/orber/examples/Stack/stack_factory.erl b/lib/orber/examples/Stack/stack_factory.erl deleted file mode 100644 index b5b455ae5a..0000000000 --- a/lib/orber/examples/Stack/stack_factory.erl +++ /dev/null @@ -1,38 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% stack_factory example file. - --module('stack_factory'). --include_lib("orber/include/corba.hrl"). --include_lib("orber/COSS/CosNaming/CosNaming.hrl"). --include_lib("orber/COSS/CosNaming/lname.hrl"). - --export([start/0]). - -start() -> - SFok = 'StackModule_StackFactory':oe_create(), - NS = corba:resolve_initial_references("NameService"), - NC = lname_component:set_id(lname_component:create(), "StackFactory"), - N = lname:insert_component(lname:create(), 1, NC), - 'CosNaming_NamingContext':bind(NS, N, SFok). - diff --git a/lib/orber/include/corba.hrl b/lib/orber/include/corba.hrl deleted file mode 100644 index fb1c2a5a94..0000000000 --- a/lib/orber/include/corba.hrl +++ /dev/null @@ -1,149 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%------------------------------------------------------------ -%% File: corba.hrl -%% -%% Description: -%% Standard header file for the Orber Erlang CORBA environment -%% -%%----------------------------------------------------------------- --ifndef(corba_hrl). --define(corba_hrl, true). - -%% -%% Implementation repository record (not used and can therefor be changed) -%% --record(orb_ImplDef, {node, module, typename, start=start, args=[[]], pid}). - -%% -%% Any record -%% --record(any, {typecode, value}). - -%% -%% Any record -%% --record(fixed, {digits, scale, value}). - -%% -%% Service context record -%% --record('IOP_ServiceContext', {context_id, context_data}). - -%% -%% Exception recod for the resolve initial reference functions -%% --record('InvalidName', {'OE_ID'="IDL:omg.org/CORBA/ORB/InvalidName:1.0"}). - -%% Orber OMG assigned TAG's -%% Service Context IDs 0x45524904 - 0x45524907 ("ERI\x04" - "ERI\x07") -%% Component IDs 0x45524904 - 0x45524907 ("ERI\x04" - "ERI\x07") -%% ORB type IDs 0x45524904 - 0x45524907 ("ERI\x04" - "ERI\x07") --define(ORBER_ORB_TYPE_1, 16#45524904). -%-define(ORBER_ORB_TYPE_2, 16#45524905). -%-define(ORBER_ORB_TYPE_3, 16#45524906). -%-define(ORBER_ORB_TYPE_4, 16#45524907). - -%-define(ORBER_COMPONENT_1, 16#45524904). -%-define(ORBER_COMPONENT_2, 16#45524905). -%-define(ORBER_COMPONENT_3, 16#45524906). -%-define(ORBER_COMPONENT_4, 16#45524907). - --define(ORBER_GENERIC_CTX_ID, 16#45524904). -%-define(ORBER_SERVICE_CTX_2, 16#45524905). -%-define(ORBER_SERVICE_CTX_3, 16#45524906). -%-define(ORBER_SERVICE_CTX_4, 16#45524907). - -%% -%% System exceptions -%% - -%% VMCID -%% VMCID base assigned to OMG --define(CORBA_OMGVMCID, 16#4f4d0000). - -%% Orber's VMCID base - "ER\x00\x00" - "ER\x0f\xff". -%% Range 16#45520000 -> 16#45520fff --define(ORBER_VMCID, 16#45520000). - -%% Some other Vendors VMCID bases. --define(IONA_VMCID_1, 16#4f4f0000). --define(IONA_VMCID_2, 16#49540000). --define(SUN_VMCID, 16#53550000). --define(BORLAND_VMCID, 16#56420000). --define(TAO_VMCID, 16#54410000). --define(PRISMTECH_VMCID,16#50540000). - --define(ex_body, {'OE_ID'="", minor=?ORBER_VMCID, completion_status}). - --record('UNKNOWN', ?ex_body). --record('BAD_PARAM', ?ex_body). --record('NO_MEMORY', ?ex_body). --record('IMP_LIMIT', ?ex_body). --record('COMM_FAILURE', ?ex_body). --record('INV_OBJREF', ?ex_body). --record('NO_PERMISSION', ?ex_body). --record('INTERNAL', ?ex_body). --record('MARSHAL', ?ex_body). --record('INITIALIZE', ?ex_body). --record('NO_IMPLEMENT', ?ex_body). --record('BAD_TYPECODE', ?ex_body). --record('BAD_OPERATION', ?ex_body). --record('NO_RESOURCES', ?ex_body). --record('NO_RESPONSE', ?ex_body). --record('PERSIST_STORE', ?ex_body). --record('BAD_INV_ORDER', ?ex_body). --record('TRANSIENT', ?ex_body). --record('FREE_MEM', ?ex_body). --record('INV_IDENT', ?ex_body). --record('INV_FLAG', ?ex_body). --record('INTF_REPOS', ?ex_body). --record('BAD_CONTEXT', ?ex_body). --record('OBJ_ADAPTER', ?ex_body). --record('DATA_CONVERSION', ?ex_body). --record('OBJECT_NOT_EXIST', ?ex_body). --record('TRANSACTION_REQUIRED', ?ex_body). --record('TRANSACTION_ROLLEDBACK', ?ex_body). --record('INVALID_TRANSACTION', ?ex_body). --record('INV_POLICY', ?ex_body). --record('CODESET_INCOMPATIBLE', ?ex_body). --record('REBIND', ?ex_body). --record('TIMEOUT', ?ex_body). --record('TRANSACTION_UNAVAILABLE', ?ex_body). --record('TRANSACTION_MODE', ?ex_body). --record('BAD_QOS', ?ex_body). - -%% Defines for the enum exception_type (is also used for reply_status) --define(NO_EXCEPTION, 'no_exception'). --define(USER_EXCEPTION, 'user_exception'). --define(SYSTEM_EXCEPTION, 'system_exception'). - -%% Defines for the enum completion_status. --define(COMPLETED_YES, 'COMPLETED_YES'). --define(COMPLETED_NO, 'COMPLETED_NO'). --define(COMPLETED_MAYBE, 'COMPLETED_MAYBE'). - - --undef(ex_body). - - --endif. diff --git a/lib/orber/include/ifr_types.hrl b/lib/orber/include/ifr_types.hrl deleted file mode 100644 index ceb8bbe885..0000000000 --- a/lib/orber/include/ifr_types.hrl +++ /dev/null @@ -1,73 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : ifr_types.hrl -%% Purpose : Record definitions for structs used in the interface repository -%%---------------------------------------------------------------------- - - -%%%---------------------------------------------------------------------- -%%% ********************************************************************* -%%% * * -%%% * PLEASE NOTE * -%%% * * -%%% * If a record is removed or added in this file, select/2 in * -%%% * orber_ifr.erl _MUST_ be updated accordingly. * -%%% * * -%%% ********************************************************************* -%%%---------------------------------------------------------------------- - --record(contained_description, {kind, value}). - --record(structmember, {name, type, type_def}). - --record(unionmember, {name, label, type, type_def}). - --record(container_description, {contained_object, kind, value}). - --record(moduledescription, {name, id, defined_in, version}). - --record(constantdescription, {name, id, defined_in, version, type, value}). - --record(typedescription, {name, id, defined_in, version, type}). - --define(make_typedescription(Obj,Object_type), - #typedescription{name = Obj#Object_type.name, - id = Obj#Object_type.id, - defined_in = Obj#Object_type.defined_in, - version = Obj#Object_type.version, - type = Obj#Object_type.type}). - --record(exceptiondescription, {name, id, defined_in, version, type}). - --record(attributedescription, {name, id, defined_in, version, type, mode}). - --record(parameterdescription, {name, type, type_def, mode}). - --record(operationdescription, {name, id, defined_in, version, result, mode, - contexts, parameters, exceptions}). - --record(fullinterfacedescription, {name, id, defined_in, version, operations, - attributes, base_interfaces, type}). - --record(interfacedescription, {name, id, defined_in, version, - base_interfaces}). diff --git a/lib/orber/include/orber_pi.hrl b/lib/orber/include/orber_pi.hrl deleted file mode 100644 index 7d1fa1edf2..0000000000 --- a/lib/orber/include/orber_pi.hrl +++ /dev/null @@ -1,77 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_pi.hrl -%% Purpose : -%%---------------------------------------------------------------------- - -%%=============== CONSTANTS ================================== -%%-------- PortableInterceptor::Interceptor (local) ---------- -%% Reply Status --define('PortableInterceptor_SUCCESSFUL', 0). --define('PortableInterceptor_SYSTEM_EXCEPTION', 1). --define('PortableInterceptor_USER_EXCEPTION', 2). --define('PortableInterceptor_LOCATION_FORWARD', 3). --define('PortableInterceptor_LOCATION_FORWARD_PERMANENT', 4). --define('PortableInterceptor_TRANSPORT_RETRY', 5). - - -%%=============== EXCEPTIONS ================================= -%%-------- PortableInterceptor::Interceptor (local) ---------- -%% forward eq. CORBA::Object, premanent eq. boolean --record('PortableInterceptor_ForwardRequest', {'OE_ID'="local", forward, permanent}). --record('PortableInterceptor_InvalidSlot', {'OE_ID'="local"}). - -%%--------------- IOP_N::Codec (local) ----------------------- --record('IOP_N_Codec_InvalidTypeForEncoding', {'OE_ID'="local"}). --record('IOP_N_Codec_FormatMismatch', {'OE_ID'="local"}). --record('IOP_N_Codec_TypeMismatch', {'OE_ID'="local"}). - -%%--------------- IOP_N (Module level) ----------------------- --define('IOP_N_ENCODING_CDR_ENCAPS', 0). - -%%--------------- IOP_N::CodecFactory (Module level) --------- --record('IOP_N_CodecFactory_UnknownEncoding', {'OE_ID'="local"}). - -%%--------------- IOP_N::ORBInitInfo (Module level) ---------- -%% name eq. string() --record('PortableInterceptor_ORBInitInfo_DuplicateName', {'OE_ID'="local", name}). --record('PortableInterceptor_ORBInitInfo_InvalidName', {'OE_ID'="local"}). - - -%%=============== DATA STRUCTURES ============================ -%%--------------- IOP_N (Module level) ----------------------- --record('IOP_N_Encoding', - {format, %% Currently only 'IOP_N_ENCODING_CDR_ENCAPS' allowed. - major_version, %% 1 only - minor_version}). %% 0,1 or 2 - - -%%--------------- Dynamic (Module level) --------------------- -%% argument eq. #any{}, -%% mode eq. CORBA::ParameterMode - PARAM_IN, PARAM_OUT, PARAM_INOUT. --record('Dynamic_Parameter', - {argument, - mode}). - -%%--------------- END OF MODULE ------------------------------ - diff --git a/lib/orber/info b/lib/orber/info deleted file mode 100644 index c92ea38dd8..0000000000 --- a/lib/orber/info +++ /dev/null @@ -1,2 +0,0 @@ -group: orb -short: A CORBA Object Request Broker diff --git a/lib/orber/java_src/Makefile b/lib/orber/java_src/Makefile deleted file mode 100644 index d8a8843d00..0000000000 --- a/lib/orber/java_src/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1997-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(ORBER_VSN) - -# ---------------------------------------------------- -# Common Macros -# ---------------------------------------------------- - -SUB_DIRECTORIES = Orber - -SPECIAL_TARGETS = - -# ---------------------------------------------------- -# Default Subdir Targets -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_subdir.mk - diff --git a/lib/orber/java_src/Orber/InitialReference.java b/lib/orber/java_src/Orber/InitialReference.java deleted file mode 100644 index 35a8c2437b..0000000000 --- a/lib/orber/java_src/Orber/InitialReference.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * %CopyrightBegin% - * - * Copyright Ericsson AB 1997-2016. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * %CopyrightEnd% - * - */ -/** - * InitialReference is a class which generates the INIT reference - * which can be used by the InitialReferences interface. - */ -package Orber; - -public class InitialReference -{ - - /** - * Constructor. - */ - public InitialReference(){;} - - /** - * Returns the stringified objectreference to the initial reference server - */ - public String stringified_ior(String host, int port) - { - String iorByteString; - String profileData; - String iorString; - - // byte_order followed by ' {"", [{0, ' - // char iorBytesFirstPart[] = {0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0}; - char iorBytesFirstPart[] = {0,0,0,0,0,0,0,32,73,68,76,58,79,114,98,101,114,47,73,110,105,116,105,97,108,82,101,102,101,114,101,110,99,101,115,58,49,46,48,0,0,0,0,1,0,0,0,0}; - // the objectkey "INIT - char iorBytesLastPart[] = {0,0,0,4,73,78,73,84}; - - // Fix the ProfileData struct. - char pdPrefix[] = {0,1,0,0}; - char nullbyte[] = {0}; - profileData = new String(pdPrefix) + enc_ulong(host.length() + 1) + host + new String(nullbyte); - profileData = align(profileData, 2); - profileData += enc_ushort(port); - profileData = align(profileData, 4); - profileData += new String(iorBytesLastPart); - // Fix the whole IOR - iorByteString = new String(iorBytesFirstPart) + enc_ulong(profileData.length()) + - profileData; - - // System.out.print("Start[" + profileData.length() + "]"); - // System.out.print("["); - // for(int x = 0; x < iorByteString.length(); x++) - // { - // System.out.print((int) iorByteString.charAt(x) + ","); - // } - // System.out.println("]"); - - iorString = createIOR(iorByteString); - // System.out.println(iorString); - return iorString; - } - - - private String enc_ushort(int s) - { - char byteArray[] = {(char) ((s >>> 8) & 0xFF), - (char) ((s >>> 0) & 0xFF)}; - - return new String(byteArray); - } - - private String enc_ulong(int l) - { - char byteArray[] = {(char) ((l >>> 24) & 0xFF), - (char) ((l >>> 16) & 0xFF), - (char) ((l >>> 8) & 0xFF), - (char) ((l >>> 0) & 0xFF)}; - - return new String(byteArray); - - } - - private String createIOR(String bytes) - { - int i; - StringBuffer sb = new StringBuffer("IOR:"); - - for(i = 0; i < bytes.length(); i++) - { - int b = bytes.charAt(i); - if(b<0) b+= 256; - int n1 = b / 16; - int n2 = b % 16; - int c1 = (n1 < 10) ? ('0' + n1) : ('a' + (n1 - 10)); - int c2 = (n2 < 10) ? ('0' + n2) : ('a' + (n2 - 10)); - sb.append((char)c1); - sb.append((char)c2); - } - - return sb.toString(); - } - - private String align(String buffer, int alignment) - { - String s = buffer; - char nullbyte[] = {0}; - - int remainder = alignment - (buffer.length() % alignment); - if (remainder == alignment) return s; - - for (int i = 0; i < remainder; i++) - { - s += new String(nullbyte); - } - return s; - } - - -} diff --git a/lib/orber/java_src/Orber/Makefile b/lib/orber/java_src/Orber/Makefile deleted file mode 100644 index 3414fb2e76..0000000000 --- a/lib/orber/java_src/Orber/Makefile +++ /dev/null @@ -1,71 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1997-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk - -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../../vsn.mk -VSN=$(ORBER_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/orber-$(VSN) - -# -# JAVA macros -# -JAVA_CLASSES = \ - InitialReference - -JAVA_FILES= $(JAVA_CLASSES:%=%.java) - -CLASSPATH = ../.. - -# ---------------------------------------------------- -# Flags -# ---------------------------------------------------- -JAVA_OPTIONS = - -# ---------------------------------------------------- -# Make Rules -# ---------------------------------------------------- - -debug opt: - -clean: - -docs: - -# ---------------------------------------------------- -# Release Targets -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)/java_src/Orber" - $(INSTALL_DATA) $(JAVA_FILES) "$(RELSYSDIR)/java_src/Orber" - -release_docs_spec: - diff --git a/lib/orber/prebuild.skip b/lib/orber/prebuild.skip deleted file mode 100644 index d6c7895b9c..0000000000 --- a/lib/orber/prebuild.skip +++ /dev/null @@ -1,5 +0,0 @@ -priv -src/PKIXAttributeCertificate.asn1db -src/PKIX1Explicit88.asn1db -src/OrberCSIv2.asn1db -src/PKIX1Implicit88.asn1db diff --git a/lib/orber/priv/Makefile b/lib/orber/priv/Makefile deleted file mode 100644 index 268c16c4c7..0000000000 --- a/lib/orber/priv/Makefile +++ /dev/null @@ -1,67 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2001-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -include ../vsn.mk -VSN = $(ORBER_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/orber-$(VSN) - -# -# Macros -# -HELP_FILES = \ - orber_help.txt - -HTML_FILES = \ - orber.tool \ - blank.html \ - info_frames.html \ - main_frame.html \ - start_info.html - -# -# Rules -# - -debug opt: - -docs: - -clean: - - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)/priv" - $(INSTALL_DATA) $(HELP_FILES) $(HTML_FILES) "$(RELSYSDIR)/priv" - -release_docs_spec: - - diff --git a/lib/orber/priv/Orber/.gitignore b/lib/orber/priv/Orber/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/orber/priv/bin/.gitignore b/lib/orber/priv/bin/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/orber/priv/blank.html b/lib/orber/priv/blank.html deleted file mode 100644 index 44e86908a0..0000000000 --- a/lib/orber/priv/blank.html +++ /dev/null @@ -1,6 +0,0 @@ - - - -  - - \ No newline at end of file diff --git a/lib/orber/priv/info_frames.html b/lib/orber/priv/info_frames.html deleted file mode 100644 index 75456a67a4..0000000000 --- a/lib/orber/priv/info_frames.html +++ /dev/null @@ -1,9 +0,0 @@ - - -OrberWeb - - - - - - \ No newline at end of file diff --git a/lib/orber/priv/main_frame.html b/lib/orber/priv/main_frame.html deleted file mode 100644 index 056a92812e..0000000000 --- a/lib/orber/priv/main_frame.html +++ /dev/null @@ -1,9 +0,0 @@ - - -OrberWeb - - - - - - \ No newline at end of file diff --git a/lib/orber/priv/obj/.gitignore b/lib/orber/priv/obj/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/orber/priv/orber.tool b/lib/orber/priv/orber.tool deleted file mode 100644 index 910a7d7e45..0000000000 --- a/lib/orber/priv/orber.tool +++ /dev/null @@ -1,2 +0,0 @@ -{version,"1.2"}. -[{config_func,{orber_web_server,config_data,[]}}]. diff --git a/lib/orber/priv/orber_help.txt b/lib/orber/priv/orber_help.txt deleted file mode 100644 index a6580dc30a..0000000000 --- a/lib/orber/priv/orber_help.txt +++ /dev/null @@ -1,42 +0,0 @@ - - - - Help for the Orber administration tool - -------------------------------------- - - - - - - The purpose of this tool is to supply an easy way to - access Orber nodes and via a GUI explore: - - NameService - - Configuration settings - - Interface Repository - - All nodes that are known to this tool is shown in the node - window, normally this is all Erlang nodes visible with the - [node()|nodes()] commands. - - -The Node window ---------------- - - The node window monitor nodes. - - -Technical Detail ----------------- - - Trouble shooting - ---------------- - - Q. Why doesn't all my nodes show up in the node window? - - A. Are the nodes visible with the [node()|nodes()] commands - in the shell? If not you must do net:ping(NodeName) to add - nodes to the Erlang distribution. - - Q. When trying to access a node I get no valid response? - - A. Make sure that Orber is running on the node. diff --git a/lib/orber/priv/start_info.html b/lib/orber/priv/start_info.html deleted file mode 100644 index 0ad521c90a..0000000000 --- a/lib/orber/priv/start_info.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - -
- - - - - - - - - - - - - -
-Welcome to the Web based Orber Admin Tool -




-
  -
- -
- - \ No newline at end of file diff --git a/lib/orber/src/CORBA.idl b/lib/orber/src/CORBA.idl deleted file mode 100644 index 3cd8790f49..0000000000 --- a/lib/orber/src/CORBA.idl +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _CORBA_IDL -#define _CORBA_IDL - -#pragma prefix "omg.org" - -//****************************************************************** -// -//Policy Object: -// -//****************************************************************** - -module CORBA { - - // Policy typedefs - typedef unsigned long PolicyType; - typedef string Identifier; - typedef string ScopedName; - typedef string RepositoryId; - -}; - -#endif diff --git a/lib/orber/src/Makefile b/lib/orber/src/Makefile deleted file mode 100644 index 7fec29a000..0000000000 --- a/lib/orber/src/Makefile +++ /dev/null @@ -1,263 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 1997-2016. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk - -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk - - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/orber-$(ORBER_VSN) - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- - -MODULES= \ - orber \ - corba \ - corba_boa \ - corba_object \ - any \ - iop_ior \ - orber_tc \ - orber_typedefs \ - orber_request_number \ - orber_objectkeys \ - orber_initial_references \ - cdrlib \ - cdr_encode \ - cdr_decode \ - orber_iiop \ - orber_iiop_net \ - orber_iiop_net_accept \ - orber_iiop_insup \ - orber_iiop_inproxy \ - orber_iiop_inrequest \ - orber_iiop_pm \ - orber_iiop_outsup \ - orber_iiop_outproxy \ - orber_iiop_socketsup \ - orber_socket \ - orber_ifr \ - orber_ifr_aliasdef \ - orber_ifr_arraydef \ - orber_ifr_attributedef \ - orber_ifr_constantdef \ - orber_ifr_contained \ - orber_ifr_container \ - orber_ifr_enumdef \ - orber_ifr_exceptiondef \ - orber_ifr_idltype \ - orber_ifr_interfacedef \ - orber_ifr_irobject \ - orber_ifr_moduledef \ - orber_ifr_operationdef \ - orber_ifr_orb \ - orber_ifr_primitivedef \ - orber_ifr_repository \ - orber_ifr_sequencedef \ - orber_ifr_stringdef \ - orber_ifr_wstringdef \ - orber_ifr_structdef \ - orber_ifr_typecode \ - orber_ifr_typedef \ - orber_ifr_uniondef \ - orber_ifr_fixeddef \ - orber_ifr_utils \ - OrberApp_IFR_impl \ - orber_pi \ - orber_web \ - orber_web_server \ - orber_iiop_tracer \ - orber_iiop_tracer_silent \ - orber_iiop_tracer_stealth \ - fixed \ - orber_exceptions \ - orber_diagnostics \ - orber_acl \ - orber_env \ - orber_tb - -ASN_MODULES = OrberCSIv2 -ASN_SET = $(ASN_MODULES:%=%.set.asn) -ASN_ASNS = $(ASN_MODULES:%=%.asn1) -GEN_ASN_ERL = $(ASN_MODULES:%=%.erl) -GEN_ASN_HRL = $(ASN_MODULES:%=%.hrl) -GEN_ASN_DBS = $(ASN_MODULES:%=%.asn1db) -GEN_ASN_TABLES = $(ASN_MODULES:%=%.table) - -PKIX_FILES = \ - OrberCSIv2.asn1 \ - PKIXAttributeCertificate.asn1 \ - PKIX1Explicit88.asn1 \ - PKIX1Algorithms88.asn1 \ - PKIX1Implicit88.asn1 \ - OrberCSIv2.set.asn - -EXTERNAL_HRL_FILES= ../include/corba.hrl \ - ../include/ifr_types.hrl \ - ../include/orber_pi.hrl - -INTERNAL_HRL_FILES = \ - orber_iiop.hrl \ - ifr_objects.hrl \ - orber_ifr.hrl - -ERL_FILES= $(MODULES:%=%.erl) - -GEN_ERL_FILES1 = \ - oe_erlang.erl \ - erlang_pid.erl \ - erlang_port.erl \ - erlang_ref.erl \ - erlang_binary.erl - -GEN_ERL_FILES2 = \ - oe_CORBA.erl - -GEN_ERL_FILES3 = \ - oe_OrberIFR.erl \ - OrberApp_IFR.erl - -GEN_ERL_FILES = $(GEN_ERL_FILES1) $(GEN_ERL_FILES2) \ - $(GEN_ERL_FILES3) \ -# $(GEN_ASN_ERL) - -GEN_HRL_FILES1 = \ - oe_erlang.hrl \ - erlang.hrl - -GEN_HRL_FILES2 = \ - CORBA.hrl \ - oe_CORBA.hrl - -GEN_HRL_FILES3 = \ - OrberApp_IFR.hrl \ - oe_OrberIFR.hrl \ - OrberApp.hrl - -GEN_HRL_FILES_EXT = $(GEN_HRL_FILES1) - -GEN_HRL_FILES_LOC = $(GEN_HRL_FILES2) $(GEN_HRL_FILES3) \ -# $(GEN_ASN_HRL) - - -GEN_FILES = \ - $(GEN_ERL_FILES) \ - $(GEN_HRL_FILES_LOC) \ - $(GEN_HRL_FILES_EXT) \ -# $(GEN_ASN_DBS) \ -# $(GEN_ASN_TABLES) - -TARGET_FILES = \ - $(GEN_ERL_FILES:%.erl=$(EBIN)/%.$(EMULATOR)) \ - $(MODULES:%=$(EBIN)/%.$(EMULATOR)) - -APPUP_FILE = orber.appup -APPUP_SRC = $(APPUP_FILE).src -APPUP_TARGET = $(EBIN)/$(APPUP_FILE) - -APP_FILE = orber.app -APP_SRC = $(APP_FILE).src -APP_TARGET = $(EBIN)/$(APP_FILE) - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/orber/ebin -# The -pa option is just used temporary until erlc can handle -# includes from other directories than ../include . -ERL_COMPILE_FLAGS += $(ERL_IDL_FLAGS) \ - -I$(ERL_TOP)/lib/orber/include \ - +'{parse_transform,sys_pre_attributes}' \ - +'{attribute,insert,app_vsn,"orber_$(ORBER_VSN)"}' - -ASN_FLAGS = -bber +der +compact_bit_string +nowarn_unused_record - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- -debug: - @${MAKE} TYPE=debug opt - -opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) - -clean: - rm -f $(TARGET_FILES) $(GEN_FILES) $(APP_TARGET) $(APPUP_TARGET) IDL-GENERATED - rm -f errs core *~ - -$(APP_TARGET): $(APP_SRC) ../vsn.mk - $(vsn_verbose)sed -e 's;%VSN%;$(ORBER_VSN);' $< > $@ - -$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - $(vsn_verbose)sed -e 's;%VSN%;$(ORBER_VSN);' $< > $@ - -docs: - -# ---------------------------------------------------- -# Special Build Targets -# ---------------------------------------------------- - -IDL-GENERATED: $(ERL_TOP)/lib/ic/include/erlang.idl CORBA.idl OrberIFR.idl - $(gen_verbose)erlc $(ERL_IDL_FLAGS) $(ERL_TOP)/lib/ic/include/erlang.idl - $(V_at)erlc $(ERL_IDL_FLAGS) CORBA.idl - $(V_at)erlc $(ERL_IDL_FLAGS) +'{this,"Orber::IFR"}' OrberIFR.idl - $(V_at)>IDL-GENERATED - -$(GEN_ERL_FILES): IDL-GENERATED -$(TARGET_FILES): IDL-GENERATED - -$(GEN_ASN_ERL) $(GEN_ASN_HRL): OrberCSIv2.asn1 OrberCSIv2.set.asn - $(asn_verbose)erlc $(ERL_COMPILE_FLAGS) $(ASN_FLAGS) +'{inline,"OrberCSIv2"}' OrberCSIv2.set.asn - $(V_at)rm -f $(GEN_ASN_ERL:%.erl=%.beam) - -# erlc $(ERL_COMPILE_FLAGS) $(ASN_FLAGS) OrberCSIv2.asn1 ;\ -# erlc $(GEN_ASN_ERL) -# Use the following when we safely can inline the ASN1 runtime code. -# Requires igor (part of syntax_tools (introduced in R10B -# erlc $(ERL_COMPILE_FLAGS) $(ASN_FLAGS) +'{inline,"OrberCSIv2"}' OrberCSIv2.set.asn ; \ - - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - - -release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)/ebin" - $(INSTALL_DATA) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) "$(RELSYSDIR)/ebin" - $(INSTALL_DIR) "$(RELSYSDIR)/src" - $(INSTALL_DATA) $(ERL_FILES) $(YRL_FILE) $(GEN_HRL_FILES_LOC) $(INTERNAL_HRL_FILES) "$(RELSYSDIR)/src" - $(INSTALL_DIR) "$(RELSYSDIR)/include" - $(INSTALL_DATA) $(EXTERNAL_HRL_FILES) $(GEN_HRL_FILES_EXT) "$(RELSYSDIR)/include" - - -release_docs_spec: - - diff --git a/lib/orber/src/OrberApp_IFR_impl.erl b/lib/orber/src/OrberApp_IFR_impl.erl deleted file mode 100644 index 069f4ad17a..0000000000 --- a/lib/orber/src/OrberApp_IFR_impl.erl +++ /dev/null @@ -1,102 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File : OrberApp_IFR_impl.erl -%% Purpose : -%%----------------------------------------------------------------- - --module('OrberApp_IFR_impl'). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/src/orber_iiop.hrl"). --include_lib("orber/include/ifr_types.hrl"). --include_lib("orber/include/corba.hrl"). - -%%--------------- IMPORTS ------------------------------------ - -%%--------------- EXPORTS ------------------------------------ -%% External --export([get_absolute_name/3, get_user_exception_type/3]). - -%%--------------- gen_server specific exports ---------------- --export([init/1, terminate/2, code_change/3]). - -%%--------------- LOCAL DEFINITIONS -------------------------- --define(DEBUG_LEVEL, 6). - - -init(State) -> - {ok, State}. -terminate(_Reason, _State) -> - ok. -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%----------------------------------------------------------- -%%------- Exported external functions ----------------------- -%%----------------------------------------------------------- -%%----------------------------------------------------------% -%% function : get_absolute_name -%% Arguments: TypeID - string() -%% Returns : Fully scooped name - string() -%%----------------------------------------------------------- - -get_absolute_name(_OE_THIS, _State, []) -> - orber:dbg("[~p] OrberApp_IFR_impl:get_absolute_name(); no TypeID supplied.", - [?LINE], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 11), completion_status=?COMPLETED_MAYBE}); - -get_absolute_name(_OE_THIS, State, TypeID) -> - Rep = orber_ifr:find_repository(), - Key = orber_ifr:'Repository_lookup_id'(Rep, TypeID), - [$:, $: |N] = orber_ifr:'Contained__get_absolute_name'(Key), - {reply, change_colons_to_underscore(N, []), State}. - -change_colons_to_underscore([$:, $: | T], Acc) -> - change_colons_to_underscore(T, [$_ |Acc]); -change_colons_to_underscore([H |T], Acc) -> - change_colons_to_underscore(T, [H |Acc]); -change_colons_to_underscore([], Acc) -> - lists:reverse(Acc). - -%%----------------------------------------------------------% -%% function : get_user_exception_type -%% Arguments: TypeID - string() -%% Returns : Fully scooped name - string() -%%----------------------------------------------------------- - -get_user_exception_type(_OE_THIS, _State, []) -> - orber:dbg("[~p] OrberApp_IFR_impl:get_user_exception_type(); no TypeID supplied.", - [?LINE], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 11), completion_status=?COMPLETED_MAYBE}); - -get_user_exception_type(_OE_THIS, State, TypeId) -> - Rep = orber_ifr:find_repository(), - ExceptionDef = orber_ifr:'Repository_lookup_id'(Rep, TypeId), - ContainedDescr = orber_ifr_exceptiondef:describe(ExceptionDef), - ExceptionDescr = ContainedDescr#contained_description.value, - {reply, ExceptionDescr#exceptiondescription.type, State}. - - -%%--------------- LOCAL FUNCTIONS ---------------------------- -%%--------------- MISC FUNCTIONS, E.G. DEBUGGING ------------- -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/orber/src/OrberCSIv2.asn1 b/lib/orber/src/OrberCSIv2.asn1 deleted file mode 100644 index d776ce2b47..0000000000 --- a/lib/orber/src/OrberCSIv2.asn1 +++ /dev/null @@ -1,45 +0,0 @@ -OrberCSIv2 DEFINITIONS ::= - -BEGIN - - IMPORTS - - -- IMPORTed module OIDs MAY change if [PKIXPROF] changes - -- PKIX1Explicit88 Certificate Extensions - Certificate - FROM PKIX1Explicit88 {iso(1) identified-organization(3) - dod(6) internet(1) security(5) mechanisms(5) - pkix(7) id-mod(0) id-pkix1-explicit-88(1)} - -- PKIXAttributeCertificate - AttributeCertificate - FROM PKIXAttributeCertificate {iso(1) identified-organization(3) dod(6) - internet(1) security(5) mechanisms(5) pkix(7) id-mod(0) - id-mod-attribute-cert(12)}; - - - - -- Authorization Token - -- AttributeCertificate - [IETF ID PKIXAC]. - -- Certificate - [IETF RFC 2459]. - - VerifyingCertChain ::= SEQUENCE OF Certificate - - AttributeCertChain ::= SEQUENCE { - attributeCert AttributeCertificate, - certificateChain VerifyingCertChain - } - - - -- The ASN.1 encoding of identity tokens of this type is defined - -- as follows (ITTX509CertChain): - CertificateChain ::= SEQUENCE SIZE (1..MAX) OF Certificate - - - -- The object identifier allocated for the GSSUP mechanism is defined as follows: - -- GSS Exported Name Object Form for GSSUP Mechanism - gssup-mechanism OBJECT IDENTIFIER ::= { iso-itu-t (2) international-organization (23) omg (130) security (1) authentication (1) gssup-mechanism (1) } - - -- Scoped-Username GSS Name Form - scoped-username OBJECT IDENTIFIER ::= { iso-itu-t (2) international-organization (23) omg (130) security (1) naming (2) scoped-username(1) } - -END diff --git a/lib/orber/src/OrberCSIv2.set.asn b/lib/orber/src/OrberCSIv2.set.asn deleted file mode 100644 index 11fbcc167f..0000000000 --- a/lib/orber/src/OrberCSIv2.set.asn +++ /dev/null @@ -1,5 +0,0 @@ -OrberCSIv2.asn1 -PKIXAttributeCertificate.asn1 -PKIX1Explicit88.asn1 -PKIX1Algorithms88.asn1 -PKIX1Implicit88.asn1 diff --git a/lib/orber/src/OrberIFR.idl b/lib/orber/src/OrberIFR.idl deleted file mode 100644 index 6d53217658..0000000000 --- a/lib/orber/src/OrberIFR.idl +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _ORBER_IFR_IDL -#define _ORBER_IFR_IDL - -module OrberApp -{ - interface IFR { - string get_absolute_name(in string TypeID); - CORBA::TypeCode get_user_exception_type(in string TypeID); - }; -}; - -#endif diff --git a/lib/orber/src/PKIX1Algorithms88.asn1 b/lib/orber/src/PKIX1Algorithms88.asn1 deleted file mode 100644 index e78de69b0e..0000000000 --- a/lib/orber/src/PKIX1Algorithms88.asn1 +++ /dev/null @@ -1,274 +0,0 @@ - PKIX1Algorithms88 { iso(1) identified-organization(3) dod(6) - internet(1) security(5) mechanisms(5) pkix(7) id-mod(0) - id-mod-pkix1-algorithms(17) } - - DEFINITIONS EXPLICIT TAGS ::= BEGIN - - -- EXPORTS All; - - -- IMPORTS NONE; - - -- - -- One-way Hash Functions - -- - - md2 OBJECT IDENTIFIER ::= { - iso(1) member-body(2) us(840) rsadsi(113549) - digestAlgorithm(2) 2 } - - md5 OBJECT IDENTIFIER ::= { - iso(1) member-body(2) us(840) rsadsi(113549) - digestAlgorithm(2) 5 } - - id-sha1 OBJECT IDENTIFIER ::= { - iso(1) identified-organization(3) oiw(14) secsig(3) - algorithms(2) 26 } - - -- - -- DSA Keys and Signatures - -- - - -- OID for DSA public key - - id-dsa OBJECT IDENTIFIER ::= { - iso(1) member-body(2) us(840) x9-57(10040) x9algorithm(4) 1 } - - -- encoding for DSA public key - - DSAPublicKey ::= INTEGER -- public key, y - - Dss-Parms ::= SEQUENCE { - p INTEGER, - q INTEGER, - g INTEGER } - - -- OID for DSA signature generated with SHA-1 hash - - id-dsa-with-sha1 OBJECT IDENTIFIER ::= { - iso(1) member-body(2) us(840) x9-57 (10040) x9algorithm(4) 3 } - - -- encoding for DSA signature generated with SHA-1 hash - - Dss-Sig-Value ::= SEQUENCE { - r INTEGER, - s INTEGER } - - -- - -- RSA Keys and Signatures - -- - - -- arc for RSA public key and RSA signature OIDs - - pkcs-1 OBJECT IDENTIFIER ::= { - iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 1 } - - -- OID for RSA public keys - - rsaEncryption OBJECT IDENTIFIER ::= { pkcs-1 1 } - - -- OID for RSA signature generated with MD2 hash - - md2WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 2 } - - -- OID for RSA signature generated with MD5 hash - - md5WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 4 } - - -- OID for RSA signature generated with SHA-1 hash - - sha1WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 5 } - - -- encoding for RSA public key - - RSAPublicKey ::= SEQUENCE { - modulus INTEGER, -- n - publicExponent INTEGER } -- e - - -- - -- Diffie-Hellman Keys - -- - - dhpublicnumber OBJECT IDENTIFIER ::= { - iso(1) member-body(2) us(840) ansi-x942(10046) - number-type(2) 1 } - - -- encoding for DSA public key - - DHPublicKey ::= INTEGER -- public key, y = g^x mod p - - DomainParameters ::= SEQUENCE { - p INTEGER, -- odd prime, p=jq +1 - g INTEGER, -- generator, g - q INTEGER, -- factor of p-1 - j INTEGER OPTIONAL, -- subgroup factor, j>= 2 - validationParms ValidationParms OPTIONAL } - - ValidationParms ::= SEQUENCE { - seed BIT STRING, - pgenCounter INTEGER } - - -- - -- KEA Keys - -- - - id-keyExchangeAlgorithm OBJECT IDENTIFIER ::= - { 2 16 840 1 101 2 1 1 22 } - - KEA-Parms-Id ::= OCTET STRING - - -- - -- Elliptic Curve Keys, Signatures, and Curves - -- - - ansi-X9-62 OBJECT IDENTIFIER ::= { - iso(1) member-body(2) us(840) 10045 } - - FieldID ::= SEQUENCE { -- Finite field - fieldType OBJECT IDENTIFIER, - parameters ANY DEFINED BY fieldType } - - -- Arc for ECDSA signature OIDS - - id-ecSigType OBJECT IDENTIFIER ::= { ansi-X9-62 signatures(4) } - - -- OID for ECDSA signatures with SHA-1 - - ecdsa-with-SHA1 OBJECT IDENTIFIER ::= { id-ecSigType 1 } - - -- OID for an elliptic curve signature - -- format for the value of an ECDSA signature value - - ECDSA-Sig-Value ::= SEQUENCE { - r INTEGER, - s INTEGER } - - -- recognized field type OIDs are defined in the following arc - - id-fieldType OBJECT IDENTIFIER ::= { ansi-X9-62 fieldType(1) } - - -- where fieldType is prime-field, the parameters are of type Prime-p - - prime-field OBJECT IDENTIFIER ::= { id-fieldType 1 } - - Prime-p ::= INTEGER -- Finite field F(p), where p is an odd prime - - -- where fieldType is characteristic-two-field, the parameters are - -- of type Characteristic-two - - characteristic-two-field OBJECT IDENTIFIER ::= { id-fieldType 2 } - - Characteristic-two ::= SEQUENCE { - m INTEGER, -- Field size 2^m - basis OBJECT IDENTIFIER, - parameters ANY DEFINED BY basis } - - -- recognized basis type OIDs are defined in the following arc - - id-characteristic-two-basis OBJECT IDENTIFIER ::= { - characteristic-two-field basisType(3) } - - -- gnbasis is identified by OID gnBasis and indicates - -- parameters are NULL - - gnBasis OBJECT IDENTIFIER ::= { id-characteristic-two-basis 1 } - - -- parameters for this basis are NULL - - -- trinomial basis is identified by OID tpBasis and indicates - -- parameters of type Pentanomial - - tpBasis OBJECT IDENTIFIER ::= { id-characteristic-two-basis 2 } - - -- Trinomial basis representation of F2^m - -- Integer k for reduction polynomial xm + xk + 1 - - Trinomial ::= INTEGER - - -- for pentanomial basis is identified by OID ppBasis and indicates - -- parameters of type Pentanomial - - ppBasis OBJECT IDENTIFIER ::= { id-characteristic-two-basis 3 } - - -- Pentanomial basis representation of F2^m - -- reduction polynomial integers k1, k2, k3 - -- f(x) = x**m + x**k3 + x**k2 + x**k1 + 1 - - Pentanomial ::= SEQUENCE { - k1 INTEGER, - k2 INTEGER, - k3 INTEGER } - - -- The object identifiers gnBasis, tpBasis and ppBasis name - -- three kinds of basis for characteristic-two finite fields - - FieldElement ::= OCTET STRING -- Finite field element - - ECPoint ::= OCTET STRING -- Elliptic curve point - - -- Elliptic Curve parameters may be specified explicitly, - -- specified implicitly through a "named curve", or - -- inherited from the CA - - EcpkParameters ::= CHOICE { - ecParameters ECParameters, - namedCurve OBJECT IDENTIFIER, - implicitlyCA NULL } - - ECParameters ::= SEQUENCE { -- Elliptic curve parameters - version ECPVer, - fieldID FieldID, - curve Curve, - base ECPoint, -- Base point G - order INTEGER, -- Order n of the base point - cofactor INTEGER OPTIONAL } -- The integer h = #E(Fq)/n - - ECPVer ::= INTEGER {ecpVer1(1)} - - Curve ::= SEQUENCE { - a FieldElement, -- Elliptic curve coefficient a - b FieldElement, -- Elliptic curve coefficient b - seed BIT STRING OPTIONAL } - - id-publicKeyType OBJECT IDENTIFIER ::= { ansi-X9-62 keyType(2) } - - id-ecPublicKey OBJECT IDENTIFIER ::= { id-publicKeyType 1 } - - -- Named Elliptic Curves in ANSI X9.62. - - ellipticCurve OBJECT IDENTIFIER ::= { ansi-X9-62 curves(3) } - - c-TwoCurve OBJECT IDENTIFIER ::= { - ellipticCurve characteristicTwo(0) } - - c2pnb163v1 OBJECT IDENTIFIER ::= { c-TwoCurve 1 } - c2pnb163v2 OBJECT IDENTIFIER ::= { c-TwoCurve 2 } - c2pnb163v3 OBJECT IDENTIFIER ::= { c-TwoCurve 3 } - c2pnb176w1 OBJECT IDENTIFIER ::= { c-TwoCurve 4 } - c2tnb191v1 OBJECT IDENTIFIER ::= { c-TwoCurve 5 } - c2tnb191v2 OBJECT IDENTIFIER ::= { c-TwoCurve 6 } - c2tnb191v3 OBJECT IDENTIFIER ::= { c-TwoCurve 7 } - c2onb191v4 OBJECT IDENTIFIER ::= { c-TwoCurve 8 } - c2onb191v5 OBJECT IDENTIFIER ::= { c-TwoCurve 9 } - c2pnb208w1 OBJECT IDENTIFIER ::= { c-TwoCurve 10 } - c2tnb239v1 OBJECT IDENTIFIER ::= { c-TwoCurve 11 } - c2tnb239v2 OBJECT IDENTIFIER ::= { c-TwoCurve 12 } - c2tnb239v3 OBJECT IDENTIFIER ::= { c-TwoCurve 13 } - c2onb239v4 OBJECT IDENTIFIER ::= { c-TwoCurve 14 } - c2onb239v5 OBJECT IDENTIFIER ::= { c-TwoCurve 15 } - c2pnb272w1 OBJECT IDENTIFIER ::= { c-TwoCurve 16 } - c2pnb304w1 OBJECT IDENTIFIER ::= { c-TwoCurve 17 } - c2tnb359v1 OBJECT IDENTIFIER ::= { c-TwoCurve 18 } - c2pnb368w1 OBJECT IDENTIFIER ::= { c-TwoCurve 19 } - c2tnb431r1 OBJECT IDENTIFIER ::= { c-TwoCurve 20 } - - primeCurve OBJECT IDENTIFIER ::= { ellipticCurve prime(1) } - - prime192v1 OBJECT IDENTIFIER ::= { primeCurve 1 } - prime192v2 OBJECT IDENTIFIER ::= { primeCurve 2 } - prime192v3 OBJECT IDENTIFIER ::= { primeCurve 3 } - prime239v1 OBJECT IDENTIFIER ::= { primeCurve 4 } - prime239v2 OBJECT IDENTIFIER ::= { primeCurve 5 } - prime239v3 OBJECT IDENTIFIER ::= { primeCurve 6 } - prime256v1 OBJECT IDENTIFIER ::= { primeCurve 7 } - - END diff --git a/lib/orber/src/PKIX1Explicit88.asn1 b/lib/orber/src/PKIX1Explicit88.asn1 deleted file mode 100644 index 9b8068fed0..0000000000 --- a/lib/orber/src/PKIX1Explicit88.asn1 +++ /dev/null @@ -1,619 +0,0 @@ -PKIX1Explicit88 { iso(1) identified-organization(3) dod(6) internet(1) - security(5) mechanisms(5) pkix(7) id-mod(0) id-pkix1-explicit(18) } - -DEFINITIONS EXPLICIT TAGS ::= - -BEGIN - --- EXPORTS ALL -- - --- IMPORTS NONE -- - --- UNIVERSAL Types defined in 1993 and 1998 ASN.1 --- and required by this specification - --- UniversalString ::= [UNIVERSAL 28] IMPLICIT OCTET STRING - -- UniversalString is defined in ASN.1:1993 - --- BMPString ::= [UNIVERSAL 30] IMPLICIT OCTET STRING - -- BMPString is the subtype of UniversalString and models - -- the Basic Multilingual Plane of ISO/IEC/ITU 10646-1 - --- UTF8String ::= [UNIVERSAL 12] IMPLICIT OCTET STRING - -- The content of this type conforms to RFC 2279. - --- PKIX specific OIDs - -id-pkix OBJECT IDENTIFIER ::= - { iso(1) identified-organization(3) dod(6) internet(1) - security(5) mechanisms(5) pkix(7) } - --- PKIX arcs - -id-pe OBJECT IDENTIFIER ::= { id-pkix 1 } - -- arc for private certificate extensions -id-qt OBJECT IDENTIFIER ::= { id-pkix 2 } - -- arc for policy qualifier types -id-kp OBJECT IDENTIFIER ::= { id-pkix 3 } - -- arc for extended key purpose OIDS -id-ad OBJECT IDENTIFIER ::= { id-pkix 48 } - -- arc for access descriptors - --- policyQualifierIds for Internet policy qualifiers - -id-qt-cps OBJECT IDENTIFIER ::= { id-qt 1 } - -- OID for CPS qualifier -id-qt-unotice OBJECT IDENTIFIER ::= { id-qt 2 } - -- OID for user notice qualifier - --- access descriptor definitions - -id-ad-ocsp OBJECT IDENTIFIER ::= { id-ad 1 } -id-ad-caIssuers OBJECT IDENTIFIER ::= { id-ad 2 } -id-ad-timeStamping OBJECT IDENTIFIER ::= { id-ad 3 } -id-ad-caRepository OBJECT IDENTIFIER ::= { id-ad 5 } - --- attribute data types - -Attribute ::= SEQUENCE { - type AttributeType, - values SET OF AttributeValue } - -- at least one value is required - -AttributeType ::= OBJECT IDENTIFIER - -AttributeValue ::= ANY - -AttributeTypeAndValue ::= SEQUENCE { - type AttributeType, - value AttributeValue } - --- suggested naming attributes: Definition of the following --- information object set may be augmented to meet local --- requirements. Note that deleting members of the set may --- prevent interoperability with conforming implementations. --- presented in pairs: the AttributeType followed by the --- type definition for the corresponding AttributeValue ---Arc for standard naming attributes -id-at OBJECT IDENTIFIER ::= { joint-iso-ccitt(2) ds(5) 4 } - --- Naming attributes of type X520name - -id-at-name AttributeType ::= { id-at 41 } -id-at-surname AttributeType ::= { id-at 4 } -id-at-givenName AttributeType ::= { id-at 42 } -id-at-initials AttributeType ::= { id-at 43 } -id-at-generationQualifier AttributeType ::= { id-at 44 } - -X520name ::= CHOICE { - teletexString TeletexString (SIZE (1..ub-name)), - printableString PrintableString (SIZE (1..ub-name)), - universalString UniversalString (SIZE (1..ub-name)), - utf8String UTF8String (SIZE (1..ub-name)), - bmpString BMPString (SIZE (1..ub-name)) } - --- Naming attributes of type X520CommonName - -id-at-commonName AttributeType ::= { id-at 3 } - -X520CommonName ::= CHOICE { - teletexString TeletexString (SIZE (1..ub-common-name)), - printableString PrintableString (SIZE (1..ub-common-name)), - universalString UniversalString (SIZE (1..ub-common-name)), - utf8String UTF8String (SIZE (1..ub-common-name)), - bmpString BMPString (SIZE (1..ub-common-name)) } - --- Naming attributes of type X520LocalityName - -id-at-localityName AttributeType ::= { id-at 7 } - -X520LocalityName ::= CHOICE { - teletexString TeletexString (SIZE (1..ub-locality-name)), - printableString PrintableString (SIZE (1..ub-locality-name)), - universalString UniversalString (SIZE (1..ub-locality-name)), - utf8String UTF8String (SIZE (1..ub-locality-name)), - bmpString BMPString (SIZE (1..ub-locality-name)) } - --- Naming attributes of type X520StateOrProvinceName - -id-at-stateOrProvinceName AttributeType ::= { id-at 8 } - -X520StateOrProvinceName ::= CHOICE { - teletexString TeletexString (SIZE (1..ub-state-name)), - printableString PrintableString (SIZE (1..ub-state-name)), - universalString UniversalString (SIZE (1..ub-state-name)), - utf8String UTF8String (SIZE (1..ub-state-name)), - bmpString BMPString (SIZE(1..ub-state-name)) } - --- Naming attributes of type X520OrganizationName - -id-at-organizationName AttributeType ::= { id-at 10 } - -X520OrganizationName ::= CHOICE { - teletexString TeletexString - (SIZE (1..ub-organization-name)), - printableString PrintableString - (SIZE (1..ub-organization-name)), - universalString UniversalString - (SIZE (1..ub-organization-name)), - utf8String UTF8String - (SIZE (1..ub-organization-name)), - bmpString BMPString - (SIZE (1..ub-organization-name)) } - --- Naming attributes of type X520OrganizationalUnitName - -id-at-organizationalUnitName AttributeType ::= { id-at 11 } - -X520OrganizationalUnitName ::= CHOICE { - teletexString TeletexString - (SIZE (1..ub-organizational-unit-name)), - printableString PrintableString - (SIZE (1..ub-organizational-unit-name)), - universalString UniversalString - (SIZE (1..ub-organizational-unit-name)), - utf8String UTF8String - (SIZE (1..ub-organizational-unit-name)), - bmpString BMPString - (SIZE (1..ub-organizational-unit-name)) } - --- Naming attributes of type X520Title - -id-at-title AttributeType ::= { id-at 12 } - -X520Title ::= CHOICE { - teletexString TeletexString (SIZE (1..ub-title)), - printableString PrintableString (SIZE (1..ub-title)), - universalString UniversalString (SIZE (1..ub-title)), - utf8String UTF8String (SIZE (1..ub-title)), - bmpString BMPString (SIZE (1..ub-title)) } - --- Naming attributes of type X520dnQualifier - -id-at-dnQualifier AttributeType ::= { id-at 46 } - -X520dnQualifier ::= PrintableString - --- Naming attributes of type X520countryName (digraph from IS 3166) - -id-at-countryName AttributeType ::= { id-at 6 } - -X520countryName ::= PrintableString (SIZE (2)) - --- Naming attributes of type X520SerialNumber - -id-at-serialNumber AttributeType ::= { id-at 5 } - -X520SerialNumber ::= PrintableString (SIZE (1..ub-serial-number)) - --- Naming attributes of type X520Pseudonym - -id-at-pseudonym AttributeType ::= { id-at 65 } - -X520Pseudonym ::= CHOICE { - teletexString TeletexString (SIZE (1..ub-pseudonym)), - printableString PrintableString (SIZE (1..ub-pseudonym)), - universalString UniversalString (SIZE (1..ub-pseudonym)), - utf8String UTF8String (SIZE (1..ub-pseudonym)), - bmpString BMPString (SIZE (1..ub-pseudonym)) } - --- Naming attributes of type DomainComponent (from RFC 2247) - -id-domainComponent AttributeType ::= - { 0 9 2342 19200300 100 1 25 } - -DomainComponent ::= IA5String - --- Legacy attributes - -pkcs-9 OBJECT IDENTIFIER ::= - { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 9 } - -id-emailAddress AttributeType ::= { pkcs-9 1 } - -EmailAddress ::= IA5String (SIZE (1..ub-emailaddress-length)) - --- naming data types -- - -Name ::= CHOICE { -- only one possibility for now -- - rdnSequence RDNSequence } - -RDNSequence ::= SEQUENCE OF RelativeDistinguishedName - -DistinguishedName ::= RDNSequence - -RelativeDistinguishedName ::= - SET SIZE (1 .. MAX) OF AttributeTypeAndValue - --- Directory string type -- - -DirectoryString ::= CHOICE { - teletexString TeletexString (SIZE (1..MAX)), - printableString PrintableString (SIZE (1..MAX)), - universalString UniversalString (SIZE (1..MAX)), - utf8String UTF8String (SIZE (1..MAX)), - bmpString BMPString (SIZE (1..MAX)) } - --- certificate and CRL specific structures begin here - -Certificate ::= SEQUENCE { - tbsCertificate TBSCertificate, - signatureAlgorithm AlgorithmIdentifier, - signature BIT STRING } - -TBSCertificate ::= SEQUENCE { - version [0] Version DEFAULT v1, - serialNumber CertificateSerialNumber, - signature AlgorithmIdentifier, - issuer Name, - validity Validity, - subject Name, - subjectPublicKeyInfo SubjectPublicKeyInfo, - issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL, - -- If present, version MUST be v2 or v3 - subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL, - -- If present, version MUST be v2 or v3 - extensions [3] Extensions OPTIONAL - -- If present, version MUST be v3 -- } - -Version ::= INTEGER { v1(0), v2(1), v3(2) } - -CertificateSerialNumber ::= INTEGER - -Validity ::= SEQUENCE { - notBefore Time, - notAfter Time } - -Time ::= CHOICE { - utcTime UTCTime, - generalTime GeneralizedTime } - -UniqueIdentifier ::= BIT STRING - -SubjectPublicKeyInfo ::= SEQUENCE { - algorithm AlgorithmIdentifier, - subjectPublicKey BIT STRING } - -Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension - -Extension ::= SEQUENCE { - extnID OBJECT IDENTIFIER, - critical BOOLEAN DEFAULT FALSE, - extnValue OCTET STRING } - --- CRL structures - -CertificateList ::= SEQUENCE { - tbsCertList TBSCertList, - signatureAlgorithm AlgorithmIdentifier, - signature BIT STRING } - -TBSCertList ::= SEQUENCE { - version Version OPTIONAL, - -- if present, MUST be v2 - signature AlgorithmIdentifier, - issuer Name, - thisUpdate Time, - nextUpdate Time OPTIONAL, - revokedCertificates SEQUENCE OF SEQUENCE { - userCertificate CertificateSerialNumber, - revocationDate Time, - crlEntryExtensions Extensions OPTIONAL - -- if present, MUST be v2 - } OPTIONAL, - crlExtensions [0] Extensions OPTIONAL } - -- if present, MUST be v2 - --- Version, Time, CertificateSerialNumber, and Extensions were --- defined earlier for use in the certificate structure - -AlgorithmIdentifier ::= SEQUENCE { - algorithm OBJECT IDENTIFIER, - parameters ANY DEFINED BY algorithm OPTIONAL } - -- contains a value of the type - -- registered for use with the - -- algorithm object identifier value - --- X.400 address syntax starts here - -ORAddress ::= SEQUENCE { - built-in-standard-attributes BuiltInStandardAttributes, - built-in-domain-defined-attributes - BuiltInDomainDefinedAttributes OPTIONAL, - -- see also teletex-domain-defined-attributes - extension-attributes ExtensionAttributes OPTIONAL } - --- Built-in Standard Attributes - -BuiltInStandardAttributes ::= SEQUENCE { - country-name CountryName OPTIONAL, - administration-domain-name AdministrationDomainName OPTIONAL, - network-address [0] IMPLICIT NetworkAddress OPTIONAL, - -- see also extended-network-address - terminal-identifier [1] IMPLICIT TerminalIdentifier OPTIONAL, - private-domain-name [2] PrivateDomainName OPTIONAL, - organization-name [3] IMPLICIT OrganizationName OPTIONAL, - -- see also teletex-organization-name - numeric-user-identifier [4] IMPLICIT NumericUserIdentifier - OPTIONAL, - personal-name [5] IMPLICIT PersonalName OPTIONAL, - -- see also teletex-personal-name - organizational-unit-names [6] IMPLICIT OrganizationalUnitNames - OPTIONAL } - -- see also teletex-organizational-unit-names - -CountryName ::= [APPLICATION 1] CHOICE { - x121-dcc-code NumericString - (SIZE (ub-country-name-numeric-length)), - iso-3166-alpha2-code PrintableString - (SIZE (ub-country-name-alpha-length)) } - -AdministrationDomainName ::= [APPLICATION 2] CHOICE { - numeric NumericString (SIZE (0..ub-domain-name-length)), - printable PrintableString (SIZE (0..ub-domain-name-length)) } - -NetworkAddress ::= X121Address -- see also extended-network-address - -X121Address ::= NumericString (SIZE (1..ub-x121-address-length)) - -TerminalIdentifier ::= PrintableString (SIZE -(1..ub-terminal-id-length)) - -PrivateDomainName ::= CHOICE { - numeric NumericString (SIZE (1..ub-domain-name-length)), - printable PrintableString (SIZE (1..ub-domain-name-length)) } - -OrganizationName ::= PrintableString - (SIZE (1..ub-organization-name-length)) - -- see also teletex-organization-name - -NumericUserIdentifier ::= NumericString - (SIZE (1..ub-numeric-user-id-length)) - -PersonalName ::= SET { - surname [0] IMPLICIT PrintableString - (SIZE (1..ub-surname-length)), - given-name [1] IMPLICIT PrintableString - (SIZE (1..ub-given-name-length)) OPTIONAL, - initials [2] IMPLICIT PrintableString - (SIZE (1..ub-initials-length)) OPTIONAL, - generation-qualifier [3] IMPLICIT PrintableString - (SIZE (1..ub-generation-qualifier-length)) - OPTIONAL } - -- see also teletex-personal-name - -OrganizationalUnitNames ::= SEQUENCE SIZE (1..ub-organizational-units) - OF OrganizationalUnitName - -- see also teletex-organizational-unit-names - -OrganizationalUnitName ::= PrintableString (SIZE - (1..ub-organizational-unit-name-length)) - --- Built-in Domain-defined Attributes - -BuiltInDomainDefinedAttributes ::= SEQUENCE SIZE - (1..ub-domain-defined-attributes) OF - BuiltInDomainDefinedAttribute - -BuiltInDomainDefinedAttribute ::= SEQUENCE { - type PrintableString (SIZE - (1..ub-domain-defined-attribute-type-length)), - value PrintableString (SIZE - (1..ub-domain-defined-attribute-value-length)) } - --- Extension Attributes - -ExtensionAttributes ::= SET SIZE (1..ub-extension-attributes) OF - ExtensionAttribute - -ExtensionAttribute ::= SEQUENCE { - extension-attribute-type [0] IMPLICIT INTEGER - (0..ub-extension-attributes), - extension-attribute-value [1] - ANY DEFINED BY extension-attribute-type } - --- Extension types and attribute values - -common-name INTEGER ::= 1 - -CommonName ::= PrintableString (SIZE (1..ub-common-name-length)) - -teletex-common-name INTEGER ::= 2 - -TeletexCommonName ::= TeletexString (SIZE (1..ub-common-name-length)) - -teletex-organization-name INTEGER ::= 3 - -TeletexOrganizationName ::= - TeletexString (SIZE (1..ub-organization-name-length)) - -teletex-personal-name INTEGER ::= 4 - -TeletexPersonalName ::= SET { - surname [0] IMPLICIT TeletexString - (SIZE (1..ub-surname-length)), - given-name [1] IMPLICIT TeletexString - (SIZE (1..ub-given-name-length)) OPTIONAL, - initials [2] IMPLICIT TeletexString - (SIZE (1..ub-initials-length)) OPTIONAL, - generation-qualifier [3] IMPLICIT TeletexString - (SIZE (1..ub-generation-qualifier-length)) - OPTIONAL } - -teletex-organizational-unit-names INTEGER ::= 5 - -TeletexOrganizationalUnitNames ::= SEQUENCE SIZE - (1..ub-organizational-units) OF TeletexOrganizationalUnitName - -TeletexOrganizationalUnitName ::= TeletexString - (SIZE (1..ub-organizational-unit-name-length)) - -pds-name INTEGER ::= 7 - -PDSName ::= PrintableString (SIZE (1..ub-pds-name-length)) - -physical-delivery-country-name INTEGER ::= 8 - -PhysicalDeliveryCountryName ::= CHOICE { - x121-dcc-code NumericString (SIZE -(ub-country-name-numeric-length)), - iso-3166-alpha2-code PrintableString - (SIZE (ub-country-name-alpha-length)) } - -postal-code INTEGER ::= 9 - -PostalCode ::= CHOICE { - numeric-code NumericString (SIZE (1..ub-postal-code-length)), - printable-code PrintableString (SIZE (1..ub-postal-code-length)) } - -physical-delivery-office-name INTEGER ::= 10 - -PhysicalDeliveryOfficeName ::= PDSParameter - -physical-delivery-office-number INTEGER ::= 11 - -PhysicalDeliveryOfficeNumber ::= PDSParameter - -extension-OR-address-components INTEGER ::= 12 - -ExtensionORAddressComponents ::= PDSParameter - -physical-delivery-personal-name INTEGER ::= 13 - -PhysicalDeliveryPersonalName ::= PDSParameter - -physical-delivery-organization-name INTEGER ::= 14 - -PhysicalDeliveryOrganizationName ::= PDSParameter - -extension-physical-delivery-address-components INTEGER ::= 15 - -ExtensionPhysicalDeliveryAddressComponents ::= PDSParameter - -unformatted-postal-address INTEGER ::= 16 - -UnformattedPostalAddress ::= SET { - printable-address SEQUENCE SIZE (1..ub-pds-physical-address-lines) - OF PrintableString (SIZE (1..ub-pds-parameter-length)) - OPTIONAL, - teletex-string TeletexString - (SIZE (1..ub-unformatted-address-length)) OPTIONAL } - -street-address INTEGER ::= 17 - -StreetAddress ::= PDSParameter - -post-office-box-address INTEGER ::= 18 - -PostOfficeBoxAddress ::= PDSParameter - -poste-restante-address INTEGER ::= 19 - -PosteRestanteAddress ::= PDSParameter - -unique-postal-name INTEGER ::= 20 - -UniquePostalName ::= PDSParameter - -local-postal-attributes INTEGER ::= 21 - -LocalPostalAttributes ::= PDSParameter - -PDSParameter ::= SET { - printable-string PrintableString - (SIZE(1..ub-pds-parameter-length)) OPTIONAL, - teletex-string TeletexString - (SIZE(1..ub-pds-parameter-length)) OPTIONAL } - -extended-network-address INTEGER ::= 22 - -ExtendedNetworkAddress ::= CHOICE { - e163-4-address SEQUENCE { - number [0] IMPLICIT NumericString - (SIZE (1..ub-e163-4-number-length)), - sub-address [1] IMPLICIT NumericString - (SIZE (1..ub-e163-4-sub-address-length)) - OPTIONAL }, - psap-address [0] IMPLICIT PresentationAddress } - -PresentationAddress ::= SEQUENCE { - pSelector [0] EXPLICIT OCTET STRING OPTIONAL, - sSelector [1] EXPLICIT OCTET STRING OPTIONAL, - tSelector [2] EXPLICIT OCTET STRING OPTIONAL, - nAddresses [3] EXPLICIT SET SIZE (1..MAX) OF OCTET STRING } - -terminal-type INTEGER ::= 23 - -TerminalType ::= INTEGER { - telex (3), - teletex (4), - g3-facsimile (5), - g4-facsimile (6), - ia5-terminal (7), - videotex (8) } (0..ub-integer-options) - --- Extension Domain-defined Attributes - -teletex-domain-defined-attributes INTEGER ::= 6 - -TeletexDomainDefinedAttributes ::= SEQUENCE SIZE - (1..ub-domain-defined-attributes) OF TeletexDomainDefinedAttribute - -TeletexDomainDefinedAttribute ::= SEQUENCE { - type TeletexString - (SIZE (1..ub-domain-defined-attribute-type-length)), - value TeletexString - (SIZE (1..ub-domain-defined-attribute-value-length)) } - --- specifications of Upper Bounds MUST be regarded as mandatory --- from Annex B of ITU-T X.411 Reference Definition of MTS Parameter --- Upper Bounds - --- Upper Bounds -ub-name INTEGER ::= 32768 -ub-common-name INTEGER ::= 64 -ub-locality-name INTEGER ::= 128 -ub-state-name INTEGER ::= 128 -ub-organization-name INTEGER ::= 64 -ub-organizational-unit-name INTEGER ::= 64 -ub-title INTEGER ::= 64 -ub-serial-number INTEGER ::= 64 -ub-match INTEGER ::= 128 -ub-emailaddress-length INTEGER ::= 128 -ub-common-name-length INTEGER ::= 64 -ub-country-name-alpha-length INTEGER ::= 2 -ub-country-name-numeric-length INTEGER ::= 3 -ub-domain-defined-attributes INTEGER ::= 4 -ub-domain-defined-attribute-type-length INTEGER ::= 8 -ub-domain-defined-attribute-value-length INTEGER ::= 128 -ub-domain-name-length INTEGER ::= 16 -ub-extension-attributes INTEGER ::= 256 -ub-e163-4-number-length INTEGER ::= 15 -ub-e163-4-sub-address-length INTEGER ::= 40 -ub-generation-qualifier-length INTEGER ::= 3 -ub-given-name-length INTEGER ::= 16 -ub-initials-length INTEGER ::= 5 -ub-integer-options INTEGER ::= 256 -ub-numeric-user-id-length INTEGER ::= 32 -ub-organization-name-length INTEGER ::= 64 -ub-organizational-unit-name-length INTEGER ::= 32 -ub-organizational-units INTEGER ::= 4 -ub-pds-name-length INTEGER ::= 16 -ub-pds-parameter-length INTEGER ::= 30 -ub-pds-physical-address-lines INTEGER ::= 6 -ub-postal-code-length INTEGER ::= 16 -ub-pseudonym INTEGER ::= 128 -ub-surname-length INTEGER ::= 40 -ub-terminal-id-length INTEGER ::= 24 -ub-unformatted-address-length INTEGER ::= 180 -ub-x121-address-length INTEGER ::= 16 - --- Note - upper bounds on string types, such as TeletexString, are --- measured in characters. Excepting PrintableString or IA5String, a --- significantly greater number of octets will be required to hold --- such a value. As a minimum, 16 octets, or twice the specified --- upper bound, whichever is the larger, should be allowed for --- TeletexString. For UTF8String or UniversalString at least four --- times the upper bound should be allowed. - -END diff --git a/lib/orber/src/PKIX1Implicit88.asn1 b/lib/orber/src/PKIX1Implicit88.asn1 deleted file mode 100644 index ced270baf6..0000000000 --- a/lib/orber/src/PKIX1Implicit88.asn1 +++ /dev/null @@ -1,349 +0,0 @@ -PKIX1Implicit88 { iso(1) identified-organization(3) dod(6) internet(1) - security(5) mechanisms(5) pkix(7) id-mod(0) id-pkix1-implicit(19) } - -DEFINITIONS IMPLICIT TAGS ::= - -BEGIN - --- EXPORTS ALL -- - -IMPORTS - id-pe, id-kp, id-qt-unotice, id-qt-cps, - -- delete following line if "new" types are supported -- - -- BMPString, - -- UTF8String, end "new" types -- - ORAddress, Name, RelativeDistinguishedName, - CertificateSerialNumber, Attribute, DirectoryString - FROM PKIX1Explicit88 { iso(1) identified-organization(3) - dod(6) internet(1) security(5) mechanisms(5) pkix(7) - id-mod(0) id-pkix1-explicit(18) }; - - --- ISO arc for standard certificate and CRL extensions - -id-ce OBJECT IDENTIFIER ::= {joint-iso-ccitt(2) ds(5) 29} - --- authority key identifier OID and syntax - -id-ce-authorityKeyIdentifier OBJECT IDENTIFIER ::= { id-ce 35 } - -AuthorityKeyIdentifier ::= SEQUENCE { - keyIdentifier [0] KeyIdentifier OPTIONAL, - authorityCertIssuer [1] GeneralNames OPTIONAL, - authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL } - -- authorityCertIssuer and authorityCertSerialNumber MUST both - -- be present or both be absent - -KeyIdentifier ::= OCTET STRING - --- subject key identifier OID and syntax - -id-ce-subjectKeyIdentifier OBJECT IDENTIFIER ::= { id-ce 14 } - -SubjectKeyIdentifier ::= KeyIdentifier - --- key usage extension OID and syntax - -id-ce-keyUsage OBJECT IDENTIFIER ::= { id-ce 15 } - -KeyUsage ::= BIT STRING { - digitalSignature (0), - nonRepudiation (1), - keyEncipherment (2), - dataEncipherment (3), - keyAgreement (4), - keyCertSign (5), - cRLSign (6), - encipherOnly (7), - decipherOnly (8) } - --- private key usage period extension OID and syntax - -id-ce-privateKeyUsagePeriod OBJECT IDENTIFIER ::= { id-ce 16 } - -PrivateKeyUsagePeriod ::= SEQUENCE { - notBefore [0] GeneralizedTime OPTIONAL, - notAfter [1] GeneralizedTime OPTIONAL } - -- either notBefore or notAfter MUST be present - --- certificate policies extension OID and syntax - -id-ce-certificatePolicies OBJECT IDENTIFIER ::= { id-ce 32 } - -anyPolicy OBJECT IDENTIFIER ::= { id-ce-certificatePolicies 0 } - -CertificatePolicies ::= SEQUENCE SIZE (1..MAX) OF PolicyInformation - -PolicyInformation ::= SEQUENCE { - policyIdentifier CertPolicyId, - policyQualifiers SEQUENCE SIZE (1..MAX) OF - PolicyQualifierInfo OPTIONAL } - -CertPolicyId ::= OBJECT IDENTIFIER - -PolicyQualifierInfo ::= SEQUENCE { - policyQualifierId PolicyQualifierId, - qualifier ANY DEFINED BY policyQualifierId } - --- Implementations that recognize additional policy qualifiers MUST --- augment the following definition for PolicyQualifierId - -PolicyQualifierId ::= - OBJECT IDENTIFIER ( id-qt-cps | id-qt-unotice ) - --- CPS pointer qualifier - -CPSuri ::= IA5String - --- user notice qualifier - -UserNotice ::= SEQUENCE { - noticeRef NoticeReference OPTIONAL, - explicitText DisplayText OPTIONAL} - -NoticeReference ::= SEQUENCE { - organization DisplayText, - noticeNumbers SEQUENCE OF INTEGER } - -DisplayText ::= CHOICE { - ia5String IA5String (SIZE (1..200)), - visibleString VisibleString (SIZE (1..200)), - bmpString BMPString (SIZE (1..200)), - utf8String UTF8String (SIZE (1..200)) } - --- policy mapping extension OID and syntax - -id-ce-policyMappings OBJECT IDENTIFIER ::= { id-ce 33 } - -PolicyMappings ::= SEQUENCE SIZE (1..MAX) OF SEQUENCE { - issuerDomainPolicy CertPolicyId, - subjectDomainPolicy CertPolicyId } - --- subject alternative name extension OID and syntax - -id-ce-subjectAltName OBJECT IDENTIFIER ::= { id-ce 17 } - -SubjectAltName ::= GeneralNames - -GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName - -GeneralName ::= CHOICE { - otherName [0] AnotherName, - rfc822Name [1] IA5String, - dNSName [2] IA5String, - x400Address [3] ORAddress, - directoryName [4] Name, - ediPartyName [5] EDIPartyName, - uniformResourceIdentifier [6] IA5String, - iPAddress [7] OCTET STRING, - registeredID [8] OBJECT IDENTIFIER } - --- AnotherName replaces OTHER-NAME ::= TYPE-IDENTIFIER, as --- TYPE-IDENTIFIER is not supported in the '88 ASN.1 syntax - -AnotherName ::= SEQUENCE { - type-id OBJECT IDENTIFIER, - value [0] EXPLICIT ANY DEFINED BY type-id } - -EDIPartyName ::= SEQUENCE { - nameAssigner [0] DirectoryString OPTIONAL, - partyName [1] DirectoryString } - --- issuer alternative name extension OID and syntax - -id-ce-issuerAltName OBJECT IDENTIFIER ::= { id-ce 18 } - -IssuerAltName ::= GeneralNames - -id-ce-subjectDirectoryAttributes OBJECT IDENTIFIER ::= { id-ce 9 } - -SubjectDirectoryAttributes ::= SEQUENCE SIZE (1..MAX) OF Attribute - --- basic constraints extension OID and syntax - -id-ce-basicConstraints OBJECT IDENTIFIER ::= { id-ce 19 } - -BasicConstraints ::= SEQUENCE { - cA BOOLEAN DEFAULT FALSE, - pathLenConstraint INTEGER (0..MAX) OPTIONAL } - --- name constraints extension OID and syntax - -id-ce-nameConstraints OBJECT IDENTIFIER ::= { id-ce 30 } - -NameConstraints ::= SEQUENCE { - permittedSubtrees [0] GeneralSubtrees OPTIONAL, - excludedSubtrees [1] GeneralSubtrees OPTIONAL } - -GeneralSubtrees ::= SEQUENCE SIZE (1..MAX) OF GeneralSubtree - -GeneralSubtree ::= SEQUENCE { - base GeneralName, - minimum [0] BaseDistance DEFAULT 0, - maximum [1] BaseDistance OPTIONAL } - -BaseDistance ::= INTEGER (0..MAX) - --- policy constraints extension OID and syntax - -id-ce-policyConstraints OBJECT IDENTIFIER ::= { id-ce 36 } - -PolicyConstraints ::= SEQUENCE { - requireExplicitPolicy [0] SkipCerts OPTIONAL, - inhibitPolicyMapping [1] SkipCerts OPTIONAL } - -SkipCerts ::= INTEGER (0..MAX) - --- CRL distribution points extension OID and syntax - -id-ce-cRLDistributionPoints OBJECT IDENTIFIER ::= {id-ce 31} - -CRLDistributionPoints ::= SEQUENCE SIZE (1..MAX) OF DistributionPoint - -DistributionPoint ::= SEQUENCE { - distributionPoint [0] DistributionPointName OPTIONAL, - reasons [1] ReasonFlags OPTIONAL, - cRLIssuer [2] GeneralNames OPTIONAL } - -DistributionPointName ::= CHOICE { - fullName [0] GeneralNames, - nameRelativeToCRLIssuer [1] RelativeDistinguishedName } - -ReasonFlags ::= BIT STRING { - unused (0), - keyCompromise (1), - cACompromise (2), - affiliationChanged (3), - superseded (4), - cessationOfOperation (5), - certificateHold (6), - privilegeWithdrawn (7), - aACompromise (8) } - --- extended key usage extension OID and syntax - -id-ce-extKeyUsage OBJECT IDENTIFIER ::= {id-ce 37} - -ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId - - -KeyPurposeId ::= OBJECT IDENTIFIER - --- permit unspecified key uses - -anyExtendedKeyUsage OBJECT IDENTIFIER ::= { id-ce-extKeyUsage 0 } - --- extended key purpose OIDs - -id-kp-serverAuth OBJECT IDENTIFIER ::= { id-kp 1 } -id-kp-clientAuth OBJECT IDENTIFIER ::= { id-kp 2 } -id-kp-codeSigning OBJECT IDENTIFIER ::= { id-kp 3 } -id-kp-emailProtection OBJECT IDENTIFIER ::= { id-kp 4 } -id-kp-timeStamping OBJECT IDENTIFIER ::= { id-kp 8 } -id-kp-OCSPSigning OBJECT IDENTIFIER ::= { id-kp 9 } - --- inhibit any policy OID and syntax - -id-ce-inhibitAnyPolicy OBJECT IDENTIFIER ::= { id-ce 54 } - -InhibitAnyPolicy ::= SkipCerts - --- freshest (delta)CRL extension OID and syntax - -id-ce-freshestCRL OBJECT IDENTIFIER ::= { id-ce 46 } - -FreshestCRL ::= CRLDistributionPoints - --- authority info access - -id-pe-authorityInfoAccess OBJECT IDENTIFIER ::= { id-pe 1 } - -AuthorityInfoAccessSyntax ::= - SEQUENCE SIZE (1..MAX) OF AccessDescription - -AccessDescription ::= SEQUENCE { - accessMethod OBJECT IDENTIFIER, - accessLocation GeneralName } - --- subject info access - -id-pe-subjectInfoAccess OBJECT IDENTIFIER ::= { id-pe 11 } - -SubjectInfoAccessSyntax ::= - SEQUENCE SIZE (1..MAX) OF AccessDescription - --- CRL number extension OID and syntax - -id-ce-cRLNumber OBJECT IDENTIFIER ::= { id-ce 20 } - -CRLNumber ::= INTEGER (0..MAX) - --- issuing distribution point extension OID and syntax - -id-ce-issuingDistributionPoint OBJECT IDENTIFIER ::= { id-ce 28 } - -IssuingDistributionPoint ::= SEQUENCE { - distributionPoint [0] DistributionPointName OPTIONAL, - onlyContainsUserCerts [1] BOOLEAN DEFAULT FALSE, - onlyContainsCACerts [2] BOOLEAN DEFAULT FALSE, - onlySomeReasons [3] ReasonFlags OPTIONAL, - indirectCRL [4] BOOLEAN DEFAULT FALSE, - onlyContainsAttributeCerts [5] BOOLEAN DEFAULT FALSE } - -id-ce-deltaCRLIndicator OBJECT IDENTIFIER ::= { id-ce 27 } - -BaseCRLNumber ::= CRLNumber - --- CRL reasons extension OID and syntax - -id-ce-cRLReasons OBJECT IDENTIFIER ::= { id-ce 21 } - -CRLReason ::= ENUMERATED { - unspecified (0), - keyCompromise (1), - cACompromise (2), - affiliationChanged (3), - superseded (4), - cessationOfOperation (5), - certificateHold (6), - removeFromCRL (8), - privilegeWithdrawn (9), - aACompromise (10) } - --- certificate issuer CRL entry extension OID and syntax - -id-ce-certificateIssuer OBJECT IDENTIFIER ::= { id-ce 29 } - -CertificateIssuer ::= GeneralNames - --- hold instruction extension OID and syntax - -id-ce-holdInstructionCode OBJECT IDENTIFIER ::= { id-ce 23 } - -HoldInstructionCode ::= OBJECT IDENTIFIER - --- ANSI x9 holdinstructions - --- ANSI x9 arc holdinstruction arc - -holdInstruction OBJECT IDENTIFIER ::= - {joint-iso-itu-t(2) member-body(2) us(840) x9cm(10040) 2} - --- ANSI X9 holdinstructions referenced by this standard - -id-holdinstruction-none OBJECT IDENTIFIER ::= - {holdInstruction 1} -- deprecated - -id-holdinstruction-callissuer OBJECT IDENTIFIER ::= - {holdInstruction 2} - -id-holdinstruction-reject OBJECT IDENTIFIER ::= - {holdInstruction 3} - --- invalidity date CRL entry extension OID and syntax - -id-ce-invalidityDate OBJECT IDENTIFIER ::= { id-ce 24 } - -InvalidityDate ::= GeneralizedTime - -END diff --git a/lib/orber/src/PKIXAttributeCertificate.asn1 b/lib/orber/src/PKIXAttributeCertificate.asn1 deleted file mode 100644 index 7d93e6b37e..0000000000 --- a/lib/orber/src/PKIXAttributeCertificate.asn1 +++ /dev/null @@ -1,189 +0,0 @@ - PKIXAttributeCertificate {iso(1) identified-organization(3) dod(6) - internet(1) security(5) mechanisms(5) pkix(7) id-mod(0) - id-mod-attribute-cert(12)} - - DEFINITIONS IMPLICIT TAGS ::= - - BEGIN - - -- EXPORTS ALL -- - - IMPORTS - - -- IMPORTed module OIDs MAY change if [PKIXPROF] changes - -- PKIX Certificate Extensions - Attribute, AlgorithmIdentifier, CertificateSerialNumber, - Extensions, UniqueIdentifier, - id-pkix, id-pe, id-kp, id-ad, id-at - FROM PKIX1Explicit88 {iso(1) identified-organization(3) - dod(6) internet(1) security(5) mechanisms(5) - pkix(7) id-mod(0) id-pkix1-explicit-88(1)} - - GeneralName, GeneralNames, id-ce - FROM PKIX1Implicit88 {iso(1) identified-organization(3) - dod(6) internet(1) security(5) mechanisms(5) - pkix(7) id-mod(0) id-pkix1-implicit-88(2)} ; - - id-pe-ac-auditIdentity OBJECT IDENTIFIER ::= { id-pe 4 } - id-pe-aaControls OBJECT IDENTIFIER ::= { id-pe 6 } - id-pe-ac-proxying OBJECT IDENTIFIER ::= { id-pe 10 } - id-ce-targetInformation OBJECT IDENTIFIER ::= { id-ce 55 } - - id-aca OBJECT IDENTIFIER ::= { id-pkix 10 } - id-aca-authenticationInfo OBJECT IDENTIFIER ::= { id-aca 1 } - id-aca-accessIdentity OBJECT IDENTIFIER ::= { id-aca 2 } - id-aca-chargingIdentity OBJECT IDENTIFIER ::= { id-aca 3 } - id-aca-group OBJECT IDENTIFIER ::= { id-aca 4 } - -- { id-aca 5 } is reserved - id-aca-encAttrs OBJECT IDENTIFIER ::= { id-aca 6 } - - id-at-role OBJECT IDENTIFIER ::= { id-at 72} - id-at-clearance OBJECT IDENTIFIER ::= - { joint-iso-ccitt(2) ds(5) module(1) - selected-attribute-types(5) clearance (55) } - - -- Uncomment this if using a 1988 level ASN.1 compiler - -- UTF8String ::= [UNIVERSAL 12] IMPLICIT OCTET STRING - - AttributeCertificate ::= SEQUENCE { - acinfo AttributeCertificateInfo, - signatureAlgorithm AlgorithmIdentifier, - signatureValue BIT STRING - } - - AttributeCertificateInfo ::= SEQUENCE { - version AttCertVersion, -- version is v2 - holder Holder, - issuer AttCertIssuer, - signature AlgorithmIdentifier, - serialNumber CertificateSerialNumber, - attrCertValidityPeriod AttCertValidityPeriod, - attributes SEQUENCE OF Attribute, - issuerUniqueID UniqueIdentifier OPTIONAL, - extensions Extensions OPTIONAL - } - - AttCertVersion ::= INTEGER { v2(1) } - - Holder ::= SEQUENCE { - baseCertificateID [0] IssuerSerial OPTIONAL, - -- the issuer and serial number of - -- the holder's Public Key Certificate - entityName [1] GeneralNames OPTIONAL, - -- the name of the claimant or role - objectDigestInfo [2] ObjectDigestInfo OPTIONAL - -- used to directly authenticate the - -- holder, for example, an executable - } - - ObjectDigestInfo ::= SEQUENCE { - digestedObjectType ENUMERATED { - publicKey (0), - publicKeyCert (1), - otherObjectTypes (2) }, - -- otherObjectTypes MUST NOT - -- MUST NOT be used in this profile - otherObjectTypeID OBJECT IDENTIFIER OPTIONAL, - digestAlgorithm AlgorithmIdentifier, - objectDigest BIT STRING - } - - AttCertIssuer ::= CHOICE { - v1Form GeneralNames, -- MUST NOT be used in this - -- profile - v2Form [0] V2Form -- v2 only - } - - V2Form ::= SEQUENCE { - issuerName GeneralNames OPTIONAL, - baseCertificateID [0] IssuerSerial OPTIONAL, - objectDigestInfo [1] ObjectDigestInfo OPTIONAL - -- issuerName MUST be present in this profile - -- baseCertificateID and objectDigestInfo MUST - -- NOT be present in this profile - } - - IssuerSerial ::= SEQUENCE { - issuer GeneralNames, - serial CertificateSerialNumber, - issuerUID UniqueIdentifier OPTIONAL - } - - AttCertValidityPeriod ::= SEQUENCE { - notBeforeTime GeneralizedTime, - notAfterTime GeneralizedTime - } - - Targets ::= SEQUENCE OF Target - - Target ::= CHOICE { - targetName [0] GeneralName, - targetGroup [1] GeneralName, - targetCert [2] TargetCert - } - - TargetCert ::= SEQUENCE { - targetCertificate IssuerSerial, - targetName GeneralName OPTIONAL, - certDigestInfo ObjectDigestInfo OPTIONAL - } - - IetfAttrSyntax ::= SEQUENCE { - policyAuthority[0] GeneralNames OPTIONAL, - values SEQUENCE OF CHOICE { - octets OCTET STRING, - oid OBJECT IDENTIFIER, - string UTF8String - } - } - - SvceAuthInfo ::= SEQUENCE { - service GeneralName, - ident GeneralName, - authInfo OCTET STRING OPTIONAL - } - - RoleSyntax ::= SEQUENCE { - roleAuthority [0] GeneralNames OPTIONAL, - roleName [1] GeneralName - } - - Clearance ::= SEQUENCE { - policyId [0] OBJECT IDENTIFIER, - classList [1] ClassList DEFAULT {unclassified}, - securityCategories - [2] SET OF SecurityCategory OPTIONAL - } - - ClassList ::= BIT STRING { - unmarked (0), - unclassified (1), - restricted (2), - confidential (3), - secret (4), - topSecret (5) - } - - SecurityCategory ::= SEQUENCE { - type [0] IMPLICIT OBJECT IDENTIFIER, - value [1] ANY DEFINED BY type - } - - AAControls ::= SEQUENCE { - pathLenConstraint INTEGER (0..MAX) OPTIONAL, - permittedAttrs [0] AttrSpec OPTIONAL, - excludedAttrs [1] AttrSpec OPTIONAL, - permitUnSpecified BOOLEAN DEFAULT TRUE - } - - AttrSpec::= SEQUENCE OF OBJECT IDENTIFIER - - ACClearAttrs ::= SEQUENCE { - acIssuer GeneralName, - acSerial INTEGER, - attrs SEQUENCE OF Attribute - } - - ProxyInfo ::= SEQUENCE OF Targets - - END diff --git a/lib/orber/src/any.erl b/lib/orber/src/any.erl deleted file mode 100644 index ec7c3ba83a..0000000000 --- a/lib/orber/src/any.erl +++ /dev/null @@ -1,74 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: any.erl -%% Description: -%% This file conatins the interface for the any type -%% -%%----------------------------------------------------------------- --module(any). - --include_lib("orber/include/corba.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([create/0, create/2, - set_typecode/2, get_typecode/1, - set_value/2, get_value/1]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- -create() -> - #any{}. - -create(TC, V) -> - case orber_tc:check_tc(TC) of - true -> - #any{typecode=TC, value=V}; - false -> - corba:raise(#'BAD_TYPECODE'{completion_status=?COMPLETED_NO}) - end. - -set_typecode(Any, TC) -> - case orber_tc:check_tc(TC) of - true -> - Any#any{typecode=TC}; - false -> - corba:raise(#'BAD_TYPECODE'{completion_status=?COMPLETED_NO}) - end. - -get_typecode(Any) -> - Any#any.typecode. - -set_value(Any, V) -> - Any#any{value=V}. - -get_value(Any) -> - Any#any.value. - diff --git a/lib/orber/src/cdr_decode.erl b/lib/orber/src/cdr_decode.erl deleted file mode 100644 index fd021988c9..0000000000 --- a/lib/orber/src/cdr_decode.erl +++ /dev/null @@ -1,1536 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: cdr_decode.erl -%% -%% Description: -%% This file contains all decoding functions for the CDR -%% format. -%% -%%----------------------------------------------------------------- --module(cdr_decode). - --include_lib("orber/src/orber_iiop.hrl"). --include_lib("orber/include/ifr_types.hrl"). --include_lib("orber/include/corba.hrl"). - --include_lib("orber/src/ifr_objects.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([dec_giop_message_header/1, dec_reply_header/4, - dec_reply_body/6, dec_locate_reply_header/4, - dec_locate_reply_body/5, dec_message_header/3, dec_request_body/6, - dec_octet_sequence_bin/6, dec_message/2, peek_request_id/2]). - -%%----------------------------------------------------------------- -%% Functions which only are exported for the testcases. -%%----------------------------------------------------------------- --export([dec_type/5, dec_byte_order/1, dec_system_exception/4, dec_user_exception/4, - dec_byte_order_list/1]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- - -%%----------------------------------------------------------------- -%% Macros -%%----------------------------------------------------------------- --define(DEBUG_LEVEL, 9). - --define(ODD(N), (N rem 2) == 1). - -%%----------------------------------------------------------------- -%% Func: dec_message/3 -%% Args: -%% TypeCodes - is the type_codes of the return value and out parameters -%% when one decodes a reply. -%% Bytes - is the the message as a byte sequence. -%% Returns: -%% A tupple which contains the decoded message, -%% {ok, Header, Parameters, TypeCodes}. -%%----------------------------------------------------------------- -dec_message(TypeCodes, Bytes) -> - Message = dec_giop_message_header(Bytes), - case Message#giop_message.message_type of - ?GIOP_MSG_REQUEST -> - {Version, ReqHdr, Rest, Len, ByteOrder} = - dec_request_header(Message#giop_message.giop_version, - Message#giop_message.message, ?GIOP_HEADER_SIZE, - Message#giop_message.byte_order, Bytes), - dec_request_body(Version, ReqHdr, Rest, Len, ByteOrder, Bytes); - ?GIOP_MSG_REPLY -> - dec_reply(Message#giop_message.giop_version, - TypeCodes, Message#giop_message.message, ?GIOP_HEADER_SIZE, - Message#giop_message.byte_order); - ?GIOP_MSG_CANCEL_REQUEST -> - dec_cancel_request(Message#giop_message.giop_version, - Message#giop_message.message, ?GIOP_HEADER_SIZE, - Message#giop_message.byte_order); - ?GIOP_MSG_LOCATE_REQUEST -> - dec_locate_request(Message#giop_message.giop_version, - Message#giop_message.message, ?GIOP_HEADER_SIZE, - Message#giop_message.byte_order); - ?GIOP_MSG_LOCATE_REPLY -> - dec_locate_reply(Message#giop_message.giop_version, - Message#giop_message.message, ?GIOP_HEADER_SIZE, - Message#giop_message.byte_order); - ?GIOP_MSG_CLOSE_CONNECTION -> - 'close_connection'; - ?GIOP_MSG_MESSAGE_ERROR -> - 'message_error'; - ?GIOP_MSG_FRAGMENT -> - dec_fragment_header(Message#giop_message.giop_version, - Message#giop_message.message, ?GIOP_HEADER_SIZE, - Message#giop_message.byte_order, Bytes) - end. - -%%----------------------------------------------------------------- -%% Func: dec_giop_message_header/1 -%% Args: -%% Bytes - is the the message as a byte sequence. -%% Returns: -%% A giop_message record. -%%----------------------------------------------------------------- -%% Magic|Version|BO| Type | Size | Body -dec_giop_message_header(<<"GIOP",1:8,0:8,1:8,MessType:8, - MessSize:32/little-unsigned-integer,Message/binary>>) -> - #giop_message{magic = "GIOP", giop_version = {1,0}, - byte_order = little, message_type = MessType, - message_size = MessSize, message = Message}; -dec_giop_message_header(<<"GIOP",1:8,0:8,0:8,MessType:8, - MessSize:32/big-unsigned-integer,Message/binary>>) -> - #giop_message{magic = "GIOP", giop_version = {1,0}, - byte_order = big, message_type = MessType, - message_size = MessSize, message = Message}; -dec_giop_message_header(<<"GIOP",1:8,Minor:8,Flags:8,MessType:8, - MessSize:32/little-unsigned-integer,Message/binary>>) when - ((Flags band 16#01) == 16#01) -> - #giop_message{magic = "GIOP", giop_version = {1,Minor}, - byte_order = little, fragments = ((Flags band 16#02) == 16#02), - message_type = MessType, message_size = MessSize, message = Message}; -dec_giop_message_header(<<"GIOP",1:8,Minor:8,Flags:8,MessType:8, - MessSize:32/big-unsigned-integer,Message/binary>>) -> - #giop_message{magic = "GIOP", giop_version = {1,Minor}, - byte_order = big, fragments = ((Flags band 16#02) == 16#02), - message_type = MessType, message_size = MessSize, message = Message}; -dec_giop_message_header(<>) -> - orber:dbg("[~p] cdr_decode:dec_giop_message_header(~p);~n" - "Orber cannot decode the GIOP-header.", [?LINE, Hdr], ?DEBUG_LEVEL), - exit(message_error); -dec_giop_message_header(Other) -> - orber:dbg("[~p] cdr_decode:dec_giop_message_header(~p);~n" - "Orber cannot decode the GIOP-header.", [?LINE, Other], ?DEBUG_LEVEL), - exit(message_error). - - -peek_request_id(big, <>) -> - ReqId; -peek_request_id(little, <>) -> - ReqId. - -%%----------------------------------------------------------------- -%% Func: dec_message_header/2 -%% Args: -%% Header - #giop_message{} -%% Bytes - is the the message body as a byte sequence. -%% Returns: -%%----------------------------------------------------------------- -dec_message_header(TypeCodes, Message, Bytes) -> - case Message#giop_message.message_type of - ?GIOP_MSG_REQUEST -> - dec_request_header(Message#giop_message.giop_version, - Message#giop_message.message, ?GIOP_HEADER_SIZE, - Message#giop_message.byte_order, Bytes); - ?GIOP_MSG_REPLY -> - dec_reply(Message#giop_message.giop_version, - TypeCodes, Message#giop_message.message, ?GIOP_HEADER_SIZE, - Message#giop_message.byte_order); - ?GIOP_MSG_CANCEL_REQUEST -> - dec_cancel_request(Message#giop_message.giop_version, - Message#giop_message.message, ?GIOP_HEADER_SIZE, - Message#giop_message.byte_order); - ?GIOP_MSG_LOCATE_REQUEST -> - dec_locate_request(Message#giop_message.giop_version, - Message#giop_message.message, ?GIOP_HEADER_SIZE, - Message#giop_message.byte_order); - ?GIOP_MSG_LOCATE_REPLY -> - dec_locate_reply(Message#giop_message.giop_version, - Message#giop_message.message, ?GIOP_HEADER_SIZE, - Message#giop_message.byte_order); - ?GIOP_MSG_CLOSE_CONNECTION -> - 'close_connection'; - ?GIOP_MSG_MESSAGE_ERROR -> - 'message_error'; - ?GIOP_MSG_FRAGMENT -> - dec_fragment_header(Message#giop_message.giop_version, - Message#giop_message.message, ?GIOP_HEADER_SIZE, - Message#giop_message.byte_order, Bytes) - end. - - -%%----------------------------------------------------------------- -%% Func: dec_byte_order/1 -%% Args: -%% The message as a byte sequence. -%% Returns: -%% A tuple {Endianness, Rest} where Endianness is big or little. -%% Rest is the remaining message byte sequence. -%%----------------------------------------------------------------- -dec_byte_order(<<0:8,T/binary>>) -> - {big, T}; -dec_byte_order(<<1:8,T/binary>>) -> - {little, T}. - -%%----------------------------------------------------------------- -%% Func: dec_byte_order_list/1 -%% Args: -%% The message as a byte sequence. -%% Returns: -%% A tuple {Endianness, Rest} where Endianness is big or little. -%% Rest is the remaining message byte sequence. -%%----------------------------------------------------------------- -dec_byte_order_list([0|T]) -> - {big, T}; -dec_byte_order_list([1|T]) -> - {little, T}. - -%%----------------------------------------------------------------- -%% Func : dec_response_flags -%% Args : -%% Returns : boolean -%%----------------------------------------------------------------- -%% FIX ME!! Not correct flag handling. -dec_response_flags(_Version, <<0:8, Rest/binary>>, Len) -> - {false, Rest, Len+1}; -dec_response_flags(_Version, <<1:8, Rest/binary>>, Len) -> - {true_oneway, Rest, Len+1}; -dec_response_flags(_Version, <<3:8, Rest/binary>>, Len) -> - {true, Rest, Len+1}; -dec_response_flags(_Version, <>, Len) -> - %% Not only the Response flag is set, test which. - if - %% Since the 6 most significant bits are unused we'll accept this for now. - ((X band 16#03) == 16#03) -> - {true, Rest, Len+1}; - ((X band 16#01) == 16#01) -> - {true_oneway, Rest, Len+1}; - true -> - {false, Rest, Len+1} - end. - -%%----------------------------------------------------------------- -%% Func : dec_target_addr -%% Args : Octet -%% Returns : boolean -%%----------------------------------------------------------------- -dec_target_addr(Version, Message, Len, ByteOrder, RequestId, Type) -> - case dec_type(?TARGETADDRESS, Version, Message, Len, ByteOrder, [], 0) of - {#'GIOP_TargetAddress'{label = ?GIOP_KeyAddr, value = KeyAddr}, Rest3, Len3, C} -> - {dec_target_key(KeyAddr, RequestId, Version, Type), Rest3, Len3, C}; - {#'GIOP_TargetAddress'{label = ?GIOP_ProfileAddr, - value = #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, - profile_data=PA}}, - Rest3, Len3, C} -> - {dec_target_key(PA, RequestId, Version, Type), Rest3, Len3, C}; - {#'GIOP_TargetAddress'{label = ?GIOP_ReferenceAddr, - value = #'GIOP_IORAddressingInfo'{ - selected_profile_index = _PI, - ior = IOR}}, Rest3, Len3, C} -> - {dec_target_key(iop_ior:get_objkey(IOR), RequestId, Version, Type), - Rest3, Len3, C}; - Other -> - orber:dbg("[~p] cdr_decode:dec_target_addr(~p);~n" - "Unsupported TargetAddress.", [?LINE, Other], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 12), completion_status=?COMPLETED_MAYBE}) - end. - -%%----------------------------------------------------------------- -%% Func : dec_target_key -%% Args : Octet -%% Returns : boolean -%%----------------------------------------------------------------- -dec_target_key(Key, RequestId, Version, Type) -> - %% The Type argument is used as an identifier of which operation it is. - %% We need it to be able to tell the difference if it's, for example, - %% a request or locate-request. - case corba:string_to_objkey_local(Key) of - {location_forward, Object} -> - throw({Type, Object, RequestId, Version, Key}); - ObjRef -> - ObjRef - end. - -%%----------------------------------------------------------------- -%% Func: dec_request_header/3 -%% Args: -%% Message - The message -%% Len0 - Number of bytes already read. -%% ByteOrder - little or big -%% Returns: -%%----------------------------------------------------------------- -dec_request_header(Version, Message, Len0, ByteOrder, _Buffer) when Version == {1,2} -> - {Request_id, Rest1, Len1, _} = dec_type('tk_ulong', Version, Message, Len0, - ByteOrder, [], 0), - {ResponseFlags, Rest2, Len2} = dec_response_flags(Version, Rest1, Len1), - {_, Rest2b, Len2b, _} = dec_type({'tk_array', 'tk_octet', 3}, Version, Rest2, Len2, ByteOrder, [], 0), - {Object_key, Rest3, Len3, _} = dec_target_addr(Version, Rest2b, Len2b, ByteOrder, Request_id, - 'location_forward'), - {Operation, Rest4, Len4, _} = dec_type({'tk_string', 0}, Version, Rest3, Len3, ByteOrder, [], 0), - {Context, Rest5, Len5} = dec_service_context(Version, Rest4, Len4, ByteOrder), - {Version, #request_header{service_context=Context, - request_id=Request_id, - response_expected=ResponseFlags, - object_key=Object_key, - operation=list_to_atom(Operation), - requesting_principal=""}, Rest5, Len5, ByteOrder}; -dec_request_header(Version, Message, Len0, ByteOrder, _Buffer) -> - {Context, Rest1, Len1} = dec_service_context(Version, Message, Len0, ByteOrder), - {Request_id, Rest2, Len2, _} = dec_type('tk_ulong', Version, Rest1, Len1, ByteOrder, [], 0), - {Response_expected, Rest3, Len3, _} = dec_type('tk_boolean', Version, Rest2, Len2, - ByteOrder, [], 0), - {ObjKey, Rest4, Len4, _} = dec_type({'tk_sequence', 'tk_octet', 0}, Version, Rest3, - Len3, ByteOrder, [], 0), - Object_key = dec_target_key(ObjKey, Request_id, Version, 'location_forward'), - {Operation, Rest5, Len5, _} = dec_type({'tk_string', 0}, Version, Rest4, Len4, ByteOrder, [], 0), - {Principal, Rest, Len, _} = dec_type({'tk_string', 0}, Version, Rest5,Len5, ByteOrder, [], 0), - {Version, #request_header{service_context=Context, - request_id=Request_id, - response_expected=Response_expected, - object_key=Object_key, - operation=list_to_atom(Operation), - requesting_principal=Principal}, Rest, Len, ByteOrder}. - - -%%----------------------------------------------------------------- -%% Func: dec_service_context/4 -%% Args: Version - e.g. 1.2 -%% Message - The message -%% Len - Number of bytes already read. -%% ByteOrder - little or big -%% Returns: -%%----------------------------------------------------------------- -dec_service_context(Version, Message, Len, ByteOrder) -> - {Context, Rest, Len1} = dec_type(?IOP_SERVICECONTEXT, Version, Message, - Len, ByteOrder), - {dec_used_contexts(Version, Context, []), Rest, Len1}. - -dec_used_contexts(_Version, [], Ctxs) -> - Ctxs; -dec_used_contexts({1,0}, [#'IOP_ServiceContext'{context_id=?IOP_CodeSets}|T], Ctxs) -> - %% Not supported by 1.0, drop it. - dec_used_contexts({1,0}, T, Ctxs); -dec_used_contexts(Version, [#'IOP_ServiceContext'{context_id=?IOP_CodeSets, - context_data = Bytes}|T], Ctxs) -> - {ByteOrder, Rest} = dec_byte_order(list_to_binary(Bytes)), - {CodeCtx, _, _} = dec_type(?CONV_FRAME_CODESETCONTEXT, Version, - Rest, 1, ByteOrder), - dec_used_contexts(Version, T, - [#'IOP_ServiceContext'{context_id=?IOP_CodeSets, - context_data = CodeCtx}|Ctxs]); -dec_used_contexts(Version, [#'IOP_ServiceContext'{context_id=?IOP_BI_DIR_IIOP, - context_data = Bytes}|T], Ctxs) -> - {ByteOrder, Rest} = dec_byte_order(list_to_binary(Bytes)), - {BiDirCtx, _, _} = dec_type(?IIOP_BIDIRIIOPSERVICECONTEXT, Version, - Rest, 1, ByteOrder), - dec_used_contexts(Version, T, - [#'IOP_ServiceContext'{context_id=?IOP_BI_DIR_IIOP, - context_data = BiDirCtx}|Ctxs]); -dec_used_contexts(Version, [#'IOP_ServiceContext'{context_id=?IOP_FT_REQUEST, - context_data = Bytes}|T], Ctxs) -> - {ByteOrder, Rest} = dec_byte_order(list_to_binary(Bytes)), - {Ctx, _, _} = dec_type(?FT_FTRequestServiceContext, Version, - Rest, 1, ByteOrder), - dec_used_contexts(Version, T, - [#'IOP_ServiceContext'{context_id=?IOP_FT_REQUEST, - context_data = Ctx}|Ctxs]); -dec_used_contexts(Version, [#'IOP_ServiceContext'{context_id=?IOP_FT_GROUP_VERSION, - context_data = Bytes}|T], Ctxs) -> - {ByteOrder, Rest} = dec_byte_order(list_to_binary(Bytes)), - {Ctx, _, _} = dec_type(?FT_FTGroupVersionServiceContext, Version, - Rest, 1, ByteOrder), - dec_used_contexts(Version, T, - [#'IOP_ServiceContext'{context_id=?IOP_FT_GROUP_VERSION, - context_data = Ctx}|Ctxs]); -dec_used_contexts(Version, [#'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, - context_data = Bytes}|T], Ctxs) -> - {ByteOrder, Rest} = dec_byte_order(list_to_binary(Bytes)), - {Ctx, _, _} = dec_type(?CSI_SASContextBody, Version, - Rest, 1, ByteOrder), - dec_used_contexts(Version, T, - [#'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, - context_data = Ctx}|Ctxs]); -dec_used_contexts(Version, [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, - context_data = Bytes}|T], Ctxs) -> - {ByteOrder, Rest} = dec_byte_order(list_to_binary(Bytes)), - {Ctx, _, _} = dec_type(?ORBER_GENERIC_CTX, Version, - Rest, 1, ByteOrder), - dec_used_contexts(Version, T, - [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, - context_data = binary_to_term(list_to_binary(Ctx))}|Ctxs]); -dec_used_contexts(Version, [H|T], Ctxs) -> - dec_used_contexts(Version, T, [H|Ctxs]). - -%%----------------------------------------------------------------- -%% Func: dec_request_body -%% Args: Version - e.g. 1.2 -%% Returns: -%%----------------------------------------------------------------- -dec_request_body(Version, ReqHdr, Rest, Len, ByteOrder, Buffer) -> - {Parameters, TypeCodes, _} = - dec_request_body(Version, ReqHdr#request_header.object_key, - ReqHdr#request_header.operation, - Rest, Len, ByteOrder, Buffer, Len), - {Version, ReqHdr, Parameters, TypeCodes}. - -dec_request_body(Version, Object_key, Operation, Body, Len, ByteOrder, Buffer, Counter) - when Version == {1,2} -> - case orber_typedefs:get_op_def(Object_key, Operation) of - {RetType, [], OutParameters} -> - {[], {RetType, [], OutParameters}, Len}; - {RetType, InParameters, OutParameters} -> - {Rest, Len1, NewC} = dec_align(Body, Len, 8, Counter), - {Parameters, Len2} = dec_parameters(Version, InParameters, Rest, Len1, - ByteOrder, Buffer, NewC), - {Parameters, {RetType, InParameters, OutParameters}, Len2} - end; -dec_request_body(Version, Object_key, Operation, Body, Len, ByteOrder, Buffer, Counter) -> - {RetType, InParameters, OutParameters} = - orber_typedefs:get_op_def(Object_key, Operation), - {Parameters, Len1} = dec_parameters(Version, InParameters, Body, Len, ByteOrder, Buffer, Counter), - {Parameters, {RetType, InParameters, OutParameters}, Len1}. - -dec_parameters(_, [], _, Len, _, _, _) -> - {[], Len}; -dec_parameters(Version, [P1 |InParList], Body, Len, ByteOrder, Buffer, Counter) -> - {Object, Rest, Len1, NewCounter} = dec_type(P1, Version, Body, Len, ByteOrder, Buffer, Counter), - {List, Len2} = dec_parameters(Version, InParList, Rest, Len1, ByteOrder, Buffer, NewCounter), - {[Object | List], Len2}. - -%%----------------------------------------------------------------- -%% Func: dec_reply/5 -%% Args: -%% Message - The message -%% Len0 - Number of bytes already read. -%% ByteOrder - little or big -%% Returns: -%% A tuple {ReplyHeader, Result} where ReplyHeader is a -%% reply_header record and Result the decode result. -%%----------------------------------------------------------------- -dec_reply(Version, TypeCodes, Message, Len0, ByteOrder) -> - {ReplyHeader, Rest, Len} = dec_reply_header(Version, Message, Len0, ByteOrder), - {Result, Par} = - case ReplyHeader#reply_header.reply_status of - 'no_exception' -> - {R, P, _} = dec_reply_body(Version, TypeCodes, Rest, Len, ByteOrder, Message), - {R, P}; - 'system_exception' -> - {R, _} = dec_system_exception(Version, Rest, Len, ByteOrder), - {R, []}; - 'user_exception' -> - {R, _} = dec_user_exception(Version, Rest, Len, ByteOrder), - {R, []}; - 'location_forward' -> - {R, _, _} = dec_reply_body(Version, {{'tk_objref', "", ""}, [],[]}, - Rest, Len, ByteOrder, Message), - {R, []}; - %% This is deprecated in later version than CORBA-2.3.1. We'll leave it for - %% now. - 'location_forward_perm' -> - {R, _, _} = dec_reply_body(Version, {{'tk_objref', "", ""}, [],[]}, - Rest, Len, ByteOrder, Message), - {R, []}; - 'needs_addressing_mode' -> - {R, _, _} = dec_reply_body(Version, {'tk_short', [],[]}, - Rest, Len, ByteOrder, Message), - {R, []} - end, - {ReplyHeader, Result, Par}. - - -%% ## NEW IIOP 1.2 ## -dec_reply_header(Version, Message, Len0, ByteOrder) when Version == {1,2} -> - {Request_id, Rest1, Len1} = dec_type('tk_ulong', Version, Message, Len0, ByteOrder), - {ReplyStatus, Rest2, Len2} = dec_reply_status(Version, Rest1, Len1, ByteOrder), - {Context, Rest, Len3} = dec_service_context(Version, Rest2, Len2, ByteOrder), - {#reply_header{service_context=Context, request_id=Request_id, reply_status=ReplyStatus}, - Rest, Len3}; - -dec_reply_header(Version, Message, Len0, ByteOrder) -> - {Context, Rest1, Len1} = dec_service_context(Version, Message, Len0, ByteOrder), - {Request_id, Rest2, Len2} = dec_type('tk_ulong', Version, Rest1, Len1, ByteOrder), - {ReplyStatus, Rest, Len3} = dec_reply_status(Version, Rest2, Len2, ByteOrder), - {#reply_header{service_context=Context, request_id=Request_id, reply_status=ReplyStatus}, - Rest, Len3}. - -dec_reply_status(Version, Status, Len, ByteOrder) -> - {L, Rest, Len1}= dec_type('tk_ulong', Version, Status, Len, ByteOrder), - {dec_giop_reply_status_type(L), Rest, Len1}. - -dec_reply_body(_, {'tk_void', _, []}, <<>>, Len, _, _) -> - %% This case is mainly to be able to avoid removing non-existent alignment for - %% IIOP-1.2 messages if the body should be empty, i.e., void return value and - %% no out parameters. - {ok, [], Len}; -dec_reply_body(Version, {RetType, _InParameters, OutParameters}, Body, Len, - ByteOrder, Bytes) when Version == {1,2} -> - {Rest, Len1, Counter} = dec_align(Body, Len, 8, Len), - {Result, Rest2, Len2, C} = dec_type(RetType, Version, Rest, Len1, ByteOrder, Bytes, Counter), - {Par, Len3} = dec_parameters(Version, OutParameters, Rest2, Len2, ByteOrder, Bytes, C), - {Result, Par, Len3}; -dec_reply_body(Version, {RetType, _InParameters, OutParameters}, Body, Len, ByteOrder, Bytes) -> - {Result, Rest, Len1, C} = dec_type(RetType, Version, Body, Len, ByteOrder, Bytes, Len), - {Par, Len2} = dec_parameters(Version, OutParameters, Rest, Len1, ByteOrder, Bytes, C), - {Result, Par, Len2}. - - -%%----------------------------------------------------------------- -%% Func: dec_cancel_request/3 -%% Args: -%% Message - The message -%% Len - Number of bytes already read. -%% ByteOrder - little or big -%% Returns: -%% A cancel_request_header record. -%%----------------------------------------------------------------- -dec_cancel_request(Version, Message, Len, ByteOrder) -> - {Request_id, _, _} = dec_type('tk_ulong', Version, Message, Len, ByteOrder), - #cancel_request_header{request_id=Request_id}. - -%%----------------------------------------------------------------- -%% Func: dec_locate_request/3 -%% Args: -%% Message - The message -%% Len - Number of bytes already read. -%% ByteOrder - little or big -%% Returns: -%% A locate_request_header record. -%%----------------------------------------------------------------- -%% ## NEW IIOP 1.2 ## -dec_locate_request(Version, Message, Len, ByteOrder) when Version == {1,2} -> - {Request_id, Rest, Len1} = dec_type('tk_ulong', Version, Message, Len, ByteOrder), - {Object_key, _, _, _} = dec_target_addr(Version, Rest, Len1, ByteOrder, Request_id, - 'object_forward'), - {Version, #locate_request_header{request_id=Request_id, object_key=Object_key}}; -dec_locate_request(Version, Message, Len, ByteOrder) -> - {Request_id, Rest, Len1} = dec_type('tk_ulong', Version, Message, Len, ByteOrder), - {ObjKey, _, _} = dec_type({'tk_sequence', 'tk_octet', 0}, Version, Rest, - Len1, ByteOrder), - Object_key = dec_target_key(ObjKey, Request_id, Version, 'object_forward'), - {Version, #locate_request_header{request_id=Request_id, object_key=Object_key}}. - - -%%----------------------------------------------------------------- -%% Func: dec_locate_reply/3 -%% Args: -%% Message - The message -%% Len - Number of bytes already read. -%% ByteOrder - little or big -%% Returns: -%% A locate_reply_header record. -%%----------------------------------------------------------------- -dec_locate_reply(Version, Message, Len, ByteOrder) -> - {ReplyHeader, Rest1, Len1} = dec_locate_reply_header(Version, Message, Len, ByteOrder), - {ReplyHeader, dec_locate_reply_body(Version, ReplyHeader#locate_reply_header.locate_status, Rest1, - Len1, ByteOrder)}. - -dec_locate_reply_header(Version, Message, Len, ByteOrder) -> - {Request_id, Rest1, Len1} = dec_type('tk_ulong', Version, Message, Len, ByteOrder), - {Locate_status, Rest2, Len2} = dec_locate_status(Version, Rest1, Len1, ByteOrder), - {#locate_reply_header{request_id=Request_id, locate_status=Locate_status}, Rest2, Len2}. - -dec_locate_reply_body(Version, LocateStatus, Rest, Len, ByteOrder) when Version == {1,2} -> - %% In CORBA-2.3.1 the LocateReply body didn't align the body (8-octet - %% boundry) for IIOP-1.2. This have been changed in CORBA-2.4 and - %% changed back in CORBA-2.6. Hence, we should not change this. - case LocateStatus of - 'object_forward' -> - {ObjRef, _, _, _} = dec_objref(Version, Rest, Len, ByteOrder), - ObjRef; - 'object_forward_perm' -> - %% This is deprecated in later version than CORBA-2.3.1. We'll leave it for - %% now. - {ObjRef, _, _, _} = dec_objref(Version, Rest, Len, ByteOrder), - ObjRef; - 'loc_system_exception' -> - %% This should be updated but since 'dec_system_exception' removes - %% alignment, which the LocateReplyBody don't have, for 1.2 we - %% pretend it's 1.1 for now. - {SysExc, _} = dec_system_exception({1,1}, Rest, Len, ByteOrder), - corba:raise(SysExc); - 'loc_needs_addressing_mode' -> - %% Not supported. - []; - _ -> - [] - end; -dec_locate_reply_body(Version, LocateStatus, Rest, Len, ByteOrder) -> - case LocateStatus of - 'object_forward' -> - {ObjRef, _, _, _} = dec_objref(Version, Rest, Len, ByteOrder), - ObjRef; - _ -> - [] - end. - -dec_locate_status(Version, Bytes, Len, ByteOrder) -> - {L, Rest, Len1} = dec_type('tk_ulong', Version, Bytes, Len, ByteOrder), - {dec_giop_locate_status_type(L), Rest, Len1}. - - -%%----------------------------------------------------------------- -%% Func: dec_fragment_header/5 -%% Args: -%% Message - The message -%% Len0 - Number of bytes already read. -%% ByteOrder - little or big -%% Returns: -%%----------------------------------------------------------------- -dec_fragment_header(Version, Message, Len0, ByteOrder, _Buffer) when Version == {1,2} -> - {RequestId, Rest1, Len1, _} = dec_type('tk_ulong', Version, Message, Len0, - ByteOrder, [], 0), - {Version, #fragment_header{request_id=RequestId}, Rest1, Len1, ByteOrder}; -dec_fragment_header(Version, _Message, _Len0, _ByteOrder, _Buffer) -> - %% The FragmentHeader is IIOP-1.2 specific. Hence, do nothing here. - orber:dbg("[~p] cdr_decode:dec_fragment_header(~p)~n" - "Orber only supports fragmented messages for IIOP-1.2.", - [?LINE, Version], ?DEBUG_LEVEL), - exit(message_error). -% {Version, #fragment_header{}, Message, Len0, ByteOrder}. - -%%----------------------------------------------------------------- -%% Func: dec_giop_reply_status_type -%% Args: -%% An integer status code -%% Returns: -%% An atom which is the reply status -%%----------------------------------------------------------------- -dec_giop_reply_status_type(0) -> - 'no_exception'; -dec_giop_reply_status_type(1) -> - 'user_exception'; -dec_giop_reply_status_type(2) -> - 'system_exception'; -dec_giop_reply_status_type(3) -> - 'location_forward'; -%% ## IIOP-1.2 ## -dec_giop_reply_status_type(4) -> - 'location_forward_perm'; -dec_giop_reply_status_type(5) -> - 'needs_addressing_mode'. - -%%----------------------------------------------------------------- -%% Func: dec_giop_locate_status_type -%% Args: -%% An integer status code -%% Returns: -%% An atom which is the reply status -%%----------------------------------------------------------------- -dec_giop_locate_status_type(0) -> - 'unknown_object'; -dec_giop_locate_status_type(1) -> - 'object_here'; -dec_giop_locate_status_type(2) -> - 'object_forward'; -%% ## IIOP-1.2 ## -dec_giop_locate_status_type(3) -> - 'object_forward_perm'; -dec_giop_locate_status_type(4) -> - 'loc_system_exception'; -dec_giop_locate_status_type(5) -> - 'loc_needs_addressing_mode'. - - -%%----------------------------------------------------------------- -%% Func: dec_type/5 -%%----------------------------------------------------------------- -dec_type(Type, Version, Bytes, Len, ByteOrder) -> - {Val, Rest, Len2, _} = - dec_type(Type, Version, Bytes, Len, ByteOrder, [], 0), - {Val, Rest, Len2}. - -dec_type('tk_null', _Version, Bytes, Len, _, _, C) -> - {'null', Bytes, Len, C}; -dec_type('tk_void', _Version, Bytes, Len, _, _, C) -> - {'ok', Bytes, Len, C}; -dec_type('tk_short', _Version, Bytes, Len, ByteOrder, _, C) -> - {Rest, Len1, NewC} = dec_align(Bytes, Len, 2, C), - {Short, Rest1} = cdrlib:dec_short(ByteOrder, Rest), - {Short, Rest1, Len1 + 2, NewC+2}; -dec_type('tk_long', _Version, Bytes, Len, ByteOrder, _, C) -> - {Rest, Len1, NewC} = dec_align(Bytes, Len, 4, C), - {Long, Rest1} = cdrlib:dec_long(ByteOrder, Rest), - {Long, Rest1, Len1 + 4, NewC+4}; -dec_type('tk_longlong', _Version, Bytes, Len, ByteOrder, _, C) -> - {Rest, Len1, NewC} = dec_align(Bytes, Len, 8, C), - {Long, Rest1} = cdrlib:dec_longlong(ByteOrder, Rest), - {Long, Rest1, Len1 + 8, NewC+8}; -dec_type('tk_ushort', _Version, Bytes, Len, ByteOrder, _, C) -> - {Rest, Len1, NewC} = dec_align(Bytes, Len, 2, C), - {Short, Rest1} = cdrlib:dec_unsigned_short(ByteOrder, Rest), - {Short, Rest1, Len1 + 2, NewC+2}; -dec_type('tk_ulong', _Version, Bytes, Len, ByteOrder, _, C) -> - {Rest, Len1, NewC} = dec_align(Bytes, Len, 4, C), - {Long, Rest1} = cdrlib:dec_unsigned_long(ByteOrder, Rest), - {Long, Rest1, Len1 + 4, NewC+4}; -dec_type('tk_ulonglong', _Version, Bytes, Len, ByteOrder, _, C) -> - {Rest, Len1, NewC} = dec_align(Bytes, Len, 8, C), - {Long, Rest1} = cdrlib:dec_unsigned_longlong(ByteOrder, Rest), - {Long, Rest1, Len1 + 8, NewC+8}; -dec_type('tk_float', _Version, Bytes, Len, ByteOrder, _, C) -> - {Rest, Len1, NewC} = dec_align(Bytes, Len, 4, C), - {Float, Rest1} = cdrlib:dec_float(ByteOrder, Rest), - {Float, Rest1, Len1 + 4, NewC+4}; -dec_type('tk_double', _Version, Bytes, Len, ByteOrder, _, C) -> - {Rest, Len1, NewC} = dec_align(Bytes, Len, 8, C), - {Double, Rest1} = cdrlib:dec_double(ByteOrder, Rest), - {Double, Rest1, Len1 + 8, NewC+8}; -dec_type('tk_boolean', _Version, Bytes, Len, _, _, C) -> - {Bool, Rest} = cdrlib:dec_bool(Bytes), - {Bool, Rest, Len + 1, C+1}; -dec_type('tk_char', _Version, Bytes, Len, _, _, C) -> - {Char, Rest} = cdrlib:dec_char(Bytes), - {Char, Rest, Len + 1, C+1}; -dec_type('tk_wchar', {1,2}, Bytes, Len, _ByteOrder, _, C) -> - %% For IIOP-1.2 a wchar is almost encoded the same way as an octet-sequence. - %% The only difference is that the length-value is an octet as well. - case cdrlib:dec_octet(Bytes) of - {2, Rest1} -> - %% Currently we only allow 2-bytes wchar. - {WChar, Rest2} = cdrlib:dec_unsigned_short(big, Rest1), - {WChar, Rest2, Len+3, C+3}; - {What, _} -> - orber:dbg("[~p] cdr_decode:dec_type(~p); unsupported wchar", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'DATA_CONVERSION'{completion_status=?COMPLETED_NO}) - end; -%% For 1.1 the wchar is limited to the use of two-octet fixed-length encoding. -dec_type('tk_wchar', _Version, Bytes, Len, ByteOrder, _, C) -> - {Rest, Len1, NewC} = dec_align(Bytes, Len, 2, C), - {WChar, Rest2} = cdrlib:dec_unsigned_short(ByteOrder, Rest), - {WChar, Rest2, Len1 + 2, NewC+2}; -dec_type('tk_octet', _Version, Bytes, Len, _, _, C) -> - {Octet, Rest} = cdrlib:dec_octet(Bytes), - {Octet, Rest, Len + 1, C+1}; -dec_type('tk_any', Version, Bytes, Len, ByteOrder, Buff, C) -> - {TypeCode, Rest1, Len1, NewC} = dec_type('tk_TypeCode', Version, Bytes, Len, ByteOrder, Buff, C), - {Value, Rest2, Len2, NewC2} = dec_type(TypeCode, Version, Rest1, Len1, ByteOrder, Buff, NewC), - {#any{typecode=TypeCode, value=Value}, Rest2, Len2, NewC2}; -dec_type('tk_TypeCode', Version, Bytes, Len, ByteOrder, Buff, C) -> - dec_type_code(Version, Bytes, Len, ByteOrder, Buff, C); -dec_type('tk_Principal', Version, Bytes, Len, ByteOrder, Buff, C) -> - dec_sequence(Version, Bytes, 'tk_octet', Len, ByteOrder, Buff, C); -dec_type({'tk_objref', _IFRId, _Name}, Version, Bytes, Len, ByteOrder, Buff, C) -> - dec_objref(Version, Bytes, Len, ByteOrder, Buff, C); -dec_type({'tk_struct', IFRId, Name, ElementList}, Version, Bytes, Len, ByteOrder, Buff, C) -> - dec_struct(Version, IFRId, Name, ElementList, Bytes, Len, ByteOrder, Buff, C); -dec_type({'tk_union', IFRId, Name, DiscrTC, Default, ElementList}, - Version, Bytes, Len, ByteOrder, Buff, C) -> - dec_union(Version, IFRId, Name, DiscrTC, Default, ElementList, Bytes, Len, ByteOrder, Buff, C); -dec_type({'tk_enum', _IFRId, _Name, ElementList}, _Version, Bytes, Len, ByteOrder, _, C) -> - {Rest, Len1, NewC} = dec_align(Bytes, Len, 4, C), - {Enum, Rest1} = cdrlib:dec_enum(ByteOrder, ElementList, Rest), - {Enum, Rest1, Len1 + 4, NewC+4}; -dec_type({'tk_string', _MaxLength}, Version, Bytes, Len, ByteOrder, Buff, C) -> - dec_string(Version, Bytes, Len, ByteOrder, Buff, C); -dec_type({'tk_wstring', _MaxLength}, Version, Bytes, Len, ByteOrder, Buff, C) -> - dec_wstring(Version, Bytes, Len, ByteOrder, Buff, C); -dec_type({'tk_sequence', ElemTC, _MaxLength}, Version, Bytes, Len, ByteOrder, Buff, C) -> - dec_sequence(Version, Bytes, ElemTC, Len, ByteOrder, Buff, C); -dec_type({'tk_array', ElemTC, Size}, Version, Bytes, Len, ByteOrder, Buff, C) -> - dec_array(Version, Bytes, Size, ElemTC, Len, ByteOrder, Buff, C); -dec_type({'tk_alias', _IFRId, _Name, TC}, Version, Bytes, Len, ByteOrder, Buff, C) -> - dec_type(TC, Version, Bytes, Len, ByteOrder, Buff, C); -%dec_type({'tk_except', IFRId, Name, ElementList}, Version, Bytes, Len, ByteOrder) -> -dec_type({'tk_fixed', Digits, Scale}, _Version, Bytes, Len, _ByteOrder, _Buff, C) -> - dec_fixed(Digits, Scale, Bytes, Len, C); -dec_type(Type, _, _, _, _, _, _) -> - orber:dbg("[~p] cdr_decode:dec_type(~p)~n" - "Incorrect TypeCode or unsupported type.", - [?LINE, Type], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 13), completion_status=?COMPLETED_MAYBE}). - -stringify_enum({tk_enum,_,_,_}, Label) -> - atom_to_list(Label); -stringify_enum(_, Label) -> - Label. - -%%----------------------------------------------------------------- -%% Func: dec_fixed -%%----------------------------------------------------------------- -%% Digits eq. total number of digits. -%% Scale eq. position of the decimal point. -%% E.g. fixed<5,2> - "123.45" -%% E.g. fixed<4,2> - "12.34" -%% These are encoded as: -%% ## <5,2> ## ## <4,2> ## -%% 1,2 0,1 eq. 1 octet -%% 3,4 2,3 -%% 5,0xC 4,0xC -%% -%% Each number is encoded as a half-octet. Note, for <4,2> a zero is -%% added first to to be able to create "even" octets. -dec_fixed(0, 0, Bytes, Len, C) -> - {#fixed{digits = 0, scale = 0, value = ""}, Bytes, Len, C}; -dec_fixed(Digits, Scale, Bytes, Len, C) -> - case ?ODD(Digits) of - true -> - {Fixed, Bytes2, Len2, C2, Sign} = dec_fixed_2(Digits, Scale, Bytes, Len, C), - case Sign of - ?FIXED_POSITIVE -> - {#fixed{digits = Digits, scale = Scale, - value = list_to_integer(Fixed)}, Bytes2, Len2, C2}; - ?FIXED_NEGATIVE -> - {#fixed{digits = Digits, scale = Scale, - value = -list_to_integer(Fixed)}, Bytes2, Len2, C2} - end; - false -> - %% If the length (of fixed) is even a zero is added first. - %% Subtract that we've read 1 digit. - <<0:4,D2:4,T/binary>> = Bytes, - {Fixed, Bytes2, Len2, C2, Sign} = dec_fixed_2(Digits-1, Scale, T, Len+1, C+1), - case Sign of - ?FIXED_POSITIVE -> - {#fixed{digits = Digits, scale = Scale, - value = list_to_integer([D2+48|Fixed])}, Bytes2, Len2, C2}; - ?FIXED_NEGATIVE -> - {#fixed{digits = Digits, scale = Scale, - value = -list_to_integer([D2+48|Fixed])}, Bytes2, Len2, C2} - end - end. - -dec_fixed_2(1, _Scale, <>, Len, C) -> - {[D1+48], T, Len+1, C+1, ?FIXED_POSITIVE}; -dec_fixed_2(1, _Scale, <>, Len, C) -> - {[D1+48], T, Len+1, C+1, ?FIXED_NEGATIVE}; -dec_fixed_2(Digits, Scale, _Bytes, _Len, _C) when Digits =< 0 -> - orber:dbg("[~p] cdr_decode:dec_fixed_2(~p, ~p)~n" - "Malformed fixed type.", [?LINE, Digits, Scale], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 14), completion_status=?COMPLETED_MAYBE}); -dec_fixed_2(Digits, Scale, <<>>, _Len, _C) -> - orber:dbg("[~p] cdr_decode:dec_fixed_2(~p, ~p)~n" - "The fixed type received was to short.", - [?LINE, Digits, Scale], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 14), completion_status=?COMPLETED_MAYBE}); -dec_fixed_2(Digits, Scale, <>, Len, C) -> - {Seq, Rest2, Len2, NewC2, Sign} = dec_fixed_2(Digits-2, Scale, T, Len+1, C+1), - {[D1+48, D2+48 | Seq], Rest2, Len2, NewC2, Sign}. - -%%----------------------------------------------------------------- -%% Func: dec_sequence/7 and dec_sequence/8 -%%----------------------------------------------------------------- -dec_sequence(_Version, Message, 'tk_octet', Len, ByteOrder, _Buff, C) -> - {Rest, Len1, NewC} = dec_align(Message, Len, 4, C), - {Size, Rest1} = cdrlib:dec_unsigned_long(ByteOrder, Rest), - <> = Rest1, - {binary_to_list(OctetSeq), Rest2, Len1+4+Size, NewC+4+Size}; -dec_sequence(_Version, Message, 'tk_char', Len, ByteOrder, _Buff, C) -> - {Rest, Len1, NewC} = dec_align(Message, Len, 4, C), - {Size, Rest1} = cdrlib:dec_unsigned_long(ByteOrder, Rest), - <> = Rest1, - {binary_to_list(OctetSeq), Rest2, Len1+4+Size, NewC+4+Size}; -%% We test if it's a sequence of struct's or unions. By doing this we only -%% have to look up the IFR-ID once instead of N times (N eq length of sequence). -dec_sequence(Version, Message, {'tk_struct', IFRId, ShortName, ElementList}, - Len, ByteOrder, Buff, C) when IFRId /= "", ShortName /= "" -> - {Rest, Len1, NewC} = dec_align(Message, Len, 4, C), - {Size, Rest1} = cdrlib:dec_unsigned_long(ByteOrder, Rest), - case IFRId of - ?SYSTEM_TYPE -> - dec_sequence_struct(Version, Rest1, Size, ElementList, Len1 + 4, - ByteOrder, Buff, NewC+4, ShortName); - _ -> - Name = ifrid_to_name(IFRId, ?IFR_StructDef), - dec_sequence_struct(Version, Rest1, Size, ElementList, Len1 + 4, - ByteOrder, Buff, NewC+4, Name) - end; -dec_sequence(Version, Message, - {'tk_union', ?SYSTEM_TYPE, TCName, DiscrTC, Default, ElementList}, - Len, ByteOrder, Buff, C) -> - {Rest, Len1, NewC} = dec_align(Message, Len, 4, C), - {Size, Rest1} = cdrlib:dec_unsigned_long(ByteOrder, Rest), - dec_sequence_union(Version, Rest1, Size, DiscrTC, Default, ElementList, Len1 + 4, - ByteOrder, Buff, NewC+4, TCName); -dec_sequence(Version, Message, - {'tk_union', IFRId, _TCName, DiscrTC, Default, ElementList}, - Len, ByteOrder, Buff, C) -> - {Rest, Len1, NewC} = dec_align(Message, Len, 4, C), - {Size, Rest1} = cdrlib:dec_unsigned_long(ByteOrder, Rest), - Name = ifrid_to_name(IFRId, ?IFR_UnionDef), - dec_sequence_union(Version, Rest1, Size, DiscrTC, Default, ElementList, Len1 + 4, - ByteOrder, Buff, NewC+4, Name); -dec_sequence(Version, Message, TypeCode, Len, ByteOrder, Buff, C) -> - {Rest, Len1, NewC} = dec_align(Message, Len, 4, C), - {Size, Rest1} = cdrlib:dec_unsigned_long(ByteOrder, Rest), - dec_sequence(Version, Rest1, Size, TypeCode, Len1 + 4, ByteOrder, Buff, NewC+4). - - -dec_sequence(_, Message, 0, _Type, Len, _ByteOrder, _Buff, C) -> - {[], Message, Len, C}; -dec_sequence(Version, Message, N, Type, Len, ByteOrder, Buff, C) -> - {Object, Rest1, Len1, NewC} = dec_type(Type, Version, Message, Len, ByteOrder, Buff, C), - {Seq, Rest2, Len2, NewC2} = dec_sequence(Version, Rest1, N - 1, Type, Len1, ByteOrder, Buff, NewC), - {[Object | Seq], Rest2, Len2, NewC2}. - -dec_sequence_struct(_, Message, 0, _Type, Len, _ByteOrder, _Buff, C, _Name) -> - {[], Message, Len, C}; -dec_sequence_struct(Version, Message, N, TypeCodeList, Len, ByteOrder, Buff, C, Name) -> - {Struct, Rest1, Len1, NewC} = dec_struct1(Version, TypeCodeList, Message, Len, ByteOrder, Buff, C), - {Seq, Rest2, Len2, NewC2} = dec_sequence_struct(Version, Rest1, N - 1, TypeCodeList, Len1, ByteOrder, - Buff, NewC, Name), - {[list_to_tuple([Name |Struct]) | Seq], Rest2, Len2, NewC2}. - - -dec_sequence_union(_, Message, 0, _DiscrTC, _Default, _ElementList, - Len, _ByteOrder, _Buff, C, _Name) -> - {[], Message, Len, C}; -dec_sequence_union(Version, Message, N, DiscrTC, Default, ElementList, - Len, ByteOrder, Buff, C, Name) when is_list(ElementList) -> - - {Label, Rest1, Len1, NewC} = dec_type(DiscrTC, Version, Message, Len, ByteOrder, Buff, C), - Result = dec_union(Version, stringify_enum(DiscrTC, Label), ElementList, Default, - Rest1, Len1, ByteOrder, Buff, NewC), - {Value, Rest2, Len2, NewC3} = case Result of - {default, R, L, NewC2} -> - dec_union(Version, default, ElementList, Default, - R, L, ByteOrder, Buff, NewC2); - X -> - X - end, - {Seq, Rest3, Len3, NewC4} = dec_sequence_union(Version, Rest2, N - 1, - DiscrTC, Default, ElementList, - Len2, ByteOrder, - Buff, NewC3, Name), - {[{Name, Label, Value} | Seq], Rest3, Len3, NewC4}; -dec_sequence_union(Version, Message, N, _DiscrTC, _Default, Module, - Len, ByteOrder, Buff, C, Name) when is_atom(Module) -> - case catch Module:tc() of - {tk_union, _, _, DiscrTC, Default, ElementList} -> - dec_sequence_union(Version, Message, N, DiscrTC, Default, ElementList, - Len, ByteOrder, Buff, C, Name); - What -> - orber:dbg("[~p] ~p:dec_sequence_union(~p). Union module doesn't exist or incorrect.", - [?LINE, ?MODULE, What], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}) - end. - - - -%% A special case; when something is encapsulated (i.e. sent as octet-sequence) -%% we sometimes don not want the result to be converted to a list. -dec_octet_sequence_bin(_Version, Message, Len, ByteOrder, _Buff, C) -> - {Rest, Len1, NewC} = dec_align(Message, Len, 4, C), - {Size, Rest1} = cdrlib:dec_unsigned_long(ByteOrder, Rest), - <> = Rest1, - {OctetSeq, Rest2, Len1+4+Size, NewC+4+Size}. - -%%----------------------------------------------------------------- -%% Func: dec_array/5 -%%----------------------------------------------------------------- -dec_array(Version, Message, Size, TypeCode, Len, ByteOrder, Buff, C) -> - {Seq, Rest1, Len1, NewC} = dec_sequence(Version, Message, Size, TypeCode, Len, - ByteOrder, Buff, C), - {list_to_tuple(Seq), Rest1, Len1, NewC}. - - -%%----------------------------------------------------------------- -%% Func: dec_string/4 -%%----------------------------------------------------------------- -dec_string(_Version, Message, Len, ByteOrder, _Buff, C) -> - {Rest, Len1, NewC} = dec_align(Message, Len, 4, C), - {Size, Rest1} = cdrlib:dec_unsigned_long(ByteOrder, Rest), - if - Size > 0 -> - DataSize = Size-1, - <> = Rest1, - {binary_to_list(String), Rest2, Len1+4+Size, NewC+4+Size}; - true -> - {"", Rest1, Len1 + 4, NewC+4} - end. - -%%----------------------------------------------------------------- -%% Func: dec_string/4 -%%----------------------------------------------------------------- -dec_wstring({1,2}, Message, Len, ByteOrder, Buff, C) -> - {Rest, Len1, NewC} = dec_align(Message, Len, 4, C), - {Octets, Rest1} = cdrlib:dec_unsigned_long(ByteOrder, Rest), - if - Octets == 0 -> - {"", Rest1, Len1 + 4, NewC+4}; - Octets > 0 -> - Size = round(Octets/2), - {String, Rest2, Len2, NewC2} = - dec_sequence({1,2}, Rest1, Size, 'tk_ushort', - Len1 + 4, big, Buff, NewC+4), - {String, Rest2, Len2, NewC2}; - true -> - orber:dbg("[~p] cdr_decode:dec_wstring(~p);", - [?LINE, Rest1], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_NO}) - end; -dec_wstring(Version, Message, Len, ByteOrder, Buff, C) -> - {Rest, Len1, NewC} = dec_align(Message, Len, 4, C), - {Size, Rest1} = cdrlib:dec_unsigned_long(ByteOrder, Rest), - if - Size > 0 -> - {String, Rest2, Len2, NewC2} = dec_sequence(Version, Rest1, Size - 1, 'tk_wchar', - Len1 + 4, ByteOrder, Buff, NewC+4), - %% Remove the NULL character. - {_, Rest3} = cdrlib:dec_unsigned_short(ByteOrder, Rest2), - {String, Rest3, Len2 + 2, NewC2+2}; - Size == 0 -> - {"", Rest1, Len1 + 4, NewC+4}; - true -> - orber:dbg("[~p] cdr_decode:dec_wstring(~p);", - [?LINE, Rest1], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_NO}) - end. - - -%%----------------------------------------------------------------- -%% Func: dec_union/9 -%%----------------------------------------------------------------- -%% ## NEW IIOP 1.2 ## -dec_union(Version, ?SYSTEM_TYPE, Name, DiscrTC, Default, ElementList, Bytes, - Len, ByteOrder, Buff, C) -> - {Label, Rest1, Len1, NewC} = dec_type(DiscrTC, Version, Bytes, Len, ByteOrder, Buff, C), - {Value, Rest2, Len2, NewC3} = dec_union(Version, Label, ElementList, Default, - Rest1, Len1, ByteOrder, Buff, NewC), - {{Name, Label, Value}, Rest2, Len2, NewC3}; - - -dec_union(Version, IFRId, _, DiscrTC, Default, ElementList, Bytes, Len, - ByteOrder, Buff, C) when is_list(ElementList) -> - {Label, Rest1, Len1, NewC} = dec_type(DiscrTC, Version, Bytes, Len, ByteOrder, Buff, C), - Result = dec_union(Version, stringify_enum(DiscrTC, Label), ElementList, Default, - Rest1, Len1, ByteOrder, Buff, NewC), - {Value, Rest2, Len2, NewC3} = case Result of - {default, R, L, NewC2} -> - dec_union(Version, default, ElementList, Default, - R, L, ByteOrder, Buff, NewC2); - X -> - X - end, - Name = ifrid_to_name(IFRId, ?IFR_UnionDef), - {{Name, Label, Value}, Rest2, Len2, NewC3}; -dec_union(Version, IFRId, _, _DiscrTC, _Default, Module, Bytes, Len, - ByteOrder, Buff, C) when is_atom(Module) -> - case catch Module:tc() of - {tk_union, _, Name, DiscrTC, Default, ElementList} -> - dec_union(Version, IFRId, Name, DiscrTC, Default, ElementList, Bytes, Len, - ByteOrder, Buff, C); - What -> - orber:dbg("[~p] ~p:dec_union(~p). Union module doesn't exist or incorrect.", - [?LINE, ?MODULE, What], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}) - end. - - - -dec_union(_, _, [], Default, Message, Len, _, _Buff, C) when Default < 0 -> - {undefined, Message, Len, C}; -dec_union(_, _, [], _Default, Message, Len, _, _Buff, C) -> - {default, Message, Len, C}; -dec_union(Version, Label, [{Label, _Name, Type}|_List], _Default, Message, Len, ByteOrder, Buff, C) -> - dec_type(Type, Version, Message, Len, ByteOrder, Buff, C); -dec_union(Version, Label, [_H|List], Default, Message, Len, ByteOrder, Buff, C) -> - dec_union(Version, Label, List, Default, Message, Len, ByteOrder, Buff, C). - -%%----------------------------------------------------------------- -%% Func: dec_struct/7 -%%----------------------------------------------------------------- -dec_struct(Version, "", "", TypeCodeList, Message, Len, ByteOrder, Buff, C) -> - {Struct, Rest, Len1, NewC} = dec_struct1(Version, TypeCodeList, Message, Len, ByteOrder, Buff, C), - {list_to_tuple(Struct), Rest, Len1, NewC}; -dec_struct(Version, [], Name, TypeCodeList, Message, Len, ByteOrder, Buff, C) -> - %% This case is used when communicating with ORB:s which don't supply the IFRId - %% field in struct type codes (used in any) - {Struct, Rest, Len1, NewC} = dec_struct1(Version, TypeCodeList, Message, Len, ByteOrder, Buff, C), - {list_to_tuple([list_to_atom(Name) |Struct]), Rest, Len1, NewC}; -dec_struct(Version, ?SYSTEM_TYPE, ShortName, TypeCodeList, Message, Len, ByteOrder, Buff, C) -> - {Struct, Rest, Len1, NewC} = dec_struct1(Version, TypeCodeList, Message, Len, ByteOrder, Buff, C), - {list_to_tuple([ShortName |Struct]), Rest, Len1, NewC}; -dec_struct(Version, IFRId, _ShortName, TypeCodeList, Message, Len, ByteOrder, Buff, C) -> - Name = ifrid_to_name(IFRId, ?IFR_StructDef), - {Struct, Rest, Len1, NewC} = dec_struct1(Version, TypeCodeList, Message, Len, ByteOrder, Buff, C), - {list_to_tuple([Name |Struct]), Rest, Len1, NewC}. - -dec_struct1(_, [], Message, Len, _ByteOrder, _, C) -> - {[], Message, Len, C}; -dec_struct1(Version, [{_ElemName, ElemType} | TypeCodeList], Message, Len, ByteOrder, Buff, C) -> - {Element, Rest, Len1, NewC} = dec_type(ElemType, Version, Message, Len, ByteOrder, Buff, C), - {Struct, Rest1, Len2, NewC2} = dec_struct1(Version, TypeCodeList, Rest, Len1, ByteOrder, Buff, NewC), - {[Element |Struct], Rest1, Len2, NewC2}; -dec_struct1(Version, Module, Message, Len, ByteOrder, Buff, C) -> - case catch Module:tc() of - {tk_struct, _, _, TypeCodeList} -> - dec_struct1(Version, TypeCodeList, Message, Len, ByteOrder, Buff, C); - What -> - orber:dbg("[~p] ~p:dec_struct1(~p). Struct module doesn't exist or incorrect.", - [?LINE, ?MODULE, What], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}) - end. - -ifrid_to_name([], Type) -> - orber:dbg("[~p] ~p:ifrid_to_name([], ~p). No Id supplied.", - [?LINE, ?MODULE, Type], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?CORBA_OMGVMCID bor 11), - completion_status=?COMPLETED_MAYBE}); -ifrid_to_name(Id, Type) -> - case orber:light_ifr() of - true -> - orber_ifr:get_module(Id, Type); - false -> - case catch ifrid_to_name_helper(Id, Type) of - {'EXCEPTION', E} -> - corba:raise(E); - {'EXIT',{aborted,{no_exists,_}}} -> - case orber:get_lightweight_nodes() of - false -> - orber:dbg("[~p] cdr_decode:ifrid_to_name(~p, ~p). IFRid not found.", - [?LINE, Id, Type], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}); - Nodes -> - L = length(Nodes), - IFR = get_ifr_node(Nodes, rand:uniform(L), L), - list_to_atom('OrberApp_IFR':get_absolute_name(IFR, Id)) - end; - {'EXIT', Other} -> - orber:dbg("[~p] cdr_decode:ifrid_to_name(~p). Unknown: ~p", - [?LINE, Id, Other], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}); - Name -> - list_to_atom(Name) - end - end. - -ifrid_to_name_helper(Id, ?IFR_UnionDef) -> - case mnesia:dirty_index_read(ir_UnionDef, Id, #ir_UnionDef.id) of - [#ir_UnionDef{absolute_name = [$:,$:|N]}] -> - change_colons_to_underscore(N, []); - Other -> - orber:dbg("[~p] cdr_decode:ifrid_to_name(~p). IFR Id not found: ~p", - [?LINE, Id, Other], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 9), - completion_status=?COMPLETED_MAYBE}) - end; -ifrid_to_name_helper(Id, ?IFR_StructDef) -> - case mnesia:dirty_index_read(ir_StructDef, Id, #ir_StructDef.id) of - [#ir_StructDef{absolute_name = [$:,$:|N]}] -> - change_colons_to_underscore(N, []); - Other -> - orber:dbg("[~p] cdr_decode:ifrid_to_name(~p). IFR Id not found: ~p", - [?LINE, Id, Other], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 10), - completion_status=?COMPLETED_MAYBE}) - end; -ifrid_to_name_helper(Id, ?IFR_ExceptionDef) -> - case mnesia:dirty_index_read(ir_ExceptionDef, Id, #ir_ExceptionDef.id) of - [#ir_ExceptionDef{absolute_name = [$:,$:|N]}] -> - change_colons_to_underscore(N, []); - Other -> - orber:dbg("[~p] cdr_decode:ifrid_to_name(~p). IFR Id not found: ~p", - [?LINE, Id, Other], ?DEBUG_LEVEL), - corba:raise(#'UNKNOWN'{minor=(?CORBA_OMGVMCID bor 1), - completion_status=?COMPLETED_MAYBE}) - end. - -change_colons_to_underscore([$:, $: | T], Acc) -> - change_colons_to_underscore(T, [$_ |Acc]); -change_colons_to_underscore([H |T], Acc) -> - change_colons_to_underscore(T, [H |Acc]); -change_colons_to_underscore([], Acc) -> - lists:reverse(Acc). - -get_ifr_node([], _, _) -> - %% Were not able to contact any of the given nodes. - orber:dbg("[~p] cdr_decode:get_ifr_node([]). No Node available.", - [?LINE], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{minor=(?ORBER_VMCID bor 1), completion_status=?COMPLETED_MAYBE}); -get_ifr_node(Nodes, N, L) -> - Node = lists:nth(N, Nodes), - case catch corba:resolve_initial_references_remote("OrberIFR", [Node]) of - IFR when is_record(IFR, 'IOP_IOR') -> - IFR; - _ -> - %% Not able to commincate with the node. Try next one. - NewL = L-1, - get_ifr_node(lists:delete(Node, Nodes), rand:uniform(NewL), NewL) - end. - - -%%----------------------------------------------------------------- -%% Func: dec_objref/4 -%%----------------------------------------------------------------- -dec_objref(Version, Message, Len, ByteOrder) -> - dec_objref(Version, Message, Len, ByteOrder, [], 0). -dec_objref(Version, Message, Len, ByteOrder, _Buff, C) -> - {IOR, Rest, Length} = iop_ior:decode(Version, Message, Len, ByteOrder), - {IOR, Rest, Length, C+Length-Len}. - -%%----------------------------------------------------------------- -%% Func: dec_system_exception/4 and dec_user_exception/4 -%%----------------------------------------------------------------- -dec_system_exception(Version, Message, Len, ByteOrder) when Version == {1,2} -> - {Rest0, Len0, _Counter} = dec_align(Message, Len, 8, Len), - {TypeId, Rest1, Len1} = dec_type({'tk_string', 0}, Version, Rest0, Len0, ByteOrder), - Name = orber_exceptions:get_name(TypeId, ?SYSTEM_EXCEPTION), - {Struct, _Rest2, Len2} = - dec_exception_1(Version, [{"minor",'tk_ulong'}, - {"completed", - {'tk_enum', "", "completion_status", - ["COMPLETED_YES", "COMPLETED_NO", - "COMPLETED_MAYBE"]}}], - Rest1, Len1, ByteOrder), - {list_to_tuple([Name, "" |Struct]), Len2}; -dec_system_exception(Version, Message, Len, ByteOrder) -> - {TypeId, Rest1, Len1} = dec_type({'tk_string', 0}, Version, Message, Len, ByteOrder), - Name = orber_exceptions:get_name(TypeId, ?SYSTEM_EXCEPTION), - {Struct, _Rest2, Len2} = - dec_exception_1(Version, [{"minor",'tk_ulong'}, - {"completed", - {'tk_enum', "", "completion_status", - ["COMPLETED_YES", "COMPLETED_NO", - "COMPLETED_MAYBE"]}}], - Rest1, Len1, ByteOrder), - {list_to_tuple([Name, "" |Struct]), Len2}. - -dec_user_exception(Version, Message, Len, ByteOrder) when Version == {1,2} -> - {Rest0, Len0, _Counter} = dec_align(Message, Len, 8, Len), - {TypeId, Rest1, Len1} = dec_type({'tk_string', 0}, Version, Rest0, Len0, ByteOrder), - Name = ifrid_to_name(TypeId, ?IFR_ExceptionDef), - {'tk_except', _, _, ElementList} = get_user_exception_type(TypeId), - {Struct, _Rest2, Len2} = dec_exception_1(Version, ElementList, Rest1, Len1, - ByteOrder), - {list_to_tuple([Name, TypeId |Struct]), Len2}; -dec_user_exception(Version, Message, Len, ByteOrder) -> - {TypeId, Rest1, Len1} = dec_type({'tk_string', 0}, Version, Message, Len, ByteOrder), - Name = ifrid_to_name(TypeId, ?IFR_ExceptionDef), - {'tk_except', _, _, ElementList} = get_user_exception_type(TypeId), - {Struct, _Rest2, Len2} = dec_exception_1(Version, ElementList, Rest1, Len1, - ByteOrder), - {list_to_tuple([Name, TypeId |Struct]), Len2}. - -dec_exception_1(_, [], Message, Len, _ByteOrder) -> - {[], Message, Len}; -dec_exception_1(Version, [{_ElemName, ElemType} | ElementList], Message, - Len, ByteOrder) -> - {Element, Rest, Len1} = dec_type(ElemType, Version, Message, Len, ByteOrder), - {Struct, Rest1, Len2} = dec_exception_1(Version, ElementList, Rest, Len1, - ByteOrder), - {[Element |Struct], Rest1, Len2}. - - -get_user_exception_type(TypeId) -> - case orber:light_ifr() of - true -> - orber_ifr:get_tc(TypeId, ?IFR_ExceptionDef); - false -> - case orber:get_lightweight_nodes() of - false -> - case mnesia:dirty_index_read(ir_ExceptionDef, TypeId, - #ir_ExceptionDef.id) of - [ExcDef] when is_record(ExcDef, ir_ExceptionDef) -> - ExcDef#ir_ExceptionDef.type; - Other -> - orber:dbg("[~p] cdr_decode:get_user_exception_type(~p). IFR Id not found: ~p", - [?LINE, TypeId, Other], ?DEBUG_LEVEL), - corba:raise(#'UNKNOWN'{minor=(?CORBA_OMGVMCID bor 1), - completion_status=?COMPLETED_MAYBE}) - end; - Nodes -> - L = length(Nodes), - IFR = get_ifr_node(Nodes, rand:uniform(L), L), - 'OrberApp_IFR':get_user_exception_type(IFR, TypeId) - end - end. - -%%----------------------------------------------------------------- -%% Func: dec_type_code/4 -%%----------------------------------------------------------------- -dec_type_code(Version, Message, Len, ByteOrder, Buff, C) -> - {TypeNo, Message1, Len1, NewC} = dec_type('tk_ulong', Version, Message, Len, ByteOrder, Buff, C), - TC = dec_type_code(TypeNo, Version, Message1, Len1, ByteOrder, Buff, NewC), - erase(orber_indirection), - TC. - -%%----------------------------------------------------------------- -%% Func: dec_type_code/5 -%%----------------------------------------------------------------- -dec_type_code(0, _, Message, Len, _, _, C) -> - {'tk_null', Message, Len, C}; -dec_type_code(1, _, Message, Len, _, _, C) -> - {'tk_void', Message, Len, C}; -dec_type_code(2, _, Message, Len, _, _, C) -> - {'tk_short', Message, Len, C}; -dec_type_code(3, _, Message, Len, _, _, C) -> - {'tk_long', Message, Len, C}; -dec_type_code(23, _, Message, Len, _, _, C) -> - {'tk_longlong', Message, Len, C}; -dec_type_code(25, _, Message, Len, _, _, C) -> - {'tk_longdouble', Message, Len, C}; -dec_type_code(4, _, Message, Len, _, _, C) -> - {'tk_ushort', Message, Len, C}; -dec_type_code(5, _, Message, Len, _, _, C) -> - {'tk_ulong', Message, Len, C}; -dec_type_code(24, _, Message, Len, _, _, C) -> - {'tk_ulonglong', Message, Len, C}; -dec_type_code(6, _, Message, Len, _, _, C) -> - {'tk_float', Message, Len, C}; -dec_type_code(7, _, Message, Len, _, _, C) -> - {'tk_double', Message, Len, C}; -dec_type_code(8, _, Message, Len, _, _, C) -> - {'tk_boolean', Message, Len, C}; -dec_type_code(9, _, Message, Len, _, _, C) -> - {'tk_char', Message, Len, C}; -dec_type_code(26, _, Message, Len, _, _, C) -> - {'tk_wchar', Message, Len, C}; -dec_type_code(10, _, Message, Len, _, _, C) -> - {'tk_octet', Message, Len, C}; -dec_type_code(11, _, Message, Len, _, _, C) -> - {'tk_any', Message, Len, C}; -dec_type_code(12, _, Message, Len, _, _, C) -> - {'tk_TypeCode', Message, Len, C}; -dec_type_code(13, _, Message, Len, _, _, C) -> - {'tk_Principal', Message, Len, C}; -dec_type_code(14, Version, Message, Len, ByteOrder, Buff, C) -> - {ComplexParams, Message1, Len1, Ex} = decode_complex_tc_parameters(Version, Message, Len, ByteOrder), - %% Decode marshalled parameters, eg get the byteorder first - {ByteOrder1, Rest1} = dec_byte_order(ComplexParams), - {{RepId, Name}, <<>>, _Len2, NewC} = - dec_type({'tk_struct', "", "", [{"repository ID", {'tk_string', 0}}, - {"name", {'tk_string', 0}}]}, - Version, Rest1, 1, ByteOrder1, Buff, C+1+Ex), - {{'tk_objref', RepId, Name}, Message1, Len1, NewC}; -dec_type_code(15, Version, Message, Len, ByteOrder, Buff, C) -> - {ComplexParams, Message1, Len1, Ex} = decode_complex_tc_parameters(Version, Message, Len, ByteOrder), - %% Decode marshalled parameters, eg get the byteorder first - {ByteOrder1, Rest1} = dec_byte_order(ComplexParams), - {{RepId, Name, ElementList}, <<>>, _Len2, NewC} = - dec_type({'tk_struct', "", "", - [{"repository ID", {'tk_string', 0}}, - {"name", {'tk_string', 0}}, - {"element list", - {'tk_sequence', {'tk_struct', "","", - [{"member name", {'tk_string', 0}}, - {"member type", 'tk_TypeCode'}]}, - 0}}]}, - Version, Rest1, 1, ByteOrder1, Buff, C+1+Ex), - {{'tk_struct', RepId, Name, ElementList}, Message1, Len1, NewC}; -dec_type_code(16, Version, Message, Len, ByteOrder, Buff, C) -> - {ComplexParams, Message1, Len1, Ex} = decode_complex_tc_parameters(Version, Message, Len, ByteOrder), - %% Decode marshalled parameters, eg get the byteorder first - {ByteOrder1, Rest1} = dec_byte_order(ComplexParams), - {{RepId, Name, DiscrTC, Default}, Rest2, RestLen2, NewC} = - dec_type({'tk_struct', "", "", - [{"repository ID", {'tk_string', 0}}, - {"name", {'tk_string', 0}}, - {"discriminant type", 'tk_TypeCode'}, - {"default used", 'tk_long'}]}, - Version, Rest1, 1, ByteOrder1, Buff, C+1+Ex), - {ElementList, <<>>, _RestLen3, NewC2} = - dec_type({'tk_sequence', {'tk_struct', "","", - [{"label value", DiscrTC}, - {"member name", {'tk_string', 0}}, - {"member type", 'tk_TypeCode'}]}, 0}, - Version, Rest2, RestLen2, ByteOrder1, Buff, NewC), - NewElementList = - case check_enum(DiscrTC) of - true -> - lists:map(fun({L,N,T}) -> {atom_to_list(L),N,T} end, ElementList); - false -> - ElementList - end, - {{'tk_union', RepId, Name, DiscrTC, Default, NewElementList}, Message1, Len1, NewC2}; -dec_type_code(17, Version, Message, Len, ByteOrder, Buff, C) -> - {ComplexParams, Message1, Len1, Ex} = decode_complex_tc_parameters(Version, Message, Len, ByteOrder), - %% Decode marshalled parameters, eg get the byteorder first - {ByteOrder1, Rest1} = dec_byte_order(ComplexParams), - {{RepId, Name, ElementList}, <<>>, _Len2, NewC} = - dec_type({'tk_struct', "", "", - [{"repository ID", {'tk_string', 0}}, - {"name", {'tk_string', 0}}, - {"element list", - {'tk_sequence', {'tk_string', 0}, 0}}]}, - Version, Rest1, 1, ByteOrder1, Buff, C+1+Ex), - {{'tk_enum', RepId, Name, ElementList}, Message1, Len1, NewC}; -dec_type_code(18, Version, Message, Len, ByteOrder, Buff, C) -> - {MaxLength, Message1, Len1, NewC} = - dec_type('tk_ulong', Version, Message, Len, ByteOrder, Buff, C), - {{'tk_string', MaxLength}, Message1, Len1, NewC}; -dec_type_code(19, Version, Message, Len, ByteOrder, Buff, C) -> - {ComplexParams, Message1, Len1, Ex} = decode_complex_tc_parameters(Version, Message, Len, ByteOrder), - %% Decode marshalled parameters, eg get the byteorder first - {ByteOrder1, Rest1} = dec_byte_order(ComplexParams), - {{ElemTC, MaxLength}, <<>>, _Len2, NewC} = - dec_type({'tk_struct', "", "", [{"element type", 'tk_TypeCode'}, - {"max length", 'tk_ulong'}]}, - Version, Rest1, 1, ByteOrder1, Buff, C+1+Ex), - {{'tk_sequence', ElemTC, MaxLength}, Message1, Len1, NewC}; -dec_type_code(20, Version, Message, Len, ByteOrder, Buff, C) -> - {ComplexParams, Message1, Len1, Ex} = decode_complex_tc_parameters(Version, Message, Len, ByteOrder), - %% Decode marshalled parameters, eg get the byteorder first - {ByteOrder1, Rest1} = dec_byte_order(ComplexParams), - {{ElemTC, Length}, <<>>, _Len2, NewC} = - dec_type({'tk_struct', "", "", [{"element type", 'tk_TypeCode'}, - {"length", 'tk_ulong'}]}, - Version, Rest1, 1, ByteOrder1, Buff, C+1+Ex), - {{'tk_array', ElemTC, Length}, Message1, Len1, NewC}; -dec_type_code(21, Version, Message, Len, ByteOrder, Buff, C) -> - {ComplexParams, Message1, Len1, Ex} = decode_complex_tc_parameters(Version, Message, Len, ByteOrder), - %% Decode marshalled parameters, eg ge a byteorder first - {ByteOrder1, Rest1} = dec_byte_order(ComplexParams), - {{RepId, Name, TC}, <<>>, _Len2, NewC} = - dec_type({'tk_struct', "", "", [{"repository ID", {'tk_string', 0}}, - {"name", {'tk_string', 0}}, - {"TypeCode", 'tk_TypeCode'}]}, - Version, Rest1, 1, ByteOrder1, Buff, C+1+Ex), - {{'tk_alias', RepId, Name, TC}, Message1, Len1, NewC}; -dec_type_code(22, Version, Message, Len, ByteOrder, Buff, C) -> - {ComplexParams, Message1, Len1, Ex} = decode_complex_tc_parameters(Version, Message, Len, ByteOrder), - %% Decode marshalled parameters, eg get the byteorder first - {ByteOrder1, Rest1} = dec_byte_order(ComplexParams), - {{RepId, Name, ElementList}, <<>>, _Len2, NewC} = - dec_type({'tk_struct', "", "", - [{"repository ID", {'tk_string', 0}}, - {"name", {'tk_string', 0}}, - {"element list", - {'tk_sequence', {'tk_struct', "","", - [{"member name", {'tk_string', 0}}, - {"member type", 'tk_TypeCode'}]}, - 0}}]}, - Version, Rest1, 1, ByteOrder1, Buff, C+1+Ex), - {{'tk_except', RepId, Name, ElementList}, Message1, Len1, NewC}; -dec_type_code(27, Version, Message, Len, ByteOrder, Buff, C) -> - {MaxLength, Message1, Len1, NewC} = - dec_type('tk_ulong', Version, Message, Len, ByteOrder, Buff, C), - {{'tk_wstring', MaxLength}, Message1, Len1, NewC}; -dec_type_code(28, Version, Message, Len, ByteOrder, Buff, C) -> - {Digits, Message1, Len1, C1} = - dec_type('tk_ushort', Version, Message, Len, ByteOrder, Buff, C), - {Scale, Message2, Len2, C2} = - dec_type('tk_short', Version, Message1, Len1, ByteOrder, Buff, C1), - {{'tk_fixed', Digits, Scale}, Message2, Len2, C2}; -dec_type_code(29, Version, Message, Len, ByteOrder, Buff, C) -> - {ComplexParams, Message1, Len1, Ex} = decode_complex_tc_parameters(Version, Message, Len, ByteOrder), - {ByteOrder1, Rest1} = dec_byte_order(ComplexParams), - {{RepId, Name, ValueModifier, TC, ElementList}, <<>>, _Len2, NewC} = - dec_type({'tk_struct', "", "", [{"repository ID", {'tk_string', 0}}, - {"name", {'tk_string', 0}}, - {"ValueModifier", 'tk_short'}, - {"TypeCode", 'tk_TypeCode'}, - {"element list", - {'tk_sequence', - {'tk_struct', "","", - [{"member name", {'tk_string', 0}}, - {"member type", 'tk_TypeCode'}, - {"Visibility", 'tk_short'}]}, - 0}}]}, - Version, Rest1, 1, ByteOrder1, Buff, C+1+Ex), - {{'tk_value', RepId, Name, ValueModifier, TC, ElementList}, Message1, Len1, NewC}; -dec_type_code(30, Version, Message, Len, ByteOrder, Buff, C) -> - {ComplexParams, Message1, Len1, Ex} = decode_complex_tc_parameters(Version, Message, Len, ByteOrder), - {ByteOrder1, Rest1} = dec_byte_order(ComplexParams), - {{RepId, Name, TC}, <<>>, _Len2, NewC} = - dec_type({'tk_struct', "", "", [{"repository ID", {'tk_string', 0}}, - {"name", {'tk_string', 0}}, - {"TypeCode", 'tk_TypeCode'}]}, - Version, Rest1, 1, ByteOrder1, Buff, C+1+Ex), - {{'tk_value_box', RepId, Name, TC}, Message1, Len1, NewC}; -dec_type_code(31, Version, Message, Len, ByteOrder, Buff, C) -> - {ComplexParams, Message1, Len1, Ex} = decode_complex_tc_parameters(Version, Message, Len, ByteOrder), - {ByteOrder1, Rest1} = dec_byte_order(ComplexParams), - {{RepId, Name}, <<>>, _Len2, NewC} = - dec_type({'tk_struct', "", "", [{"repository ID", {'tk_string', 0}}, - {"name", {'tk_string', 0}}]}, - Version, Rest1, 1, ByteOrder1, Buff, C+1+Ex), - {{'tk_native', RepId, Name}, Message1, Len1, NewC}; -dec_type_code(32, Version, Message, Len, ByteOrder, Buff, C) -> - {ComplexParams, Message1, Len1, Ex} = decode_complex_tc_parameters(Version, Message, Len, ByteOrder), - {ByteOrder1, Rest1} = dec_byte_order(ComplexParams), - {{RepId, Name}, <<>>, _Len2, NewC} = - dec_type({'tk_struct', "", "", [{"RepositoryId", {'tk_string', 0}}, - {"name", {'tk_string', 0}}]}, - Version, Rest1, 1, ByteOrder1, Buff, C+1+Ex), - {{'tk_abstract_interface', RepId, Name}, Message1, Len1, NewC}; -dec_type_code(33, Version, Message, Len, ByteOrder, Buff, C) -> - {ComplexParams, Message1, Len1, Ex} = decode_complex_tc_parameters(Version, Message, Len, ByteOrder), - {ByteOrder1, Rest1} = dec_byte_order(ComplexParams), - {{RepId, Name}, <<>>, _Len2, NewC} = - dec_type({'tk_struct', "", "", [{"RepositoryId", {'tk_string', 0}}, - {"name", {'tk_string', 0}}]}, - Version, Rest1, 1, ByteOrder1, Buff, C+1+Ex), - {{'tk_local_interface', RepId, Name}, Message1, Len1, NewC}; -dec_type_code(16#ffffffff, Version, Message, Len, ByteOrder, Buff, C) -> - {Indirection, Message1, Len1, NewC} = - dec_type('tk_long', Version, Message, Len, ByteOrder, Buff, C), - Position = C+Indirection, - case put(orber_indirection, Position) of - Position -> -%% {{'none', Indirection}, Message1, Len1, NewC}; - %% Recursive TypeCode. Break the loop. - orber:dbg("[~p] cdr_decode:dec_type_code(~p); Recursive TC not supported.", - [?LINE,Position], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_NO}); - _ -> - <<_:Position/binary, SubBuff/binary>> = Buff, - {TC, _, _, _} = dec_type_code(Version, SubBuff, Position, ByteOrder, Buff, Position), - {TC, Message1, Len1, NewC} - end; -dec_type_code(Type, _, _, _, _, _, _) -> - orber:dbg("[~p] cdr_decode:dec_type_code(~p); No match.", - [?LINE, Type], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 8), completion_status=?COMPLETED_MAYBE}). - -check_enum({'tk_enum', _, _, _}) -> - true; -check_enum(_) -> - false. - - -decode_complex_tc_parameters(_Version, Message, Len, ByteOrder) -> - {Rest, Len1, NewC} = dec_align(Message, Len, 4, 0), - {Size, Rest1} = cdrlib:dec_unsigned_long(ByteOrder, Rest), - <> = Rest1, - {OctetSeq, Rest2, Len1+4+Size, NewC+4}. - -%%----------------------------------------------------------------- -%% Func: dec_align/3 -%% Args: -%% R - The byte sequence that shall be aligned. -%% Len - The number of bytes read so far. -%% Alignment - The alignment as an integer (for example: 2,4,8). -%% Returns: -%% An aligned byte sequence. -%%----------------------------------------------------------------- -dec_align(R, Len, Alignment, C) -> - Rem = Len rem Alignment, - if Rem == 0 -> - {R, Len, C}; - true -> - Diff = Alignment - Rem, - <<_:Diff/binary,Rest/binary>> = R, - {Rest, Len + Diff, C + Diff} - end. - -%%---------------- EOF MODULE ---------------------------------------- diff --git a/lib/orber/src/cdr_encode.erl b/lib/orber/src/cdr_encode.erl deleted file mode 100644 index 2c42d5bd7e..0000000000 --- a/lib/orber/src/cdr_encode.erl +++ /dev/null @@ -1,1172 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2017. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: cdr_encode.erl -%% -%% Description: -%% This file contains all encoding functions for the CDR -%% format. -%% -%%----------------------------------------------------------------- --module(cdr_encode). - --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([enc_giop_msg_type/1, - enc_request/1, enc_request_split/1, - enc_reply/1, enc_reply_split/1, - enc_type/3, enc_type/5, - enc_cancel_request/1, - enc_locate_request/1, - enc_locate_reply/1, - enc_close_connection/1, - enc_message_error/1, - enc_fragment/1, - enc_giop_message_header/5, - validate_request_body/1, - validate_reply_body/2]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% Macros -%%----------------------------------------------------------------- --define(DEBUG_LEVEL, 9). - --define(ODD(N), (N rem 2) == 1). - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: enc_giop_message_header/5 -%%----------------------------------------------------------------- -%% The header size is known so we know that the size will be aligned. -%% MessSize already includes the header length. -%%----------------------------------------------------------------- -enc_giop_message_header(#giop_env{version = {Major,Minor}}, MessType, - _Flags, MessSize, Message) -> - Type = enc_giop_msg_type(MessType), - %% The Flag handling must be fixed, i.e., it's not correct to only use '0'. - %% If IIOP-1.0 a boolean (FALSE == 0), otherwise, IIOP-1.1 or 1.2, - %% an octet. The octet bits represents: - %% * The least significant the byteorder (0 eq. big-endian) - %% * The second least significant indicates if the message is fragmented. - %% If set to 0 it's not fragmented. - %% * The most significant 6 bits are reserved. Hence, must be set to 0. - %% Since we currently don't support fragmented messages and we always - %% encode using big-endian it's ok to use '0' for now. - list_to_binary([ <<"GIOP",Major:8,Minor:8,0:8, - Type:8,MessSize:32/big-unsigned-integer>> | Message]). - -enc_byte_order(Env, Message) -> - enc_type('tk_boolean', Env, 'false', Message, 0). - -%%----------------------------------------------------------------- -%% Func: enc_parameters/2 -%%----------------------------------------------------------------- -enc_parameters(_, [], [], Message, Len) -> - {Message, Len}; -enc_parameters(_, [], P, _, _) -> - orber:dbg("[~p] cdr_encode:encode_parameters(~p); to many parameters.", - [?LINE, P], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 17), completion_status=?COMPLETED_MAYBE}); -enc_parameters(_, _, [], TC, _) -> - orber:dbg("[~p] cdr_encode:encode_parameters(~p); to few parameters.", - [?LINE, TC], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 17), completion_status=?COMPLETED_MAYBE}); -enc_parameters(Env, [PT1 |TypeList], [ P1 | Parameters], Message, Len) -> - {Message1, Len1} = enc_type(PT1, Env, P1, Message, Len), - enc_parameters(Env, TypeList, Parameters, Message1, Len1). - -%%----------------------------------------------------------------- -%% Func: enc_request/8 -%%----------------------------------------------------------------- -%% ## NEW IIOP 1.2 ## -enc_request(#giop_env{version = {1,2}} = Env) -> - Flags = 1, %% LTH Not correct, just placeholder - {Message, Len} = enc_request_id(Env, [], ?GIOP_HEADER_SIZE), - {Message1, Len1} = enc_response_flags(Env, Message, Len), - {Message2, Len2} = enc_reserved(Env, {0,0,0}, Message1, Len1), - {Message3, Len3} = enc_target_address(Env, Message2, Len2), - {Message4, Len4} = enc_operation(Env, Message3, Len3), - {Message5, Len5} = enc_service_context(Env, Message4, Len4), - {Message6, Len6} = enc_request_body(Env, Message5, Len5), - enc_giop_message_header(Env, 'request', Flags, Len6 - ?GIOP_HEADER_SIZE, - lists:reverse(Message6)); -enc_request(#giop_env{version = Version} = Env) -> - Flags = 1, %% LTH Not correct, just placeholder - {Message0, Len0} = enc_service_context(Env, [], ?GIOP_HEADER_SIZE), - {Message, Len} = enc_request_id(Env, Message0, Len0), - {Message1, Len1} = enc_response(Env, Message, Len), - {Message1b, Len1b} = - if - Version /= {1,0} -> - enc_reserved(Env, {0,0,0}, Message1, Len1); - true -> - {Message1, Len1} - end, - {Message2, Len2} = enc_object_key(Env, Message1b, Len1b), - {Message3, Len3} = enc_operation(Env, Message2, Len2), - {Message4, Len4} = enc_principal(Env, Message3, Len3), - {Message5, Len5} = enc_request_body(Env, Message4, Len4), - enc_giop_message_header(Env, 'request', Flags, Len5 - ?GIOP_HEADER_SIZE, - lists:reverse(Message5)). - -%% ## NEW IIOP 1.2 ## -enc_request_split(#giop_env{version = {1,2}} = Env) -> - Flags = 1, %% LTH Not correct, just placeholder - {Message, Len} = enc_request_id(Env, [], ?GIOP_HEADER_SIZE), - {Message1, Len1} = enc_response_flags(Env, Message, Len), - {Message2, Len2} = enc_reserved(Env, {0,0,0}, Message1, Len1), - {Message3, Len3} = enc_target_address(Env, Message2, Len2), - {Message4, Len4} = enc_operation(Env, Message3, Len3), - {Message5, Len5} = enc_service_context(Env, Message4, Len4), - {Body, Len6} = enc_request_body(Env, [], Len5), - {lists:reverse(Message5), list_to_binary(lists:reverse(Body)), - Len5 - ?GIOP_HEADER_SIZE, Len6-Len5, Flags}; -enc_request_split(#giop_env{version = Version} = Env) -> - Flags = 1, %% LTH Not correct, just placeholder - {Message0, Len0} = enc_service_context(Env, [], ?GIOP_HEADER_SIZE), - {Message, Len} = enc_request_id(Env, Message0, Len0), - {Message1, Len1} = enc_response(Env, Message, Len), - {Message1b, Len1b} = - if - Version /= {1,0} -> - enc_reserved(Env, {0,0,0}, Message1, Len1); - true -> - {Message1, Len1} - end, - {Message2, Len2} = enc_object_key(Env, Message1b, Len1b), - {Message3, Len3} = enc_operation(Env, Message2, Len2), - {Message4, Len4} = enc_principal(Env, Message3, Len3), - {Body, Len5} = enc_request_body(Env, [], Len4), - {lists:reverse(Message4), list_to_binary(lists:reverse(Body)), - Len4 - ?GIOP_HEADER_SIZE, Len5-Len4, Flags}. - -enc_principal(Env, Mess, Len) -> - enc_type({'tk_string', 0}, Env, atom_to_list(node()), Mess, Len). - -enc_operation(Env, Mess, Len) -> - enc_type({'tk_string', 0}, Env, atom_to_list(Env#giop_env.op), Mess, Len). - -enc_object_key(Env, Mess, Len) -> - enc_type({'tk_sequence', 'tk_octet', 0}, Env, Env#giop_env.objkey, Mess, Len). - -enc_reserved(Env, Reserved, Mess, Len) -> - enc_type({'tk_array', 'tk_octet', 3}, Env, Reserved, Mess, Len). - -enc_response(Env, Mess, Len) -> - enc_type('tk_boolean', Env, Env#giop_env.response_expected, Mess, Len). - -enc_request_id(Env, Mess, Len) -> - enc_type('tk_ulong', Env, Env#giop_env.request_id, Mess, Len). - -enc_service_context(Env, Message, Len) -> - Ctxs = enc_used_contexts(Env, Env#giop_env.ctx, []), - enc_type(?IOP_SERVICECONTEXT, Env, Ctxs, Message, Len). - -enc_used_contexts(_Env, [], Message) -> - Message; -enc_used_contexts(#giop_env{version = {1, 0}} = Env, - [#'IOP_ServiceContext'{context_id=?IOP_CodeSets}|T], Ctxs) -> - %% Not supported by 1.0, drop it. - enc_used_contexts(Env, T, Ctxs); -enc_used_contexts(Env, [#'IOP_ServiceContext'{context_id=?IOP_CodeSets, - context_data = CodeSetCtx}|T], - Ctxs) -> - %% Encode ByteOrder - {Bytes0, Len0} = cdr_encode:enc_type('tk_octet', Env, 0, [], 0), - {Bytes1, _Len1} = enc_type(?CONV_FRAME_CODESETCONTEXT, Env, CodeSetCtx, - Bytes0, Len0), - Bytes = list_to_binary(lists:reverse(Bytes1)), - enc_used_contexts(Env, T, - [#'IOP_ServiceContext'{context_id=?IOP_CodeSets, - context_data = Bytes}|Ctxs]); -enc_used_contexts(Env, [#'IOP_ServiceContext'{context_id=?IOP_BI_DIR_IIOP, - context_data = BiDirCtx}|T], - Ctxs) -> - %% Encode ByteOrder - {Bytes0, Len0} = cdr_encode:enc_type('tk_octet', Env, 0, [], 0), - {Bytes1, _Len1} = enc_type(?IIOP_BIDIRIIOPSERVICECONTEXT, Env, BiDirCtx, - Bytes0, Len0), - Bytes = list_to_binary(lists:reverse(Bytes1)), - enc_used_contexts(Env, T, - [#'IOP_ServiceContext'{context_id=?IOP_BI_DIR_IIOP, - context_data = Bytes}|Ctxs]); -enc_used_contexts(Env, [#'IOP_ServiceContext'{context_id=?IOP_FT_REQUEST, - context_data = Ctx}|T], - Ctxs) -> - %% Encode ByteOrder - {Bytes0, Len0} = cdr_encode:enc_type('tk_octet', Env, 0, [], 0), - {Bytes1, _Len1} = enc_type(?FT_FTRequestServiceContext, Env, Ctx, - Bytes0, Len0), - Bytes = list_to_binary(lists:reverse(Bytes1)), - enc_used_contexts(Env, T, - [#'IOP_ServiceContext'{context_id=?IOP_FT_REQUEST, - context_data = Bytes}|Ctxs]); -enc_used_contexts(Env, [#'IOP_ServiceContext'{context_id=?IOP_FT_GROUP_VERSION, - context_data = Ctx}|T], - Ctxs) -> - %% Encode ByteOrder - {Bytes0, Len0} = cdr_encode:enc_type('tk_octet', Env, 0, [], 0), - {Bytes1, _Len1} = enc_type(?FT_FTGroupVersionServiceContext, Env, Ctx, - Bytes0, Len0), - Bytes = list_to_binary(lists:reverse(Bytes1)), - enc_used_contexts(Env, T, - [#'IOP_ServiceContext'{context_id=?IOP_FT_GROUP_VERSION, - context_data = Bytes}|Ctxs]); -enc_used_contexts(Env, [#'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, - context_data = Ctx}|T], - Ctxs) -> - %% Encode ByteOrder - {Bytes0, Len0} = cdr_encode:enc_type('tk_octet', Env, 0, [], 0), - {Bytes1, _Len1} = enc_type(?CSI_SASContextBody, Env, Ctx, - Bytes0, Len0), - Bytes = list_to_binary(lists:reverse(Bytes1)), - enc_used_contexts(Env, T, - [#'IOP_ServiceContext'{context_id=?IOP_SecurityAttributeService, - context_data = Bytes}|Ctxs]); -enc_used_contexts(Env, [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, - context_data = {interface, _I}}|T], - Ctxs) -> - %% This shall not be forwarded. - enc_used_contexts(Env, T, Ctxs); -enc_used_contexts(Env, [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, - context_data = {configuration, _O}}|T], - Ctxs) -> - %% This shall not be forwarded. - enc_used_contexts(Env, T, Ctxs); -enc_used_contexts(Env, [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, - context_data = Ctx}|T], - Ctxs) -> - %% Encode ByteOrder - {Bytes0, Len0} = cdr_encode:enc_type('tk_octet', Env, 0, [], 0), - {Bytes1, _Len1} = enc_type(?ORBER_GENERIC_CTX, Env, - binary_to_list(term_to_binary(Ctx)), - Bytes0, Len0), - Bytes = list_to_binary(lists:reverse(Bytes1)), - enc_used_contexts(Env, T, - [#'IOP_ServiceContext'{context_id=?ORBER_GENERIC_CTX_ID, - context_data = Bytes}|Ctxs]); -enc_used_contexts(Env, [H|T], Ctxs) -> - enc_used_contexts(Env, T, [H|Ctxs]). - -%% ## NEW IIOP 1.2 ## -enc_target_address(#giop_env{objkey = TargetAddr} = Env, Mess, Len) - when is_record(TargetAddr, 'GIOP_TargetAddress') -> - enc_type(?TARGETADDRESS, Env, TargetAddr, Mess, Len); -enc_target_address(#giop_env{objkey = IORInfo} = Env, Mess, Len) - when is_record(IORInfo, 'GIOP_IORAddressingInfo') -> - enc_type(?TARGETADDRESS, Env, #'GIOP_TargetAddress'{label = ?GIOP_ReferenceAddr, - value = IORInfo}, - Mess, Len); -enc_target_address(#giop_env{objkey = TP} = Env, Mess, Len) - when is_record(TP, 'IOP_TaggedProfile') -> - enc_type(?TARGETADDRESS, Env, #'GIOP_TargetAddress'{label = ?GIOP_ProfileAddr, - value = TP}, - Mess, Len); -enc_target_address(#giop_env{objkey = ObjKey} = Env, Mess, Len) -> - enc_type(?TARGETADDRESS, Env, #'GIOP_TargetAddress'{label = ?GIOP_KeyAddr, - value = ObjKey}, - Mess, Len). - -%% FIX ME!! This is temporary, not proper flag handling. -enc_response_flags(#giop_env{response_expected = true} = Env, Mess, Len) -> - enc_type('tk_octet', Env, 3, Mess, Len); -enc_response_flags(#giop_env{response_expected = false} = Env, Mess, Len) -> - enc_type('tk_octet', Env, 0, Mess, Len). - -%%----------------------------------------------------------------- -%% Func: enc_request_body/5 -%%----------------------------------------------------------------- -enc_request_body(#giop_env{tc = {_, [], _}}, Message, Len) -> - %% This case is used to avoid adding alignment even though no body will be added. - {Message, Len}; -enc_request_body(#giop_env{version = {1,2}, - tc = {_RetType, InParameters, _OutParameters}, - parameters = Parameters} = Env, - Message, Len) -> - {Message1, Len1} = enc_align(Message, Len, 8), - enc_parameters(Env, InParameters, Parameters, Message1, Len1); -enc_request_body(#giop_env{tc = {_RetType, InParameters, _OutParameters}, - parameters = Parameters} = Env, - Message, Len) -> - enc_parameters(Env, InParameters, Parameters, Message, Len). - -%%----------------------------------------------------------------- -%% Func: validate_request_body/1 -%%----------------------------------------------------------------- -validate_request_body(#giop_env{tc = {_RetType, InParameters, _OutParameters}, - parameters = Parameters} = Env) -> - enc_parameters(Env, InParameters, Parameters, [], 0). - -%%----------------------------------------------------------------- -%% Func: enc_reply/6 -%%----------------------------------------------------------------- -%% ## NEW IIOP 1.2 ## -enc_reply(#giop_env{version = {1,2}} = Env) -> - Flags = 1, %% LTH Not correct, just placeholder - {Message, Len} = enc_request_id(Env, [], ?GIOP_HEADER_SIZE), - {Message1, Len1} = enc_reply_status(Env, Message, Len), - {Message2, Len2} = enc_service_context(Env, Message1, Len1), - {Message3, Len3} = enc_reply_body(Env, Message2, Len2), - enc_giop_message_header(Env, 'reply', Flags, Len3 - ?GIOP_HEADER_SIZE, - lists:reverse(Message3)); -enc_reply(Env) -> - Flags = 1, %% LTH Not correct, just placeholder - {Message, Len} = enc_service_context(Env, [], ?GIOP_HEADER_SIZE), - {Message1, Len1} = enc_request_id(Env, Message, Len), - {Message2, Len2} = enc_reply_status(Env, Message1, Len1), - {Message3, Len3} = enc_reply_body(Env, Message2, Len2), - enc_giop_message_header(Env, 'reply', Flags, Len3 - ?GIOP_HEADER_SIZE, - lists:reverse(Message3)). - -%% ## NEW IIOP 1.2 ## -enc_reply_split(#giop_env{version = {1,2}} = Env) -> - Flags = 1, %% LTH Not correct, just placeholder - {Message, Len0} = enc_request_id(Env, [], ?GIOP_HEADER_SIZE), - {Message1, Len1} = enc_reply_status(Env, Message, Len0), - {Message2, Len2} = enc_service_context(Env, Message1, Len1), - {Body, Len} = enc_reply_body(Env, [], Len2), - {lists:reverse(Message2), list_to_binary(lists:reverse(Body)), - Len2 - ?GIOP_HEADER_SIZE, Len-Len2, Flags}; -enc_reply_split(Env) -> - Flags = 1, %% LTH Not correct, just placeholder - {Message, Len0} = enc_service_context(Env, [], ?GIOP_HEADER_SIZE), - {Message1, Len1} = enc_request_id(Env, Message, Len0), - {Message2, Len2} = enc_reply_status(Env, Message1, Len1), - {Body, Len} = enc_reply_body(Env, [], Len2), - {lists:reverse(Message2), list_to_binary(lists:reverse(Body)), - Len2 - ?GIOP_HEADER_SIZE, Len-Len2, Flags}. - -enc_reply_status(Env, Mess, Len) -> - L = enc_giop_reply_status_type(Env#giop_env.reply_status), - enc_type('tk_ulong', Env, L, Mess, Len). - -%%----------------------------------------------------------------- -%% Func: enc_reply_body/6 -%%----------------------------------------------------------------- -enc_reply_body(#giop_env{tc = {'tk_void', _, []}, result = ok, - parameters = []}, Message, Len) -> - %% This case is mainly to be able to avoid adding alignment for - %% IIOP-1.2 messages if the body should be empty, i.e., void return value and - %% no out parameters. - {Message, Len}; -enc_reply_body(#giop_env{version = {1,2}, - tc = {RetType, _InParameters, OutParameters}, - parameters = Parameters, result = Result} = Env, - Message, Len) -> - {Message1, Len1} = enc_align(Message, Len, 8), - {Message2, Len2} = enc_type(RetType, Env, Result, Message1, Len1), - enc_parameters(Env, OutParameters, Parameters, Message2, Len2); -enc_reply_body(#giop_env{tc = {RetType, _InParameters, OutParameters}, - parameters = Parameters, result = Result} = Env, - Message, Len) -> - {Message1, Len1} = enc_type(RetType, Env, Result, Message, Len), - enc_parameters(Env, OutParameters, Parameters, Message1, Len1). - - -%%----------------------------------------------------------------- -%% Func: validate_reply_body/3 -%%----------------------------------------------------------------- -validate_reply_body(Env, {'EXCEPTION', Exception}) -> - {TypeOfException, ExceptionTypeCode, NewExc} = - orber_exceptions:get_def(Exception), - {'tk_except', TypeOfException, ExceptionTypeCode, - (catch enc_reply_body(Env#giop_env{tc = {ExceptionTypeCode, [], []}, - result = NewExc, parameters = []}, [], 0))}; -validate_reply_body(#giop_env{tc = {_RetType, _InParameters, []}} = Env, Reply) -> - enc_reply_body(Env#giop_env{result = Reply}, [], 0); -validate_reply_body(Env, Reply) when is_tuple(Reply) -> - [Result|Parameters] = tuple_to_list(Reply), - enc_reply_body(Env#giop_env{result = Result, parameters = Parameters}, [], 0); -validate_reply_body(Env, Reply) -> - enc_reply_body(Env#giop_env{result = Reply}, [], 0). - -%%----------------------------------------------------------------- -%% Func: enc_cancel_request/2 -%%----------------------------------------------------------------- -enc_cancel_request(Env) -> - Flags = 1, %% LTH Not correct, just placeholder - {Message, Len} = enc_request_id(Env, [], ?GIOP_HEADER_SIZE), - enc_giop_message_header(Env, 'cancel_request', Flags, Len - ?GIOP_HEADER_SIZE, - lists:reverse(Message)). - -%%----------------------------------------------------------------- -%% Func: enc_locate_request/3 -%%----------------------------------------------------------------- -%% ## NEW IIOP 1.2 ## -enc_locate_request(#giop_env{version = {1,2}} = Env) -> - Flags = 1, %% LTH Not correct, just placeholder - {Message, Len} = enc_request_id(Env, [], ?GIOP_HEADER_SIZE), - {Message1, Len1} = enc_target_address(Env, Message, Len), - enc_giop_message_header(Env, 'locate_request', Flags, Len1-?GIOP_HEADER_SIZE, - lists:reverse(Message1)); -enc_locate_request(Env) -> - Flags = 1, %% LTH Not correct, just placeholder - {Message, Len} = enc_request_id(Env, [], ?GIOP_HEADER_SIZE), - {Message1, Len1} = enc_object_key(Env, Message, Len), - enc_giop_message_header(Env, 'locate_request', Flags, Len1-?GIOP_HEADER_SIZE, - lists:reverse(Message1)). - -%%----------------------------------------------------------------- -%% Func: enc_locate_reply -%%----------------------------------------------------------------- -%% No forward etc. Just encode the status. -enc_locate_reply(#giop_env{tc = undefined} = Env) -> - Flags = 1, %% LTH Not correct, just placeholder - {Message, Len} = enc_request_id(Env, [], ?GIOP_HEADER_SIZE), - {Message1, Len1} = enc_locate_status(Env, Message, Len), - enc_giop_message_header(Env, 'locate_reply', Flags, Len1 - ?GIOP_HEADER_SIZE, - lists:reverse(Message1)); -enc_locate_reply(Env) -> - Flags = 1, %% LTH Not correct, just placeholder - {Message, Len} = enc_request_id(Env, [], ?GIOP_HEADER_SIZE), - {Message1, Len1} = enc_locate_status(Env, Message, Len), - {Message2, Len2} = enc_locate_reply_body(Env, Message1, Len1), - enc_giop_message_header(Env, 'locate_reply', Flags, Len2 - ?GIOP_HEADER_SIZE, - lists:reverse(Message2)). - -enc_locate_reply_body(#giop_env{tc = TC, result = Data} = Env, Message, Len) -> - %% In CORBA-2.3.1 the LocateReply body didn't align the body (8-octet - %% boundry) for IIOP-1.2. This have been changed in later specs. - %% Un-comment the line below when we want to be CORBA-2.4 compliant. - %% But in CORB-2.6 this was changed once again (i.e. no alignment). - %% The best solution is to keep it as is. - enc_type(TC, Env, Data, Message, Len). - -enc_locate_status(Env, Mess, Len) -> - L = enc_giop_locate_status_type(Env#giop_env.reply_status), - enc_type('tk_ulong', Env, L, Mess, Len). -%%----------------------------------------------------------------- -%% Func: enc_close_connection/1 -%%----------------------------------------------------------------- -enc_close_connection(Env) -> - Flags = 1, %% LTH Not correct, just placeholder - enc_giop_message_header(Env, 'close_connection', Flags, 0, []). - -%%----------------------------------------------------------------- -%% Func: enc_message_error/1 -%%----------------------------------------------------------------- -enc_message_error(Env) -> - Flags = 1, %% LTH Not correct, just placeholder - enc_giop_message_header(Env, 'message_error', Flags, 0, []). - -%%----------------------------------------------------------------- -%% Func: enc_fragment/1 -%%----------------------------------------------------------------- -enc_fragment(Env) -> - Flags = 1, %% LTH Not correct, just placeholder - enc_giop_message_header(Env, 'fragment', Flags, 0, []). - -%%----------------------------------------------------------------- -%% Func: enc_giop_msg_type -%% Args: An integer message type code -%% Returns: An atom which is the message type code name -%%----------------------------------------------------------------- -enc_giop_msg_type('request') -> - 0; -enc_giop_msg_type('reply') -> - 1; -enc_giop_msg_type('cancel_request') -> - 2; -enc_giop_msg_type('locate_request') -> - 3; -enc_giop_msg_type('locate_reply') -> - 4; -enc_giop_msg_type('close_connection') -> - 5; -enc_giop_msg_type('message_error') -> - 6; -enc_giop_msg_type('fragment') -> - 7. - - -%%----------------------------------------------------------------- -%% Func: enc_giop_reply_status_type -%% Args: An atom which is the reply status -%% Returns: An integer status code -%%----------------------------------------------------------------- -enc_giop_reply_status_type(?NO_EXCEPTION) -> - 0; -enc_giop_reply_status_type(?USER_EXCEPTION) -> - 1; -enc_giop_reply_status_type(?SYSTEM_EXCEPTION) -> - 2; -enc_giop_reply_status_type('location_forward') -> - 3; -%% ## NEW IIOP 1.2 ## -enc_giop_reply_status_type('location_forward_perm') -> - 4; -enc_giop_reply_status_type('needs_addressing_mode') -> - 5. - -%%----------------------------------------------------------------- -%% Func: enc_giop_locate_status_type -%% Args: An integer status code -%% Returns: An atom which is the reply status -%%----------------------------------------------------------------- -enc_giop_locate_status_type('unknown_object') -> - 0; -enc_giop_locate_status_type('object_here') -> - 1; -enc_giop_locate_status_type('object_forward') -> - 2; -%% ## NEW IIOP 1.2 ## -enc_giop_locate_status_type('object_forward_perm') -> - 3; -enc_giop_locate_status_type('loc_system_exception') -> - 4; -enc_giop_locate_status_type('loc_needs_addressing_mode') -> - 5. - -%%----------------------------------------------------------------- -%% Func: enc_type/3 -%%----------------------------------------------------------------- -enc_type(Env, TypeCode, Value) -> - {Bytes, _Len} = enc_type(TypeCode, Env, Value, [], 0), - list_to_binary(lists:reverse(Bytes)). - -%%----------------------------------------------------------------- -%% Func: enc_type/5 -%%----------------------------------------------------------------- -enc_type('tk_null', _Env, null, Bytes, Len) -> - {Bytes, Len}; -enc_type('tk_void', _Env, ok, Bytes, Len) -> - {Bytes, Len}; -enc_type('tk_short', _Env, Value, Bytes, Len) -> - {Rest, Len1} = enc_align(Bytes, Len, 2), - {cdrlib:enc_short(Value, Rest), Len1 + 2}; -enc_type('tk_long', _Env, Value, Bytes, Len) -> - {Rest, Len1} = enc_align(Bytes, Len, 4), - {cdrlib:enc_long(Value, Rest ), Len1 + 4}; -enc_type('tk_longlong', _Env, Value, Bytes, Len) -> - {Rest, Len1} = enc_align(Bytes, Len, 8), - {cdrlib:enc_longlong(Value, Rest ), Len1 + 8}; -enc_type('tk_ushort', _Env, Value, Bytes, Len) -> - {Rest, Len1} = enc_align(Bytes, Len, 2), - {cdrlib:enc_unsigned_short(Value, Rest), Len1 + 2}; -enc_type('tk_ulong', _Env, Value, Bytes, Len) -> - {Rest, Len1} = enc_align(Bytes, Len, 4), - {cdrlib:enc_unsigned_long(Value, Rest), Len1 + 4}; -enc_type('tk_ulonglong', _Env, Value, Bytes, Len) -> - {Rest, Len1} = enc_align(Bytes, Len, 8), - {cdrlib:enc_unsigned_longlong(Value, Rest), Len1 + 8}; -enc_type('tk_float', _Env, Value, Bytes, Len) -> - {Rest, Len1} = enc_align(Bytes, Len, 4), - {cdrlib:enc_float(Value, Rest), Len1 + 4}; -enc_type('tk_double', _Env, Value, Bytes, Len) -> - {Rest, Len1} = enc_align(Bytes, Len, 8), - {cdrlib:enc_double(Value, Rest), Len1 + 8}; -enc_type('tk_boolean', _Env, Value, Bytes, Len) -> - {cdrlib:enc_bool(Value, Bytes), Len + 1}; -enc_type('tk_char', _Env, Value, Bytes, Len) -> - {cdrlib:enc_char(Value, Bytes), Len + 1}; -%% The wchar decoding can be 1, 2 or 4 bytes but for now we only accept 2. -enc_type('tk_wchar', #giop_env{version = {1,2}}, Value, Bytes, Len) -> - Bytes1 = cdrlib:enc_octet(2, Bytes), - {cdrlib:enc_unsigned_short(Value, Bytes1), Len + 3}; -enc_type('tk_wchar', _Env, Value, Bytes, Len) -> - {Rest, Len1} = enc_align(Bytes, Len, 2), - {cdrlib:enc_unsigned_short(Value, Rest), Len1 + 2}; -enc_type('tk_octet', _Env, Value, Bytes, Len) -> - {cdrlib:enc_octet(Value, Bytes), Len + 1}; -enc_type('tk_any', Env, Any, Bytes, Len) when is_record(Any, any) -> - {Rest, Len1} = enc_type('tk_TypeCode', Env, Any#any.typecode, Bytes, Len), - enc_type(Any#any.typecode, Env, Any#any.value, Rest, Len1); -enc_type('tk_TypeCode', Env, Value, Bytes, Len) -> - enc_type_code(Value, Env, Bytes, Len); -enc_type('tk_Principal', Env, Value, Bytes, Len) -> - %% Set MaxLength no 0 (i.e. unlimited). - enc_sequence(Env, Value, 0, 'tk_octet', Bytes, Len); -enc_type({'tk_objref', _IFRId, Name}, Env, Value, Bytes, Len) -> - enc_objref(Env, Name,Value, Bytes, Len); -enc_type({'tk_struct', _IFRId, _Name, ElementList}, Env, Value, Bytes, Len) -> - enc_struct(Env, Value, ElementList, Bytes, Len); -enc_type({'tk_union', _IFRId, _Name, DiscrTC, Default, ElementList}, - Env, Value, Bytes, Len) -> - enc_union(Env, Value, DiscrTC, Default, ElementList, Bytes, Len); -enc_type({'tk_enum', _IFRId, _Name, ElementList}, _Env, Value, Bytes, Len) -> - {Rest, Len1} = enc_align(Bytes, Len, 4), - {cdrlib:enc_enum(atom_to_list(Value), ElementList, Rest), Len1 + 4}; -enc_type({'tk_string', MaxLength}, Env, Value, Bytes, Len) -> - enc_string(Env, Value, MaxLength, Bytes, Len); -enc_type({'tk_wstring', MaxLength}, Env, Value, Bytes, Len) -> - enc_wstring(Env, Value, MaxLength, Bytes, Len); -enc_type({'tk_sequence', ElemTC, MaxLength}, Env, Value, Bytes, Len) -> - enc_sequence(Env, Value, MaxLength, ElemTC, Bytes, Len); -enc_type({'tk_array', ElemTC, Size}, Env, Value, Bytes, Len) -> - enc_array(Env, Value, Size, ElemTC, Bytes, Len); -enc_type({'tk_alias', _IFRId, _Name, TC}, Env, Value, Bytes, Len) -> - enc_type(TC, Env, Value, Bytes, Len); -enc_type({'tk_except', IFRId, Name, ElementList}, Env, Value, Bytes, Len) -> - enc_exception(Env, Name, IFRId, Value, ElementList, Bytes, Len); -enc_type({'tk_fixed', Digits, Scale}, Env, Value, Bytes, Len) -> - enc_fixed(Env, Digits, Scale, Value, Bytes, Len); -enc_type(Type, _, Value, _, _) -> - orber:dbg("[~p] cdr_encode:type(~p, ~p)~n" - "Incorrect TypeCode or unsupported type.", - [?LINE, Type, Value], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 13), completion_status=?COMPLETED_MAYBE}). - - - - -%%----------------------------------------------------------------- -%% Func: enc_fixed -%%----------------------------------------------------------------- -%% Digits eq. total number of digits. -%% Scale eq. position of the decimal point. -%% E.g. fixed<5,2> - "123.45" eq. #fixed{digits = 5, scale = 2, value = 12345} -%% E.g. fixed<4,2> - "12.34" eq. #fixed{digits = 4, scale = 2, value = 1234} -%% These are encoded as: -%% ## <5,2> ## ## <4,2> ## -%% 1,2 0,1 eq. 1 octet -%% 3,4 2,3 -%% 5,0xC 4,0xC -%% -%% Each number is encoded as a half-octet. Note, for <4,2> a zero is -%% added first to to be able to create "even" octets. -enc_fixed(Env, Digits, Scale, - #fixed{digits = Digits, scale = Scale, value = Value}, Bytes, Len) - when is_integer(Value) andalso is_integer(Digits) andalso is_integer(Scale) - andalso Digits < 32 andalso Digits >= Scale -> - %% This isn't very efficient and we should improve it before supporting it - %% officially. - Odd = ?ODD(Digits), - case integer_to_list(Value) of - [$-|ValueList] when Odd == true -> - Padded = lists:duplicate((Digits-length(ValueList)), 0) ++ ValueList, - enc_fixed_2(Env, Digits, Scale, Padded, - Bytes, Len, ?FIXED_NEGATIVE); - [$-|ValueList] -> - Padded = lists:duplicate((Digits-length(ValueList)), 0) ++ ValueList, - enc_fixed_2(Env, Digits, Scale, [0|Padded], - Bytes, Len, ?FIXED_NEGATIVE); - ValueList when Odd == true -> - Padded = lists:duplicate((Digits-length(ValueList)), 0) ++ ValueList, - enc_fixed_2(Env, Digits, Scale, Padded, - Bytes, Len, ?FIXED_POSITIVE); - ValueList -> - Padded = lists:duplicate((Digits-length(ValueList)), 0) ++ ValueList, - enc_fixed_2(Env, Digits, Scale, [0|Padded], - Bytes, Len, ?FIXED_POSITIVE) - end; -enc_fixed(_Env, Digits, Scale, Fixed, _Bytes, _Len) -> - orber:dbg("[~p] cdr_encode:enc_fixed(~p, ~p, ~p)~n" - "The supplied fixed type incorrect. Check that the 'digits' and 'scale' field~n" - "match the definition in the IDL-specification. The value field must be~n" - "a list of Digits length.", - [?LINE, Digits, Scale, Fixed], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}). - -enc_fixed_2(_Env, _Digits, _Scale, [D1], Bytes, Len, Sign) -> - {[<>|Bytes], Len+1}; -enc_fixed_2(Env, Digits, Scale, [D1, D2|Ds], Bytes, Len, Sign) -> - %% We could convert the ASCII-value to digit values but the bit-syntax will - %% truncate it correctly. - enc_fixed_2(Env, Digits, Scale, Ds, [<> | Bytes], Len+1, Sign); -enc_fixed_2(_Env, Digits, Scale, Value, _Bytes, _Len, Sign) -> - orber:dbg("[~p] cdr_encode:enc_fixed_2(~p, ~p, ~p, ~p)~n" - "The supplied fixed type incorrect. Most likely the 'digits' field don't match the~n" - "supplied value. Hence, check that the value is correct.", - [?LINE, Digits, Scale, Value, Sign], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}). - - - -%%----------------------------------------------------------------- -%% Func: enc_sequence/5 -%%----------------------------------------------------------------- -%% This is a special case used when encoding encapsualted data, i.e., contained -%% in an octet-sequence. -enc_sequence(_Env, Sequence, MaxLength, 'tk_octet', Bytes, Len) - when is_binary(Sequence) -> - {ByteSequence, Len1} = enc_align(Bytes, Len, 4), - Size = size(Sequence), - if - Size > MaxLength, MaxLength > 0 -> - orber:dbg("[~p] cdr_encode:enc_sequnce(~p, ~p). Sequence exceeds max.", - [?LINE, Sequence, MaxLength], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 19), - completion_status=?COMPLETED_MAYBE}); - true -> - ByteSequence1 = cdrlib:enc_unsigned_long(Size, ByteSequence), - {[Sequence |ByteSequence1], Len1 + 4 + Size} - end; -enc_sequence(Env, Sequence, MaxLength, TypeCode, Bytes, Len) -> - Length = length(Sequence), - if - Length > MaxLength, MaxLength > 0 -> - orber:dbg("[~p] cdr_encode:enc_sequnce(~p, ~p). Sequence exceeds max.", - [?LINE, Sequence, MaxLength], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 19), - completion_status=?COMPLETED_MAYBE}); - true -> - {ByteSequence, Len1} = enc_align(Bytes, Len, 4), - ByteSequence1 = cdrlib:enc_unsigned_long(Length, ByteSequence), - enc_sequence1(Env, Sequence, TypeCode, ByteSequence1, Len1 + 4) - end. - -%%----------------------------------------------------------------- -%% Func: enc_sequence1/4 -%%----------------------------------------------------------------- -enc_sequence1(_Env, [], _TypeCode, Bytes, Len) -> - {Bytes, Len}; -enc_sequence1(_Env, CharSeq, 'tk_char', Bytes, Len) -> - {[list_to_binary(CharSeq) |Bytes], Len + length(CharSeq)}; -enc_sequence1(_Env, OctetSeq, 'tk_octet', Bytes, Len) -> - {[list_to_binary(OctetSeq) |Bytes], Len + length(OctetSeq)}; -enc_sequence1(Env, [Object| Rest], TypeCode, Bytes, Len) -> - {ByteSequence, Len1} = enc_type(TypeCode, Env, Object, Bytes, Len), - enc_sequence1(Env, Rest, TypeCode, ByteSequence, Len1). - -%%----------------------------------------------------------------- -%% Func: enc_array/4 -%%----------------------------------------------------------------- -enc_array(Env, Array, Size, TypeCode, Bytes, Len) when size(Array) == Size -> - Sequence = tuple_to_list(Array), - enc_sequence1(Env, Sequence, TypeCode, Bytes, Len); -enc_array(_,Array, Size, _, _, _) -> - orber:dbg("[~p] cdr_encode:enc_array(~p, ~p). Incorrect size.", - [?LINE, Array, Size], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 15), completion_status=?COMPLETED_MAYBE}). - -%%----------------------------------------------------------------- -%% Func: enc_string/4 -%%----------------------------------------------------------------- -enc_string(_Env, String, MaxLength, Bytes, Len) -> - StrLen = length(String), - if - StrLen > MaxLength, MaxLength > 0 -> - orber:dbg("[~p] cdr_encode:enc_string(~p, ~p). String exceeds max.", - [?LINE, String, MaxLength], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 16), - completion_status=?COMPLETED_MAYBE}); - true -> - {ByteSequence, Len1} = enc_align(Bytes, Len, 4), - ByteSequence1 = cdrlib:enc_unsigned_long(StrLen + 1, ByteSequence), - {cdrlib:enc_octet(0, [String | ByteSequence1]), Len1 + StrLen + 5} - end. - - -%%----------------------------------------------------------------- -%% Func: enc_wstring/4 -%%----------------------------------------------------------------- -enc_wstring(#giop_env{version = {1,2}} = Env, String, MaxLength, Bytes, Len) -> - %% Encode the length of the string (ulong). - {Bytes1, Len1} = enc_align(Bytes, Len, 4), - %% For IIOP-1.2 the length is the total number of octets. Hence, since the wchar's - %% we accepts is encoded as <<255, 255>> the total size is 2*length of the list. - ListLen = length(String), - if - ListLen > MaxLength, MaxLength > 0 -> - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 16), - completion_status=?COMPLETED_MAYBE}); - true -> - StrLen = ListLen * 2, - Bytes2 = cdrlib:enc_unsigned_long(StrLen, Bytes1), - %% For IIOP-1.2 no terminating null character is used. - enc_sequence1(Env, String, 'tk_ushort', Bytes2, Len1+4) - end; -enc_wstring(Env, String, MaxLength, Bytes, Len) -> - %% Encode the length of the string (ulong). - {Bytes1, Len1} = enc_align(Bytes, Len, 4), - ListLen = length(String), - if - ListLen > MaxLength, MaxLength > 0 -> - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 16), - completion_status=?COMPLETED_MAYBE}); - true -> - StrLen = ListLen + 1, - Bytes2 = cdrlib:enc_unsigned_long(StrLen, Bytes1), - {Bytes3, Len3} = enc_sequence1(Env, String, 'tk_wchar', Bytes2, Len1+4), - %% The terminating null character is also a wchar. - {cdrlib:enc_unsigned_short(0, Bytes3), Len3+2} - end. - - -%%----------------------------------------------------------------- -%% Func: enc_union/5 -%%----------------------------------------------------------------- -enc_union(Env, {_, Label, Value}, DiscrTC, Default, TypeCodeList, - Bytes, Len) when is_list(TypeCodeList) -> - {ByteSequence, Len1} = enc_type(DiscrTC, Env, Label, Bytes, Len), - Label2 = stringify_enum(DiscrTC,Label), - enc_union2(Env, {Label2, Value},TypeCodeList, Default, - ByteSequence, Len1, undefined); -enc_union(Env, Value, _DiscrTC, _Default, Module, Bytes, Len) when is_atom(Module) -> - case catch Module:tc() of - {tk_union, _, _, DiscrTC, Default, ElementList} -> - enc_union(Env, Value, DiscrTC, Default, ElementList, Bytes, Len); - What -> - orber:dbg("[~p] ~p:enc_union(~p). Union module doesn't exist or incorrect.", - [?LINE, ?MODULE, What], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}) - end. - -enc_union2(_Env, _What, [], Default, Bytes, Len, _) when Default < 0 -> - {Bytes, Len}; -enc_union2(Env, {_, Value}, [], _Default, Bytes, Len, Type) -> - enc_type(Type, Env, Value, Bytes, Len); -enc_union2(Env, {Label,Value} ,[{Label, _Name, Type} |_List], - _Default, Bytes, Len, _) -> - enc_type(Type, Env, Value, Bytes, Len); -enc_union2(Env, Union ,[{default, _Name, Type} |List], Default, Bytes, Len, _) -> - enc_union2(Env, Union, List, Default, Bytes, Len, Type); -enc_union2(Env, Union,[_ | List], Default, Bytes, Len, DefaultType) -> - enc_union2(Env, Union, List, Default, Bytes, Len, DefaultType). - -stringify_enum({tk_enum, _,_,_}, Label) -> - atom_to_list(Label); -stringify_enum(_, Label) -> - Label. -%%----------------------------------------------------------------- -%% Func: enc_struct/4 -%%----------------------------------------------------------------- -enc_struct(Env, Struct, TypeCodeList, Bytes, Len) when is_list(TypeCodeList) -> - [_Name | StructList] = tuple_to_list(Struct), - enc_struct1(Env, StructList, TypeCodeList, Bytes, Len); -enc_struct(Env, Struct, Module, Bytes, Len) -> - [Module | StructList] = tuple_to_list(Struct), - case catch Module:tc() of - {tk_struct, _, _, TypeCodeList} -> - enc_struct1(Env, StructList, TypeCodeList, Bytes, Len); - What -> - orber:dbg("[~p] ~p:enc_struct([], ~p). Struct module doesn't exist or incorrect.", - [?LINE, ?MODULE, What], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}) - end. - -enc_struct1(_Env, [], [], Bytes, Len) -> - {Bytes, Len}; -enc_struct1(Env, [Object | Rest], [{_ElemName, ElemType} | TypeCodeList], Bytes, - Len) -> - {ByteSequence, Len1} = enc_type(ElemType, Env, Object, Bytes, Len), - enc_struct1(Env, Rest, TypeCodeList, ByteSequence, Len1). - -%%----------------------------------------------------------------- -%% Func: enc_objref/4 -%%----------------------------------------------------------------- -enc_objref(Env, _Name, Value, Bytes, Len) -> - iop_ior:code(Env, Value, Bytes, Len). - -%%----------------------------------------------------------------- -%% Func: enc_exception/5 -%%----------------------------------------------------------------- -enc_exception(Env, _Name, IFRId, Value, ElementList, Bytes, Len) -> - [_Name1, _TypeId | Args] = tuple_to_list(Value), - {Bytes1, Len1} = enc_type({'tk_string', 0}, Env, IFRId , Bytes, Len), - enc_exception_1(Env, Args, ElementList, Bytes1, Len1). - -enc_exception_1(_Env, [], [], Bytes, Len) -> - {Bytes, Len}; -enc_exception_1(Env, [Arg |Args], [{_ElemName, ElemType} |ElementList], - Bytes, Len) -> - {Bytes1, Len1} = enc_type(ElemType, Env, Arg, Bytes, Len), - enc_exception_1(Env, Args, ElementList, Bytes1, Len1). - - -%%----------------------------------------------------------------- -%% Func: enc_type_code/3 -%%----------------------------------------------------------------- -enc_type_code('tk_null', Env, Message, Len) -> - enc_type('tk_ulong', Env, 0, Message, Len); -enc_type_code('tk_void', Env, Message, Len) -> - enc_type('tk_ulong', Env, 1, Message, Len); -enc_type_code('tk_short', Env, Message, Len) -> - enc_type('tk_ulong', Env, 2, Message, Len); -enc_type_code('tk_long', Env, Message, Len) -> - enc_type('tk_ulong', Env, 3, Message, Len); -enc_type_code('tk_longlong', Env, Message, Len) -> - enc_type('tk_ulong', Env, 23, Message, Len); -enc_type_code('tk_longdouble', Env, Message, Len) -> - enc_type('tk_ulong', Env, 25, Message, Len); -enc_type_code('tk_ushort', Env, Message, Len) -> - enc_type('tk_ulong', Env, 4, Message, Len); -enc_type_code('tk_ulong', Env, Message, Len) -> - enc_type('tk_ulong', Env, 5, Message, Len); -enc_type_code('tk_ulonglong', Env, Message, Len) -> - enc_type('tk_ulong', Env, 24, Message, Len); -enc_type_code('tk_float', Env, Message, Len) -> - enc_type('tk_ulong', Env, 6, Message, Len); -enc_type_code('tk_double', Env, Message, Len) -> - enc_type('tk_ulong', Env, 7, Message, Len); -enc_type_code('tk_boolean', Env, Message, Len) -> - enc_type('tk_ulong', Env, 8, Message, Len); -enc_type_code('tk_char', Env, Message, Len) -> - enc_type('tk_ulong', Env, 9, Message, Len); -enc_type_code('tk_wchar', Env, Message, Len) -> - enc_type('tk_ulong', Env, 26, Message, Len); -enc_type_code('tk_octet', Env, Message, Len) -> - enc_type('tk_ulong', Env, 10, Message, Len); -enc_type_code('tk_any', Env, Message, Len) -> - enc_type('tk_ulong', Env, 11, Message, Len); -enc_type_code('tk_TypeCode', Env, Message, Len) -> - enc_type('tk_ulong', Env, 12, Message, Len); -enc_type_code('tk_Principal', Env, Message, Len) -> - enc_type('tk_ulong', Env, 13, Message, Len); -enc_type_code({'tk_objref', RepId, Name}, Env, Message, Len) -> - {Message1, Len1} = enc_type('tk_ulong', Env, 14, Message, Len), - {Message2, _} = enc_byte_order(Env, []), - {ComplexParams, Len2} = enc_type({'tk_struct', "", "", [{"repository ID", {'tk_string', 0}}, - {"name", {'tk_string', 0}}]}, - Env, - {"", RepId, Name}, - Message2, 1), - encode_complex_tc_paramters(lists:reverse(ComplexParams), Len2, Message1, Len1); -enc_type_code({'tk_struct', RepId, SimpleName, ElementList}, Env, Message, Len) -> - %% Using SimpleName should be enough (and we avoid some overhead). - %% Name = ifrid_to_name(RepId), - {Message1, Len1} = enc_type('tk_ulong', Env, 15, Message, Len), - {Message2, _} = enc_byte_order(Env, []), - {ComplexParams, Len2} = enc_type({'tk_struct', "", "", [{"repository ID", {'tk_string', 0}}, - {"name", {'tk_string', 0}}, - {"element list", - {'tk_sequence', {'tk_struct', "","", - [{"member name", {'tk_string', 0}}, - {"member type", 'tk_TypeCode'}]}, - 0}}]}, - Env, - {"", RepId, SimpleName, - lists:map(fun({N,T}) -> {"",N,T} end, ElementList)}, - Message2, 1), - encode_complex_tc_paramters(lists:reverse(ComplexParams), Len2, Message1, Len1); -enc_type_code({'tk_union', RepId, Name, DiscrTC, Default, ElementList}, - Env, Message, Len) -> - NewElementList = - case check_enum(DiscrTC) of - true -> - lists:map(fun({L,N,T}) -> {"",list_to_atom(L),N,T} end, ElementList); - false -> - lists:map(fun({L,N,T}) -> {"",L,N,T} end, ElementList) - end, - {Message1, Len1} = enc_type('tk_ulong', Env, 16, Message, Len), - {Message2, _} = enc_byte_order(Env, []), - {ComplexParams, Len2} = enc_type({'tk_struct', "", "", [{"repository ID", {'tk_string', 0}}, - {"name", {'tk_string', 0}}, - {"discriminant type", 'tk_TypeCode'}, - {"default used", 'tk_long'}, - {"element list", - {'tk_sequence', {'tk_struct', "","", - [{"label value", DiscrTC}, - {"member name", {'tk_string', 0}}, - {"member type", 'tk_TypeCode'}]}, - 0}}]}, - Env, - {"", RepId, Name, DiscrTC, Default, NewElementList}, - Message2, 1), - encode_complex_tc_paramters(lists:reverse(ComplexParams), Len2, Message1, Len1); -enc_type_code({'tk_enum', RepId, Name, ElementList}, Env, Message, Len) -> - {Message1, Len1} = enc_type('tk_ulong', Env, 17, Message, Len), - {Message2, _} = enc_byte_order(Env, []), - {ComplexParams, Len2} = enc_type({'tk_struct', "", "", [{"repository ID", {'tk_string', 0}}, - {"name", {'tk_string', 0}}, - {"element list", - {'tk_sequence', {'tk_string', 0}, 0}}]}, - Env, - {"", RepId, Name, ElementList}, - Message2, 1), - encode_complex_tc_paramters(lists:reverse(ComplexParams), Len2, Message1, Len1); -enc_type_code({'tk_string', MaxLength}, Env, Message, Len) -> - enc_type({'tk_struct', "", "", [{"TCKind", 'tk_ulong'}, - {"max length", 'tk_ulong'}]}, - Env, - {"", 18, MaxLength}, - Message, Len); -enc_type_code({'tk_wstring', MaxLength}, Env, Message, Len) -> - enc_type({'tk_struct', "", "", [{"TCKind", 'tk_ulong'}, - {"max length", 'tk_ulong'}]}, - Env, - {"", 27, MaxLength}, - Message, Len); -enc_type_code({'tk_sequence', ElemTC, MaxLength}, Env, Message, Len) -> - {Message1, Len1} = enc_type('tk_ulong', Env, 19, Message, Len), - {Message2, _} = enc_byte_order(Env, []), - {ComplexParams, Len2} = enc_type({'tk_struct', "", "", [{"element type", 'tk_TypeCode'}, - {"max length", 'tk_ulong'}]}, - Env, - {"", ElemTC, MaxLength}, - Message2, 1), - encode_complex_tc_paramters(lists:reverse(ComplexParams), Len2, Message1, Len1); -enc_type_code({'tk_array', ElemTC, Length}, Env, Message, Len) -> - {Message1, Len1} = enc_type('tk_ulong', Env, 20, Message, Len), - {Message2, _} = enc_byte_order(Env, []), - {ComplexParams, Len2} = enc_type({'tk_struct', "", "", [{"element type", 'tk_TypeCode'}, - {"length", 'tk_ulong'}]}, - Env, - {"", ElemTC, Length}, - Message2, 1), - encode_complex_tc_paramters(lists:reverse(ComplexParams), Len2, Message1, Len1); -enc_type_code({'tk_alias', RepId, Name, TC}, Env, Message, Len) -> - {Message1, Len1} = enc_type('tk_ulong', Env, 21, Message, Len), - {Message2, _} = enc_byte_order(Env, []), - {ComplexParams, Len2} = enc_type({'tk_struct', "", "", [{"repository ID", {'tk_string', 0}}, - {"name", {'tk_string', 0}}, - {"TypeCode", 'tk_TypeCode'}]}, - Env, - {"", RepId, Name, TC}, - Message2, 1), - encode_complex_tc_paramters(lists:reverse(ComplexParams), Len2, Message1, Len1); -enc_type_code({'tk_except', RepId, Name, ElementList}, Env, Message, Len) -> - {Message1, Len1} = enc_type('tk_ulong', Env, 22, Message, Len), - {Message2, _} = enc_byte_order(Env, []), - {ComplexParams, Len2} = enc_type({'tk_struct', "", "", [{"repository ID", {'tk_string', 0}}, - {"name", {'tk_string', 0}}, - {"element list", - {'tk_sequence', - {'tk_struct', "", "", - [{"member name", {'tk_string', 0}}, - {"member type", 'tk_TypeCode'}]}, 0}}]}, - Env, - {"", RepId, Name, - lists:map(fun({N,T}) -> {"",N,T} end, ElementList)}, - Message2, 1), - encode_complex_tc_paramters(lists:reverse(ComplexParams), Len2, Message1, Len1); -enc_type_code({'tk_fixed', Digits, Scale}, Env, Message, Len) -> - enc_type({'tk_struct', "", "", [{"TCKind", 'tk_ulong'}, - {"digits", 'tk_ushort'}, - {"scale", 'tk_short'}]}, - Env, - {"", 28, Digits, Scale}, - Message, Len); -enc_type_code({'tk_value', RepId, Name, ValueModifier, TC, ElementList}, Env, Message, Len) -> - {Message1, Len1} = enc_type('tk_ulong', Env, 29, Message, Len), - {Message2, _} = enc_byte_order(Env, []), - {ComplexParams, Len2} = enc_type({'tk_struct', "", "", - [{"repository ID", {'tk_string', 0}}, - {"name", {'tk_string', 0}}, - {"ValueModifier", 'tk_short'}, - {"TypeCode", 'tk_TypeCode'}, - {"element list", - {'tk_sequence', - {'tk_struct', "","", - [{"member name", {'tk_string', 0}}, - {"member type", 'tk_TypeCode'}, - {"Visibility", 'tk_short'}]}, - 0}}]}, - Env, - {"", RepId, Name, ValueModifier, TC, - lists:map(fun({N,T,V}) -> {"",N,T,V} end, ElementList)}, - Message2, 1), - encode_complex_tc_paramters(lists:reverse(ComplexParams), Len2, Message1, Len1); -enc_type_code({'tk_value_box', RepId, Name, TC}, Env, Message, Len) -> - {Message1, Len1} = enc_type('tk_ulong', Env, 30, Message, Len), - {Message2, _} = enc_byte_order(Env, []), - {ComplexParams, Len2} = enc_type({'tk_struct', "", "", - [{"repository ID", {'tk_string', 0}}, - {"name", {'tk_string', 0}}, - {"TypeCode", 'tk_TypeCode'}]}, - Env, - {"", RepId, Name, TC}, - Message2, 1), - encode_complex_tc_paramters(lists:reverse(ComplexParams), Len2, Message1, Len1); -enc_type_code({'tk_native', RepId, Name}, Env, Message, Len) -> - {Message1, Len1} = enc_type('tk_ulong', Env, 31, Message, Len), - {Message2, _} = enc_byte_order(Env, []), - {ComplexParams, Len2} = enc_type({'tk_struct', "", "", - [{"repository ID", {'tk_string', 0}}, - {"name", {'tk_string', 0}}]}, - Env, - {"", RepId, Name}, - Message2, 1), - encode_complex_tc_paramters(lists:reverse(ComplexParams), Len2, Message1, Len1); -enc_type_code({'tk_abstract_interface', RepId, Name}, Env, Message, Len) -> - {Message1, Len1} = enc_type('tk_ulong', Env, 32, Message, Len), - {Message2, _} = enc_byte_order(Env, []), - {ComplexParams, Len2} = enc_type({'tk_struct', "", "", - [{"RepositoryId", {'tk_string', 0}}, - {"name", {'tk_string', 0}}]}, - Env, - {"", RepId, Name}, - Message2, 1), - encode_complex_tc_paramters(lists:reverse(ComplexParams), Len2, Message1, Len1); -enc_type_code({'tk_local_interface', RepId, Name}, Env, Message, Len) -> - {Message1, Len1} = enc_type('tk_ulong', Env, 33, Message, Len), - {Message2, _} = enc_byte_order(Env, []), - {ComplexParams, Len2} = enc_type({'tk_struct', "", "", - [{"RepositoryId", {'tk_string', 0}}, - {"name", {'tk_string', 0}}]}, - Env, - {"", RepId, Name}, - Message2, 1), - encode_complex_tc_paramters(lists:reverse(ComplexParams), Len2, Message1, Len1); -enc_type_code({'none', Indirection}, Env, Message, Len) -> %% placeholder - enc_type({'tk_struct', "", "", [{"TCKind", 'tk_ulong'}, - {"indirection", 'tk_long'}]}, - Env, - {"", 16#ffffffff, Indirection}, - Message, Len); -enc_type_code(Type, _, _, _) -> - orber:dbg("[~p] cdr_encode:enc_type_code(~p); No match.", - [?LINE, Type], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 7), completion_status=?COMPLETED_MAYBE}). - -check_enum({'tk_enum', _, _, _}) -> - true; -check_enum(_) -> - false. - -encode_complex_tc_paramters(Value, ValueLength, Message, Len) -> - {Message1, _Len1} = enc_align(Message, Len, 4), - Message2 = cdrlib:enc_unsigned_long(ValueLength, Message1), - {[Value |Message2], Len+ValueLength+4}. - -%%----------------------------------------------------------------- -%% Func: enc_align/1 -%%----------------------------------------------------------------- -enc_align(R, Len, Alignment) -> - Rem = Len rem Alignment, - if Rem == 0 -> - {R, Len}; - true -> - Diff = Alignment - Rem, - {add_bytes(R, Diff), Len + Diff} - end. - -add_bytes(R, 0) -> - R; -add_bytes(R, 1) -> - [<<16#01:8>> | R]; -add_bytes(R, 2) -> - [<<16#02:8, 16#02:8>> | R]; -add_bytes(R, 3) -> - [<<16#03:8, 16#03:8, 16#03:8>> | R]; -add_bytes(R, 4) -> - [<<16#04:8, 16#04:8, 16#04:8, 16#04:8>> | R]; -add_bytes(R, 5) -> - [<<16#05:8, 16#05:8, 16#05:8, 16#05:8, 16#05:8>> | R]; -add_bytes(R, 6) -> - [<<16#06:8, 16#06:8, 16#06:8, 16#06:8, 16#06:8, 16#06:8>> | R]; -add_bytes(R, 7) -> - [<<16#07:8, 16#07:8, 16#07:8, 16#07:8, 16#07:8, 16#07:8, 16#07:8>> | R]; -add_bytes(R,N) -> - add_bytes([<<16#08:8>> | R], N - 1). - diff --git a/lib/orber/src/cdrlib.erl b/lib/orber/src/cdrlib.erl deleted file mode 100644 index a181681382..0000000000 --- a/lib/orber/src/cdrlib.erl +++ /dev/null @@ -1,415 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: cdrlib.erl -%% -%% Description: -%% CDR basic type encode/decode functions -%% -%%----------------------------------------------------------------- --module(cdrlib). - --include_lib("orber/include/corba.hrl"). --include("orber_iiop.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([ %% IIOP 1.0 - - enc_short/2, dec_short/2, - enc_unsigned_short/2, dec_unsigned_short/2, - enc_long/2, dec_long/2, - enc_unsigned_long/2, dec_unsigned_long/2, - enc_bool/2, dec_bool/1, - enc_float/2, dec_float/2, - enc_double/2, dec_double/2, - enc_char/2, dec_char/1, - enc_octet/2, dec_octet/1, - enc_enum/3, dec_enum/3, - %% IIOP 1.1 - - enc_longlong/2, dec_longlong/2, - enc_unsigned_longlong/2, dec_unsigned_longlong/2 - %%enc_longdouble/2, dec_longdouble/2 - %%enc_fixed/4, dec_fixed/2 - ]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% Macros -%%----------------------------------------------------------------- --define(DEBUG_LEVEL, 10). - -%%----------------------------------------------------------------- -%% short -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: enc_short/2 -%%----------------------------------------------------------------- -enc_short(X, Message) when is_integer(X) andalso X >= ?SHORTMIN andalso X =< ?SHORTMAX -> - [<> | Message]; -enc_short(X, _Message) when is_integer(X) -> - orber:dbg("[~p] cdrlib:enc_short(~p); Out of range.", [?LINE, X], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 1), completion_status=?COMPLETED_NO}); -enc_short(X, _Message) -> - orber:dbg("[~p] cdrlib:enc_short(~p); not integer.", [?LINE, X], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 2), completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------------- -%% Func: dec_short/2 -%%----------------------------------------------------------------- -dec_short(big, <>) -> - {Short, Rest}; -dec_short(little, <>) -> - {Short, Rest}. - -%%----------------------------------------------------------------- -%% unsigned short -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: enc_unsigned_short/2 -%%----------------------------------------------------------------- -enc_unsigned_short(X, Message) when is_integer(X) andalso X >= ?USHORTMIN andalso X =< ?USHORTMAX -> - [<> | Message]; -enc_unsigned_short(X, _Message) when is_integer(X) -> - orber:dbg("[~p] cdrlib:enc_unsigned_short(~p); Out of range.", - [?LINE, X], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 1), completion_status=?COMPLETED_NO}); -enc_unsigned_short(X, _Message) -> - orber:dbg("[~p] cdrlib:enc_unsigned_short(~p); not integer >= 0", - [?LINE, X], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 2), completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------------- -%% Func: dec_unsigned_short/2 -%%----------------------------------------------------------------- -dec_unsigned_short(big, <>) -> - {UShort, Rest}; -dec_unsigned_short(little, <>) -> - {UShort, Rest}. - -%%----------------------------------------------------------------- -%% long -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: enc_long/2 -%%----------------------------------------------------------------- -enc_long(X, Message) when is_integer(X) andalso X >= ?LONGMIN andalso X =< ?LONGMAX -> - [<> | Message]; -enc_long(X, _Message) when is_integer(X) -> - orber:dbg("[~p] cdrlib:enc_long(~p); Out of range.",[?LINE, X], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 1), completion_status=?COMPLETED_NO}); -enc_long(X, _Message) -> - orber:dbg("[~p] cdrlib:enc_long(~p); not integer.", - [?LINE, X], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 2), completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------------- -%% Func: dec_long/2 -%%----------------------------------------------------------------- -dec_long(big, <>) -> - {Long, Rest}; -dec_long(little, <>) -> - {Long, Rest}. - -%%----------------------------------------------------------------- -%% unsigned_long -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: enc_unsigned_long/2 -%%----------------------------------------------------------------- -enc_unsigned_long(X, Message) when is_integer(X) andalso X >= ?ULONGMIN andalso X =< ?ULONGMAX -> - [<> | Message]; -enc_unsigned_long(X, _Message) when is_integer(X) -> - orber:dbg("[~p] cdrlib:enc_unsigned_long(~p); Out of range.", - [?LINE, X], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 1), completion_status=?COMPLETED_NO}); -enc_unsigned_long(X, _Message) -> - orber:dbg("[~p] cdrlib:enc_unsigned_long(~p); not integer >=0 ", - [?LINE, X], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 2), completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------------- -%% Func: dec_unsigned_long/2 -%%----------------------------------------------------------------- -dec_unsigned_long(big, <>) -> - {ULong, Rest}; -dec_unsigned_long(little, <>) -> - {ULong, Rest}. - -%%----------------------------------------------------------------- -%% boolean -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: enc_bool/2 -%%----------------------------------------------------------------- -enc_bool(true, Message) -> [<<1:8>>| Message]; -enc_bool(false, Message) -> [<<0:8>>| Message]; -enc_bool(X, _Message) -> - orber:dbg("[~p] cdrlib:enc_bool(~p); Must be 'true' or 'false'", - [?LINE, X], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 3), completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------------- -%% Func: dec_bool/1 -%%----------------------------------------------------------------- -dec_bool(<<1:8,Rest/binary>>) -> {true, Rest}; -dec_bool(<<0:8,Rest/binary>>) -> {false, Rest}; -dec_bool(<>) -> - orber:dbg("[~p] cdrlib:dec_bool(~p); Not a boolean (1 or 0).", - [?LINE, X], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 3), completion_status=?COMPLETED_NO}). - - -%%----------------------------------------------------------------- -%% Func: enc_float/2 -%%----------------------------------------------------------------- -enc_float(X, Message) when is_number(X) -> - [<> | Message]; -enc_float(X, _Message) -> - orber:dbg("[~p] cdrlib:enc_float(~p); not a number.", [?LINE, X], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 4), completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------------- -%% Func: dec_float/2 -%%----------------------------------------------------------------- -dec_float(big, <>) -> - {Float, Rest}; -dec_float(little, <>) -> - {Float, Rest}. - -%%----------------------------------------------------------------- -%% Func: enc_double/2 -%%----------------------------------------------------------------- -enc_double(X, Message) when is_number(X) -> - [<> | Message]; -enc_double(X, _Message) -> - orber:dbg("[~p] cdrlib:enc_double(~p); not a number.", [?LINE, X], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 4), completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------------- -%% Func: dec_double/2 -%%----------------------------------------------------------------- -dec_double(big, <>) -> - {Double, Rest}; -dec_double(little, <>) -> - {Double, Rest}. - -%%----------------------------------------------------------------- -%% char -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: enc_char/2 -%%----------------------------------------------------------------- -enc_char(X, Message) when is_integer(X) andalso X =< 255, X >= 0 -> - [<> | Message]; -enc_char(X,_) -> - orber:dbg("[~p] cdrlib:enc_char(~p); not a char.", [?LINE, X], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 6),completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------------- -%% Func: dec_char/1 -%%----------------------------------------------------------------- -dec_char(<>) -> - {Char, Rest}. - -%%----------------------------------------------------------------- -%% octet -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: enc_octet/2 -%%----------------------------------------------------------------- -enc_octet(X, Message) when is_integer(X) andalso X =< 255, X >= 0 -> - [<> | Message]; -enc_octet(X, _Message) -> - orber:dbg("[~p] cdrlib:enc_octet(~p); not an octet.", [?LINE, X], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 6),completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------------- -%% Func: dec_octet/1 -%%----------------------------------------------------------------- -dec_octet(<>) -> - {Octet, Rest}. - -%%----------------------------------------------------------------- -%% enum -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: enc_enum/3 -%%----------------------------------------------------------------- -enc_enum(Enum, ElemList, Message) -> - Val = getEnumValue(ElemList,Enum, 0), - enc_unsigned_long(Val, Message). - -getEnumValue([],Enum, _) -> - orber:dbg("[~p] cdrlib:enc_enum/enc_r_enum(~p); not exist.", - [?LINE, Enum], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 5), - completion_status=?COMPLETED_NO}); -getEnumValue([Enum|_List], Enum, N) -> - N; -getEnumValue([_ |List], Enum, N) -> - getEnumValue(List, Enum, N + 1). - -%%----------------------------------------------------------------- -%% Func: dec_enum/2 -%%----------------------------------------------------------------- -dec_enum(ByteOrder, ElemList, Message) -> - {N, Rest} = dec_unsigned_long(ByteOrder, Message), - case catch lists:nth(N + 1, ElemList) of - {'EXIT', _} -> - orber:dbg("[~p] cdrlib:dec_enum(~p, ~p); not defined.", - [?LINE, N, ElemList], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 5), - completion_status=?COMPLETED_NO}); - X -> - {list_to_atom(X), Rest} - end. - - -%%----------------------------------------------------------------- -%% IIOP 1.1 - -%%----------------------------------------------------------------- - -%%----------------------------------------------------------------- -%% longlong -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: enc_longlong/2 -%%----------------------------------------------------------------- -enc_longlong(X, Message) when is_integer(X) andalso X >= ?LONGLONGMIN andalso X =< ?LONGLONGMAX -> - [<> | Message]; -enc_longlong(X, _Message) when is_integer(X) -> - orber:dbg("[~p] cdrlib:enc_longlong(~p); Out of range.", - [?LINE, X], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 1), completion_status=?COMPLETED_NO}); -enc_longlong(X, _Message) -> - orber:dbg("[~p] cdrlib:enc_longlong(~p); not integer.", - [?LINE, X], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 2), completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------------- -%% Func: dec_longlong/2 -%%----------------------------------------------------------------- -dec_longlong(big, <>) -> - {LongLong, Rest}; -dec_longlong(little, <>) -> - {LongLong, Rest}. - -%%----------------------------------------------------------------- -%% Func: enc_unsigned_longlong/2 -%%----------------------------------------------------------------- -enc_unsigned_longlong(X, Message) when is_integer(X) andalso X >= ?ULONGLONGMIN andalso X =< ?ULONGLONGMAX -> - [<> | Message]; -enc_unsigned_longlong(X, _Message) when is_integer(X) -> - orber:dbg("[~p] cdrlib:enc_unsigned_longlong(~p); Out of range.", - [?LINE, X], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 1), completion_status=?COMPLETED_NO}); -enc_unsigned_longlong(X, _Message) -> - orber:dbg("[~p] cdrlib:enc_unsigned_longlong(~p); not integer >= 0.", - [?LINE, X], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 2), completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------------- -%% Func: dec_unsigned_longlong/2 -%%----------------------------------------------------------------- -dec_unsigned_longlong(big, <>) -> - {ULongLong, Rest}; -dec_unsigned_longlong(little, <>) -> - {ULongLong, Rest}. - -%%%----------------------------------------------------------------- -%%% long double [S=1 | E=15 | F=112] -%%% X = (-1)^S * 2^(E-16383) * 1.F -%%%----------------------------------------------------------------- -%-define(LONGDOUBLE_BASE, 16#10000000000000000000000000000). -%-define(LONGDOUBLE_BIAS, 16383). -%%%----------------------------------------------------------------- -%%% Func: enc_longdouble/2 -%%%----------------------------------------------------------------- -%enc_longdouble(X, Message) when number(X) -> -% {S, E, F} = enc_ieee(X, ?LONGDOUBLE_BASE, ?LONGDOUBLE_BIAS), -% [ (S bsl 7) bor ((E bsr 8) band 16#7f), -% E band 16#ff, -% (F bsr 104) band 16#ff, -% (F bsr 96) band 16#ff, -% (F bsr 88) band 16#ff, -% (F bsr 80) band 16#ff, -% (F bsr 72) band 16#ff, -% (F bsr 64) band 16#ff, -% (F bsr 56) band 16#ff, -% (F bsr 48) band 16#ff, -% (F bsr 40) band 16#ff, -% (F bsr 32) band 16#ff, -% (F bsr 24) band 16#ff, -% (F bsr 16) band 16#ff, -% (F bsr 8) band 16#ff, -% F band 16#ff | Message]; -%enc_longdouble(X, Message) -> -% corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 4), completion_status=?COMPLETED_NO}). - -%%%----------------------------------------------------------------- -%%% Func: dec_longdouble/2 -%%%----------------------------------------------------------------- -%dec_longdouble([X15,X14,X13,X12,X11,X10,X9,X8,X7,X6,X5,X4,X3,X2,X1,X0 | R], big) -> - -% E = (X15 band 16#7f) bsl 8 + X14, - -% F = (X13 bsl 104) + (X12 bsl 96) + -% (X11 bsl 88) + (X10 bsl 80) + (X9 bsl 72) + -% (X8 bsl 64) + (X7 bsl 56) + (X6 bsl 48) + -% (X5 bsl 40) + (X4 bsl 32) + (X3 bsl 24) + -% (X2 bsl 16) + (X1 bsl 8) + X0, - -% if -% E == 0, F == 0 -> -% { 0.0, R}; -% X15 >= 16#80 -> -% { - math:pow(2, E-?LONGDOUBLE_BIAS) * (1 + F / ?LONGDOUBLE_BASE), R}; -% true -> -% { math:pow(2, E-?LONGDOUBLE_BIAS) * (1 + F / ?LONGDOUBLE_BASE), R} -% end; -%dec_longdouble([X15,X14,X13,X12,X11,X10,X9,X8,X7,X6,X5,X4,X3,X2,X1,X0 | R], little) -> - -% E = (X0 band 16#7f) bsl 8 + X1, - -% F = -% (X2 bsl 104) + (X3 bsl 96) + -% (X4 bsl 88) + (X5 bsl 80) + (X6 bsl 72) + -% (X7 bsl 64) + (X8 bsl 56) + (X9 bsl 48) + -% (X10 bsl 40) + (X11 bsl 32) + (X12 bsl 24) + -% (X13 bsl 16) + (X14 bsl 8) + X15, - -% if -% E == 0, F == 0 -> -% { 0.0, R}; -% X0 >= 16#80 -> -% { - math:pow(2, E-?DOUBLE_BIAS) * (1 + F / ?DOUBLE_BASE), R}; -% true -> -% { math:pow(2, E-?DOUBLE_BIAS) * (1 + F / ?DOUBLE_BASE), R} -% end. - -%%------------------ END OF MODULE ----------------------------------- - diff --git a/lib/orber/src/corba.erl b/lib/orber/src/corba.erl deleted file mode 100644 index 23ce01ffc3..0000000000 --- a/lib/orber/src/corba.erl +++ /dev/null @@ -1,2206 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2017. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%-------------------------------------------------------------------- -%% File: corba.erl -%% -%% Description: -%% This file contains the CORBA::ORB interface plus some -%% Orber specific functions. -%%----------------------------------------------------------------- --module(corba). - --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). - -%%----------------------------------------------------------------- -%% Standard interface CORBA -%%----------------------------------------------------------------- --export([orb_init/1, orb_init/2]). -%%----------------------------------------------------------------- -%% Standard interface CORBA::ORB -%%----------------------------------------------------------------- --export([%create_list/2, - %create_operation_list/2, - %% get_default_context/1, - %% 'BOA_init/2, - resolve_initial_references/1, - resolve_initial_references/2, - resolve_initial_references_local/1, - list_initial_services/0, - add_initial_service/2, - remove_initial_service/1, - resolve_initial_references_remote/2, - resolve_initial_references_remote/3, - list_initial_services_remote/1, - list_initial_services_remote/2, - object_to_string/1, object_to_string/2, - object_to_string/3, object_to_string/4, - string_to_object/1, - string_to_object/2]). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([create/2, - create/3, - create/4, - create_link/2, - create_link/3, - create_link/4, - create_remote/3, - create_remote/5, - create_link_remote/3, - create_link_remote/5, - create_nil_objref/0, - dispose/1, - create_subobject_key/2, - get_subobject_key/1, - get_pid/1, - raise/1, raise_with_state/2, - print_object/1, - print_object/2, - add_alternate_iiop_address/3, - add_FTGroup_component/4, - add_FTPrimary_component/1, - call_internal/10]). - -%%----------------------------------------------------------------- -%% Internal (inside orber implementation) exports -%%----------------------------------------------------------------- --export([call/4, call/5, reply/2, - cast/4, cast/5, locate/1, locate/2, locate/3, - request_from_iiop/6, - common_create/5, - mk_objkey/4, - mk_light_objkey/2, - objkey_to_string/1, - string_to_objkey/1, - string_to_objkey_local/1, - call_relay/3, - cast_relay/2, - handle_init/2, - handle_terminate/3, - handle_info/3, - handle_code_change/4, - handle_call/7, - handle_call/10, - handle_cast/9, - handle_cast/6, - get_implicit_context/1]). - -%%----------------------------------------------------------------- -%% Internal definitions -%%----------------------------------------------------------------- --define(DEBUG_LEVEL, 5). - --record(is, {flags = 0}). - -%% Defines possible configuration parameters a user can add when -%% creating new CORBA objects. --record(options, {sup_child = false, - persistent = false, - regname = [], - pseudo = false, - object_flags = ?ORB_INIT_FLAGS, - object_flags_set = ?ORB_INIT_FLAGS, - create_options = [], - passive = false, - group_id = 0, - internal_state}). - --record(extra, {timeout = infinity, - context = []}). - - -%%-------------------------------------------------------------------- -%% FT stuff -%%-------------------------------------------------------------------- --define(IDL_MODULES, [oe_TimeBase, - oe_CosEventComm, - oe_CosEventChannelAdmin, - oe_CosNotification, - oe_CosNotifyComm, - oe_CosNotifyFilter, - oe_GIOP]). - --define(groupid_to_table(Integer), - list_to_atom("ft_" ++ integer_to_list(Integer))). - --define(RM_TABLE_SPEC, - [{attributes, record_info(fields, ft_replication_manager)}]). --define(RO_TABLE_SPEC, - [{attributes, record_info(fields, ft_replicated_object)}]). --define(RR_TABLE_SPEC, - [{attributes, record_info(fields, ft_reply_retention)}]). - -%% how long we're allowed to wait for database tables to be available. --define(TABLE_TIMEOUT, infinite). - -%-record(rm_state, {default_options, type_options, node_port_ips}). - -%-record(node_port_ip, {node, port, ip}). - --record(ft_replication_manager, {object_group_id, - type_id, - primary, - iogr, - ref_version, - options}). - --record(ft_replicated_object, {group_id, state}). --record(ft_reply_retention, {retention_id, reply}). - -%-record(ft_properties, {replications_style, -% membership_style, -% consistency_style, -% initial_number_replicas, -% minimum_number_replicas}). - -% one should change things work with stdlib:proplist and clean up the mess. -%-record(ft_criteria, {ft_properties, -% object_location, -% object_init, -% object_impl}). - -%%------------------------------------------------------------ -%% -%% Implementation of CORBA CORBA::ORB interfaces -%% -%%------------------------------------------------------------ - -%%create_list(Count) -> -%% corba_nvlist:create_list(Count). - -%%create_operation_list(OpDef) -> -%% corba_nvlist:create_operation_list(OpDef). - -orb_init(KeyValueList) -> - orb_init(KeyValueList, "ORBER"). - -orb_init([], _Name) -> - ok; -orb_init(KeyValueList, _Name) -> - orber:multi_configure(KeyValueList). - -%%----------------------------------------------------------------- -%% Initial reference handling -%%----------------------------------------------------------------- -resolve_initial_references(ObjectId) -> - resolve_initial_references(ObjectId, []). -resolve_initial_references(ObjectId, Ctx) -> - case use_local_host(ObjectId) of - true -> - orber_initial_references:get(ObjectId); - Ref -> - string_to_object(Ref, Ctx) - end. - -resolve_initial_references_local(ObjectId) -> - orber_initial_references:get(ObjectId). - -list_initial_services() -> - Local = orber_initial_references:list(), - case orber:get_ORBInitRef() of - undefined -> - Local; - InitRef -> - orber_tb:unique(Local ++ get_prefixes(InitRef, [])) - end. - -get_prefixes([], Acc) -> - Acc; -%% A list of ORBInitRef's -get_prefixes([H|T], Acc) when is_list(H) -> - [Key|_] = string:tokens(H, "="), - get_prefixes(T, [Key|Acc]); -%% A single ORBInitRef -get_prefixes(InitRef, _Acc) when is_list(InitRef) -> - [Key|_] = string:tokens(InitRef, "="), - [Key]; -get_prefixes(What, _) -> - orber:dbg("[~p] corba:get_prefixes(~p);~nMalformed argument?", - [?LINE, What], ?DEBUG_LEVEL), - raise(#'BAD_PARAM'{completion_status = ?COMPLETED_NO}). - - -use_local_host(ObjectId) -> - case orber:get_ORBInitRef() of - undefined -> - case orber:get_ORBDefaultInitRef() of - undefined -> - true; - DefRef -> - DefRef++"/"++ObjectId - end; - InitRef -> - case check_prefixes(InitRef, ObjectId) of - false -> - case orber:get_ORBDefaultInitRef() of - undefined -> - true; - DefRef -> - DefRef++"/"++ObjectId - end; - UseRef -> - strip_junk(UseRef) - end - end. - - -check_prefixes([], _) -> - false; -%% A list of ORBInitRef's -check_prefixes([H|T], ObjectId) when is_list(H) -> - case prefix(ObjectId, H) of - false -> - check_prefixes(T, ObjectId); - UseRef -> - UseRef - end; -%% A single ORBInitRef -check_prefixes(InitRef, ObjectId) when is_list(InitRef) -> - case prefix(ObjectId, InitRef) of - false -> - false; - UseRef -> - UseRef - end; -check_prefixes(What,_) -> - orber:dbg("[~p] corba:check_prefixes(~p);~nMalformed argument?", - [?LINE, What], ?DEBUG_LEVEL), - raise(#'BAD_PARAM'{completion_status = ?COMPLETED_NO}). - - -%% Valid is, for example, "NameService = corbaloc::host/NameService". -%% Hence, we must remove ' ' and '='. -strip_junk([32|T]) -> - strip_junk(T); -strip_junk([$=|T]) -> - strip_junk(T); -strip_junk(Ref) -> - Ref. - -add_initial_service(ObjectId, ObjectRef) -> - orber_initial_references:add(ObjectId, ObjectRef). - -remove_initial_service(ObjectId) -> - orber_initial_references:remove(ObjectId). - -resolve_initial_references_remote(ObjectId, Address) -> - resolve_initial_references_remote(ObjectId, Address, []). - -resolve_initial_references_remote(_ObjectId, [], _Ctx) -> - raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}); -resolve_initial_references_remote(ObjectId, [RemoteModifier| Rest], Ctx) - when is_list(RemoteModifier) -> - case parse_remote_modifier(RemoteModifier) of - {error, _} -> - resolve_initial_references_remote(ObjectId, Rest, Ctx); - {ok, Host, Port} -> - IOR = iop_ior:create_external(orber:giop_version(), "", - Host, list_to_integer(Port), "INIT"), - %% We know it's an external referens. Hence, no need to check. - {_, Key} = iop_ior:get_key(IOR), - orber_iiop:request(Key, 'get', [ObjectId], - {{'tk_objref', 12, "object"}, - [{'tk_string', 0}], - []}, 'true', infinity, IOR, Ctx) - end. - -list_initial_services_remote(Address) -> - list_initial_services_remote(Address, []). - -list_initial_services_remote([], _Ctx) -> - raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}); -list_initial_services_remote([RemoteModifier| Rest], Ctx) when is_list(RemoteModifier) -> - case parse_remote_modifier(RemoteModifier) of - {error, _} -> - resolve_initial_references_remote(Rest, Ctx); - {ok, Host, Port} -> - IOR = iop_ior:create_external(orber:giop_version(), "", - Host, list_to_integer(Port), "INIT"), - %% We know it's an external referens. Hence, no need to check. - {_, Key} = iop_ior:get_key(IOR), - orber_iiop:request(Key, 'list', [], - {{'tk_sequence', {'tk_string',0},0}, - [], []}, 'true', infinity, IOR, Ctx) - end; -list_initial_services_remote(_, _) -> - raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - - -parse_remote_modifier("iiop://" ++ Rest) -> - parse_host_version(Rest); -parse_remote_modifier(_RemoteModifier) -> - {error, not_supported}. - -parse_host_version("[" ++ Rest) -> - parse_ipv6(Rest, []); -parse_host_version(Rest) -> - parse_ipv4_or_dnsname(Rest, []). - - -parse_ipv4_or_dnsname([$: |Rest], Acc) -> - {ok, lists:reverse(Acc), Rest}; -parse_ipv4_or_dnsname([C |Rest], Acc) -> - parse_ipv4_or_dnsname(Rest, [C |Acc]). - -parse_ipv6("]:" ++ Rest, Acc) -> - {ok, lists:reverse(Acc), Rest}; -parse_ipv6([C |Rest], Acc) -> - parse_ipv6(Rest, [C |Acc]). - - -%%----------------------------------------------------------------- -%% Objectreference convertions -%%----------------------------------------------------------------- -object_to_string(Object) -> - iop_ior:string_code(Object). - -object_to_string(Object, [H|_] = Hosts) when is_list(H) -> - iop_ior:string_code(Object, Hosts); -object_to_string(_Object, _Hosts) -> - raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -object_to_string(Object, [H|_] = Hosts, Port) when is_list(H) andalso - is_integer(Port) -> - iop_ior:string_code(Object, Hosts, Port); -object_to_string(_Object, _Hosts, _Port) -> - raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -object_to_string(Object, [H|_] = Hosts, Port, SSLPort) when is_list(H) andalso - is_integer(Port) andalso - is_integer(SSLPort)-> - iop_ior:string_code(Object, Hosts, Port, SSLPort); -object_to_string(_Object, _Hosts, _Port, _SSLPort) -> - raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - - -string_to_object(IORString) -> - string_to_object(IORString, []). - -string_to_object(IORString, Ctx) when is_list(Ctx) -> - case lists:prefix("IOR", IORString) of - true -> - {ObjRef, _, _} = iop_ior:string_decode(IORString), - ObjRef; - _ -> - %% CORBA-2.4 allows both IOR and ior prefix. - case lists:prefix("ior", IORString) of - true -> - {ObjRef, _, _} = iop_ior:string_decode(IORString), - ObjRef; - _ -> - Data = orber_cosnaming_utils:select_type(IORString), - case orber_cosnaming_utils:lookup(Data, Ctx) of - String when is_list(String) -> - {Obj, _, _} = iop_ior:string_decode(String), - Obj; - ObjRef -> - ObjRef - end - end - end; -string_to_object(IORString, Ctx) -> - orber:dbg("[~p] corba:string_to_object(~p, ~p);~n" - "Failed to supply a context list.", - [?LINE, IORString, Ctx], ?DEBUG_LEVEL), - raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%------------------------------------------------------------ -%% -%% Implementation of NON-standard functions -%% -%%------------------------------------------------------------ -create(Module, TypeID) -> - create(Module, TypeID, []). - -create(Module, TypeID, Env) -> - common_create(Module, TypeID, Env, [], 'start'). - -create(Module, TypeID, Env, {Type, RegName}) -> - common_create(Module, TypeID, Env, [{regname, {Type, RegName}}], 'start'); -create(Module, TypeID, Env, Options) -> - common_create(Module, TypeID, Env, Options, 'start'). - - -create_link(Module, TypeID) -> - create_link(Module, TypeID, []). - -create_link(Module, TypeID, Env) -> - common_create(Module, TypeID, Env, [], 'start_link'). - -create_link(Module, TypeID, Env, {Type, RegName}) -> - common_create(Module, TypeID, Env, [{regname, {Type, RegName}}], 'start_link'); -create_link(Module, TypeID, Env, Options) -> - common_create(Module, TypeID, Env, Options, 'start_link'). - - -create_remote(Node, Module, TypeID) -> - create_remote(Node, Module, TypeID, []). - -create_remote(Node, Module, TypeID, Env) -> - common_create_remote(Node, Module, TypeID, Env, [], 'start'). - -create_remote(Node, Module, TypeID, Env, {Type, RegName}) -> - common_create_remote(Node, Module, TypeID, Env, [{regname, {Type, RegName}}], 'start'); -create_remote(Node, Module, TypeID, Env, Options) -> - common_create_remote(Node, Module, TypeID, Env, Options, 'start'). - - -create_link_remote(Node, Module, TypeID) -> - create_link_remote(Node, Module, TypeID, []). - -create_link_remote(Node, Module, TypeID, Env) -> - common_create_remote(Node, Module, TypeID, Env, [], 'start_link'). - -create_link_remote(Node, Module, TypeID, Env, {Type, RegName}) -> - common_create_remote(Node, Module, TypeID, Env, [{regname, {Type, RegName}}], 'start_link'); -create_link_remote(Node, Module, TypeID, Env, Options) -> - common_create_remote(Node, Module, TypeID, Env, Options, 'start_link'). - -common_create_remote(Node, Module, TypeID, Env, {Type, RegName}, StartMethod) -> - common_create_remote(Node, Module, TypeID, Env, [{regname, {Type, RegName}}], StartMethod); -common_create_remote(Node, Module, TypeID, Env, Options, StartMethod) -> - case node_check(Node) of - true -> - rpc:call(Node, corba, common_create, [Module, TypeID, Env, Options, StartMethod]); - _ -> - orber:dbg("[~p] corba:common_create_remote(~p);~n" - "Node not in current domain.", [?LINE, Node], ?DEBUG_LEVEL), - raise(#'OBJ_ADAPTER'{completion_status=?COMPLETED_NO}) - end. - -node_check(Node) -> - lists:member(Node,orber:orber_nodes()). - -common_create(Module, _TypeID, Env, Options, StartMethod) when is_list(Options) -> - Opt = evaluate_options(Options, #options{}), - case Opt#options.regname of - [] -> - ok; - {'local', Atom} when is_atom(Atom) andalso Opt#options.persistent == false -> - ok; - {'global', _} -> - ok; - Why -> - orber:dbg("[~p] corba:common_create(~p, ~p);~n" - "Bad name type or combination(~p).", - [?LINE, Module, Options, Why], ?DEBUG_LEVEL), - raise(#'BAD_PARAM'{minor=(?ORBER_VMCID bor 1), - completion_status=?COMPLETED_NO}) - end, - case Opt of - #options{pseudo = false, passive = false} -> - case gen_server:StartMethod(Module, {Opt#options.object_flags, Env}, - Opt#options.create_options) of - {ok, Pid} -> - case catch mk_objkey(Module, Pid, Opt#options.regname, - Opt#options.persistent, - Opt#options.object_flags) of - {'EXCEPTION', E} -> - %% This branch is only used if we couldn't register - %% our new objectkey due to an internal error in orber. - gen_server:call(Pid, stop), - raise(E); - {'EXIT', _} -> - %% This branch takes care of exit values - %% which aren't expected (due to bug). - gen_server:call(Pid, stop), - raise(#'BAD_PARAM'{minor=(?ORBER_VMCID bor 1), - completion_status=?COMPLETED_NO}); - Objkey when Opt#options.sup_child == true -> - {ok, Pid, Objkey}; - Objkey -> - Objkey - end; - X -> - X - end; - #options{pseudo = true, passive = false} -> - ModuleImpl = list_to_atom(lists:concat([Module, '_impl'])), - case ModuleImpl:init(Env) of - {ok, State} -> - create_subobject_key(mk_pseudo_objkey(Module, ModuleImpl, - Opt#options.object_flags), - State); - {ok, State,_} -> - create_subobject_key(mk_pseudo_objkey(Module, ModuleImpl, - Opt#options.object_flags), - State); - Reason -> - orber:dbg("[~p] corba:common_create(~p);~n" - "'init' function incorrect(~p).", - [?LINE, ModuleImpl, Reason], ?DEBUG_LEVEL), - raise(#'BAD_PARAM'{minor=(?ORBER_VMCID bor 1), - completion_status=?COMPLETED_NO}) - end; - #options{pseudo = false, passive = true} -> - ModuleImpl = list_to_atom(lists:concat([Module, '_impl'])), - create_subobject_key(mk_passive_objkey(Module, ModuleImpl, - Opt#options.object_flags), - ?groupid_to_table(Opt#options.group_id)); - What -> - orber:dbg("[~p] corba:common_create(~p, ~p);~n" - "not a boolean(~p).", - [?LINE, Module, Options, What], ?DEBUG_LEVEL), - raise(#'BAD_PARAM'{minor=(?ORBER_VMCID bor 1), - completion_status=?COMPLETED_NO}) - end. - -%%---------------------------------------------------------------------- -%% Function : dispose -%% Arguments : Object -%% Returns : -%% Description: Terminate the object represented by the supplied reference. -%%---------------------------------------------------------------------- -dispose(?ORBER_NIL_OBJREF) -> - ok; -dispose(Obj) -> - corba_boa:dispose(Obj). - -%%---------------------------------------------------------------------- -%% Function : create_nil_objref -%% Arguments : - -%% Returns : A NIL object reference -%% Description: -%%---------------------------------------------------------------------- -create_nil_objref() -> - ?ORBER_NIL_OBJREF. - -%%---------------------------------------------------------------------- -%% Function : create_subobject_key -%% Arguments : A local object reference and an Erlang term(). -%% Returns : A new instance of the supplied reference with the -%% sub-object field changed to the given value. -%% Description: Initially, this field is set to 'undefined' -%%---------------------------------------------------------------------- -create_subobject_key(Objkey, B) when is_binary(B) -> - iop_ior:set_privfield(Objkey, B); -create_subobject_key(Objkey, T) -> - create_subobject_key(Objkey, term_to_binary(T)). - -%%---------------------------------------------------------------------- -%% Function : get_subobject_key -%% Arguments : A local object reference -%% Returns : Erlang term(). -%% Description: Return the value set by using create_subobject_key/2 -%%---------------------------------------------------------------------- -get_subobject_key(Objkey) -> - iop_ior:get_privfield(Objkey). - -%%---------------------------------------------------------------------- -%% Function : get_pid -%% Arguments : A local object reference -%% Returns : If the object is local and is associated with a pid, this -%% pid is returned. Otherwise, external- or pseudo-object, -%% an exception is raised. -%% Description: -%%---------------------------------------------------------------------- -get_pid(Objkey) -> - case iop_ior:get_key(Objkey) of - {'internal', Key, _, _, _} -> - orber_objectkeys:get_pid(Key); - {'internal_registered', Key, _, _, _} when is_atom(Key) -> - case whereis(Key) of - undefined -> - raise(#'OBJECT_NOT_EXIST'{completion_status=?COMPLETED_NO}); - Pid -> - Pid - end; - R -> - orber:dbg("[~p] corba:get_pid(~p);~n" - "Probably a pseudo- or external object(~p).", - [?LINE, Objkey, R], ?DEBUG_LEVEL), - raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}) - end. - -%%---------------------------------------------------------------------- -%% Function : raise -%% Arguments : Local exception representation. -%% Returns : Throws the exception. -%% Description: -%%---------------------------------------------------------------------- -%% To avoid dialyzer warnings due to the use of exit/throw. --spec raise(term()) -> no_return(). -raise(E) -> - throw({'EXCEPTION', E}). - -%%---------------------------------------------------------------------- -%% Function : raise_with_state -%% Arguments : Local exception representation. -%% Returns : Throws the exception. -%% Description: -%%---------------------------------------------------------------------- -%% To avoid dialyzer warnings due to the use of exit/throw. --spec raise_with_state(term(), term()) -> no_return(). -raise_with_state(E, State) -> - throw({reply, {'EXCEPTION', E}, State}). - -%%---------------------------------------------------------------------- -%% Function : reply -%% Arguments : To - pid -%% Reply - Erlang term(). -%% Returns : -%% Description: Used to reply to the invoker but still be able -%% to do some more work in the callback module. -%%---------------------------------------------------------------------- -reply(To, Reply) -> - gen_server:reply(To, Reply). - -%%---------------------------------------------------------------------- -%% Function : print_object -%% Arguments : An object represented as one of the following: -%% - local (tuple) -%% - IOR -%% - stringified IOR -%% - corbaloc- or corbaname-schema -%% IoDevice - the same as the io-module defines. -%% Returns : -%% Description: Prints the object's components and profiles. -%%---------------------------------------------------------------------- -print_object(Object) -> - iop_ior:print(Object). -print_object(Object, IoDevice) -> - iop_ior:print(IoDevice, Object). - -%%---------------------------------------------------------------------- -%% Function : add_alternate_iiop_address -%% Arguments : Local object (tuple or IOR). -%% IP - IP-string -%% Port - integer(). -%% Returns : A local IOR with a TAG_ALTERNATE_IIOP_ADDRESS component. -%% Description: -%%---------------------------------------------------------------------- -add_alternate_iiop_address(Obj, Host, Port) when is_list(Host) andalso is_integer(Port) -> - TC = #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS, - component_data = #'ALTERNATE_IIOP_ADDRESS'{ - 'HostID' = Host, - 'Port' = Port}}, - iop_ior:add_component(Obj, TC); -add_alternate_iiop_address(_, Host, Port) -> - orber:dbg("[~p] corba:add_alternate_iiop_address(~p, ~p);~n" - "Incorrect argument(s). Host must be IP-string and Port an integer.", - [?LINE, Host, Port], ?DEBUG_LEVEL), - raise(#'BAD_PARAM'{completion_status = ?COMPLETED_NO}). - - -%%---------------------------------------------------------------------- -%% Function : add_FTGroup_component -%% Arguments : Local object (tuple or IOR). -%% FTDomain - FT Domain. String(). -%% GroupID - Replicated object group's id. Integer(). (ulonglong) -%% GroupVer - Object group's version number. Integer(). (ulong) -%% Returns : A local IOR with one TAG_FT_GROUP component. -%% Description: -%%---------------------------------------------------------------------- -add_FTGroup_component(Obj, FTDomain, GroupID, GroupVer) - when is_list(FTDomain) andalso is_integer(GroupID) andalso is_integer(GroupVer) andalso - GroupID >= ?ULONGLONGMIN andalso GroupID =< ?ULONGLONGMAX andalso - GroupVer >= ?ULONGMIN andalso GroupVer =< ?ULONGMAX -> - TC = #'IOP_TaggedComponent'{tag = ?TAG_FT_GROUP, - component_data = #'FT_TagFTGroupTaggedComponent'{ - version = #'GIOP_Version'{major = 1, minor = 0}, - ft_domain_id = FTDomain, - object_group_id = GroupID, - object_group_ref_version = GroupVer}}, - iop_ior:add_component(Obj, TC); -add_FTGroup_component(_Obj, FTDomain, GroupID, GroupVer) -> - orber:dbg("[~p] corba:add_FTGroup_component(~p, ~p, ~p);~n" - "Incorrect argument(s).", - [?LINE, FTDomain, GroupID, GroupVer], ?DEBUG_LEVEL), - raise(#'BAD_PARAM'{completion_status = ?COMPLETED_NO}). - - -%%---------------------------------------------------------------------- -%% Function : add_FTPrimary_component -%% Arguments : Local object (tuple or IOR). -%% Returns : A local IOR with one TAG_FT_PRIMARY component. -%% Description: -%%---------------------------------------------------------------------- -add_FTPrimary_component(Obj) -> - TC = #'IOP_TaggedComponent'{ - tag=?TAG_FT_PRIMARY, - component_data=#'FT_TagFTPrimaryTaggedComponent'{primary = true}}, - iop_ior:add_component(Obj, TC). - - -%%----------------------------------------------------------------- -%% Generic functions for accessing the call-back modules (i.e. X_impl.erl). -%% These functions are invoked by the generated stubs. -%%----------------------------------------------------------------- -handle_init(M, {Flags, Env}) -> - case M:init(Env) of - {ok, State} -> - {ok, {#is{flags = Flags}, State}}; - {ok,State,Timeout} -> - {ok, {#is{flags = Flags}, State}, Timeout}; - Other -> - %% E.g. ignore | {stop, Reason} - Other - end. - - -handle_terminate(M, Reason, {_InternalState, State}) -> - catch (M:terminate(Reason, State)). - -handle_info(M, Info, {InternalState, State}) -> - case catch M:handle_info(Info, State) of - {noreply,NewState} -> - {noreply, {InternalState, NewState}}; - {noreply, NewState, Timeout} -> - {noreply, {InternalState, NewState}, Timeout}; - {stop, Reason, NewState} -> - {stop, Reason, {InternalState, NewState}}; - {'EXIT', Why} -> - handle_exit(InternalState, State, Why, true, - {M, handle_info}, [Info, State]) - end. - -handle_code_change(M, OldVsn, {InternalState, State}, Extra) -> - {ok, NewState} = M:code_change(OldVsn, State, Extra), - {ok, {InternalState, NewState}}. - - -%% This function handles call Pre- & Post-conditions. -handle_call(M, F, A, {InternalState, State}, Ctx, This, From, - PreData, PostData, Stub) -> - CArgs = call_state(A, State, This, From), - case catch invoke_precond(PreData, Stub, F, CArgs) of - {'EXIT', Why} -> - handle_exit(InternalState, State, Why, false, PreData, [Stub, F, CArgs]); - {'EXCEPTION', E} -> - {reply, {'EXCEPTION', E}, {InternalState, State}}; - ok -> - Result = handle_call2(M, F, CArgs, InternalState, State, Ctx), - case catch invoke_postcond(PostData, Stub, F, CArgs, Result) of - {'EXIT', Why} -> - handle_exit(InternalState, State, Why, false, PostData, A); - {'EXCEPTION', E} -> - {reply, {'EXCEPTION', E}, {InternalState, State}}; - ok -> - Result - end - end. - - -invoke_precond(false, _, _, _) -> - ok; -invoke_precond({CondM, CondF}, Stub, F, CArgs) -> - CondM:CondF(Stub, F, CArgs). - -%% We must remove the Internal State before invoking post-cond. -invoke_postcond(false, _, _, _, _) -> - ok; -invoke_postcond({CondM, CondF}, Stub, F, CArgs, {reply, Reply, {_, NS}}) -> - CondM:CondF(Stub, F, CArgs, {reply, Reply, NS}); -invoke_postcond({CondM, CondF}, Stub, F, CArgs, {reply, Reply, {_, NS}, Timeout}) -> - CondM:CondF(Stub, F, CArgs, {reply, Reply, NS, Timeout}); -invoke_postcond({CondM, CondF}, Stub, F, CArgs, {stop, Reason, Reply, {_, NS}}) -> - CondM:CondF(Stub, F, CArgs, {stop, Reason, Reply, NS}); -invoke_postcond({CondM, CondF}, Stub, F, CArgs, {stop, Reason, {_, NS}}) -> - CondM:CondF(Stub, F, CArgs, {stop, Reason, NS}); -invoke_postcond({CondM, CondF}, Stub, F, CArgs, {noreply,{_, NS}}) -> - CondM:CondF(Stub, F, CArgs, {noreply,NS}); -invoke_postcond({CondM, CondF}, Stub, F, CArgs, {noreply,{_, NS}, Timeout}) -> - CondM:CondF(Stub, F, CArgs, {noreply, NS, Timeout}); -invoke_postcond({CondM, CondF}, Stub, F, CArgs, Result) -> - CondM:CondF(Stub, F, CArgs, Result). - - -handle_call(M, F, A, {InternalState, State}, Ctx, This, From) -> - handle_call2(M, F, call_state(A, State, This, From), InternalState, State, Ctx). - -handle_call2(M, F, A, InternalState, State, []) -> - case catch apply(M, F, A) of - {reply, Reply, NewState} -> - {reply, add_context(Reply), {InternalState, NewState}}; - {reply, Reply, NewState, Timeout} -> - {reply, add_context(Reply), {InternalState, NewState}, Timeout}; - {stop, Reason, Reply, NewState} -> - {stop, Reason, add_context(Reply), {InternalState, NewState}}; - {stop, Reason, NewState} -> - {stop, Reason, {InternalState, NewState}}; - {noreply,NewState} -> - {noreply,{InternalState, NewState}}; - {noreply,NewState,Timeout} -> - {noreply,{InternalState, NewState},Timeout}; - {'EXIT', Reason} -> - handle_exit(InternalState, State, Reason, false, {M, F}, A); - {'EXCEPTION', E} -> - {reply, add_context({'EXCEPTION', E}), {InternalState, State}}; - {Reply, NewState} -> - {reply, add_context(Reply), {InternalState, NewState}} - end; -handle_call2(M, F, A, InternalState, State, Ctx) -> - %% Set the new Context. - put(oe_server_in_context, Ctx), - case catch apply(M, F, A) of - {reply, Reply, NewState} -> - put(oe_server_in_context, undefined), - {reply, add_context(Reply), {InternalState, NewState}}; - {reply, Reply, NewState, Timeout} -> - put(oe_server_in_context, undefined), - {reply, add_context(Reply), {InternalState, NewState}, Timeout}; - {stop, Reason, Reply, NewState} -> - {stop, Reason, add_context(Reply), {InternalState, NewState}}; - {stop, Reason, NewState} -> - {stop, Reason, {InternalState, NewState}}; - {noreply,NewState} -> - put(oe_server_in_context, undefined), - {noreply, {InternalState, NewState}}; - {noreply, {InternalState, NewState}, Timeout} -> - put(oe_server_in_context, undefined), - {noreply, {InternalState, NewState},Timeout}; - {'EXIT', Reason} -> - handle_exit(InternalState, State, Reason, false, {M, F}, A); - {'EXCEPTION', E} -> - put(oe_server_in_context, undefined), - {reply, add_context({'EXCEPTION', E}), {InternalState, State}}; - {Reply, NewState} -> - put(oe_server_in_context, undefined), - {reply, add_context(Reply), {InternalState, NewState}} - end. - -call_state(A, State, false, false) -> - [State|A]; -call_state(A, State, false, From) -> - [From, State|A]; -call_state(A, State, This, false) -> - [This, State|A]; -call_state(A, State, This, From) -> - [This, From, State|A]. - -cast_state(A, State, false) -> - [State|A]; -cast_state(A, State, This) -> - [This, State|A]. - -add_context(Reply) -> - %% Reset oe_server_out_context - case put(oe_server_out_context, undefined) of - undefined -> - Reply; - _OutCtx -> - %% The previous value wasn't 'undefined', which means that - %% the server supplied a return context. - Reply - end. - - -%% This function handles call Pre- & Post-conditions. -handle_cast(M, F, A, {InternalState, State}, Ctx, This, PreData, PostData, Stub) -> - CArgs = cast_state(A, State, This), - case catch invoke_precond(PreData, Stub, F, CArgs) of - {'EXIT', Why} -> - handle_exit(InternalState, State, Why, true, PreData, [Stub, F, CArgs]); - {'EXCEPTION', _} -> - {noreply, {InternalState, State}}; - ok -> - Result = handle_cast2(M, F, CArgs, InternalState, State, Ctx), - case catch invoke_postcond(PostData, Stub, F, CArgs, Result) of - {'EXIT', Why} -> - handle_exit(InternalState, State, Why, true, PostData, A); - {'EXCEPTION', _} -> - {noreply, {InternalState, State}}; - ok -> - Result - end - end. - - -handle_cast(M, F, A, {InternalState, State}, Ctx, This) -> - handle_cast2(M, F, cast_state(A, State, This), InternalState, State, Ctx). - -handle_cast2(M, F, A, InternalState, State, []) -> - case catch apply(M, F, A) of - {noreply, NewState} -> - {noreply, {InternalState, NewState}}; - {noreply, NewState, Timeout} -> - {noreply, {InternalState, NewState}, Timeout}; - {stop, Reason, NewState} -> - {stop, Reason, {InternalState, NewState}}; - {'EXCEPTION', _} -> - {noreply, {InternalState, State}}; - {'EXIT', Reason} -> - handle_exit(InternalState, State, Reason, true, {M, F}, A); - NewState -> - {noreply, {InternalState, NewState}} - end; -handle_cast2(M, F, A, InternalState, State, Ctx) -> - put(oe_server_in_context, Ctx), - case catch apply(M, F, A) of - {noreply, NewState} -> - put(oe_server_in_context, undefined), - {noreply, {InternalState, NewState}}; - {noreply, NewState, Timeout} -> - put(oe_server_in_context, undefined), - {noreply, {InternalState, NewState}, Timeout}; - {stop, Reason, NewState} -> - {stop, Reason, {InternalState, NewState}}; - {'EXCEPTION', _} -> - put(oe_server_in_context, undefined), - {noreply, {InternalState, State}}; - {'EXIT', Reason} -> - handle_exit(InternalState, State, Reason, true, {M, F}, A); - NewState -> - put(oe_server_in_context, undefined), - {noreply, {InternalState, NewState}} - end. - -handle_exit(InternalState, State, {undef, [{M, F, _, _}|_]} = Reason, - OnewayOp, {M, F}, A) -> - case catch check_exports(M:module_info(exports), F) of - {'EXIT',{undef,_}} -> - %% No such module. - orber:dbg("~p.beam doesn't exist.~n" - "Check IC compile options (e.g. 'impl') and that the~n" - "beam-file is load-able.", - [M], ?DEBUG_LEVEL), - reply_after_exit(InternalState, State, Reason, OnewayOp, - #'OBJ_ADAPTER'{minor=(?ORBER_VMCID bor 1), - completion_status=?COMPLETED_MAYBE}); - "" -> - orber:dbg("~p:~p/~p doesn't exist.~n" - "Check spelling, export-attributes etc", - [M, F, length(A)], ?DEBUG_LEVEL), - reply_after_exit(InternalState, State, Reason, OnewayOp, - #'OBJ_ADAPTER'{minor=(?ORBER_VMCID bor 2), - completion_status=?COMPLETED_MAYBE}); - Exports when is_list(Exports) -> - orber:dbg("~p:~p/~p doesn't exist.~n" - "~p:~p~s do exists.~nCheck export-attributes etc", - [M, F, length(A), M, F, Exports], ?DEBUG_LEVEL), - reply_after_exit(InternalState, State, Reason, OnewayOp, - #'OBJ_ADAPTER'{minor=(?ORBER_VMCID bor 3), - completion_status=?COMPLETED_MAYBE}); - _ -> - %% Should never happen - reply_after_exit(InternalState, State, Reason, OnewayOp, - #'OBJ_ADAPTER'{minor=(?ORBER_VMCID bor 4), - completion_status=?COMPLETED_MAYBE}) - end; -handle_exit(InternalState, State, {undef, [{M2, F2, A2, _}|_]} = Reason, - OnewayOp, {M, F}, A) -> - case catch check_exports(M2:module_info(exports), F2) of - {'EXIT',{undef,_}} -> - %% No such module. - orber:dbg("~p.beam doesn't exist.~n" - "~p:~p/~p invoked an operation on the module above.~n" - "Check IC compile options and that the beam-file is load-able.", - [M2, M, F, length(A)], ?DEBUG_LEVEL), - reply_after_exit(InternalState, State, Reason, OnewayOp, - #'OBJ_ADAPTER'{minor=(?ORBER_VMCID bor 5), - completion_status=?COMPLETED_MAYBE}); - "" -> - orber:dbg("~p:~p/~p doesn't exist.~n" - "~p:~p/~p invoked the operation above~n" - "Check spelling, export-attributes etc", - [M2, F2, length(A2), M, F, length(A)], ?DEBUG_LEVEL), - reply_after_exit(InternalState, State, Reason, OnewayOp, - #'OBJ_ADAPTER'{minor=(?ORBER_VMCID bor 6), - completion_status=?COMPLETED_MAYBE}); - Exports when is_list(Exports) -> - orber:dbg("~p:~p/~p doesn't exist.~n" - "~p:~p~s do exist(s).~nCheck export-attributes etc~n" - "~p:~p/~p invoked the operation above~n", - [M2, F2, length(A2), M2, F2, Exports, M, F, length(A)], ?DEBUG_LEVEL), - reply_after_exit(InternalState, State, Reason, OnewayOp, - #'OBJ_ADAPTER'{minor=(?ORBER_VMCID bor 7), - completion_status=?COMPLETED_MAYBE}); - _ -> - %% Should never happen - reply_after_exit(InternalState, State, Reason, OnewayOp, - #'OBJ_ADAPTER'{minor=(?ORBER_VMCID bor 4), - completion_status=?COMPLETED_MAYBE}) - end; -%% Misc errors. We separate between direct and in-direct errors. Due to different -%% notation we must separate between different cases. -handle_exit(InternalState, State, {{case_clause,_}, [{M, F, _}|_]} = Reason, - OnewayOp, {M, F}, A) -> - orber:dbg("~p:~p/~p contains a 'case_clause' error.", - [M, F, length(A)], ?DEBUG_LEVEL), - reply_after_exit(InternalState, State, Reason, OnewayOp, - #'OBJ_ADAPTER'{minor=(?ORBER_VMCID bor 8), - completion_status=?COMPLETED_MAYBE}); -handle_exit(InternalState, State, {Reason, [{M, F, _}|_]}, OnewayOp, {M, F}, A) -> - orber:dbg("~p:~p/~p contains a '~p' error.", - [M, F, length(A), Reason], ?DEBUG_LEVEL), - reply_after_exit(InternalState, State, Reason, OnewayOp, - #'OBJ_ADAPTER'{minor=(?ORBER_VMCID bor 8), - completion_status=?COMPLETED_MAYBE}); -handle_exit(InternalState, State, {function_clause, [{M2, F2, A2}|_]} = Reason, - OnewayOp, {M, F}, A) -> - orber:dbg("~p:~p/~p contains a 'function_clause' error.~n" - "Invoked via the operation:~n" - "~p:~p/~p", - [M2, F2, length(A2), M, F, length(A)], ?DEBUG_LEVEL), - reply_after_exit(InternalState, State, Reason, OnewayOp, - #'OBJ_ADAPTER'{minor=(?ORBER_VMCID bor 9), - completion_status=?COMPLETED_MAYBE}); -handle_exit(InternalState, State, {{case_clause,_}, [{M2, F2, A2}|_]} = Reason, - OnewayOp, {M, F}, A) -> - orber:dbg("~p:~p/~p contains a 'case_clause' error.~n" - "Invoked via the operation:~n" - "~p:~p/~p", - [M2, F2, A2, M, F, length(A)], ?DEBUG_LEVEL), - reply_after_exit(InternalState, State, Reason, OnewayOp, - #'OBJ_ADAPTER'{minor=(?ORBER_VMCID bor 9), - completion_status=?COMPLETED_MAYBE}); -handle_exit(InternalState, State, {Reason, [{M2, F2, A2}|_]} = Reason, - OnewayOp, {M, F}, A) -> - orber:dbg("~p:~p/~p contains a '~p' error.~n" - "Invoked via the operation:~n" - "~p:~p/~p", - [M2, F2, A2, Reason, M, F, length(A)], ?DEBUG_LEVEL), - reply_after_exit(InternalState, State, Reason, OnewayOp, - #'OBJ_ADAPTER'{minor=(?ORBER_VMCID bor 9), - completion_status=?COMPLETED_MAYBE}); -handle_exit(InternalState, State, Reason, OnewayOp, {M, F}, A) -> - orber:dbg("~p:~p(~p) ->~n" - " {EXIT, ~p}~n", - [M, F, A, Reason], ?DEBUG_LEVEL), - reply_after_exit(InternalState, State, Reason, OnewayOp, - #'OBJ_ADAPTER'{minor=(?ORBER_VMCID bor 10), - completion_status=?COMPLETED_MAYBE}). - - -reply_after_exit(#is{flags = Flags} = InternalState, State, - Reason, OnewayOp, Exc) -> - case ?ORB_FLAG_TEST(Flags, ?ORB_SURVIVE_EXIT) of - false -> - exit(Reason); - true when OnewayOp == false -> - put(oe_server_in_context, undefined), - {reply, {'EXCEPTION', Exc}, {InternalState, State}}; - true -> - %% One-way operation. Cannot return exception. - put(oe_server_in_context, undefined), - {noreply, {InternalState, State}} - end. - - -check_exports(Exports, Op) -> - check_exports(Exports, Op, []). - -check_exports([], _, Acc) -> - Acc; -check_exports([{Op, Arity}|Rest], Op, Acc) -> - check_exports(Rest, Op, Acc ++ "/" ++ integer_to_list(Arity)); -check_exports([_|Rest], Op, Acc) -> - check_exports(Rest, Op, Acc). - - -%%----------------------------------------------------------------- -%% Corba:call - the function for reqests -%%----------------------------------------------------------------- -call(Obj, Func, Args, TypesOrMod) -> - call_helper(Obj, Func, Args, TypesOrMod, infinity, []). - -call(Obj, Func, Args, TypesOrMod, [{context, Ctx}]) -> - call_helper(Obj, Func, Args, TypesOrMod, infinity, Ctx); -call(Obj, Func, Args, TypesOrMod, [{timeout, Timeout}]) -> - call_helper(Obj, Func, Args, TypesOrMod, Timeout, []); -call(Obj, Func, Args, TypesOrMod, Extra) when is_list(Extra) -> - ExtraData = extract_extra_data(Extra, #extra{}), - call_helper(Obj, Func, Args, TypesOrMod, ExtraData#extra.timeout, - ExtraData#extra.context); -call(Obj, Func, Args, TypesOrMod, Timeout) -> - call_helper(Obj, Func, Args, TypesOrMod, Timeout, []). - -call_helper(Obj, Func, Args, TypesOrMod, Timeout, InCtx) -> - Ctx = get_implicit_context(InCtx), - case iop_ior:get_key(Obj) of - {'internal', Key, _, Flags, Mod} -> - Pid = orber_objectkeys:get_pid(Key), - call_internal(Pid, Obj, Func, Args, TypesOrMod, - ?ORB_FLAG_TEST(Flags, ?ORB_TYPECHECK), - ?ORB_FLAG_TEST(Flags, ?ORB_USE_PI), Mod, Timeout, Ctx); - {'internal_registered', Key, _, Flags, Mod} -> - call_internal(Key, Obj, Func, Args, TypesOrMod, - ?ORB_FLAG_TEST(Flags, ?ORB_TYPECHECK), - ?ORB_FLAG_TEST(Flags, ?ORB_USE_PI), Mod, Timeout, Ctx); - {'external', Key} when is_atom(TypesOrMod) -> - case catch TypesOrMod:oe_tc(Func) of - {'EXIT', What} -> - orber:dbg("[~p] corba:call_helper(~p);~n" - "The call-back module does not exist or" - " incorrect IC-version used.~nReason: ~p", - [?LINE, TypesOrMod, What], ?DEBUG_LEVEL), - raise(#'TRANSIENT'{minor=(?ORBER_VMCID bor 7), - completion_status=?COMPLETED_NO}); - undefined -> - raise(#'BAD_OPERATION'{minor = (?ORBER_VMCID bor 4), - completion_status=?COMPLETED_NO}); - Types -> - orber_iiop:request(Key, Func, Args, Types, 'true', Timeout, Obj, Ctx) - end; - {'external', Key} -> - orber_iiop:request(Key, Func, Args, TypesOrMod, 'true', Timeout, Obj, Ctx) - end. - -get_implicit_context([]) -> - case get(oe_server_in_context) of - undefined -> - []; - ImplCtx -> - ImplCtx - end; -get_implicit_context(Ctx) -> - case get(oe_server_in_context) of - undefined -> - Ctx; - ImplCtx -> - %% Both defined. An explicit interface context overrides - %% an implicit. - case check_for_interface_ctx(Ctx) of - false -> - ImplCtx; - true -> - remove_interface_ctx(ImplCtx, Ctx) - end - end. - -check_for_interface_ctx([]) -> - false; -check_for_interface_ctx([#'IOP_ServiceContext' - {context_id=?ORBER_GENERIC_CTX_ID, - context_data = {interface, _I}}|_]) -> - true; -check_for_interface_ctx([_|T]) -> - check_for_interface_ctx(T). - -remove_interface_ctx([], Acc) -> - Acc; -remove_interface_ctx([#'IOP_ServiceContext' - {context_id=?ORBER_GENERIC_CTX_ID, - context_data = {interface, _I}}|T], Acc) -> - remove_interface_ctx(T, Acc); -remove_interface_ctx([H|T], Acc) -> - remove_interface_ctx(T, [H|Acc]). - - -extract_extra_data([], ED) -> - ED; -extract_extra_data([{context, Ctx}|T], ED) -> - extract_extra_data(T, ED#extra{context = Ctx}); -extract_extra_data([{timeout, Timeout}|T], ED) -> - extract_extra_data(T, ED#extra{timeout = Timeout}). - -call_internal(Pid, Obj, Func, Args, Types, Check, PI, Mod, Timeout, Ctx) - when is_pid(Pid) andalso node(Pid) == node() -> - invoke_pi_request(PI, Obj, Ctx, Func, Args), - typecheck_request(Check, Args, Types, Func), - case catch gen_server:call(Pid, {Obj, Ctx, Func, Args}, Timeout) of - {'EXCEPTION', E} -> - invoke_pi_reply(PI, Obj, Ctx, Func, {'EXCEPTION', E}), - typecheck_reply(Check, {'EXCEPTION', E}, Mod, Func), - raise(E); - {'EXIT',{timeout, _}} -> - Exc = #'TIMEOUT'{completion_status=?COMPLETED_MAYBE}, - invoke_pi_reply(PI, Obj, Ctx, Func, {'EXCEPTION', Exc}), - raise(Exc); - {'EXIT',R} -> - orber:dbg("[~p] corba:call_internal(~p, ~p, ~p);~ncall exit(~p).", - [?LINE, Func, Args, Types, R], ?DEBUG_LEVEL), - Exc = #'TRANSIENT'{minor=(?ORBER_VMCID bor 4), - completion_status=?COMPLETED_NO}, - invoke_pi_reply(PI, Obj, Ctx, Func, {'EXCEPTION', Exc}), - raise(Exc); - Res -> - invoke_pi_reply(PI, Obj, Ctx, Func, Res), - typecheck_reply(Check, Res, Types, Func), - Res - end; -call_internal(Pid, Obj, Func, Args, Types, Check, PI, - _Mod, Timeout, Ctx) when is_pid(Pid) -> - typecheck_request(Check, Args, Types, Func), - case catch rpc:call(node(Pid), corba, call_relay, - [Pid, {Obj, Ctx, Func, Args}, Timeout]) of - {'EXCEPTION', E} -> - invoke_pi_reply(PI, Obj, Ctx, Func, {'EXCEPTION', E}), - typecheck_reply(Check, {'EXCEPTION', E}, Types, Func), - raise(E); - {badrpc, {'EXIT',R}} -> - orber:dbg("[~p] corba:call_internal(~p, ~p, ~p);~ncall exit(~p).", - [?LINE, Func, Args, Types, R], ?DEBUG_LEVEL), - Exc = #'TRANSIENT'{minor=(?ORBER_VMCID bor 3), - completion_status=?COMPLETED_MAYBE}, - invoke_pi_reply(PI, Obj, Ctx, Func, {'EXCEPTION', Exc}), - raise(Exc); - {badrpc,nodedown} -> - orber:dbg("[~p] corba:call_internal(~p, ~p, ~p);~nNode ~p down.", - [?LINE, Func, Args, Types, node(Pid)], ?DEBUG_LEVEL), - Exc = #'TRANSIENT'{minor=(?ORBER_VMCID bor 2), - completion_status=?COMPLETED_NO}, - invoke_pi_reply(PI, Obj, Ctx, Func, {'EXCEPTION', Exc}), - raise(Exc); - {badrpc, Reason} -> - orber:dbg("[~p] corba:call_internal(~p, ~p, ~p);~n" - "Unable to invoke operation due to: ~p", - [?LINE, Func, Args, Types, Reason], ?DEBUG_LEVEL), - Exc = #'TRANSIENT'{minor=(?ORBER_VMCID bor 5), - completion_status=?COMPLETED_MAYBE}, - invoke_pi_reply(PI, Obj, Ctx, Func, {'EXCEPTION', Exc}), - raise(Exc); - Res -> - invoke_pi_reply(PI, Obj, Ctx, Func, Res), - typecheck_reply(Check, Res, Types, Func), - Res - end; - -%% This case handles if the reference is created as a Pseudo object. -%% Just call apply/3. -call_internal({pseudo, Module}, Obj, Func, Args, Types, Check, PI, - _Mod, _Timeout, Ctx) -> - OldCtx = put(oe_server_in_context, Ctx), - invoke_pi_request(PI, Obj, Ctx, Func, Args), - typecheck_request(Check, Args, Types, Func), - State = binary_to_term(get_subobject_key(Obj)), - case catch apply(Module, Func, [Obj, State|Args]) of - {noreply, _} -> - put(oe_server_in_context, OldCtx), - ok; - {noreply, _, _} -> - put(oe_server_in_context, OldCtx), - ok; - {reply, Reply, _} -> - put(oe_server_in_context, OldCtx), - invoke_pi_reply(PI, Obj, Ctx, Func, Reply), - typecheck_reply(Check, Reply, Types, Func), - Reply; - {reply, Reply, _, _} -> - put(oe_server_in_context, OldCtx), - invoke_pi_reply(PI, Obj, Ctx, Func, Reply), - typecheck_reply(Check, Reply, Types, Func), - Reply; - {stop, _, Reply, _} -> - put(oe_server_in_context, OldCtx), - invoke_pi_reply(PI, Obj, Ctx, Func, Reply), - typecheck_reply(Check, Reply, Types, Func), - Reply; - {stop, _, _} -> - put(oe_server_in_context, OldCtx), - ok; - {'EXCEPTION', E} -> - put(oe_server_in_context, OldCtx), - invoke_pi_reply(PI, Obj, Ctx, Func, {'EXCEPTION', E}), - typecheck_reply(Check, {'EXCEPTION', E}, Types, Func), - raise(E); - {'EXIT', What} -> - put(oe_server_in_context, OldCtx), - orber:dbg("[~p] corba:call_internal(~p, ~p, ~p);~n" - "Pseudo object exit(~p).", - [?LINE, Func, Args, Types, What], ?DEBUG_LEVEL), - Exc = #'TRANSIENT'{minor=(?ORBER_VMCID bor 4), - completion_status=?COMPLETED_MAYBE}, - invoke_pi_reply(PI, Obj, Ctx, Func, {'EXCEPTION', Exc}), - raise(Exc); - Unknown -> - put(oe_server_in_context, OldCtx), - orber:dbg("[~p] corba:call_internal(~p, ~p, ~p);~n" - "Pseudo object failed due to bad return value (~p).", - [?LINE, Func, Args, Types, Unknown], ?DEBUG_LEVEL), - Exc = #'TRANSIENT'{minor=(?ORBER_VMCID bor 6), - completion_status=?COMPLETED_MAYBE}, - invoke_pi_reply(PI, Obj, Ctx, Func, {'EXCEPTION', Exc}), - raise(Exc) - end; -call_internal({passive, Module}, Obj, Func, Args, Types, Check, PI, - Mod, Timeout, Ctx) -> - invoke_pi_request(PI, Obj, Ctx, Func, Args), - typecheck_request(Check, Args, Types, Func), - GroupID = binary_to_term(get_subobject_key(Obj)), - Transaction = - fun() -> - ObjectGroup = read_object_group(GroupID), - call_primary_protected(ObjectGroup, Module, Obj, - Func, Args, GroupID, - get_FTRequestCtx(Ctx)) - end, - case mnesia:transaction(Transaction) of - {atomic, Reply} -> - %% this check should be inside transaction so that - %% failing typecheck_reply would result in transaction - %% abortion. Or not. call_internal(Registered...) does not - %% cancel the state transition even if the result isn't type compliant. - %% So, we do likewise. - typecheck_reply(Check, Reply, Mod, Func), - Reply; - {aborted, {not_primary, Primary, _}} -> - FTRequestCtx = mk_FTRequestCtx(10000000), - case rpc:call(Primary, corba, call_internal, - [{passive, Module}, Obj, Func, Args, - Types, Check, PI, Mod, Timeout, - [FTRequestCtx|Ctx]]) of - {badrpc, Reason} -> - orber:dbg("[~p] corba:call_passive(~p, ~p, ~p); ~n" - " badrpc(~p).", - [?LINE, Func, Args, Types, Reason],?DEBUG_LEVEL), - raise(#'TRANSIENT'{minor=0, - completion_status=?COMPLETED_MAYBE}); - %% one should keep trying request_duration_policy_value -time. - {'EXCEPTION', E} -> - invoke_pi_reply(PI, Obj, Ctx, Func, {'EXCEPTION', E}), - raise(E); - Reply -> - %% is this typecheck_reply neccessary? The check is made - %% on the remote node... - invoke_pi_reply(PI, Obj, Ctx, Func, Reply), - typecheck_reply(Check, Reply, Mod, Func), - Reply - %% generate RetentionID's and call Primary node with flag that tells - %% the node not to escalate rpc call's to next node if the primary - %% has changed again. - %% raise({not_primary, Primary}); - end; - {aborted, {throw, {'EXCEPTION', E}}} -> - invoke_pi_reply(PI, Obj, Ctx, Func, {'EXCEPTION', E}), - typecheck_reply(Check, {'EXCEPTION', E}, Mod, Func), - raise(E); - {aborted, {'EXIT', What}} -> - orber:dbg("[~p] corba:call_passive(~p, ~p, ~p); " ++ - "Passive object exit(~p).", - [?LINE, Func, Args, Types, What], ?DEBUG_LEVEL), - Exc = #'TRANSIENT'{minor=(?ORBER_VMCID bor 4), - completion_status=?COMPLETED_MAYBE}, - invoke_pi_reply(PI, Obj, Ctx, Func, {'EXCEPTION', Exc}), - raise(Exc); - {aborted, Unknown} -> - orber:dbg("[~p] corba:call_passive(~p, ~p, ~p); " ++ - "Passive object failed due to bad return value (~p).", - [?LINE, Func, Args, Types, Unknown], ?DEBUG_LEVEL), - Exc = #'TRANSIENT'{minor=(?ORBER_VMCID bor 6), - completion_status=?COMPLETED_MAYBE}, - invoke_pi_reply(PI, Obj, Ctx, Func, {'EXCEPTION', Exc}), - raise(Exc) - end; -call_internal(Registered, Obj, Func, Args, Types, Check, PI, - _Mod, Timeout, Ctx) when is_atom(Registered)-> - invoke_pi_request(PI, Obj, Ctx, Func, Args), - typecheck_request(Check, Args, Types, Func), - case whereis(Registered) of - undefined -> - Exc = #'OBJECT_NOT_EXIST'{completion_status=?COMPLETED_NO}, - invoke_pi_reply(PI, Obj, Ctx, Func, {'EXCEPTION', Exc}), - raise(Exc); - P -> - case catch gen_server:call(P, {Obj, Ctx, Func, Args}, Timeout) of - {'EXCEPTION', E} -> - invoke_pi_reply(PI, Obj, Ctx, Func, {'EXCEPTION', E}), - typecheck_reply(Check, {'EXCEPTION', E}, Types, Func), - raise(E); - {'EXIT',{timeout, _}} -> - Exc = #'TIMEOUT'{completion_status=?COMPLETED_MAYBE}, - invoke_pi_reply(PI, Obj, Ctx, Func, {'EXCEPTION', Exc}), - raise(Exc); - {'EXIT',R} -> - orber:dbg("[~p] corba:call_internal(~p, ~p, ~p).~n" - "call exit(~p).", - [?LINE, Func, Args, Types, R], ?DEBUG_LEVEL), - Exc = #'TRANSIENT'{minor=(?ORBER_VMCID bor 5), - completion_status=?COMPLETED_MAYBE}, - invoke_pi_reply(PI, Obj, Ctx, Func, {'EXCEPTION', Exc}), - raise(Exc); - Res -> - invoke_pi_reply(PI, Obj, Ctx, Func, Res), - typecheck_reply(Check, Res, Types, Func), - Res - end - end. - -invoke_pi_request(false, _Obj, _Ctx, _Func, _Args) -> - ok; -invoke_pi_request(_, Obj, Ctx, Func, Args) -> - case orber:get_cached_interceptors() of - {native, PIs} -> - orber_pi:out_request(PIs, Obj, Ctx, Func, "localhost", Args); - _ -> - ok - end. - -invoke_pi_reply(false, _Obj, _Ctx, _Func, _Res) -> - ok; -invoke_pi_reply(_, Obj, Ctx, Func, Res) -> - case orber:get_cached_interceptors() of - {native, PIs} -> - orber_pi:in_reply(PIs, Obj, Ctx, Func, "localhost", Res); - _ -> - ok - end. - -typecheck_request(false, _, _, _) -> - ok; -typecheck_request(true, Args, Mod, Func) when is_atom(Mod) -> - case catch Mod:oe_tc(Func) of - undefined -> - raise(#'BAD_OPERATION'{minor = (?ORBER_VMCID bor 4), - completion_status=?COMPLETED_NO}); - {'EXIT', What} -> - orber:dbg("[~p] corba:typecheck_request(~p, ~p, ~p);~n" - "The call-back module does not exist or incorrect" - "IC-version used.~nReason: ~p", - [?LINE, Mod, Func, Args, What], ?DEBUG_LEVEL), - raise(#'TRANSIENT'{minor=(?ORBER_VMCID bor 7), - completion_status=?COMPLETED_NO}); - Types -> - typecheck_request_helper(Types, Args, Mod, Func) - end; -typecheck_request(true, Args, Types, Func) -> - typecheck_request_helper(Types, Args, Types, Func). - -typecheck_request_helper(Types, Args, Mod, Func) -> - case catch cdr_encode:validate_request_body( - #giop_env{version = {1,2}, tc = Types, parameters = Args, - host = orber:host(), iiop_port = orber:iiop_port(), - iiop_ssl_port = orber:iiop_ssl_port(), - domain = orber:domain(), - partial_security = orber:partial_security(), - flags = orber:get_flags()}) of - {'EXCEPTION', E} -> - {_, TC, _} = Types, - error_logger:error_msg("========= Orber Typecheck Request =========~n" - "Invoked......: ~p:~p/~p~n" - "Typecode.....: ~p~n" - "Arguments....: ~p~n" - "Result.......: ~p~n" - "===========================================~n", - [Mod, Func, length(TC), TC, Args, {'EXCEPTION', E}]), - raise(E); - {'EXIT',R} -> - {_, TC, _} = Types, - error_logger:error_msg("========= Orber Typecheck Request =========~n" - "Invoked......: ~p:~p/~p~n" - "Typecode.....: ~p~n" - "Arguments....: ~p~n" - "Result.......: ~p~n" - "===========================================~n", - [Mod, Func, length(TC), TC, Args, {'EXIT',R}]), - raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}); - _ -> - ok - end. - -typecheck_reply(true, Args, Mod, Func) when is_atom(Mod) -> - case catch Mod:oe_tc(Func) of - undefined -> - raise(#'BAD_OPERATION'{minor = (?ORBER_VMCID bor 4), - completion_status=?COMPLETED_NO}); - {'EXIT', What} -> - orber:dbg("[~p] corba:typecheck_reply(~p, ~p, ~p);~n" - "The call-back module does not exist or incorrect" - " IC-version used.~nReason: ~p", - [?LINE, Mod, Func, Args, What], ?DEBUG_LEVEL), - raise(#'TRANSIENT'{minor=(?ORBER_VMCID bor 7), - completion_status=?COMPLETED_NO}); - Types -> - typecheck_reply_helper(Types, Args, Mod, Func) - end; -typecheck_reply(true, Args, Types, Func) -> - typecheck_reply_helper(Types, Args, Types, Func); -typecheck_reply(_, _, _, _) -> - ok. - -typecheck_reply_helper(Types, Args, Mod, Func) -> - case catch cdr_encode:validate_reply_body( - #giop_env{version = {1,2}, tc = Types, - host = orber:host(), iiop_port = orber:iiop_port(), - iiop_ssl_port = orber:iiop_ssl_port(), - domain = orber:domain(), - partial_security = orber:partial_security(), - flags = orber:get_flags()}, Args) of - {'tk_except', ExcType, ExcTC, {'EXCEPTION', E}} -> - {_, TC, _} = Types, - error_logger:error_msg("========== Orber Typecheck Reply ==========~n" - "Invoked........: ~p:~p/~p~n" - "Exception Type.: ~p~n" - "Typecode.......: ~p~n" - "Raised.........: ~p~n" - "Result.........: ~p~n" - "===========================================~n", - [Mod, Func, length(TC), ExcType, ExcTC, Args, {'EXCEPTION', E}]), - raise(E); - {'EXCEPTION', E} -> - {RetType, TC, OutParams} = Types, - error_logger:error_msg("========== Orber Typecheck Reply ==========~n" - "Invoked......: ~p:~p/~p~n" - "Typecode.....: ~p~n" - "Reply........: ~p~n" - "Result.......: ~p~n" - "===========================================~n", - [Mod, Func, length(TC), [RetType | OutParams], Args, {'EXCEPTION', E}]), - raise(E); - {'tk_except', ExcType, ExcTC, {'EXIT',R}} -> - {_, TC, _} = Types, - error_logger:error_msg("========== Orber Typecheck Reply ==========~n" - "Invoked........: ~p:~p/~p~n" - "Exception Type.: ~p~n" - "Typecode.......: ~p~n" - "Raised.........: ~p~n" - "Result.........: ~p~n" - "===========================================~n", - [Mod, Func, length(TC), ExcType, ExcTC, Args, {'EXIT',R}]), - raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}); - {'EXIT',R} -> - {RetType, TC, OutParams} = Types, - error_logger:error_msg("========== Orber Typecheck Reply ==========~n" - "Invoked........: ~p:~p/~p~n" - "Typecode.......: ~p~n" - "Reply..........: ~p~n" - "Result.........: ~p~n" - "===========================================~n", - [Mod, Func, length(TC), [RetType | OutParams], Args, {'EXIT',R}]), - raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}); - _ -> - ok - end. - -call_relay(Pid, Data, Timeout) -> - case whereis(orber_objkeyserver) of - undefined -> - raise(#'TRANSIENT'{minor=(?ORBER_VMCID bor 1), completion_status=?COMPLETED_MAYBE}); - _ -> - case catch gen_server:call(Pid, Data, Timeout) of - {'EXCEPTION', E} -> - raise(E); - {'EXIT',{timeout, _}} -> - raise(#'TIMEOUT'{completion_status=?COMPLETED_MAYBE}); - {'EXIT',R} -> - orber:dbg("[~p] corba:call_internal(~p);~n" - "call exit(~p).", [?LINE, Data, R], ?DEBUG_LEVEL), - exit(R); - Res -> - Res - end - end. - -%%----------------------------------------------------------------- -%% Corba:cast - the function for ONEWAY requests -%%----------------------------------------------------------------- -cast(Obj, Func, Args, TypesOrMod) -> - cast_helper(Obj, Func, Args, TypesOrMod, []). - -cast(Obj, Func, Args, TypesOrMod, [{context, Ctx}]) -> - cast_helper(Obj, Func, Args, TypesOrMod, Ctx). - -cast_helper(Obj, Func, Args, TypesOrMod, InCtx) -> - Ctx = get_implicit_context(InCtx), - case iop_ior:get_key(Obj) of - {'internal', Key, _, Flags, Mod} -> - Pid = orber_objectkeys:get_pid(Key), - cast_internal(Pid, Obj, Func, Args, TypesOrMod, - ?ORB_FLAG_TEST(Flags, ?ORB_TYPECHECK), - ?ORB_FLAG_TEST(Flags, ?ORB_USE_PI), Mod, Ctx); - {'internal_registered', Key, _, Flags, Mod} -> - cast_internal(Key, Obj, Func, Args, TypesOrMod, - ?ORB_FLAG_TEST(Flags, ?ORB_TYPECHECK), - ?ORB_FLAG_TEST(Flags, ?ORB_USE_PI), Mod, Ctx); - {'external', Key} when is_atom(TypesOrMod) -> - case catch TypesOrMod:oe_tc(Func) of - {'EXIT', What} -> - orber:dbg("[~p] corba:cast_helper(~p);~n" - "The call-back module does not exist or incorrect" - " IC-version used.~nReason: ~p", - [?LINE, TypesOrMod, What], ?DEBUG_LEVEL), - raise(#'TRANSIENT'{minor=(?ORBER_VMCID bor 7), - completion_status=?COMPLETED_NO}); - undefined -> - raise(#'BAD_OPERATION'{minor = (?ORBER_VMCID bor 4), - completion_status=?COMPLETED_NO}); - Types -> - orber_iiop:request(Key, Func, Args, Types, 'false', infinity, - Obj, Ctx) - end; - {'external', Key} -> - orber_iiop:request(Key, Func, Args, TypesOrMod, 'false', infinity, - Obj, Ctx) - end. - -cast_internal(Pid, Obj, Func, Args, Types, Check, PI, _Mod, Ctx) - when is_pid(Pid) andalso node(Pid) == node() -> - invoke_pi_request(PI, Obj, Ctx, Func, Args), - typecheck_request(Check, Args, Types, Func), - catch gen_server:cast(Pid, {Obj, Ctx, Func, Args}), - ok; -cast_internal(Pid, Obj, Func, Args, Types, Check, PI, Mod, Ctx) when is_pid(Pid) -> - invoke_pi_request(PI, Obj, Ctx, Func, Args), - typecheck_request(Check, Args, Types, Func), - case catch rpc:call(node(Pid), corba, cast_relay, [Pid, {Obj, Ctx, Func, Args}]) of - {'EXCEPTION', E} -> - typecheck_reply(Check, {'EXCEPTION', E}, Mod, Func), - raise(E); - {badrpc, {'EXIT', _R}} -> - raise(#'TRANSIENT'{minor=(?ORBER_VMCID bor 3), - completion_status=?COMPLETED_MAYBE}); - {badrpc,nodedown} -> - orber:dbg("[~p] corba:cast_internal(~p, ~p, ~p);~nNode ~p down.", - [?LINE, Func, Args, Types, node(Pid)], ?DEBUG_LEVEL), - raise(#'TRANSIENT'{minor=(?ORBER_VMCID bor 2), - completion_status=?COMPLETED_NO}); - Other -> - orber:dbg("[~p] corba:cast_internal(~p, ~p, ~p);~n" - "Communication with node: ~p failed with reason: ~p.", - [?LINE, Func, Args, Types, node(Pid), Other], ?DEBUG_LEVEL), - raise(#'TRANSIENT'{minor=(?ORBER_VMCID bor 5), - completion_status=?COMPLETED_MAYBE}) - end; - -%% This case handles if the reference is created as a Pseudo object. -%% Just call apply/3. -cast_internal({pseudo, Module}, Obj, Func, Args, Types, Check, PI, _Mod, Ctx) -> - OldCtx = put(oe_server_in_context, Ctx), - invoke_pi_request(PI, Obj, Ctx, Func, Args), - typecheck_request(Check, Args, Types, Func), - State = binary_to_term(get_subobject_key(Obj)), - catch apply(Module, Func, [Obj, State|Args]), - put(oe_server_in_context, OldCtx), - ok; -cast_internal(Registered, Obj, Func, Args, Types, Check, PI, _Mod, Ctx) -> - invoke_pi_request(PI, Obj, Ctx, Func, Args), - typecheck_request(Check, Args, Types, Func), - case whereis(Registered) of - undefined -> - raise(#'OBJECT_NOT_EXIST'{completion_status=?COMPLETED_NO}); - P -> - gen_server:cast(P, {Obj, Ctx, Func, Args}) - end. - -cast_relay(Pid, Data) -> - case whereis(orber_objkeyserver) of - undefined -> - raise(#'TRANSIENT'{minor=(?ORBER_VMCID bor 1), - completion_status=?COMPLETED_NO}); - _ -> - gen_server:cast(Pid, Data) - end. - -%%----------------------------------------------------------------- -%% Corba:locate - this function is for the moment just used for tests -%%----------------------------------------------------------------- -locate(Obj) -> - locate(Obj, infinity, []). - -locate(Obj, Timeout) -> - locate(Obj, Timeout, []). - -locate(Obj, Timeout, Ctx) -> - case iop_ior:get_key(Obj) of - {'external', Key} -> - orber_iiop:locate(Key, Timeout, Obj, Ctx); - _ -> - orber_objectkeys:check(iop_ior:get_objkey(Obj)) - end. - -%%----------------------------------------------------------------- -%% Incomming request from iiop -%%----------------------------------------------------------------- -%% Operations which do not allow object invokation. -request_from_iiop(Obj, '_is_a', [Args], _, _, _) -> - catch corba_object:is_a(Obj, Args); -%% First the OMG specified this operation to be '_not_existent' and then -%% changed it to '_non_existent' without suggesting that both must be supported. -%% See CORBA2.3.1 page 15-34, Minor revision 2.3.1: October 1999 -request_from_iiop(Obj, '_not_existent', _, _, _, _) -> - catch corba_object:non_existent(Obj); -request_from_iiop(Obj, '_non_existent', _, _, _, _) -> - catch corba_object:non_existent(Obj); -request_from_iiop(_, '_FT_HB', _, _, _, _) -> - ok; - -%% "Ordinary" operations. -request_from_iiop({Mod, _, _, _, _, _}, oe_get_interface, - _, _, _, _ServiceCtx) when is_atom(Mod) -> - case catch Mod:oe_get_interface() of - {'EXIT', What} -> - orber:dbg("[~p] corba:request_from_iiop(~p);~n" - "The call-back module does not exist or" - " incorrect IC-version used.~nReason: ~p", - [?LINE, Mod, What], ?DEBUG_LEVEL), - {'EXCEPTION', #'TRANSIENT'{minor=(?ORBER_VMCID bor 7), - completion_status=?COMPLETED_NO}}; - undefined -> - {'EXCEPTION', #'BAD_OPERATION'{minor = (?ORBER_VMCID bor 4), - completion_status='COMPLETED_NO'}}; - Interface -> - Interface - end; -request_from_iiop({_Mod, pseudo, Module, _UserDef, _OrberDef, _Flags} = ObjRef, - Func, Args, Types, ResponseExpected, _ServiceCtx) -> - State = binary_to_term(get_subobject_key(ObjRef)), - case ResponseExpected of - true -> - case catch apply(Module, Func, [ObjRef, State|Args]) of - {noreply, _} -> - ok; - {noreply, _, _} -> - ok; - {reply, Reply, _} -> - Reply; - {reply, Reply, _, _} -> - Reply; - {stop, _, Reply, _} -> - Reply; - {stop, _, _} -> - ok; - {'EXCEPTION', E} -> - {'EXCEPTION', E}; - {'EXIT', {undef, _}} -> - orber:dbg("[~p] corba:request_from_iiop(~p, ~p, ~p);~n" - "The call-back module does not exist.", - [?LINE, Func, Args, Types], ?DEBUG_LEVEL), - {'EXCEPTION', #'TRANSIENT'{minor=(?ORBER_VMCID bor 4), - completion_status=?COMPLETED_NO}}; - {'EXIT', What} -> - orber:dbg("[~p] corba:request_from_iiop(~p, ~p, ~p);~n" - "Pseudo object exit(~p).~n" - "The call-back module probably contain an error.", - [?LINE, Func, Args, Types, What], ?DEBUG_LEVEL), - {'EXCEPTION', #'TRANSIENT'{minor=(?ORBER_VMCID bor 4), - completion_status=?COMPLETED_MAYBE}}; - Unknown -> - orber:dbg("[~p] corba:request_from_iiop(~p, ~p, ~p);~n" - "Pseudo object failed(~p);~n" - "Confirm that the return value is correct" - " (e.g. {reply, Reply, State})", - [?LINE, Func, Args, Types, Unknown], ?DEBUG_LEVEL), - {'EXCEPTION', #'TRANSIENT'{minor=(?ORBER_VMCID bor 6), - completion_status=?COMPLETED_MAYBE}} - end; - false -> - catch apply(Module, Func, [ObjRef, State|Args]), - ok; - true_oneway -> - catch apply(Module, Func, [ObjRef, State|Args]), - ok - end; -% FOR PASSIVE REPLICATION! (Response IS expected --- one way semantics doesn't -% really mix with intentions to be consistent & fault tolerant.) -request_from_iiop({_Mod, passive, Module, _UserDef, _OrberDef, _Flags} = ObjRef, - Func, Args, Types, true, Ctx) -> - GroupID = binary_to_term(get_subobject_key(ObjRef)), - FTGroupVersionCtx = get_FTGroupVersionCtx(Ctx), - Transaction = - fun() -> - ObjectGroup = read_object_group(GroupID), - check_version_context(ObjectGroup, - FTGroupVersionCtx), - call_primary_protected(ObjectGroup, - Module, - ObjRef, - Func, - Args, - GroupID, - get_FTRequestCtx(Ctx)) - end, - case mnesia:transaction(Transaction) of - {atomic, Reply} -> - Reply; - {aborted, {too_old_reference, IOGR}} -> - {oe_location_forward_perm, IOGR}; - {aborted, {not_primary, _Primary, IOGR}} -> - case FTGroupVersionCtx of - [] -> - {oe_location_forward_perm, IOGR}; - _ -> - {'EXCEPTION', #'TRANSIENT'{minor = 0, - completion_status = ?COMPLETED_NO}} - end; - {aborted, {throw, {'EXCEPTION', E}}} -> - {'EXCEPTION', E}; - {aborted, {'EXIT', What}} -> - orber:dbg("[~p] corba:call_passive(~p, ~p, ~p);~n" - "Passive object exit(~p).", - [?LINE, Func, Args, Types, What], ?DEBUG_LEVEL), - {'EXCEPTION', #'TRANSIENT'{minor = 0, - completion_status=?COMPLETED_MAYBE}}; - {aborted, Unknown} -> - orber:dbg("[~p] corba:call_passive(~p, ~p, ~p);~n" - "Passive object failed due to bad return value (~p).", - [?LINE, Func, Args, Types, Unknown], ?DEBUG_LEVEL), - {'EXCEPTION', #'TRANSIENT'{minor = 0, - completion_status=?COMPLETED_MAYBE}} - end; -request_from_iiop({_Mod, _Type, Key, _UserDef, _OrberDef, _Flags} = ObjRef, - Func, Args, Types, true, _ServiceCtx) -> - case catch gen_server:call(convert_key_to_pid(Key), - {ObjRef, [], Func, Args}, infinity) of - {'EXIT', What} -> - orber:dbg("[~p] corba:request_from_iiop(~p, ~p, ~p);~n" - "gen_server:call exit: ~p", - [?LINE, Func, Args, Types, What], ?DEBUG_LEVEL), - {'EXCEPTION', #'TRANSIENT'{minor=(?ORBER_VMCID bor 4), - completion_status=?COMPLETED_MAYBE}}; - Result -> - Result - end; -request_from_iiop({_Mod, _Type, Key, _UserDef, _OrberDef, _Flags} = ObjRef, - Func, Args, Types, _, _ServiceCtx) -> - case catch gen_server:cast(convert_key_to_pid(Key), - {ObjRef, [], Func, Args}) of - {'EXIT', What} -> - orber:dbg("[~p] corba:request_from_iiop(~p, ~p, ~p);~n" - "gen_server:cast exit: ~p", - [?LINE, Func, Args, Types, What], ?DEBUG_LEVEL), - {'EXCEPTION', #'TRANSIENT'{minor=(?ORBER_VMCID bor 4), - completion_status=?COMPLETED_MAYBE}}; - Result -> - Result - end. - -%%------------------------------------------------------------ -%% Internal stuff -%%------------------------------------------------------------ - -convert_key_to_pid(Key) when is_binary(Key) -> - orber_objectkeys:get_pid(Key); -convert_key_to_pid(Name) when is_atom(Name) -> - Name. - -mk_objkey(Mod, Pid, RegName, Persistent) -> - mk_objkey(Mod, Pid, RegName, Persistent, 0). - -mk_objkey(Mod, Pid, [], _, Flags) when is_pid(Pid) -> - Key = make_objkey(), - case orber_objectkeys:register(Key, Pid, false) of - ok -> - {Mod, 'key', Key, term_to_binary(undefined), 0, Flags}; - R -> - orber:dbg("[~p] corba:mk_objkey(~p);~n" - "unable to store key(~p).", [?LINE, Mod, R], ?DEBUG_LEVEL), - raise(#'INTERNAL'{minor=(?ORBER_VMCID bor 2), completion_status=?COMPLETED_NO}) - end; -mk_objkey(Mod, Pid, {'global', RegName}, Persitent, Flags) when is_pid(Pid) -> - Key = term_to_binary(RegName), - case orber_objectkeys:register(Key, Pid, Persitent) of - ok -> - {Mod, 'key', Key, term_to_binary(undefined), 0, Flags}; - R -> - orber:dbg("[~p] corba:mk_objkey(~p, ~p);~n" - "unable to store key(~p).", - [?LINE, Mod, RegName, R], ?DEBUG_LEVEL), - raise(#'INTERNAL'{minor=(?ORBER_VMCID bor 2), completion_status=?COMPLETED_NO}) - end; -mk_objkey(Mod, Pid, {'local', RegName}, Persistent, Flags) when is_pid(Pid) andalso is_atom(RegName) -> - register(RegName, Pid), - Key = make_objkey(), - case orber_objectkeys:register(Key, Pid, Persistent) of - ok -> - {Mod, 'registered', RegName, term_to_binary(undefined), 0, Flags}; - R -> - orber:dbg("[~p] corba:mk_objkey(~p, ~p);~n" - "unable to store key(~p).", - [?LINE, Mod, RegName, R], ?DEBUG_LEVEL), - raise(#'INTERNAL'{minor=(?ORBER_VMCID bor 2), completion_status=?COMPLETED_NO}) - end. - - -mk_light_objkey(Mod, RegName) -> - {Mod, 'registered', RegName, term_to_binary(undefined), 0, 0}. - -mk_pseudo_objkey(Mod, Module, Flags) -> - {Mod, 'pseudo', Module, term_to_binary(undefined), 0, Flags}. - -mk_passive_objkey(Mod, Module, Flags) -> - {Mod, 'passive', Module, term_to_binary(undefined), 0, Flags}. - -make_objkey() -> - term_to_binary({{erlang:system_time(), - erlang:unique_integer()}, - node()}). - -objkey_to_string({_Mod, 'registered', 'orber_init', _UserDef, _OrberDef, _Flags}) -> - "INIT"; -objkey_to_string({Mod, Type, Key, UserDef, OrberDef, Flags}) -> - orber:domain() ++ [ 7 | binary_to_list(term_to_binary({Mod, Type, Key, UserDef, OrberDef, Flags}))]; -objkey_to_string(External_object_key) -> - External_object_key. - -string_to_objkey("INIT") -> - {orber_initial_references, 'registered', 'orber_init', term_to_binary(undefined), 0, 0}; -string_to_objkey(String) -> - case prefix(orber:domain(), String) of - [7 | Rest] -> - binary_to_term(list_to_binary(Rest)); - _ -> - String - end. -%% This function may only be used when we know it's a local reference (i.e. target -%% key in a request; IOR's passed as argument or reply doesn't qualify)! -string_to_objkey_local("INIT") -> - {orber_initial_references, 'registered', 'orber_init', term_to_binary(undefined), 0, 0}; -string_to_objkey_local(String) -> - case prefix(orber:domain(), String) of - [7 | Rest] -> - binary_to_term(list_to_binary(Rest)); - _ -> - case resolve_initial_references(String) of - ?ORBER_NIL_OBJREF -> - orber:dbg("[~p] corba:string_to_objkey_local(~p);~n" - "Invalid ObjektKey.", [?LINE, String], ?DEBUG_LEVEL), - ?ORBER_NIL_OBJREF; - Object -> - {location_forward, Object} - end - end. - -prefix([], L2) -> - L2; -prefix([E |L1], [E | L2]) -> - prefix(L1, L2); -prefix(_, _) -> - false. - - -evaluate_options([], Options) -> - GlobalFlags = orber:get_flags(), - Options2 = check_flag(Options, ?ORB_TYPECHECK, - ?ORB_ENV_LOCAL_TYPECHECKING, GlobalFlags), - Options3 = check_flag(Options2, ?ORB_USE_PI, ?ORB_ENV_USE_PI, GlobalFlags), - check_flag(Options3, ?ORB_SURVIVE_EXIT, ?ORB_ENV_SURVIVE_EXIT, GlobalFlags); -%% Pseudo or not. -evaluate_options([{pseudo, false}|Rest], Options) -> - evaluate_options(Rest, Options); -evaluate_options([{pseudo, true}|Rest], #options{passive = false} = Options) -> - evaluate_options(Rest, Options#options{pseudo = true}); -%% FT stuff -evaluate_options([{passive, true}|Rest], #options{pseudo = false} = Options) -> - evaluate_options(Rest, Options#options{passive = true}); -evaluate_options([{group_id, ID}|Rest], Options) when is_integer(ID) -> - evaluate_options(Rest, Options#options{group_id = ID}); -%% Options accepted by gen_server (e.g. dbg). -evaluate_options([{create_options, COpt}|Rest], Options) when is_list(COpt) -> - evaluate_options(Rest, Options#options{create_options = COpt}); -%% When starting object as supervisor child. -evaluate_options([{sup_child, false}|Rest], Options) -> - evaluate_options(Rest, Options); -evaluate_options([{sup_child, true}|Rest], Options) -> - evaluate_options(Rest, Options#options{sup_child = true}); -%% Persistent object-key -evaluate_options([{persistent, false}|Rest], Options) -> - evaluate_options(Rest, Options); -evaluate_options([{persistent, true}|Rest], Options) -> - evaluate_options(Rest, Options#options{persistent = true}); -evaluate_options([{regname, []}|Rest], Options) -> - evaluate_options(Rest, Options); -evaluate_options([{regname, Name}|Rest], Options) -> - evaluate_options(Rest, Options#options{regname = Name}); -evaluate_options([{survive_exit, false}|Rest], - #options{object_flags_set = FlagsSet} = Options) -> - %% This option overrides a global setting. - evaluate_options(Rest, Options#options{object_flags_set = - (?ORB_SURVIVE_EXIT bor FlagsSet)}); -evaluate_options([{survive_exit, true}|Rest], - #options{object_flags = Flags, - object_flags_set = FlagsSet} = Options) -> - evaluate_options(Rest, Options#options{object_flags = - (?ORB_SURVIVE_EXIT bor Flags), - object_flags_set = - (?ORB_SURVIVE_EXIT bor FlagsSet)}); -evaluate_options([{local_typecheck, false}|Rest], - #options{object_flags_set = FlagsSet} = Options) -> - %% This option overrides a global setting. - evaluate_options(Rest, Options#options{object_flags_set = - (?ORB_TYPECHECK bor FlagsSet)}); -evaluate_options([{local_typecheck, true}|Rest], - #options{object_flags = Flags, - object_flags_set = FlagsSet} = Options) -> - evaluate_options(Rest, Options#options{object_flags = (?ORB_TYPECHECK bor Flags), - object_flags_set = - (?ORB_TYPECHECK bor FlagsSet)}); -evaluate_options([{local_interceptors, false}|Rest], - #options{object_flags_set = FlagsSet} = Options) -> - %% This option overrides a global setting. - evaluate_options(Rest, Options#options{object_flags_set = - (?ORB_USE_PI bor FlagsSet)}); -evaluate_options([{local_interceptors, true}|Rest], - #options{object_flags = Flags, - object_flags_set = FlagsSet} = Options) -> - evaluate_options(Rest, Options#options{object_flags = (?ORB_USE_PI bor Flags), - object_flags_set = - (?ORB_USE_PI bor FlagsSet)}); -%% Temporary option. -evaluate_options([{no_security, true}|Rest], - #options{object_flags = Flags} = Options) -> - %% We do not allow this option to be set globally. - evaluate_options(Rest, Options#options{object_flags = (?ORB_NO_SECURITY bor Flags)}); -evaluate_options([{no_security, false}|Rest], Options) -> - %% We do not allow this option to be set globally. - evaluate_options(Rest, Options); -evaluate_options([{Key, Value}|_], _) -> - orber:dbg("[~p] corba:evaluate_options(~p, ~p);~n" - "Option not recognized, illegal value or combination.~n" - "Allowed settings:~n" - "survive_exit.......: boolean()~n" - "sup_child..........: boolean()~n" - "persistent.........: boolean()~n" - "pseudo.............: boolean()~n" - "local_typecheck....: boolean()~n" - "local_interceptors.: boolean()~n" - "regname............: {local, atom()} | {global, term()}", - [?LINE, Key, Value], ?DEBUG_LEVEL), - raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -check_flag(#options{object_flags = Flags, - object_flags_set = FlagsSet} = Options, Flag, - FlagConstant, GlobalFlags) -> - %% Option activated/deactived by a supplied option. - case ?ORB_FLAG_TEST(FlagsSet, Flag) of - true -> - Options; - false -> - %% Not the above. Globally defined? - case ?ORB_FLAG_TEST(GlobalFlags, FlagConstant) of - true -> - Options#options{object_flags = (Flag bor Flags)}; - false -> - Options - end - end. - -%%%%%%%%%%%%%%%%% FOR PASSIVE REPLICATION! -% Note should be called inside transaction. Does not catch exceptions. -% let's not allow corba:reply from transaction... (no {noreply, ...} messages) -% should the object be able to stop itself by returning {stop, ...}? -% how about corba:dispose then? Deleting table representing object group and -% corresponding entry in ft_replication_manager -table might just do the job? -% No {stop, ...} messages for now -% Exceptions falls through. They are expected to be caught by transaction in a -% form of {aborted, {throw, {'EXCEPTION', ...}}} -call_passive(Module, Obj, Func, Args, GroupID) -> - [Record] = mnesia:read(ft_replicated_object, GroupID, sticky_write), - State = Record#ft_replicated_object.state, - - case apply(Module, Func, [Obj, State|Args]) of - {reply, Reply, NewState} -> - {Reply, NewState}; - {reply, Reply, NewState, _} -> - {Reply, NewState} - end, - mnesia:write(ft_replicated_object, - #ft_replicated_object{group_id = GroupID, state = NewState}, - sticky_write), - Reply. - - - -% FTRequestCtx protected object call -% One should protect agains aged reply. If expirations_time is reached and -% request is retransmitted, one might return BAD_CONTEXT -exception! -call_RQprotected(Module, Obj, Func, Args, GroupID, RQCtx) -> - case mnesia:read(ft_reply_retention, RQCtx, sticky_write) of - % fresh request - [] -> - Reply = call_passive(Module, Obj, Func, Args, GroupID), - mnesia:write(ft_reply_retention, - #ft_reply_retention{retention_id= RQCtx,reply= Reply}, - sticky_write), - Reply; - % retransmitted request - [#ft_reply_retention{reply = Reply}] -> - Reply - end. - - - -% call_primary_protected. Protects agains calling non-primary node. -% normal case, without FTRequest Service Context -call_primary_protected(#ft_replication_manager{primary = Primary}, - Module, - Obj, - Func, - Args, - GroupID, - []) when Primary == node() -> - call_passive(Module, Obj, Func, Args, GroupID); -% normal case, with FTRequest Service Context -call_primary_protected(#ft_replication_manager{primary = Primary}, - Module, - Obj, - Func, - Args, - GroupID, - RetentionID) when Primary == node() -> - call_RQprotected(Module, Obj, Func, Args, GroupID, RetentionID); -% case where primary resides in another node -call_primary_protected(#ft_replication_manager{primary = Primary, - iogr = IOGR}, - _Module, _Obj, _Func, _Args, _GroupID, _) -> - mnesia:abort({not_primary, Primary, IOGR}). - - - -% no context -check_version_context(_, []) -> - ok; -% client's IOGR is current. -check_version_context(#ft_replication_manager{ref_version = CurrentVer}, - GroupVer) when CurrentVer == GroupVer -> - ok; -% client's IOGR is old. -check_version_context(#ft_replication_manager{ref_version = CurrentVer, - iogr = IOGR}, - GroupVer) when CurrentVer > GroupVer -> - mnesia:abort({too_old_reference, IOGR}); -% client's IOGR is too new! -check_version_context(#ft_replication_manager{ref_version = CurrentVer}, - GroupVer) when CurrentVer < GroupVer -> - raise(#'INV_OBJREF'{completion_status = ?COMPLETED_NO}). - - - -read_object_group(GroupID) -> - case mnesia:read({ft_replication_manager, GroupID}) of - [] -> - raise(#'OBJECT_NOT_EXIST'{completion_status = ?COMPLETED_NO}); - [ObjectGroup] -> - ObjectGroup - end. - - - -mk_FTRequestCtx(Expiration_time) -> - #'FT_FTRequestServiceContext'{ - client_id = atom_to_list(node()), - retention_id = orber_request_number:get(), - expiration_time = Expiration_time}. - - - -get_FTRequestCtx([#'FT_FTRequestServiceContext' - {client_id = Client_ID, retention_id = Retention_ID, - expiration_time = Expiration_time}|_Ctxs]) -> - {Client_ID, Retention_ID, Expiration_time}; -get_FTRequestCtx([]) -> - []; -get_FTRequestCtx([_Ctx|Ctxs]) -> - get_FTRequestCtx(Ctxs). - - - -get_FTGroupVersionCtx([#'FT_FTGroupVersionServiceContext' - {object_group_ref_version = Version}|_Ctxs]) -> - Version; -get_FTGroupVersionCtx([]) -> - []; -get_FTGroupVersionCtx([_Ctx|Ctxs]) -> - get_FTGroupVersionCtx(Ctxs). - diff --git a/lib/orber/src/corba_boa.erl b/lib/orber/src/corba_boa.erl deleted file mode 100644 index 12b063a5db..0000000000 --- a/lib/orber/src/corba_boa.erl +++ /dev/null @@ -1,135 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: corba_boa.erl -%% -%% Description: -%% This file contains the CORBA::BOA interface -%% -%%----------------------------------------------------------------- --module(corba_boa). - --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([%create/3, - dispose/1, - get_id/1]). -% change_implementation/2, -% set_exception/3, -% impl_is_ready/1, -% deactivate_impl/1, -% obj_is_ready/2, -% deactivate_obj/1, -% get_principal/2]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% Macros -%%----------------------------------------------------------------- --define(DEBUG_LEVEL, 5). - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- -%create(Id, Interface, Implementation) -> -% corba:create(Implementation#orb_ImplDef.module, -% Interface#fullinterfacedescription.id). - -dispose(Object) -> - case binary_to_term(iop_ior:get_privfield(Object)) of - undefined -> - case catch iop_ior:get_key(Object) of - {'internal', Key, _, _, _} -> - case orber_objectkeys:get_pid(Key) of - {error, Reason} -> - orber:dbg("[~p] corba_boa:dispose(~p); object not found(~p)", - [?LINE, Object, Reason], ?DEBUG_LEVEL), - corba:raise(#'TRANSIENT'{completion_status=?COMPLETED_NO}); - Pid -> - gen_server:call(Pid, stop) - end; - {'internal_registered', Key, _, _, _} -> - case Key of - {pseudo, Module} -> - Module:terminate(normal, undefined), - ok; - _ -> - case whereis(Key) of - undefined -> - corba:raise(#'OBJECT_NOT_EXIST'{completion_status=?COMPLETED_NO}); - Pid -> - gen_server:call(Pid, stop) - end - end; - {'external', _} -> - orber:dbg("[~p] corba_boa:dispose(~p); external object.", - [?LINE, Object], ?DEBUG_LEVEL), - %% Must be fixed !!!!!!!! - corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}) - end; - Other -> - case iop_ior:get_key(Object) of - {_, {pseudo, Module}, _, _, _} -> - Module:terminate(normal, Other), - ok; - Why -> - orber:dbg("[~p] corba_boa:dispose(~p); probably subobject key set(~p)", - [?LINE, Object, Why], ?DEBUG_LEVEL), - corba:raise(#'NO_PERMISSION'{completion_status=?COMPLETED_NO}) - end - end. - -get_id(Object) -> - iop_ior:get_objkey(Object). - -%change_implementation(Object, ImplementationDef) -> -% ok. - -%get_principal(Object, Env) -> -% ok. - -%set_exception(Major, Id, Param) -> -% ok. - -%impl_is_ready(ImplementationDef) -> -% ok. - -%deactivate_impl(ImplementationDef) -> -% ok. - -%obj_is_ready(Object, ImplementationDef) -> -% ok. - -%deactivate_obj(Object) -> -% ok. - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- diff --git a/lib/orber/src/corba_nvlist.erl b/lib/orber/src/corba_nvlist.erl deleted file mode 100644 index 4a1361842b..0000000000 --- a/lib/orber/src/corba_nvlist.erl +++ /dev/null @@ -1,98 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: corba_nvlist.erl -%% Description: -%% This file contains the CORBA::NVList handling -%% -%%----------------------------------------------------------------- --module(corba_nvlist). - --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). - -%%----------------------------------------------------------------- -%% Standard interface CORBA::NVList -%%----------------------------------------------------------------- --export([add_item/6, - free/1, - free_memory/1, - get_count/1]). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([create_list/1, - create_operation_list/1]). - -%%------------------------------------------------------------ -%% Implementation of standard interface CORBA::NVList -%%------------------------------------------------------------ -add_item(List, Id, TC, Value, Len, ArgFlags) -> - {ok, List}. - -free(List) -> - ok. - -free_memory(List) -> - ok. - -get_count(List) -> - {ok, 0}. - -%%------------------------------------------------------------ -%% Implementation of extra functions which creates NVList:s -%% theese ae used by the standard functions with the same name -%% in the CORBA::ORB interface -%%------------------------------------------------------------ - -create_list(Count) -> - {ok, create_list_2(Count, [])}. - -create_list_2(0, Acc) -> - Acc; -create_list_2(N, Acc) -> - create_list_2(N-1, [[] | Acc]). - -create_operation_list(OpDef) -> - OpArgList = OpDef, - {ok, create_operation_list_2(OpArgList, [])}. - -create_operation_list_2([], Acc) -> - Acc; -create_operation_list_2([OpArg | OpArgList], Acc) -> - Rec = parse_oparg_def(OpArg), - create_operation_list_2(OpArgList, [Rec | Acc]). - -parse_oparg_def(OpArg) -> - OpArg. - - - - - - - - - - - diff --git a/lib/orber/src/corba_object.erl b/lib/orber/src/corba_object.erl deleted file mode 100644 index bf31226067..0000000000 --- a/lib/orber/src/corba_object.erl +++ /dev/null @@ -1,221 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: corba_object.erl -%% -%% Description: -%% This file contains the CORBA::Object interface -%% -%%----------------------------------------------------------------- --module(corba_object). - --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). --include_lib("orber/src/ifr_objects.hrl"). - -%%----------------------------------------------------------------- -%% Standard interface CORBA::Object -%%----------------------------------------------------------------- --export([get_interface/1, - is_nil/1, - is_a/2, - is_a/3, - is_remote/1, - non_existent/1, - non_existent/2, - not_existent/1, - not_existent/2, - is_equivalent/2, - hash/2, - create_request/6]). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% Macros -%%----------------------------------------------------------------- --define(DEBUG_LEVEL, 5). - -%%------------------------------------------------------------ -%% Implementation of standard interface -%%------------------------------------------------------------ -get_interface(Obj) -> - case orber_env:light_ifr() of - false -> - TypeId = iop_ior:get_typeID(Obj), - case mnesia:dirty_index_read(ir_InterfaceDef, TypeId, #ir_InterfaceDef.id) of - %% If all we get is an empty list there are no such - %% object registered in the IFR. - [] -> - orber:dbg("[~p] corba_object:get_interface(~p); TypeID ~p not found in IFR.", - [?LINE, Obj, TypeId], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}); - [#ir_InterfaceDef{ir_Internal_ID=Ref}] -> - orber_ifr_interfacedef:describe_interface({ir_InterfaceDef, Ref}) - end; - true -> - case catch iop_ior:get_key(Obj) of - {'external', _Key} -> - orber:dbg("[~p] corba_object:get_interface(~p); Invalid object reference.", - [?LINE, Obj], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}); - {_Local, _Key, _, _, Module} -> - case catch Module:oe_get_interface() of - {'EXIT', What} -> - orber:dbg("[~p] corba_object:get_interface(~p);~n" - "The call-back module does not exist or incorrect IC-version used.~n" - "Reason: ~p", [?LINE, Module, What], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}); - InterfaceDesc -> - InterfaceDesc - end - end - end. - - -is_nil(Object) when is_record(Object, 'IOP_IOR') -> - iop_ior:check_nil(Object); -is_nil({I,T,K,P,O,F}) -> - iop_ior:check_nil({I,T,K,P,O,F}); -is_nil(Obj) -> - orber:dbg("[~p] corba_object:is_nil(~p); Invalid object reference.", - [?LINE, Obj], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}). - -is_a(Obj, Logical_type_id) -> - is_a(Obj, Logical_type_id, []). - -is_a(?ORBER_NIL_OBJREF, _, _Ctx) -> - false; -is_a(#'IOP_IOR'{type_id = Logical_type_id}, Logical_type_id, _Ctx) -> - true; -is_a(Obj, Logical_type_id, Ctx) when is_list(Ctx) -> - case catch iop_ior:get_key(Obj) of - {'external', Key} -> - orber_iiop:request(Key, '_is_a', [Logical_type_id], - {orber_tc:boolean(),[orber_tc:string(0)],[]}, - true, infinity, Obj, corba:get_implicit_context(Ctx)); - {_Local, _Key, _, _, Module} -> - case catch Module:oe_is_a(Logical_type_id) of - {'EXIT', What} -> - orber:dbg("[~p] corba_object:is_a(~p);~n" - "The call-back module does not exist or incorrect IC-version used.~n" - "Reason: ~p", [?LINE, Module, What], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}); - Boolean -> - Boolean - end; - _ -> - orber:dbg("[~p] corba_object:is_a(~p, ~p); Invalid object reference.", - [?LINE, Obj, Logical_type_id], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}) - end; -is_a(Obj, Logical_type_id, Ctx) -> - orber:dbg("[~p] corba_object:is_a(~p, ~p, ~p);~n" - "Failed to supply a context list.", - [?LINE, Obj, Logical_type_id, Ctx], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - - -non_existent(Obj) -> - non_existent(Obj, []). - -non_existent(?ORBER_NIL_OBJREF, _Ctx) -> - true; -non_existent(Obj, Ctx) -> - existent_helper(Obj, '_non_existent', Ctx). - -not_existent(Obj) -> - not_existent(Obj, []). - -not_existent(?ORBER_NIL_OBJREF, _Ctx) -> - true; -not_existent(Obj, Ctx) -> - existent_helper(Obj, '_not_existent', Ctx). - - -existent_helper(Obj, Op, Ctx) when is_list(Ctx) -> - case catch iop_ior:get_key(Obj) of - {'internal', Key, _, _, _} -> - case catch orber_objectkeys:get_pid(Key) of - {'EXCEPTION', E} when is_record(E,'OBJECT_NOT_EXIST') -> - true; - {'EXCEPTION', X} -> - corba:raise(X); - {'EXIT', R} -> - orber:dbg("[~p] corba_object:non_existent(~p); exit(~p).", - [?LINE, Obj, R], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}); - _ -> - false - end; - {'internal_registered', Key, _, _, _} -> - case Key of - {pseudo, _} -> - false; - _-> - case whereis(Key) of - undefined -> - true; - _P -> - false - end - end; - {'external', Key} -> - orber_iiop:request(Key, Op, [], - {orber_tc:boolean(), [],[]}, 'true', - infinity, Obj, corba:get_implicit_context(Ctx)); - true -> - false - end; -existent_helper(Obj, Op, Ctx) -> - orber:dbg("[~p] corba_object:existent_helper(~p, ~p, ~p);~n" - "Failed to supply a context list.", - [?LINE, Obj, Op, Ctx], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - - -is_remote(Obj) -> - case catch iop_ior:get_key(Obj) of - {'external', _} -> - true; - _ -> - false - end. - - -is_equivalent(Obj, Obj) -> - true; -is_equivalent({I,T,K,P,_,_}, {I,T,K,P,_,_}) -> - true; -is_equivalent(_, _) -> - false. - -hash(Obj, Maximum) -> - erlang:phash(iop_ior:get_key(Obj), Maximum). - - -create_request(_Obj, _Ctx, _Op, _ArgList, NamedValueResult, _ReqFlags) -> - {ok, NamedValueResult, []}. diff --git a/lib/orber/src/fixed.erl b/lib/orber/src/fixed.erl deleted file mode 100644 index 8d6239991d..0000000000 --- a/lib/orber/src/fixed.erl +++ /dev/null @@ -1,306 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2002-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%-------------------------------------------------------------------- -%% File : fixed.erl -%% Purpose : -%%-------------------------------------------------------------------- - --module(fixed). - --include_lib("orber/include/corba.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([create/3, add/2, subtract/2, divide/2, multiply/2, unary_minus/1, - get_typecode/1]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% Definitions -%%----------------------------------------------------------------- --define(get_max(__X, __Y), if __X > __Y -> __X; true -> __Y end). --define(get_min(__X, __Y), if __X > __Y -> __Y; true -> __X end). - --define(BASE, 100000000000000000000000000000000). --define(FIXED_MAX, 9999999999999999999999999999999). --define(FIXED_MIN, -9999999999999999999999999999999). - --define(DEBUG_LEVEL, 5). - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- -create(Digits, Scale, Value) when is_integer(Digits) andalso Digits >= 0 andalso Digits < 32 andalso - is_integer(Scale) andalso Scale >= 0 andalso Digits >= Scale andalso - is_integer(Value) andalso Value =< ?FIXED_MAX andalso - Value >= ?FIXED_MIN -> - case count_digits(abs(Value)) of - Dig when Dig =< Digits -> - #fixed{digits = Digits, scale = Scale, value = Value}; - Overflow -> - orber:dbg("[~p] fixed:create(~p, ~p, ~p).~n" - "The Value exceeds the Digits limit: ~p, ~p", - [?LINE, Digits, Scale, Value, Digits, Overflow], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end; -create(Digits, Scale, Value) -> - orber:dbg("[~p] fixed:add(~p, ~p, ~p).~n" - "At least one of the supplied arguments is incorrect.~n" - "Digits and Scale must be a positive integer with the following~n" - "limits:~n" - " * 0 =< Digits < 32~n" - " * Digits >= Scale~n" - " * Value range +/- 9999999999999999999999999999999", - [?LINE, Digits, Scale, Value], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - - -get_typecode(#fixed{digits = Digits, scale = Scale}) -> - {tk_fixed, Digits, Scale}; -get_typecode(Other) -> - orber:dbg("[~p] fixed:get_typecode(~p). -The supplied argument is not a Fixed Type.", [?LINE, Other], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -add(#fixed{digits = D1, scale = S1, value = V1}, - #fixed{digits = D2, scale = S2, value = V2}) -> - Scale = ?get_max(S1, S2), - Digits = ?get_max((D1-S1), (D2-S2)) + Scale +1, - %% We must normalize the values before adding. Why? - %% 4.23 and 5.2 are represented as 423 and 52. To be able to get the - %% correct result we must add 4230 and 5200 == 9430. - {PV1, PV2} = normalize(S1, V1, S2, V2), - check_fixed_overflow(#fixed{digits = Digits, - scale = Scale, - value = (PV1 + PV2)}); -add(F1, F2) -> - orber:dbg("[~p] fixed:add(~p, ~p).~n" - "At least one of the supplied arguments is not a Fixed Type.", - [?LINE, F1, F2], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - - -subtract(#fixed{digits = D1, scale = S1, value = V1}, - #fixed{digits = D2, scale = S2, value = V2}) -> - Scale = ?get_max(S1, S2), - Digits = ?get_max((D1-S1), (D2-S2)) + Scale +1, - {PV1, PV2} = normalize(S1, V1, S2, V2), - check_fixed_overflow(#fixed{digits = Digits, - scale = Scale, - value = (PV1 - PV2)}); -subtract(F1, F2) -> - orber:dbg("[~p] fixed:subtract(~p, ~p).~n" - "At least one of the supplied arguments is not a Fixed Type.", - [?LINE, F1, F2], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -divide(#fixed{digits = D1, scale = S1, value = V1}, - #fixed{digits = _D2, scale = S2, value = V2}) -> - {PV1, PV2} = normalize(S1, V1, S2, V2), - DigitsMin = (D1-S1+S2), - R1 = (PV1 div PV2), - R2 = (R1*?BASE + (PV1 rem PV2) * (?BASE div PV2)), - {Result2, Sinf} = delete_zeros_value(R2, 0, R1), - check_fixed_overflow(#fixed{digits = DigitsMin + Sinf, scale = Sinf, - value = Result2}); -divide(F1, F2) -> - orber:dbg("[~p] fixed:divide(~p, ~p).~n" - "At least one of the supplied arguments is not a Fixed Type.", - [?LINE, F1, F2], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - - -multiply(#fixed{digits = D1, scale = S1, value = V1}, - #fixed{digits = D2, scale = S2, value = V2}) -> - check_fixed_overflow(#fixed{digits = (D1+D2), - scale = (S1+S2), - value = V1*V2}); -multiply(F1, F2) -> - orber:dbg("[~p] fixed:multiply(~p, ~p).~n" - "At least one of the supplied arguments is not a Fixed Type.", - [?LINE, F1, F2], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -unary_minus(Fixed) when is_record(Fixed, fixed) -> - Fixed#fixed{value = -(Fixed#fixed.value)}; -unary_minus(Fixed) -> - orber:dbg("[~p] fixed:unary_minus(~p).~n" - "The supplied argument is not a Fixed Type.", - [?LINE, Fixed], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- -%% Pretty?! No, but since we now the upper-limit this is the fastest way -%% to calculate 10^x -power(0) -> 1; -power(1) -> 10; -power(2) -> 100; -power(3) -> 1000; -power(4) -> 10000; -power(5) -> 100000; -power(6) -> 1000000; -power(7) -> 10000000; -power(8) -> 100000000; -power(9) -> 1000000000; -power(10) -> 10000000000; -power(11) -> 100000000000; -power(12) -> 1000000000000; -power(13) -> 10000000000000; -power(14) -> 100000000000000; -power(15) -> 1000000000000000; -power(16) -> 10000000000000000; -power(17) -> 100000000000000000; -power(18) -> 1000000000000000000; -power(19) -> 10000000000000000000; -power(20) -> 100000000000000000000; -power(21) -> 1000000000000000000000; -power(22) -> 10000000000000000000000; -power(23) -> 100000000000000000000000; -power(24) -> 1000000000000000000000000; -power(25) -> 10000000000000000000000000; -power(26) -> 100000000000000000000000000; -power(27) -> 1000000000000000000000000000; -power(28) -> 10000000000000000000000000000; -power(29) -> 100000000000000000000000000000; -power(30) -> 1000000000000000000000000000000; -power(31) -> 10000000000000000000000000000000; -power(_) -> 10000000000000000000000000000000. - - - -%% If the result of an operation (+, -, * or /) causes overflow we use this -%% operation. However, since these calculations are performed during compiletime, -%% shouldn't the IDL-specification be changed to not cause overflow?! But, since -%% the OMG standard allows this we must support it. -check_fixed_overflow(#fixed{digits = Digits, scale = Scale, value = Value}) -> - case count_digits(abs(Value)) of - overflow -> - {N, NewVal} = cut_overflow(0, Value), - if - N > Scale -> - #fixed{digits = 31, scale = 0, value = NewVal}; - true -> - NewScale = Scale - N, - {NewVal2, Removed} = delete_zeros(NewVal, NewScale), - #fixed{digits = 31, scale = NewScale-Removed, value = NewVal2} - end; - Count when Count > Digits -> - Diff = Count-Digits, - if - Diff > Scale -> - #fixed{digits = Digits, scale = 0, - value = (Value div power(Diff))}; - true -> - NewScale = Scale-Diff, - {NewVal, Removed} = delete_zeros((Value div power(Diff)), NewScale), - #fixed{digits = Digits-Removed, - scale = NewScale-Removed, - value = NewVal} - end; - Count -> - {NewVal, Removed} = delete_zeros(Value, Scale), - #fixed{digits = Count-Removed, scale = Scale-Removed, value = NewVal} - end. - -%% This function see to that the values are of the same baase. -normalize(S, V1, S, V2) -> - {V1, V2}; -normalize(S1, V1, S2, V2) when S1 > S2 -> - {V1, V2*power(S1-S2)}; -normalize(S1, V1, S2, V2) -> - {V1*power(S2-S1), V2}. - -%% If we have access to the integer part of the fixed type we use this -%% operation to remove all trailing zeros. If we know the scale, length of -%% fraction part, we can use delete_zeros as well. But, after a division -%% it's hard to know the scale and we don't need to calcluate the integer part. -delete_zeros_value(0, N, _) -> - {0, 32-N}; -delete_zeros_value(X, N, M) when X > M, (X rem 10) == 0 -> - delete_zeros_value((X div 10), N+1, M); -delete_zeros_value(X, N, _) -> - {X, 32-N}. - -%% If we know the exact scale of a fixed type we can use this operation to -%% remove all trailing zeros. -delete_zeros(0, _) -> - {0,0}; -delete_zeros(X, Max) -> - delete_zeros(X, 0, Max). -delete_zeros(X, Max, Max) -> - {X, Max}; -delete_zeros(X, N, Max) when (X rem 10) == 0 -> - delete_zeros((X div 10), N+1, Max); -delete_zeros(X, N, _) -> - {X, N}. - -cut_overflow(N, X) when X > ?FIXED_MAX -> - cut_overflow(N+1, (X div 10)); -cut_overflow(N, X) -> - {N, X}. - -%% A fast way to check the size of a fixed data type. -count_digits(X) when X > ?FIXED_MAX -> overflow; -count_digits(X) when X >= 1000000000000000000000000000000 -> 31; -count_digits(X) when X >= 100000000000000000000000000000 -> 30; -count_digits(X) when X >= 10000000000000000000000000000 -> 29; -count_digits(X) when X >= 1000000000000000000000000000 -> 28; -count_digits(X) when X >= 100000000000000000000000000 -> 27; -count_digits(X) when X >= 10000000000000000000000000 -> 26; -count_digits(X) when X >= 1000000000000000000000000 -> 25; -count_digits(X) when X >= 100000000000000000000000 -> 24; -count_digits(X) when X >= 10000000000000000000000 -> 23; -count_digits(X) when X >= 1000000000000000000000 -> 22; -count_digits(X) when X >= 100000000000000000000 -> 21; -count_digits(X) when X >= 10000000000000000000 -> 20; -count_digits(X) when X >= 1000000000000000000 -> 19; -count_digits(X) when X >= 100000000000000000 -> 18; -count_digits(X) when X >= 10000000000000000 -> 17; -count_digits(X) when X >= 1000000000000000 -> 16; -count_digits(X) when X >= 100000000000000 -> 15; -count_digits(X) when X >= 10000000000000 -> 14; -count_digits(X) when X >= 1000000000000 -> 13; -count_digits(X) when X >= 100000000000 -> 12; -count_digits(X) when X >= 10000000000 -> 11; -count_digits(X) when X >= 1000000000 -> 10; -count_digits(X) when X >= 100000000 -> 9; -count_digits(X) when X >= 10000000 -> 8; -count_digits(X) when X >= 1000000 -> 7; -count_digits(X) when X >= 100000 -> 6; -count_digits(X) when X >= 10000 -> 5; -count_digits(X) when X >= 1000 -> 4; -count_digits(X) when X >= 100 -> 3; -count_digits(X) when X >= 10 -> 2; -count_digits(_X) -> 1. - -%%----------------------------------------------------------------- -%%------------- END OF MODULE ------------------------------------- -%%----------------------------------------------------------------- diff --git a/lib/orber/src/ifr_objects.hrl b/lib/orber/src/ifr_objects.hrl deleted file mode 100644 index 3feedbc652..0000000000 --- a/lib/orber/src/ifr_objects.hrl +++ /dev/null @@ -1,422 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%%---------------------------------------------------------------------- -%%% File : ir_objects.hrl -%%% Purpose : Record definitions for the IR DB -%%%---------------------------------------------------------------------- - -%%%---------------------------------------------------------------------- -%%% ********************************************************************* -%%% * * -%%% * PLEASE NOTE * -%%% * * -%%% * If a record is removed or added in this file, the corresponding * -%%% * database initialization code _MUST_ be updated accordingly. * -%%% * * -%%% * The initialization code is defined in a macro in this file. * -%%% * * -%%% * Also remember to update select/2 in orber_ifr.erl when adding * -%%% * or deleting a record in this file. * -%%% * * -%%% ********************************************************************* -%%%---------------------------------------------------------------------- - -%% Interface objects - -%% There are eight interface objects in an interface repository: -%% Repository, ModuleDef, InterfaceDef, AttributeDef, OperationDef, -%% TypedefDef, ConstantDef and ExceptionDef (CORBA V2.0, page 6-5/6). - -% The other objects defined here are used to build the above objects -% (CORBA V2.0, page 6-7). - -% Object references are stored as mnesia object IDs, i.e. a tuple with -% the table name and the ir_Internal_ID. - -% Inheritance strategy. We incorporate the inherited object into the -% inheriting object. The record element 'inherited_objects' is a list -% of objects that "this" object inherits from (i.e. full object -% records and not object references). - -% The record element 'ir_Internal_ID' is a tag that uniquely -% identifies a record. See the function orber_ifr:unique(). - - % IRObject, page 6-9 --record(ir_IRObject, {ir_Internal_ID,def_kind}). - - % Contained, page 6-9 --record(ir_Contained, {ir_Internal_ID, %[IRObject] - def_kind, %from IRObject - id, - name, - version, - defined_in, - absolute_name, - containing_repository}). - - % Container, page 6-10 --record(ir_Container, {ir_Internal_ID, %[IRObject] - def_kind, %from IRObject - contents}). - - % IDLType, page 6-15 --record(ir_IDLType, {ir_Internal_ID, %[IRObject] - def_kind, %from IRObject - type}). - - % Repository, page 6-16 --record(ir_Repository, {ir_Internal_ID, %[Container] - def_kind, %from IRObject - contents, %from Container - primitivedefs}). - - % ModuleDef, page 6-17 --record(ir_ModuleDef, {ir_Internal_ID, %[Container,Contained] - def_kind, %from IRObject - contents, %from Container - id, %from Contained - name, %from Contained - version, %from Contained - defined_in, %from Contained - absolute_name, %from Contained - containing_repository %from Contained - }). - - % ConstantDef, page 6-17 --record(ir_ConstantDef, {ir_Internal_ID, %[Contained] - def_kind, %from IRObject - id, %from Contained - name, %from Contained - version, %from Contained - defined_in, %from Contained - absolute_name, %from Contained - containing_repository, %from Contained - type, - type_def, - value}). - - % TypedefDef, page 6-18 --record(ir_TypedefDef, {ir_Internal_ID, %[Contained,IDLType] - def_kind, %from IRObject - id, %from Contained - name, %from Contained - version, %from Contained - defined_in, %from Contained - absolute_name, %from Contained - containing_repository, %from Contained - type %from IDLType - }). - - % StructDef, page 6-19 --record(ir_StructDef, {ir_Internal_ID, %[TypedefDef] - def_kind, %from IRObject - id, %from Contained - name, %from Contained - version, %from Contained - defined_in, %from Contained - absolute_name, %from Contained - containing_repository, %from Contained - type, %from IDLType - members}). - - % UnionDef, page 6-19 --record(ir_UnionDef, {ir_Internal_ID, %[TypedefDef] - def_kind, %from IRObject - id, %from Contained - name, %from Contained - version, %from Contained - defined_in, %from Contained - absolute_name, %from Contained - containing_repository, %from Contained - type, %from IDLType - discriminator_type, - discriminator_type_def, - members}). - - % EnumDef, page 6-20 --record(ir_EnumDef, {ir_Internal_ID, %[TypedefDef] - def_kind, %from IRObject - id, %from Contained - name, %from Contained - version, %from Contained - defined_in, %from Contained - absolute_name, %from Contained - containing_repository, %from Contained - type, %from IDLType - members}). - - % AliasDef, page 6-21 --record(ir_AliasDef, {ir_Internal_ID, %[TypedefDef] - def_kind, %from IRObject - id, %from Contained - name, %from Contained - version, %from Contained - defined_in, %from Contained - absolute_name, %from Contained - containing_repository, %from Contained - type, %from IDLType - original_type_def}). - - % PrimitiveDef, page 6-21 --record(ir_PrimitiveDef, {ir_Internal_ID, %[IDLType] - def_kind, %from IRObject - type, %from IDLType - kind}). - - % StringDef, page 6-22 --record(ir_StringDef, {ir_Internal_ID, %[IDLType] - def_kind, %from IRObject - type, %from IDLType - bound}). - --record(ir_WstringDef, {ir_Internal_ID, %[IDLType] - def_kind, %from IRObject - type, %from IDLType - bound}). - - % SequenceDef, page 6-22 --record(ir_SequenceDef, {ir_Internal_ID, %[IDLType] - def_kind, %from IRObject - type, %from IDLType - bound, - element_type, - element_type_def}). - - % ArrayDef, page 6-23 --record(ir_ArrayDef, {ir_Internal_ID, %[IDLType] - def_kind, %from IRObject - type, %from IDLType - length, - element_type, - element_type_def}). - - % ExceptionDef, page 6-23 --record(ir_ExceptionDef, {ir_Internal_ID, %[Contained] - def_kind, %from IRObject - id, %from Contained - name, %from Contained - version, %from Contained - defined_in, %from Contained - absolute_name, %from Contained - containing_repository, %from Contained - type, - members}). - - % AttributeDef, page 6-24 --record(ir_AttributeDef, {ir_Internal_ID, %[Contained] - def_kind, %from IRObject - id, %from Contained - name, %from Contained - version, %from Contained - defined_in, %from Contained - absolute_name, %from Contained - containing_repository, %from Contained - type, - type_def, - mode}). - - % OperationDef, page 6-25 --record(ir_OperationDef, {ir_Internal_ID, %[Contained] - def_kind, %from IRObject - id, %from Contained - name, %from Contained - version, %from Contained - defined_in, %from Contained - absolute_name, %from Contained - containing_repository, %from Contained - result, - result_def, - params, - mode, - contexts, - exceptions}). - - % InterfaceDef, page 6-27 --record(ir_InterfaceDef, {ir_Internal_ID, %[Container,Contained,IDLType] - def_kind, %from IRObject - contents, %from Container - id, %from Contained - name, %from Contained - version, %from Contained - defined_in, %from Contained - absolute_name, %from Contained - containing_repository, %from Contained - type, %from IDLType - base_interfaces}). - - % TypeCode, page 6-33 - --record(ir_FixedDef, {ir_Internal_ID, %[IDLType] - def_kind, %from IRObject - type, %from IDLType - digits, - scale}). - - -% TypeCodes cannot be defined as records, since each type code has a -% quite unique structure depending on the type. The old TypeCode -% record definition is left here as a comment in case we want to -% change back to the old style. - -%% ir_TypeCode does not have a field ir_Internal_ID. TypeCodes are -%% never explicitly written to the database as separate DB-records. -%% TypeCodes are stored as full records whenever they are used in an -%% IFR-object. -%%-record(ir_TypeCode, {kind, -%% parameter_list}). - - % ORB, page 6-39 --record(ir_ORB, {ir_Internal_ID, % *** Do we need any attributes - dummy}). % for this table? ORB is a pseudo- - % object so perhaps the table is - % unnecessary? - --record(orber_light_ifr, {id, %% IFR-id - module, - type, - base_id}). - --define(IFR_ModuleDef, 0). --define(IFR_ConstantDef, 1). --define(IFR_StructDef, 2). --define(IFR_UnionDef, 3). --define(IFR_EnumDef, 4). --define(IFR_AliasDef, 5). --define(IFR_InterfaceDef, 6). --define(IFR_ExceptionDef, 7). - - -%%%---------------------------------------------------------------------- -%%% 'ifr_object_list' is used by other modules. Do NOT remove or rename -%%% this list! -%%% An addition or deletion of a record above must be duplicated here in -%%% this list and in the macro 'ifr_record_tuple_list' below. --define(ifr_object_list, [ir_ModuleDef, - ir_Contained, - ir_AttributeDef, - ir_Repository, - ir_OperationDef, - ir_InterfaceDef, - ir_TypedefDef, - ir_Container, - ir_EnumDef, - ir_UnionDef, - ir_StringDef, - ir_WstringDef, - ir_ORB, - ir_IDLType, - ir_ExceptionDef, - ir_IRObject, - ir_PrimitiveDef, - ir_ArrayDef, - ir_AliasDef, - ir_ConstantDef, - ir_StructDef, - ir_SequenceDef, - ir_FixedDef]). - --define(ifr_light_object_list, [orber_light_ifr]). - --define(cr_fun_tuple(Table, Options), - {Table, - fun() -> - case mnesia:create_table(Table,[{attributes, - record_info(fields, - Table)}]++Options)of - {atomic,ok} -> - ok; - R -> - R - end - end} - ). - --define(cr_fun_tuple_local(Table, IFR_storage_type), - {Table, - fun() -> - case mnesia:add_table_copy(Table,node(), IFR_storage_type)of - {atomic,ok} -> - ok; - R -> - R - end - end} - ). - --define(ifr_record_tuple_list(Options), - [?cr_fun_tuple(ir_IRObject, Options), - ?cr_fun_tuple(ir_Contained, [{index, [#ir_Contained.id]}|Options]), - ?cr_fun_tuple(ir_Container, Options), - ?cr_fun_tuple(ir_IDLType, Options), - ?cr_fun_tuple(ir_Repository, Options), - ?cr_fun_tuple(ir_ModuleDef, [{index, [#ir_ModuleDef.id]}|Options]), - ?cr_fun_tuple(ir_ConstantDef, [{index, [#ir_ConstantDef.id]}|Options]), - ?cr_fun_tuple(ir_TypedefDef, [{index, [#ir_TypedefDef.id]}|Options]), - ?cr_fun_tuple(ir_StructDef, [{index, [#ir_StructDef.id]}|Options]), - ?cr_fun_tuple(ir_UnionDef, [{index, [#ir_UnionDef.id]}|Options]), - ?cr_fun_tuple(ir_EnumDef, [{index, [#ir_EnumDef.id]}|Options]), - ?cr_fun_tuple(ir_AliasDef, [{index, [#ir_AliasDef.id]}|Options]), - ?cr_fun_tuple(ir_PrimitiveDef, Options), - ?cr_fun_tuple(ir_StringDef, Options), - ?cr_fun_tuple(ir_WstringDef, Options), - ?cr_fun_tuple(ir_SequenceDef, Options), - ?cr_fun_tuple(ir_ArrayDef, Options), - ?cr_fun_tuple(ir_ExceptionDef, [{index, [#ir_ExceptionDef.id]}|Options]), - ?cr_fun_tuple(ir_AttributeDef, [{index, [#ir_AttributeDef.id]}|Options]), - ?cr_fun_tuple(ir_OperationDef, [{index, [#ir_OperationDef.id]}|Options]), - ?cr_fun_tuple(ir_InterfaceDef, [{index, [#ir_InterfaceDef.id]}| Options]), -% ?cr_fun_tuple(ir_TypeCode, Options), - ?cr_fun_tuple(ir_ORB, Options), - ?cr_fun_tuple(ir_FixedDef, Options)]). - --define(ifr_light_record_tuple_list(Options), - [?cr_fun_tuple(orber_light_ifr, Options)]). - - --define(ifr_record_tuple_list_local(IFR_storage_type), - [?cr_fun_tuple_local(ir_IRObject, IFR_storage_type), - ?cr_fun_tuple_local(ir_Contained, IFR_storage_type), - ?cr_fun_tuple_local(ir_Container, IFR_storage_type), - ?cr_fun_tuple_local(ir_IDLType, IFR_storage_type), - ?cr_fun_tuple_local(ir_Repository, IFR_storage_type), - ?cr_fun_tuple_local(ir_ModuleDef, IFR_storage_type), - ?cr_fun_tuple_local(ir_ConstantDef, IFR_storage_type), - ?cr_fun_tuple_local(ir_TypedefDef, IFR_storage_type), - ?cr_fun_tuple_local(ir_StructDef, IFR_storage_type), - ?cr_fun_tuple_local(ir_UnionDef, IFR_storage_type), - ?cr_fun_tuple_local(ir_EnumDef, IFR_storage_type), - ?cr_fun_tuple_local(ir_AliasDef, IFR_storage_type), - ?cr_fun_tuple_local(ir_PrimitiveDef, IFR_storage_type), - ?cr_fun_tuple_local(ir_StringDef, IFR_storage_type), - ?cr_fun_tuple_local(ir_WstringDef, IFR_storage_type), - ?cr_fun_tuple_local(ir_SequenceDef, IFR_storage_type), - ?cr_fun_tuple_local(ir_ArrayDef, IFR_storage_type), - ?cr_fun_tuple_local(ir_ExceptionDef, IFR_storage_type), - ?cr_fun_tuple_local(ir_AttributeDef, IFR_storage_type), - ?cr_fun_tuple_local(ir_OperationDef, IFR_storage_type), - ?cr_fun_tuple_local(ir_InterfaceDef, IFR_storage_type), -% ?cr_fun_tuple_local(ir_TypeCode, IFR_storage_type), - ?cr_fun_tuple_local(ir_ORB, IFR_storage_type), - ?cr_fun_tuple_local(ir_FixedDef, IFR_storage_type)]). - --define(ifr_light_record_tuple_list_local(IFR_storage_type), - [?cr_fun_tuple_local(orber_light_ifr, IFR_storage_type)]). diff --git a/lib/orber/src/iop_ior.erl b/lib/orber/src/iop_ior.erl deleted file mode 100644 index a78a6b96e5..0000000000 --- a/lib/orber/src/iop_ior.erl +++ /dev/null @@ -1,1717 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: iop_ior.erl -%% Description: -%% This file contains the IOP::IOR handling -%% -%%----------------------------------------------------------------- --module(iop_ior). - --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([code/4, decode/4, string_decode/1, - string_code/1, string_code/2, string_code/3, string_code/4, - get_key/1, get_key/2, get_typeID/1, create/9, - get_objkey/1, check_nil/1, get_privfield/1, set_privfield/2, - get_orbfield/1, set_orbfield/2, - get_flagfield/1, set_flagfield/2, - create_external/5, create_external/6, print/1, print/2, - get_alt_addr/1, add_component/2, get_peerdata/1]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- - -%%----------------------------------------------------------------- -%% Macros -%%----------------------------------------------------------------- --define(DEBUG_LEVEL, 6). - - -%%----------------------------------------------------------------- -%% External interface functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: create/5/6 -%%----------------------------------------------------------------- -%% There are a few restrictions if a certain IIOP-version may contain certain components -%% and contexts The ones we currently, and the ones we perhaps will, support is: -%% -%% Feature 1.0 1.1 1.2 -%% TransactionService Service Context yes yes yes -%% CodeSets Service Context yes yes -%% Object by Value Service Context yes -%% Bi-Directional IIOP Service Context yes -%% IOR components in IIOP profile yes yes -%% TAG_ORB_TYPE yes yes -%% TAG_CODE_SETS yes yes -%% TAG_ALTERNATE_IIOP_ADDRESS yes -%% TAG_SSL_SEC_TRANS yes yes -%% Extended IDL data types yes yes -%% Bi-Directional GIOP Features yes -%% Value types and Abstract Interfaces yes -%% -%% CSIv2: -%% A target that supports unprotected IIOP invocations shall specify in the -%% corresponding TAG_INTERNET_IOP profile a nonzero port number at which the -%% target will accept unprotected invocations.9 A target that supports only -%% protected IIOP invocations shall specify a port number of 0 (zero) in the -%% corresponding TAG_INTERNET_IOP profile. -%%----------------------------------------------------------------- -create({1, 0}, TypeID, Hosts, IIOPPort, _, Objkey, _, _, _) -> - Template = #'IIOP_ProfileBody_1_0'{iiop_version = - #'IIOP_Version'{major=1, minor=0}, - port = IIOPPort, - object_key = Objkey}, - #'IOP_IOR'{type_id=TypeID, - profiles=duplicate_1_0_profiles(Hosts, Template, [])}; -create({1, Minor}, TypeID, Hosts, IIOPPort, -1, Objkey, MC, _, _) -> - Template = #'IIOP_ProfileBody_1_1'{iiop_version = - #'IIOP_Version'{major=1, minor=Minor}, - port = IIOPPort, - object_key = Objkey, - components = MC}, - #'IOP_IOR'{type_id=TypeID, - profiles=duplicate_1_1_profiles(Hosts, Template, [])}; - -create({1, Minor}, TypeID, Hosts, IIOPPort, SSLPort, Objkey, MC, Flags, EnvFlags) -> - V=#'IIOP_Version'{major=1, minor=Minor}, - UseCSIv2 = ?ORB_FLAG_TEST(EnvFlags, ?ORB_ENV_USE_CSIV2), - Template = - case ?ORB_FLAG_TEST(Flags, ?ORB_NO_SECURITY) of - true -> - #'IIOP_ProfileBody_1_1'{iiop_version = V, - port = IIOPPort, - object_key = Objkey, - components = MC}; - false when UseCSIv2 == false -> - #'IIOP_ProfileBody_1_1'{iiop_version=V, - port=IIOPPort, - object_key=Objkey, - components= [#'IOP_TaggedComponent' - {tag=?TAG_SSL_SEC_TRANS, - component_data=#'SSLIOP_SSL'{target_supports = 2, - target_requires = 2, - port = SSLPort}}|MC]}; - false when UseCSIv2 == true -> - #'IIOP_ProfileBody_1_1' - {iiop_version=V, - port=0, - object_key=Objkey, - components= [#'IOP_TaggedComponent' - {tag = ?TAG_CSI_SEC_MECH_LIST, - component_data = - #'CSIIOP_CompoundSecMechList' - {stateful = false, - mechanism_list = - [#'CSIIOP_CompoundSecMech' - {target_requires = 6, - transport_mech = - #'IOP_TaggedComponent' - {tag=?TAG_TLS_SEC_TRANS, - component_data=#'CSIIOP_TLS_SEC_TRANS' - {target_supports = 7, - target_requires = 8, - addresses = - [#'CSIIOP_TransportAddress'{host_name = "Host", - port = SSLPort}]}}, - as_context_mech = - #'CSIIOP_AS_ContextSec' - {target_supports = 9, target_requires = 10, - client_authentication_mech = [1, 255], - target_name = [2,255]}, - sas_context_mech = - #'CSIIOP_SAS_ContextSec' - {target_supports = 11, target_requires = 12, - privilege_authorities = - [#'CSIIOP_ServiceConfiguration' - {syntax = ?ULONGMAX, - name = [3,255]}], - supported_naming_mechanisms = [[4,255],[5,255]], - supported_identity_types = ?ULONGMAX}}]}}|MC]} - end, - #'IOP_IOR'{type_id=TypeID, - profiles=duplicate_1_1_profiles(Hosts, Template, [])}; -create(Version, TypeID, Host, IIOPPort, SSLPort, Objkey, MC, _, _) -> - orber:dbg("[~p] iop_ior:create(~p, ~p, ~p, ~p, ~p, ~p, ~p);~n" - "Unsupported IIOP-version.", - [?LINE, Version, TypeID, Host, IIOPPort, SSLPort, Objkey, MC], - ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}). - - - - -duplicate_1_1_profiles([], _, Profiles) -> - Profiles; -duplicate_1_1_profiles([H|T], Template, Profiles) -> - duplicate_1_1_profiles(T, Template, - [#'IOP_TaggedProfile' - {tag=?TAG_INTERNET_IOP, - profile_data = - Template#'IIOP_ProfileBody_1_1'{host = H}}|Profiles]). - -duplicate_1_0_profiles([], _, Profiles) -> - Profiles; -duplicate_1_0_profiles([H|T], Template, Profiles) -> - duplicate_1_0_profiles(T, Template, - [#'IOP_TaggedProfile' - {tag=?TAG_INTERNET_IOP, - profile_data = - Template#'IIOP_ProfileBody_1_0'{host = H}}|Profiles]). - - -%%----------------------------------------------------------------- -%% Func: create_external/5/6 -%%----------------------------------------------------------------- -create_external(Version, TypeID, Host, IIOP_port, Objkey) -> - create_external(Version, TypeID, Host, IIOP_port, Objkey, []). -create_external({1, 0}, TypeID, Host, IIOP_port, Objkey, _MC) -> - V=#'IIOP_Version'{major=1, - minor=0}, - PB=#'IIOP_ProfileBody_1_0'{iiop_version=V, - host=Host, - port=IIOP_port, - object_key=Objkey}, - #'IOP_IOR'{type_id=TypeID, profiles=[#'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, - profile_data=PB}]}; -create_external({1, 1}, TypeID, Host, IIOP_port, Objkey, Components) -> - V=#'IIOP_Version'{major=1, - minor=1}, - PB=#'IIOP_ProfileBody_1_1'{iiop_version=V, - host=Host, - port=IIOP_port, - object_key=Objkey, - components=Components}, - #'IOP_IOR'{type_id=TypeID, - profiles=[#'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, - profile_data=PB}]}; -create_external({1, 2}, TypeID, Host, IIOP_port, Objkey, Components) -> - V=#'IIOP_Version'{major=1, - minor=2}, - PB=#'IIOP_ProfileBody_1_1'{iiop_version=V, - host=Host, - port=IIOP_port, - object_key=Objkey, - components=Components}, - #'IOP_IOR'{type_id=TypeID, - profiles=[#'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, - profile_data=PB}]}; -create_external(Version, TypeID, Host, IIOP_port, Objkey, MC) -> - orber:dbg("[~p] iop_ior:create_external(~p, ~p, ~p, ~p, ~p, ~p);~n" - "Unsupported IIOP-version.", - [?LINE, Version, TypeID, Host, IIOP_port, Objkey, MC], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------------- -%% Func: get_peerdata/1 -%%----------------------------------------------------------------- -%% Probably an external IOR. -get_peerdata(#'IOP_IOR'{} = IOR) -> - get_peerdata(get_key(IOR), IOR, [], []); -%% Local object reference. -get_peerdata(_) -> - []. - -%% "Plain" TCP/IP. -get_peerdata({'external', {Host, Port, _InitObjkey, Index, TaggedProfile, - #host_data{protocol = normal, - csiv2_mech = undefined}}}, - IOR, Acc, Indexes) -> - Alts = get_alt_addr(TaggedProfile), - get_peerdata(get_key(IOR, [Index|Indexes]), IOR, [{Host, Port}|Alts] ++ Acc, - [Index|Indexes]); -%% "Plain" SSL -get_peerdata({'external', {Host, _Port, _InitObjkey, Index, TaggedProfile, - #host_data{protocol = ssl, - ssl_data = #'SSLIOP_SSL'{port = Port}, - csiv2_mech = undefined}}}, - IOR, Acc, Indexes) -> - Alts = get_alt_addr(TaggedProfile), - get_peerdata(get_key(IOR, [Index|Indexes]), IOR, [{Host, Port}|Alts] ++ Acc, - [Index|Indexes]); -%% TEMPORARY FIX TO SKIP CSIv2 DATA. -get_peerdata({'external', {Host, _Port, _InitObjkey, Index, TaggedProfile, - #host_data{protocol = ssl, - ssl_data = #'SSLIOP_SSL'{port = Port}}}}, - IOR, Acc, Indexes) -> - Alts = get_alt_addr(TaggedProfile), - get_peerdata(get_key(IOR, [Index|Indexes]), IOR, [{Host, Port}|Alts] ++ Acc, - [Index|Indexes]); -%% CSIv2 over SSL (TAG_TLS_SEC_TRANS) using the SAS protocol. Note port must equal 0. -get_peerdata({'external', - {_Host, 0, _InitObjkey, Index, TaggedProfile, - #host_data{protocol = ssl, - csiv2_mech = - #'CSIIOP_CompoundSecMech'{target_requires = _TR} = _Mech, - csiv2_addresses = Addresses}}}, - IOR, Acc, Indexes) -> - Alts = get_alt_addr(TaggedProfile), - get_peerdata(get_key(IOR, [Index|Indexes]), IOR, Addresses ++ Alts ++ Acc, - [Index|Indexes]); -%% CSIv2 over SSL (TAG_NULL_TAG) using the SAS protocol. -get_peerdata({'external', - {Host, _Port, _InitObjkey, Index, TaggedProfile, - #host_data{protocol = ssl, - ssl_data = #'SSLIOP_SSL'{port = Port}, - csiv2_mech = Mech}}}, - IOR, Acc, Indexes) when is_record(Mech, 'CSIIOP_CompoundSecMech') -> - Alts = get_alt_addr(TaggedProfile), - get_peerdata(get_key(IOR, [Index|Indexes]), IOR, [{Host, Port}|Alts] ++ Acc, - [Index|Indexes]); -%% CSIv2 over TCP (TAG_NULL_TAG) using the SAS protocol. -get_peerdata({'external', - {Host, Port, _InitObjkey, Index, TaggedProfile, - #host_data{protocol = normal, - csiv2_mech = Mech}}}, - IOR, Acc, Indexes) when is_record(Mech, 'CSIIOP_CompoundSecMech') -> - Alts = get_alt_addr(TaggedProfile), - get_peerdata(get_key(IOR, [Index|Indexes]), IOR, [{Host, Port}|Alts] ++ Acc, - [Index|Indexes]); -get_peerdata(undefined, _IOR, Acc, _Indexes) -> - Acc; -%% Local object reference. -get_peerdata(_, _, _, _) -> - []. - -%%----------------------------------------------------------------- -%% Func: get_key/1 -%%----------------------------------------------------------------- -get_key(#'IOP_IOR'{profiles=P}) -> - get_key_1(P, false, 0, undefined, #host_data{}); -get_key({Module, Type, Key, _UserDef, OrberDef, Flags}) -> - if - is_binary(Key) -> - {'internal', Key, OrberDef, Flags, Module}; - Type == pseudo -> - {'internal_registered', {pseudo, Key}, OrberDef, Flags, Module}; - is_atom(Key) -> - {'internal_registered', Key, OrberDef, Flags, Module} - end; -get_key(What) -> - orber:dbg("[~p] iop_ior:get_key(~p); Invalid IOR", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}). - - -get_key(#'IOP_IOR'{profiles=P}, Exclude) -> - get_key_1(P, true, 0, Exclude, #host_data{}); -get_key(What, _Exclude) -> - orber:dbg("[~p] iop_ior:get_key(~p); Invalid IOR", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}). - - -get_key_1([], false, _, _, _) -> - orber:dbg("[~p] iop_ior:get_key_1([]); bad object reference, profile not found.", - [?LINE], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}); -get_key_1([], true, _, _, _) -> - undefined; -%%--------- Local IIOP-1.0 Profile --------- -get_key_1([#'IOP_TaggedProfile' - {tag=?TAG_INTERNET_IOP, - profile_data=#'IIOP_ProfileBody_1_0' - {object_key={Module, Type, Key, _UserDef, OrberDef, Flags}}}|_], - _Retry, _Counter, _Exclude, _HD) -> - if - is_binary(Key) -> - {'internal', Key, OrberDef, Flags, Module}; - Type == pseudo -> - {'internal_registered', {pseudo, Key}, OrberDef, Flags, Module}; - is_atom(Key) -> - {'internal_registered', Key, OrberDef, Flags, Module} - end; -%%--------- Local IIOP-1.1 & IIOP-1.2 Profiles --------- -get_key_1([#'IOP_TaggedProfile' - {tag=?TAG_INTERNET_IOP, - profile_data=#'IIOP_ProfileBody_1_1' - {object_key={Module, Type, Key, _UserDef, OrberDef, Flags}}}|_], - _Retry, _Counter, _Exclude, _HD) -> - if - is_binary(Key) -> - {'internal', Key, OrberDef, Flags, Module}; - Type == pseudo -> - {'internal_registered', {pseudo, Key}, OrberDef, Flags, Module}; - Type == passive -> - %% CHECK FOR PRIMARY COMPONENT & GROUPID! Better yet, do not. - %% This is internal key and is supposed to be well formed. - %% Also, internal keys are not searched for primary member or - %% groupid in the component-section of IOR. ObjectKey will tell - %% GroupID and database read transaction will tell primary member. - {'internal_registered', {passive, Key}, OrberDef, Flags, Module}; - is_atom(Key) -> - {'internal_registered', Key, OrberDef, Flags, Module} - end; -%%--------- External IIOP-1.0 Profile --------- -get_key_1([#'IOP_TaggedProfile' - {tag=?TAG_INTERNET_IOP, - profile_data=#'IIOP_ProfileBody_1_0' - {host = Host, port = Port, object_key= ObjectKey}} = TP|P], - _Retry, Counter, Exclude, HD) when Exclude == undefined -> - %% This case is "necessary" if an ORB adds several IIOP-profiles since, - %% for example, wchar isn't supported for 1.0. - case get_key_1(P, true, Counter+1, Exclude, HD) of - undefined -> - %% We now it's IIOP-1.0 and it doesn't contain any - %% components. Hence, no need to check for it. - {'external', {Host, Port, ObjectKey, Counter, TP, - HD#host_data{version = {1,0}}}}; - LaterVersion -> - LaterVersion - end; -get_key_1([#'IOP_TaggedProfile' - {tag=?TAG_INTERNET_IOP, - profile_data=#'IIOP_ProfileBody_1_0' - {host = Host, port = Port, object_key= ObjectKey}} = TP|P], - Retry, Counter, Exclude, HD) -> - case lists:member(Counter, Exclude) of - true -> - get_key_1(P, Retry, Counter+1, Exclude, HD); - false -> - %% This case is "necessary" if an ORB adds several IIOP-profiles since, - %% for example, wchar isn't supported for 1.0. - case get_key_1(P, true, Counter+1, Exclude, HD) of - undefined -> - {'external', {Host, Port, ObjectKey, Counter, TP, - HD#host_data{version = {1,0}}}}; - LaterVersion -> - LaterVersion - end - end; -%%--------- External IIOP-1.1 & IIOP-1.2 Profiles --------- -get_key_1([#'IOP_TaggedProfile' - {tag=?TAG_INTERNET_IOP, - profile_data=#'IIOP_ProfileBody_1_1' - {iiop_version = #'IIOP_Version'{major=Major, minor=Minor}, - host = Host, port = Port, object_key= ObjectKey, - components = Components}} = TP|P], - Retry, Counter, Exclude, HD) when Exclude == undefined -> - case check_components(Components, Port, HD#host_data{version = {Major,Minor}}) of - #host_data{csiv2_mech = undefined} when Port == 0 -> - get_key_1(P, Retry, Counter+1, Exclude, HD); - NewHD -> - {'external', {Host, Port, ObjectKey, Counter, TP, NewHD}} - end; -get_key_1([#'IOP_TaggedProfile' - {tag=?TAG_INTERNET_IOP, - profile_data=#'IIOP_ProfileBody_1_1' - {iiop_version = #'IIOP_Version'{major=Major, minor=Minor}, - host = Host, port = Port, object_key= ObjectKey, - components = Components}} = TP|P], - Retry, Counter, Exclude, HD) -> - case lists:member(Counter, Exclude) of - true -> - get_key_1(P, Retry, Counter+1, Exclude, HD); - false -> - case check_components(Components, Port, - HD#host_data{version = {Major,Minor}}) of - #host_data{csiv2_mech = undefined} when Port == 0 -> - get_key_1(P, Retry, Counter+1, Exclude, HD); - NewHD -> - {'external', {Host, Port, ObjectKey, Counter, TP, NewHD}} - end - end; -get_key_1([_ | P], Retry, Counter, Exclude, HD) -> - get_key_1(P, Retry, Counter+1, Exclude, HD). - -check_components([], _, HostData) -> - HostData; -check_components([#'IOP_TaggedComponent'{tag=?TAG_SSL_SEC_TRANS, - component_data=SSLStruct}|Rest], - Port, HostData) when is_record(SSLStruct, 'SSLIOP_SSL') -> - check_components(Rest, Port, HostData#host_data{protocol = ssl, - ssl_data = SSLStruct}); -%% CSIv2 Components -check_components([#'IOP_TaggedComponent'{tag=?TAG_CSI_SEC_MECH_LIST, - component_data=Data}|Rest], - Port, HostData) when is_record(Data, 'CSIIOP_CompoundSecMechList') -> - case check_sec_mech(Data#'CSIIOP_CompoundSecMechList'.mechanism_list, Port) of - undefined -> - check_components(Rest, Port, HostData); - {ok, Protocol, Mech, Addresses} -> - check_components(Rest, Port, - HostData#host_data - {protocol = Protocol, - csiv2_mech = Mech, - csiv2_statefull = Data#'CSIIOP_CompoundSecMechList'.stateful, - csiv2_addresses = Addresses}); - {ok, Mech} -> - check_components(Rest, Port, - HostData#host_data - {csiv2_mech = Mech, - csiv2_statefull = Data#'CSIIOP_CompoundSecMechList'.stateful}) - end; -%% FT Components -check_components([#'IOP_TaggedComponent' - {tag=?TAG_FT_HEARTBEAT_ENABLED, - component_data= - #'FT_TagFTHeartbeatEnabledTaggedComponent' - {heartbeat_enabled = Boolean}}|Rest], - Port, HostData) -> - check_components(Rest, Port, HostData#host_data{ft_heartbeat = Boolean}); -check_components([#'IOP_TaggedComponent' - {tag=?TAG_FT_PRIMARY, - component_data= - #'FT_TagFTPrimaryTaggedComponent'{primary = Boolean}}|Rest], - Port, HostData) -> - check_components(Rest, Port, HostData#host_data{ft_primary = Boolean}); -check_components([#'IOP_TaggedComponent' - {tag=?TAG_FT_GROUP, - component_data=#'FT_TagFTGroupTaggedComponent' - {version = #'GIOP_Version'{major = 1, minor = 0}, - ft_domain_id = FTDomain, - object_group_id = GroupID, - object_group_ref_version = GroupVer}}|Rest], - Port, HostData) -> - check_components(Rest, Port, HostData#host_data{ft_domain = FTDomain, - ft_group = GroupID, - ft_ref_version = GroupVer}); -%% CodeSets Component -check_components([#'IOP_TaggedComponent'{tag=?TAG_CODE_SETS, - component_data=#'CONV_FRAME_CodeSetComponentInfo' - {'ForCharData' = Char, - 'ForWcharData' = Wchar}}|Rest], - Port, HostData) -> - CharData = check_char_codeset(Char), - WcharData = check_wchar_codeset(Wchar), - check_components(Rest, Port, HostData#host_data{charset = CharData, - wcharset = WcharData}); -%% Not used -check_components([_ | Rest], Port, HostData) -> - check_components(Rest, Port, HostData). - -check_sec_mech([], _) -> - undefined; -%% Not supported yet. -%check_sec_mech([#'CSIIOP_CompoundSecMech' -% {target_requires = TR, -% transport_mech= -% #'IOP_TaggedComponent'{tag=?TAG_SECIOP_SEC_TRANS}} = Mech|_], -% Port) -> -% {ok, seciop, Mech}; -check_sec_mech([#'CSIIOP_CompoundSecMech' - {target_requires = TR, - transport_mech= - #'IOP_TaggedComponent'{tag = ?TAG_TLS_SEC_TRANS, - component_data = CD}} = Mech|_], _Port) - when TR =< ?CSIv2_MAX_TARGET_REQUIRES -> - {ok, ssl, Mech, extract_host_port(CD#'CSIIOP_TLS_SEC_TRANS'.addresses, [])}; -%% The TAG_NULL_TAG component shall be used in the 'transport_mech' field to -%% indicate that a mechanism does not implement security functionality at the -%% transport layer. -%% If the port field in TAG_INTERNET_IOP equals 0 we must find a TAG_TLS_SEC_TRANS -%% or TAG_SECIOP_SEC_TRANS mechanism. -check_sec_mech([#'CSIIOP_CompoundSecMech' - {transport_mech= - #'IOP_TaggedComponent'{tag = ?TAG_NULL_TAG}}|Rest], 0) -> - check_sec_mech(Rest, 0); -check_sec_mech([#'CSIIOP_CompoundSecMech' - {target_requires = TR, - transport_mech= - #'IOP_TaggedComponent'{tag = ?TAG_NULL_TAG}} = Mech|_], _Port) - when TR =< ?CSIv2_MAX_TARGET_REQUIRES -> - {ok, Mech}; -%% Unrecognized or the peer requires more than we support. -check_sec_mech([_ | Rest], Port) -> - check_sec_mech(Rest, Port). - -extract_host_port([], Acc) -> - Acc; -extract_host_port([#'CSIIOP_TransportAddress'{host_name = Host, - port = Port}|Rest], Acc) -> - extract_host_port(Rest, [{Host, Port}|Acc]). - - -check_char_codeset(#'CONV_FRAME_CodeSetComponent'{native_code_set=?ISO8859_1_ID}) -> - ?ISO8859_1_ID; -check_char_codeset(#'CONV_FRAME_CodeSetComponent'{native_code_set=?ISO646_IRV_ID}) -> - ?ISO646_IRV_ID; -check_char_codeset(#'CONV_FRAME_CodeSetComponent'{conversion_code_sets=Converters}) -> - %% Since the list of Converters usually is very short (0 or 1 element) we - %% can use lists:member. - case lists:member(?ISO8859_1_ID, Converters) of - true -> - ?ISO8859_1_ID; - false -> - %% Since we are 100% sure strings will be (e.g. IFR-ids) used we - %% can raise an exception at this point. - orber:dbg("[~p] iop_ior:check_char_codeset(~p);~n" - "Orber cannot communicate with this ORB.~n" - "It doesn't support a Char CodeSet known to Orber.", - [?LINE, Converters], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status = ?COMPLETED_NO}) - end. - -check_wchar_codeset(#'CONV_FRAME_CodeSetComponent'{native_code_set=?UTF_16_ID}) -> - ?UTF_16_ID; -check_wchar_codeset(#'CONV_FRAME_CodeSetComponent'{native_code_set=?UCS_2_ID}) -> - ?UCS_2_ID; -check_wchar_codeset(#'CONV_FRAME_CodeSetComponent'{conversion_code_sets=Converters}) -> - case lists:member(?UTF_16_ID, Converters) of - true -> - ?UTF_16_ID; - false -> - %% We should not raise an exception here since we do not know if - %% wchar/wstring is used. - ?UTF_16_ID -% ?UNSUPPORTED_WCHAR - end. - - -%%----------------------------------------------------------------- -%% Func: add_component/2 -%%----------------------------------------------------------------- -add_component(Objref, Component) when is_record(Objref, 'IOP_IOR') -> - add_component_ior(Objref, Component); -add_component(Objref, Component) -> - add_component_local(Objref, Component, orber:giop_version()). - -add_component_local(_, Component, {1,0}) -> - orber:dbg("[~p] iop_ior:add_component(~p);~n" - "IIOP-1.0 objects cannot contain any components.", - [?LINE, Component], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status = ?COMPLETED_NO}); -add_component_local(_, #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS} - = Component, {1,1}) -> - orber:dbg("[~p] iop_ior:add_component(~p);~n" - "IIOP-1.1 objects may not contain ALTERNATE_IIOP_ADDRESS components.", - [?LINE, Component], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status = ?COMPLETED_NO}); -add_component_local({Mod, Type, Key, UserDef, OrberDef, Flags}, Component, Version) -> - EnvFlags = orber:get_flags(), - MC = case ?ORB_FLAG_TEST(EnvFlags, ?ORB_ENV_EXCLUDE_CODESET_COMPONENT) of - true -> - [Component]; - false -> - [#'IOP_TaggedComponent'{tag=?TAG_CODE_SETS, - component_data=?DEFAULT_CODESETS}, - Component] - end, - case ?ORB_FLAG_TEST(EnvFlags, ?ORB_ENV_ENABLE_NAT) of - false -> - create(Version, Mod:typeID(), orber:host(), orber:iiop_port(), - orber:iiop_ssl_port(), - {Mod, Type, Key, UserDef, OrberDef, Flags}, - MC, Flags, EnvFlags); - true -> - create(Version, Mod:typeID(), orber:nat_host(), - orber:nat_iiop_port(), orber:nat_iiop_ssl_port(), - {Mod, Type, Key, UserDef, OrberDef, Flags}, - MC, Flags, EnvFlags) - - end. - -add_component_ior(#'IOP_IOR'{profiles=P} = IOR, Component) -> - case add_component_ior_helper(P, Component, false, []) of - {false, _} -> - orber:dbg("[~p] iop_ior:add_component_ior(~p);~n" - "The IOR do not contain a valid IIOP-version for the supplied component.", - [?LINE, Component], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status = ?COMPLETED_NO}); - {_, NewProfiles} -> - IOR#'IOP_IOR'{profiles=NewProfiles} - end. - -add_component_ior_helper([], _Component, Status, Acc) -> - {Status, Acc}; -add_component_ior_helper([#'IOP_TaggedProfile' - {tag=?TAG_INTERNET_IOP, - profile_data=#'IIOP_ProfileBody_1_1' - {iiop_version= #'IIOP_Version'{minor=1}}}|T], - #'IOP_TaggedComponent'{tag = ?TAG_ALTERNATE_IIOP_ADDRESS} - = Component, Status, Acc) -> - %% 'ALTERNATE_IIOP_ADDRESS' may only be added to IIOP-1.2 IOR's. - add_component_ior_helper(T, Component, Status, Acc); -add_component_ior_helper([#'IOP_TaggedProfile' - {tag=?TAG_INTERNET_IOP, - profile_data=#'IIOP_ProfileBody_1_1' - {object_key=Objkey, - components=Components} = PB} = H|T], - Component, _Status, Acc) when is_tuple(Objkey) -> - %% The objectkey must be a tuple if it's a local object. We cannot(!!) add components - %% to an external IOR. - add_component_ior_helper(T, Component, true, - [H#'IOP_TaggedProfile' - {profile_data=PB#'IIOP_ProfileBody_1_1' - {components = [Component|Components]}}|Acc]); -add_component_ior_helper([_|T], Component, Status, Acc) -> - add_component_ior_helper(T, Component, Status, Acc). - -%%----------------------------------------------------------------- -%% Func: get_alt_addr/1 -%%----------------------------------------------------------------- -%% TAG_ALTERNATE_IIOP_ADDRESS may only occur in IIOP-1.2 IOR's. -get_alt_addr(#'IOP_TaggedProfile' - {tag=?TAG_INTERNET_IOP, - profile_data=#'IIOP_ProfileBody_1_1'{iiop_version= - #'IIOP_Version'{minor=2}, - components=Components}}) -> - get_alt_addr_helper(Components, []); -get_alt_addr(_) -> - []. - -get_alt_addr_helper([], Acc) -> Acc; -get_alt_addr_helper([#'IOP_TaggedComponent'{tag=?TAG_ALTERNATE_IIOP_ADDRESS, - component_data=#'ALTERNATE_IIOP_ADDRESS' - {'HostID'=Host, 'Port'=Port}}|T], Acc) -> - get_alt_addr_helper(T, [{Host, Port}|Acc]); -get_alt_addr_helper([_|T], Acc) -> - get_alt_addr_helper(T, Acc). - -%%----------------------------------------------------------------- -%% Func: get_typeID/1 -%%----------------------------------------------------------------- -get_typeID(#'IOP_IOR'{type_id=TypeID}) -> - TypeID; -get_typeID({Mod, _Type, _Key, _UserDef, _OrberDef, _Flags}) -> - Mod:typeID(). - -%%----------------------------------------------------------------- -%% Func: get_objkey/1 -%%----------------------------------------------------------------- -get_objkey(#'IOP_IOR'{profiles=P}) -> - get_objkey_1(P); -get_objkey({Id, Type, Key, UserDef, OrberDef, Flags}) -> - {Id, Type, Key, UserDef, OrberDef, Flags}. - -get_objkey_1([]) -> - orber:dbg("[~p] iop_ior:get_objkey_1([]); bad object key, profile not found.", - [?LINE], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}); -get_objkey_1([#'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB} |_]) -> - [_, _, _, _, ObjectKey | _] = tuple_to_list(PB), - ObjectKey; -get_objkey_1([_ | P]) -> - get_objkey_1(P). - -%%----------------------------------------------------------------- -%% Func: get_privfield/1 -%%----------------------------------------------------------------- -get_privfield(#'IOP_IOR'{profiles=P}) -> - get_privfield_1(P); -get_privfield({_Id, _Type, _Key, UserDef, _OrberDef, _Flags}) -> - UserDef. - -get_privfield_1([]) -> - orber:dbg("[~p] iop_ior:get_privfield_1([]); bad object key, profile not found.", - [?LINE], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}); -get_privfield_1([#'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB}|_]) -> - [_, _, _, _, ObjectKey | _] = tuple_to_list(PB), - case ObjectKey of - {_Id, _Type, _Key, UserDef, _OrberDef, _Flags} -> - UserDef; - _ -> - orber:dbg("[~p] iop_ior:get_privfield_1(~p); bad object key.", - [?LINE, ObjectKey], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}) - end; -get_privfield_1([_| P]) -> - get_privfield_1(P). - -%%----------------------------------------------------------------- -%% Func: set_privfield/2 -%%----------------------------------------------------------------- -set_privfield(#'IOP_IOR'{type_id=Id, profiles=P}, UserData) -> - #'IOP_IOR'{type_id=Id, profiles=set_privfield_1(P, UserData)}; -set_privfield({Id, Type, Key, _, OrberDef, Flags}, UserData) -> - {Id, Type, Key, UserData, OrberDef, Flags}. - -set_privfield_1([], _) -> - orber:dbg("[~p] iop_ior:set_privfield_1([]); bad object key, profile not found or external object.", - [?LINE], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}); -set_privfield_1([#'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB}|P], UserData) -> - [RecName, Version, Host, IIOP_port, ObjectKey | Rest] = tuple_to_list(PB), - case ObjectKey of - {Id, Type, Key, _, OrberDef, Flags} -> - [#'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, - profile_data=list_to_tuple([RecName, - Version, Host, - IIOP_port, - {Id, Type, Key, UserData, OrberDef, Flags}| - Rest])} | - set_privfield_1(P, UserData)]; - _ -> - [#'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB} | set_privfield_1(P, UserData)] - end; -set_privfield_1([PB| P], UserData) -> - [PB | set_privfield_1(P, UserData)]. - -%%----------------------------------------------------------------- -%% Func: get_orbfield/1 -%%----------------------------------------------------------------- -get_orbfield(#'IOP_IOR'{profiles=P}) -> - get_orbfield_1(P); -get_orbfield({_Id, _Type, _Key, _UserDef, OrberDef, _Flags}) -> - OrberDef. - -get_orbfield_1([]) -> - orber:dbg("[~p] iop_ior:get_orbfield_1([]);~n" - "bad object key, profile not found.", [?LINE], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}); -get_orbfield_1([#'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB}|_]) -> - [_, _, _, _, ObjectKey | _] = tuple_to_list(PB), - case ObjectKey of - {_Id, _Type, _Key, _UserDef, OrberDef, _Flags} -> - OrberDef; - _ -> - orber:dbg("[~p] iop_ior:get_orbfield_1(~p);~n" - "bad object key.", [?LINE, ObjectKey], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}) - end; -get_orbfield_1([_| P]) -> - get_orbfield_1(P). - -%%----------------------------------------------------------------- -%% Func: set_orbfield/2 -%%----------------------------------------------------------------- -set_orbfield(#'IOP_IOR'{type_id=Id, profiles=P}, OrberDef) -> - #'IOP_IOR'{type_id=Id, profiles=set_orbfield_1(P, OrberDef)}; -set_orbfield({Id, Type, Key, Priv, _, Flags}, OrberDef) -> - {Id, Type, Key, Priv, OrberDef, Flags}. - -set_orbfield_1([], _) -> - orber:dbg("[~p] iop_ior:set_orbfield_1([]);~n" - "bad object key, profile not found or external object.", - [?LINE], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}); -set_orbfield_1([#'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB}| P], OrberDef) -> - [RecName, Version, Host, IIOP_port, ObjectKey | Rest] = tuple_to_list(PB), - case ObjectKey of - {Id, Type, Key, Priv, _, Flags} -> - [#'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, - profile_data=list_to_tuple([RecName, - Version, Host, - IIOP_port, - {Id, Type, Key, Priv, OrberDef, Flags}| - Rest])} | - set_orbfield_1(P, OrberDef)]; - _ -> - [#'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB} | set_orbfield_1(P, OrberDef)] - end; -set_orbfield_1([PB| P], OrberDef) -> - [PB | set_orbfield_1(P, OrberDef)]. - -%%----------------------------------------------------------------- -%% Func: get_flagfield/1 -%%----------------------------------------------------------------- -get_flagfield(#'IOP_IOR'{profiles=P}) -> - get_flagfield_1(P); -get_flagfield({_Id, _Type, _Key, _UserDef, _OrberDef, Flags}) -> - Flags. - -get_flagfield_1([]) -> - orber:dbg("[~p] iop_ior:get_flagfield_1([]); bad object key, profile not found.", - [?LINE], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}); -get_flagfield_1([#'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB}|_]) -> - [_, _, _, _, ObjectKey | _] = tuple_to_list(PB), - case ObjectKey of - {_Id, _Type, _Key, _UserDef, _OrberDef, Flags} -> - Flags; - _ -> - orber:dbg("[~p] iop_ior:get_flagfield_1(~p); bad object key.", - [?LINE, ObjectKey], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}) - end; -get_flagfield_1([_| P]) -> - get_flagfield_1(P). - -%%----------------------------------------------------------------- -%% Func: set_flagfield/2 -%%----------------------------------------------------------------- -set_flagfield(#'IOP_IOR'{type_id=Id, profiles=P}, Flags) -> - #'IOP_IOR'{type_id=Id, profiles=set_flagfield_1(P, Flags)}; -set_flagfield({Id, Type, Key, Priv, OrberDef, _}, Flags) -> - {Id, Type, Key, Priv, OrberDef, Flags}. - -set_flagfield_1([], _) -> - orber:dbg("[~p] iop_ior:set_flagfield_1([]); bad object key, profile not found or external object.", - [?LINE], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}); -set_flagfield_1([#'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB}| P], Flags) -> - [RecName, Version, Host, IIOP_port, ObjectKey | Rest] = tuple_to_list(PB), - case ObjectKey of - {Id, Type, Key, Priv, OrberDef, _} -> - [#'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, - profile_data=list_to_tuple([RecName, - Version, Host, - IIOP_port, - {Id, Type, Key, Priv, OrberDef, Flags}| - Rest])} | - set_flagfield_1(P, Flags)]; - _ -> - [#'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=PB} | set_flagfield_1(P, Flags)] - end; -set_flagfield_1([PB| P], Flags) -> - [PB | set_flagfield_1(P, Flags)]. - -%%----------------------------------------------------------------- -%% Func: check_nil/1 -%%----------------------------------------------------------------- -check_nil(#'IOP_IOR'{type_id="", profiles=[]}) -> - true; -check_nil({Id, _, _, _, _, _}) when is_atom(Id) -> - false; -check_nil({Id, _, _, _, _, _}) -> - case binary_to_list(Id) of - "" -> - true; - _ -> - false - end; -check_nil(_) -> - false. - - - -%%---------------------------------------------------------------------- -%% Function : print -%% Arguments : An object represented as one of the following: -%% - local (tuple) -%% - IOR -%% - stringified IOR -%% - corbaloc- or corbaname-schema -%% IoDevice - the same as the io-module defines. -%% Returns : -%% Description: Prints the object's components. -%%---------------------------------------------------------------------- -print(Object) -> - print(undefined, Object). -print(IoDevice, #'IOP_IOR'{type_id="", profiles=[]}) -> - print_it(IoDevice, - "================== IOR ====================~n" - "NIL Object Reference.~n" - "================== END ====================~n"); -print(IoDevice, IORStr) when is_list(IORStr) -> - IOR = corba:string_to_object(IORStr), - print_helper(IoDevice, IOR); -print(IoDevice, IOR) when is_record(IOR, 'IOP_IOR') -> - print_helper(IoDevice, IOR); -print(IoDevice, {Mod, Type, Key, UserDef, OrberDef, Flags}) -> - EnvFlags = orber:get_flags(), - MC = case ?ORB_FLAG_TEST(EnvFlags, ?ORB_ENV_EXCLUDE_CODESET_COMPONENT) of - true -> - []; - false -> - [#'IOP_TaggedComponent'{tag=?TAG_CODE_SETS, - component_data=?DEFAULT_CODESETS}] - end, - IOR = case ?ORB_FLAG_TEST(EnvFlags, ?ORB_ENV_ENABLE_NAT) of - false -> - create(orber:giop_version(), Mod:typeID(), orber:host(), - orber:iiop_port(), orber:iiop_ssl_port(), - {Mod, Type, Key, UserDef, OrberDef, Flags}, - MC, Flags, EnvFlags); - true -> - create(orber:giop_version(), Mod:typeID(), orber:nat_host(), - orber:nat_iiop_port(), orber:nat_iiop_ssl_port(), - {Mod, Type, Key, UserDef, OrberDef, Flags}, - MC, Flags, EnvFlags) - - end, - print_helper(IoDevice, IOR); -print(_, _) -> - exit("Bad parameter"). - -print_helper(IoDevice, #'IOP_IOR'{type_id=TypeID, profiles=Profs}) -> - Data = io_lib:format("================== IOR ====================~n" - "------------------ IFR ID -----------------~n~s~n", - [TypeID]), - NewData = print_profiles(Profs, []), - print_it(IoDevice, lists:flatten([Data|NewData])). - -print_profiles([], Acc) -> - lists:flatten([Acc | io_lib:format("================== END ====================~n", [])]); -print_profiles([#'IOP_TaggedProfile' - {tag=?TAG_INTERNET_IOP, - profile_data = #'IIOP_ProfileBody_1_0'{iiop_version= - #'IIOP_Version'{major=Major, - minor=Minor}, - host=Host, port=Port, - object_key=Objkey}}|T], Acc) -> - Profile = io_lib:format("~n------------------ IIOP Profile -----------~n" - "Version.............: ~p.~p~n" - "Host................: ~s~n" - "Port................: ~p~n", - [Major, Minor, Host, Port]), - ObjKeyStr = print_objkey(Objkey), - print_profiles(T, [Profile, ObjKeyStr | Acc]); -print_profiles([#'IOP_TaggedProfile' - {tag=?TAG_INTERNET_IOP, - profile_data = #'IIOP_ProfileBody_1_1'{iiop_version= - #'IIOP_Version'{major=Major, - minor=Minor}, - host=Host, - port=Port, - object_key=Objkey, - components=Components}}|T], Acc) -> - Profile = io_lib:format("~n------------------ IIOP Profile -----------~n" - "Version.............: ~p.~p~n" - "Host................: ~s~n" - "Port................: ~p~n", - [Major, Minor, Host, Port]), - ComponentsStr = print_components(Components, []), - ObjKeyStr = print_objkey(Objkey), - print_profiles(T, [Profile, ObjKeyStr, ComponentsStr |Acc]); -print_profiles([#'IOP_TaggedProfile'{tag=?TAG_MULTIPLE_COMPONENTS, - profile_data = Components}|T], Acc) -> - MComp = io_lib:format("~n------------------ Multiple Components ----~n", []), - ComponentsStr = print_components(Components, []), - print_profiles(T, [MComp, ComponentsStr | Acc]); -print_profiles([#'IOP_TaggedProfile'{tag=?TAG_SCCP_IOP, - profile_data = _Data}|T], Acc) -> - SCCP = io_lib:format("~n------------------ SCCP IOP ---------------~n", []), - print_profiles(T, [SCCP | Acc]); -print_profiles([#'IOP_TaggedProfile'{tag=Tag, - profile_data = Data}|T], Acc) -> - TAG = io_lib:format("~n------------------ TAG ~p -----------------~n" - "Data................: ~p~n", [Tag, Data]), - print_profiles(T, [TAG|Acc]). - -print_components([], Data) -> lists:flatten(lists:reverse(Data)); -print_components([#'IOP_TaggedComponent'{tag=?TAG_ORB_TYPE, - component_data=ORB}|T], Data) -> - OType = io_lib:format(" TAG_ORB_TYPE~n" - "ORB Type............: ~p~n", [ORB]), - print_components(T, [OType | Data]); -print_components([#'IOP_TaggedComponent'{tag=?TAG_CODE_SETS, - component_data= - #'CONV_FRAME_CodeSetComponentInfo' - {'ForCharData' = Char, - 'ForWcharData' = Wchar}}|T], Data) -> - CharSet = io_lib:format(" TAG_CODE_SETS~n" - "Native Char.........: ~p~n" - "Char Conversion.....: ~p~n" - "Native Wchar........: ~p~n" - "Wchar Conversion....: ~p~n", - [Char#'CONV_FRAME_CodeSetComponent'.native_code_set, - Char#'CONV_FRAME_CodeSetComponent'.conversion_code_sets, - Wchar#'CONV_FRAME_CodeSetComponent'.native_code_set, - Wchar#'CONV_FRAME_CodeSetComponent'.conversion_code_sets]), - print_components(T, [CharSet | Data]); -print_components([#'IOP_TaggedComponent'{tag=?TAG_ALTERNATE_IIOP_ADDRESS, - component_data=#'ALTERNATE_IIOP_ADDRESS' - {'HostID'=Host, 'Port'=Port}}|T], Data) -> - AltAddr = io_lib:format(" TAG_ALTERNATE_IIOP_ADDRESS~n" - "Alternate Address...: ~s:~p~n", [Host, Port]), - print_components(T, [AltAddr | Data]); -print_components([#'IOP_TaggedComponent'{tag=?TAG_SSL_SEC_TRANS, - component_data=#'SSLIOP_SSL' - {target_supports=Supports, - target_requires=Requires, - port=Port}}|T], Data) -> - SSL = io_lib:format(" TAG_SSL_SEC_TRANS~n" - "SSL Port............: ~p~n" - "SSL Requires........: ~p~n" - "SSL Supports........: ~p~n", [Port, Requires, Supports]), - print_components(T, [SSL | Data]); -%% Fault Tolerant Components -print_components([#'IOP_TaggedComponent'{tag=?TAG_FT_GROUP, - component_data=#'FT_TagFTGroupTaggedComponent' - {version = Version, - ft_domain_id = DomainId, - object_group_id = ObjectGroupId, - object_group_ref_version = ObjGrRefVer}}|T], Data) -> - Comp = io_lib:format(" TAG_FT_GROUP~n" - "Version.............: ~p~n" - "Domain Id...........: ~p~n" - "Obj Group Id........: ~p~n" - "Obj Group Ref Ver...: ~p~n", - [Version, DomainId, ObjectGroupId, ObjGrRefVer]), - print_components(T, [Comp | Data]); -print_components([#'IOP_TaggedComponent'{tag=?TAG_FT_PRIMARY, - component_data=#'FT_TagFTPrimaryTaggedComponent' - {primary = Primary}}|T], Data) -> - Comp = io_lib:format(" TAG_FT_PRIMARY~n" - "Primary.............: ~p~n", [Primary]), - print_components(T, [Comp | Data]); -print_components([#'IOP_TaggedComponent'{tag=?TAG_FT_HEARTBEAT_ENABLED, - component_data=#'FT_TagFTHeartbeatEnabledTaggedComponent' - {heartbeat_enabled = HBE}}|T], Data) -> - Comp = io_lib:format(" TAG_FT_HEARTBEAT_ENABLED~n" - "Heart Beat Enabled..: ~p~n", [HBE]), - print_components(T, [Comp | Data]); -%% Security - CSIIOP -print_components([#'IOP_TaggedComponent'{tag=?TAG_CSI_SEC_MECH_LIST, - component_data=#'CSIIOP_CompoundSecMechList' - {stateful=Stateful, - mechanism_list = MechList}}|T], Data) -> - Comp = io_lib:format(" TAG_CSI_SEC_MECH_LIST~n" - "Stateful............: ~p~n" - "Mechanisms..........: ~p~n", [Stateful, MechList]), - print_components(T, [Comp | Data]); -print_components([#'IOP_TaggedComponent'{tag=?TAG_TLS_SEC_TRANS, - component_data=#'CSIIOP_TLS_SEC_TRANS' - {target_supports = TargetS, - target_requires = TargetR, - addresses = Addresses}}|T], Data) -> - Comp = io_lib:format(" TAG_TLS_SEC_TRANS~n" - "Target Supports.....: ~p~n" - "Target Requires.....: ~p~n" - "Addresses...........: ~p~n", - [TargetS, TargetR, Addresses]), - print_components(T, [Comp | Data]); -print_components([#'IOP_TaggedComponent'{tag=?TAG_SECIOP_SEC_TRANS, - component_data=#'CSIIOP_SECIOP_SEC_TRANS' - {target_supports = TargetS, - target_requires = TargetR, - mech_oid = MechOID, - target_name = TargetName, - addresses = Addresses}}|T], Data) -> - Comp = io_lib:format(" TAG_SECIOP_SEC_TRANS~n" - "Target Supports.....: ~p~n" - "Target Requires.....: ~p~n" - "Mechanism OID.......: ~p~n" - "Target Name.........: ~p~n" - "Addresses...........: ~p~n", - [TargetS, TargetR, MechOID, TargetName, Addresses]), - print_components(T, [Comp | Data]); -%% Unused components. -print_components([#'IOP_TaggedComponent'{tag=TAG, - component_data=CData}|T], Data) -> - Unused = io_lib:format("Unused Component....: ~s~n", [match_tag(TAG)]), - Octets = print_octets(CData, [], 1, []), - print_components(T, [lists:flatten([Unused | Octets])| Data]). - - -print_objkey(Objkey) when is_tuple(Objkey) -> - io_lib:format("Local Object........:~n~p~n", [Objkey]); -print_objkey(Objkey) -> - Hdr = io_lib:format("External Object.....: ~n", []), - Octets = print_octets(Objkey, [], 1, []), - lists:flatten([Hdr | Octets]). - -print_octets([], [], _, Data) -> - lists:reverse(Data); -print_octets([], Acc, C, Data) -> - Filling = lists:duplicate((4*(9-C)), 32), - FData = io_lib:format("~s", [Filling]), - Rest = io_lib:format(" ~p~n", [lists:reverse(Acc)]), - [lists:reverse(Data), FData | Rest]; -print_octets([H|T], Acc, 8, Data) when H > 31 , H < 127 -> - D1 = io_lib:format("~4w", [H]), - D2 = io_lib:format(" ~p~n", [lists:reverse([H|Acc])]), - print_octets(T, [], 1, [D2, D1 | Data]); -print_octets([H|T], Acc, 1, Data) when H > 31 , H < 127 -> - D1 = io_lib:format("~3w", [H]), - print_octets(T, [H|Acc], 2, [D1 | Data]); -print_octets([H|T], Acc, C, Data) when H > 31 , H < 127 -> - D1 = io_lib:format("~4w", [H]), - print_octets(T, [H|Acc], C+1, [D1 | Data]); -print_octets([H|T], Acc, 8, Data) -> - D1 = io_lib:format("~4w", [H]), - D2 = io_lib:format(" ~p~n", [lists:reverse([$.|Acc])]), - print_octets(T, [], 1, [D2, D1 | Data]); -print_octets([H|T], Acc, 1, Data) -> - D1 = io_lib:format("~3w", [H]), - print_octets(T, [$.|Acc], 2, [D1|Data]); -print_octets([H|T], Acc, C, Data) -> - D1 = io_lib:format("~4w", [H]), - print_octets(T, [$.|Acc], C+1, [D1|Data]). - -print_it(undefined, Data) -> - io:format(Data); -print_it(error_report, Data) -> - error_logger:error_report(Data); -print_it(info_msg, Data) -> - error_logger:info_msg(Data); -print_it(string, Data) -> - lists:flatten(Data); -print_it({error_report, Msg}, Data) -> - error_logger:error_report(io_lib:format("================== Reason =================~n~s~n~s", - [Msg, Data])); -print_it({info_msg, Msg}, Data) -> - error_logger:info_msg(io_lib:format("================== Comment ================~n~s~n~s", - [Msg, Data])); -print_it(IoDevice, Data) -> - io:format(IoDevice, Data, []). - -match_tag(?TAG_ORB_TYPE) -> ?TAG_ORB_TYPE_STR; -match_tag(?TAG_CODE_SETS) -> ?TAG_CODE_SETS_STR; -match_tag(?TAG_POLICIES) -> ?TAG_POLICIES_STR; -match_tag(?TAG_ALTERNATE_IIOP_ADDRESS) -> ?TAG_ALTERNATE_IIOP_ADDRESS_STR; -match_tag(?TAG_COMPLETE_OBJECT_KEY) -> ?TAG_COMPLETE_OBJECT_KEY_STR; -match_tag(?TAG_ENDPOINT_ID_POSITION) -> ?TAG_ENDPOINT_ID_POSITION_STR; -match_tag(?TAG_LOCATION_POLICY) -> ?TAG_LOCATION_POLICY_STR; -match_tag(?TAG_ASSOCIATION_OPTIONS) -> ?TAG_ASSOCIATION_OPTIONS_STR; -match_tag(?TAG_SEC_NAME) -> ?TAG_SEC_NAME_STR; -match_tag(?TAG_SPKM_1_SEC_MECH) -> ?TAG_SPKM_1_SEC_MECH_STR; -match_tag(?TAG_SPKM_2_SEC_MECH) -> ?TAG_SPKM_2_SEC_MECH_STR; -match_tag(?TAG_KerberosV5_SEC_MECH) -> ?TAG_KerberosV5_SEC_MECH_STR; -match_tag(?TAG_CSI_ECMA_Secret_SEC_MECH) -> ?TAG_CSI_ECMA_Secret_SEC_MECH_STR; -match_tag(?TAG_CSI_ECMA_Hybrid_SEC_MECH) -> ?TAG_CSI_ECMA_Hybrid_SEC_MECH_STR; -match_tag(?TAG_SSL_SEC_TRANS) -> ?TAG_SSL_SEC_TRANS_STR; -match_tag(?TAG_CSI_ECMA_Public_SEC_MECH) -> ?TAG_CSI_ECMA_Public_SEC_MECH_STR; -match_tag(?TAG_GENERIC_SEC_MECH) -> ?TAG_GENERIC_SEC_MECH_STR; -match_tag(?TAG_FIREWALL_TRANS) -> ?TAG_FIREWALL_TRANS_STR; -match_tag(?TAG_SCCP_CONTACT_INFO) -> ?TAG_SCCP_CONTACT_INFO_STR; -match_tag(?TAG_JAVA_CODEBASE) -> ?TAG_JAVA_CODEBASE_STR; -match_tag(?TAG_TRANSACTION_POLICY) -> ?TAG_TRANSACTION_POLICY_STR; -match_tag(?TAG_FT_GROUP) -> ?TAG_FT_GROUP_STR; -match_tag(?TAG_FT_PRIMARY) -> ?TAG_FT_PRIMARY_STR; -match_tag(?TAG_FT_HEARTBEAT_ENABLED) -> ?TAG_FT_HEARTBEAT_ENABLED_STR; -match_tag(?TAG_MESSAGE_ROUTERS) -> ?TAG_MESSAGE_ROUTERS_STR; -match_tag(?TAG_OTS_POLICY) -> ?TAG_OTS_POLICY_STR; -match_tag(?TAG_INV_POLICY) -> ?TAG_INV_POLICY_STR; -match_tag(?TAG_CSI_SEC_MECH_LIST) -> ?TAG_CSI_SEC_MECH_LIST_STR; -match_tag(?TAG_NULL_TAG) -> ?TAG_NULL_TAG_STR; -match_tag(?TAG_SECIOP_SEC_TRANS) -> ?TAG_SECIOP_SEC_TRANS_STR; -match_tag(?TAG_TLS_SEC_TRANS) -> ?TAG_TLS_SEC_TRANS_STR; -match_tag(?TAG_DCE_STRING_BINDING) -> ?TAG_DCE_STRING_BINDING_STR; -match_tag(?TAG_DCE_BINDING_NAME) -> ?TAG_DCE_BINDING_NAME_STR; -match_tag(?TAG_DCE_NO_PIPES) -> ?TAG_DCE_NO_PIPES_STR; -match_tag(?TAG_DCE_SEC_MECH) -> ?TAG_DCE_SEC_MECH_STR; -match_tag(?TAG_INET_SEC_TRANS) -> ?TAG_INET_SEC_TRANS_STR; -match_tag(Tag) -> integer_to_list(Tag). - -%%----------------------------------------------------------------- -%% Func: string_code/1 -%%----------------------------------------------------------------- -string_code(IOR) -> - Flags = orber:get_flags(), - case ?ORB_FLAG_TEST(Flags, ?ORB_ENV_ENABLE_NAT) of - false -> - string_code(IOR, Flags, orber:host(), - orber:iiop_port(), orber:iiop_ssl_port()); - true -> - string_code(IOR, Flags, orber:nat_host(), - orber:nat_iiop_port(), orber:nat_iiop_ssl_port()) - end. - -string_code(IOR, Host) -> - Flags = orber:get_flags(), - case ?ORB_FLAG_TEST(Flags, ?ORB_ENV_ENABLE_NAT) of - false -> - string_code(IOR, Flags, Host, - orber:iiop_port(), orber:iiop_ssl_port()); - true -> - string_code(IOR, Flags, Host, - orber:nat_iiop_port(), orber:nat_iiop_ssl_port()) - end. - -string_code(IOR, Host, Port) -> - Flags = orber:get_flags(), - case ?ORB_FLAG_TEST(Flags, ?ORB_ENV_ENABLE_NAT) of - false -> - string_code(IOR, Flags, Host, Port, orber:iiop_ssl_port()); - true -> - string_code(IOR, Flags, Host, Port, orber:nat_iiop_ssl_port()) - end. - -string_code(IOR, Host, Port, SSLPort) -> - string_code(IOR, orber:get_flags(), Host, Port, SSLPort). - -string_code(IOR, Flags, IP, Port, SSLPort) -> - Env = #giop_env{version = orber:giop_version(), - flags = Flags, host = IP, iiop_port = Port, - iiop_ssl_port = SSLPort, domain = orber:domain(), - partial_security = orber:partial_security()}, - {IorByteSeq0, Length0} = cdr_encode:enc_type('tk_octet', Env, 0, [], 0), - {IorByteSeq, _} = code(Env, IOR, IorByteSeq0, Length0), - IorByteSeq1 = binary_to_list(list_to_binary(lists:reverse(IorByteSeq))), - IorHexSeq = bytestring_to_hexstring(IorByteSeq1), - [$I,$O,$R,$: | IorHexSeq]. - -%%----------------------------------------------------------------- -%% Func: code/3 -%%----------------------------------------------------------------- -code(#giop_env{version = Version} = Env, #'IOP_IOR'{type_id=TypeId, profiles=Profiles}, Bytes, Len) -> - ProfileSeq =code_profile_datas(Version, Profiles), - %% Byte order - cdr_encode:enc_type(?IOR_TYPEDEF, - Env, - #'IOP_IOR'{type_id=TypeId, profiles=ProfileSeq}, - Bytes, Len); -%% No Local Interface supplied. Use configuration parameters. -code(#giop_env{version = Version, host = 0, flags = EnvFlags} = Env, - {Mod, Type, Key, UserDef, OrberDef, Flags}, Bytes, Len) -> - MC = case ?ORB_FLAG_TEST(EnvFlags, ?ORB_ENV_EXCLUDE_CODESET_COMPONENT) of - true -> - []; - false -> - [#'IOP_TaggedComponent'{tag=?TAG_CODE_SETS, - component_data=?DEFAULT_CODESETS}] - end, - IOR = case ?ORB_FLAG_TEST(EnvFlags, ?ORB_ENV_ENABLE_NAT) of - false -> - create(Version, Mod:typeID(), orber_env:host(), - orber_env:iiop_port(), orber_env:iiop_ssl_port(), - {Mod, Type, Key, UserDef, OrberDef, Flags}, - MC, Flags, EnvFlags); - true -> - create(Version, Mod:typeID(), orber_env:nat_host(), - orber_env:nat_iiop_port(), orber_env:nat_iiop_ssl_port(), - {Mod, Type, Key, UserDef, OrberDef, Flags}, - MC, Flags, EnvFlags) - - end, - code(Env, IOR, Bytes, Len); -code(#giop_env{version = Version, host = Host, iiop_port = IIOPort, - iiop_ssl_port = SSLPort, flags = EnvFlags} = Env, - {Mod, Type, Key, UserDef, OrberDef, Flags}, Bytes, Len) -> - MC = case ?ORB_FLAG_TEST(EnvFlags, ?ORB_ENV_EXCLUDE_CODESET_COMPONENT) of - true -> - []; - false -> - [#'IOP_TaggedComponent'{tag=?TAG_CODE_SETS, - component_data=?DEFAULT_CODESETS}] - end, - IOR = case ?ORB_FLAG_TEST(EnvFlags, ?ORB_ENV_ENABLE_NAT) of - false -> - create(Version, Mod:typeID(), Host, check_port(IIOPort, normal), - check_port(SSLPort, ssl), - {Mod, Type, Key, UserDef, OrberDef, Flags}, - MC, Flags, EnvFlags); - true -> - create(Version, Mod:typeID(), orber_env:nat_host(Host), - orber_env:nat_iiop_port(check_port(IIOPort, normal)), - orber_env:nat_iiop_ssl_port(check_port(SSLPort, ssl)), - {Mod, Type, Key, UserDef, OrberDef, Flags}, - MC, Flags, EnvFlags) - end, - code(Env, IOR, Bytes, Len). - -check_port(Port, _Type) when is_integer(Port) -> - Port; -check_port(_, normal) -> - orber:iiop_port(); -check_port(_, ssl) -> - orber:iiop_ssl_port(). - -code_profile_datas(_, []) -> - []; -code_profile_datas(Version, [#'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=P} | Profiles]) -> - NewBytes = list_to_binary(code_profile_data(Version, P)), - [#'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=NewBytes} | - code_profile_datas(Version, Profiles)]; -%% Multiple Components -code_profile_datas(Version, [#'IOP_TaggedProfile'{tag=?TAG_MULTIPLE_COMPONENTS, - profile_data=P} | Profiles]) -> - Comps= code_comp(Version, P, []), - {Bytes, Length} = cdr_encode:enc_type('tk_octet', Version, 0, [], 0), - {Bytes1, _Length1} = cdr_encode:enc_type(?IOP_TAGGEDCOMPONENT_SEQ, Version, Comps, Bytes, Length), - Profs = binary_to_list(list_to_binary(lists:reverse(Bytes1))), - [#'IOP_TaggedProfile'{tag=?TAG_MULTIPLE_COMPONENTS, - profile_data=Profs}| code_profile_datas(Version, Profiles)]; -code_profile_datas(Version, [#'IOP_TaggedProfile'{tag=N, profile_data=P} | Profiles]) -> - [#'IOP_TaggedProfile'{tag=N, profile_data=P} | code_profile_datas(Version, Profiles)]; -code_profile_datas(_, Data) -> - orber:dbg("[~p] iop_ior:code_profile_datas(~p); unsupported TaggedProfile.", - [?LINE, Data], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}). - -code_profile_data(Version, ProfileData) -> - [RecTag, V, H, P, O |Rest] = tuple_to_list(ProfileData), - {Bytes, Length} = cdr_encode:enc_type('tk_octet', Version, 0, [], 0), - {Bytes1, Length1} = cdr_encode:enc_type(?IIOP_VERSION, Version, V, Bytes, Length), - {Bytes2, Length2} = cdr_encode:enc_type({'tk_string', 0}, Version, - H, Bytes1, Length1), - {Bytes3, Length3} = cdr_encode:enc_type('tk_ushort', Version, P, Bytes2, Length2), - {Bytes4, Length4} = cdr_encode:enc_type({'tk_sequence', 'tk_octet', 0}, Version, - corba:objkey_to_string(O), Bytes3, Length3), - {Bytes5, _Length5} = code_profile_data_1(Version, RecTag, Rest, Bytes4, Length4), - Bytes6 = lists:reverse(Bytes5), - lists:flatten(Bytes6). - -code_profile_data_1(_Version, 'IIOP_ProfileBody_1_0', [], Bytes, Length) -> - {Bytes, Length}; -code_profile_data_1(Version, 'IIOP_ProfileBody_1_1', [TaggedComponentSeq], Bytes, Length) -> - Comps = code_comp(Version, TaggedComponentSeq, []), - cdr_encode:enc_type(?IOP_TAGGEDCOMPONENT_SEQ, Version, Comps, Bytes, Length); -code_profile_data_1(_,V,S,_,_) -> - orber:dbg("[~p] iop_ior:code_profile_datas(~p, ~p); probably unsupported IIOP-version", - [?LINE, V, S], ?DEBUG_LEVEL), - corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}). - -code_comp(_Version, [], CompData) -> - CompData; -code_comp(Version, [#'IOP_TaggedComponent'{tag=?TAG_CODE_SETS, - component_data=CodeSet}|Comps], CompData) -> - {Bytes0, Len0} = cdr_encode:enc_type('tk_octet', Version, 0, [], 0), - {Bytes1, _Len1} = cdr_encode:enc_type(?CONV_FRAME_CODESETCOMPONENTINFO, Version, - CodeSet, Bytes0, Len0), - Bytes = binary_to_list(list_to_binary(lists:reverse(Bytes1))), - code_comp(Version, Comps, [#'IOP_TaggedComponent'{tag=?TAG_CODE_SETS, - component_data=Bytes}|CompData]); -code_comp(Version, [#'IOP_TaggedComponent'{tag=?TAG_ORB_TYPE, - component_data=ORBType}|Comps], CompData) -> - {Bytes0, Len0} = cdr_encode:enc_type('tk_octet', Version, 0, [], 0), - {Bytes1, _Len1} = cdr_encode:enc_type(?ORB_TYPE, Version, - ORBType, Bytes0, Len0), - Bytes = binary_to_list(list_to_binary(lists:reverse(Bytes1))), - code_comp(Version, Comps, [#'IOP_TaggedComponent'{tag=?TAG_ORB_TYPE, - component_data=Bytes}|CompData]); -code_comp(Version, [#'IOP_TaggedComponent'{tag=?TAG_ALTERNATE_IIOP_ADDRESS, - component_data=AltAddr}|Comps], CompData) -> - {Bytes0, Len0} = cdr_encode:enc_type('tk_octet', Version, 0, [], 0), - {Bytes1, _Len1} = cdr_encode:enc_type(?ALTERNATE_IIOP_ADDRESS, Version, - AltAddr, Bytes0, Len0), - Bytes = binary_to_list(list_to_binary(lists:reverse(Bytes1))), - code_comp(Version, Comps, [#'IOP_TaggedComponent'{tag=?TAG_ALTERNATE_IIOP_ADDRESS, - component_data=Bytes}|CompData]); -code_comp(Version, [#'IOP_TaggedComponent'{tag=?TAG_SSL_SEC_TRANS, - component_data=SSLStruct}|Comps], CompData) -> - {Bytes0, Len0} = cdr_encode:enc_type('tk_octet', Version, 0, [], 0), - {Bytes1, _Len1} = cdr_encode:enc_type(?SSLIOP_SSL, Version, - SSLStruct, Bytes0, Len0), - Bytes = binary_to_list(list_to_binary(lists:reverse(Bytes1))), - code_comp(Version, Comps, [#'IOP_TaggedComponent'{tag=?TAG_SSL_SEC_TRANS, - component_data=Bytes}|CompData]); -%% Fault Tolerant Components -code_comp(Version, [#'IOP_TaggedComponent'{tag=?TAG_FT_GROUP, - component_data=Data}|Comps], CompData) -> - {Bytes0, Len0} = cdr_encode:enc_type('tk_octet', Version, 0, [], 0), - {Bytes1, _Len1} = cdr_encode:enc_type(?FT_TagFTGroupTaggedComponent, Version, - Data, Bytes0, Len0), - Bytes = binary_to_list(list_to_binary(lists:reverse(Bytes1))), - code_comp(Version, Comps, [#'IOP_TaggedComponent'{tag=?TAG_FT_GROUP, - component_data=Bytes}|CompData]); -code_comp(Version, [#'IOP_TaggedComponent'{tag=?TAG_FT_PRIMARY, - component_data=Data}|Comps], CompData) -> - {Bytes0, Len0} = cdr_encode:enc_type('tk_octet', Version, 0, [], 0), - {Bytes1, _Len1} = cdr_encode:enc_type(?FT_TagFTPrimaryTaggedComponent, Version, - Data, Bytes0, Len0), - Bytes = binary_to_list(list_to_binary(lists:reverse(Bytes1))), - code_comp(Version, Comps, [#'IOP_TaggedComponent'{tag=?TAG_FT_PRIMARY, - component_data=Bytes}|CompData]); -code_comp(Version, [#'IOP_TaggedComponent'{tag=?TAG_FT_HEARTBEAT_ENABLED, - component_data=Data}|Comps], CompData) -> - {Bytes0, Len0} = cdr_encode:enc_type('tk_octet', Version, 0, [], 0), - {Bytes1, _Len1} = cdr_encode:enc_type(?FT_TagFTHeartbeatEnabledTaggedComponent, Version, - Data, Bytes0, Len0), - Bytes = binary_to_list(list_to_binary(lists:reverse(Bytes1))), - code_comp(Version, Comps, [#'IOP_TaggedComponent'{tag=?TAG_FT_HEARTBEAT_ENABLED, - component_data=Bytes}|CompData]); -%% Security - CSIIOP -code_comp(Version, [#'IOP_TaggedComponent'{tag=?TAG_CSI_SEC_MECH_LIST, - component_data=Data}|Comps], CompData) -> - NewData = Data#'CSIIOP_CompoundSecMechList' - {mechanism_list = code_sec_mech(Version, - Data#'CSIIOP_CompoundSecMechList'.mechanism_list, - [])}, - {Bytes0, Len0} = cdr_encode:enc_type('tk_octet', Version, 0, [], 0), - {Bytes1, _Len1} = cdr_encode:enc_type(?CSIIOP_CompoundSecMechList, Version, - NewData, Bytes0, Len0), - Bytes = binary_to_list(list_to_binary(lists:reverse(Bytes1))), - code_comp(Version, Comps, [#'IOP_TaggedComponent'{tag=?TAG_CSI_SEC_MECH_LIST, - component_data=Bytes}|CompData]); -code_comp(Version, [#'IOP_TaggedComponent'{tag=?TAG_TLS_SEC_TRANS, - component_data=Data}|Comps], - CompData) -> - {Bytes0, Len0} = cdr_encode:enc_type('tk_octet', Version, 0, [], 0), - {Bytes1, _Len1} = cdr_encode:enc_type(?CSIIOP_TLS_SEC_TRANS, Version, - Data, Bytes0, Len0), - Bytes = binary_to_list(list_to_binary(lists:reverse(Bytes1))), - code_comp(Version, Comps, [#'IOP_TaggedComponent'{tag=?TAG_TLS_SEC_TRANS, - component_data=Bytes}|CompData]); -code_comp(Version, [#'IOP_TaggedComponent'{tag=?TAG_SECIOP_SEC_TRANS, - component_data=Data}|Comps], CompData) -> - {Bytes0, Len0} = cdr_encode:enc_type('tk_octet', Version, 0, [], 0), - {Bytes1, _Len1} = cdr_encode:enc_type(?CSIIOP_SECIOP_SEC_TRANS, Version, - Data, Bytes0, Len0), - Bytes = binary_to_list(list_to_binary(lists:reverse(Bytes1))), - code_comp(Version, Comps, [#'IOP_TaggedComponent'{tag=?TAG_SECIOP_SEC_TRANS, - component_data=Bytes}|CompData]); -code_comp(Version, [#'IOP_TaggedComponent'{tag=?TAG_NULL_TAG}|Comps], CompData) -> - %% The body of the TAG_NULL_TAG component is a sequence of octets of - %% length 0. - {Bytes0, Len0} = cdr_encode:enc_type('tk_octet', Version, 0, [], 0), - {Bytes1, _Len1} = cdr_encode:enc_type({'tk_sequence', 'tk_octet', 0}, Version, - [], Bytes0, Len0), - Bytes = binary_to_list(list_to_binary(lists:reverse(Bytes1))), - code_comp(Version, Comps, [#'IOP_TaggedComponent'{tag=?TAG_NULL_TAG, - component_data=Bytes}|CompData]); -%% Unsupported/not used component. -code_comp(Version, [C|Comps], CompData) -> - code_comp(Version, Comps, [C|CompData]). - - -code_sec_mech(_, [], Acc) -> - %% We must preserver the order!! - lists:reverse(Acc); -code_sec_mech(Version, [#'CSIIOP_CompoundSecMech'{transport_mech = TagComp} = CSM|T], - Acc) -> - [EncTagComp] = code_comp(Version, [TagComp], []), - code_sec_mech(Version, T, [CSM#'CSIIOP_CompoundSecMech' - {transport_mech = EncTagComp}|Acc]). - - -%%----------------------------------------------------------------- -%% Func: string_decode/1 -%%----------------------------------------------------------------- -string_decode([$I,$O,$R,$: | IorHexSeq]) -> - Version = orber:giop_version(), - IorByteSeq = list_to_binary(hexstring_to_bytestring(IorHexSeq)), - {ByteOrder, IorRest} = cdr_decode:dec_byte_order(IorByteSeq), - decode(Version, IorRest, 1, ByteOrder); -string_decode([$i,$o,$r,$: | IorHexSeq]) -> - Version = orber:giop_version(), - IorByteSeq = list_to_binary(hexstring_to_bytestring(IorHexSeq)), - {ByteOrder, IorRest} = cdr_decode:dec_byte_order(IorByteSeq), - decode(Version, IorRest, 1, ByteOrder); -string_decode(What) -> - orber:dbg("[~p] iop_ior:string_decode(~p); Should be IOR:.. or ior:..", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------------- -%% Func: decode/3 -%%----------------------------------------------------------------- -decode(Version, IorByteSeq, Len, ByteOrder) -> - {#'IOP_IOR'{type_id=TypeId, profiles=Profiles}, Rest, Length} = - cdr_decode:dec_type(?IOR_TYPEDEF, Version, IorByteSeq, Len, ByteOrder), - L = decode_profiles(Version, Profiles), - {#'IOP_IOR'{type_id=TypeId, profiles=L}, Rest, Length}. - -decode_profiles(_, []) -> - []; -decode_profiles(Version, [P | Profiles]) -> - Struct = decode_profile(Version, P), - L = decode_profiles(Version, Profiles), - [Struct | L]. - -decode_profile(Version, #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=ProfileData}) -> - {ByteOrder, Rest} = cdr_decode:dec_byte_order(list_to_binary(ProfileData)), - Length = 1, - {V, Rest1, Length1} = cdr_decode:dec_type(?IIOP_VERSION, Version, Rest, Length, - ByteOrder), - {H, Rest2, Length2} = cdr_decode:dec_type({'tk_string', 0}, Version, Rest1, Length1, - ByteOrder), - {P, Rest3, Length3} = cdr_decode:dec_type('tk_ushort', Version, Rest2, Length2, - ByteOrder), - {ObjKey, Rest4, Length4} = cdr_decode:dec_type({'tk_sequence', 'tk_octet', 0}, - Version, Rest3, Length3, - ByteOrder), - Struct = decode_profile_1(V, H, P, ObjKey, Version, Rest4, Length4, ByteOrder), - #'IOP_TaggedProfile'{tag=?TAG_INTERNET_IOP, profile_data=Struct}; -%% Multiple Components -decode_profile(Version, #'IOP_TaggedProfile'{tag=?TAG_MULTIPLE_COMPONENTS, - profile_data=ProfileData}) -> - {ByteOrder, Rest} = cdr_decode:dec_byte_order(list_to_binary(ProfileData)), - {Components, <<>>, _Length1} =cdr_decode:dec_type(?IOP_TAGGEDCOMPONENT_SEQ, Version, Rest, 1, ByteOrder), - CompData = decode_comp(Version, Components, []), - #'IOP_TaggedProfile'{tag=?TAG_MULTIPLE_COMPONENTS, profile_data=CompData}; -decode_profile(_, #'IOP_TaggedProfile'{tag=N, profile_data=ProfileData}) -> - #'IOP_TaggedProfile'{tag=N, profile_data=ProfileData}; -decode_profile(_, Data) -> - orber:dbg("[~p] iop_ior:decode_profile(~p); unsupported TaggedProfile.", - [?LINE, Data], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}). - -decode_profile_1(#'IIOP_Version'{major=1, minor=0}, H, P, ObjKey, _Version, _Rest, _Length, _ByteOrder) -> - #'IIOP_ProfileBody_1_0'{iiop_version=#'IIOP_Version'{major=1, - minor=0}, - host=H, port=P, - object_key=corba:string_to_objkey(ObjKey)}; -decode_profile_1(#'IIOP_Version'{major=1, minor=1}, H, P, ObjKey, Version, Rest, Length, ByteOrder) -> - {Components, <<>>, _Length1} =cdr_decode:dec_type(?IOP_TAGGEDCOMPONENT_SEQ, Version, Rest, Length, ByteOrder), - CompData = decode_comp(Version, Components, []), - #'IIOP_ProfileBody_1_1'{iiop_version=#'IIOP_Version'{major=1, - minor=1}, - host=H, port=P, - object_key=corba:string_to_objkey(ObjKey), - components=CompData}; -decode_profile_1(#'IIOP_Version'{major=1, minor=2}, H, P, ObjKey, Version, Rest, Length, ByteOrder) -> - {Components, <<>>, _Length1} =cdr_decode:dec_type(?IOP_TAGGEDCOMPONENT_SEQ, Version, Rest, Length, ByteOrder), - CompData = decode_comp(Version, Components, []), - #'IIOP_ProfileBody_1_1'{iiop_version=#'IIOP_Version'{major=1, - minor=2}, - host=H, port=P, - object_key=corba:string_to_objkey(ObjKey), - components=CompData}; -decode_profile_1(V, _, _, _, _, _, _,_) -> - orber:dbg("[~p] iop_ior:decode_profile_1(~p); probably unsupported IIOP-version.", - [?LINE, V], ?DEBUG_LEVEL), - corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}). - -decode_comp(_Version, [], Components) -> - Components; -decode_comp(Version, [#'IOP_TaggedComponent'{tag=?TAG_CODE_SETS, - component_data=Bytes}|Comps], - Components) -> - {ByteOrder, Rest} = cdr_decode:dec_byte_order(list_to_binary(Bytes)), - {CodeSet, _, _} = cdr_decode:dec_type(?CONV_FRAME_CODESETCOMPONENTINFO, - Version, Rest, 1, ByteOrder), - decode_comp(Version, Comps, - [#'IOP_TaggedComponent'{tag=?TAG_CODE_SETS, - component_data=CodeSet}|Components]); -decode_comp(Version, [#'IOP_TaggedComponent'{tag=?TAG_ORB_TYPE, - component_data=Bytes}|Comps], - Components) -> - {ByteOrder, Rest} = cdr_decode:dec_byte_order(list_to_binary(Bytes)), - {ORBType, _, _} = cdr_decode:dec_type(?ORB_TYPE, - Version, Rest, 1, ByteOrder), - decode_comp(Version, Comps, - [#'IOP_TaggedComponent'{tag=?TAG_ORB_TYPE, - component_data=ORBType}|Components]); -decode_comp(Version, [#'IOP_TaggedComponent'{tag=?TAG_ALTERNATE_IIOP_ADDRESS, - component_data=Bytes}|Comps], - Components) -> - {ByteOrder, Rest} = cdr_decode:dec_byte_order(list_to_binary(Bytes)), - {AltIIOP, _, _} = cdr_decode:dec_type(?ALTERNATE_IIOP_ADDRESS, - Version, Rest, 1, ByteOrder), - decode_comp(Version, Comps, - [#'IOP_TaggedComponent'{tag=?TAG_ALTERNATE_IIOP_ADDRESS, - component_data=AltIIOP}|Components]); -decode_comp(Version, [#'IOP_TaggedComponent'{tag=?TAG_SSL_SEC_TRANS, - component_data=Data}|Comps], Components) -> - {ByteOrder, R} = cdr_decode:dec_byte_order(list_to_binary(Data)), - {SSLStruct, _Rest1, _Length1} = cdr_decode:dec_type(?SSLIOP_SSL, Version, R, 1, - ByteOrder), - decode_comp(Version, Comps, - [#'IOP_TaggedComponent'{tag=?TAG_SSL_SEC_TRANS, - component_data=SSLStruct}|Components]); -%% Fault Tolerant Components -decode_comp(Version, [#'IOP_TaggedComponent'{tag=?TAG_FT_GROUP, - component_data=Data}|Comps], Components) -> - {ByteOrder, R} = cdr_decode:dec_byte_order(list_to_binary(Data)), - {DecodedData, _Rest1, _Length1} = cdr_decode:dec_type(?FT_TagFTGroupTaggedComponent, Version, R, 1, - ByteOrder), - decode_comp(Version, Comps, - [#'IOP_TaggedComponent'{tag=?TAG_FT_GROUP, - component_data=DecodedData}|Components]); -decode_comp(Version, [#'IOP_TaggedComponent'{tag=?TAG_FT_PRIMARY, - component_data=Data}|Comps], Components) -> - {ByteOrder, R} = cdr_decode:dec_byte_order(list_to_binary(Data)), - {DecodedData, _Rest1, _Length1} = cdr_decode:dec_type(?FT_TagFTPrimaryTaggedComponent, Version, R, 1, - ByteOrder), - decode_comp(Version, Comps, - [#'IOP_TaggedComponent'{tag=?TAG_FT_PRIMARY, - component_data=DecodedData}|Components]); -decode_comp(Version, [#'IOP_TaggedComponent'{tag=?TAG_FT_HEARTBEAT_ENABLED, - component_data=Data}|Comps], Components) -> - {ByteOrder, R} = cdr_decode:dec_byte_order(list_to_binary(Data)), - {DecodedData, _Rest1, _Length1} = cdr_decode:dec_type(?FT_TagFTHeartbeatEnabledTaggedComponent, Version, R, 1, - ByteOrder), - decode_comp(Version, Comps, - [#'IOP_TaggedComponent'{tag=?TAG_FT_HEARTBEAT_ENABLED, - component_data=DecodedData}|Components]); -%% Security - CSIIOP -decode_comp(Version, [#'IOP_TaggedComponent'{tag=?TAG_CSI_SEC_MECH_LIST, - component_data=Data}|Comps], Components) -> - {ByteOrder, R} = cdr_decode:dec_byte_order(list_to_binary(Data)), - {DecodedData, _Rest1, _Length1} = cdr_decode:dec_type(?CSIIOP_CompoundSecMechList, Version, R, 1, - ByteOrder), - NewDecodedData = DecodedData#'CSIIOP_CompoundSecMechList' - {mechanism_list = decode_sec_mech(Version, - DecodedData#'CSIIOP_CompoundSecMechList'.mechanism_list, - [])}, - decode_comp(Version, Comps, - [#'IOP_TaggedComponent'{tag=?TAG_CSI_SEC_MECH_LIST, - component_data=NewDecodedData}|Components]); -decode_comp(Version, [#'IOP_TaggedComponent'{tag=?TAG_TLS_SEC_TRANS, - component_data=Data}|Comps], Components) -> - {ByteOrder, R} = cdr_decode:dec_byte_order(list_to_binary(Data)), - {DecodedData, _Rest1, _Length1} = cdr_decode:dec_type(?CSIIOP_TLS_SEC_TRANS, Version, R, 1, - ByteOrder), - decode_comp(Version, Comps, - [#'IOP_TaggedComponent'{tag=?TAG_TLS_SEC_TRANS, - component_data=DecodedData}|Components]); -decode_comp(Version, [#'IOP_TaggedComponent'{tag=?TAG_SECIOP_SEC_TRANS, - component_data=Data}|Comps], Components) -> - {ByteOrder, R} = cdr_decode:dec_byte_order(list_to_binary(Data)), - {DecodedData, _Rest1, _Length1} = cdr_decode:dec_type(?CSIIOP_SECIOP_SEC_TRANS, Version, R, 1, - ByteOrder), - decode_comp(Version, Comps, - [#'IOP_TaggedComponent'{tag=?TAG_SECIOP_SEC_TRANS, - component_data=DecodedData}|Components]); -decode_comp(Version, [#'IOP_TaggedComponent'{tag=?TAG_NULL_TAG, - component_data=_Data}|Comps], Components) -> - %% The body of the TAG_NULL_TAG component is a sequence of octets of - %% length 0. - decode_comp(Version, Comps, - [#'IOP_TaggedComponent'{tag=?TAG_NULL_TAG, - component_data=[]}|Components]); - -decode_comp(Version, [C|Comps], Components) -> - %% Not used but we cannot discard it. - decode_comp(Version, Comps, [C|Components]). - - -decode_sec_mech(_Version, [], Acc) -> - %% We must preserver the order!! - lists:reverse(Acc); -decode_sec_mech(Version, [#'CSIIOP_CompoundSecMech'{transport_mech = TagComp} = CSM|T], - Acc) -> - [DecTagComp] = decode_comp(Version, [TagComp], []), - decode_sec_mech(Version, T, [CSM#'CSIIOP_CompoundSecMech' - {transport_mech = DecTagComp}|Acc]). - - -%%----------------------------------------------------------------- -%% Func: hexstring_to_bytestring/1 -%%----------------------------------------------------------------- -hexstring_to_bytestring(HexString) -> - ByteString = hexstring_to_bytestring(HexString, []), - lists:reverse(ByteString). - -hexstring_to_bytestring([], Acc) -> - Acc; -hexstring_to_bytestring([H1, H2 |Rest], Acc) -> - I1 = hex_to_int(H1), - I2 = hex_to_int(H2), - I = I1 * 16 + I2, - Acc2 = cdrlib:enc_octet(I, Acc), - hexstring_to_bytestring(Rest, Acc2). - - -hex_to_int(H) when H >= $a -> - 10 + H - $a; -hex_to_int(H) when H >= $A -> - 10 + H -$A; -hex_to_int(H) -> - H - $0. -%%----------------------------------------------------------------- -%% Func: bytestring_to_hexstring/1 -%% Args: A byte string -%% Returns: A list of hexadecimal digits (onebyte will be represented as -%% two hexadecimal digits). -%%----------------------------------------------------------------- -bytestring_to_hexstring(ByteString) -> - HexString = bytestring_to_hexstring(ByteString, []), - lists:reverse(HexString). - -bytestring_to_hexstring([], Acc) -> - Acc; -bytestring_to_hexstring([B |Rest], Acc) -> - [C1, C2] = int_to_hex(B), - bytestring_to_hexstring(Rest,[C2, C1| Acc]). - -int_to_hex(B) when B < 256, B >= 0 -> - N1 = B div 16, - N2 = B rem 16, - [code_character(N1), - code_character(N2)]. - -code_character(N) when N < 10 -> - $0 + N; -code_character(N) -> - $a + (N - 10). - diff --git a/lib/orber/src/orber.app.src b/lib/orber/src/orber.app.src deleted file mode 100644 index 217c1b247f..0000000000 --- a/lib/orber/src/orber.app.src +++ /dev/null @@ -1,111 +0,0 @@ -{application, orber, - [{description, "The Erlang ORB application"}, - {vsn, "%VSN%"}, - {modules, - [ - 'CosNaming_Binding', - 'CosNaming_BindingIterator', - 'CosNaming_BindingList', - 'CosNaming_BindingIterator_impl', - 'CosNaming_Name', - 'CosNaming_NameComponent', - 'CosNaming_NamingContext', - 'CosNaming_NamingContext_AlreadyBound', - 'CosNaming_NamingContext_CannotProceed', - 'CosNaming_NamingContext_InvalidName', - 'CosNaming_NamingContext_NotEmpty', - 'CosNaming_NamingContext_NotFound', - 'CosNaming_NamingContextExt', - 'CosNaming_NamingContextExt_impl', - 'CosNaming_NamingContextExt_InvalidAddress', - 'OrberApp_IFR', - 'OrberApp_IFR_impl', - 'oe_OrberIFR', - 'any', - 'cdr_decode', - 'cdr_encode', - 'cdrlib', - 'corba', - 'corba_boa', - 'corba_object', - 'erlang_pid', - 'erlang_port', - 'erlang_ref', - 'erlang_binary', - 'iop_ior', - 'lname', - 'lname_component', - 'oe_CORBA', - 'oe_cos_naming', - 'oe_cos_naming_ext', - 'oe_erlang', - 'orber', - 'orber_cosnaming_utils', - 'orber_ifr', - 'orber_ifr_aliasdef', - 'orber_ifr_arraydef', - 'orber_ifr_attributedef', - 'orber_ifr_constantdef', - 'orber_ifr_contained', - 'orber_ifr_container', - 'orber_ifr_enumdef', - 'orber_ifr_exceptiondef', - 'orber_ifr_idltype', - 'orber_ifr_interfacedef', - 'orber_ifr_irobject', - 'orber_ifr_moduledef', - 'orber_ifr_operationdef', - 'orber_ifr_orb', - 'orber_ifr_primitivedef', - 'orber_ifr_repository', - 'orber_ifr_sequencedef', - 'orber_ifr_stringdef', - 'orber_ifr_wstringdef', - 'orber_ifr_structdef', - 'orber_ifr_typecode', - 'orber_ifr_typedef', - 'orber_ifr_uniondef', - 'orber_ifr_fixeddef', - 'orber_ifr_utils', - 'orber_iiop', - 'orber_iiop_inproxy', - 'orber_iiop_inrequest', - 'orber_iiop_insup', - 'orber_iiop_net', - 'orber_iiop_net_accept', - 'orber_iiop_outproxy', - 'orber_iiop_outsup', - 'orber_iiop_pm', - 'orber_iiop_socketsup', - 'orber_initial_references', - 'orber_pi', - 'orber_objectkeys', - 'orber_request_number', - 'orber_socket', - 'orber_tc', - 'orber_typedefs', - 'orber_web', - 'orber_web_server', - 'orber_iiop_tracer', - 'orber_iiop_tracer_silent', - 'orber_iiop_tracer_stealth', - 'fixed', - 'orber_exceptions', - 'orber_diagnostics', - 'orber_acl', - 'orber_tb', - 'orber_env' - ] - }, - {registered, [orber_sup, orber_iiop_sup, orber_iiop_net, orber_iiop_outsup, - orber_iiop_insup, orber_init, orber_reqno, - orber_objkeyserver, orber_iiop_socketsup, - orber_iiop_pm, orber_env]}, - {applications, [stdlib, kernel, mnesia]}, - {env, []}, - {mod, {orber, []}}, - {runtime_dependencies, ["stdlib-2.5","ssl-5.3.4","mnesia-4.12","kernel-3.0", - "inets-5.10","erts-7.0"]} -]}. - - diff --git a/lib/orber/src/orber.appup.src b/lib/orber/src/orber.appup.src deleted file mode 100644 index 6c3b2833b7..0000000000 --- a/lib/orber/src/orber.appup.src +++ /dev/null @@ -1,7 +0,0 @@ -{"%VSN%", - [ - ], - [ - ] -}. - diff --git a/lib/orber/src/orber.erl b/lib/orber/src/orber.erl deleted file mode 100644 index f5e2429f5d..0000000000 --- a/lib/orber/src/orber.erl +++ /dev/null @@ -1,1238 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: orber.erl -%% -%% Description: -%% This file contains the Orber application interface -%% -%%----------------------------------------------------------------- --module(orber). - --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). --include_lib("orber/src/ifr_objects.hrl"). -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([start/0, start/1, stop/0, install/1, install/2, orber_nodes/0, iiop_port/0, - domain/0, iiop_ssl_port/0, iiop_out_ports/0, iiop_out_ports_random/0, - iiop_out_ports_attempts/0, - ssl_server_options/0, ssl_client_options/0, set_ssl_client_options/1, - ssl_server_certfile/0, ssl_client_certfile/0, set_ssl_client_certfile/1, - ssl_server_verify/0, ssl_client_verify/0, set_ssl_client_verify/1, - ssl_server_depth/0, ssl_client_depth/0, set_ssl_client_depth/1, - ssl_server_cacertfile/0,ssl_client_cacertfile/0, set_ssl_client_cacertfile/1, - ssl_client_keyfile/0, ssl_client_password/0, ssl_server_keyfile/0, ssl_server_password/0, - ssl_client_ciphers/0, ssl_server_ciphers/0, ssl_client_cachetimeout/0, ssl_server_cachetimeout/0, - uninstall/0, giop_version/0, info/0, info/1, is_running/0, add_node/2, - remove_node/1, iiop_timeout/0, iiop_connection_timeout/0, - iiop_setup_connection_timeout/0, objectkeys_gc_time/0, - is_lightweight/0, get_lightweight_nodes/0, - start_lightweight/0, start_lightweight/1, - get_ORBDefaultInitRef/0, get_ORBInitRef/0, - get_interceptors/0, get_local_interceptors/0, - get_cached_interceptors/0, set_interceptors/1, - jump_start/0, jump_start/1, jump_stop/0, - iiop_connections/0, iiop_connections/1, iiop_connections_pending/0, - typechecking/0, - exclude_codeset_ctx/0, exclude_codeset_component/0, bidir_context/0, use_FT/0, - use_CSIv2/0, get_flags/0, secure/0, multi_jump_start/1, multi_jump_start/2, - multi_jump_start/3, get_tables/0, iiop_in_connection_timeout/0, - partial_security/0, nat_iiop_ssl_port/0, nat_iiop_port/0, ip_version/0, - light_ifr/0, iiop_max_in_requests/0, iiop_max_in_connections/0, - iiop_max_fragments/0, iiop_backlog/0, iiop_ssl_backlog/0, - find_sockname_by_peername/2, find_peername_by_sockname/2, iiop_acl/0, - add_listen_interface/2, add_listen_interface/3, remove_listen_interface/1, - reconfigure_out_connections/1, - reconfigure_out_connection/3, reconfigure_out_connection/4, - reconfigure_in_connections/1, reconfigure_in_connection/2, - activate_audit_trail/0, activate_audit_trail/1, deactivate_audit_trail/0, - iiop_ssl_ip_address_local/0, ip_address_local/0, - close_connection/1, close_connection/2, is_system_exception/1, - exception_info/1]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([nat_host/0, host/0, ip_address_variable_defined/0, start/2, init/1, - get_debug_level/0, debug_level_print/3, dbg/3, error/3, - configure/2, configure_override/2, multi_configure/1, - mjs/1, mjs/2, js/0, js/1]). - -%%----------------------------------------------------------------- -%% Internal definitions -%%----------------------------------------------------------------- -%% Defines possible configuration parameters a user can add when, -%% for example, installing Orber. --record(options, {ifr_storage_type = disc_copies, - install_timeout = infinity, - local_content = false, - nameservice_storage_type = ram_copies, - initialreferences_storage_type = ram_copies, - type = temporary, - load_order = 0}). - --define(ORBER_TABS, [orber_CosNaming, orber_objkeys, orber_references]). - --define(DEBUG_LEVEL, 5). - --define(FORMAT(_F, _A), lists:flatten(io_lib:format(_F, _A))). --define(EFORMAT(_F, _A), exit(lists:flatten(io_lib:format(_F, _A)))). - - -%%----------------------------------------------------------------- -%% External interface functions -%%----------------------------------------------------------------- - -jump_stop() -> - stop(), - uninstall(), - mnesia:stop(). - -js() -> - application:load(orber), - jump_start([{iiop_port, iiop_port()}, - {interceptors, {native, [orber_iiop_tracer_silent]}}, - {orber_debug_level, 10}, - {flags, (?ORB_ENV_LOCAL_TYPECHECKING bor get_flags())}]). - -js(Port) when is_integer(Port) -> - application:load(orber), - jump_start([{iiop_port, Port}, - {interceptors, {native, [orber_iiop_tracer_silent]}}, - {orber_debug_level, 10}, - {flags, (?ORB_ENV_LOCAL_TYPECHECKING bor get_flags())}]). - -jump_start() -> - application:load(orber), - jump_start([{iiop_port, iiop_port()}]). - - -jump_start(Port) when is_integer(Port) -> - application:load(orber), - jump_start([{iiop_port, Port}]); -jump_start(Options) when is_list(Options) -> - application:load(orber), - mnesia:start(), - Port = case lists:keysearch(iiop_port, 1, Options) of - {value, {iiop_port, Value}} -> - Value; - _ -> - iiop_port() - end, - corba:orb_init([{iiop_port, Port}|Options]), - install([node()], [{ifr_storage_type, ram_copies}]), - start(), - %% We need to use this operation if Port == 0 to see what the OS - %% assigned. - NewPort = orber_env:iiop_port(), - Domain = orber_env:ip_address() ++ [$:|integer_to_list(NewPort)], - orber_env:configure_override(domain, Domain), - info(); -jump_start(Options) -> - exit({error, Options}). - - -mjs(Nodes) -> - application:load(orber), - multi_js_helper(Nodes, iiop_port(), - [{interceptors, {native, [orber_iiop_tracer_silent]}}, - {orber_debug_level, 10}, - {flags, (?ORB_ENV_LOCAL_TYPECHECKING bor get_flags())}]). - -mjs(Nodes, Port) -> - application:load(orber), - multi_js_helper(Nodes, Port, - [{interceptors, {native, [orber_iiop_tracer_silent]}}, - {orber_debug_level, 10}, - {flags, (?ORB_ENV_LOCAL_TYPECHECKING bor get_flags())}]). - - -multi_jump_start(Nodes) -> - application:load(orber), - multi_js_helper(Nodes, iiop_port(), []). - -multi_jump_start(Nodes, Port) -> - multi_js_helper(Nodes, Port, []). - -multi_jump_start(Nodes, Port, Options) -> - multi_js_helper(Nodes, Port, Options). - -multi_js_helper(Nodes, Port, InitOptions) when is_list(Nodes) andalso - is_integer(Port) andalso - is_list(InitOptions) -> - %% We MUST delete the option iiop_port. - Options = lists:keydelete(iiop_port, 1, InitOptions), - case node() of - nonode@nohost -> - {error, "The distribution is not started"}; - _ -> - mnesia:start(), - corba:orb_init([{iiop_port, Port}|Options]), - install([node()], [{ifr_storage_type, ram_copies}]), - start(), - NewPort = orber_env:iiop_port(), - Domain = orber_env:ip_address() ++ [$:|integer_to_list(NewPort)], - orber_env:configure_override(domain, Domain), - case jump_start_slaves(Nodes, NewPort, - [{domain, Domain}|Options], [], []) of - {ok, NodeData} -> - info(), - {ok, [{node(), NewPort}|NodeData]}; - Other -> - Other - end - end. - -jump_start_slaves([], _, _, [], NodeData) -> - rpc:multicall([node() | nodes()], global, sync, []), - {ok, NodeData}; -jump_start_slaves([], _, _, Errors, _) -> - {error, Errors}; -jump_start_slaves([{Host, N}|T], Port, Options, Errors, NodeData) -> - case create_nodes(Host, N, Port, Options, Errors, NodeData) of - {ok, NewNodeData} -> - jump_start_slaves(T, Port, Options, Errors, NewNodeData); - {error, NewErrors} -> - jump_start_slaves(T, Port, Options, NewErrors, NodeData) - end; -jump_start_slaves([Host|T], Port, Options, Errors, NodeData) -> - case catch create_node(Host, Port+1, Options) of - {ok, NewNode} -> - jump_start_slaves(T, Port, Options, Errors, [{NewNode, Port+1}|NodeData]); - {error, Reason} -> - jump_start_slaves(T, Port, Options, [{Host, Port, Reason}|Errors], - NodeData); - Other -> - jump_start_slaves(T, Port, Options, [{Host, Port, Other}|Errors], - NodeData) - end. - -create_nodes(_, 0, _, _, [], NodeData) -> - {ok, NodeData}; -create_nodes(_, 0, _, _, Errors, _) -> - {error, Errors}; -create_nodes(Host, N, Port, Options, Errors, NodeData) -> - case catch create_node(Host, Port+N, Options) of - {ok, NewNode} -> - create_nodes(Host, N-1, Port, Options, Errors, - [{NewNode, Port+N}|NodeData]); - {error, Reason} -> - create_nodes(Host, N-1, Port, Options, - [{Host, Port+N, Reason}|Errors], NodeData); - Other -> - create_nodes(Host, N-1, Port, Options, - [{Host, Port+N, Other}|Errors], NodeData) - end. - - -create_node(Host, Port, Options) -> - case slave:start_link(Host, list_to_atom(integer_to_list(Port))) of - {ok, NewNode} -> - case net_adm:ping(NewNode) of - pong -> - ok = rpc:call(NewNode, mnesia, start, []), - {ok,_} = rpc:call(NewNode, mnesia, change_config, [extra_db_nodes, [node()]]), - ok = rpc:call(NewNode, corba, orb_init, [[{iiop_port, Port}|Options]]), - ok = rpc:call(NewNode, orber, add_node, [NewNode, ram_copies]), - {ok, NewNode}; - _ -> - {error, "net_adm:ping(Node) failed"} - end; - {error, Reason} -> - {error, Reason} - end. - - -start() -> - start(temporary). - -start(Type) when Type == permanent; Type == temporary -> - application:start(mnesia), - TableTest = test_tables(), - case lists:member(not_member, TableTest) of - true -> - exit({error,"Orber Mnesia Table(s) missing. Orber not properly installed."}); - _-> - try_starting(Type) - end. - -start_lightweight() -> - application:start(orber). - -start_lightweight(Nodes) when is_list(Nodes) -> - configure(lightweight, Nodes), - application:set_env(orber, lightweight, Nodes), - application:start(orber); -start_lightweight(_) -> - exit({error,"Argument not correct; must be a list of nodes."}). - -stop() -> - application:stop(orber). - - -get_tables() -> - case light_ifr() of - false -> - ?ifr_object_list++?ORBER_TABS; - true -> - ?ifr_light_object_list ++?ORBER_TABS - end. - -iiop_port() -> - orber_env:iiop_port(). - -nat_iiop_port() -> - orber_env:nat_iiop_port(). - -iiop_out_ports() -> - orber_env:iiop_out_ports(). - -iiop_out_ports_random() -> - orber_env:iiop_out_ports_random(). - -iiop_out_ports_attempts() -> - orber_env:iiop_out_ports_attempts(). - -orber_nodes() -> - case catch mnesia:table_info(orber_objkeys,ram_copies) of - Nodes when is_list(Nodes) -> - Nodes; - _ -> - [node()] - end. - -domain() -> - orber_env:domain(). - - -ip_address_variable_defined() -> - orber_env:ip_address_variable_defined(). - - -nat_host() -> - orber_env:nat_host(). - -host() -> - orber_env:host(). - -giop_version() -> - orber_env:giop_version(). - -iiop_timeout() -> - orber_env:iiop_timeout(). - -iiop_connection_timeout() -> - orber_env:iiop_connection_timeout(). - -iiop_setup_connection_timeout() -> - orber_env:iiop_setup_connection_timeout(). - -iiop_in_connection_timeout() -> - orber_env:iiop_in_connection_timeout(). - -find_peername_by_sockname(Host, Port) -> - orber_iiop_net:sockname2peername(Host, Port) ++ - orber_iiop_pm:sockname2peername(Host, Port). - -find_sockname_by_peername(Host, Port) -> - orber_iiop_net:peername2sockname(Host, Port) ++ - orber_iiop_pm:peername2sockname(Host, Port). - -%%---------------------------------------------------------------------- -%% Function : iiop_connections -%% Arguments : Direction - in | out | inout -%% Returns : Connections - [{Host, Port}] | [{Host, Port, Interface}] -%% Host - string -%% Port - integer -%% Interface - string -%% Raises : -%% Description: List existing in- and/or out-bound connections. -%%---------------------------------------------------------------------- -iiop_connections() -> - iiop_connections(inout). - -iiop_connections(inout) -> - orber_iiop_pm:list_existing_connections() ++ orber_iiop_net:connections(); -iiop_connections(in) -> - orber_iiop_net:connections(); -iiop_connections(out) -> - orber_iiop_pm:list_existing_connections(). - -%%---------------------------------------------------------------------- -%% Function : close_connection -%% Arguments : ObjRef - #'IOP_IOR'{} | [{Host, Port}] | -%% Interface - string (optional) -%% Host - string -%% Port - integer -%% Returns : ok | {'EXCEPTION', #'BAD_PARAM'{}} -%% Raises : -%% Description: Close outgoing connections. -%%---------------------------------------------------------------------- -close_connection(ObjRef) -> - close_connection(ObjRef, 0). - -close_connection(ObjRef, Interface) when is_record(ObjRef, 'IOP_IOR') -> - case iop_ior:get_peerdata(ObjRef) of - [] -> - ok; - PeerData -> - orber_iiop_pm:close_connection(PeerData, Interface) - end; -close_connection(PeerData, Interface) when is_list(PeerData) -> - orber_iiop_pm:close_connection(PeerData, Interface); -close_connection(What, Interface) -> - orber:dbg("[~p] orber:close_connection(~p, ~p);~n" - "Incorrect type of arguments.", - [?LINE, What, Interface], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%---------------------------------------------------------------------- -%% Function : iiop_connections_pending -%% Arguments : - -%% Returns : Connections - [{Host, Port}] -%% Host - string -%% Port - integer -%% Raises : -%% Description: List outbound connections that are being setup. Usefull -%% when suspecting firewall problems. -%%---------------------------------------------------------------------- -iiop_connections_pending() -> - orber_iiop_pm:list_setup_connections(). - - -iiop_max_fragments() -> - orber_env:iiop_max_fragments(). - -iiop_max_in_requests() -> - orber_env:iiop_max_in_requests(). - -iiop_max_in_connections() -> - orber_env:iiop_max_in_connections(). - -iiop_backlog() -> - orber_env:iiop_backlog(). - -iiop_acl() -> - orber_env:iiop_acl(). - -ip_address_local() -> - orber_env:ip_address_local(). - -get_flags() -> - orber_env:get_flags(). - -typechecking() -> - orber_env:typechecking(). - -exclude_codeset_ctx() -> - orber_env:exclude_codeset_ctx(). - -exclude_codeset_component() -> - orber_env:exclude_codeset_component(). - -partial_security() -> - orber_env:partial_security(). - -use_CSIv2() -> - orber_env:use_CSIv2(). - -use_FT() -> - orber_env:use_FT(). - -ip_version() -> - orber_env:ip_version(). - -light_ifr() -> - orber_env:light_ifr(). - -bidir_context() -> - orber_env:bidir_context(). - -objectkeys_gc_time() -> - orber_env:objectkeys_gc_time(). - - -%%----------------------------------------------------------------- -%% CosNaming::NamingContextExt operations -%%----------------------------------------------------------------- -get_ORBInitRef() -> - orber_env:get_ORBInitRef(). - -get_ORBDefaultInitRef() -> - orber_env:get_ORBDefaultInitRef(). - - -%%----------------------------------------------------------------- -%% Interceptor opertaions (see orber_pi.erl) -%%----------------------------------------------------------------- -get_interceptors() -> - orber_env:get_interceptors(). - -get_local_interceptors() -> - orber_env:get_local_interceptors(). - -get_cached_interceptors() -> - orber_env:get_cached_interceptors(). - -set_interceptors(Val) -> - orber_env:set_interceptors(Val). - - -%%----------------------------------------------------------------- -%% Light weight Orber operations -%%----------------------------------------------------------------- -is_lightweight() -> - orber_env:is_lightweight(). - -get_lightweight_nodes() -> - orber_env:get_lightweight_nodes(). - -%%----------------------------------------------------------------- -%% Security access operations (SSL) -%%----------------------------------------------------------------- -secure() -> - orber_env:secure(). - -iiop_ssl_backlog() -> - orber_env:iiop_ssl_backlog(). - -iiop_ssl_ip_address_local() -> - orber_env:iiop_ssl_ip_address_local(). - -iiop_ssl_port() -> - orber_env:iiop_ssl_port(). - -nat_iiop_ssl_port() -> - orber_env:nat_iiop_ssl_port(). - -ssl_server_options() -> - orber_env:ssl_server_options(). - -ssl_client_options() -> - orber_env:ssl_client_options(). - -set_ssl_client_options(Value) -> - orber_env:set_ssl_client_options(Value). - -ssl_server_certfile() -> - orber_env:ssl_server_certfile(). - -ssl_client_certfile() -> - orber_env:ssl_client_certfile(). - -set_ssl_client_certfile(Value) -> - orber_env:set_ssl_client_certfile(Value). - -ssl_server_verify() -> - orber_env:ssl_server_verify(). - -ssl_client_verify() -> - orber_env:ssl_client_verify(). - -set_ssl_client_verify(Value) -> - orber_env:set_ssl_client_verify(Value). - -ssl_server_depth() -> - orber_env:ssl_server_depth(). - -ssl_client_depth() -> - orber_env:ssl_client_depth(). - -set_ssl_client_depth(Value) -> - orber_env:set_ssl_client_depth(Value). - -ssl_server_cacertfile() -> - orber_env:ssl_server_cacertfile(). - -ssl_client_cacertfile() -> - orber_env:ssl_client_cacertfile(). - -set_ssl_client_cacertfile(Value) -> - orber_env:set_ssl_client_cacertfile(Value). - -ssl_client_password() -> - orber_env:ssl_client_password(). - -ssl_server_password() -> - orber_env:ssl_server_password(). - -ssl_client_keyfile() -> - orber_env:ssl_client_keyfile(). - -ssl_server_keyfile() -> - orber_env:ssl_server_keyfile(). - -ssl_client_ciphers() -> - orber_env:ssl_client_ciphers(). - -ssl_server_ciphers() -> - orber_env:ssl_server_ciphers(). - -ssl_client_cachetimeout() -> - orber_env:ssl_client_cachetimeout(). - -ssl_server_cachetimeout() -> - orber_env:ssl_server_cachetimeout(). - -%%---------------------------------------------------------------------- -%% Function : activate_audit_trail -%% Arguments : Verbosity - stealth | normal | verbose -%% Returns : - -%% Raises : -%% Description: Activate the appropriate interceptor for the requested direction(s). -%%---------------------------------------------------------------------- -activate_audit_trail() -> - activate_audit_trail(normal). - -activate_audit_trail(stealth) -> - do_activate(orber_iiop_tracer_stealth); -activate_audit_trail(verbose) -> - do_activate(orber_iiop_tracer); -activate_audit_trail(_) -> - do_activate(orber_iiop_tracer_silent). - -do_activate(Interceptor) -> - Options = - case orber_env:get_interceptors() of - {native, PIs} -> - [{interceptors, - {native, [Interceptor|remove_built_in_interceptors(PIs, [])]}}]; - _ -> - [{interceptors, {native, [Interceptor]}}] - end, - reconfigure_in_connections(Options), - reconfigure_out_connections(Options). - -remove_built_in_interceptors([orber_iiop_tracer_stealth|T], Acc) -> - remove_built_in_interceptors(T, Acc); -remove_built_in_interceptors([orber_iiop_tracer|T], Acc) -> - remove_built_in_interceptors(T, Acc); -remove_built_in_interceptors([orber_iiop_tracer_silent|T], Acc) -> - remove_built_in_interceptors(T, Acc); -remove_built_in_interceptors([H|T], Acc) -> - remove_built_in_interceptors(T, [H|Acc]); -remove_built_in_interceptors([], Acc) -> - %% We must use the same order as defined by the interceptors parameter - lists:reverse(Acc). - -%%---------------------------------------------------------------------- -%% Function : deactivate_audit_trail -%% Arguments : - -%% Returns : - -%% Raises : -%% Description: Dectivate interceptors for the requested direction(s). -%%---------------------------------------------------------------------- -deactivate_audit_trail() -> - Options - = case orber_env:get_interceptors() of - {native, PIs} -> - [{interceptors, {native, PIs}}]; - _ -> - [{interceptors, false}] - end, - reconfigure_in_connections(Options), - reconfigure_out_connections(Options). - -%%---------------------------------------------------------------------- -%% Function : add_listen_interface -%% Arguments : IP - string -%% Type - normal | ssl -%% Port - integer > 0 -%% Options - [{Key, Value}] -%% Key - atom() valid configuration parameter -%% Value - a valid value for the given Key -%% Returns : #Ref -%% Raises : -%% Description: Add a new listen process, which will accept new incoming -%% connections. -%%---------------------------------------------------------------------- -add_listen_interface(IP, normal) -> - orber_iiop_net:add(IP, normal, [{iiop_port, orber_env:iiop_port()}]); -add_listen_interface(IP, ssl) -> - orber_iiop_net:add(IP, ssl, [{iiop_ssl_port, orber_env:iiop_ssl_port()}]). - -add_listen_interface(IP, normal, Port) when is_integer(Port) andalso Port > 0 -> - orber_iiop_net:add(IP, normal, [{iiop_port, Port}]); -add_listen_interface(IP, ssl, Port) when is_integer(Port) andalso Port > 0 -> - orber_iiop_net:add(IP, ssl, [{iiop_ssl_port, Port}]); -add_listen_interface(IP, Type, Options) when is_list(Options) -> - orber_iiop_net:add(IP, Type, Options); -add_listen_interface(IP, Type, Port) when is_integer(Port) -> - orber:dbg("[~p] orber:add_listen_interface(~p, ~p, ~p);~n" - "The port number must be greater than 0.", - [?LINE, IP, Type, Port], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}); -add_listen_interface(IP, Type, Extra) -> - orber:dbg("[~p] orber:add_listen_interface(~p, ~p, ~p);~n" - "Incorrect argument(s).", - [?LINE, IP, Type, Extra], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%---------------------------------------------------------------------- -%% Function : remove_listen_interface -%% Arguments : Ref - #Ref -%% Returns : #Ref -%% Raises : -%% Description: Terminate the listen process and all related inproxies -%% associated with the supplied reference. -%%---------------------------------------------------------------------- -remove_listen_interface(Ref) -> - orber_iiop_net:remove(Ref). - -%%---------------------------------------------------------------------- -%% Function : reconfigure_out_connections -%% Arguments : Options - see corba:orb_init -%% Returns : ok | {error, Reason} -%% Raises : -%% Description: Reconfigure the behavior of all outgoing IIOP connections. -%%---------------------------------------------------------------------- -reconfigure_out_connections(Options) -> - orber_iiop_pm:reconfigure(Options). - -%%---------------------------------------------------------------------- -%% Function : reconfigure_out_connections -%% Arguments : Options - see corba:orb_init -%% Host - string() -%% Port - integer() -%% Interface - string -%% Returns : ok | {error, Reason} -%% Raises : -%% Description: Reconfigure the behavior of all outgoing connections. -%%---------------------------------------------------------------------- -reconfigure_out_connection(Options, Host, Port) -> - orber_iiop_pm:reconfigure(Options, Host, Port). -reconfigure_out_connection(Options, Host, Port, Interface) -> - orber_iiop_pm:reconfigure(Options, Host, Port, Interface). - -%%---------------------------------------------------------------------- -%% Function : reconfigure_in_connections -%% Arguments : Options - see corba:orb_init -%% Returns : ok | {error, Reason} -%% Raises : -%% Description: Reconfigure the behavior of all incoming IIOP connections. -%%---------------------------------------------------------------------- -reconfigure_in_connections(Options) -> - orber_iiop_net:reconfigure(Options). - -%%---------------------------------------------------------------------- -%% Function : reconfigure_in_connections -%% Arguments : Options - see corba:orb_init -%% Ref - The #Ref returned by add_listen_interface/2/3 -%% Returns : ok | {error, Reason} -%% Raises : -%% Description: Reconfigure the behavior of all incoming IIOP connections. -%%---------------------------------------------------------------------- -reconfigure_in_connection(Options, Ref) -> - orber_iiop_net:reconfigure(Options, Ref). - - -%%----------------------------------------------------------------- -%% Configuration settings -%%----------------------------------------------------------------- -info() -> - orber_env:info(). - -info(IoDevice) -> - orber_env:info(IoDevice). - -%%----------------------------------------------------------------- -%% EXCEPTION mapping -%%----------------------------------------------------------------- -exception_info(Exc) -> - orber_exceptions:dissect(Exc). - -is_system_exception(Exc) -> - orber_exceptions:is_system_exception(Exc). - -%%----------------------------------------------------------------- -%% Installation interface functions -%%----------------------------------------------------------------- -install(Nodes) -> - install(Nodes, []). - -install([], Options) -> - install([node()], Options); -install(Nodes, Options) when is_list(Nodes) andalso is_list(Options)-> - case orber_tb:is_running() of - false -> - application:load(orber), - case mnesia:system_info(is_running) of - no -> - application:start(mnesia), - Outcome = install_orber(Nodes, Options), - application:stop(mnesia), - Outcome; - yes -> - install_orber(Nodes, Options) - end; - _ -> - exit({error, "Orber is already running on this node."}) - end. - - - -install_orber(Nodes, Options) -> - #options{ifr_storage_type = IFRType, install_timeout = Timeout, - local_content = LocalContent, nameservice_storage_type = NSType, - initialreferences_storage_type = InitType, - load_order = LoadOrder} - = check_options(Options, #options{}), - MnesiaOptions = [{local_content, LocalContent}, - {load_order, LoadOrder}], - TableTest = test_tables(), - case lists:member(is_member, TableTest) of - true -> - case LocalContent of - true -> - orber_ifr:initialize(Timeout, {localCopy,IFRType}, - light_ifr()); - _-> - exit("Orber Mnesia Table(s) already exist. Cannot install Orber.") - end; - _ -> - orber_ifr:initialize(Timeout, [{IFRType, Nodes} |MnesiaOptions], - light_ifr()) - end, - orber_objectkeys:install(Timeout, [{ram_copies, Nodes} |MnesiaOptions]), - 'CosNaming_NamingContextExt_impl':install(Timeout, [{NSType, Nodes} |MnesiaOptions]), - orber_initial_references:install(Timeout, [{InitType, Nodes} |MnesiaOptions]), - oe_cos_naming:oe_register(), - oe_cos_naming_ext:oe_register(), - oe_erlang:oe_register(), - oe_OrberIFR:oe_register(), - oe_CORBA:oe_register(), - case NSType of - ram_copies -> - case mnesia:dump_tables(['orber_CosNaming']) of - {atomic, ok} -> - ok; - {aborted, {has_no_disc,_}} -> - ok; - {aborted, Reason} -> - ?EFORMAT("Unable to dump mnesia tables: ~p", [Reason]) - end; - _ -> - ok - end. - -check_options([], Options) -> - Options; -check_options([{ifr_storage_type, Type}|T], Options) - when Type == disc_copies; Type == ram_copies -> - check_options(T, Options#options{ifr_storage_type = Type}); -check_options([{nameservice_storage_type, Type}|T], Options) - when Type == disc_copies; Type == ram_copies -> - check_options(T, Options#options{nameservice_storage_type = Type}); -check_options([{initialreferences_storage_type, Type}|T], Options) - when Type == disc_copies; Type == ram_copies -> - check_options(T, Options#options{initialreferences_storage_type = Type}); -check_options([{install_timeout, Timeout}|T], Options) - when Timeout == infinity orelse is_integer(Timeout) -> - check_options(T, Options#options{install_timeout = Timeout}); -check_options([{local_content, Bool}|T], Options) - when Bool == true; Bool == false -> - check_options(T, Options#options{local_content = Bool}); -check_options([{type, Type}|T], Options) - when Type == temporary; Type == permanent -> - check_options(T, Options#options{type = Type}); -check_options([{load_order, LoadOrder}|T], Options) - when is_integer(LoadOrder) -> - check_options(T, Options#options{load_order = LoadOrder}); -check_options([H|_], _) -> - ?EFORMAT("Option unknown or incorrect value: ~w", [H]). - - - -try_starting(Type) -> - case application:start(orber, Type) of - ok -> - case partial_security() of - true -> - error_logger:warning_msg( - "=================== Orber =================~n" - "*******************************************~n" - "**** WARNING - WARNING - WARNING **********~n" - "**** WARNING - WARNING - WARNING **********~n" - "**** WARNING - WARNING - WARNING **********~n" - "**** WARNING - WARNING - WARNING **********~n" - "*******************************************~n" - " ORBER STARTED WITH AN INSECURE OPTION:~n" - " ~n" - " {flags, ~p}~n" - " ~n" - " THIS OPTION MAY ONLY BE USED DURING TESTS~n" - " ~n" - "===========================================~n", - [?ORB_ENV_PARTIAL_SECURITY]), - ok; - false -> - ok - end; - {error,{already_started,orber}} -> - {error,{already_started,orber}}; - Reason -> - dbg("[~p] orber:try_starting(~p) failed: ~n~p", - [?LINE, Type, Reason], ?DEBUG_LEVEL), - {error, "Unable to start Orber. Is the listen port vacant?"} - end. - -test_tables() -> - AllTabs = mnesia:system_info(tables), - lists:map(fun(Tab) -> - case lists:member(Tab,AllTabs) of - false -> - not_member; - _ -> - is_member - end - end, - get_tables()). - -%%----------------------------------------------------------------- -%% UnInstallation interface functions -%%----------------------------------------------------------------- -uninstall() -> - orber_objectkeys:stop_all(), - application:stop(orber), - delete_orber_tables(get_tables()). - -delete_orber_tables([]) -> ok; -delete_orber_tables([Tab1|Rest]) -> - mnesia:delete_table(Tab1), - delete_orber_tables(Rest). - -%%----------------------------------------------------------------- -%% Add and remove node interface functions -%%----------------------------------------------------------------- -add_node(Node, StorageType) when is_atom(Node) andalso is_atom(StorageType) -> - add_node(Node, [{ifr_storage_type, StorageType}]); -add_node(Node, OptionList) when is_atom(Node) andalso is_list(OptionList) -> - case rpc:call(Node, mnesia, system_info, [is_running]) of - {badrpc, Reason} -> - ?EFORMAT("Node ~p do not respond. add_node/2 failed: ~p", - [Node, Reason]); - yes -> - case rpc:call(Node, orber, is_running, []) of - false -> - %% We need to "load" orber to make sure that - %% application environment variables is loaded. - rpc:call(Node, application, load, [orber]), - Options = check_options(OptionList, #options{}), - case rpc:call(Node, orber, light_ifr, []) of - false -> - copy_tables(?ifr_object_list, Node, Options); - true -> - copy_tables(?ifr_light_object_list, Node, Options) - end; - true -> - ?EFORMAT("Orber is already running on ~p. add_node failed.", - [Node]); - Reason -> - ?EFORMAT("Unable to reach node ~p. add_node/1 failed: ~p", - [Node, Reason]) - end; - no -> - ?EFORMAT("Mnesia not running on node ~p. add_node/2 failed.", - [Node]); - starting -> - ?EFORMAT("Mnesia not fully started on node ~p. add_node/2 failed.", - [Node]); - stopping -> - ?EFORMAT("Mnesia stopping on node ~p. add_node/2 failed.", [Node]) - end. - -%% We have to copy the tables in two steps, i.e., orber tables should be ram_copies -%% while the user may choose to install the rest as disc_copies. -copy_tables([], Node, Options) -> - copy_orber_tables(?ORBER_TABS, Node, Options); -copy_tables([T1|Trest], Node, Options) -> - case mnesia:add_table_copy(T1, Node, Options#options.ifr_storage_type) of - {atomic, ok} -> - copy_tables(Trest, Node, Options); - {aborted, Reason} -> - ?EFORMAT("orber:add_node/2 failed: ~p. Unable to copy IFR table(s): ~p", - [mnesia:error_description(Reason), [T1|Trest]]) - end. - -copy_orber_tables([], Node, Options) -> - case rpc:call(Node, application, start, [orber, Options#options.type]) of - ok -> - ok; - Reason -> - ?EFORMAT("All tables installed but failed to start orber on node ~p: ~p", - [Node, Reason]) - end; -copy_orber_tables([orber_CosNaming|TTail], Node, Options) -> - case mnesia:add_table_copy(orber_CosNaming, Node, - Options#options.nameservice_storage_type) of - {atomic, ok} -> - copy_orber_tables(TTail, Node, Options); - {aborted, Reason} -> - ?EFORMAT("orber:add_node/2 failed: ~p. Unable to copy system table(s): ~p", - [mnesia:error_description(Reason), [orber_CosNaming|TTail]]) - end; -copy_orber_tables([orber_references|TTail], Node, Options) -> - case mnesia:add_table_copy(orber_references, Node, - Options#options.initialreferences_storage_type) of - {atomic, ok} -> - copy_orber_tables(TTail, Node, Options); - {aborted, Reason} -> - ?EFORMAT("orber:add_node/2 failed: ~p. Unable to copy system table(s): ~p", - [mnesia:error_description(Reason), [orber_references|TTail]]) - end; -copy_orber_tables([THead|TTail], Node, Options) -> - case mnesia:add_table_copy(THead, Node, ram_copies) of - {atomic, ok} -> - copy_orber_tables(TTail, Node, Options); - {aborted, Reason} -> - ?EFORMAT("orber:add_node/2 failed: ~p. Unable to copy system table(s): ~p", - [mnesia:error_description(Reason), [THead|TTail]]) - end. - -remove_node(Node) when is_atom(Node) -> - case rpc:call(Node, mnesia, system_info, [is_running]) of - yes -> - case rpc:call(Node, orber, is_running, []) of - true -> - rpc:call(Node, orber, stop, []), - remove_tables(get_tables(), Node); - false -> - remove_tables(get_tables(), Node); - Reason -> - ?EFORMAT("Unable to reach node: ~p. remove_node/1 failed: ~p", - [Node, Reason]) - end; - no -> - case rpc:call(Node, mnesia, start, []) of - ok -> - remove_tables(get_tables(), Node), - rpc:call(Node, mnesia, stop, []); - Reason -> - ?EFORMAT("Unable to reach node: ~p. remove_node/1 failed: ~p", - [Node, Reason]) - end; - Reason -> - ?EFORMAT("Problem with ~p. remove_node/1 failed: ~p", [Node, Reason]) - end. - - -remove_tables(Tables, Node) -> - case remove_tables(Tables, Node, []) of - ok -> - ok; - {error, Node, Failed} -> - ?EFORMAT("orber:remove_node(~p) failed. Unable to remove table(s): ~p", - [Node, Failed]) - end. - -remove_tables([], _, []) -> - ok; -remove_tables([], Node, Failed) -> - {error, Node, Failed}; -remove_tables([T1|Trest], Node, Failed) -> - case mnesia:del_table_copy(T1, Node) of - {atomic, ok} -> - remove_tables(Trest, Node, Failed); - {aborted, Reason} -> - remove_tables(Trest, Node, [{T1, Reason}|Failed]) - end. - -%%----------------------------------------------------------------- -%% Internal interface functions -%%----------------------------------------------------------------- -%%---------------------------------------------------------------------- -%% Function : is_running -%% Arguments : -%% Returns : -%% Raises : -%% Description: -%%---------------------------------------------------------------------- -is_running() -> - orber_tb:is_running(). - -%%---------------------------------------------------------------------- -%% Function : check_giop -%% Arguments : -%% Returns : -%% Raises : -%% Description: -%%---------------------------------------------------------------------- -check_giop_version() -> - case giop_version() of - {1,0} -> - ok; - {1,1} -> - ok; - {1,2} -> - ok; - X -> - X - end. - -%%---------------------------------------------------------------------- -%% Function : dbg -%% Arguments : -%% Returns : -%% Raises : -%% Description: Note, dbg replaces debug_level_print. -%% -%% The following levels are used (0-10): -%% 10: cdrlib.erl -%% 9: cdr_encode.erl cdr_decode.erl orber_ifr.erl orber_pi.erl -%% 8: orber_iiop_outrequest.erl orber_iiop_inrequest.erl -%% 7: orber_iiop_outproxy.erl orber_iiop_inproxy.erl -%% 6: iop_ior.erl, orber_objectkeys.erl, Orber_IFR_impl.erl orber_socket.erl -%% 5: corba.erl, corba_boa.erl, corba_object.erl -%% 4: Reserved for Cos-services! -%% 3: Reserved for Cos-services! -%% 2: Reserved for client applications! -%% 1: Reserved for client applications! -%% 0: No logging! -%% -%% A higher value will result in a finer granularity. -%%---------------------------------------------------------------------- -get_debug_level() -> - orber_env:get_debug_level(). - -debug_level_print(Format, Data, RequestedLevel) -> - dbg(Format, Data, RequestedLevel). - -dbg(Format, Data, RequestedLevel) -> - case orber_env:get_debug_level() of - 0 -> - ok; - Level when is_integer(Level) andalso Level >= RequestedLevel -> - if - RequestedLevel > 4 -> - %% Use catch if incorrect format used somewhere. - catch error_logger:error_msg("=================== Orber =================~n"++ - Format++ - "~n===========================================~n", - Data); - RequestedLevel > 2 -> - %% Use catch if incorrect format used somewhere. - catch error_logger:error_msg("=========== Orber COS Application =========~n"++ - Format++ - "~n===========================================~n", - Data); - true -> - %% Use catch if incorrect format used somewhere. - catch error_logger:error_msg("========== Orber Client Application =======~n"++ - Format++ - "~n===========================================~n", - Data) - end, - ok; - _ -> - ok - end. - -error(Format, Data, RequestedLevel) -> - if - RequestedLevel > 4 -> - %% Use catch if incorrect format used somewhere. - catch error_logger:error_msg("=================== Orber =================~n"++ - Format++ - "~n===========================================~n", - Data); - RequestedLevel > 2 -> - %% Use catch if incorrect format used somewhere. - catch error_logger:error_msg("=========== Orber COS Application =========~n"++ - Format++ - "~n===========================================~n", - Data); - true -> - %% Use catch if incorrect format used somewhere. - catch error_logger:error_msg("========== Orber Client Application =======~n"++ - Format++ - "~n===========================================~n", - Data) - end, - ok. - -configure(Key, Value) -> - orber_env:configure(Key, Value, check). - -configure_override(Key, Value) -> - orber_env:configure(Key, Value, loaded). - -multi_configure(KeyValueList) -> - orber_env:multi_configure(KeyValueList). - - -%%----------------------------------------------------------------- -%% Server functions -%%----------------------------------------------------------------- -start(_, _) -> - supervisor:start_link({local, orber_sup}, orber, orb_init). - -init(orb_init) -> - case check_giop_version() of - ok -> - case is_lightweight() of - true -> - SupFlags = {one_for_one, 5, 1000}, - ChildSpec = [ - {orber_iiop_sup, {orber_iiop, start_sup, [[]]}, - permanent, - 10000, supervisor, [orber_iiop]}, - {orber_reqno, {orber_request_number, start, - [[]]}, - permanent, - 10000, worker, [orber_request_number]} - ], - {ok, {SupFlags, ChildSpec}}; - false -> - case orber_tb:wait_for_tables(get_tables()) of - ok -> - orber_objectkeys:remove_old_keys(), - SupFlags = {one_for_one, 5, 1000}, - ChildSpec = [ - {orber_iiop_sup, {orber_iiop, start_sup, [[]]}, - permanent, - 10000, supervisor, [orber_iiop]}, - {orber_init, {orber_initial_references, start, - [[]]}, - permanent, - 10000, worker, [orber_initial_references]}, - {orber_reqno, {orber_request_number, start, - [[]]}, - permanent, - 10000, worker, [orber_request_number]}, - {orber_objkeyserver, {orber_objectkeys, start, - [[orber_nodes(), 0]]}, - permanent, - 10000, worker, [orber_objectkeys]}, - {orber_env, {orber_env, start, [[]]}, - permanent, 10000, worker, [orber_env]} - ], - {ok, {SupFlags, ChildSpec}}; - StopReason -> - {stop, StopReason} - end - end; - X -> - {stop, ?FORMAT("GIOP ~p not an implemeted version", [X])} - end. - diff --git a/lib/orber/src/orber_acl.erl b/lib/orber/src/orber_acl.erl deleted file mode 100644 index 55d84afbab..0000000000 --- a/lib/orber/src/orber_acl.erl +++ /dev/null @@ -1,397 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: orber_acl.erl -%% -%% Description: -%% Handling ACL's (Access Control Lists). -%% -%% Creation date: 040723 -%% -%%----------------------------------------------------------------- --module(orber_acl). - --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([init_acl/1, init_acl/2, clear_acl/0, - match/2, match/3, verify/3, range/1, range/2]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --define(ACL_DB, orber_acl_db). - --define(DEBUG_LEVEL, 5). --define(CONTINUE, -1). --define(STOP, -2). - --define(FORMAT(_F, _A), {error, lists:flatten(io_lib:format(_F, _A))}). --define(EFORMAT(_F, _A), exit(lists:flatten(io_lib:format(_F, _A)))). - -%%----------------------------------------------------------------- -%% Record Definitions -%%----------------------------------------------------------------- --record(acl, {key, bits = ?CONTINUE, mask, interfaces = [], - ports = 0, flags = 0}). - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- - -%%----------------------------------------------------------------- -%% function : verify/1 -%% Arguments: IP - string() -%% Filter - string() see init_acl -%% Family - inet | inet6 -%% Returns : boolean() -%% Exception: -%% Effect : -%%----------------------------------------------------------------- -verify(IP, Filter, Family) -> - DB = ets:new(orber_temporary_acl_table_created_by_user, - [set, public, {keypos, 2}]), - Result = - case catch verify_helper(IP, Filter, Family, DB) of - true -> - true; - {ok, Low, High} -> - {false, Low, High}; - What -> - {error, ?FORMAT("Uknown Error: ~p\n", [What])} - end, - ets:delete(DB), - Result. - -verify_helper(IP, Filter, Family, DB) -> - init_acl([{tcp_in, Filter}], Family, DB), - {ok, IPTuple} = inet:getaddr(IP, Family), - case match_helper(tuple_to_list(IPTuple), tcp_in, DB, false, tcp_in) of - true -> - true; - false -> - range(Filter, Family) - end. - -%%----------------------------------------------------------------- -%% function : range/1/2 -%% Arguments: Filter - string(). See init_acl -%% Family - inet | inet6 -%% Returns : {ok, From, To} -%% From - To - string() -%% Exception: -%% Effect : -%%----------------------------------------------------------------- -range(Filter) -> - range(Filter, inet). - -range(Filter, inet) -> - range_safe(Filter, inet, ".", 16#FF, "255", 8, "~p.", "~p", 3); -range(Filter, Family) -> - range_safe(Filter, Family, ":", 16#FFFF, "FFFF", 16, "~.16B:", "~.16B", 7). - -range_safe(Filter, Family, Separator, Max, MaxStr, N, F1, F2, X) -> - case catch range_helper(Filter, Family, Separator, Max, MaxStr, N, F1, F2, X) of - {ok, Low, High} -> - {ok, Low, High}; - {'EXIT',{format,Why}} -> - {error, ?FORMAT("Unable to format string: ~p\n", [Why])}; - {'EXIT', E} -> - {error, ?FORMAT("Exit: ~p\n", [E])}; - What -> - {error, ?FORMAT("Unknown Error: ~p\n", [What])} - end. - -range_helper(Filter, Family, Separator, Max, MaxStr, N, F1, F2, X) -> - {MaskStr, Bits, _Ports} = tokenize(Filter, Family), - {ok, MaskTuple} = inet:getaddr(MaskStr, Family), - NoOfFull = Bits div N, - Mask = get_mask(N, (Bits rem N)), - case split(NoOfFull, tuple_to_list(MaskTuple)) of - {Full, [Partial|_DontCare]} -> - Beginning = pp(Full, [], F1), - MiddleLow = io_lib:format(F2, [(Mask band Partial) + ((Mask bxor Max) band 0)]), - MiddleHigh = io_lib:format(F2, [(Mask band Partial) + ((Mask bxor Max) band Max)]), - EndLow = lists:duplicate((X-NoOfFull), Separator ++ "0"), - EndHigh = lists:duplicate((X-NoOfFull), Separator ++ MaxStr), - Low = lists:flatten([Beginning, MiddleLow, EndLow]), - High = lists:flatten([Beginning, MiddleHigh, EndHigh]), - {ok, Low, High}; - {Full, []} -> - Address = lists:flatten(pp(Full, [], F1)), - {ok, Address, Address} - end. - -pp([], Acc, _) -> - Acc; -pp([H|T], Acc, Format) -> - pp(T, Acc ++ io_lib:format(Format, [H]), Format). - -split(N, List) when is_integer(N) andalso N >= 0 andalso is_list(List) -> - case split(N, List, []) of - Fault when is_atom(Fault) -> - erlang:error(Fault, [N,List]); - Result -> - Result - end; -split(N, List) -> - erlang:error(badarg, [N,List]). - -split(0, L, R) -> - {lists:reverse(R, []), L}; -split(N, [H|T], R) -> - split(N-1, T, [H|R]); -split(_, [], _) -> - badarg. - - -%%----------------------------------------------------------------- -%% function : clear_acl/0 -%% Arguments: - -%% Returns : -%% Exception: -%% Effect : -%%----------------------------------------------------------------- -clear_acl() -> - clear_acl(?ACL_DB). -clear_acl(DB) -> - (catch ets:delete(DB)), - ok. - -%%----------------------------------------------------------------- -%% function : init_acl/1/2 -%% Arguments: Filters - [{Direction, Filter}] | [{Direction, Filter, [Interfaces]}] -%% Direction - tcp_in | ssl_in | tcp_out | ssl_out -%% Filter - string(). Examples: -%% * "123.456.789.10" - match against all bits. -%% * "123.456.789.10/17" - match against the 17 most significant bits. -%% * "123.456.789.10/17#4001" - as above but only allow port 4001 -%% * "123.456.789.10/17#4001/5001" - as above but only allow port 4001-5001 -%% Family - inet | inet6 -%% Returns : ok | {'EXCEPTION', E} -%% Exception: 'BAD_PARAM' -%% Effect : -%%----------------------------------------------------------------- -init_acl(Filters) -> - DB = ets:new(?ACL_DB, [set, public, named_table, {keypos, 2}]), - case ?ORB_FLAG_TEST(orber:get_flags(), ?ORB_ENV_USE_IPV6) of - false -> - init_acl(Filters, inet, DB); - true -> - init_acl(Filters, inet6, DB) - end. - -init_acl(Filters, Family) -> - DB = ets:new(?ACL_DB, [set, public, named_table, {keypos, 2}]), - init_acl(Filters, Family, DB). - -init_acl([], _, DB) -> - {ok, DB}; -init_acl([Data|T], Family, DB) -> - {Direction, Filter, Interfaces} = - case Data of - {D, F, I} -> - {D, F, I}; - {D, F} -> - {D, F, []} - end, - {MaskStr, Bits, Ports} = tokenize(Filter, Family), - case inet:getaddr(MaskStr, Family) of - {ok, Addr} when size(Addr) == 4 -> - create_mask(tuple_to_list(Addr), Bits div 8, - get_mask8((Bits rem 8)), DB, Direction, Interfaces, Ports), - init_acl(T, Family, DB); - {ok, Addr} -> - create_mask(tuple_to_list(Addr), Bits div 16, - get_mask16((Bits rem 16)), DB, Direction, Interfaces, Ports), - init_acl(T, Family, DB) - end. - -create_mask(List, Div, Mask, DB, Direction, Interfaces, Ports) -> - case split(Div, List) of - {[], [Partial|_DontCare]} -> - %% Less than 8/16 bits (depends on family). - add_parts([], Direction, (Partial band Mask), Mask, DB, - Interfaces, Ports); - {Full, [Partial|_DontCare]} -> - add_parts(Full, Direction, (Partial band Mask), Mask, DB, - Interfaces, Ports); - {Full, []} -> - %% 32 bits. - add_parts(Full, Direction, ?STOP, Mask, DB, Interfaces, Ports) - end. - -add_parts([], Parent, Bits, Mask, DB, Interfaces, Ports) -> - ets:insert(DB, #acl{key = Parent, bits = Bits, - mask = Mask, interfaces = Interfaces, ports = Ports}); -add_parts([H|T], Parent, Bits, Mask, DB, Interfaces, Ports) -> - Key = {Parent, H}, - ets:insert(DB, #acl{key = Key}), - add_parts(T, Key, Bits, Mask, DB, Interfaces, Ports). - - -%%----------------------------------------------------------------- -%% function : match/1/2 -%% Arguments: IP - tuple() | [integer()] -%% Direction - tcp_in | ssl_in | tcp_out | ssl_out -%% All - boolean() -%% Returns : -%% Exception: -%% Effect : -%%----------------------------------------------------------------- -match(IPTuple, Direction) when is_tuple(IPTuple) -> - match_helper(tuple_to_list(IPTuple), Direction, ?ACL_DB, false, Direction); -match(IPList, Direction) -> - match_helper(IPList, Direction, ?ACL_DB, false, Direction). - -match(IPTuple, Direction, All) when is_tuple(IPTuple) -> - match_helper(tuple_to_list(IPTuple), Direction, ?ACL_DB, All, Direction); -match(IPList, Direction, All) -> - match_helper(IPList, Direction, ?ACL_DB, All, Direction). - -match_helper([], _, _, false, _) -> false; -match_helper([], _, _, true, _) -> {false, [], 0}; -match_helper([H|T], Parent, DB, All, Direction) -> - case ets:lookup(DB, {Parent, H}) of - [#acl{bits = ?CONTINUE}] -> - match_helper(T, {Parent, H}, DB, All, Direction); - [#acl{bits = ?STOP}] when All == false -> - true; - [#acl{bits = ?STOP, interfaces = I, ports = Ports}] -> - {true, I, Ports}; - [#acl{bits = Bits, mask = Mask}] when All == false -> - Bits == (hd(T) band Mask); - [#acl{bits = Bits, mask = Mask, interfaces = I, ports = Ports}] -> - {Bits == (hd(T) band Mask), I, Ports}; - _ -> - %% Less than 8/16 significant bits (depends on family). - %% Should we even allow this? - case ets:lookup(DB, Direction) of - [#acl{bits = Bits, mask = Mask}] when is_integer(Bits) andalso - All == false -> - Bits == (H band Mask); - [#acl{bits = Bits, mask = Mask, - interfaces = I, ports = Ports}] when is_integer(Bits) -> - {Bits == (H band Mask), I, Ports}; - _ when All == false -> - false; - _ -> - {false, [], 0} - end - end. - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% function : tokenize/1 -%% Arguments: Filter - string(). Examples: -%% * "123.456.789.10" - match against all. -%% * "123.456.789.10/17" - match against the 17 most significant bits. -%% * "123.456.789.10/17#4001" - as above but only allow port 4001 -%% * "123.456.789.10/17#4001/5001" - as above but only allow port 4001-5001 -%% Family - inet | inet6 -%% Returns : {MaskStr, Bits, Ports} -%% MaskStr - string() -%% Bits - integer() -%% Ports - integer() | {integer(), integer()} -%% Exception: -%% Effect : -%%----------------------------------------------------------------- -tokenize(Filter, Family) -> - case string:tokens(Filter, "/#") of - [MaskStr] when Family == inet -> - {MaskStr, 32, 0}; - [MaskStr] when Family == inet6 -> - {MaskStr, 128, 0}; - [MaskStr, BitString] -> - {MaskStr, list_to_integer(BitString), 0}; - [MaskStr, BitString, Port] -> - {MaskStr, list_to_integer(BitString), list_to_integer(Port)}; - [MaskStr, BitString, MinPort, MaxPort] -> - {MaskStr, list_to_integer(BitString), - {list_to_integer(MinPort), list_to_integer(MaxPort)}}; - What -> - ?EFORMAT("Invalid Filter: ~p\nReason: ~p\n", [Filter, What]) - end. - - -%%----------------------------------------------------------------- -%% function : get_mask/2 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%----------------------------------------------------------------- -get_mask(8, Bits) -> - get_mask8(Bits); -get_mask(16, Bits) -> - get_mask16(Bits). - -%%----------------------------------------------------------------- -%% function : get_mask8/1 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%----------------------------------------------------------------- -get_mask8(0) -> 2#00000000; -get_mask8(1) -> 2#10000000; -get_mask8(2) -> 2#11000000; -get_mask8(3) -> 2#11100000; -get_mask8(4) -> 2#11110000; -get_mask8(5) -> 2#11111000; -get_mask8(6) -> 2#11111100; -get_mask8(7) -> 2#11111110. - -%%----------------------------------------------------------------- -%% function : get_mask16/1 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%----------------------------------------------------------------- -get_mask16(0) -> 2#0000000000000000; -get_mask16(1) -> 2#1000000000000000; -get_mask16(2) -> 2#1100000000000000; -get_mask16(3) -> 2#1110000000000000; -get_mask16(4) -> 2#1111000000000000; -get_mask16(5) -> 2#1111100000000000; -get_mask16(6) -> 2#1111110000000000; -get_mask16(7) -> 2#1111111000000000; -get_mask16(8) -> 2#1111111100000000; -get_mask16(9) -> 2#1111111110000000; -get_mask16(10) -> 2#1111111111000000; -get_mask16(11) -> 2#1111111111100000; -get_mask16(12) -> 2#1111111111110000; -get_mask16(13) -> 2#1111111111111000; -get_mask16(14) -> 2#1111111111111100; -get_mask16(15) -> 2#1111111111111110. - - -%%----------------------------------------------------------------- -%%------------- END OF MODULE ------------------------------------- -%%----------------------------------------------------------------- diff --git a/lib/orber/src/orber_diagnostics.erl b/lib/orber/src/orber_diagnostics.erl deleted file mode 100644 index 18d28fcf35..0000000000 --- a/lib/orber/src/orber_diagnostics.erl +++ /dev/null @@ -1,241 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2003-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: orber_diagnostics.erl -%% -%% Description: -%% -%%----------------------------------------------------------------- - --module(orber_diagnostics). - - -%%----------------------------------------------------------------- -%% Includes -%%----------------------------------------------------------------- --include_lib("orber/src/orber_iiop.hrl"). --include_lib("orber/src/ifr_objects.hrl"). --include_lib("orber/COSS/CosNaming/CosNaming.hrl"). --include_lib("orber/COSS/CosNaming/CosNaming_NamingContext.hrl"). --include_lib("orber/COSS/CosNaming/orber_cosnaming.hrl"). - - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([nameservice/0, nameservice/1, - objectkeys/0, - missing_modules/0]). - -%%----------------------------------------------------------------- -%% Internal Exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- - -%%----------------------------------------------------------------- -%% Macros -%%----------------------------------------------------------------- --define(DEBUG_LEVEL, 5). - --define(DIAGNOSTICS_PING_EXTERNAL, 16#01). - -%%----------------------------------------------------------------- -%% Function : missing_modules -%% Args : - -%% Returns : -%%----------------------------------------------------------------- -missing_modules() -> - List = - case orber:light_ifr() of - false -> - Unions = mnesia:dirty_select(ir_UnionDef, - [{#ir_UnionDef{absolute_name='$1', - _='_'}, - [], ['$1']}]), - Structs = mnesia:dirty_select(ir_StructDef, - [{#ir_StructDef{absolute_name='$1', - _='_'}, - [], ['$1']}]), - Exc = mnesia:dirty_select(ir_ExceptionDef, - [{#ir_ExceptionDef{absolute_name='$1', - _='_'}, - [], ['$1']}]), - Interface = mnesia:dirty_select(ir_InterfaceDef, - [{#ir_InterfaceDef{absolute_name='$1', - _='_'}, - [], ['$1']}]), - Acc1 = create_module_names(Unions, [], ?IFR_UnionDef), - Acc2 = create_module_names(Structs, Acc1, ?IFR_StructDef), - Acc3 = create_module_names(Exc, Acc2, ?IFR_ExceptionDef), - create_module_names(Interface, Acc3, ?IFR_InterfaceDef); - true -> - mnesia:dirty_select(orber_light_ifr, - [{#orber_light_ifr{module='$1', - type='$2', _='_'}, - [{'=/=', '$2', ?IFR_ModuleDef}, - {'=/=', '$2', ?IFR_ConstantDef}, - {'=/=', '$2', ?IFR_AliasDef}, - {'=/=', '$2', ?IFR_EnumDef}], ['$$']}]) - end, - io:format("Need to check for ~p modules.~n", [length(List)]), - Count = missing_modules_helper(List, 0), - io:format("Check completed. ~p missing modules.~n", [Count]), - Count. - -create_module_names([], Acc, _) -> - Acc; -create_module_names([[$:,$:|N]|T], Acc, Type) -> - create_module_names(T, [[change_colons_to_underscore(N, []), Type]|Acc], Type). - -change_colons_to_underscore([$:, $: | T], Acc) -> - change_colons_to_underscore(T, [$_ |Acc]); -change_colons_to_underscore([H |T], Acc) -> - change_colons_to_underscore(T, [H |Acc]); -change_colons_to_underscore([], Acc) -> - list_to_atom(lists:reverse(Acc)). - -missing_modules_helper([], ErrorsFound) -> - ErrorsFound; -missing_modules_helper([[Mod, Type]|T], ErrorsFound) when Type == ?IFR_StructDef; - Type == ?IFR_UnionDef; - Type == ?IFR_ExceptionDef -> - case catch Mod:tc() of - {'EXIT', _} -> - io:format("Missing (~s): ~p~n", [type2str(Type), Mod]), - missing_modules_helper(T, ErrorsFound + 1); - _ -> - missing_modules_helper(T, ErrorsFound) - end; -missing_modules_helper([[Mod, Type]|T], ErrorsFound) when Type == ?IFR_InterfaceDef -> - case catch Mod:oe_get_interface() of - {'EXIT', {undef,[{Mod, _, _, _}|_]}} -> - io:format("Missing (Interface): ~p~n", [Mod]), - missing_modules_helper(T, ErrorsFound + 1); - {'EXIT', {undef,[{OtherMod, _, _, _}|_]}} -> - io:format("Missing (Inherited by the ~p Interface): ~p~n", - [Mod, OtherMod]), - missing_modules_helper(T, ErrorsFound + 1); - _ -> - missing_modules_helper(T, ErrorsFound) - end; -missing_modules_helper([_|T], ErrorsFound) -> - missing_modules_helper(T, ErrorsFound). - -type2str(?IFR_StructDef) -> - "Struct"; -type2str(?IFR_UnionDef) -> - "Union"; -type2str(?IFR_ExceptionDef) -> - "Exception". - - -%%----------------------------------------------------------------- -%% Function : nameservice -%% Args : - | integer() -%% Returns : -%%----------------------------------------------------------------- -nameservice() -> - nameservice(0). - -nameservice(Flags) -> - case catch ns(?ORB_FLAG_TEST(Flags, ?DIAGNOSTICS_PING_EXTERNAL)) of - ok -> - ok; - {'EXCEPTION', E} -> - orber:dbg("[~p] orber_diagnostics:nameservice(~p);~n" - "Reason: ~p", [?LINE, Flags, E], ?DEBUG_LEVEL), - corba:raise(E); - What -> - orber:dbg("[~p] orber_diagnostics:nameservice(~p);~n" - "Reason: ~p", [?LINE, Flags, What], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -ns(Ping) -> - NS = corba:resolve_initial_references("NameService"), - display_names(NS, "", Ping). - - -display_names(NS, Prefix, Ping) -> - {ok, [], Iter} = 'CosNaming_NamingContextExt':list(NS, 0), - More = not corba_object:is_nil(Iter), - iter_names(NS, Prefix, Iter, More, Ping). - -iter_names(_NS, _Prefix, Iter, false, _) -> - destroy_iter(Iter); -iter_names(NS, Prefix, Iter, true, Ping) -> - {More, #'CosNaming_Binding'{binding_name = Name, binding_type = Type}} = - 'CosNaming_BindingIterator':next_one(Iter), - Fun = fun(#'CosNaming_NameComponent'{id = Id, kind = Kind}, Acc) -> - case Kind of - "" -> Acc ++ Id ++ "/"; - _ -> Acc ++ Id ++ "." ++ Kind ++ "/" - end - end, - Prefix2 = lists:foldl(Fun, Prefix, Name), - if - More == false -> - ignore; - Type == nobject -> - Object = 'CosNaming_NamingContext':resolve(NS, Name), - Status = - case corba_object:is_remote(Object) of - false -> - corba_object:non_existent(Object); - _ when Ping == true -> - case catch corba_object:non_existent(Object) of - Boolean when is_atom(Boolean) -> - Boolean; - _Other -> - undefined - end; - _ -> - external - end, - io:format("~s [~p] ~s\n", - [Prefix2, Status, iop_ior:get_typeID(Object)]); - Type == ncontext -> - Context = 'CosNaming_NamingContext':resolve(NS, Name), - io:format("~s\n", [Prefix2]), - display_names(Context, Prefix2, Ping) - end, - iter_names(NS, Prefix, Iter, More, Ping). - -destroy_iter(Iter) -> - case corba_object:is_nil(Iter) of - false -> - 'CosNaming_BindingIterator':destroy(Iter), - ok; - true -> - ok - end. - -objectkeys() -> - ok. - - - -%%---------------- END OF MODULE ---------------------------------- diff --git a/lib/orber/src/orber_env.erl b/lib/orber/src/orber_env.erl deleted file mode 100644 index 3000af6cd3..0000000000 --- a/lib/orber/src/orber_env.erl +++ /dev/null @@ -1,1545 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: orber_env.erl -%% -%% Description: -%% Handling environment parameters for Orber. -%% -%% Creation date: 040723 -%% -%%----------------------------------------------------------------- --module(orber_env). - --behaviour(gen_server). - --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([start/1, configure/2, configure/3, configure_override/2, - multi_configure/1, get_env/1, set_env/2, get_keys/0, env/1, - info/0, info/1]). - --export([iiop_acl/0, iiop_port/0, nat_iiop_port/0, nat_iiop_port/1, iiop_out_ports/0, - domain/0, ip_address_variable_defined/0, nat_host/0, nat_host/1, host/0, - ip_address/0, ip_address/1, giop_version/0, iiop_timeout/0, iiop_out_ports_random/0, - iiop_connection_timeout/0, iiop_setup_connection_timeout/0, iiop_out_ports_attempts/0, - iiop_in_connection_timeout/0, iiop_max_fragments/0, iiop_max_in_requests/0, - iiop_max_in_connections/0, iiop_backlog/0, objectkeys_gc_time/0, - get_ORBInitRef/0, get_ORBDefaultInitRef/0, get_interceptors/0, - get_local_interceptors/0, get_cached_interceptors/0, - set_interceptors/1, is_lightweight/0, get_lightweight_nodes/0, secure/0, - iiop_ssl_backlog/0, iiop_ssl_port/0, nat_iiop_ssl_port/0, nat_iiop_ssl_port/1, - ssl_server_options/0, ssl_client_options/0, set_ssl_client_options/1, - ssl_server_certfile/0, ssl_client_certfile/0, set_ssl_client_certfile/1, - ssl_server_verify/0, ssl_client_verify/0, set_ssl_client_verify/1, - ssl_server_depth/0, ssl_client_depth/0, set_ssl_client_depth/1, - ssl_server_cacertfile/0, ssl_client_cacertfile/0, - set_ssl_client_cacertfile/1, ssl_client_password/0, - ssl_server_password/0, ssl_client_keyfile/0, ssl_server_keyfile/0, - ssl_client_ciphers/0, ssl_server_ciphers/0, ssl_client_cachetimeout/0, - ssl_server_cachetimeout/0, - get_flags/0, typechecking/0, - exclude_codeset_ctx/0, exclude_codeset_component/0, partial_security/0, - use_CSIv2/0, use_FT/0, ip_version/0, light_ifr/0, bidir_context/0, - get_debug_level/0, getaddrstr/2, addr2str/1, iiop_packet_size/0, - iiop_ssl_ip_address_local/0, ip_address_local/0, iiop_in_keepalive/0, - iiop_out_keepalive/0, iiop_ssl_in_keepalive/0, iiop_ssl_out_keepalive/0, - iiop_ssl_accept_timeout/0, ssl_generation/0]). - - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([init/1, terminate/2, handle_call/3]). --export([handle_cast/2, handle_info/2, code_change/3]). - -%%----------------------------------------------------------------- -%% Record Definitions Etc. -%%----------------------------------------------------------------- --define(DEBUG_LEVEL, 5). - --define(FORMAT(_F, _A), {error, lists:flatten(io_lib:format(_F, _A))}). --define(EFORMAT(_F, _A), exit(lists:flatten(io_lib:format(_F, _A)))). - --define(ENV_DB, orber_env_db). - --define(ENV_KEYS, - [flags, iiop_port, nat_iiop_port, iiop_out_ports, domain, ip_address, - nat_ip_address, giop_version, iiop_timeout, iiop_connection_timeout, - iiop_setup_connection_timeout, iiop_in_connection_timeout, iiop_acl, - iiop_max_fragments, iiop_max_in_requests, iiop_max_in_connections, - iiop_backlog, objectkeys_gc_time, orbInitRef, orbDefaultInitRef, - interceptors, local_interceptors, lightweight, ip_address_local, - secure, iiop_ssl_ip_address_local, iiop_ssl_backlog, - iiop_ssl_port, nat_iiop_ssl_port, ssl_server_certfile, - ssl_client_certfile, ssl_server_verify, ssl_client_verify, ssl_server_depth, - ssl_client_depth, ssl_server_cacertfile, ssl_client_cacertfile, - ssl_client_password, ssl_server_password, ssl_client_keyfile, - ssl_server_keyfile, ssl_client_ciphers, ssl_server_ciphers, - ssl_client_cachetimeout, ssl_server_cachetimeout, orber_debug_level, - iiop_packet_size, iiop_in_keepalive, iiop_out_keepalive, - iiop_ssl_in_keepalive, iiop_ssl_out_keepalive, iiop_ssl_accept_timeout, - ssl_server_options, ssl_client_options]). - -%% The 'flags' parameter must be first in the list. -%-define(ENV_KEYS, -% [{flags, ?ORB_ENV_INIT_FLAGS}, {iiop_port, 4001}, nat_iiop_port, -% {iiop_out_ports, 0}, {domain, "ORBER"}, ip_address, nat_ip_address, -% {giop_version, {1, 1}}, {iiop_timeout, infinity}, -% {iiop_connection_timeout, infinity}, {iiop_setup_connection_timeout, infinity}, -% {iiop_in_connection_timeout, infinity}, {iiop_acl, []}, -% {iiop_max_fragments, infinity}, {iiop_max_in_requests, infinity}, -% {iiop_max_in_connections, infinity}, {iiop_backlog, 5}, -% {objectkeys_gc_time, infinity}, -% {orbInitRef, undefined}, {orbDefaultInitRef, undefined}, -% {interceptors, false}, {local_interceptors, false}, {lightweight, false}, -% {secure, no}, {iiop_ssl_backlog, 5}, {iiop_ssl_port, 4002}, -% nat_iiop_ssl_port, {ssl_server_certfile, []}, {ssl_client_certfile, []}, -% {ssl_server_verify, 0}, {ssl_client_verify, 0}, {ssl_server_depth, 1}, -% {ssl_client_depth, 1}, {ssl_server_cacertfile, []}, -% {ssl_client_cacertfile, []}, {ssl_client_password, []}, -% {ssl_server_password, []}, {ssl_client_keyfile, []}, -% {ssl_server_keyfile, []}, {ssl_client_ciphers, []}, -% {ssl_server_ciphers, []}, {ssl_client_cachetimeout, infinity}, -% {ssl_server_cachetimeout, infinity}, {orber_debug_level, 0}]). - --record(parameters, {key, value, flags = 0}). - --record(env, {acl, parameters, flags = 0}). - - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% function : -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%----------------------------------------------------------------- -start(Opts) -> - gen_server:start_link({local, orber_env}, ?MODULE, Opts, []). - -%%----------------------------------------------------------------- -%% function : get_keys -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%----------------------------------------------------------------- -get_keys() -> - ?ENV_KEYS. - -%%----------------------------------------------------------------- -%% function : get_env -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%----------------------------------------------------------------- -get_env(Key) when is_atom(Key) -> - case catch ets:lookup(?ENV_DB, Key) of - [#parameters{value = Val}] -> - {ok, Val}; - _ -> - undefined - end. - -%%----------------------------------------------------------------- -%% function : get_env -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%----------------------------------------------------------------- -set_env(Key, Value) when is_atom(Key) -> - case catch ets:insert(?ENV_DB, #parameters{key = Key, value = Value}) of - true -> - ok; - _ -> - undefined - end. - - -%%----------------------------------------------------------------- -%% function : info -%% Arguments: IoDervice - info_msg | string | io | {io, Dev} -%% Returns : -%% Exception: -%% Effect : -%%----------------------------------------------------------------- -info() -> - info(info_msg). - -info(IoDevice) -> - Info = - case orber_tb:is_running() of - true -> - Info1 = create_main_info(), - Info2 = create_flag_info(Info1), - create_security_info(secure(), Info2); - _ -> - lists:flatten( - io_lib:format("======= Orber Execution Environment ======~n" - " *** Orber is not running ***~n" - "==========================================~n", - [])) - end, - case IoDevice of - info_msg -> - error_logger:info_msg(Info); - string -> - Info; - io -> - io:format("~s", [Info]); - {io, Dev} -> - io:format(Dev, "~s", [Info]); - _ -> - exit("Bad parameter") - end. - -create_main_info() -> - {Major, Minor} = giop_version(), - {orber, _, OrberVsn} = lists:keyfind(orber, 1, application:loaded_applications()), - [io_lib:format("======= Orber Execution Environment ======~n" - "Orber version.................: ~s~n" - "Orber domain..................: ~s~n" - "IIOP port number..............: ~p~n" - "IIOP NAT port number..........: ~p~n" - "Interface(s)..................: ~p~n" - "Interface(s) NAT..............: ~p~n" - "Local Interface (default).....: ~p~n" - "Nodes in domain...............: ~p~n" - "GIOP version (default)........: ~p.~p~n" - "IIOP out timeout..............: ~p msec~n" - "IIOP out connection timeout...: ~p msec~n" - "IIOP setup connection timeout.: ~p msec~n" - "IIOP out ports................: ~p~n" - "IIOP out ports attempts.......: ~p~n" - "IIOP out ports random.........: ~p~n" - "IIOP out connections..........: ~p~n" - "IIOP out connections (pending): ~p~n" - "IIOP out keepalive............: ~p~n" - "IIOP in connections...........: ~p~n" - "IIOP in connection timeout....: ~p msec~n" - "IIOP in keepalive.............: ~p~n" - "IIOP max fragments............: ~p~n" - "IIOP max in requests..........: ~p~n" - "IIOP max in connections.......: ~p~n" - "IIOP backlog..................: ~p~n" - "IIOP ACL......................: ~p~n" - "IIOP maximum packet size......: ~p~n" - "Object Keys GC interval.......: ~p~n" - "Using Interceptors............: ~p~n" - "Using Local Interceptors......: ~p~n" - "Debug Level...................: ~p~n" - "orbInitRef....................: ~p~n" - "orbDefaultInitRef.............: ~p~n", - [OrberVsn, domain(), iiop_port(), nat_iiop_port(), host(), - nat_host(), ip_address_local(), - orber:orber_nodes(), Major, Minor, - iiop_timeout(), iiop_connection_timeout(), - iiop_setup_connection_timeout(), iiop_out_ports(), - iiop_out_ports_attempts(), iiop_out_ports_random(), - orber:iiop_connections(out), orber:iiop_connections_pending(), - iiop_out_keepalive(), orber:iiop_connections(in), - iiop_in_connection_timeout(), iiop_in_keepalive(), - iiop_max_fragments(), iiop_max_in_requests(), - iiop_max_in_connections(), iiop_backlog(), iiop_acl(), - iiop_packet_size(), objectkeys_gc_time(), get_interceptors(), - get_local_interceptors(), get_debug_level(), get_ORBInitRef(), - get_ORBDefaultInitRef()])]. - -create_flag_info(Info) -> - case get_flags() of - ?ORB_ENV_INIT_FLAGS -> - [Info, "System Flags Set..............: -\n"]; - Flags -> - FlagData = check_flags(?ORB_ENV_FLAGS, Flags, []), - [Info, "System Flags Set..............: \n", FlagData, "\n"] - end. - -check_flags([], _, Acc) -> - Acc; -check_flags([{Flag, Txt}|T], Flags, Acc) when ?ORB_FLAG_TEST(Flags, Flag) -> - check_flags(T, Flags, [" - ", Txt, "\n"|Acc]); -check_flags([_|T], Flags, Acc) -> - check_flags(T, Flags, Acc). - - -create_security_info(no, Info) -> - lists:flatten([Info, "=========================================\n"]); -create_security_info(ssl, Info) -> - lists:flatten([Info, - io_lib:format("ORB security..................: ssl~n" - "SSL generation................: ~p~n" - "SSL IIOP in keepalive.........: ~p~n" - "SSL IIOP out keepalive........: ~p~n" - "SSL IIOP port number..........: ~p~n" - "SSL IIOP NAT port number......: ~p~n" - "SSL IIOP accept timeout.......: ~p~n" - "SSL IIOP backlog..............: ~p~n" - "SSL IIOP Local Interface......: ~p~n" - "SSL server options............: ~p~n" - "SSL server certfile...........: ~p~n" - "SSL server verification type..: ~p~n" - "SSL server verification depth.: ~p~n" - "SSL server cacertfile.........: ~p~n" - "SSL server keyfile............: ~p~n" - "SSL server password...........: ~p~n" - "SSL server ciphers............: ~p~n" - "SSL server cachetimeout.......: ~p~n" - "SSL client options............: ~p~n" - "SSL client certfile...........: ~p~n" - "SSL client verification type..: ~p~n" - "SSL client verification depth.: ~p~n" - "SSL client cacertfile.........: ~p~n" - "SSL client keyfile............: ~p~n" - "SSL client password...........: ~p~n" - "SSL client ciphers............: ~p~n" - "SSL client cachetimeout.......: ~p~n" - "=========================================~n", - [ssl_generation(), iiop_ssl_port(), - iiop_ssl_in_keepalive(), iiop_ssl_out_keepalive(), - nat_iiop_ssl_port(), iiop_ssl_accept_timeout(), - iiop_ssl_backlog(), iiop_ssl_ip_address_local(), - ssl_server_options(), - ssl_server_certfile(), ssl_server_verify(), - ssl_server_depth(), ssl_server_cacertfile(), - ssl_server_keyfile(), ssl_server_password(), - ssl_server_ciphers(), ssl_server_cachetimeout(), - ssl_client_options(), - ssl_client_certfile(), ssl_client_verify(), - ssl_client_depth(), ssl_client_cacertfile(), - ssl_client_keyfile(), ssl_client_password(), - ssl_client_ciphers(), ssl_client_cachetimeout()])]). - - -%%----------------------------------------------------------------- -%% function : iiop_acl -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%----------------------------------------------------------------- -iiop_acl() -> - case application:get_env(orber, iiop_acl) of - {ok, ACL} when is_list(ACL) -> - ACL; - _ -> - [] - end. - -iiop_packet_size() -> - case application:get_env(orber, iiop_packet_size) of - {ok, Max} when is_integer(Max) andalso Max > 0 -> - Max; - _ -> - infinity - end. - - -iiop_port() -> - case application:get_env(orber, iiop_port) of - {ok, Port} when is_integer(Port) andalso Port >= 0 -> - Port; - _ -> - 4001 - end. - -nat_iiop_port() -> - case application:get_env(orber, nat_iiop_port) of - {ok, Port} when is_integer(Port) andalso Port > 0 -> - Port; - {ok, {local, Default, _NATList}} -> - Default; - _ -> - iiop_port() - end. - -nat_iiop_port(LocalPort) -> - case application:get_env(orber, nat_iiop_port) of - {ok, Port} when is_integer(Port) andalso Port > 0 -> - Port; - {ok, {local, Default, NATList}} -> - orber_tb:keysearch(LocalPort, NATList, Default); - _ -> - iiop_port() - end. - -iiop_out_ports() -> - case application:get_env(orber, iiop_out_ports) of - {ok, {Min, Max}} when is_integer(Min) andalso is_integer(Max) andalso Min =< Max -> - {Min, Max}; - {ok, {Max, Min}} when is_integer(Min) andalso is_integer(Max) andalso Min < Max -> - {Min, Max}; - _ -> - 0 - end. - -iiop_out_ports_random() -> - case application:get_env(orber, iiop_out_ports_random) of - {ok, true} -> - true; - _ -> - false - end. - -iiop_out_ports_attempts() -> - case application:get_env(orber, iiop_out_ports_attempts) of - {ok, No} when is_integer(No) andalso No > 0 -> - No; - _ -> - 1 - end. - - -domain() -> - case application:get_env(orber, domain) of - {ok, Domain} when is_list(Domain) -> - Domain; - {ok, Domain} when is_atom(Domain) -> - atom_to_list(Domain); - _ -> - "ORBER" - end. - -ip_address_variable_defined() -> - case application:get_env(orber, ip_address) of - undefined -> - false; - {ok,{multiple, _}} -> - false; - _ -> - [Host] = host(), - Host - end. - -nat_host() -> - case application:get_env(orber, nat_ip_address) of - {ok,I} when is_list(I) -> - [I]; - {ok,{multiple, [I|_] = IList}} when is_list(I) -> - IList; - {ok,{local, Default, _NATList}} -> - [Default]; - _ -> - host() - end. - -nat_host([Host]) -> - case application:get_env(orber, nat_ip_address) of - {ok,I} when is_list(I) -> - [I]; - {ok,{multiple, [I|_] = IList}} when is_list(I) -> - IList; - {ok,{local, Default, NATList}} -> - [orber_tb:keysearch(Host, NATList, Default)]; - _ -> - host() - end. - - -host() -> - case application:get_env(orber, ip_address) of - {ok,I} when is_list(I) -> - [I]; - {ok,{multiple, [I|_] = IList}} when is_list(I) -> - IList; - %% IPv4. For IPv6 we only accept a string, but we must support this format - %% for IPv4 - {ok, {A1, A2, A3, A4}} when is_integer(A1+A2+A3+A4) -> - [integer_to_list(A1) ++ "." ++ integer_to_list(A2) ++ "." ++ integer_to_list(A3) - ++ "." ++ integer_to_list(A4)]; - _ -> - Flags = get_flags(), - case ?ORB_FLAG_TEST(Flags, ?ORB_ENV_HOSTNAME_IN_IOR) of - true -> - {ok, Hostname} = inet:gethostname(), - [Hostname]; - _ -> - case ?ORB_FLAG_TEST(Flags, ?ORB_ENV_USE_IPV6) of - false -> - [ip_address(inet)]; - true -> - [ip_address(inet6)] - end - end - end. - -ip_address_local() -> - case application:get_env(orber, ip_address_local) of - {ok,I} when is_list(I) -> - [I]; - _ -> - [] - end. - - -ip_address() -> - ip_address(ip_version()). - -ip_address(inet) -> - {ok, Hostname} = inet:gethostname(), - {ok, {A1, A2, A3, A4}} = inet:getaddr(Hostname, inet), - integer_to_list(A1) ++ "." ++ integer_to_list(A2) ++ "." ++ integer_to_list(A3) - ++ "." ++ integer_to_list(A4); -ip_address(inet6) -> - {ok, Hostname} = inet:gethostname(), - {ok, {A1, A2, A3, A4, A5, A6, A7, A8}} = inet:getaddr(Hostname, inet6), - int16_to_hex(A1) ++ ":" ++int16_to_hex(A2) ++ ":" ++ - int16_to_hex(A3) ++ ":" ++ int16_to_hex(A4) ++ ":" ++ - int16_to_hex(A5) ++ ":" ++ int16_to_hex(A6) ++ ":" ++ - int16_to_hex(A7) ++ ":" ++ int16_to_hex(A8). - -getaddrstr(Hostname, inet) -> - {ok, {A1, A2, A3, A4}} = inet:getaddr(Hostname, inet), - integer_to_list(A1) ++ "." ++ integer_to_list(A2) ++ "." ++ integer_to_list(A3) - ++ "." ++ integer_to_list(A4); -getaddrstr(Hostname, inet6) -> - {ok, {A1, A2, A3, A4, A5, A6, A7, A8}} = inet:getaddr(Hostname, inet6), - int16_to_hex(A1) ++ ":" ++int16_to_hex(A2) ++ ":" ++ - int16_to_hex(A3) ++ ":" ++ int16_to_hex(A4) ++ ":" ++ - int16_to_hex(A5) ++ ":" ++ int16_to_hex(A6) ++ ":" ++ - int16_to_hex(A7) ++ ":" ++ int16_to_hex(A8). - -addr2str({A1, A2, A3, A4}) -> - integer_to_list(A1) ++ "." ++ integer_to_list(A2) ++ "." ++ integer_to_list(A3) - ++ "." ++ integer_to_list(A4); -addr2str({A1, A2, A3, A4, A5, A6, A7, A8}) -> - int16_to_hex(A1) ++ ":" ++int16_to_hex(A2) ++ ":" ++ - int16_to_hex(A3) ++ ":" ++ int16_to_hex(A4) ++ ":" ++ - int16_to_hex(A5) ++ ":" ++ int16_to_hex(A6) ++ ":" ++ - int16_to_hex(A7) ++ ":" ++ int16_to_hex(A8). - - -int16_to_hex(0) -> - [$0]; -int16_to_hex(I) -> - N1 = ((I bsr 8) band 16#ff), - N2 = (I band 16#ff), - [code_character(N1 div 16), code_character(N1 rem 16), - code_character(N2 div 16), code_character(N2 rem 16)]. - -code_character(N) when N < 10 -> - $0 + N; -code_character(N) -> - $A + (N - 10). - -giop_version() -> - case application:get_env(orber, giop_version) of - {ok, {Major, Minor}} -> - {Major, Minor}; - _ -> - {1, 1} - end. - -iiop_timeout() -> - case application:get_env(orber, iiop_timeout) of - {ok, Int} when is_integer(Int) -> - if - Int > 1000000 -> - error_logger:error_msg("Orber 'iiop_timeout' badly configured.~n" - "Time to large (>1000000 sec), swithed to 'infinity'~n"), - infinity; - true -> - %% Convert to msec. - Int*1000 - end; - _ -> - infinity - end. - -iiop_connection_timeout() -> - case application:get_env(orber, iiop_connection_timeout) of - {ok, Int} when is_integer(Int) -> - if - Int > 1000000 -> - error_logger:error_msg("Orber 'iiop_connection_timeout' badly configured.~n" - "Time to large (>1000000 sec), swithed to 'infinity'~n"), - infinity; - true -> - %% Convert to msec. - Int*1000 - end; - _ -> - infinity - end. - -iiop_setup_connection_timeout() -> - case application:get_env(orber, iiop_setup_connection_timeout) of - {ok, Int} when is_integer(Int) -> - %% Convert to msec. - Int*1000; - _ -> - infinity - end. - -iiop_in_connection_timeout() -> - case application:get_env(orber, iiop_in_connection_timeout) of - {ok, Int} when is_integer(Int) -> - if - Int > 1000000 -> - error_logger:error_msg("Orber 'iiop_connection_timeout' badly configured.~n" - "Time to large (>1000000 sec), swithed to 'infinity'~n"), - infinity; - true -> - %% Convert to msec. - Int*1000 - end; - _ -> - infinity - end. - -iiop_max_fragments() -> - case application:get_env(orber, iiop_max_fragments) of - {ok, Max} when is_integer(Max) andalso Max > 0 -> - Max; - _ -> - infinity - end. - -iiop_max_in_requests() -> - case application:get_env(orber, iiop_max_in_requests) of - {ok, Max} when is_integer(Max) andalso Max > 0 -> - Max; - _ -> - infinity - end. - -iiop_max_in_connections() -> - case application:get_env(orber, iiop_max_in_connections) of - {ok, Max} when is_integer(Max) andalso Max > 0 -> - Max; - _ -> - infinity - end. - -iiop_backlog() -> - case application:get_env(orber, iiop_backlog) of - {ok, Int} when is_integer(Int) andalso Int >= 0 -> - Int; - _ -> - 5 - end. - -iiop_in_keepalive() -> - case application:get_env(orber, iiop_in_keepalive) of - {ok, true} -> - true; - _ -> - false - end. - -iiop_out_keepalive() -> - case application:get_env(orber, iiop_out_keepalive) of - {ok, true} -> - true; - _ -> - false - end. - - - -get_flags() -> - case get(oe_orber_flags) of - undefined -> - case application:get_env(orber, flags) of - undefined -> - put(oe_orber_flags, ?ORB_ENV_INIT_FLAGS), - ?ORB_ENV_INIT_FLAGS; - {ok, Flags} -> - put(oe_orber_flags, Flags), - Flags - end; - Flags when is_integer(Flags) -> - Flags - end. - -typechecking() -> - ?ORB_FLAG_TEST(get_flags(), ?ORB_ENV_LOCAL_TYPECHECKING). - -exclude_codeset_ctx() -> - ?ORB_FLAG_TEST(get_flags(), ?ORB_ENV_EXCLUDE_CODESET_CTX). - -exclude_codeset_component() -> - ?ORB_FLAG_TEST(get_flags(), ?ORB_ENV_EXCLUDE_CODESET_COMPONENT). - -partial_security() -> - ?ORB_FLAG_TEST(get_flags(), ?ORB_ENV_PARTIAL_SECURITY). - -use_CSIv2() -> - ?ORB_FLAG_TEST(get_flags(), ?ORB_ENV_USE_CSIV2). - -use_FT() -> - ?ORB_FLAG_TEST(get_flags(), ?ORB_ENV_USE_FT). - -ip_version() -> - case ?ORB_FLAG_TEST(get_flags(), ?ORB_ENV_USE_IPV6) of - false -> - inet; - true -> - inet6 - end. - -light_ifr() -> - ?ORB_FLAG_TEST(get_flags(), ?ORB_ENV_LIGHT_IFR). - -bidir_context() -> - Flags = get_flags(), - if - ?ORB_FLAG_TEST(Flags, ?ORB_ENV_USE_BI_DIR_IIOP) -> - [#'IOP_ServiceContext' - {context_id=?IOP_BI_DIR_IIOP, - context_data = - #'IIOP_BiDirIIOPServiceContext'{listen_points = - [#'IIOP_ListenPoint'{host=host(), - port=iiop_port()}]}}]; - true -> - [] - end. - -objectkeys_gc_time() -> - case application:get_env(orber, objectkeys_gc_time) of - {ok, Int} when is_integer(Int) -> - if - Int > 1000000 -> - error_logger:error_msg("Orber 'objectkeys_gc_time' badly configured.~n" - "Time to large (>1000000 sec), swithed to 'infinity'~n"), - infinity; - true -> - Int - end; - _ -> - infinity - end. - -get_ORBInitRef() -> - case application:get_env(orber, orbInitRef) of - {ok, Ref} when is_list(Ref) -> - Ref; - _ -> - undefined - end. - -get_ORBDefaultInitRef() -> - case application:get_env(orber, orbDefaultInitRef) of - {ok, Ref} when is_list(Ref) -> - Ref; - _ -> - undefined - end. - -get_debug_level() -> - case application:get_env(orber, orber_debug_level) of - {ok, Level} when is_integer(Level) -> - Level; - _ -> - 0 - end. - - -%%----------------------------------------------------------------- -%% Interceptor opertaions (see orber_pi.erl) -%%----------------------------------------------------------------- -get_interceptors() -> - case application:get_env(orber, interceptors) of - {ok, {native, PIs}} when is_list(PIs) -> - {native, PIs}; - {ok, {portable, PIs}} when is_list(PIs) -> - {portable, PIs}; - _ -> - false - end. - -get_local_interceptors() -> - case application:get_env(orber, local_interceptors) of - {ok, {native, PIs}} when is_list(PIs) -> - {native, PIs}; - {ok, {portable, PIs}} when is_list(PIs) -> - {portable, PIs}; - _ -> - false - end. - - -get_cached_interceptors() -> - case get(oe_orber_interceptor_cache) of - undefined -> - PIs = case application:get_env(orber, local_interceptors) of - {ok, {native, LPIs}} when is_list(LPIs) -> - {native, LPIs}; - {ok, {portable, LPIs}} when is_list(LPIs) -> - {portable, LPIs}; - _ -> - get_interceptors() - end, - put(oe_orber_interceptor_cache, PIs), - PIs; - PIs -> - PIs - end. - - -set_interceptors({Type, InterceptorList}) when is_list(InterceptorList) -> - configure(interceptors, {Type, InterceptorList}); -set_interceptors(_) -> - exit({error, "Usage: {Type, ModuleList}"}). - - -%%----------------------------------------------------------------- -%% Light weight Orber operations -%%----------------------------------------------------------------- -is_lightweight() -> - case application:get_env(orber, lightweight) of - {ok, L} when is_list(L) -> - true; - _ -> - false - end. -get_lightweight_nodes() -> - case application:get_env(orber, lightweight) of - {ok, L} when is_list(L) -> - L; - _ -> - false - end. - - -%%----------------------------------------------------------------- -%% Security access operations (SSL) -%%----------------------------------------------------------------- -secure() -> - case application:get_env(orber, secure) of - {ok, V} -> - V; - _ -> - no - end. - -ssl_generation() -> - case application:get_env(orber, ssl_generation) of - {ok, V} -> - V; - _ -> - 2 - end. - -iiop_ssl_ip_address_local() -> - case application:get_env(orber, iiop_ssl_ip_address_local) of - {ok,I} when is_list(I) -> - [I]; - _ -> - [] - end. - -iiop_ssl_backlog() -> - case application:get_env(orber, iiop_ssl_backlog) of - {ok, Int} when is_integer(Int), Int >= 0 -> - Int; - _ -> - 5 - end. - -iiop_ssl_in_keepalive() -> - case application:get_env(orber, iiop_ssl_in_keepalive) of - {ok, true} -> - true; - _ -> - false - end. - -iiop_ssl_out_keepalive() -> - case application:get_env(orber, iiop_ssl_out_keepalive) of - {ok, true} -> - true; - _ -> - false - end. - -iiop_ssl_accept_timeout() -> - case application:get_env(orber, iiop_ssl_accept_timeout) of - {ok, N} when is_integer(N) -> - N * 1000; - _ -> - infinity - end. - -iiop_ssl_port() -> - case application:get_env(orber, secure) of - {ok, ssl} -> - case application:get_env(orber, iiop_ssl_port) of - {ok, Port} when is_integer(Port) -> - Port; - _ -> - 4002 - end; - _ -> - -1 - end. - -nat_iiop_ssl_port() -> - case application:get_env(orber, secure) of - {ok, ssl} -> - case application:get_env(orber, nat_iiop_ssl_port) of - {ok, Port} when is_integer(Port) andalso Port > 0 -> - Port; - {ok, {local, Default, _NATList}} -> - Default; - _ -> - iiop_ssl_port() - end; - _ -> - -1 - end. - -nat_iiop_ssl_port(LocalPort) -> - case application:get_env(orber, secure) of - {ok, ssl} -> - case application:get_env(orber, nat_iiop_ssl_port) of - {ok, Port} when is_integer(Port) andalso Port > 0 -> - Port; - {ok, {local, Default, NATList}} -> - orber_tb:keysearch(LocalPort, NATList, Default); - _ -> - iiop_ssl_port() - end; - _ -> - -1 - end. - -ssl_server_options() -> - case application:get_env(orber, ssl_server_options) of - {ok, V1} when is_list(V1) -> - V1; - _ -> - [] - end. - -ssl_client_options() -> - case application:get_env(orber, ssl_client_options) of - {ok, V1} when is_list(V1) -> - V1; - _ -> - [] - end. - -check_ssl_opts(Value) -> - check_ssl_opts(Value, []). -check_ssl_opts([], []) -> - ok; -check_ssl_opts([], Acc) -> - {error, Acc}; -check_ssl_opts([{active, _} |T], Acc) -> - check_ssl_opts(T, [active |Acc]); -check_ssl_opts([{packet, _} |T], Acc) -> - check_ssl_opts(T, [packet |Acc]); -check_ssl_opts([{mode, _} |T], Acc) -> - check_ssl_opts(T, [mode |Acc]); -check_ssl_opts([list |T], Acc) -> - check_ssl_opts(T, [list |Acc]); -check_ssl_opts([binary |T], Acc) -> - check_ssl_opts(T, [binary |Acc]); -check_ssl_opts([_ |T], Acc) -> - check_ssl_opts(T, Acc). - -set_ssl_client_options(Value) when is_list(Value) -> - case check_ssl_opts(Value) of - ok -> - ok; - {error, List} -> - exit(lists:flatten( - io_lib:format("TCP options ~p is not allowed in set_ssl_client_options()", - [List]))) - end, - put(ssl_client_options, Value), ok. - -ssl_server_certfile() -> - case application:get_env(orber, ssl_server_certfile) of - {ok, V1} when is_list(V1) -> - V1; - {ok, V2} when is_atom(V2) -> - atom_to_list(V2); - _ -> - [] - end. - -ssl_client_certfile() -> - case get(ssl_client_certfile) of - undefined -> - case application:get_env(orber, ssl_client_certfile) of - {ok, V1} when is_list(V1) -> - V1; - {ok, V2} when is_atom(V2) -> - atom_to_list(V2); - _ -> - [] - end; - V -> - V - end. - -set_ssl_client_certfile(Value) when is_list(Value) -> - put(ssl_client_certfile, Value). - -ssl_server_verify() -> - Verify = case application:get_env(orber, ssl_server_verify) of - {ok, V} when is_integer(V) -> - V; - _ -> - 0 - end, - if - Verify =< 2, Verify >= 0 -> - Verify; - true -> - 0 - end. - -ssl_client_verify() -> - Verify = case get(ssl_client_verify) of - undefined -> - case application:get_env(orber, ssl_client_verify) of - {ok, V1} when is_integer(V1) -> - V1; - _ -> - 0 - end; - V2 -> - V2 - end, - if - Verify =< 2, Verify >= 0 -> - Verify; - true -> - 0 - end. - -set_ssl_client_verify(Value) when is_integer(Value) andalso Value =< 2 andalso Value >= 0 -> - put(ssl_client_verify, Value), ok. - -ssl_server_depth() -> - case application:get_env(orber, ssl_server_depth) of - {ok, V1} when is_integer(V1) -> - V1; - _ -> - 1 - end. - -ssl_client_depth() -> - case get(ssl_client_depth) of - undefined -> - case application:get_env(orber, ssl_client_depth) of - {ok, V1} when is_integer(V1) -> - V1; - _ -> - 1 - end; - V2 -> - V2 - end. - -set_ssl_client_depth(Value) when is_integer(Value) -> - put(ssl_client_depth, Value), ok. - - - -ssl_server_cacertfile() -> - case application:get_env(orber, ssl_server_cacertfile) of - {ok, V1} when is_list(V1) -> - V1; - {ok, V2} when is_atom(V2) -> - atom_to_list(V2); - _ -> - [] - end. - -ssl_client_cacertfile() -> - case get(ssl_client_cacertfile) of - undefined -> - case application:get_env(orber, ssl_client_cacertfile) of - {ok, V1} when is_list(V1) -> - V1; - {ok, V2} when is_atom(V2) -> - atom_to_list(V2); - _ -> - [] - end; - V3 -> - V3 - end. - -set_ssl_client_cacertfile(Value) when is_list(Value) -> - put(ssl_client_cacertfile, Value), ok. - - -ssl_client_password() -> - case application:get_env(orber, ssl_client_password) of - {ok, V1} when is_list(V1) -> - V1; - _ -> - [] - end. - -ssl_server_password() -> - case application:get_env(orber, ssl_server_password) of - {ok, V1} when is_list(V1) -> - V1; - _ -> - [] - end. - -ssl_client_keyfile() -> - case application:get_env(orber, ssl_client_keyfile) of - {ok, V1} when is_list(V1) -> - V1; - _ -> - [] - end. - -ssl_server_keyfile() -> - case application:get_env(orber, ssl_server_keyfile) of - {ok, V1} when is_list(V1) -> - V1; - _ -> - [] - end. - -ssl_client_ciphers() -> - case application:get_env(orber, ssl_client_ciphers) of - {ok, V1} when is_list(V1) -> - V1; - _ -> - [] - end. - -ssl_server_ciphers() -> - case application:get_env(orber, ssl_server_ciphers) of - {ok, V1} when is_list(V1) -> - V1; - _ -> - [] - end. - -ssl_client_cachetimeout() -> - case application:get_env(orber, ssl_client_cachetimeout) of - {ok, V1} when is_integer(V1) -> - V1; - _ -> - infinity - end. - -ssl_server_cachetimeout() -> - case application:get_env(orber, ssl_server_cachetimeout) of - {ok, V1} when is_integer(V1) -> - V1; - _ -> - infinity - end. - -%%----------------------------------------------------------------- -%% function : configure -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%----------------------------------------------------------------- -configure(Key, Value) when is_atom(Key) -> - configure(Key, Value, check); -configure(Key, _) -> - ?EFORMAT("Given key (~p) not an atom.", [Key]). - -configure_override(Key, Value) when is_atom(Key) -> - configure(Key, Value, loaded); -configure_override(Key, _) -> - ?EFORMAT("Given key (~p) not an atom.", [Key]). - -%%----------------------------------------------------------------- -%% function : multi_configure -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%----------------------------------------------------------------- -multi_configure(KeyValueList) when is_list(KeyValueList) -> - case orber_tb:is_loaded() of - false -> - application:load(orber), - multi_configure_helper(KeyValueList, loaded); - true -> - case orber_tb:is_running() of - false -> - multi_configure_helper(KeyValueList, loaded); - true -> - multi_configure_helper(KeyValueList, running) - end - end; -multi_configure(KeyValueList) -> - ?EFORMAT("Given configuration parameters not a Key-Value-pair list: ~p", - [KeyValueList]). - -multi_configure_helper([], _) -> - ok; -multi_configure_helper([{Key, Value}|T], Status) -> - configure(Key, Value, Status), - multi_configure_helper(T, Status); -multi_configure_helper([What|_], _) -> - ?EFORMAT("Incorrect configuration parameters supplied: ~p", [What]). - - -%%------ Keys we can update at any time ----- -%% Initial Services References -configure(orbDefaultInitRef, String, Status) when is_list(String) -> - do_configure(orbDefaultInitRef, String, Status); -configure(orbDefaultInitRef, undefined, Status) -> - do_configure(orbDefaultInitRef, undefined, Status); -configure(orbInitRef, String, Status) when is_list(String) -> - do_configure(orbInitRef, String, Status); -configure(orbInitRef, undefined, Status) -> - do_configure(orbInitRef, undefined, Status); -%% IIOP-version -configure(giop_version, {1, 0}, Status) -> - do_configure(giop_version, {1, 0}, Status); -configure(giop_version, {1, 1}, Status) -> - do_configure(giop_version, {1, 1}, Status); -configure(giop_version, {1, 2}, Status) -> - do_configure(giop_version, {1, 2}, Status); -%% configure 'iiop_timout' will only have effect on new requests. -configure(iiop_timeout, infinity, Status) -> - do_configure(iiop_timeout, infinity, Status); -configure(iiop_timeout, Value, Status) when is_integer(Value) andalso Value =< 1000000 -> - do_configure(iiop_timeout, Value, Status); -%% Backlog -configure(iiop_backlog, Value, Status) when is_integer(Value) andalso Value >= 0 -> - do_configure(iiop_backlog, Value, Status); -%% configure 'iiop_in_keepalive' will only have effect on new connections. -configure(iiop_in_keepalive, true, Status) -> - do_configure(iiop_in_keepalive, true, Status); -configure(iiop_in_keepalive, false, Status) -> - do_configure(iiop_in_keepalive, false, Status); -%% configure 'iiop_out_keepalive' will only have effect on new connections. -configure(iiop_out_keepalive, true, Status) -> - do_configure(iiop_out_keepalive, true, Status); -configure(iiop_out_keepalive, false, Status) -> - do_configure(iiop_out_keepalive, false, Status); -%% configure 'iiop_connection_timout' will only have effect on new connections. -configure(iiop_connection_timeout, infinity, Status) -> - do_configure(iiop_connection_timeout, infinity, Status); -configure(iiop_connection_timeout, Value, Status) when is_integer(Value) andalso Value =< 1000000 -> - do_configure(iiop_connection_timeout, Value, Status); -%% configure 'iiop_in_connection_timout' will only have effect on new connections. -configure(iiop_in_connection_timeout, infinity, Status) -> - do_configure(iiop_in_connection_timeout, infinity, Status); -configure(iiop_in_connection_timeout, Value, Status) when is_integer(Value) andalso Value =< 1000000 -> - do_configure(iiop_in_connection_timeout, Value, Status); -%% configure 'iiop_setup_connection_timeout' will only have effect on new connections. -configure(iiop_setup_connection_timeout, infinity, Status) -> - do_configure(iiop_setup_connection_timeout, infinity, Status); -configure(iiop_setup_connection_timeout, Value, Status) when is_integer(Value) -> - do_configure(iiop_setup_connection_timeout, Value, Status); -%% configure 'iiop_max_fragments' will only have effect on new connections. -configure(iiop_max_fragments, infinity, Status) -> - do_configure(iiop_max_fragments, infinity, Status); -configure(iiop_max_fragments, Value, Status) when is_integer(Value) andalso Value > 0 -> - do_configure(iiop_max_fragments, Value, Status); -%% configure 'iiop_max_in_requests' will only have effect on new connections. -configure(iiop_max_in_requests, infinity, Status) -> - do_configure(iiop_max_in_requests, infinity, Status); -configure(iiop_max_in_requests, Value, Status) when is_integer(Value) andalso Value > 0 -> - do_configure(iiop_max_in_requests, Value, Status); -%% configure 'iiop_max_in_connections' will only have effect on new connections. -configure(iiop_max_in_connections, infinity, Status) -> - do_configure(iiop_max_in_connections, infinity, Status); -configure(iiop_max_in_connections, Value, Status) when is_integer(Value) andalso Value > 0 -> - do_configure(iiop_max_in_connections, Value, Status); -%% Garbage Collect the object keys DB. -configure(objectkeys_gc_time, infinity, Status) -> - do_configure(objectkeys_gc_time, infinity, Status); -configure(objectkeys_gc_time, Value, Status) when is_integer(Value) andalso Value =< 1000000 -> - do_configure(objectkeys_gc_time, Value, Status); -%% Orber debug printouts -configure(orber_debug_level, Value, Status) when is_integer(Value) -> - do_configure(orber_debug_level, Value, Status); - -%%------ Keys we cannot change if Orber is running ----- -%% Set the listen port -configure(iiop_port, Value, Status) when is_integer(Value) -> - do_safe_configure(iiop_port, Value, Status); -%% Set the NAT listen port -configure(nat_iiop_port, Value, Status) when is_integer(Value) andalso Value > 0 -> - do_safe_configure(nat_iiop_port, Value, Status); -configure(nat_iiop_port, {local, Value1, Value2}, Status) when is_integer(Value1) andalso - Value1 > 0 andalso - is_list(Value2) -> - do_safe_configure(nat_iiop_port, {local, Value1, Value2}, Status); -%% Set Maximum Packet Size -configure(iiop_packet_size, Max, Status) when is_integer(Max) andalso Max > 0 -> - do_safe_configure(iiop_packet_size, Max, Status); -%% IIOP interceptors -configure(interceptors, Value, Status) when is_tuple(Value) -> - do_safe_configure(interceptors, Value, Status); -%% Local interceptors -configure(local_interceptors, Value, Status) when is_tuple(Value) -> - do_safe_configure(local_interceptors, Value, Status); -%% Orber Domain -configure(domain, Value, Status) when is_list(Value) -> - do_safe_configure(domain, Value, Status); -%% Set the IP-address we should use -configure(ip_address, Value, Status) when is_list(Value) -> - do_safe_configure(ip_address, Value, Status); -configure(ip_address, {multiple, Value}, Status) when is_list(Value) -> - do_safe_configure(ip_address, {multiple, Value}, Status); -configure(ip_address_local, Value, Status) when is_list(Value) -> - do_safe_configure(ip_address_local, Value, Status); -%% Set the NAT IP-address we should use -configure(nat_ip_address, Value, Status) when is_list(Value) -> - do_safe_configure(nat_ip_address, Value, Status); -configure(nat_ip_address, {multiple, Value}, Status) when is_list(Value) -> - do_safe_configure(nat_ip_address, {multiple, Value}, Status); -configure(nat_ip_address, {local, Value1, Value2}, Status) when is_list(Value1) andalso - is_list(Value2) -> - do_safe_configure(nat_ip_address, {local, Value1, Value2}, Status); -%% Set the range of ports we may use on this machine when connecting to a server. -configure(iiop_out_ports, {Min, Max}, Status) when is_integer(Min) andalso is_integer(Max) -> - do_safe_configure(iiop_out_ports, {Min, Max}, Status); -configure(iiop_out_ports_attempts, Max, Status) when is_integer(Max) andalso Max > 0 -> - do_safe_configure(iiop_out_ports_attempts, Max, Status); -configure(iiop_out_ports_random, true, Status) -> - do_safe_configure(iiop_out_ports_random, true, Status); -configure(iiop_out_ports_random, false, Status) -> - do_safe_configure(iiop_out_ports_random, false, Status); -%% Set the lightweight option. -configure(lightweight, Value, Status) when is_list(Value) -> - do_safe_configure(lightweight, Value, Status); -%% Configre the System Flags -configure(flags, Value, Status) when is_integer(Value) -> - do_safe_configure(flags, Value, Status); -%% Configre the ACL -configure(iiop_acl, Value, Status) when is_list(Value) -> - do_safe_configure(iiop_acl, Value, Status); - -%% SSL settings -%% configure 'iiop_in_keepalive' will only have effect on new connections. -configure(iiop_ssl_in_keepalive, true, Status) -> - do_configure(iiop_ssl_in_keepalive, true, Status); -configure(iiop_ssl_in_keepalive, false, Status) -> - do_configure(iiop_ssl_in_keepalive, false, Status); -%% configure 'iiop_ssl_out_keepalive' will only have effect on new connections. -configure(iiop_ssl_out_keepalive, true, Status) -> - do_configure(iiop_ssl_out_keepalive, true, Status); -configure(iiop_ssl_out_keepalive, false, Status) -> - do_configure(iiop_ssl_out_keepalive, false, Status); -configure(iiop_ssl_accept_timeout, infinity, Status) -> - do_configure(iiop_ssl_accept_timeout, infinity, Status); -configure(iiop_ssl_accept_timeout, Value, Status) when is_integer(Value) andalso Value >= 0 -> - do_configure(iiop_ssl_accept_timeout, Value, Status); -configure(ssl_generation, Generation, Status) when is_integer(Generation) andalso Generation >= 2 -> - do_safe_configure(ssl_generation, Generation, Status); -configure(secure, ssl, Status) -> - do_safe_configure(secure, ssl, Status); -configure(iiop_ssl_ip_address_local, Value, Status) when is_list(Value) -> - do_safe_configure(iiop_ssl_ip_address_local, Value, Status); -configure(iiop_ssl_backlog, Value, Status) when is_integer(Value) andalso Value >= 0 -> - do_safe_configure(iiop_ssl_backlog, Value, Status); -configure(nat_iiop_ssl_port, Value, Status) when is_integer(Value) andalso Value > 0 -> - do_safe_configure(nat_iiop_ssl_port, Value, Status); -configure(nat_iiop_ssl_port, {local, Value1, Value2}, Status) when is_integer(Value1) andalso - Value1 > 0 andalso - is_list(Value2) -> - do_safe_configure(nat_iiop_ssl_port, {local, Value1, Value2}, Status); -configure(iiop_ssl_port, Value, Status) when is_integer(Value) -> - do_safe_configure(iiop_ssl_port, Value, Status); - -%% New SSL options -configure(ssl_server_options, Value, Status) when is_list(Value) -> - do_safe_configure(ssl_server_options, Value, Status); -configure(ssl_client_options, Value, Status) when is_list(Value) -> - do_safe_configure(ssl_client_options, Value, Status); - -%% Old SSL options -configure(ssl_server_certfile, Value, Status) when is_list(Value) -> - do_safe_configure(ssl_server_certfile, Value, Status); -configure(ssl_server_certfile, Value, Status) when is_atom(Value) -> - do_safe_configure(ssl_server_certfile, atom_to_list(Value), Status); -configure(ssl_client_certfile, Value, Status) when is_list(Value) -> - do_safe_configure(ssl_client_certfile, Value, Status); -configure(ssl_client_certfile, Value, Status) when is_atom(Value) -> - do_safe_configure(ssl_client_certfile, atom_to_list(Value), Status); -configure(ssl_server_verify, Value, Status) when is_integer(Value) -> - do_safe_configure(ssl_server_verify, Value, Status); -configure(ssl_client_verify, Value, Status) when is_integer(Value) -> - do_safe_configure(ssl_client_verify, Value, Status); -configure(ssl_server_depth, Value, Status) when is_integer(Value) -> - do_safe_configure(ssl_server_depth, Value, Status); -configure(ssl_client_depth, Value, Status) when is_integer(Value) -> - do_safe_configure(ssl_client_depth, Value, Status); -configure(ssl_server_cacertfile, Value, Status) when is_list(Value) -> - do_safe_configure(ssl_server_cacertfile, Value, Status); -configure(ssl_server_cacertfile, Value, Status) when is_atom(Value) -> - do_safe_configure(ssl_server_cacertfile, atom_to_list(Value), Status); -configure(ssl_client_cacertfile, Value, Status) when is_list(Value) -> - do_safe_configure(ssl_client_cacertfile, Value, Status); -configure(ssl_client_cacertfile, Value, Status) when is_atom(Value) -> - do_safe_configure(ssl_client_cacertfile, atom_to_list(Value), Status); -configure(ssl_client_password, Value, Status) when is_list(Value) -> - do_safe_configure(ssl_client_password, Value, Status); -configure(ssl_client_password, Value, Status) when is_atom(Value) -> - do_safe_configure(ssl_client_password, atom_to_list(Value), Status); -configure(ssl_client_keyfile, Value, Status) when is_list(Value) -> - do_safe_configure(ssl_client_keyfile, Value, Status); -configure(ssl_client_keyfile, Value, Status) when is_atom(Value) -> - do_safe_configure(ssl_client_keyfile, atom_to_list(Value), Status); -configure(ssl_server_password, Value, Status) when is_list(Value) -> - do_safe_configure(ssl_server_password, Value, Status); -configure(ssl_client_password, Value, Status) when is_atom(Value) -> - do_safe_configure(ssl_server_password, atom_to_list(Value), Status); -configure(ssl_server_keyfile, Value, Status) when is_list(Value) -> - do_safe_configure(ssl_server_keyfile, Value, Status); -configure(ssl_server_keyfile, Value, Status) when is_atom(Value) -> - do_safe_configure(ssl_server_keyfile, atom_to_list(Value), Status); -configure(ssl_server_ciphers, Value, Status) when is_list(Value) -> - do_safe_configure(ssl_server_ciphers, Value, Status); -configure(ssl_server_ciphers, Value, Status) when is_atom(Value) -> - do_safe_configure(ssl_server_ciphers, atom_to_list(Value), Status); -configure(ssl_client_ciphers, Value, Status) when is_list(Value) -> - do_safe_configure(ssl_client_ciphers, Value, Status); -configure(ssl_client_ciphers, Value, Status) when is_atom(Value) -> - do_safe_configure(ssl_client_ciphers, atom_to_list(Value), Status); -configure(ssl_client_cachetimeout, Value, Status) when is_integer(Value) andalso Value > 0 -> - do_safe_configure(ssl_client_cachetimeout, Value, Status); -configure(ssl_server_cachetimeout, Value, Status) when is_integer(Value) andalso Value > 0 -> - do_safe_configure(ssl_server_cachetimeout, Value, Status); - -configure(Key, Value, _) -> - ?EFORMAT("Bad configuration parameter: {~p, ~p}", [Key, Value]). - -%% This function may be used as long as it is safe to change a value at any time. -do_configure(Key, Value, check) -> - case orber_tb:is_loaded() of - false -> - application:load(orber), - application:set_env(orber, Key, Value); - true -> - application:set_env(orber, Key, Value) - end; -do_configure(Key, Value, _) -> - application:set_env(orber, Key, Value). - -%% This function MUST(!!) be used when we cannot change a value if Orber is running. -do_safe_configure(_, _, running) -> - exit("Orber already running, the given key may not be updated!"); -do_safe_configure(Key, Value, check) -> - case orber_tb:is_loaded() of - false -> - application:load(orber), - application:set_env(orber, Key, Value); - true -> - case orber_tb:is_running() of - false -> - application:set_env(orber, Key, Value); - true -> - ?EFORMAT("Orber already running. {~p, ~p} may not be updated!", - [Key, Value]) - end - end; -do_safe_configure(Key, Value, loaded) -> - application:set_env(orber, Key, Value). - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Server functions -%%----------------------------------------------------------------- -init(_Opts) -> - {ok, #env{acl = orber_acl:init_acl(iiop_acl()), - parameters = init_env()}}. - -terminate(_Reason, _State) -> - ok. - -handle_call(_, _From, State) -> - {reply, ok, State}. - -handle_cast(_, State) -> - {noreply, State}. - -handle_info(_, State) -> - {noreply, State}. - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%----------------------------------------------------------------- -%% function : env -%% Arguments: -%% Returns : -%% Exception: -%% Effect : Used when Key always exists (Default Value) -%%----------------------------------------------------------------- -env(Key) -> - [#parameters{value = Val}] = ets:lookup(?ENV_DB, Key), - Val. - -%%----------------------------------------------------------------- -%% function : init_env -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%----------------------------------------------------------------- -init_env() -> - application:load(orber), - DB = ets:new(?ENV_DB, [set, public, named_table, {keypos, 2}]), -% init_env(?ENV_KEYS), - DB. - -%init_env([{H,D}|T]) -> -% case application:get_env(orber, H) of -% {ok, V} -> -% ets:insert(?ENV_DB, #parameters{key = H, value = V, flags = 0}), -% init_env(T); -% _ -> -% ets:insert(?ENV_DB, #parameters{key = H, value = D, flags = 0}), -% init_env(T) -% end; -%init_env([H|T]) -> -% case application:get_env(orber, H) of -% {ok, V} -> -% ets:insert(?ENV_DB, #parameters{key = H, value = V, flags = 0}), -% init_env(T); -% _ -> -% ets:insert(?ENV_DB, #parameters{key = H, value = undefined, flags = 0}), -% init_env(T) -% end; -%init_env([]) -> -% ok. - -%%----------------------------------------------------------------- -%%------------- END OF MODULE ------------------------------------- -%%----------------------------------------------------------------- diff --git a/lib/orber/src/orber_exceptions.erl b/lib/orber/src/orber_exceptions.erl deleted file mode 100644 index 2519775eb3..0000000000 --- a/lib/orber/src/orber_exceptions.erl +++ /dev/null @@ -1,718 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2002-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: orber_exceptions.erl -%% -%% Description: -%% -%%----------------------------------------------------------------- - --module(orber_exceptions). - --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). --include_lib("orber/src/ifr_objects.hrl"). --include_lib("orber/include/ifr_types.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([dissect/1, - get_def/1, - get_name/2, - type/1, - is_system_exception/1]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export(['UNKNOWN'/1, - 'BAD_PARAM'/1, - 'NO_MEMORY'/1, - 'IMP_LIMIT'/1, - 'COMM_FAILURE'/1, - 'INV_OBJREF'/1, - 'NO_PERMISSION'/1, - 'INTERNAL'/1, - 'MARSHAL'/1, - 'INITIALIZE'/1, - 'NO_IMPLEMENT'/1, - 'BAD_TYPECODE'/1, - 'BAD_OPERATION'/1, - 'NO_RESOURCES'/1, - 'NO_RESPONSE'/1, - 'PERSIST_STORE'/1, - 'BAD_INV_ORDER'/1, - 'TRANSIENT'/1, - 'FREE_MEM'/1, - 'INV_IDENT'/1, - 'INV_FLAG'/1, - 'INTF_REPOS'/1, - 'BAD_CONTEXT'/1, - 'OBJ_ADAPTER'/1, - 'DATA_CONVERSION'/1, - 'OBJECT_NOT_EXIST'/1, - 'TRANSACTION_REQUIRED'/1, - 'TRANSACTION_ROLLEDBACK'/1, - 'INVALID_TRANSACTION'/1, - 'INV_POLICY'/1, - 'CODESET_INCOMPATIBLE'/1, - 'REBIND'/1, - 'TIMEOUT'/1, - 'TRANSACTION_UNAVAILABLE'/1, - 'TRANSACTION_MODE'/1, - 'BAD_QOS'/1]). - - --define(DEBUG_LEVEL, 5). - -%%----------------------------------------------------------------- -%% Function : is_system_exception -%% Arguments : Exception - record() -%% Returns : true | false -%% Raises : -%% Description: Check if CORBA system exception or user defined -%%----------------------------------------------------------------- -is_system_exception({'EXCEPTION', E}) -> - is_system_exception(E); -is_system_exception(E) when is_tuple(E) -> - ?SYSTEM_EXCEPTION == type(element(1, E)); -is_system_exception(_E) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%----------------------------------------------------------------- -%% Function : type -%% Arguments : ExceptionName - atom() -%% Returns : ?SYSTEM_EXCEPTION | ?USER_EXCEPTION -%% Raises : -%% Description: Check if CORBA system exception or user defined -%%----------------------------------------------------------------- -type('UNKNOWN') -> ?SYSTEM_EXCEPTION; -type('BAD_PARAM') -> ?SYSTEM_EXCEPTION; -type('NO_MEMORY') -> ?SYSTEM_EXCEPTION; -type('IMP_LIMIT') -> ?SYSTEM_EXCEPTION; -type('COMM_FAILURE') -> ?SYSTEM_EXCEPTION; -type('INV_OBJREF') -> ?SYSTEM_EXCEPTION; -type('NO_PERMISSION') -> ?SYSTEM_EXCEPTION; -type('INTERNAL') -> ?SYSTEM_EXCEPTION; -type('MARSHAL') -> ?SYSTEM_EXCEPTION; -type('INITIALIZE') -> ?SYSTEM_EXCEPTION; -type('NO_IMPLEMENT') -> ?SYSTEM_EXCEPTION; -type('BAD_TYPECODE') -> ?SYSTEM_EXCEPTION; -type('BAD_OPERATION') -> ?SYSTEM_EXCEPTION; -type('NO_RESOURCES') -> ?SYSTEM_EXCEPTION; -type('NO_RESPONSE') -> ?SYSTEM_EXCEPTION; -type('PERSIST_STORE') -> ?SYSTEM_EXCEPTION; -type('BAD_INV_ORDER') -> ?SYSTEM_EXCEPTION; -type('TRANSIENT') -> ?SYSTEM_EXCEPTION; -type('FREE_MEM') -> ?SYSTEM_EXCEPTION; -type('INV_IDENT') -> ?SYSTEM_EXCEPTION; -type('INV_FLAG') -> ?SYSTEM_EXCEPTION; -type('INTF_REPOS') -> ?SYSTEM_EXCEPTION; -type('BAD_CONTEXT') -> ?SYSTEM_EXCEPTION; -type('OBJ_ADAPTER') -> ?SYSTEM_EXCEPTION; -type('DATA_CONVERSION') -> ?SYSTEM_EXCEPTION; -type('OBJECT_NOT_EXIST') -> ?SYSTEM_EXCEPTION; -type('TRANSACTION_REQUIRED') -> ?SYSTEM_EXCEPTION; -type('TRANSACTION_ROLLEDBACK') -> ?SYSTEM_EXCEPTION; -type('INVALID_TRANSACTION') -> ?SYSTEM_EXCEPTION; -type('INV_POLICY') -> ?SYSTEM_EXCEPTION; -type('CODESET_INCOMPATIBLE') -> ?SYSTEM_EXCEPTION; -type('REBIND') -> ?SYSTEM_EXCEPTION; -type('TIMEOUT') -> ?SYSTEM_EXCEPTION; -type('TRANSACTION_UNAVAILABLE') -> ?SYSTEM_EXCEPTION; -type('TRANSACTION_MODE') -> ?SYSTEM_EXCEPTION; -type('BAD_QOS') -> ?SYSTEM_EXCEPTION; -type(_) -> ?USER_EXCEPTION. - -%%----------------------------------------------------------------- -%% Function : get_def -%% Arguments : Exception - record() -%% Returns : {Type, TypeCode, Exc} -%% Raises : -%% Description: Returns the TC for the supplied exception -%%----------------------------------------------------------------- -get_def(Exception) -> - [Exc, TypeId | _] = tuple_to_list(Exception), - case type(Exc) of - ?SYSTEM_EXCEPTION -> - {?SYSTEM_EXCEPTION, get_system_exception_def(Exc), Exception}; - ?USER_EXCEPTION -> - case orber:light_ifr() of - true -> - case catch orber_ifr:get_tc(TypeId, ?IFR_ExceptionDef) of - {'EXCEPTION', NewExc} -> - {?SYSTEM_EXCEPTION, - get_system_exception_def(NewExc), - NewExc}; - TC -> - {?USER_EXCEPTION, TC, Exception} - end; - false -> - case mnesia:dirty_index_read(ir_ExceptionDef, TypeId, - #ir_ExceptionDef.id) of - [ExcDef] when is_record(ExcDef, ir_ExceptionDef) -> - {?USER_EXCEPTION, - ExcDef#ir_ExceptionDef.type, - Exception}; - Other -> - orber:dbg("[~p] ~p:get_user_exception_type(~p).~n" - "IFR Id not found: ~p", - [?LINE, ?MODULE, TypeId, Other], ?DEBUG_LEVEL), - NewExc = #'UNKNOWN'{minor=(?CORBA_OMGVMCID bor 1), - completion_status=?COMPLETED_MAYBE}, - {?SYSTEM_EXCEPTION, - get_system_exception_def(NewExc), - NewExc} - end - end - end. - -%%----------------------------------------------------------------- -%% Function : get_name -%% Arguments : TypeId - string() -%% Type - ?SYSTEM_EXCEPTION ( | ?USER_EXCEPTION) -%% Returns : ExceptionName - atom() -%% Raises : #'UNKNOWN'{} -%% Description: Extract exception name -%%----------------------------------------------------------------- -get_name(TypeId, ?SYSTEM_EXCEPTION) -> - ExcName = - case string:tokens(TypeId, ":/") of - [_IDL, _OMGORG, _CORBA, Name, _Version] when is_list(Name) -> - list_to_atom(Name); - [_IDL, _CORBA, Name, _Version] when is_list(Name) -> - %% We should remove this case but we keep it for now due to backward - %% compatible reasons. - list_to_atom(Name); - Other -> - %% The CORBA-spec states that this exception should be raised if - %% it's a system exception we do not support. - orber:dbg("[~p] ~p:get_system_exception_name(~p).~n" - "Unknown System Exception: ~p", - [?LINE, ?MODULE, TypeId, Other], ?DEBUG_LEVEL), - corba:raise(#'UNKNOWN'{minor=(?CORBA_OMGVMCID bor 2), - completion_status=?COMPLETED_MAYBE}) - end, - case type(ExcName) of - ?SYSTEM_EXCEPTION -> - ExcName; - What -> - orber:dbg("[~p] ~p:get_system_exception_name(~p).~n" - "Unknown System Exception: ~p", - [?LINE, ?MODULE, TypeId, What], ?DEBUG_LEVEL), - corba:raise(#'UNKNOWN'{minor=(?CORBA_OMGVMCID bor 2), - completion_status=?COMPLETED_MAYBE}) - end. - - -%%----------------------------------------------------------------- -%% Generate system exception TypeCode -%%----------------------------------------------------------------- -get_system_exception_def(ExcName) when is_atom(ExcName) -> - Name = atom_to_list(ExcName), - {'tk_except', "IDL:omg.org/CORBA/" ++ Name ++ ":1.0", Name, - [{"minor",'tk_ulong'}, - {"completed", - {'tk_enum', "", "completion_status", - ["COMPLETED_YES", "COMPLETED_NO", - "COMPLETED_MAYBE"]}}]}; -get_system_exception_def(Exc) -> - get_system_exception_def(element(1, Exc)). - - -%%----------------------------------------------------------------- -%% Mapping minor codes to a printable string. -%%----------------------------------------------------------------- -dissect({'EXCEPTION', Exc}) -> - dissect(Exc); -dissect(Exception) when is_tuple(Exception) -> - [Exc, TypeId | _] = tuple_to_list(Exception), - case type(Exc) of - ?USER_EXCEPTION -> - {ok, lists:flatten(io_lib:format("~n------------- EXCEPTION INFO -------------- -User Defined Exception.: ~p -IFR Id.................: ~s --------------------------------------------~n", [Exc, TypeId]))}; - ?SYSTEM_EXCEPTION -> - case map_exc(Exception) of - {ok, String} -> - {ok, lists:flatten(String)}; - {error, Reason} -> - {error, Reason} - end - end; -dissect(_What) -> - {error, "Not a correct exception supplied to orber_exceptions:dissect/1"}. - -map_exc({Name, _, Minor, Status}) when is_integer(Minor) -> - case lookup_vendor(Minor) of - {true, Vendor, VMCID} -> - case catch ?MODULE:Name(Minor) of - MinorInfo when is_list(MinorInfo) -> - {ok, io_lib:format("~n------------- EXCEPTION INFO -------------- -Vendor.....: ~s -VMCID......: ~s -Exception..: ~p -Status.....: ~p -Minor Code.: ~p -Info.......: ~s --------------------------------------------~n", - [Vendor, VMCID, Name, Status, (Minor band 16#fff), MinorInfo])}; - _ -> - {ok, io_lib:format("~n------------- EXCEPTION INFO -------------- -Vendor.....: ~s -VMCID......: ~s -Exception..: ~p -Status.....: ~p -Minor Code.: ~p -Info.......: - -------------------------------------~n", [Vendor, VMCID, Name, Status, (Minor band 16#fff)])} - end; - {false, Vendor, VMCID} -> - {ok, io_lib:format("~n------------- EXCEPTION INFO -------------- -Vendor.....: ~s -VMCID......: ~s -Exception..: ~p -Status.....: ~p -Minor Code.: ~p -Info.......: - --------------------------------------------~n", [Vendor, VMCID, Name, Status, (Minor band 16#fff)])} - end; -map_exc(_) -> - {error, "Not a correct exception supplied to orber_exceptions:map_exc/1"}. - -lookup_vendor(Minor) when (?ORBER_VMCID bxor Minor) < 16#0fff -> - {true, "Orber", "0x45520000"}; -lookup_vendor(Minor) when (?CORBA_OMGVMCID bxor Minor) < 16#0fff -> - {true, "OMG", "0x4f4d0000"}; -lookup_vendor(Minor) when (?IONA_VMCID_1 bxor Minor) < 16#0fff -> - {false, "IONA", "0x4f4f0000"}; -lookup_vendor(Minor) when (?IONA_VMCID_2 bxor Minor) < 16#0fff -> - {false, "IONA", "0x49540000"}; -lookup_vendor(Minor) when (?SUN_VMCID bxor Minor) < 16#0fff -> - {false, "SUN", "0x53550000"}; -lookup_vendor(Minor) when (?BORLAND_VMCID bxor Minor) < 16#0fff -> - {false, "Borland", "0x56420000"}; -lookup_vendor(Minor) when (?TAO_VMCID bxor Minor) < 16#0fff -> - {false, "TAO", "0x54410000"}; -lookup_vendor(Minor) when (?PRISMTECH_VMCID bxor Minor) < 16#0fff -> - {false, "PrismTech", "0x50540000"}; -lookup_vendor(Minor) when is_integer(Minor), Minor =< ?ULONGMAX -> - {false, "undefined", extract_VMCID(Minor)}; -lookup_vendor(Minor) when is_integer(Minor), Minor =< ?ULONGMAX -> - {false, "Unknown", "Unable to extract it"}. - -extract_VMCID(Int) -> - int_to_hex_str(3, ((Int bsr 8) band 16#fffff0), ["00"]). - -int_to_hex_str(0, _, Acc) -> - lists:flatten(["0x" | Acc]); -int_to_hex_str(N, Int, Acc) -> - int_to_hex_str(N-1, (Int bsr 8), [int_to_hex((16#ff band Int))|Acc]). - -int_to_hex(B) when B < 256, B >= 0 -> - N1 = B div 16, - N2 = B rem 16, - [code_character(N1), - code_character(N2)]. -code_character(N) when N < 10 -> - $0 + N; -code_character(N) -> - $a + (N - 10). - - -%% The following functions all maps to a system exception. -%% UNKNOWN - OMG -'UNKNOWN'(?CORBA_OMGVMCID bor 1) -> "Unlisted user exception received -by client"; -'UNKNOWN'(?CORBA_OMGVMCID bor 2) -> "Non-standard System Exception -not supported"; -%% UNKNOWN - Orber -'UNKNOWN'(?ORBER_VMCID bor 1) -> "Missing beam-file. Unable to extract TC."; -'UNKNOWN'(_) -> "-". - - -%% BAD_PARAM - OMG -'BAD_PARAM'(?CORBA_OMGVMCID bor 1) -> "Failure to register, unregister, or -lookup value factory"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 2) -> "RID already defined in IFR"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 3) -> "Name already used in the context in IFR"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 4) -> "Target is not a valid container"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 5) -> "Name clash in inherited context"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 6) -> "Incorrect type for abstract interface"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 7) -> "string_to_object conversion failed -due to bad scheme name"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 8) -> "string_to_object conversion failed -due to bad address"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 9) -> "string_to_object conversion failed -due to bad bad schema specific part"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 10) -> "string_to_object conversion failed -due to non specific reason"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 11) -> "Attempt to derive abstract interface -from non-abstract base interface -in the Interface Repository"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 12) -> "Attempt to let a ValueDef support -more than one non-abstract interface -in the Interface Repository"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 13) -> "Attempt to use an incomplete -TypeCode as a parameter"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 14) -> "Invalid object id passed to -POA::create_reference_by_id"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 15) -> "Bad name argument in TypeCode operation"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 16) -> "Bad RepositoryId argument in TypeCode -operation"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 17) -> "Invalid member name in TypeCode operation"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 18) -> "Duplicate label value in create_union_tc"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 19) -> "Incompatible TypeCode of label and -discriminator in create_union_tc"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 20) -> "Supplied discriminator type illegitimate -in create_union_tc"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 21) -> "Any passed to ServerRequest::set_exception -does not contain an exception"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 22) -> "Unlisted user exception passed to -ServerRequest::set_exception"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 23) -> "wchar transmission code set not -in service context"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 24) -> "Service context is not in OMG-defined range"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 25) -> "Enum value out of range"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 26) -> "Invalid service context Id in portable -interceptor"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 27) -> "Attempt to call register_initial_reference -with a null Object"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 28) -> "Invalid component Id in -portable interceptor"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 29) -> "Invalid profile Id in portable -interceptor"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 30) -> "Two or more Policy objects with the -same PolicyType value supplied to -Object::set_policy_overrides or -PolicyManager::set_policy_overrides"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 31) -> "Attempt to define a oneway -operation with non-void result, -out or inout parameters or user -exceptions"; -'BAD_PARAM'(?CORBA_OMGVMCID bor 32) -> "DII asked to create request -for an implicit operation"; -%% BAD_PARAM - Orber -'BAD_PARAM'(?ORBER_VMCID bor 1) -> "Bad return value from the objects -init-function (create phase) or invalid -options suuplied"; -'BAD_PARAM'(_) -> "-". - -%% NO_MEMORY - OMG -'NO_MEMORY'(_) -> "-". - -%% IMP_LIMIT - OMG -'IMP_LIMIT'(?CORBA_OMGVMCID bor 1) -> "Unable to use any profile in IOR"; -%% IMP_LIMIT - Orber -'IMP_LIMIT'(?ORBER_VMCID bor 1) -> "All ports assigned to the configuration -parameter 'iiop_out_ports' are in use"; -'IMP_LIMIT'(_) -> "-". - -%% COMM_FAILURE - OMG -%% COMM_FAILURE - Orber -'COMM_FAILURE'(?ORBER_VMCID bor 1) -> "Unable to connect to another ORB - -probably inactive"; -'COMM_FAILURE'(?ORBER_VMCID bor 2) -> "Unable to connect to another ORB - -interceptor(s) rejected it or behaves -badly"; -'COMM_FAILURE'(?ORBER_VMCID bor 3) -> "Request terminated by another process"; -'COMM_FAILURE'(?ORBER_VMCID bor 4) -> "Unable to connect to another ORB - timed out"; -'COMM_FAILURE'(_) -> "-". - -%% INV_OBJREF - OMG -'INV_OBJREF'(?CORBA_OMGVMCID bor 1) -> "wchar Code Set support not specified"; -'INV_OBJREF'(?CORBA_OMGVMCID bor 2) -> "Codeset component required for type using wchar or wstring data"; -'INV_OBJREF'(_) -> "-". - -%% NO_PERMISSION - OMG -'NO_PERMISSION'(_) -> "-". - -%% INTERNAL - OMG -%% INTERNAL - Orber -'INTERNAL'(?ORBER_VMCID bor 1) -> "Unable to connect to an Orber installation"; -'INTERNAL'(?ORBER_VMCID bor 2) -> "Failed to register internal objectkey in the database"; -'INTERNAL'(_) -> "-". - -%% MARSHAL - OMG -'MARSHAL'(?CORBA_OMGVMCID bor 1) -> "Unable to locate value factory"; -'MARSHAL'(?CORBA_OMGVMCID bor 2) -> "ServerRequest::set_result called -before ServerRequest::ctx when the -operation IDL contains a context -clause"; -'MARSHAL'(?CORBA_OMGVMCID bor 3) -> "NVList passed to -ServerRequest::arguments does not -describe all parameters passed -by client"; -'MARSHAL'(?CORBA_OMGVMCID bor 4) -> "Attempt to marshal Local object"; -'MARSHAL'(?CORBA_OMGVMCID bor 5) -> "wchar or wstring data erroneosly -sent by client over GIOP 1.0 -connection"; -'MARSHAL'(?CORBA_OMGVMCID bor 6) -> "wchar or wstring data erroneously -returned by server over GIOP 1.0 -connection"; -%% MARSHAL - Orber -'MARSHAL'(?ORBER_VMCID bor 1) -> "Integer overflow"; -'MARSHAL'(?ORBER_VMCID bor 2) -> "Passed a non-integer, -when it must be an integer"; -'MARSHAL'(?ORBER_VMCID bor 3) -> "Incorrect boolean"; -'MARSHAL'(?ORBER_VMCID bor 4) -> "Passed a non-number, -when it must be a float, double -or long double"; -'MARSHAL'(?ORBER_VMCID bor 5) -> "Bad enumerant - does not exist"; -'MARSHAL'(?ORBER_VMCID bor 6) -> "Passed something else but character -or octet"; -'MARSHAL'(?ORBER_VMCID bor 7) -> "Unable to marshal the supplied -typecode"; -'MARSHAL'(?ORBER_VMCID bor 8) -> "Unable to un-marshal the supplied -typecode"; -'MARSHAL'(?ORBER_VMCID bor 9) -> "Union IFR-id does not exist"; -'MARSHAL'(?ORBER_VMCID bor 10) -> "Struct IFR-id does not exist"; -'MARSHAL'(?ORBER_VMCID bor 11) -> "Empty string supplied as IFR-id"; -'MARSHAL'(?ORBER_VMCID bor 12) -> "Unable to decode target address"; -'MARSHAL'(?ORBER_VMCID bor 13) -> "Incorrect TypeCode or unsupported -data type"; -'MARSHAL'(?ORBER_VMCID bor 14) -> "The Fixed type does not match the -defined digits/scale parameters"; -'MARSHAL'(?ORBER_VMCID bor 15) -> "The supplied array is to long or to short"; -'MARSHAL'(?ORBER_VMCID bor 16) -> "String/Wstring exceeds maximum length"; -'MARSHAL'(?ORBER_VMCID bor 17) -> "To few or to many parameters supplied"; -'MARSHAL'(?ORBER_VMCID bor 18) -> "Unable to decode message header"; -'MARSHAL'(?ORBER_VMCID bor 19) -> "Sequnce exceeds maximum length"; -'MARSHAL'(_) -> "-". - -%% INITIALIZE - OMG -'INITIALIZE'(_) -> "-". - -%% NO_IMPLEMENT - OMG -'NO_IMPLEMENT'(?CORBA_OMGVMCID bor 1) -> "Missing local value implementation"; -'NO_IMPLEMENT'(?CORBA_OMGVMCID bor 2) -> "Incompatible value implementation version"; -'NO_IMPLEMENT'(?CORBA_OMGVMCID bor 3) -> "Unable to use any profile in IOR"; -'NO_IMPLEMENT'(?CORBA_OMGVMCID bor 4) -> "Attempt to use DII on Local object"; -'NO_IMPLEMENT'(_) -> "-". - - -%% BAD_TYPECODE - OMG -'BAD_TYPECODE'(?CORBA_OMGVMCID bor 1) -> "Attempt to marshal incomplete -TypeCode"; -'BAD_TYPECODE'(?CORBA_OMGVMCID bor 2) -> "Member type code illegitimate -in TypeCode operation"; -'BAD_TYPECODE'(_) -> "-". - -%% BAD_OPERATION - OMG -'BAD_OPERATION'(?CORBA_OMGVMCID bor 1) -> "ServantManager returned wrong -servant type"; -%% BAD_OPERATION - Orber -'BAD_OPERATION'(?ORBER_VMCID bor 1) -> "Incorrect instance type for this -operation"; -'BAD_OPERATION'(?ORBER_VMCID bor 2) -> "Incorrect instance type for this -operation (one-way)"; -'BAD_OPERATION'(?ORBER_VMCID bor 3) -> "The IC option 'handle_info' was -not used when compiling the stub"; -'BAD_OPERATION'(?ORBER_VMCID bor 4) -> "Incorrect instance type for the -invoked operation (two- or one-way)"; -'BAD_OPERATION'(_) -> "-". - -%% NO_RESOURCES - OMG -'NO_RESOURCES'(?CORBA_OMGVMCID bor 1) -> "Portable Interceptor operation -not supported in this binding"; -'NO_RESOURCES'(_) -> "-". - -%% NO_RESPONSE - OMG -'NO_RESPONSE'(_) -> "-". - -%% PERSIST_STORE - OMG -'PERSIST_STORE'(_) -> "-". - -%% BAD_INV_ORDER - OMG -'BAD_INV_ORDER'(?CORBA_OMGVMCID bor 1) -> "Dependency exists in IFR preventing -destruction of this object"; -'BAD_INV_ORDER'(?CORBA_OMGVMCID bor 2) -> "Attempt to destroy indestructible -objects in IFR"; -'BAD_INV_ORDER'(?CORBA_OMGVMCID bor 3) -> "Operation would deadlock"; -'BAD_INV_ORDER'(?CORBA_OMGVMCID bor 4) -> "ORB has shutdown"; -'BAD_INV_ORDER'(?CORBA_OMGVMCID bor 5) -> "Attempt to invoke send or invoke -operation of the same Request object -more than once"; -'BAD_INV_ORDER'(?CORBA_OMGVMCID bor 6) -> "Attempt to set a servant manager -after one has already been set"; -'BAD_INV_ORDER'(?CORBA_OMGVMCID bor 7) -> "ServerRequest::arguments called more -than once or after a call to -ServerRequest:: set_exception"; -'BAD_INV_ORDER'(?CORBA_OMGVMCID bor 8) -> "ServerRequest::ctx called more than -once or before ServerRequest::arguments or -after ServerRequest::ctx, ServerRequest::set_result -or ServerRequest::set_exception"; -'BAD_INV_ORDER'(?CORBA_OMGVMCID bor 9) -> "ServerRequest::set_result called more -than once or before ServerRequest::arguments -or after ServerRequest::set_result or -ServerRequest::set_exception"; -'BAD_INV_ORDER'(?CORBA_OMGVMCID bor 10) -> "Attempt to send a DII request after -it was sent previously"; -'BAD_INV_ORDER'(?CORBA_OMGVMCID bor 11) -> "Attempt to poll a DII request or to -retrieve its result before the request -was sent"; -'BAD_INV_ORDER'(?CORBA_OMGVMCID bor 12) -> "Attempt to poll a DII request or to -retrieve its result after the result -was retrieved previously"; -'BAD_INV_ORDER'(?CORBA_OMGVMCID bor 13) -> "Attempt to poll a synchronous DII -request or to retrieve results from -a synchronous DII request"; -'BAD_INV_ORDER'(?CORBA_OMGVMCID bor 14) -> "Invalid portable interceptor call"; -'BAD_INV_ORDER'(?CORBA_OMGVMCID bor 15) -> "Service context add failed in portable -interceptor because a service context -with the given id already exists"; -'BAD_INV_ORDER'(?CORBA_OMGVMCID bor 16) -> "Registration of PolicyFactory failed -because a factory already exists for -the given PolicyType"; -'BAD_INV_ORDER'(?CORBA_OMGVMCID bor 17) -> "POA cannot create POAs while undergoing -destruction"; -'BAD_INV_ORDER'(_) -> "-". - -%% TRANSIENT - OMG -'TRANSIENT'(?CORBA_OMGVMCID bor 1) -> "Request discarded because of resource -exhaustion in POA, or because POA -is in discarding state"; -'TRANSIENT'(?CORBA_OMGVMCID bor 2) -> "No usable profile in IOR"; -'TRANSIENT'(?CORBA_OMGVMCID bor 3) -> "Request cancelled"; -'TRANSIENT'(?CORBA_OMGVMCID bor 4) -> "POA destroyed"; -%% TRANSIENT - Orber -'TRANSIENT'(?ORBER_VMCID bor 1) -> "Orber is being restarted, or should be, -on one node in the multi-node Orber -installation"; -'TRANSIENT'(?ORBER_VMCID bor 2) -> "The node the target object resides on -is down (multi-node Orber installation)"; -'TRANSIENT'(?ORBER_VMCID bor 3) -> "Received EXIT when invoking an operation -on an object residing on another -node in a multi-node Orber installation"; -'TRANSIENT'(?ORBER_VMCID bor 4) -> "Received EXIT when invoking an operation -on a local object"; -'TRANSIENT'(?ORBER_VMCID bor 5) -> "Received unknown reply when invoking an -operation on an object residing on -another node in a multi-node Orber -installation"; -'TRANSIENT'(?ORBER_VMCID bor 6) -> "Received unknown reply when invoking an -operation on a local object"; -'TRANSIENT'(?ORBER_VMCID bor 7) -> "Either the stub/skeleton does not exist or an -incorrect IC-version was used, which does not generate -the oe_tc/1 or oe_get_interface/1 functions"; -'TRANSIENT'(_) -> "-". - -%% FREE_MEM - OMG -'FREE_MEM'(_) -> "-". - -%% INV_IDENT - OMG -'INV_IDENT'(_) -> "-". - -%% INV_FLAG - OMG -'INV_FLAG'(_) -> "-". - -%% INTF_REPOS - OMG -'INTF_REPOS'(?CORBA_OMGVMCID bor 1) -> "Interface Repository not available"; -'INTF_REPOS'(?CORBA_OMGVMCID bor 2) -> "No entry for requested interface in -Interface Repository"; -'INTF_REPOS'(_) -> "-". - -%% BAD_CONTEXT - OMG -'BAD_CONTEXT'(_) -> "-". - -%% OBJ_ADAPTER - OMG -'OBJ_ADAPTER'(?CORBA_OMGVMCID bor 1) -> "System exception in -AdapterActivator::unknown_adapter"; -'OBJ_ADAPTER'(?CORBA_OMGVMCID bor 2) -> "Servant not found [ServantManager]"; -'OBJ_ADAPTER'(?CORBA_OMGVMCID bor 3) -> "No default servant available [POA policy]"; -'OBJ_ADAPTER'(?CORBA_OMGVMCID bor 4) -> "No servant manager available [POA Policy]"; -'OBJ_ADAPTER'(?CORBA_OMGVMCID bor 5) -> "Violation of POA policy by -ServantActivator::incarnate"; -'OBJ_ADAPTER'(?CORBA_OMGVMCID bor 6) -> "Exception in -PortableInterceptor::IORInterceptor.components_established"; -%% OBJ_ADAPTER - Orber -'OBJ_ADAPTER'(?ORBER_VMCID bor 1) -> "Call-back module does not exist"; -'OBJ_ADAPTER'(?ORBER_VMCID bor 2) -> "Missing function or incorrect arity in -call-back module"; -'OBJ_ADAPTER'(?ORBER_VMCID bor 3) -> "Function exported but arity incorrect"; -'OBJ_ADAPTER'(?ORBER_VMCID bor 4) -> "Unknown error. Call-back module generated -EXIT"; -'OBJ_ADAPTER'(?ORBER_VMCID bor 5) -> "Call-back module invoked operation on a -non-existing module"; -'OBJ_ADAPTER'(?ORBER_VMCID bor 6) -> "Missing function or incorrect arity in -a module invoked via the call-back module"; -'OBJ_ADAPTER'(?ORBER_VMCID bor 7) -> "Function exported but arity incorrect in -a module invoked via the call-back module"; -'OBJ_ADAPTER'(?ORBER_VMCID bor 8) -> "Call-back module contains a function_clause, -case_clause or badarith error"; -'OBJ_ADAPTER'(?ORBER_VMCID bor 9) -> "Call-back module invoked operation exported -by another module which contains a function_clause, case_clause or badarith error"; -'OBJ_ADAPTER'(?ORBER_VMCID bor 10) -> "Unknown EXIT returned by call-back module"; -'OBJ_ADAPTER'(_) -> "-". - -%% DATA_CONVERSION - OMG -'DATA_CONVERSION'(?CORBA_OMGVMCID bor 1) -> "Character does not map to negotiated -transmission code set"; -'DATA_CONVERSION'(_) -> "-". - -%% OBJECT_NOT_EXIST - OMG -'OBJECT_NOT_EXIST'(?CORBA_OMGVMCID bor 1) -> "Attempt to pass an unactivated -(unregistered) value as an object reference"; -'OBJECT_NOT_EXIST'(?CORBA_OMGVMCID bor 2) -> "Failed to create or locate Object -Adapter"; -'OBJECT_NOT_EXIST'(?CORBA_OMGVMCID bor 3) -> "Biomolecular Sequence Analysis -Service is no longer available"; -'OBJECT_NOT_EXIST'(?CORBA_OMGVMCID bor 4) -> "Object Adapter inactive"; -'OBJECT_NOT_EXIST'(_) -> "-". - -%% TRANSACTION_REQUIRED - OMG -'TRANSACTION_REQUIRED'(_) -> "-". - -%% TRANSACTION_ROLLEDBACK - OMG -'TRANSACTION_ROLLEDBACK'(_) -> "-". - -%% INVALID_TRANSACTION - OMG -'INVALID_TRANSACTION'(_) -> "-". - -%% INV_POLICY - OMG -'INV_POLICY'(?CORBA_OMGVMCID bor 1) -> "Unable to reconcile IOR specified -policy with effective policy override"; -'INV_POLICY'(?CORBA_OMGVMCID bor 2) -> "Invalid PolicyType"; -'INV_POLICY'(?CORBA_OMGVMCID bor 3) -> "No PolicyFactory has been registered -for the given PolicyType"; -'INV_POLICY'(_) -> "-". - -%% CODESET_INCOMPATIBLE - OMG -'CODESET_INCOMPATIBLE'(_) -> "-". - -%% REBIND - OMG -'REBIND'(_) -> "-". - -%% TIMEOUT - OMG -'TIMEOUT'(_) -> "-". - -%% TRANSACTION_UNAVAILABLE - OMG -'TRANSACTION_UNAVAILABLE'(_) -> "-". - -%% TRANSACTION_MODE - OMG -'TRANSACTION_MODE'(_) -> "-". - -%% BAD_QOS - OMG -'BAD_QOS'(_) -> "-". - diff --git a/lib/orber/src/orber_ifr.erl b/lib/orber/src/orber_ifr.erl deleted file mode 100644 index 70e0cb3fca..0000000000 --- a/lib/orber/src/orber_ifr.erl +++ /dev/null @@ -1,1820 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : corba_ir_impl.erl -%% Purpose : Interface Repository for CORBA -%%---------------------------------------------------------------------- - -%%% NOTES: -%%% -%%% For details about known deficiencies in this CORBA IFR -%%% implementation, see the file ../doc/src/notes.txt. -%%% - --module(orber_ifr). - --export([ -%%% Public interfaces: - init/2, - find_repository/0, - 'IRObject__get_def_kind'/1, - %%'IRObject_destroy'/1, - 'Contained__get_def_kind'/1, - %%'Contained_destroy'/1, - 'Contained__get_id'/1, - 'Contained__set_id'/2, - 'Contained__get_name'/1, - 'Contained__set_name'/2, - 'Contained__get_version'/1, - 'Contained__set_version'/2, - 'Contained__get_defined_in'/1, - 'Contained__get_absolute_name'/1, - 'Contained__get_containing_repository'/1, - 'Contained_describe'/1, - 'Contained_move'/4, - 'Container__get_def_kind'/1, - 'Container_destroy'/1, - 'Container_lookup'/2, - 'Container_contents'/3, - 'Container_lookup_name'/5, - 'Container_describe_contents'/4, - 'Container_create_module'/4, - 'Container_create_constant'/6, - 'Container_create_struct'/5, - 'Container_create_union'/6, - 'Container_create_enum'/5, - 'Container_create_alias'/5, - 'Container_create_interface'/5, - 'Container_create_exception'/5, - 'IDLType__get_def_kind'/1, - 'IDLType_destroy'/1, - 'IDLType__get_type'/1, - 'Repository__get_def_kind'/1, - 'Repository_destroy'/1, - 'Repository_lookup'/2, - 'Repository_contents'/3, - 'Repository_lookup_name'/5, - 'Repository_describe_contents'/4, - 'Repository_create_module'/4, - 'Repository_create_constant'/6, - 'Repository_create_struct'/5, - 'Repository_create_union'/6, - 'Repository_create_enum'/5, - 'Repository_create_alias'/5, - 'Repository_create_interface'/5, - 'Repository_create_exception'/5, - 'Repository_lookup_id'/2, - 'Repository_get_primitive'/2, - 'Repository_create_string'/2, - 'Repository_create_wstring'/2, - 'Repository_create_sequence'/3, - 'Repository_create_array'/3, - 'Repository_create_idltype'/2, %not in CORBA 2.0 - 'ModuleDef__get_def_kind'/1, - 'ModuleDef_destroy'/1, - 'ModuleDef_lookup'/2, - 'ModuleDef_contents'/3, - 'ModuleDef_lookup_name'/5, - 'ModuleDef_describe_contents'/4, - 'ModuleDef_create_module'/4, - 'ModuleDef_create_constant'/6, - 'ModuleDef_create_struct'/5, - 'ModuleDef_create_union'/6, - 'ModuleDef_create_enum'/5, - 'ModuleDef_create_alias'/5, - 'ModuleDef_create_interface'/5, - 'ModuleDef_create_exception'/5, - 'ModuleDef__get_id'/1, - 'ModuleDef__set_id'/2, - 'ModuleDef__get_name'/1, - 'ModuleDef__set_name'/2, - 'ModuleDef__get_version'/1, - 'ModuleDef__set_version'/2, - 'ModuleDef__get_defined_in'/1, - 'ModuleDef__get_absolute_name'/1, - 'ModuleDef__get_containing_repository'/1, - 'ModuleDef_describe'/1, - 'ModuleDef_move'/4, - 'ConstantDef__get_def_kind'/1, - 'ConstantDef_destroy'/1, - 'ConstantDef__get_id'/1, - 'ConstantDef__set_id'/2, - 'ConstantDef__get_name'/1, - 'ConstantDef__set_name'/2, - 'ConstantDef__get_version'/1, - 'ConstantDef__set_version'/2, - 'ConstantDef__get_defined_in'/1, - 'ConstantDef__get_absolute_name'/1, - 'ConstantDef__get_containing_repository'/1, - 'ConstantDef_describe'/1, - 'ConstantDef_move'/4, - 'ConstantDef__get_type'/1, - 'ConstantDef__get_type_def'/1, - 'ConstantDef__set_type_def'/2, - 'ConstantDef__get_value'/1, - 'ConstantDef__set_value'/2, - 'TypedefDef__get_def_kind'/1, - 'TypedefDef_destroy'/1, - 'TypedefDef__get_id'/1, - 'TypedefDef__set_id'/2, - 'TypedefDef__get_name'/1, - 'TypedefDef__set_name'/2, - 'TypedefDef__get_version'/1, - 'TypedefDef__set_version'/2, - 'TypedefDef__get_defined_in'/1, - 'TypedefDef__get_absolute_name'/1, - 'TypedefDef__get_containing_repository'/1, - 'TypedefDef_describe'/1, - 'TypedefDef_move'/4, - 'TypedefDef__get_type'/1, - 'StructDef__get_def_kind'/1, - 'StructDef_destroy'/1, - 'StructDef__get_id'/1, - 'StructDef__set_id'/2, - 'StructDef__get_name'/1, - 'StructDef__set_name'/2, - 'StructDef__get_version'/1, - 'StructDef__set_version'/2, - 'StructDef__get_defined_in'/1, - 'StructDef__get_absolute_name'/1, - 'StructDef__get_containing_repository'/1, - 'StructDef_describe'/1, - 'StructDef_move'/4, - 'StructDef__get_type'/1, - 'StructDef__get_members'/1, - 'StructDef__set_members'/2, - 'UnionDef__get_def_kind'/1, - 'UnionDef_destroy'/1, - 'UnionDef__get_id'/1, - 'UnionDef__set_id'/2, - 'UnionDef__get_name'/1, - 'UnionDef__set_name'/2, - 'UnionDef__get_version'/1, - 'UnionDef__set_version'/2, - 'UnionDef__get_defined_in'/1, - 'UnionDef__get_absolute_name'/1, - 'UnionDef__get_containing_repository'/1, - 'UnionDef_describe'/1, - 'UnionDef_move'/4, - 'UnionDef__get_type'/1, - 'UnionDef__get_discriminator_type'/1, - 'UnionDef__get_discriminator_type_def'/1, - 'UnionDef__set_discriminator_type_def'/2, - 'UnionDef__get_members'/1, - 'UnionDef__set_members'/2, - 'EnumDef__get_def_kind'/1, - 'EnumDef_destroy'/1, - 'EnumDef__get_id'/1, - 'EnumDef__set_id'/2, - 'EnumDef__get_name'/1, - 'EnumDef__set_name'/2, - 'EnumDef__get_version'/1, - 'EnumDef__set_version'/2, - 'EnumDef__get_defined_in'/1, - 'EnumDef__get_absolute_name'/1, - 'EnumDef__get_containing_repository'/1, - 'EnumDef_describe'/1, - 'EnumDef_move'/4, - 'EnumDef__get_type'/1, - 'EnumDef__get_members'/1, - 'EnumDef__set_members'/2, - 'AliasDef__get_def_kind'/1, - 'AliasDef_destroy'/1, - 'AliasDef__get_id'/1, - 'AliasDef__set_id'/2, - 'AliasDef__get_name'/1, - 'AliasDef__set_name'/2, - 'AliasDef__get_version'/1, - 'AliasDef__set_version'/2, - 'AliasDef__get_defined_in'/1, - 'AliasDef__get_absolute_name'/1, - 'AliasDef__get_containing_repository'/1, - 'AliasDef_describe'/1, - 'AliasDef_move'/4, - 'AliasDef__get_type'/1, - 'AliasDef__get_original_type_def'/1, - 'AliasDef__set_original_type_def'/2, - 'PrimitiveDef__get_def_kind'/1, - 'PrimitiveDef_destroy'/1, - 'PrimitiveDef__get_type'/1, - 'PrimitiveDef__get_kind'/1, - 'StringDef__get_def_kind'/1, - 'StringDef_destroy'/1, - 'StringDef__get_type'/1, - 'StringDef__get_bound'/1, - 'StringDef__set_bound'/2, - 'WstringDef__get_def_kind'/1, - 'WstringDef_destroy'/1, - 'WstringDef__get_type'/1, - 'WstringDef__get_bound'/1, - 'WstringDef__set_bound'/2, - 'FixedDef__get_def_kind'/1, - 'FixedDef_destroy'/1, - 'FixedDef__get_type'/1, - 'FixedDef__get_digits'/1, - 'FixedDef__set_digits'/2, - 'FixedDef__get_scale'/1, - 'FixedDef__set_scale'/2, - 'SequenceDef__get_def_kind'/1, - 'SequenceDef_destroy'/1, - 'SequenceDef__get_type'/1, - 'SequenceDef__get_bound'/1, - 'SequenceDef__set_bound'/2, - 'SequenceDef__get_element_type'/1, - 'SequenceDef__get_element_type_def'/1, - 'SequenceDef__set_element_type_def'/2, - 'ArrayDef__get_def_kind'/1, - 'ArrayDef_destroy'/1, - 'ArrayDef__get_type'/1, - 'ArrayDef__get_length'/1, - 'ArrayDef__set_length'/2, - 'ArrayDef__get_element_type'/1, - 'ArrayDef__get_element_type_def'/1, - 'ArrayDef__set_element_type_def'/2, - 'ExceptionDef__get_def_kind'/1, - 'ExceptionDef_destroy'/1, - 'ExceptionDef__get_id'/1, - 'ExceptionDef__set_id'/2, - 'ExceptionDef__get_name'/1, - 'ExceptionDef__set_name'/2, - 'ExceptionDef__get_version'/1, - 'ExceptionDef__set_version'/2, - 'ExceptionDef__get_defined_in'/1, - 'ExceptionDef__get_absolute_name'/1, - 'ExceptionDef__get_containing_repository'/1, - 'ExceptionDef_describe'/1, - 'ExceptionDef_move'/4, - 'ExceptionDef__get_type'/1, - 'ExceptionDef__get_members'/1, - 'ExceptionDef__set_members'/2, - 'AttributeDef__get_def_kind'/1, - 'AttributeDef_destroy'/1, - 'AttributeDef__get_id'/1, - 'AttributeDef__set_id'/2, - 'AttributeDef__get_name'/1, - 'AttributeDef__set_name'/2, - 'AttributeDef__get_version'/1, - 'AttributeDef__set_version'/2, - 'AttributeDef__get_defined_in'/1, - 'AttributeDef__get_absolute_name'/1, - 'AttributeDef__get_containing_repository'/1, - 'AttributeDef_describe'/1, - 'AttributeDef_move'/4, - 'AttributeDef__get_type'/1, - 'AttributeDef__get_type_def'/1, - 'AttributeDef__set_type_def'/2, - 'AttributeDef__get_mode'/1, - 'AttributeDef__set_mode'/2, - 'OperationDef__get_def_kind'/1, - 'OperationDef_destroy'/1, - 'OperationDef__get_id'/1, - 'OperationDef__set_id'/2, - 'OperationDef__get_name'/1, - 'OperationDef__set_name'/2, - 'OperationDef__get_version'/1, - 'OperationDef__set_version'/2, - 'OperationDef__get_defined_in'/1, - 'OperationDef__get_absolute_name'/1, - 'OperationDef__get_containing_repository'/1, - 'OperationDef_describe'/1, - 'OperationDef_move'/4, - 'OperationDef__get_result'/1, - 'OperationDef__get_result_def'/1, - 'OperationDef__set_result_def'/2, - 'OperationDef__get_params'/1, - 'OperationDef__set_params'/2, - 'OperationDef__get_mode'/1, - 'OperationDef__set_mode'/2, - 'OperationDef__get_contexts'/1, - 'OperationDef__set_contexts'/2, - 'OperationDef__get_exceptions'/1, - 'OperationDef__set_exceptions'/2, - 'InterfaceDef__get_def_kind'/1, - 'InterfaceDef_destroy'/1, - 'InterfaceDef_lookup'/2, - 'InterfaceDef_contents'/3, - 'InterfaceDef_lookup_name'/5, - 'InterfaceDef_describe_contents'/4, - 'InterfaceDef_create_module'/4, - 'InterfaceDef_create_constant'/6, - 'InterfaceDef_create_struct'/5, - 'InterfaceDef_create_union'/6, - 'InterfaceDef_create_enum'/5, - 'InterfaceDef_create_alias'/5, - 'InterfaceDef_create_interface'/5, - 'InterfaceDef_create_exception'/5, - 'InterfaceDef__get_id'/1, - 'InterfaceDef__set_id'/2, - 'InterfaceDef__get_name'/1, - 'InterfaceDef__set_name'/2, - 'InterfaceDef__get_version'/1, - 'InterfaceDef__set_version'/2, - 'InterfaceDef__get_defined_in'/1, - 'InterfaceDef__get_absolute_name'/1, - 'InterfaceDef__get_containing_repository'/1, - 'InterfaceDef_describe'/1, - 'InterfaceDef_move'/4, - 'InterfaceDef__get_type'/1, - 'InterfaceDef__get_base_interfaces'/1, - 'InterfaceDef__set_base_interfaces'/2, - 'InterfaceDef_is_a'/2, - 'InterfaceDef_describe_interface'/1, - 'InterfaceDef_create_attribute'/6, - 'InterfaceDef_create_operation'/9, - %%'TypeCode_equal'/2, - %%'TypeCode_kind'/1, - %%'TypeCode_id'/1, - %%'TypeCode_name'/1, - %%'TypeCode_member_count'/1, - %%'TypeCode_member_name'/2, - %%'TypeCode_member_type'/2, - %%'TypeCode_member_label'/2, - %%'TypeCode_discriminator_type'/1, - %%'TypeCode_default_index'/1, - %%'TypeCode_length'/1, - %%'TypeCode_content_type'/1, - %%'TypeCode_param_count'/1, - %%'TypeCode_parameter'/2, - 'ORB_create_struct_tc'/3, - 'ORB_create_union_tc'/4, - 'ORB_create_enum_tc'/3, - 'ORB_create_alias_tc'/3, - 'ORB_create_exception_tc'/3, - 'ORB_create_interface_tc'/2, - 'ORB_create_string_tc'/1, - 'ORB_create_wstring_tc'/1, - 'ORB_create_sequence_tc'/2, - 'ORB_create_recursive_sequence_tc'/2, - 'ORB_create_array_tc'/2, -%%% "Methods" of the IFR "objects" - get_def_kind/1, - destroy/1, - get_id/1, - set_id/2, - get_name/1, - set_name/2, - get_version/1, - set_version/2, - get_defined_in/1, - get_absolute_name/1, - get_containing_repository/1, - describe/1, - move/4, - lookup/2, - contents/3, - lookup_name/5, - describe_contents/4, - create_module/4, - create_constant/6, - create_struct/5, - create_union/6, - create_enum/5, - create_alias/5, - create_interface/5, - create_exception/5, - get_type/1, - lookup_id/2, - get_primitive/2, - create_string/2, - create_wstring/2, - create_sequence/3, - create_array/3, - create_idltype/2, %not in CORBA 2.0 - create_fixed/3, - get_type_def/1, - set_type_def/2, - get_value/1, - set_value/2, - get_members/1, - set_members/2, - get_discriminator_type/1, - get_discriminator_type_def/1, - set_discriminator_type_def/2, - get_original_type_def/1, - set_original_type_def/2, - get_kind/1, - get_bound/1, - set_bound/2, - get_element_type/1, - get_element_type_def/1, - set_element_type_def/2, - get_length/1, - set_length/2, - get_mode/1, - set_mode/2, - get_result/1, - get_result_def/1, - set_result_def/2, - get_params/1, - set_params/2, - get_contexts/1, - set_contexts/2, - get_exceptions/1, - set_exceptions/2, - get_base_interfaces/1, - set_base_interfaces/2, - is_a/2, - describe_interface/1, - create_attribute/6, - create_operation/9 - ]). - -%% Light IFR operations --export([initialize/3, - get_module/2, - get_tc/2, - add_module/3, add_module/4, - add_constant/3, add_constant/4, - add_struct/3, add_struct/4, - add_union/3, add_union/4, - add_enum/3, add_enum/4, - add_alias/3, add_alias/4, - add_interface/3, add_interface/4, - add_exception/3, add_exception/4, - remove/2, - add_items/3]). - - --include_lib("orber/include/corba.hrl"). --include("orber_ifr.hrl"). --include("ifr_objects.hrl"). - -%%====================================================================== -%% Public interfaces to the IFR -%%====================================================================== -%%=================== Light IFR operations ============================= -%%---------------------------------------------------------------------- -%% Function : get_module -%% Arguments : Id - string() -%% Type - ?IFR_ModuleDef | ?IFR_ConstantDef | ?IFR_StructDef | -%% ?IFR_UnionDef | ?IFR_EnumDef | ?IFR_AliasDef | -%% ?IFR_InterfaceDef | ?IFR_ExceptionDef -%% Returns : Module - atom() | {'EXCEPTION', E} -%% Raises : #'MARSHAL'{} -%% Description: -%%---------------------------------------------------------------------- -get_module(Id, Type) -> - case mnesia:dirty_read(orber_light_ifr, Id) of - [#orber_light_ifr{module = Module, type = Type}] -> - Module; - What -> - orber:dbg("[~p] ~p:get_module(~p, ~p).~n" - "Id doesn't exist, mismatch Id vs Type or DB error: ~p", - [?LINE, ?MODULE, Id, Type, What], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}) - end. - - -%%---------------------------------------------------------------------- -%% Function : get_tc -%% Arguments : Id - string() -%% Type - ?IFR_ModuleDef | ?IFR_ConstantDef | ?IFR_StructDef | -%% ?IFR_UnionDef | ?IFR_EnumDef | ?IFR_AliasDef | -%% ?IFR_InterfaceDef | ?IFR_ExceptionDef -%% Returns : Module - atom() | {'EXCEPTION', E} -%% Raises : #'MARSHAL'{} -%% Description: This function may *only* return correct TypeCode or raise -%% a system exception!! -%%---------------------------------------------------------------------- -get_tc(Id, Type) -> - case catch mnesia:dirty_read(orber_light_ifr, Id) of - [#orber_light_ifr{module = Module, type = Type}] -> - case catch Module:tc() of - {'EXIT', Reason} -> - case Reason of - {undef,[{Module, tc,[],_}|_]} -> - orber:dbg("[~p] ~p:get_tc(~p);~nMissing ~p:tc()~n", - [?LINE, ?MODULE, Id, Module], ?DEBUG_LEVEL), - corba:raise(#'UNKNOWN'{minor=(?ORBER_VMCID bor 1), - completion_status=?COMPLETED_MAYBE}); - _ -> - orber:dbg("[~p] ~p:get_tc(~p, ~p);~nEXIT reason: ~p~n", - [?LINE, ?MODULE, Id, Module, Reason], - ?DEBUG_LEVEL), - corba:raise(#'UNKNOWN'{minor=(?CORBA_OMGVMCID bor 1), - completion_status=?COMPLETED_MAYBE}) - end; - TC -> - TC - end; - What when Type == ?IFR_ExceptionDef -> - orber:dbg("[~p] ~p:get_tc(~p, ExceptionDef);~nUnknown: ~p~n", - [?LINE, ?MODULE, Id, What], ?DEBUG_LEVEL), - corba:raise(#'UNKNOWN'{completion_status=?COMPLETED_MAYBE}); - What -> - orber:dbg("[~p] ~p:get_tc(~p, ~p);~nUnknown: ~p~n", - [?LINE, ?MODULE, Id, Type, What], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}) - end. - -%%---------------------------------------------------------------------- -%% Function : initialize -%% Arguments : Timeout - integer() | infinity -%% Options - [{Key, Value}] -%% LightIFR - true | false -%% Returns : ok | {'EXCEPTION', E} -%% Raises : #'INTF_REPOS'{} -%% Description: -%%---------------------------------------------------------------------- -initialize(Timeout, Options, LightIFR) -> - orber_ifr_utils:init_DB(Timeout, Options, LightIFR). - -%%---------------------------------------------------------------------- -%% Function : add_X -%% Arguments : Id - string() -%% Module - atom() -%% BaseId - string() -%% Returns : -%% Raises : -%% Description: -%%---------------------------------------------------------------------- -add_module(Id, Module, BaseId) -> - add_it(Id, Module, BaseId, ?IFR_ModuleDef, false). -add_module(Id, Module, BaseId, Transaction) -> - add_it(Id, Module, BaseId, ?IFR_ModuleDef, Transaction). - -add_constant(Id, Module, BaseId) -> - add_it(Id, Module, BaseId, ?IFR_ConstantDef, false). -add_constant(Id, Module, BaseId, Transaction) -> - add_it(Id, Module, BaseId, ?IFR_ConstantDef, Transaction). - -add_struct(Id, Module, BaseId) -> - add_it(Id, Module, BaseId, ?IFR_StructDef, false). -add_struct(Id, Module, BaseId, Transaction) -> - add_it(Id, Module, BaseId, ?IFR_StructDef, Transaction). - -add_union(Id, Module, BaseId) -> - add_it(Id, Module, BaseId, ?IFR_UnionDef, false). -add_union(Id, Module, BaseId, Transaction) -> - add_it(Id, Module, BaseId, ?IFR_UnionDef, Transaction). - -add_enum(Id, Module, BaseId) -> - add_it(Id, Module, BaseId, ?IFR_EnumDef, false). -add_enum(Id, Module, BaseId, Transaction) -> - add_it(Id, Module, BaseId, ?IFR_EnumDef, Transaction). - -add_alias(Id, Module, BaseId) -> - add_it(Id, Module, BaseId, ?IFR_AliasDef, false). -add_alias(Id, Module, BaseId, Transaction) -> - add_it(Id, Module, BaseId, ?IFR_AliasDef, Transaction). - -add_interface(Id, Module, BaseId) -> - add_it(Id, Module, BaseId, ?IFR_InterfaceDef, false). -add_interface(Id, Module, BaseId, Transaction) -> - add_it(Id, Module, BaseId, ?IFR_InterfaceDef, Transaction). - -add_exception(Id, Module, BaseId) -> - add_it(Id, Module, BaseId, ?IFR_ExceptionDef, false). -add_exception(Id, Module, BaseId, Transaction) -> - add_it(Id, Module, BaseId, ?IFR_ExceptionDef, Transaction). - - -%%---------------------------------------------------------------------- -%% Function : add_it -%% Arguments : Id - string() -%% Module - atom() -%% BaseId - string() -%% Type - ?IFR_ModuleDef | ?IFR_ConstantDef | ?IFR_StructDef | -%% ?IFR_UnionDef | ?IFR_EnumDef | ?IFR_AliasDef | -%% ?IFR_InterfaceDef | ?IFR_ExceptionDef -%% Transaction - true | false -%% Returns : -%% Raises : -%% Description: -%%---------------------------------------------------------------------- -add_it(Id, Module, BaseId, Type, true) -> - F = fun() -> - D = #orber_light_ifr{id = Id, module = Module, - type = Type, base_id = BaseId}, - mnesia:write(D) - end, - case mnesia:transaction(F) of - {aborted, Reason} -> - orber:dbg("[~p] orber_ifr:add_it(~p). aborted:~n~p~n", - [?LINE, Id, Reason], ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}); - {atomic, _} -> - ok - end; -add_it(Id, Module, BaseId, Type, false) -> - D = #orber_light_ifr{id = Id, module = Module, - type = Type, base_id = BaseId}, - mnesia:write(D). - -%%---------------------------------------------------------------------- -%% Function : remove -%% Arguments : BaseId - atom() -%% Options - [KeyValue] -%% KeyValue - {storage, mnesia | ets} -%% Returns : -%% Raises : -%% Description: -%%---------------------------------------------------------------------- -remove(ContainerId, _Options) -> - F = fun() -> - MatchHead = #orber_light_ifr{id = '$1', base_id = ContainerId, _='_'}, - Result = '$1', - IdList = mnesia:select(orber_light_ifr, - [{MatchHead, [], [Result]}], - write), - lists:foreach(fun(RefId) -> - mnesia:delete({orber_light_ifr, RefId}) - end, IdList) - end, - case mnesia:transaction(F) of - {aborted, Reason} -> - orber:dbg("[~p] orber_ifr:remove(~p). aborted:~n~p~n", - [?LINE, ContainerId, Reason], ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}); - {atomic, _} -> - ok - end. - -%%---------------------------------------------------------------------- -%% Function : add_items -%% Arguments : ContainerId - atom() -%% Options - [KeyValue] -%% KeyValue - {storage, mnesia | ets} -%% Items - [{Id, Module, Type}] -%% Id - string() -%% Module - atom() -%% Type - struct | except | union | interface -%% Returns : -%% Raises : -%% Description: -%%---------------------------------------------------------------------- -add_items(ContainerId, _Options, Items) -> - F = fun() -> - mnesia:write_lock_table(orber_light_ifr), - add_items_helper(Items, ContainerId) - end, - case mnesia:transaction(F) of - {aborted, Reason} -> - orber:dbg("[~p] orber_ifr:add_items(~p). aborted:~n~p~n", - [?LINE, ContainerId, Reason], ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}); - {atomic, _} -> - ok - end. - -add_items_helper([{Id, Module, struct}|T], ContainerId) -> - add_it(Id, Module, ContainerId, ?IFR_StructDef, false), - add_items_helper(T, ContainerId); -add_items_helper([{Id, Module, interface}|T], ContainerId) -> - add_it(Id, Module, ContainerId, ?IFR_InterfaceDef, false), - add_items_helper(T, ContainerId); -add_items_helper([{Id, Module, except}|T], ContainerId) -> - add_it(Id, Module, ContainerId, ?IFR_ExceptionDef, false), - add_items_helper(T, ContainerId); -add_items_helper([{Id, Module, union}|T], ContainerId) -> - add_it(Id, Module, ContainerId, ?IFR_UnionDef, false), - add_items_helper(T, ContainerId); -add_items_helper([ok], _) -> - ok. - - -%%=================== End Light IFR operations ========================= - -%% Initialize the database -init(Nodes, Timeout) when is_atom(Timeout) orelse is_integer(Timeout) -> - orber_ifr_utils:init_DB(Timeout, [{disc_copies, Nodes}]); -init(Timeout, Nodes) -> - orber_ifr_utils:init_DB(Timeout, [{disc_copies, Nodes}]). - - -%%% Find the repository -find_repository() -> - orber_ifr_utils:create_repository(). - -'IRObject__get_def_kind'(Objref) -> - orber_ifr_irobject:'_get_def_kind'(Objref). -%%'IRObject_destroy'(Objref) -> -%% orber_ifr_irobject:destroy(Objref). - -'Contained__get_def_kind'(Objref) -> - orber_ifr_contained:'_get_def_kind'(Objref). -%%'Contained_destroy'(Objref) -> -%% orber_ifr_contained:destroy(Objref). -'Contained__get_id'(Objref) -> - orber_ifr_contained:'_get_id'(Objref). -'Contained__set_id'(Objref,Id) -> - orber_ifr_contained:'_set_id'(Objref,Id). -'Contained__get_name'(Objref) -> - orber_ifr_contained:'_get_name'(Objref). -'Contained__set_name'(Objref,Name) -> - orber_ifr_contained:'_set_name'(Objref,Name). -'Contained__get_version'(Objref) -> - orber_ifr_contained:'_get_version'(Objref). -'Contained__set_version'(Objref,Version) -> - orber_ifr_contained:'_set_version'(Objref,Version). -'Contained__get_defined_in'(Objref) -> - orber_ifr_contained:'_get_defined_in'(Objref). -'Contained__get_absolute_name'(Objref) -> - orber_ifr_contained:'_get_absolute_name'(Objref). -'Contained__get_containing_repository'(Objref) -> - orber_ifr_contained:'_get_containing_repository'(Objref). -'Contained_describe'(Objref) -> - orber_ifr_contained:describe(Objref). -'Contained_move'(Objref,New_container,New_name,New_version) -> - orber_ifr_contained:move(Objref,New_container,New_name,New_version). - -'Container__get_def_kind'(Objref) -> - orber_ifr_container:'_get_def_kind'(Objref). -'Container_destroy'(Objref) -> - orber_ifr_container:destroy(Objref). -'Container_lookup'(Objref,Search_name) -> - orber_ifr_container:lookup(Objref,Search_name). -'Container_contents'(Objref,Limit_type,Exclude_inherited) -> - orber_ifr_container:contents(Objref,Limit_type,Exclude_inherited). -'Container_lookup_name'(Objref,Search_name,Levels_to_search,Limit_type, - Exclude_inherited) -> - orber_ifr_container:lookup_name(Objref,Search_name,Levels_to_search,Limit_type, - Exclude_inherited). -'Container_describe_contents'(Objref,Limit_type,Exclude_inherited, - Max_returned_objs) -> - orber_ifr_container:describe_contents(Objref,Limit_type,Exclude_inherited, - Max_returned_objs). -'Container_create_module'(Objref,Id,Name,Version) -> - orber_ifr_container:create_module(Objref,Id,Name,Version). -'Container_create_constant'(Objref,Id,Name,Version,Type,Value) -> - orber_ifr_container:create_constant(Objref,Id,Name,Version,Type,Value). -'Container_create_struct'(Objref,Id,Name,Version,Members) -> - orber_ifr_container:create_struct(Objref,Id,Name,Version,Members). -'Container_create_union'(Objref,Id,Name,Version,Discriminator_type,Members) -> - orber_ifr_container:create_union(Objref,Id,Name,Version,Discriminator_type, - Members). -'Container_create_enum'(Objref,Id,Name,Version,Members) -> - orber_ifr_container:create_enum(Objref,Id,Name,Version,Members). -'Container_create_alias'(Objref,Id,Name,Version,Original_type) -> - orber_ifr_container:create_alias(Objref,Id,Name,Version,Original_type). -'Container_create_interface'(Objref,Id,Name,Version,Base_interfaces) -> - orber_ifr_container:create_interface(Objref,Id,Name,Version,Base_interfaces). -'Container_create_exception'(Objref,Id,Name,Version,Members) -> - orber_ifr_container:create_exception(Objref,Id,Name,Version,Members). - -'IDLType__get_def_kind'(Objref) -> - orber_ifr_idltype:'_get_def_kind'(Objref). -'IDLType_destroy'(Objref) -> - orber_ifr_idltype:destroy(Objref). -'IDLType__get_type'(Objref) -> - orber_ifr_idltype:'_get_type'(Objref). - -'Repository__get_def_kind'(Objref) -> - orber_ifr_repository:'_get_def_kind'(Objref). --spec 'Repository_destroy'(_) -> no_return(). -'Repository_destroy'(Objref) -> - orber_ifr_repository:destroy(Objref). -'Repository_lookup'(Objref,Search_name) -> - orber_ifr_repository:lookup(Objref,Search_name). -'Repository_contents'(Objref,Limit_type,Exclude_inherited) -> - orber_ifr_repository:contents(Objref,Limit_type,Exclude_inherited). -'Repository_lookup_name'(Objref,Search_name,Levels_to_search,Limit_type, - Exclude_inherited) -> - orber_ifr_repository:lookup_name(Objref,Search_name,Levels_to_search,Limit_type, - Exclude_inherited). -'Repository_describe_contents'(Objref,Limit_type,Exclude_inherited, - Max_returned_objs) -> - orber_ifr_repository:describe_contents(Objref,Limit_type,Exclude_inherited, - Max_returned_objs). -'Repository_create_module'(Objref,Id,Name,Version) -> - orber_ifr_repository:create_module(Objref,Id,Name,Version). -'Repository_create_constant'(Objref,Id,Name,Version,Type,Value) -> - orber_ifr_repository:create_constant(Objref,Id,Name,Version,Type,Value). -'Repository_create_struct'(Objref,Id,Name,Version,Members) -> - orber_ifr_repository:create_struct(Objref,Id,Name,Version,Members). -'Repository_create_union'(Objref,Id,Name,Version,Discriminator_type,Members) -> - orber_ifr_repository:create_union(Objref,Id,Name,Version,Discriminator_type, - Members). -'Repository_create_enum'(Objref,Id,Name,Version,Members) -> - orber_ifr_repository:create_enum(Objref,Id,Name,Version,Members). -'Repository_create_alias'(Objref,Id,Name,Version,Original_type) -> - orber_ifr_repository:create_alias(Objref,Id,Name,Version,Original_type). -'Repository_create_interface'(Objref,Id,Name,Version,Base_interfaces) -> - orber_ifr_repository:create_interface(Objref,Id,Name,Version,Base_interfaces). -'Repository_create_exception'(Objref,Id,Name,Version,Members) -> - orber_ifr_repository:create_exception(Objref,Id,Name,Version,Members). -'Repository_lookup_id'(Objref,Search_id) -> - lookup_id(Objref,Search_id). -'Repository_get_primitive'(Objref,Kind) -> - orber_ifr_repository:get_primitive(Objref,Kind). -'Repository_create_string'(Objref,Bound) -> - orber_ifr_repository:create_string(Objref,Bound). -'Repository_create_wstring'(Objref,Bound) -> - orber_ifr_repository:create_wstring(Objref,Bound). -'Repository_create_sequence'(Objref,Bound,Element_type) -> - orber_ifr_repository:create_sequence(Objref,Bound,Element_type). -'Repository_create_array'(Objref,Length,Element_type) -> - orber_ifr_repository:create_array(Objref,Length,Element_type). -'Repository_create_idltype'(Objref,Typecode) -> - orber_ifr_repository:create_idltype(Objref,Typecode). - -'ModuleDef__get_def_kind'(Objref) -> - orber_ifr_moduledef:'_get_def_kind'(Objref). -'ModuleDef_destroy'(Objref) -> - orber_ifr_moduledef:destroy(Objref). -'ModuleDef_lookup'(Objref,Search_name) -> - orber_ifr_moduledef:lookup(Objref,Search_name). -'ModuleDef_contents'(Objref,Limit_type,Exclude_inherited) -> - orber_ifr_moduledef:contents(Objref,Limit_type,Exclude_inherited). -'ModuleDef_lookup_name'(Objref,Search_name,Levels_to_search,Limit_type, - Exclude_inherited) -> - orber_ifr_moduledef:lookup_name(Objref,Search_name,Levels_to_search,Limit_type, - Exclude_inherited). -'ModuleDef_describe_contents'(Objref,Limit_type,Exclude_inherited, - Max_returned_objs) -> - orber_ifr_moduledef:describe_contents(Objref,Limit_type,Exclude_inherited, - Max_returned_objs). -'ModuleDef_create_module'(Objref,Id,Name,Version) -> - orber_ifr_moduledef:create_module(Objref,Id,Name,Version). -'ModuleDef_create_constant'(Objref,Id,Name,Version,Type,Value) -> - orber_ifr_moduledef:create_constant(Objref,Id,Name,Version,Type,Value). -'ModuleDef_create_struct'(Objref,Id,Name,Version,Members) -> - orber_ifr_moduledef:create_struct(Objref,Id,Name,Version,Members). -'ModuleDef_create_union'(Objref,Id,Name,Version,Discriminator_type,Members) -> - orber_ifr_moduledef:create_union(Objref,Id,Name,Version,Discriminator_type, - Members). -'ModuleDef_create_enum'(Objref,Id,Name,Version,Members) -> - orber_ifr_moduledef:create_enum(Objref,Id,Name,Version,Members). -'ModuleDef_create_alias'(Objref,Id,Name,Version,Original_type) -> - orber_ifr_moduledef:create_alias(Objref,Id,Name,Version,Original_type). -'ModuleDef_create_interface'(Objref,Id,Name,Version,Base_interfaces) -> - orber_ifr_moduledef:create_interface(Objref,Id,Name,Version,Base_interfaces). -'ModuleDef_create_exception'(Objref,Id,Name,Version,Members) -> - orber_ifr_moduledef:create_exception(Objref,Id,Name,Version,Members). -'ModuleDef__get_id'(Objref) -> - orber_ifr_moduledef:'_get_id'(Objref). -'ModuleDef__set_id'(Objref,Id) -> - orber_ifr_moduledef:'_set_id'(Objref,Id). -'ModuleDef__get_name'(Objref) -> - orber_ifr_moduledef:'_get_name'(Objref). -'ModuleDef__set_name'(Objref,Name) -> - orber_ifr_moduledef:'_set_name'(Objref,Name). -'ModuleDef__get_version'(Objref) -> - orber_ifr_moduledef:'_get_version'(Objref). -'ModuleDef__set_version'(Objref,Version) -> - orber_ifr_moduledef:'_set_version'(Objref,Version). -'ModuleDef__get_defined_in'(Objref) -> - orber_ifr_moduledef:'_get_defined_in'(Objref). -'ModuleDef__get_absolute_name'(Objref) -> - orber_ifr_moduledef:'_get_absolute_name'(Objref). -'ModuleDef__get_containing_repository'(Objref) -> - orber_ifr_moduledef:'_get_containing_repository'(Objref). -'ModuleDef_describe'(Objref) -> - orber_ifr_moduledef:describe(Objref). -'ModuleDef_move'(Objref,New_container,New_name,New_version) -> - orber_ifr_moduledef:move(Objref,New_container,New_name,New_version). - -'ConstantDef__get_def_kind'(Objref) -> - orber_ifr_constantdef:'_get_def_kind'(Objref). -'ConstantDef_destroy'(Objref) -> - orber_ifr_constantdef:destroy(Objref). -'ConstantDef__get_id'(Objref) -> - orber_ifr_constantdef:'_get_id'(Objref). -'ConstantDef__set_id'(Objref,Id) -> - orber_ifr_constantdef:'_set_id'(Objref,Id). -'ConstantDef__get_name'(Objref) -> - orber_ifr_constantdef:'_get_name'(Objref). -'ConstantDef__set_name'(Objref,Name) -> - orber_ifr_constantdef:'_set_name'(Objref,Name). -'ConstantDef__get_version'(Objref) -> - orber_ifr_constantdef:'_get_version'(Objref). -'ConstantDef__set_version'(Objref,Version) -> - orber_ifr_constantdef:'_set_version'(Objref,Version). -'ConstantDef__get_defined_in'(Objref) -> - orber_ifr_constantdef:'_get_defined_in'(Objref). -'ConstantDef__get_absolute_name'(Objref) -> - orber_ifr_constantdef:'_get_absolute_name'(Objref). -'ConstantDef__get_containing_repository'(Objref) -> - orber_ifr_constantdef:'_get_containing_repository'(Objref). -'ConstantDef_describe'(Objref) -> - orber_ifr_constantdef:describe(Objref). -'ConstantDef_move'(Objref,New_container,New_name,New_version) -> - orber_ifr_constantdef:move(Objref,New_container,New_name,New_version). -'ConstantDef__get_type'(Objref) -> - orber_ifr_constantdef:'_get_type'(Objref). -'ConstantDef__get_type_def'(Objref) -> - orber_ifr_constantdef:'_get_type_def'(Objref). -'ConstantDef__set_type_def'(Objref,TypeDef) -> - orber_ifr_constantdef:'_set_type_def'(Objref,TypeDef). -'ConstantDef__get_value'(Objref) -> - orber_ifr_constantdef:'_get_value'(Objref). -'ConstantDef__set_value'(Objref,Value) -> - orber_ifr_constantdef:'_set_value'(Objref,Value). - -'TypedefDef__get_def_kind'(Objref) -> - orber_ifr_typedef:'_get_def_kind'(Objref). -'TypedefDef_destroy'(Objref) -> - orber_ifr_typedef:destroy(Objref). -'TypedefDef__get_id'(Objref) -> - orber_ifr_typedef:'_get_id'(Objref). -'TypedefDef__set_id'(Objref,Id) -> - orber_ifr_typedef:'_set_id'(Objref,Id). -'TypedefDef__get_name'(Objref) -> - orber_ifr_typedef:'_get_name'(Objref). -'TypedefDef__set_name'(Objref,Name) -> - orber_ifr_typedef:'_set_name'(Objref,Name). -'TypedefDef__get_version'(Objref) -> - orber_ifr_typedef:'_get_version'(Objref). -'TypedefDef__set_version'(Objref,Version) -> - orber_ifr_typedef:'_set_version'(Objref,Version). -'TypedefDef__get_defined_in'(Objref) -> - orber_ifr_typedef:'_get_defined_in'(Objref). -'TypedefDef__get_absolute_name'(Objref) -> - orber_ifr_typedef:'_get_absolute_name'(Objref). -'TypedefDef__get_containing_repository'(Objref) -> - orber_ifr_typedef:'_get_containing_repository'(Objref). -'TypedefDef_describe'(Objref) -> - orber_ifr_typedef:describe(Objref). -'TypedefDef_move'(Objref,New_container,New_name,New_version) -> - orber_ifr_typedef:move(Objref,New_container,New_name,New_version). -'TypedefDef__get_type'(Objref) -> - orber_ifr_typedef:'_get_type'(Objref). - -'StructDef__get_def_kind'(Objref) -> - orber_ifr_structdef:'_get_def_kind'(Objref). -'StructDef_destroy'(Objref) -> - orber_ifr_structdef:destroy(Objref). -'StructDef__get_id'(Objref) -> - orber_ifr_structdef:'_get_id'(Objref). -'StructDef__set_id'(Objref,Id) -> - orber_ifr_structdef:'_set_id'(Objref,Id). -'StructDef__get_name'(Objref) -> - orber_ifr_structdef:'_get_name'(Objref). -'StructDef__set_name'(Objref,Name) -> - orber_ifr_structdef:'_set_name'(Objref,Name). -'StructDef__get_version'(Objref) -> - orber_ifr_structdef:'_get_version'(Objref). -'StructDef__set_version'(Objref,Version) -> - orber_ifr_structdef:'_set_version'(Objref,Version). -'StructDef__get_defined_in'(Objref) -> - orber_ifr_structdef:'_get_defined_in'(Objref). -'StructDef__get_absolute_name'(Objref) -> - orber_ifr_structdef:'_get_absolute_name'(Objref). -'StructDef__get_containing_repository'(Objref) -> - orber_ifr_structdef:'_get_containing_repository'(Objref). -'StructDef_describe'(Objref) -> - orber_ifr_structdef:describe(Objref). -'StructDef_move'(Objref,New_container,New_name,New_version) -> - orber_ifr_structdef:move(Objref,New_container,New_name,New_version). -'StructDef__get_type'(Objref) -> - orber_ifr_structdef:'_get_type'(Objref). -'StructDef__get_members'(Objref) -> - orber_ifr_structdef:'_get_members'(Objref). -'StructDef__set_members'(Objref,Members) -> - orber_ifr_structdef:'_set_members'(Objref,Members). - -'UnionDef__get_def_kind'(Objref) -> - orber_ifr_uniondef:'_get_def_kind'(Objref). -'UnionDef_destroy'(Objref) -> - orber_ifr_uniondef:destroy(Objref). -'UnionDef__get_id'(Objref) -> - orber_ifr_uniondef:'_get_id'(Objref). -'UnionDef__set_id'(Objref,Id) -> - orber_ifr_uniondef:'_set_id'(Objref,Id). -'UnionDef__get_name'(Objref) -> - orber_ifr_uniondef:'_get_name'(Objref). -'UnionDef__set_name'(Objref,Name) -> - orber_ifr_uniondef:'_set_name'(Objref,Name). -'UnionDef__get_version'(Objref) -> - orber_ifr_uniondef:'_get_version'(Objref). -'UnionDef__set_version'(Objref,Version) -> - orber_ifr_uniondef:'_set_version'(Objref,Version). -'UnionDef__get_defined_in'(Objref) -> - orber_ifr_uniondef:'_get_defined_in'(Objref). -'UnionDef__get_absolute_name'(Objref) -> - orber_ifr_uniondef:'_get_absolute_name'(Objref). -'UnionDef__get_containing_repository'(Objref) -> - orber_ifr_uniondef:'_get_containing_repository'(Objref). -'UnionDef_describe'(Objref) -> - orber_ifr_uniondef:describe(Objref). -'UnionDef_move'(Objref,New_container,New_name,New_version) -> - orber_ifr_uniondef:move(Objref,New_container,New_name,New_version). -'UnionDef__get_type'(Objref) -> - orber_ifr_uniondef:'_get_type'(Objref). -'UnionDef__get_discriminator_type'(Objref) -> - orber_ifr_uniondef:'_get_discriminator_type'(Objref). -'UnionDef__get_discriminator_type_def'(Objref) -> - orber_ifr_uniondef:'_get_discriminator_type_def'(Objref). -'UnionDef__set_discriminator_type_def'(Objref,TypeDef) -> - orber_ifr_uniondef:'_set_discriminator_type_def'(Objref,TypeDef). -'UnionDef__get_members'(Objref) -> - orber_ifr_uniondef:'_get_members'(Objref). -'UnionDef__set_members'(Objref,Members) -> - orber_ifr_uniondef:'_set_members'(Objref,Members). - -'EnumDef__get_def_kind'(Objref) -> - orber_ifr_enumdef:'_get_def_kind'(Objref). -'EnumDef_destroy'(Objref) -> - orber_ifr_enumdef:destroy(Objref). -'EnumDef__get_id'(Objref) -> - orber_ifr_enumdef:'_get_id'(Objref). -'EnumDef__set_id'(Objref,Id) -> - orber_ifr_enumdef:'_set_id'(Objref,Id). -'EnumDef__get_name'(Objref) -> - orber_ifr_enumdef:'_get_name'(Objref). -'EnumDef__set_name'(Objref,Name) -> - orber_ifr_enumdef:'_set_name'(Objref,Name). -'EnumDef__get_version'(Objref) -> - orber_ifr_enumdef:'_get_version'(Objref). -'EnumDef__set_version'(Objref,Version) -> - orber_ifr_enumdef:'_set_version'(Objref,Version). -'EnumDef__get_defined_in'(Objref) -> - orber_ifr_enumdef:'_get_defined_in'(Objref). -'EnumDef__get_absolute_name'(Objref) -> - orber_ifr_enumdef:'_get_absolute_name'(Objref). -'EnumDef__get_containing_repository'(Objref) -> - orber_ifr_enumdef:'_get_containing_repository'(Objref). -'EnumDef_describe'(Objref) -> - orber_ifr_enumdef:describe(Objref). -'EnumDef_move'(Objref,New_container,New_name,New_version) -> - orber_ifr_enumdef:move(Objref,New_container,New_name,New_version). -'EnumDef__get_type'(Objref) -> - orber_ifr_enumdef:'_get_type'(Objref). -'EnumDef__get_members'(Objref) -> - orber_ifr_enumdef:'_get_members'(Objref). -'EnumDef__set_members'(Objref,Members) -> - orber_ifr_enumdef:'_set_members'(Objref,Members). - -'AliasDef__get_def_kind'(Objref) -> - orber_ifr_aliasdef:'_get_def_kind'(Objref). -'AliasDef_destroy'(Objref) -> - orber_ifr_aliasdef:destroy(Objref). -'AliasDef__get_id'(Objref) -> - orber_ifr_aliasdef:'_get_id'(Objref). -'AliasDef__set_id'(Objref,Id) -> - orber_ifr_aliasdef:'_set_id'(Objref,Id). -'AliasDef__get_name'(Objref) -> - orber_ifr_aliasdef:'_get_name'(Objref). -'AliasDef__set_name'(Objref,Name) -> - orber_ifr_aliasdef:'_set_name'(Objref,Name). -'AliasDef__get_version'(Objref) -> - orber_ifr_aliasdef:'_get_version'(Objref). -'AliasDef__set_version'(Objref,Version) -> - orber_ifr_aliasdef:'_set_version'(Objref,Version). -'AliasDef__get_defined_in'(Objref) -> - orber_ifr_aliasdef:'_get_defined_in'(Objref). -'AliasDef__get_absolute_name'(Objref) -> - orber_ifr_aliasdef:'_get_absolute_name'(Objref). -'AliasDef__get_containing_repository'(Objref) -> - orber_ifr_aliasdef:'_get_containing_repository'(Objref). -'AliasDef_describe'(Objref) -> - orber_ifr_aliasdef:describe(Objref). -'AliasDef_move'(Objref,New_container,New_name,New_version) -> - orber_ifr_aliasdef:move(Objref,New_container,New_name,New_version). -'AliasDef__get_type'(Objref) -> - orber_ifr_aliasdef:'_get_type'(Objref). -'AliasDef__get_original_type_def'(Objref) -> - orber_ifr_aliasdef:'_get_original_type_def'(Objref). -'AliasDef__set_original_type_def'(Objref,TypeDef) -> - orber_ifr_aliasdef:'_set_original_type_def'(Objref,TypeDef). - -'PrimitiveDef__get_def_kind'(Objref) -> - orber_ifr_primitivedef:'_get_def_kind'(Objref). -'PrimitiveDef_destroy'(Objref) -> - orber_ifr_primitivedef:destroy(Objref). -'PrimitiveDef__get_type'(Objref) -> - orber_ifr_primitivedef:'_get_type'(Objref). -'PrimitiveDef__get_kind'(Objref) -> - orber_ifr_primitivedef:'_get_kind'(Objref). - -'StringDef__get_def_kind'(Objref) -> - orber_ifr_stringdef:'_get_def_kind'(Objref). -'StringDef_destroy'(Objref) -> - orber_ifr_stringdef:destroy(Objref). -'StringDef__get_type'(Objref) -> - orber_ifr_stringdef:'_get_type'(Objref). -'StringDef__get_bound'(Objref) -> - orber_ifr_stringdef:'_get_bound'(Objref). -'StringDef__set_bound'(Objref,Bound) -> - orber_ifr_stringdef:'_set_bound'(Objref,Bound). - -'WstringDef__get_def_kind'(Objref) -> - orber_ifr_wstringdef:'_get_def_kind'(Objref). -'WstringDef_destroy'(Objref) -> - orber_ifr_wstringdef:destroy(Objref). -'WstringDef__get_type'(Objref) -> - orber_ifr_wstringdef:'_get_type'(Objref). -'WstringDef__get_bound'(Objref) -> - orber_ifr_wstringdef:'_get_bound'(Objref). -'WstringDef__set_bound'(Objref,Bound) -> - orber_ifr_wstringdef:'_set_bound'(Objref,Bound). - -'FixedDef__get_def_kind'(Objref) -> - orber_ifr_fixeddef:'_get_def_kind'(Objref). -'FixedDef_destroy'(Objref) -> - orber_ifr_fixeddef:destroy(Objref). -'FixedDef__get_type'(Objref) -> - orber_ifr_fixeddef:'_get_type'(Objref). -'FixedDef__get_digits'(Objref) -> - orber_ifr_fixeddef:'_get_digits'(Objref). -'FixedDef__set_digits'(Objref,Digits) -> - orber_ifr_fixeddef:'_set_digits'(Objref,Digits). -'FixedDef__get_scale'(Objref) -> - orber_ifr_fixeddef:'_get_scale'(Objref). -'FixedDef__set_scale'(Objref,Scale) -> - orber_ifr_fixeddef:'_set_scale'(Objref,Scale). - -'SequenceDef__get_def_kind'(Objref) -> - orber_ifr_sequencedef:'_get_def_kind'(Objref). -'SequenceDef_destroy'(Objref) -> - orber_ifr_sequencedef:destroy(Objref). -'SequenceDef__get_type'(Objref) -> - orber_ifr_sequencedef:'_get_type'(Objref). -'SequenceDef__get_bound'(Objref) -> - orber_ifr_sequencedef:'_get_bound'(Objref). -'SequenceDef__set_bound'(Objref,Bound) -> - orber_ifr_sequencedef:'_set_bound'(Objref,Bound). -'SequenceDef__get_element_type'(Objref) -> - orber_ifr_sequencedef:'_get_element_type'(Objref). -'SequenceDef__get_element_type_def'(Objref) -> - orber_ifr_sequencedef:'_get_element_type_def'(Objref). -'SequenceDef__set_element_type_def'(Objref,TypeDef) -> - orber_ifr_sequencedef:'_set_element_type_def'(Objref,TypeDef). - -'ArrayDef__get_def_kind'(Objref) -> - orber_ifr_arraydef:'_get_def_kind'(Objref). -'ArrayDef_destroy'(Objref) -> - orber_ifr_arraydef:destroy(Objref). -'ArrayDef__get_type'(Objref) -> - orber_ifr_arraydef:'_get_type'(Objref). -'ArrayDef__get_length'(Objref) -> - orber_ifr_arraydef:'_get_length'(Objref). -'ArrayDef__set_length'(Objref,Length) -> - orber_ifr_arraydef:'_set_length'(Objref,Length). -'ArrayDef__get_element_type'(Objref) -> - orber_ifr_arraydef:'_get_element_type'(Objref). -'ArrayDef__get_element_type_def'(Objref) -> - orber_ifr_arraydef:'_get_element_type_def'(Objref). -'ArrayDef__set_element_type_def'(Objref,TypeDef) -> - orber_ifr_arraydef:'_set_element_type_def'(Objref,TypeDef). - -'ExceptionDef__get_def_kind'(Objref) -> - orber_ifr_exceptiondef:'_get_def_kind'(Objref). -'ExceptionDef_destroy'(Objref) -> - orber_ifr_exceptiondef:destroy(Objref). -'ExceptionDef__get_id'(Objref) -> - orber_ifr_exceptiondef:'_get_id'(Objref). -'ExceptionDef__set_id'(Objref,Id) -> - orber_ifr_exceptiondef:'_set_id'(Objref,Id). -'ExceptionDef__get_name'(Objref) -> - orber_ifr_exceptiondef:'_get_name'(Objref). -'ExceptionDef__set_name'(Objref,Name) -> - orber_ifr_exceptiondef:'_set_name'(Objref,Name). -'ExceptionDef__get_version'(Objref) -> - orber_ifr_exceptiondef:'_get_version'(Objref). -'ExceptionDef__set_version'(Objref,Version) -> - orber_ifr_exceptiondef:'_set_version'(Objref,Version). -'ExceptionDef__get_defined_in'(Objref) -> - orber_ifr_exceptiondef:'_get_defined_in'(Objref). -'ExceptionDef__get_absolute_name'(Objref) -> - orber_ifr_exceptiondef:'_get_absolute_name'(Objref). -'ExceptionDef__get_containing_repository'(Objref) -> - orber_ifr_exceptiondef:'_get_containing_repository'(Objref). -'ExceptionDef_describe'(Objref) -> - orber_ifr_exceptiondef:describe(Objref). -'ExceptionDef_move'(Objref,New_container,New_name,New_version) -> - orber_ifr_exceptiondef:move(Objref,New_container,New_name,New_version). -'ExceptionDef__get_type'(Objref) -> - orber_ifr_exceptiondef:'_get_type'(Objref). -'ExceptionDef__get_members'(Objref) -> - orber_ifr_exceptiondef:'_get_members'(Objref). -'ExceptionDef__set_members'(Objref,Members) -> - orber_ifr_exceptiondef:'_set_members'(Objref,Members). - -'AttributeDef__get_def_kind'(Objref) -> - orber_ifr_attributedef:'_get_def_kind'(Objref). -'AttributeDef_destroy'(Objref) -> - orber_ifr_attributedef:destroy(Objref). -'AttributeDef__get_id'(Objref) -> - orber_ifr_attributedef:'_get_id'(Objref). -'AttributeDef__set_id'(Objref,Id) -> - orber_ifr_attributedef:'_set_id'(Objref,Id). -'AttributeDef__get_name'(Objref) -> - orber_ifr_attributedef:'_get_name'(Objref). -'AttributeDef__set_name'(Objref,Name) -> - orber_ifr_attributedef:'_set_name'(Objref,Name). -'AttributeDef__get_version'(Objref) -> - orber_ifr_attributedef:'_get_version'(Objref). -'AttributeDef__set_version'(Objref,Version) -> - orber_ifr_attributedef:'_set_version'(Objref,Version). -'AttributeDef__get_defined_in'(Objref) -> - orber_ifr_attributedef:'_get_defined_in'(Objref). -'AttributeDef__get_absolute_name'(Objref) -> - orber_ifr_attributedef:'_get_absolute_name'(Objref). -'AttributeDef__get_containing_repository'(Objref) -> - orber_ifr_attributedef:'_get_containing_repository'(Objref). -'AttributeDef_describe'(Objref) -> - orber_ifr_attributedef:describe(Objref). -'AttributeDef_move'(Objref,New_container,New_name,New_version) -> - orber_ifr_attributedef:move(Objref,New_container,New_name,New_version). -'AttributeDef__get_type'(Objref) -> - orber_ifr_attributedef:'_get_type'(Objref). -'AttributeDef__get_type_def'(Objref) -> - orber_ifr_attributedef:'_get_type_def'(Objref). -'AttributeDef__set_type_def'(Objref,TypeDef) -> - orber_ifr_attributedef:'_set_type_def'(Objref,TypeDef). -'AttributeDef__get_mode'(Objref) -> - orber_ifr_attributedef:'_get_mode'(Objref). -'AttributeDef__set_mode'(Objref,Mode) -> - orber_ifr_attributedef:'_set_mode'(Objref,Mode). - -'OperationDef__get_def_kind'(Objref) -> - orber_ifr_operationdef:'_get_def_kind'(Objref). -'OperationDef_destroy'(Objref) -> - orber_ifr_operationdef:destroy(Objref). -'OperationDef__get_id'(Objref) -> - orber_ifr_operationdef:'_get_id'(Objref). -'OperationDef__set_id'(Objref,Id) -> - orber_ifr_operationdef:'_set_id'(Objref,Id). -'OperationDef__get_name'(Objref) -> - orber_ifr_operationdef:'_get_name'(Objref). -'OperationDef__set_name'(Objref,Name) -> - orber_ifr_operationdef:'_set_name'(Objref,Name). -'OperationDef__get_version'(Objref) -> - orber_ifr_operationdef:'_get_version'(Objref). -'OperationDef__set_version'(Objref,Version) -> - orber_ifr_operationdef:'_set_version'(Objref,Version). -'OperationDef__get_defined_in'(Objref) -> - orber_ifr_operationdef:'_get_defined_in'(Objref). -'OperationDef__get_absolute_name'(Objref) -> - orber_ifr_operationdef:'_get_absolute_name'(Objref). -'OperationDef__get_containing_repository'(Objref) -> - orber_ifr_operationdef:'_get_containing_repository'(Objref). -'OperationDef_describe'(Objref) -> - orber_ifr_operationdef:describe(Objref). -'OperationDef_move'(Objref,New_container,New_name,New_version) -> - orber_ifr_operationdef:move(Objref,New_container,New_name,New_version). -'OperationDef__get_result'(Objref) -> - orber_ifr_operationdef:'_get_result'(Objref). -'OperationDef__get_result_def'(Objref) -> - orber_ifr_operationdef:'_get_result_def'(Objref). -'OperationDef__set_result_def'(Objref,ResultDef) -> - orber_ifr_operationdef:'_set_result_def'(Objref,ResultDef). -'OperationDef__get_params'(Objref) -> - orber_ifr_operationdef:'_get_params'(Objref). -'OperationDef__set_params'(Objref,Params) -> - orber_ifr_operationdef:'_set_params'(Objref,Params). -'OperationDef__get_mode'(Objref) -> - orber_ifr_operationdef:'_get_mode'(Objref). -'OperationDef__set_mode'(Objref,Mode) -> - orber_ifr_operationdef:'_set_mode'(Objref,Mode). -'OperationDef__get_contexts'(Objref) -> - orber_ifr_operationdef:'_get_contexts'(Objref). -'OperationDef__set_contexts'(Objref,Contexts) -> - orber_ifr_operationdef:'_set_contexts'(Objref,Contexts). -'OperationDef__get_exceptions'(Objref) -> - orber_ifr_operationdef:'_get_exceptions'(Objref). -'OperationDef__set_exceptions'(Objref,Exceptions) -> - orber_ifr_operationdef:'_set_exceptions'(Objref,Exceptions). - -'InterfaceDef__get_def_kind'(Objref) -> - orber_ifr_interfacedef:'_get_def_kind'(Objref). -'InterfaceDef_destroy'(Objref) -> - orber_ifr_interfacedef:destroy(Objref). -'InterfaceDef_lookup'(Objref,Search_name) -> - orber_ifr_interfacedef:lookup(Objref,Search_name). -'InterfaceDef_contents'(Objref,Limit_type,Exclude_inherited) -> - orber_ifr_interfacedef:contents(Objref,Limit_type,Exclude_inherited). -'InterfaceDef_lookup_name'(Objref,Search_name,Levels_to_search,Limit_type, - Exclude_inherited) -> - orber_ifr_interfacedef:lookup_name(Objref,Search_name,Levels_to_search,Limit_type, - Exclude_inherited). -'InterfaceDef_describe_contents'(Objref,Limit_type,Exclude_inherited, - Max_returned_objs) -> - orber_ifr_interfacedef:describe_contents(Objref,Limit_type,Exclude_inherited, - Max_returned_objs). -'InterfaceDef_create_module'(Objref,Id,Name,Version) -> - orber_ifr_interfacedef:create_module(Objref,Id,Name,Version). -'InterfaceDef_create_constant'(Objref,Id,Name,Version,Type,Value) -> - orber_ifr_interfacedef:create_constant(Objref,Id,Name,Version,Type,Value). -'InterfaceDef_create_struct'(Objref,Id,Name,Version,Members) -> - orber_ifr_interfacedef:create_struct(Objref,Id,Name,Version,Members). -'InterfaceDef_create_union'(Objref,Id,Name,Version,Discriminator_type, - Members) -> - orber_ifr_interfacedef:create_union(Objref,Id,Name,Version,Discriminator_type, - Members). -'InterfaceDef_create_enum'(Objref,Id,Name,Version,Members) -> - orber_ifr_interfacedef:create_enum(Objref,Id,Name,Version,Members). -'InterfaceDef_create_alias'(Objref,Id,Name,Version,Original_type) -> - orber_ifr_interfacedef:create_alias(Objref,Id,Name,Version,Original_type). -'InterfaceDef_create_interface'(Objref,Id,Name,Version,Base_interfaces) -> - orber_ifr_interfacedef:create_interface(Objref,Id,Name,Version,Base_interfaces). -'InterfaceDef_create_exception'(Objref,Id,Name,Version,Members) -> - orber_ifr_interfacedef:create_exception(Objref,Id,Name,Version,Members). -'InterfaceDef__get_id'(Objref) -> - orber_ifr_interfacedef:'_get_id'(Objref). -'InterfaceDef__set_id'(Objref,Id) -> - orber_ifr_interfacedef:'_set_id'(Objref,Id). -'InterfaceDef__get_name'(Objref) -> - orber_ifr_interfacedef:'_get_name'(Objref). -'InterfaceDef__set_name'(Objref,Name) -> - orber_ifr_interfacedef:'_set_name'(Objref,Name). -'InterfaceDef__get_version'(Objref) -> - orber_ifr_interfacedef:'_get_version'(Objref). -'InterfaceDef__set_version'(Objref,Version) -> - orber_ifr_interfacedef:'_set_version'(Objref,Version). -'InterfaceDef__get_defined_in'(Objref) -> - orber_ifr_interfacedef:'_get_defined_in'(Objref). -'InterfaceDef__get_absolute_name'(Objref) -> - orber_ifr_interfacedef:'_get_absolute_name'(Objref). -'InterfaceDef__get_containing_repository'(Objref) -> - orber_ifr_interfacedef:'_get_containing_repository'(Objref). -'InterfaceDef_describe'(Objref) -> - orber_ifr_interfacedef:describe(Objref). -'InterfaceDef_move'(Objref,New_container,New_name,New_version) -> - orber_ifr_interfacedef:move(Objref,New_container,New_name,New_version). -'InterfaceDef__get_type'(Objref) -> - orber_ifr_interfacedef:'_get_type'(Objref). -'InterfaceDef__get_base_interfaces'(Objref) -> - orber_ifr_interfacedef:'_get_base_interfaces'(Objref). -'InterfaceDef__set_base_interfaces'(Objref,BaseInterfaces) -> - orber_ifr_interfacedef:'_set_base_interfaces'(Objref,BaseInterfaces). -'InterfaceDef_is_a'(Objref,Interface_id) -> - orber_ifr_interfacedef:is_a(Objref,Interface_id). -'InterfaceDef_describe_interface'(Objref) -> - orber_ifr_interfacedef:describe_interface(Objref). -'InterfaceDef_create_attribute'(Objref,Id,Name,Version,Type,Mode) -> - orber_ifr_interfacedef:create_attribute(Objref,Id,Name,Version,Type,Mode). -'InterfaceDef_create_operation'(Objref,Id,Name,Version,Result,Mode,Params, - Exceptions,Contexts) -> - orber_ifr_interfacedef:create_operation(Objref,Id,Name,Version,Result,Mode, - Params,Exceptions,Contexts). - -%%'TypeCode_equal'(Objref,Tc) -> -%% orber_ifr_typecode:equal(Objref,Tc). -%%'TypeCode_kind'(Objref) -> -%% orber_ifr_typecode:kind(Objref). -%%'TypeCode_id'(Objref) -> -%% orber_ifr_typecode:id(Objref). -%%'TypeCode_name'(Objref) -> -%% orber_ifr_typecode:name(Objref). -%%'TypeCode_member_count'(Objref) -> -%% orber_ifr_typecode:member_count(Objref). -%%'TypeCode_member_name'(Objref,Index) -> -%% orber_ifr_typecode:member_name(Objref,Index). -%%'TypeCode_member_type'(Objref,Index) -> -%% orber_ifr_typecode:member_type(Objref,Index). -%%'TypeCode_member_label'(Objref,Index) -> -%% orber_ifr_typecode:member_label(Objref,Index). -%%'TypeCode_discriminator_type'(Objref) -> -%% orber_ifr_typecode:discriminator_type(Objref). -%%'TypeCode_default_index'(Objref) -> -%% orber_ifr_typecode:default_index(Objref). -%%'TypeCode_length'(Objref) -> -%% orber_ifr_typecode:length(Objref). -%%'TypeCode_content_type'(Objref) -> -%% orber_ifr_typecode:content_type(Objref). -%%'TypeCode_param_count'(Objref) -> -%% orber_ifr_typecode:param_count(Objref). -%%'TypeCode_parameter'(Objref,Index) -> -%% orber_ifr_typecode:parameter(Objref,Index). - -'ORB_create_struct_tc'(Id,Name,Members) -> - orber_ifr_orb:create_struct_tc(Id,Name,Members). -'ORB_create_union_tc'(Id,Name,Discriminator_type,Members) -> - orber_ifr_orb:create_union_tc(Id,Name,Discriminator_type,Members). -'ORB_create_enum_tc'(Id,Name,Members) -> - orber_ifr_orb:create_enum_tc(Id,Name,Members). -'ORB_create_alias_tc'(Id,Name,Original_type) -> - orber_ifr_orb:create_alias_tc(Id,Name,Original_type). -'ORB_create_exception_tc'(Id,Name,Members) -> - orber_ifr_orb:create_exception_tc(Id,Name,Members). -'ORB_create_interface_tc'(Id,Name) -> - orber_ifr_orb:create_interface_tc(Id,Name). -'ORB_create_string_tc'(Bound) -> - orber_ifr_orb:create_string_tc(Bound). -'ORB_create_wstring_tc'(Bound) -> - orber_ifr_orb:create_wstring_tc(Bound). -'ORB_create_sequence_tc'(Bound,Element_type) -> - orber_ifr_orb:create_sequence_tc(Bound,Element_type). --spec 'ORB_create_recursive_sequence_tc'(_,_) -> no_return(). -'ORB_create_recursive_sequence_tc'(Bound,Offset) -> - orber_ifr_orb:create_recursive_sequence_tc(Bound,Offset). -'ORB_create_array_tc'(Length,Element_type) -> - orber_ifr_orb:create_array_tc(Length,Element_type). - -%%%--------------------------------------------------------------- -%%% "Methods" of the IFR "objects" - -get_def_kind(Objref) -> - Mod = obj2mod(Objref), - Mod:'_get_def_kind'(Objref). - -%% Light IFR Operations -destroy(#orber_light_ifr_ref{data = #lightdata{id = Id}}) -> - F = fun() -> - MatchHead = #orber_light_ifr{id = '$1', base_id = Id, _='_'}, - Result = '$1', - IdList = mnesia:select(orber_light_ifr, - [{MatchHead, [], [Result]}], - write), - lists:foreach(fun(RefId) -> - mnesia:delete({orber_light_ifr, RefId}) - end, IdList) - end, - case mnesia:transaction(F) of - {aborted, _} -> - exit({"FAILED TO DELETE:", Id}); - {atomic, _} -> - ok - end; -destroy(Objref) -> - %% Destroying an ir_IRObject, ir_Contained or ir_Container directly - %% is not allowed - Mod = obj2mod(Objref), - Mod:destroy(Objref). - -%%%--------------------------------------------------------------- -%%% - -get_id(Objref) -> - Mod = obj2mod(Objref), - Mod:'_get_id'(Objref). - -set_id(Objref,Id) -> - Mod = obj2mod(Objref), - Mod:'_set_id'(Objref,Id). - -get_name(Objref) -> - Mod = obj2mod(Objref), - Mod:'_get_name'(Objref). - -set_name(Objref,Name) -> - Mod = obj2mod(Objref), - Mod:'_set_name'(Objref,Name). - -get_version(Objref) -> - Mod = obj2mod(Objref), - Mod:'_get_version'(Objref). - -set_version(Objref,Version) -> - Mod = obj2mod(Objref), - Mod:'_set_version'(Objref,Version). - -get_defined_in(Objref) -> - Mod = obj2mod(Objref), - Mod:'_get_defined_in'(Objref). - -get_absolute_name(Objref) -> - Mod = obj2mod(Objref), - Mod: '_get_absolute_name'(Objref). - -get_containing_repository(Objref) -> - Mod = obj2mod(Objref), - Mod:'_get_containing_repository'(Objref). - -describe(Objref) -> - Mod = obj2mod(Objref), - Mod:describe(Objref). - -move(Objref,New_container,New_name,New_version) -> - Mod = obj2mod(Objref), - Mod:move(Objref,New_container,New_name,New_version). - -%%%--------------------------------------------------------------- -%%% - -lookup(Objref,Search_name) -> - Mod = obj2mod(Objref), - Mod:lookup(Objref,Search_name). - -%% Light IFR Operation -contents(#orber_light_ifr_ref{data = #lightdata{id = _Id}}, - _Limit_type, _Exclude_inherited) -> - []; -contents(Objref,Limit_type,Exclude_inherited) -> - Mod = obj2mod(Objref), - Mod:contents(Objref,Limit_type,Exclude_inherited). - -lookup_name(Objref,Search_name,Levels_to_search,Limit_type,Exclude_inherited) -> - Mod = obj2mod(Objref), - Mod:lookup_name(Objref,Search_name,Levels_to_search,Limit_type,Exclude_inherited). - - -describe_contents(Objref,Limit_type,Exclude_inherited,Max_returned_objs) -> - Mod = obj2mod(Objref), - Mod:describe_contents(Objref,Limit_type,Exclude_inherited,Max_returned_objs). - -create_module(Objref,Id,Name,Version) -> - Mod = obj2mod(Objref), - Mod:create_module(Objref,Id,Name,Version). - -create_constant(Objref,Id,Name,Version,Type,Value) -> - Mod = obj2mod(Objref), - Mod:create_constant(Objref,Id,Name,Version,Type,Value). - -create_struct(Objref,Id,Name,Version,Members) -> - Mod = obj2mod(Objref), - Mod:create_struct(Objref,Id,Name,Version,Members). - -create_union(Objref,Id,Name,Version,Discriminator_type,Members) -> - Mod = obj2mod(Objref), - Mod:create_union(Objref,Id,Name,Version,Discriminator_type,Members). - -create_enum(Objref,Id,Name,Version,Members) -> - Mod = obj2mod(Objref), - Mod:create_enum(Objref,Id,Name,Version,Members). - -create_alias(Objref,Id,Name,Version,Original_type) -> - Mod = obj2mod(Objref), - Mod:create_alias(Objref,Id,Name,Version,Original_type). - -create_interface(Objref,Id,Name,Version,Base_interfaces) -> - Mod = obj2mod(Objref), - Mod:create_interface(Objref,Id,Name,Version,Base_interfaces). - -create_exception(Objref,Id,Name,Version,Members) -> - Mod = obj2mod(Objref), - Mod:create_exception(Objref,Id,Name,Version,Members). - -%%%--------------------------------------------------------------- -%%% - -get_type(Objref) -> - Mod = obj2mod(Objref), - Mod:'_get_type'(Objref). - -%%%--------------------------------------------------------------- -%%% - -%% This list should contain the data in most-likely-to-be-accessed-order. --define(INDEXED_TABLE_LIST, [{ir_ExceptionDef, #ir_ExceptionDef.id}, - {ir_InterfaceDef, #ir_InterfaceDef.id}, - {ir_ModuleDef, #ir_ModuleDef.id}, - {ir_StructDef, #ir_StructDef.id}, - {ir_UnionDef, #ir_UnionDef.id}, - {ir_AliasDef, #ir_AliasDef.id}, - {ir_TypedefDef, #ir_TypedefDef.id}, - {ir_ConstantDef, #ir_ConstantDef.id}, - {ir_EnumDef, #ir_EnumDef.id}, - {ir_AttributeDef, #ir_AttributeDef.id}, - {ir_Contained, #ir_Contained.id}, - {ir_OperationDef, #ir_OperationDef.id}]). - - -lookup_id(#orber_light_ifr_ref{}, Id) -> - case mnesia:dirty_read(orber_light_ifr, Id) of - [] -> - []; - [#orber_light_ifr{module = Mod}] -> - #orber_light_ifr_ref{data = #lightdata{scope = atom_to_list(Mod), - id = Id}} - end; -lookup_id(_Objref,Id) -> - %% We used the operation below before but it's very expensive. - %% orber_ifr_repository:lookup_id(Objref,Id) - lookup_id_helper(?INDEXED_TABLE_LIST, Id). - -lookup_id_helper([], _) -> - []; -lookup_id_helper([{Tab, IdNum}|T], Id) -> - case mnesia:dirty_index_read(Tab, Id, IdNum) of - [] -> - lookup_id_helper(T, Id); - [FoundIt] -> - {Tab, element(2, FoundIt)} - end. - -get_primitive(Objref,Kind) -> - orber_ifr_repository:get_primitive(Objref,Kind). - -create_string(Objref,Bound) -> - orber_ifr_repository:create_string(Objref,Bound). - -create_wstring(Objref,Bound) -> - orber_ifr_repository:create_wstring(Objref,Bound). - -create_sequence(Objref,Bound,Element_type) -> - orber_ifr_repository:create_sequence(Objref,Bound,Element_type). - -create_array(Objref,Length,Element_type) -> - orber_ifr_repository:create_array(Objref,Length,Element_type). - -create_idltype(Objref,Typecode) -> %not in CORBA 2.0 - orber_ifr_repository:create_idltype(Objref,Typecode). - -create_fixed(Objref, Digits, Scale) -> - orber_ifr_repository:create_fixed(Objref, Digits, Scale). - -%%%--------------------------------------------------------------- -%%% - -get_type_def(Objref) -> - Mod = obj2mod(Objref), - Mod:'_get_type_def'(Objref). - -set_type_def(Objref,TypeDef) -> - Mod = obj2mod(Objref), - Mod:'_set_type_def'(Objref,TypeDef). - -get_value(Objref) -> - orber_ifr_constantdef:'_get_value'(Objref). - -set_value(Objref,Value) -> - orber_ifr_constantdef: '_set_value'(Objref,Value). - -%%%--------------------------------------------------------------- -%%% - -get_members(Objref) -> - Mod = obj2mod(Objref), - Mod:'_get_members'(Objref). - -set_members(Objref,Members) -> - Mod = obj2mod(Objref), - Mod:'_set_members'(Objref,Members). - -%%%--------------------------------------------------------------- -%%% - -get_discriminator_type(Objref) -> - orber_ifr_uniondef:'_get_discriminator_type'(Objref). - -get_discriminator_type_def(Objref) -> - orber_ifr_uniondef:'_get_discriminator_type_def'(Objref). - -set_discriminator_type_def(Objref,TypeDef) -> - orber_ifr_uniondef:'_set_discriminator_type_def'(Objref,TypeDef). - -%%%--------------------------------------------------------------- -%%% - -get_original_type_def(Objref) -> - orber_ifr_aliasdef:'_get_original_type_def'(Objref). - -set_original_type_def(Objref,TypeDef) -> - orber_ifr_aliasdef:'_set_original_type_def'(Objref,TypeDef). - -%%%--------------------------------------------------------------- -%%% - -get_kind(Objref) -> - orber_ifr_primitivedef:'_get_kind'(Objref). - -%%%--------------------------------------------------------------- -%%% - -get_bound(Objref) -> - Mod = obj2mod(Objref), - Mod:'_get_bound'(Objref). - -set_bound(Objref,Bound) -> - Mod = obj2mod(Objref), - Mod:'_set_bound'(Objref,Bound). - -%%%--------------------------------------------------------------- -%%% - -get_element_type(Objref) -> - Mod = obj2mod(Objref), - Mod:'_get_element_type'(Objref). - -get_element_type_def(Objref) -> - Mod = obj2mod(Objref), - Mod:'_get_element_type_def'(Objref). - -set_element_type_def(Objref,TypeDef) -> - Mod = obj2mod(Objref), - Mod:'_set_element_type_def'(Objref,TypeDef). - -%%%--------------------------------------------------------------- -%%% - -get_length(Objref) -> - orber_ifr_arraydef:'_get_length'(Objref). - -set_length(Objref,Length) -> - orber_ifr_arraydef:'_set_length'(Objref,Length). - -%%%--------------------------------------------------------------- -%%% - -get_mode(Objref) -> - Mod = obj2mod(Objref), - Mod:'_get_mode'(Objref). - -set_mode(Objref,Mode) -> - Mod = obj2mod(Objref), - Mod:'_set_mode'(Objref,Mode). - -%%%--------------------------------------------------------------- -%%% - -get_result(Objref) -> - orber_ifr_operationdef:'_get_result'(Objref). - -get_result_def(Objref) -> - orber_ifr_operationdef:'_get_result_def'(Objref). - -set_result_def(Objref,ResultDef) -> - orber_ifr_operationdef:'_set_result_def'(Objref,ResultDef). - -get_params(Objref) -> - orber_ifr_operationdef:'_get_params'(Objref). - -set_params(Objref,Params) -> - orber_ifr_operationdef:'_set_params'(Objref,Params). - -get_contexts(Objref) -> - orber_ifr_operationdef:'_get_contexts'(Objref). - -set_contexts(Objref,Contexts) -> - orber_ifr_operationdef:'_set_contexts'(Objref,Contexts). - -get_exceptions(Objref) -> - orber_ifr_operationdef:'_get_exceptions'(Objref). - -set_exceptions(Objref,Exceptions) -> - orber_ifr_operationdef:'_set_exceptions'(Objref,Exceptions). - -%%%--------------------------------------------------------------- -%%% - -get_base_interfaces(Objref) -> - orber_ifr_interfacedef:'_get_base_interfaces'(Objref). - -set_base_interfaces(Objref,BaseInterfaces) -> - orber_ifr_interfacedef:'_set_base_interfaces'(Objref,BaseInterfaces). - -is_a(Objref,Interface_id) -> - orber_ifr_interfacedef:is_a(Objref,Interface_id). - -describe_interface(Objref) -> - orber_ifr_interfacedef:describe_interface(Objref). - -create_attribute(Objref,Id,Name,Version,Type,Mode) -> - orber_ifr_interfacedef:create_attribute(Objref,Id,Name,Version,Type,Mode). - -create_operation(Objref,Id,Name,Version,Result,Mode,Params,Exceptions,Contexts) -> - orber_ifr_interfacedef:create_operation(Objref,Id,Name,Version,Result,Mode, - Params,Exceptions,Contexts). - -obj2mod({ir_IRObject, _}) -> - orber_ifr_irobject; -obj2mod({ir_Contained, _}) -> - orber_ifr_contained; -obj2mod({ir_Container, _}) -> - orber_ifr_container; -obj2mod({ir_IDLType, _}) -> - orber_ifr_idltype; -obj2mod({ir_Repository, _}) -> - orber_ifr_repository; -obj2mod({ir_ModuleDef, _}) -> - orber_ifr_moduledef; -obj2mod({ir_ConstantDef, _}) -> - orber_ifr_constantdef; -obj2mod({ir_TypedefDef, _}) -> - orber_ifr_typedef; -obj2mod({ir_StructDef, _}) -> - orber_ifr_structdef; -obj2mod({ir_UnionDef, _}) -> - orber_ifr_uniondef; -obj2mod({ir_EnumDef, _}) -> - orber_ifr_enumdef; -obj2mod({ir_AliasDef, _}) -> - orber_ifr_aliasdef; -obj2mod({ir_PrimitiveDef, _}) -> - orber_ifr_primitivedef; -obj2mod({ir_StringDef, _}) -> - orber_ifr_stringdef; -obj2mod({ir_WstringDef, _}) -> - orber_ifr_wstringdef; -obj2mod({ir_SequenceDef, _}) -> - orber_ifr_sequencedef; -obj2mod({ir_ArrayDef, _}) -> - orber_ifr_arraydef; -obj2mod({ir_ExceptionDef, _}) -> - orber_ifr_exceptiondef; -obj2mod({ir_AttributeDef, _}) -> - orber_ifr_attributedef; -obj2mod({ir_OperationDef, _}) -> - orber_ifr_operationdef; -obj2mod({ir_InterfaceDef, _}) -> - orber_ifr_interfacedef; -obj2mod({ir_FixedDef, _}) -> - orber_ifr_fidxeddef; -obj2mod(Obj) -> - orber:dbg("[~p] orber_ifr:obj2mod(~p); unknown.", - [?LINE, Obj], ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}). - - diff --git a/lib/orber/src/orber_ifr.hrl b/lib/orber/src/orber_ifr.hrl deleted file mode 100644 index 10634f58c0..0000000000 --- a/lib/orber/src/orber_ifr.hrl +++ /dev/null @@ -1,35 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr.hrl -%% Purpose : Macros for the Interface Repository -%%---------------------------------------------------------------------- - - --record(lightdata, {scope, id}). --record(orber_light_ifr_ref, {data}). - -%% "Type" checking --define(tcheck(Type, Thing), when Type == Thing ; Thing == orber_light_ifr_ref). - --define(DEBUG_LEVEL, 9). - diff --git a/lib/orber/src/orber_ifr_aliasdef.erl b/lib/orber/src/orber_ifr_aliasdef.erl deleted file mode 100644 index 04a92be5e3..0000000000 --- a/lib/orber/src/orber_ifr_aliasdef.erl +++ /dev/null @@ -1,135 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_aliasdef.erl -%% Purpose : Code for Aliasdef -%%---------------------------------------------------------------------- - --module(orber_ifr_aliasdef). - --export(['_get_def_kind'/1, - destroy/1, - cleanup_for_destroy/1, %not in CORBA 2.0 - '_get_id'/1, - '_set_id'/2, - '_get_name'/1, - '_set_name'/2, - '_get_version'/1, - '_set_version'/2, - '_get_defined_in'/1, - '_get_absolute_name'/1, - '_get_containing_repository'/1, - describe/1, - move/4, - '_get_type'/1, - '_get_original_type_def'/1, - '_set_original_type_def'/2 - ]). - --import(orber_ifr_utils,[get_field/2, - get_object/1, - set_object/1 - ]). - --include("orber_ifr.hrl"). --include("ifr_objects.hrl"). - -%%%====================================================================== -%%% AliasDef (TypedefDef(Contained(IRObject), IDLType(IRObject))) - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IRObject - -'_get_def_kind'({ObjType, ObjID}) ?tcheck(ir_AliasDef, ObjType) -> - orber_ifr_irobject:'_get_def_kind'({ObjType,ObjID}). - -destroy({ObjType, ObjID}) ?tcheck(ir_AliasDef, ObjType) -> - F = fun() -> ObjList = cleanup_for_destroy({ObjType, ObjID}), - orber_ifr_irobject:destroy([{ObjType,ObjID} | ObjList]) - end, - orber_ifr_utils:ifr_transaction_write(F). - -cleanup_for_destroy({ObjType,ObjID}) ?tcheck(ir_AliasDef, ObjType) -> - orber_ifr_idltype:cleanup_for_destroy( - '_get_original_type_def'({ObjType,ObjID})) ++ - orber_ifr_typedef:cleanup_for_destroy({ObjType,ObjID}). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from Contained - -'_get_id'({ObjType, ObjID}) ?tcheck(ir_AliasDef, ObjType) -> - orber_ifr_contained:'_get_id'({ObjType,ObjID}). - -'_set_id'({ObjType, ObjID}, EO_Value) ?tcheck(ir_AliasDef, ObjType) -> - orber_ifr_contained:'_set_id'({ObjType,ObjID},EO_Value). - -'_get_name'({ObjType, ObjID}) ?tcheck(ir_AliasDef, ObjType) -> - orber_ifr_contained:'_get_name'({ObjType,ObjID}). - -'_set_name'({ObjType, ObjID}, EO_Value) ?tcheck(ir_AliasDef, ObjType) -> - orber_ifr_contained:'_set_name'({ObjType,ObjID}, EO_Value). - -'_get_version'({ObjType, ObjID}) ?tcheck(ir_AliasDef, ObjType) -> - orber_ifr_contained:'_get_version'({ObjType,ObjID}). - -'_set_version'({ObjType, ObjID}, EO_Value) ?tcheck(ir_AliasDef, ObjType) -> - orber_ifr_contained:'_set_version'({ObjType,ObjID},EO_Value). - -'_get_defined_in'({ObjType, ObjID}) ?tcheck(ir_AliasDef, ObjType) -> - orber_ifr_contained:'_get_defined_in'({ObjType,ObjID}). - -'_get_absolute_name'({ObjType, ObjID}) ?tcheck(ir_AliasDef,ObjType) -> - orber_ifr_contained:'_get_absolute_name'({ObjType,ObjID}). - -'_get_containing_repository'({ObjType, ObjID}) ?tcheck(ir_AliasDef, ObjType) -> - orber_ifr_contained:'_get_containing_repository'({ObjType,ObjID}). - -describe({ObjType, ObjID}) ?tcheck(ir_AliasDef, ObjType) -> - orber_ifr_contained:describe({ObjType,ObjID}). - -move({ObjType, ObjID}, New_container, New_name, New_version) - ?tcheck(ir_AliasDef, ObjType) -> - orber_ifr_contained:move({ObjType,ObjID},New_container,New_name, - New_version). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IDLType - -'_get_type'({ObjType, ObjID}) ?tcheck(ir_AliasDef, ObjType) -> - orber_ifr_idltype:'_get_type'({ObjType, ObjID}). - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces - -'_get_original_type_def'({ObjType, ObjID}) - ?tcheck(ir_AliasDef, ObjType) -> - get_field({ObjType,ObjID},original_type_def). - -'_set_original_type_def'({ObjType, ObjID}, EO_Value) - ?tcheck(ir_AliasDef, ObjType) -> - AliasDef = get_object({ObjType, ObjID}), - New_AliasDef = AliasDef#ir_AliasDef{type = {tk_alias, - AliasDef#ir_AliasDef.id, - AliasDef#ir_AliasDef.name, - EO_Value#ir_IDLType.type}, - original_type_def = EO_Value}, - set_object(New_AliasDef). diff --git a/lib/orber/src/orber_ifr_arraydef.erl b/lib/orber/src/orber_ifr_arraydef.erl deleted file mode 100644 index 1513914a08..0000000000 --- a/lib/orber/src/orber_ifr_arraydef.erl +++ /dev/null @@ -1,104 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_arraydef.erl -%% Purpose : Code for Arraydef -%%---------------------------------------------------------------------- - --module(orber_ifr_arraydef). - --export(['_get_def_kind'/1, - destroy/1, - cleanup_for_destroy/1, %not in CORBA 2.0 - '_get_type'/1, - '_get_length'/1, - '_set_length'/2, - '_get_element_type'/1, - '_get_element_type_def'/1, - '_set_element_type_def'/2 - ]). - --import(orber_ifr_utils,[get_field/2, - get_object/1, - set_object/1 - ]). - --include("orber_ifr.hrl"). --include("ifr_objects.hrl"). - -%%%====================================================================== -%%% ArrayDef (IDLType(IRObject)) - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IRObject - -'_get_def_kind'({ObjType, ObjID}) ?tcheck(ir_ArrayDef, ObjType) -> - orber_ifr_irobject:'_get_def_kind'({ObjType,ObjID}). - -destroy({ObjType, ObjID}) ?tcheck(ir_ArrayDef, ObjType) -> - F = fun() -> ObjList = cleanup_for_destroy({ObjType, ObjID}), - orber_ifr_irobject:destroy([{ObjType,ObjID} | ObjList]) - end, - orber_ifr_utils:ifr_transaction_write(F). - -cleanup_for_destroy({ObjType,ObjID}) ?tcheck(ir_ArrayDef, ObjType) -> - orber_ifr_idltype:cleanup_for_destroy( - '_get_element_type_def'({ObjType,ObjID})) ++ - orber_ifr_idltype:cleanup_for_destroy({ObjType,ObjID}). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IDLType - -'_get_type'({ObjType, ObjID}) ?tcheck(ir_ArrayDef, ObjType) -> - orber_ifr_idltype:'_get_type'({ObjType, ObjID}). - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces - -'_get_length'({ObjType, ObjID}) ?tcheck(ir_ArrayDef, ObjType) -> - get_field({ObjType,ObjID},length). - -'_set_length'({ObjType, ObjID}, EO_Value) ?tcheck(ir_ArrayDef, ObjType) -> - ArrayDef = get_object({ObjType, ObjID}), - New_ArrayDef = - ArrayDef#ir_ArrayDef{type = {tk_array, - ArrayDef#ir_ArrayDef.type, - ArrayDef#ir_ArrayDef.length}, - length = EO_Value}, - set_object(New_ArrayDef). - -'_get_element_type'({ObjType, ObjID}) ?tcheck(ir_ArrayDef, ObjType) -> - get_field({ObjType,ObjID},element_type). - -'_get_element_type_def'({ObjType, ObjID}) ?tcheck(ir_ArrayDef, ObjType) -> - get_field({ObjType,ObjID},element_type_def). - -'_set_element_type_def'({ObjType, ObjID}, EO_Value) - ?tcheck(ir_ArrayDef, ObjType) -> - ArrayDef = get_object({ObjType, ObjID}), - New_type = {tk_array, - EO_Value#ir_IDLType.type, - ArrayDef#ir_ArrayDef.length}, - New_ArrayDef = ArrayDef#ir_ArrayDef{type = New_type, - element_type = New_type, - element_type_def = EO_Value}, - set_object(New_ArrayDef). diff --git a/lib/orber/src/orber_ifr_attributedef.erl b/lib/orber/src/orber_ifr_attributedef.erl deleted file mode 100644 index bf7d1d2b63..0000000000 --- a/lib/orber/src/orber_ifr_attributedef.erl +++ /dev/null @@ -1,138 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_attributedef.erl -%% Purpose : Code for Attributedef -%%---------------------------------------------------------------------- - --module(orber_ifr_attributedef). - --export(['_get_def_kind'/1, - destroy/1, - cleanup_for_destroy/1, %not in CORBA 2.0 - '_get_id'/1, - '_set_id'/2, - '_get_name'/1, - '_set_name'/2, - '_get_version'/1, - '_set_version'/2, - '_get_defined_in'/1, - '_get_absolute_name'/1, - '_get_containing_repository'/1, - describe/1, - move/4, - '_get_type'/1, - '_get_type_def'/1, - '_set_type_def'/2, - '_get_mode'/1, - '_set_mode'/2 - ]). - --import(orber_ifr_utils,[get_field/2, - set_field/3, - get_object/1, - set_object/1 - ]). - --include("orber_ifr.hrl"). --include("ifr_objects.hrl"). - -%%%---------------------------------------------------------------------- -%% AttributeDef (Contained(IRObject)) - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IRObject - -'_get_def_kind'({ObjType, ObjID}) ?tcheck(ir_AttributeDef, ObjType) -> - orber_ifr_irobject:'_get_def_kind'({ObjType,ObjID}). - -destroy({ObjType, ObjID}) ?tcheck(ir_AttributeDef, ObjType) -> - F = fun() -> ObjList = cleanup_for_destroy({ObjType, ObjID}), - orber_ifr_irobject:destroy([{ObjType,ObjID} | ObjList]) - end, - orber_ifr_utils:ifr_transaction_write(F). - -cleanup_for_destroy({ObjType,ObjID}) ?tcheck(ir_AttributeDef, ObjType) -> - orber_ifr_idltype:cleanup_for_destroy( - orber_ifr_idltype:'_get_type_def'({ObjType,ObjID})) ++ - orber_ifr_contained:cleanup_for_destroy({ObjType,ObjID}). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from Contained - -'_get_id'({ObjType, ObjID}) ?tcheck(ir_AttributeDef, ObjType) -> - orber_ifr_contained:'_get_id'({ObjType,ObjID}). - -'_set_id'({ObjType, ObjID}, EO_Value) ?tcheck(ir_AttributeDef, ObjType) -> - orber_ifr_contained:'_set_id'({ObjType,ObjID},EO_Value). - -'_get_name'({ObjType, ObjID}) ?tcheck(ir_AttributeDef, ObjType) -> - orber_ifr_contained:'_get_name'({ObjType,ObjID}). - -'_set_name'({ObjType, ObjID}, EO_Value) ?tcheck(ir_AttributeDef, ObjType) -> - orber_ifr_contained:'_set_name'({ObjType,ObjID}, EO_Value). - -'_get_version'({ObjType, ObjID}) ?tcheck(ir_AttributeDef, ObjType) -> - orber_ifr_contained:'_get_version'({ObjType,ObjID}). - -'_set_version'({ObjType, ObjID}, EO_Value) ?tcheck(ir_AttributeDef, ObjType) -> - orber_ifr_contained:'_set_version'({ObjType,ObjID},EO_Value). - -'_get_defined_in'({ObjType, ObjID}) ?tcheck(ir_AttributeDef, ObjType) -> - orber_ifr_contained:'_get_defined_in'({ObjType,ObjID}). - -'_get_absolute_name'({ObjType, ObjID}) ?tcheck(ir_AttributeDef, ObjType) -> - orber_ifr_contained:'_get_absolute_name'({ObjType,ObjID}). - -'_get_containing_repository'({ObjType, ObjID}) - ?tcheck(ir_AttributeDef, ObjType) -> - orber_ifr_contained:'_get_containing_repository'({ObjType,ObjID}). - -describe({ObjType, ObjID}) ?tcheck(ir_AttributeDef, ObjType) -> - orber_ifr_contained:describe({ObjType,ObjID}). - -move({ObjType, ObjID}, New_container, New_name, New_version) - ?tcheck(ir_AttributeDef, ObjType) -> - orber_ifr_contained:move({ObjType,ObjID},New_container,New_name, - New_version). - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces - -'_get_type'({ObjType, ObjID}) ?tcheck(ir_AttributeDef, ObjType) -> - get_field({ObjType,ObjID},type). - -'_get_type_def'({ObjType, ObjID}) ?tcheck(ir_AttributeDef, ObjType) -> - get_field({ObjType,ObjID},type_def). - -'_set_type_def'({ObjType, ObjID},EO_Value) ?tcheck(ir_AttributeDef, ObjType) -> - AttributeDef = get_object({ObjType, ObjID}), - New_AttributeDef = - AttributeDef#ir_AttributeDef{type = EO_Value#ir_IDLType.type, - type_def = EO_Value}, - set_object(New_AttributeDef). - -'_get_mode'({ObjType, ObjID}) ?tcheck(ir_AttributeDef, ObjType) -> - get_field({ObjType,ObjID},mode). - -'_set_mode'({ObjType, ObjID}, EO_Value) ?tcheck(ir_AttributeDef, ObjType) -> - set_field({ObjType,ObjID}, mode, EO_Value). diff --git a/lib/orber/src/orber_ifr_constantdef.erl b/lib/orber/src/orber_ifr_constantdef.erl deleted file mode 100644 index b9d4393177..0000000000 --- a/lib/orber/src/orber_ifr_constantdef.erl +++ /dev/null @@ -1,148 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_constantdef.erl -%% Purpose : Code for Constantdef -%%---------------------------------------------------------------------- - --module(orber_ifr_constantdef). - --export(['_get_def_kind'/1, - destroy/1, - cleanup_for_destroy/1, %not in CORBA 2.0 - '_get_id'/1, - '_set_id'/2, - '_get_name'/1, - '_set_name'/2, - '_get_version'/1, - '_set_version'/2, - '_get_defined_in'/1, - '_get_absolute_name'/1, - '_get_containing_repository'/1, - describe/1, - move/4, - '_get_type'/1, - '_get_type_def'/1, - '_set_type_def'/2, - '_get_value'/1, - '_set_value'/2 - ]). - --import(orber_ifr_utils,[get_field/2, - set_field/3, - get_object/1, - set_object/1 - ]). - --include_lib("orber/include/corba.hrl"). --include("orber_ifr.hrl"). --include("ifr_objects.hrl"). - -%%%====================================================================== -%%% ConstantDef (Contained(IRObject)) - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IRObject - -'_get_def_kind'({ObjType,ObjID}) ?tcheck(ir_ConstantDef,ObjType) -> - orber_ifr_irobject:'_get_def_kind'({ObjType, ObjID}). - -destroy({ObjType, ObjID}) ?tcheck(ir_ConstantDef, ObjType) -> - F = fun() -> ObjList = cleanup_for_destroy({ObjType,ObjID}), - orber_ifr_irobject:destroy([{ObjType,ObjID} | ObjList]) - end, - orber_ifr_utils:ifr_transaction_write(F). - -cleanup_for_destroy({ObjType,ObjID}) ?tcheck(ir_ConstantDef, ObjType) -> - orber_ifr_idltype:cleanup_for_destroy( - '_get_type_def'({ObjType,ObjID})) ++ - orber_ifr_contained:cleanup_for_destroy({ObjType,ObjID}). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from Contained - -'_get_id'({ObjType, ObjID}) ?tcheck(ir_ConstantDef, ObjType) -> - orber_ifr_contained:'_get_id'({ObjType,ObjID}). - -'_set_id'({ObjType, ObjID}, EO_Value) ?tcheck(ir_ConstantDef, ObjType) -> - orber_ifr_contained:'_set_id'({ObjType,ObjID},EO_Value). - -'_get_name'({ObjType, ObjID}) ?tcheck(ir_ConstantDef, ObjType) -> - orber_ifr_contained:'_get_name'({ObjType,ObjID}). - -'_set_name'({ObjType, ObjID}, EO_Value) ?tcheck(ir_ConstantDef, ObjType) -> - orber_ifr_contained:'_set_name'({ObjType,ObjID}, EO_Value). - -'_get_version'({ObjType, ObjID}) ?tcheck(ir_ConstantDef,ObjType) -> - orber_ifr_contained:'_get_version'({ObjType,ObjID}). - -'_set_version'({ObjType, ObjID}, EO_Value) ?tcheck(ir_ConstantDef, ObjType) -> - orber_ifr_contained:'_set_version'({ObjType,ObjID},EO_Value). - -'_get_defined_in'({ObjType, ObjID}) ?tcheck(ir_ConstantDef, ObjType) -> - orber_ifr_contained:'_get_defined_in'({ObjType,ObjID}). - -'_get_absolute_name'({ObjType, ObjID}) ?tcheck(ir_ConstantDef, ObjType) -> - orber_ifr_contained:'_get_absolute_name'({ObjType,ObjID}). - -'_get_containing_repository'({ObjType, ObjID}) - ?tcheck(ir_ConstantDef, ObjType) -> - orber_ifr_contained:'_get_containing_repository'({ObjType,ObjID}). - -describe({ObjType, ObjID}) ?tcheck(ir_ConstantDef, ObjType) -> - orber_ifr_contained:describe({ObjType,ObjID}). - % -move({ObjType, ObjID}, New_container, New_name, New_version) - ?tcheck(ir_ConstantDef, ObjType) -> - orber_ifr_contained:move({ObjType,ObjID},New_container,New_name, - New_version). - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces - -'_get_type'({ObjType, ObjID}) ?tcheck(ir_ConstantDef, ObjType) -> - get_field({ObjType,ObjID},type). - -'_get_type_def'({ObjType,ObjID}) ?tcheck(ir_ConstantDef,ObjType) -> - get_field({ObjType,ObjID},type_def). - -'_set_type_def'({ObjType, ObjID}, EO_Value) ?tcheck(ir_ConstantDef, ObjType) -> - ConstantDef = get_object({ObjType, ObjID}), - New_ConstantDef = ConstantDef#ir_ConstantDef{type=EO_Value#ir_IDLType.type, - type_def = EO_Value}, - set_object(New_ConstantDef). - -'_get_value'({ObjType, ObjID}) ?tcheck(ir_ConstantDef, ObjType) -> - get_field({ObjType,ObjID},value). - -'_set_value'({ObjType, ObjID}, EO_Value) ?tcheck(ir_ConstantDef, ObjType) -> - Typecode = get_field({ObjType,ObjID},type), - {Value_typecode, _} = EO_Value, - case Value_typecode == Typecode of - true -> - set_field({ObjType, ObjID}, value, EO_Value); - false -> - orber:dbg("[~p] ~p:destroy(~p, ~p, ~p);~n" - "Wrong typecode in set_value.~n", - [?LINE, ?MODULE, ObjType, ObjID, EO_Value], ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}) - end. diff --git a/lib/orber/src/orber_ifr_contained.erl b/lib/orber/src/orber_ifr_contained.erl deleted file mode 100644 index 2a67fa98fd..0000000000 --- a/lib/orber/src/orber_ifr_contained.erl +++ /dev/null @@ -1,248 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_contained.erl -%% Purpose : Code for Contained -%%---------------------------------------------------------------------- - --module(orber_ifr_contained). - --export(['_get_def_kind'/1, - destroy/1, - cleanup_for_destroy/1, %not in CORBA 2.0 - '_get_id'/1, - '_set_id'/2, - '_get_name'/1, - '_set_name'/2, - '_get_version'/1, - '_set_version'/2, - '_get_defined_in'/1, - '_get_absolute_name'/1, - '_get_containing_repository'/1, - describe/1, - describe/2, %not in CORBA 2.0 - move/4 - ]). - --import(orber_ifr_utils,[get_object/1, - get_field/2, - set_field/3, - construct/3, - select/2, - write_result/1, - ifr_transaction_read_write/1 - ]). - --include("orber_ifr.hrl"). --include("ifr_objects.hrl"). --include_lib("orber/include/ifr_types.hrl"). --include_lib("orber/include/corba.hrl"). - -%%%====================================================================== -%%% Contained (IRObject) - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IRObject - -'_get_def_kind'({ObjType,ObjID}) -> - orber_ifr_irobject:'_get_def_kind'({ObjType,ObjID}). - -%%% Note, that the destroy function is meant to be called within a -%%% transaction called in the destroy function of an object which -%%% inherits from Contained. A Contained should only be destroyed by -%%% destroying the object that inherits from a Contained. An attempt -%%% to call this function in user code will result in unpredictable -%%% results. - -%%% Don't type check the object reference. We need to be able to -%%% handle several types of objects that inherit from Contained. - -destroy(Contained_objref) -> - ObjList = cleanup_for_destroy(Contained_objref), - orber_ifr_irobject:destroy([Contained_objref | ObjList]). - -cleanup_for_destroy(Contained_objref) -> - Defined_in = '_get_defined_in'(Contained_objref), - [Container_obj] = mnesia:read(Defined_in), - New_container_obj = - construct(Container_obj,contents, - lists:filter(fun(X) -> X /= Contained_objref end, - select(Container_obj,contents))), - [fun() -> mnesia:write(New_container_obj) end]. - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces - -'_get_id'({ObjType,ObjID}) -> - get_field({ObjType,ObjID},id). - -'_set_id'({ObjType,ObjID}, EO_Value) -> - set_field({ObjType, ObjID}, id, EO_Value). - -'_get_name'({ObjType,ObjID}) -> - get_field({ObjType,ObjID},name). - -'_set_name'({ObjType,ObjID}, EO_Value) -> - set_field({ObjType, ObjID}, name, EO_Value). - -'_get_version'({ObjType,ObjID}) -> - get_field({ObjType,ObjID},version). - -'_set_version'({ObjType,ObjID}, EO_Value) -> - set_field({ObjType, ObjID}, version, EO_Value). - -'_get_defined_in'({ObjType,ObjID}) -> - get_field({ObjType,ObjID},defined_in). - -'_get_absolute_name'({ObjType,ObjID}) -> - get_field({ObjType,ObjID},absolute_name). - -'_get_containing_repository'({ObjType,ObjID}) -> - get_field({ObjType,ObjID},containing_repository). - -describe(ObjRef) -> - Def_kind = '_get_def_kind'(ObjRef), - Object = get_object(ObjRef), - describe(Object,Def_kind). - -describe(Object,Def_kind) -> - Value = - case Def_kind of - dk_Module -> - #moduledescription{name = Object#ir_ModuleDef.name, - id = Object#ir_ModuleDef.id, - defined_in = Object#ir_ModuleDef.defined_in, - version = Object#ir_ModuleDef.version}; - dk_Constant -> - #constantdescription{name = Object#ir_ConstantDef.name, - id = Object#ir_ConstantDef.id, - defined_in = - Object#ir_ConstantDef.defined_in, - version = Object#ir_ConstantDef.version, - type = Object#ir_ConstantDef.type, - value = Object#ir_ConstantDef.value}; - dk_Typedef -> - #typedescription{name = Object#ir_TypedefDef.name, - id = Object#ir_TypedefDef.id, - defined_in = Object#ir_TypedefDef.defined_in, - version = Object#ir_TypedefDef.version, - type = Object#ir_TypedefDef.type}; - dk_Struct -> - ?make_typedescription(Object,ir_StructDef); - dk_Union -> - ?make_typedescription(Object,ir_UnionDef); - dk_Enum -> - ?make_typedescription(Object,ir_EnumDef); - dk_Alias -> - ?make_typedescription(Object,ir_AliasDef); - dk_Exception -> - #exceptiondescription{name = Object#ir_ExceptionDef.name, - id = Object#ir_ExceptionDef.id, - defined_in = - Object#ir_ExceptionDef.defined_in, - version = Object#ir_ExceptionDef.version, - type = Object#ir_ExceptionDef.type}; - dk_Attribute -> - #attributedescription{name = Object#ir_AttributeDef.name, - id = Object#ir_AttributeDef.id, - defined_in = - Object#ir_AttributeDef.defined_in, - version = Object#ir_AttributeDef.version, - type = Object#ir_AttributeDef.type, - mode = Object#ir_AttributeDef.mode}; - dk_Operation -> - #operationdescription{name = Object#ir_OperationDef.name, - id = Object#ir_OperationDef.id, - defined_in = - Object#ir_OperationDef.defined_in, - version = Object#ir_OperationDef.version, - result = Object#ir_OperationDef.result, - mode = Object#ir_OperationDef.mode, - contexts = - Object#ir_OperationDef.contexts, - parameters = - Object#ir_OperationDef.params, - exceptions = - Object#ir_OperationDef.exceptions}; - dk_Interface -> - #interfacedescription{name = Object#ir_InterfaceDef.name, - id = Object#ir_InterfaceDef.id, - defined_in = - Object#ir_InterfaceDef.defined_in, - version = Object#ir_InterfaceDef.version, - base_interfaces = - Object#ir_InterfaceDef.base_interfaces}; - _ -> - undefined - end, - #contained_description{kind=Def_kind, value=Value}. - -move({ObjType,ObjID},{NewContainerType,NewContainerID},New_name,New_version) -> - Move_OK = - ('_get_containing_repository'({NewContainerType,NewContainerID}) == - '_get_containing_repository'({ObjType,ObjID})) - and - case NewContainerType of - ir_Repository -> - lists:member(ObjType,[ir_ConstantDef,ir_TypedefDef, - ir_ExceptionDef,ir_InterfaceDef, - ir_ModuleDef]); - ir_ModuleDef -> - lists:member(ObjType,[ir_ConstantDef,ir_TypedefDef, - ir_ExceptionDef,ir_ModuleDef, - ir_InterfaceDef]); - ir_InterfaceDef -> - lists:member(ObjType,[ir_ConstantDef,ir_TypedefDef, - ir_ExceptionDef,ir_AttributeDef, - ir_OperationDef]); - _ -> - false - end - and - (orber_ifr_container:lookup_name({NewContainerType,NewContainerID}, - New_name, -1, % *** -1? - dk_All, false) == []), - move(Move_OK,{ObjType,ObjID},{NewContainerType,NewContainerID},New_name, - New_version). - -move(true, Contained_objref, New_container, New_name, New_version) -> - F = fun() -> Defined_in = '_get_defined_in'(Contained_objref), - [Old_container_obj] = mnesia:read(Defined_in), - New_old_container_obj = - construct(Old_container_obj,contents, - lists:filter(fun(X) -> X /= Contained_objref - end, select(Old_container_obj, - contents))), - [New_container_obj] = mnesia:read(New_container), - Contents = orber_ifr_container:contents(New_container, dk_All, - true), - New_new_container_obj = - construct(construct(construct(New_container_obj, contents, - [Contained_objref | Contents]), - name,New_name),version,New_version), - mnesia:write(New_old_container_obj), - mnesia:write(New_new_container_obj) - end, - write_result(ifr_transaction_read_write(F)); - -move(false, _Contained_objref, _New_container, _New_name, _New_version) -> - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}). diff --git a/lib/orber/src/orber_ifr_container.erl b/lib/orber/src/orber_ifr_container.erl deleted file mode 100644 index e085985bc4..0000000000 --- a/lib/orber/src/orber_ifr_container.erl +++ /dev/null @@ -1,464 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_container.erl -%% Purpose : Code for Container -%%---------------------------------------------------------------------- - --module(orber_ifr_container). - --export(['_get_def_kind'/1, - destroy/1, - cleanup_for_destroy/1, %not in CORBA 2.0 - lookup/2, - contents/3, - lookup_name/5, - describe_contents/4, - make_absolute_name/2, %not in CORBA 2.0 - make_containing_repository/1, %not in CORBA 2.0 - add_to_container/5, %not in CORBA 2.0 - create_module/4, - create_constant/6, - create_struct/5, - create_union/6, - create_enum/5, - create_alias/5, - create_interface/5, - create_exception/5 - ]). - --import(orber_ifr_utils,[get_field/2,select/2,construct/3,makeref/1,unique/0]). --import(lists,[map/2,filter/2,flatten/1,sublist/2]). - --include_lib("orber/include/corba.hrl"). --include("orber_ifr.hrl"). --include("ifr_objects.hrl"). --include_lib("orber/include/ifr_types.hrl"). - -%%%====================================================================== -%%% Container (IRObject) - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IRObject - -'_get_def_kind'(ObjRef) -> - orber_ifr_irobject:'_get_def_kind'(ObjRef). - -%%% Note, that the destroy function is meant to be called within a -%%% transaction called in the destroy function of an object which -%%% inherits from Container. A Container should only be destroyed by -%%% destroying the object that inherits from a Container. An attempt -%%% to call this function in user code will result in unpredictable -%%% results. - -%%% Don't type check the object reference. We need to be able to handle several -%%% types of objects that inherit from Container. - -destroy(Container_objref) -> - ObjList = cleanup_for_destroy(Container_objref), - orber_ifr_irobject:destroy([Container_objref | ObjList]). - -cleanup_for_destroy(Container_objref) -> - Contents = get_field(Container_objref, contents), - map(fun destroy_thing/1, Contents) ++ Contents. - -%%% Destroy objects which inherit from Contained, i.e. objects that populate -%%% the contents list of a Container. - -destroy_thing({ObjType,ObjID}) when ObjType == ir_ModuleDef -> - orber_ifr_moduledef:cleanup_for_destroy({ObjType,ObjID}); -destroy_thing({ObjType,ObjID}) when ObjType == ir_ConstantDef -> - orber_ifr_constantdef:cleanup_for_destroy({ObjType,ObjID}); -destroy_thing({ObjType,ObjID}) when ObjType == ir_TypedefDef -> - orber_ifr_typedef:cleanup_for_destroy({ObjType,ObjID}); -destroy_thing({ObjType,ObjID}) when ObjType == ir_StructDef -> - orber_ifr_structdef:cleanup_for_destroy({ObjType,ObjID}); -destroy_thing({ObjType,ObjID}) when ObjType == ir_UnionDef -> - orber_ifr_uniondef:cleanup_for_destroy({ObjType,ObjID}); -destroy_thing({ObjType,ObjID}) when ObjType == ir_EnumDef -> - orber_ifr_enumdef:cleanup_for_destroy({ObjType,ObjID}); -destroy_thing({ObjType,ObjID}) when ObjType == ir_AliasDef -> - orber_ifr_aliasdef:cleanup_for_destroy({ObjType,ObjID}); -destroy_thing({ObjType,ObjID}) when ObjType == ir_ExceptionDef -> - orber_ifr_exceptiondef:cleanup_for_destroy({ObjType,ObjID}); -destroy_thing({ObjType,ObjID}) when ObjType == ir_AttributeDef -> - orber_ifr_attributedef:cleanup_for_destroy({ObjType,ObjID}); -destroy_thing({ObjType,ObjID}) when ObjType == ir_OperationDef -> - orber_ifr_operationdef:cleanup_for_destroy({ObjType,ObjID}); -destroy_thing({ObjType,ObjID}) when ObjType == ir_InterfaceDef -> - orber_ifr_interfacedef:cleanup_for_destroy({ObjType,ObjID}); -destroy_thing({_ObjType,_ObjID}) -> - %% Unknown object in Container contents. - true. - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces -lookup(ObjRef, Search_name) -> - Contents = contents(ObjRef, dk_All, false), - - %% We now have the contents (a list of object references). - %% Let's find all objects with the correct name. - - case filter(fun({Type,ID}) -> - orber_ifr_contained:'_get_absolute_name'({Type,ID}) == - Search_name - end, - Contents) of - [Obj] -> - Obj; - X -> - X - end. - - -contents(ObjRef, Limit_type, Exclude_inherited) -> - Contents = - flatten(get_field(ObjRef, contents) ++ - inherited_contents(ObjRef,Exclude_inherited)), - AllContents = - Contents ++ - flatten(subcontents(Limit_type,Contents)), - limit_contents(Limit_type,AllContents). - - -subcontents(_,[]) -> []; -subcontents(Limit_type,Contents) -> - map(fun(ObjRef) -> contents(ObjRef,Limit_type) end, Contents). - -contents({ir_Repository,ObjID},Limit_type) -> - orber_ifr_repository:contents({ir_Repository,ObjID},Limit_type,false); -contents({ir_ModuleDef,ObjID},Limit_type) -> - orber_ifr_moduledef:contents({ir_ModuleDef,ObjID},Limit_type,false); -contents({ir_InterfaceDef,ObjID},Limit_type) -> - orber_ifr_interfacedef:contents({ir_InterfaceDef,ObjID},Limit_type,false); -contents(_,_) -> []. - -limit_contents(dk_All,Contents) -> Contents; -limit_contents(Limit_type,Contents) -> - filter(fun(Obj_Ref) -> '_get_def_kind'(Obj_Ref) == Limit_type end, - Contents). - - -lookup_name(ObjRef, Search_name, Levels_to_search, - Limit_type, Exclude_inherited) -> - Contents = get_field(ObjRef, contents), - AllContents = Contents ++ inherited_contents(ObjRef, Exclude_inherited), - lookup_name(AllContents, Search_name, Levels_to_search, Limit_type). - -inherited_contents({ir_InterfaceDef,ObjID}, false) -> - map(fun(ObjRef) -> get_field(ObjRef,contents) end, - orber_ifr_interfacedef:'_get_base_interfaces'({ir_InterfaceDef,ObjID})); -inherited_contents(_, false) -> []; -inherited_contents(_, true) -> []. - -lookup_name(Contents, Search_name, Level, Limit_type) -> - filter(fun(X) -> - (orber_ifr_contained:'_get_id'(X) == Search_name) - and - ('_get_def_kind'(X) == Limit_type) - end, Contents) ++ - sublookup_name(Contents, Search_name, Level - 1, Limit_type). - -sublookup_name([],_,_,_) -> []; -sublookup_name(_,_,0,_) -> []; -sublookup_name(Contents, Search_name, Level, Limit_type) -> - map(fun(X) -> - Conts = subcontents(X), - lookup_name(Conts, Search_name, Level - 1, Limit_type) - end, Contents). - -subcontents({ir_Repository,ObjID}) -> - get_field({ir_Repository,ObjID}, contents); -subcontents({ir_ModuleDefObjType,ObjID}) -> - get_field({ir_ModuleDef,ObjID}, contents); -subcontents({ir_InterfaceDef,ObjID}) -> - get_field({ir_InterfaceDef,ObjID}, contents); -subcontents(_) -> []. - -describe_contents(ObjRef, Limit_type, Exclude_inherited, - Max_returned_objs) -> - Limited_contents = contents(ObjRef,Limit_type,Exclude_inherited), - describe_contents(Limited_contents, Max_returned_objs, []). - -describe_contents(_, 0, Acc) -> - Acc; -describe_contents([], _Max_returned_objs, Acc) -> - Acc; -describe_contents([H|T], Max_returned_objs, Acc) -> - Desc = orber_ifr_contained:describe(H), - describe_contents(T, Max_returned_objs-1, [Desc|Acc]). - - -%% This is a kludge. Se p. 6-11 in CORBA 2.0. -make_absolute_name({ObjType,ObjID}, Name) -> - case ObjType of - ir_Repository -> - "::" ++ Name; - _ -> - orber_ifr_contained:'_get_absolute_name'({ObjType,ObjID}) ++ - "::" ++ Name - end. - -%% This is a kludge. Se p. 6-15 in CORBA 2.0. -make_containing_repository({ObjType,ObjID}) -> - case ObjType of - ir_Repository -> - {ir_Repository,ObjID}; - _ -> - orber_ifr_contained:'_get_containing_repository'({ObjType, ObjID}) - end. - -add_to_container(ContainerRef,Object, Id, Table, Index) -> - F = fun() -> - [Container_obj] = mnesia:wread(ContainerRef), - case mnesia:index_read(Table, Id, Index) of - [] -> - ObjectRef = makeref(Object), - New_container_obj = - construct(Container_obj,contents, - [ObjectRef | select(Container_obj,contents)]), - mnesia:write(New_container_obj), - mnesia:write(Object); - _ -> - mnesia:abort("duplicate") - end - end, - case mnesia:transaction(F) of - {aborted, "duplicate"} -> - %% Must keep the misspelled word (must match IC generated code). - exit({allready_registered, Id}); - {aborted, Reason} -> - orber:dbg("[~p] orber_ifr_container:add_to_container(~p). aborted:~n~p~n", - [?LINE, Id, Reason], ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}); - {atomic, _} -> - ok - end. - -add_to_light(#orber_light_ifr_ref{data = Data} = LRef, Id, Type, Name) -> - BaseId = get_base_id(Data#lightdata.id, Id), - NewScope = scoped_name(Data#lightdata.scope, Name, Type), - F = fun() -> - D = #orber_light_ifr{id = Id, - module = list_to_atom(NewScope), - type = Type, base_id = BaseId}, - mnesia:write(D) - end, - case mnesia:transaction(F) of - {aborted, Reason} -> - orber:dbg("[~p] orber_ifr_container:add_to_light(~p). aborted:~n~p~n", - [?LINE, Id, Reason], ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}); - {atomic, _} -> - LRef#orber_light_ifr_ref{data = Data#lightdata{scope = NewScope, - id = BaseId}} - end. - -get_base_id("", Id) -> - Id; -get_base_id(Id, _) -> - Id. - -scoped_name("", Name, _) -> - Name; -scoped_name(Scope, _, ?IFR_ConstantDef) -> - Scope; -scoped_name(Scope, Name, _) -> - Scope ++ "_" ++ Name. - -create_module(#orber_light_ifr_ref{} = LRef, Id, Name, _Version) -> - add_to_light(LRef, Id, ?IFR_ModuleDef, Name); -create_module(ObjRef, Id, Name, Version) -> - New_module = #ir_ModuleDef{ir_Internal_ID = unique(), - def_kind = dk_Module, - contents = [], - id = Id, - name = Name, - version = Version, - defined_in = ObjRef, - absolute_name = - make_absolute_name(ObjRef, Name), - containing_repository = - make_containing_repository(ObjRef)}, - add_to_container(ObjRef,New_module, Id, ir_ModuleDef, #ir_ModuleDef.id), - makeref(New_module). - -create_constant(#orber_light_ifr_ref{} = LRef, Id, Name, _Version, _Type, _Value) -> - add_to_light(LRef, Id, ?IFR_ConstantDef, Name); -create_constant(ObjRef, Id, Name, Version, Type, Value) -> - IDL_typecode = get_field(Type,type), - {Typecode, _} = Value, - case IDL_typecode == Typecode of - false -> - orber:dbg("[~p] ~p:create_constant(~p, ~p, ~p, ~p, ~p, ~p);~n" - "Wrong type.~n", - [?LINE, ?MODULE, ObjRef, Id, Name, Version, Type, Value], - ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}); - true -> - New_constant = #ir_ConstantDef{ir_Internal_ID = unique(), - def_kind = dk_Constant, - id = Id, - name = Name, - version = Version, - defined_in = ObjRef, - absolute_name = - make_absolute_name(ObjRef, Name), - containing_repository = - make_containing_repository(ObjRef), - type = get_field(Type,type), - type_def = Type, - value = Value}, - add_to_container(ObjRef,New_constant, - Id, ir_ConstantDef, #ir_ConstantDef.id), - makeref(New_constant) - end. - -create_struct(#orber_light_ifr_ref{} = LRef, Id, Name, _Version, _Members) -> - add_to_light(LRef, Id, ?IFR_StructDef, Name); -create_struct(ObjRef, Id, Name, Version, Members) -> - New_struct = #ir_StructDef{ir_Internal_ID = unique(), - def_kind = dk_Struct, - id = Id, - name = Name, - version = Version, - defined_in = ObjRef, - absolute_name = - make_absolute_name(ObjRef, Name), - containing_repository = - make_containing_repository(ObjRef), - type = {tk_struct, Id, Name, - map(fun(#structmember{name=MemName, - type=Type}) -> - {MemName,Type} end, - Members)}, - members = Members}, - add_to_container(ObjRef, New_struct, Id, ir_StructDef, #ir_StructDef.id), - makeref(New_struct). - -create_union(#orber_light_ifr_ref{} = LRef, Id, Name, _Version, - _Discriminator_type, _Members) -> - add_to_light(LRef, Id, ?IFR_UnionDef, Name); -create_union(ObjRef, Id, Name, Version, - Discriminator_type, Members) -> - Discriminator_type_code = get_field(Discriminator_type, type), - New_union = #ir_UnionDef{ir_Internal_ID = unique(), - def_kind = dk_Union, - id = Id, - name = Name, - version = Version, - defined_in = ObjRef, - absolute_name = - make_absolute_name(ObjRef, Name), - containing_repository = - make_containing_repository(ObjRef), - type = {tk_union, Id, Name, - Discriminator_type_code, -1, - map(fun(#unionmember{name=MemName, - label=Label, - type=Type}) -> - {Label,MemName,Type} end, - Members)}, - discriminator_type = Discriminator_type_code, - discriminator_type_def = Discriminator_type, - members = Members}, - add_to_container(ObjRef, New_union, Id, ir_UnionDef, #ir_UnionDef.id), - makeref(New_union). - -create_enum(#orber_light_ifr_ref{} = LRef, Id, Name, _Version, _Members) -> - add_to_light(LRef, Id, ?IFR_EnumDef, Name); -create_enum(ObjRef, Id, Name, Version, Members) -> - New_enum = #ir_EnumDef{ir_Internal_ID = unique(), - def_kind = dk_Enum, - id = Id, - name = Name, - version = Version, - defined_in = ObjRef, - absolute_name = - make_absolute_name(ObjRef, Name), - containing_repository = - make_containing_repository(ObjRef), - type = {tk_enum, Id, Name, Members}, - members = Members}, - add_to_container(ObjRef, New_enum, Id, ir_EnumDef, #ir_EnumDef.id), - makeref(New_enum). - -create_alias(#orber_light_ifr_ref{} = LRef, Id, Name, _Version, _Original_type) -> - add_to_light(LRef, Id, ?IFR_AliasDef, Name); -create_alias(ObjRef, Id, Name, Version, Original_type) -> - New_alias = #ir_AliasDef{ir_Internal_ID = unique(), - def_kind = dk_Alias, - id = Id, - name = Name, - version = Version, - defined_in = ObjRef, - absolute_name = - make_absolute_name(ObjRef, Name), - containing_repository = - make_containing_repository(ObjRef), - type = {tk_alias, Id, Name, - get_field(Original_type,type)}, - original_type_def = Original_type}, - add_to_container(ObjRef, New_alias, Id, ir_AliasDef, #ir_AliasDef.id), - makeref(New_alias). - -create_interface(#orber_light_ifr_ref{} = LRef, Id, Name, _Version, _Base_interfaces) -> - add_to_light(LRef, Id, ?IFR_InterfaceDef, Name); -create_interface(ObjRef, Id, Name, Version, Base_interfaces) -> - New_interface = #ir_InterfaceDef{ir_Internal_ID = unique(), - def_kind = dk_Interface, - contents = [], - id = Id, - name = Name, - version = Version, - defined_in = ObjRef, - absolute_name = - make_absolute_name(ObjRef,Name), - containing_repository = - make_containing_repository(ObjRef), - type = {tk_objref, Id, Name}, - base_interfaces = Base_interfaces}, - add_to_container(ObjRef, New_interface, Id, ir_InterfaceDef, #ir_InterfaceDef.id), - makeref(New_interface). - -create_exception(#orber_light_ifr_ref{} = LRef, Id, Name, _Version, _Members) -> - add_to_light(LRef, Id, ?IFR_ExceptionDef, Name); -create_exception(ObjRef, Id, Name, Version, Members) -> - New_exception = #ir_ExceptionDef{ir_Internal_ID = unique(), - def_kind = dk_Exception, - id = Id, - name = Name, - version = Version, - defined_in = ObjRef, - absolute_name = - make_absolute_name(ObjRef,Name), - containing_repository = - make_containing_repository(ObjRef), - type = {tk_except, Id, Name, - map(fun(#structmember{name=MemName, - type=Type}) - -> - {MemName,Type} end, - Members)}, - members = Members}, - add_to_container(ObjRef, New_exception, Id, ir_ExceptionDef, #ir_ExceptionDef.id), - makeref(New_exception). diff --git a/lib/orber/src/orber_ifr_enumdef.erl b/lib/orber/src/orber_ifr_enumdef.erl deleted file mode 100644 index b1820046bb..0000000000 --- a/lib/orber/src/orber_ifr_enumdef.erl +++ /dev/null @@ -1,130 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_enumdef.erl -%% Purpose : Code for Enumdef -%%---------------------------------------------------------------------- - --module(orber_ifr_enumdef). - --export(['_get_def_kind'/1, - destroy/1, - cleanup_for_destroy/1, %not in CORBA 2.0 - '_get_id'/1, - '_set_id'/2, - '_get_name'/1, - '_set_name'/2, - '_get_version'/1, - '_set_version'/2, - '_get_defined_in'/1, - '_get_absolute_name'/1, - '_get_containing_repository'/1, - describe/1, - move/4, - '_get_type'/1, - '_get_members'/1, - '_set_members'/2 - ]). - --import(orber_ifr_utils,[get_field/2, - get_object/1, - set_object/1 - ]). - --include("orber_ifr.hrl"). --include("ifr_objects.hrl"). - -%%%====================================================================== -%%% EnumDef (TypedefDef(Contained(IRObject), IDLType(IRObject))) - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IRObject - -'_get_def_kind'({ObjType, ObjID}) ?tcheck(ir_EnumDef, ObjType) -> - orber_ifr_irobject:'_get_def_kind'({ObjType,ObjID}). - -destroy({ObjType, ObjID}) ?tcheck(ir_EnumDef, ObjType) -> - F = fun() -> ObjList = cleanup_for_destroy({ObjType, ObjID}), - orber_ifr_irobject:destroy([{ObjType, ObjID} | ObjList]) - end, - orber_ifr_utils:ifr_transaction_write(F). - -cleanup_for_destroy({ObjType,ObjID}) ?tcheck(ir_EnumDef, ObjType) -> - orber_ifr_typedef:cleanup_for_destroy({ObjType,ObjID}). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from Contained - -'_get_id'({ObjType, ObjID}) ?tcheck(ir_EnumDef, ObjType) -> - orber_ifr_contained:'_get_id'({ObjType,ObjID}). - -'_set_id'({ObjType, ObjID}, EO_Value) ?tcheck(ir_EnumDef, ObjType) -> - orber_ifr_contained:'_set_id'({ObjType,ObjID},EO_Value). - -'_get_name'({ObjType, ObjID}) ?tcheck(ir_EnumDef, ObjType) -> - orber_ifr_contained:'_get_name'({ObjType,ObjID}). - -'_set_name'({ObjType, ObjID}, EO_Value) ?tcheck(ir_EnumDef, ObjType) -> - orber_ifr_contained:'_set_name'({ObjType,ObjID}, EO_Value). - -'_get_version'({ObjType, ObjID}) ?tcheck(ir_EnumDef, ObjType) -> - orber_ifr_contained:'_get_version'({ObjType,ObjID}). - -'_set_version'({ObjType, ObjID}, EO_Value) ?tcheck(ir_EnumDef, ObjType) -> - orber_ifr_contained:'_set_version'({ObjType,ObjID},EO_Value). - -'_get_defined_in'({ObjType, ObjID}) ?tcheck(ir_EnumDef, ObjType) -> - orber_ifr_contained:'_get_defined_in'({ObjType,ObjID}). - -'_get_absolute_name'({ObjType, ObjID}) ?tcheck(ir_EnumDef, ObjType) -> - orber_ifr_contained:'_get_absolute_name'({ObjType,ObjID}). - -'_get_containing_repository'({ObjType, ObjID}) ?tcheck(ir_EnumDef, ObjType) -> - orber_ifr_contained:'_get_containing_repository'({ObjType,ObjID}). - -describe({ObjType, ObjID}) ?tcheck(ir_EnumDef, ObjType) -> - orber_ifr_contained:describe({ObjType,ObjID}). - -move({ObjType, ObjID}, New_container, New_name, New_version) - ?tcheck(ir_EnumDef, ObjType) -> - orber_ifr_contained:move({ObjType,ObjID},New_container,New_name,New_version). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IDLType - -'_get_type'({ObjType, ObjID}) ?tcheck(ir_EnumDef, ObjType) -> - orber_ifr_idltype:'_get_type'({ObjType, ObjID}). - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces - -'_get_members'({ObjType, ObjID}) ?tcheck(ir_EnumDef, ObjType) -> - get_field({ObjType,ObjID},members). - -'_set_members'({ObjType, ObjID}, EO_Value) ?tcheck(ir_EnumDef, ObjType) -> - EnumDef = get_object({ObjType, ObjID}), - New_EnumDef = EnumDef#ir_EnumDef{type = {tk_enum, - EnumDef#ir_EnumDef.id, - EnumDef#ir_EnumDef.name, - EO_Value}, - members = EO_Value}, - set_object(New_EnumDef). diff --git a/lib/orber/src/orber_ifr_exceptiondef.erl b/lib/orber/src/orber_ifr_exceptiondef.erl deleted file mode 100644 index a9e477f01a..0000000000 --- a/lib/orber/src/orber_ifr_exceptiondef.erl +++ /dev/null @@ -1,145 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_exceptiondef.erl -%% Purpose : Code for Exceptiondef -%%---------------------------------------------------------------------- - --module(orber_ifr_exceptiondef). - --export(['_get_def_kind'/1, - destroy/1, - cleanup_for_destroy/1, %not in CORBA 2.0 - '_get_id'/1, - '_set_id'/2, - '_get_name'/1, - '_set_name'/2, - '_get_version'/1, - '_set_version'/2, - '_get_defined_in'/1, - '_get_absolute_name'/1, - '_get_containing_repository'/1, - describe/1, - %%lookup_id/1, %not in CORBA 2.0 - move/4, - '_get_type'/1, - '_get_members'/1, - '_set_members'/2 - ]). - --import(orber_ifr_utils,[get_field/2, - get_object/1, - set_object/1 - ]). --import(lists,[map/2]). - --include("orber_ifr.hrl"). --include("ifr_objects.hrl"). --include_lib("orber/include/ifr_types.hrl"). - -%%%====================================================================== -%%% ExceptionDef (Contained(IRObject)) - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IRObject - -'_get_def_kind'({ObjType, ObjID}) ?tcheck(ir_ExceptionDef, ObjType) -> - orber_ifr_irobject:'_get_def_kind'({ObjType,ObjID}). - -destroy({ObjType, ObjID}) ?tcheck(ir_ExceptionDef, ObjType) -> - F = fun() -> ObjList = cleanup_for_destroy({ObjType, ObjID}), - orber_ifr_irobject:destroy([{ObjType,ObjID} | ObjList]) - end, - orber_ifr_utils:ifr_transaction_write(F). - -cleanup_for_destroy({ObjType,ObjID}) ?tcheck(ir_ExceptionDef, ObjType) -> - lists:map(fun(X) -> orber_ifr_idltype:cleanup_for_destroy( - X#structmember.type_def) - end, - '_get_members'({ObjType, ObjID})) ++ - orber_ifr_contained:cleanup_for_destroy({ObjType,ObjID}). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from Contained - -'_get_id'({ObjType, ObjID}) ?tcheck(ir_ExceptionDef, ObjType) -> - orber_ifr_contained:'_get_id'({ObjType,ObjID}). - -'_set_id'({ObjType, ObjID}, EO_Value) ?tcheck(ir_ExceptionDef, ObjType) -> - orber_ifr_contained:'_set_id'({ObjType,ObjID},EO_Value). - -'_get_name'({ObjType, ObjID}) ?tcheck(ir_ExceptionDef, ObjType) -> - orber_ifr_contained:'_get_name'({ObjType,ObjID}). - -'_set_name'({ObjType, ObjID}, EO_Value) ?tcheck(ir_ExceptionDef, ObjType) -> - orber_ifr_contained:'_set_name'({ObjType,ObjID}, EO_Value). - -'_get_version'({ObjType, ObjID}) ?tcheck(ir_ExceptionDef, ObjType) -> - orber_ifr_contained:'_get_version'({ObjType,ObjID}). - -'_set_version'({ObjType, ObjID}, EO_Value) ?tcheck(ir_ExceptionDef, ObjType) -> - orber_ifr_contained:'_set_version'({ObjType,ObjID},EO_Value). - -'_get_defined_in'({ObjType, ObjID}) ?tcheck(ir_ExceptionDef, ObjType) -> - orber_ifr_contained:'_get_defined_in'({ObjType,ObjID}). - -'_get_absolute_name'({ObjType, ObjID}) ?tcheck(ir_ExceptionDef, ObjType) -> - orber_ifr_contained:'_get_absolute_name'({ObjType,ObjID}). - -'_get_containing_repository'({ObjType, ObjID}) - ?tcheck(ir_ExceptionDef, ObjType) -> - orber_ifr_contained:'_get_containing_repository'({ObjType,ObjID}). - -describe({ObjType, ObjID}) ?tcheck(ir_ExceptionDef, ObjType) -> - orber_ifr_contained:describe({ObjType,ObjID}). - -move({ObjType, ObjID}, New_container, New_name, New_version) - ?tcheck(ir_ExceptionDef, ObjType) -> - orber_ifr_contained:move({ObjType,ObjID},New_container,New_name, - New_version). - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces - -'_get_type'({ObjType, ObjID}) ?tcheck(ir_ExceptionDef, ObjType) -> - get_field({ObjType,ObjID},type). - -'_get_members'({ObjType, ObjID}) ?tcheck(ir_ExceptionDef, ObjType) -> - get_field({ObjType,ObjID},members). - -'_set_members'({ObjType, ObjID}, EO_Value) ?tcheck(ir_ExceptionDef, ObjType) -> - ExceptionDef = get_object({ObjType, ObjID}), - Members=map(fun(Exceptionmember) -> - Exceptionmember#structmember{type=tk_void} - end, EO_Value), - New_ExceptionDef = - ExceptionDef#ir_ExceptionDef{type = - {tk_except, - ExceptionDef#ir_ExceptionDef.id, - ExceptionDef#ir_ExceptionDef.name, - map(fun(#structmember{name=Name, - type=Type}) -> - {Name,Type} - end, - EO_Value)}, - members=Members}, - set_object(New_ExceptionDef). diff --git a/lib/orber/src/orber_ifr_fixeddef.erl b/lib/orber/src/orber_ifr_fixeddef.erl deleted file mode 100644 index fc1b354af0..0000000000 --- a/lib/orber/src/orber_ifr_fixeddef.erl +++ /dev/null @@ -1,80 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2002-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_fixeddef.erl -%% Description : -%% -%%---------------------------------------------------------------------- --module(orber_ifr_fixeddef). - --export(['_get_def_kind'/1, - destroy/1, - cleanup_for_destroy/1, %not in CORBA 2.0 - '_get_type'/1, - '_get_digits'/1, - '_set_digits'/2, - '_get_scale'/1, - '_set_scale'/2]). - --import(orber_ifr_utils, [get_field/2, - set_field/3]). - --include("orber_ifr.hrl"). - -%%%====================================================================== -%%% FixedDef (IDLType(IRObject)) - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IRObject - -'_get_def_kind'({ObjType,ObjID}) ?tcheck(ir_FixedDef, ObjType) -> - orber_ifr_irobject:'_get_def_kind'({ObjType,ObjID}). - -destroy({ObjType, ObjID}) ?tcheck(ir_FixedDef, ObjType) -> - F = fun() -> ObjList = cleanup_for_destroy({ObjType, ObjID}), - orber_ifr_irobject:destroy([{ObjType,ObjID} | ObjList]) - end, - orber_ifr_utils:ifr_transaction_write(F). - -cleanup_for_destroy({ObjType,ObjID}) ?tcheck(ir_FixedDef, ObjType) -> - orber_ifr_idltype:cleanup_for_destroy({ObjType,ObjID}). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IDLType - -'_get_type'({ObjType, ObjID}) ?tcheck(ir_FixedDef, ObjType) -> - orber_ifr_idltype:'_get_type'({ObjType, ObjID}). - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces - -'_get_digits'({ObjType, ObjID}) ?tcheck(ir_FixedDef, ObjType) -> - get_field({ObjType,ObjID},digits). -'_get_scale'({ObjType, ObjID}) ?tcheck(ir_FixedDef, ObjType) -> - get_field({ObjType,ObjID},scale). - -'_set_digits'({ObjType, ObjID}, EO_Value) - ?tcheck(ir_FixedDef, ObjType) -> - set_field({ObjType, ObjID}, digits, EO_Value). -'_set_scale'({ObjType, ObjID}, EO_Value) - ?tcheck(ir_FixedDef, ObjType) -> - set_field({ObjType, ObjID}, scale, EO_Value). diff --git a/lib/orber/src/orber_ifr_idltype.erl b/lib/orber/src/orber_ifr_idltype.erl deleted file mode 100644 index 44ab86c41a..0000000000 --- a/lib/orber/src/orber_ifr_idltype.erl +++ /dev/null @@ -1,75 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_idltype.erl -%% Purpose : Code for Idltype -%%---------------------------------------------------------------------- - --module(orber_ifr_idltype). - --export(['_get_def_kind'/1, - destroy/1, - cleanup_for_destroy/1, %not in CORBA 2.0 - '_get_type'/1, - '_get_type_def'/1 - ]). - --import(orber_ifr_utils,[get_field/2]). - --include("orber_ifr.hrl"). --include("ifr_objects.hrl"). - -%%%====================================================================== -%%% IDLType (IRObject) - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IRObject - -'_get_def_kind'({ObjType, ObjID}) ?tcheck(ir_IDLType, ObjType) -> - orber_ifr_irobject:'_get_def_kind'({ObjType, ObjID}). - -%%% Don't type check the object reference. We need to be able to -%%% handle several types of objects that inherit from IDLType. - -destroy(IDLType_objref) -> - F = fun() -> ObjList = cleanup_for_destroy(IDLType_objref), - orber_ifr_irobject:destroy(ObjList) - end, - orber_ifr_utils:ifr_transaction_write(F). - -cleanup_for_destroy(IDLType_objref) -> - [IDLType_objref]. - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces - -%% What is this ? You cannot check this for ir_IDLType here ! -%% ( an object type cannot be both .... ) -%%'_get_type'({ObjType,ObjID}) ?tcheck(ir_IDLType, ObjType) -> -%% get_field({ObjType,ObjID},type). - - -'_get_type'({ObjType,ObjID}) -> - get_field({ObjType,ObjID},type). - -'_get_type_def'({ObjType,ObjID}) -> - get_field({ObjType,ObjID},type_def). diff --git a/lib/orber/src/orber_ifr_interfacedef.erl b/lib/orber/src/orber_ifr_interfacedef.erl deleted file mode 100644 index 1195f1eff6..0000000000 --- a/lib/orber/src/orber_ifr_interfacedef.erl +++ /dev/null @@ -1,340 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_interfacedef.erl -%% Purpose : Code for Interfacedef -%%---------------------------------------------------------------------- - --module(orber_ifr_interfacedef). - --export(['_get_def_kind'/1, - destroy/1, - cleanup_for_destroy/1, %not in CORBA 2.0 - lookup/2, - contents/3, - lookup_name/5, - describe_contents/4, - create_module/4, - create_constant/6, - create_struct/5, - create_union/6, - create_enum/5, - create_alias/5, - create_interface/5, - create_exception/5, - '_get_id'/1, - '_set_id'/2, - '_get_name'/1, - '_set_name'/2, - '_get_version'/1, - '_set_version'/2, - '_get_defined_in'/1, - '_get_absolute_name'/1, - '_get_containing_repository'/1, - describe/1, - move/4, - '_get_type'/1, - '_get_base_interfaces'/1, - '_set_base_interfaces'/2, - is_a/2, - describe_interface/1, - create_attribute/6, - create_operation/9 - ]). - --import(orber_ifr_utils,[get_object/1, - get_field/2, - set_field/3, - select/2, - makeref/1, - unique/0 - ]). --import(orber_ifr_container,[make_absolute_name/2, - make_containing_repository/1 - ]). - --include("orber_ifr.hrl"). --include("ifr_objects.hrl"). --include_lib("orber/include/ifr_types.hrl"). - - -%%%====================================================================== -%%% InterfaceDef (Container(IRObject), Contained(IRObject), IDLType(IRObject)) - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IRObject - -'_get_def_kind'({ObjType, ObjID}) ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_irobject:'_get_def_kind'({ObjType,ObjID}). - -destroy({ObjType, ObjID}) ?tcheck(ir_InterfaceDef, ObjType) -> - F = fun() -> ObjList = cleanup_for_destroy({ObjType,ObjID}), - orber_ifr_irobject:destroy([{ObjType,ObjID} | ObjList]) - end, - orber_ifr_utils:ifr_transaction_write(F). - -cleanup_for_destroy({ObjType,ObjID}) ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_contained:cleanup_for_destroy({ObjType,ObjID}) ++ - orber_ifr_container:cleanup_for_destroy({ObjType,ObjID}) ++ - orber_ifr_idltype:cleanup_for_destroy({ObjType,ObjID}). - - -%% BUG ! You can't remove inherited !!!!! -%%cleanup_for_destroy({ObjType,ObjID}) ?tcheck(ir_InterfaceDef, ObjType) -> -%% lists:map(fun(X) -> cleanup_for_destroy(X) end, -%% '_get_base_interfaces'({ObjType,ObjID})) ++ <<<<<<<<<< Here -%% orber_ifr_contained:cleanup_for_destroy({ObjType,ObjID}) ++ -%% orber_ifr_container:cleanup_for_destroy({ObjType,ObjID}) ++ -%% orber_ifr_idltype:cleanup_for_destroy({ObjType,ObjID}). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from Container - -lookup({ObjType, ObjID}, Search_name) ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_container:lookup({ObjType,ObjID}, Search_name). - -contents({ObjType, ObjID}, Limit_type, Exclude_inherited) - ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_container:contents({ObjType,ObjID},Limit_type,Exclude_inherited). - -lookup_name({ObjType, ObjID}, Search_name, Levels_to_search, Limit_type, - Exclude_inherited) ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_container:lookup_name({ObjType,ObjID}, Search_name, - Levels_to_search, Limit_type, - Exclude_inherited). - -describe_contents({ObjType, ObjID}, Limit_type, Exclude_inherited, - Max_returned_objs) ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_container:describe_contents({ObjType,ObjID}, Limit_type, - Exclude_inherited, - Max_returned_objs). - -create_module({ObjType, ObjID}, Id, Name, Version) - ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_container:create_module({ObjType, ObjID}, Id, Name, Version). - -create_constant({ObjType, ObjID}, Id, Name, Version, Type, Value) - ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_container:create_constant({ObjType, ObjID}, Id, Name, Version, - Type, Value). - -create_struct({ObjType, ObjID}, Id, Name, Version, Members) - ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_container:create_struct({ObjType,ObjID},Id,Name,Version,Members). - -create_union({ObjType, ObjID}, Id, Name, Version, Discriminator_type, Members) - ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_container:create_union({ObjType, ObjID}, Id, Name, Version, - Discriminator_type, Members). - -create_enum({ObjType, ObjID}, Id, Name, Version, Members) - ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_container:create_enum({ObjType, ObjID},Id,Name,Version,Members). - -create_alias({ObjType, ObjID}, Id, Name, Version, Original_type) - ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_container:create_alias({ObjType, ObjID}, Id, Name, Version, - Original_type). - -create_interface({ObjType, ObjID}, Id, Name, Version, Base_interfaces) - ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_container:create_interface({ObjType, ObjID}, Id, Name, Version, - Base_interfaces). - -create_exception({ObjType, ObjID}, Id, Name, Version, Members) - ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_container:create_exception({ObjType, ObjID}, Id, Name, Version, - Members). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from Contained - -'_get_id'({ObjType, ObjID}) ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_contained:'_get_id'({ObjType,ObjID}). - -'_set_id'({ObjType, ObjID}, EO_Value) ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_contained:'_set_id'({ObjType,ObjID},EO_Value). - -'_get_name'({ObjType, ObjID}) ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_contained:'_get_name'({ObjType,ObjID}). - -'_set_name'({ObjType, ObjID}, EO_Value) ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_contained:'_set_name'({ObjType,ObjID}, EO_Value). - -'_get_version'({ObjType, ObjID}) ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_contained:'_get_version'({ObjType,ObjID}). - -'_set_version'({ObjType, ObjID}, EO_Value) ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_contained:'_set_version'({ObjType,ObjID},EO_Value). - -'_get_defined_in'({ObjType, ObjID}) ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_contained:'_get_defined_in'({ObjType,ObjID}). - -'_get_absolute_name'({ObjType, ObjID}) ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_contained:'_get_absolute_name'({ObjType,ObjID}). - -'_get_containing_repository'({ObjType, ObjID}) - ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_contained:'_get_containing_repository'({ObjType,ObjID}). - -describe({ObjType, ObjID}) ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_contained:describe({ObjType,ObjID}). - -move({ObjType, ObjID}, New_container, New_name, New_version) - ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_contained:move({ObjType,ObjID},New_container,New_name, - New_version). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IDLType - -'_get_type'({ObjType, ObjID}) ?tcheck(ir_InterfaceDef, ObjType) -> - orber_ifr_idltype:'_get_type'({ObjType, ObjID}). - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces - -'_get_base_interfaces'({ObjType,ObjID}) ?tcheck(ir_InterfaceDef, ObjType) -> - get_field({ObjType,ObjID},base_interfaces). - -'_set_base_interfaces'({ObjType, ObjID}, EO_Value) - ?tcheck(ir_InterfaceDef, ObjType) -> - set_field({ObjType,ObjID}, base_interfaces, EO_Value). - - - -is_a({ObjType, ObjID}, Interface_id) ?tcheck(ir_InterfaceDef, ObjType) -> - Base_interfaces = '_get_base_interfaces'({ObjType, ObjID}), - lists:any(fun(X) -> - case catch orber_ifr_contained:'_get_id'(X) of - Interface_id -> - 'true'; - _ -> - 'false' - end - end, - Base_interfaces). - -describe_interface({ObjType, ObjID}) ?tcheck(ir_InterfaceDef, ObjType) -> - -%%% *** Should we exclude the inherited operations here? Probably not, -%%% but I'm not sure at all. - -%%% OpContents = orber_ifr_container:contents({ObjType,ObjID}, dk_Operation, -%%% true), - - %% If it is OK to set Exclude_inherited to true (as in the above - %% code which is commented out), the following code is faster than - %% calling the contents/3 above. Otherwise we have to rethink - %% this. - - Object = get_object({ObjType, ObjID}), - -%%% Contents = select(Object, contents), - %% This is faster: - Contents = Object#ir_InterfaceDef.contents, - - ContentsObjects = lists:map(fun(ObjRef) -> - get_object(ObjRef) - end, - Contents), - OpContents = lists:filter(fun(Obj) -> - select(Obj,def_kind) == dk_Operation - end, - ContentsObjects), - - Ops = lists:map(fun(Obj) -> - orber_ifr_contained:describe(Obj,dk_Operation) - end, OpContents), - -%%% *** See the comment above on the Exclude_inherited parameter, and -%%% the circumstances when not to use contents/3. - -%%% AttrContents = orber_ifr_container:contents({ObjType,ObjID}, dk_Attribute, -%%% true), - - AttrContents = lists:filter(fun(Obj) -> - select(Obj,def_kind) == dk_Attribute - end, - ContentsObjects), - Attrs = lists:map(fun(Obj) -> - orber_ifr_contained:describe(Obj,dk_Attribute) - end, AttrContents), - - #fullinterfacedescription{name = Object#ir_InterfaceDef.name, - id = Object#ir_InterfaceDef.id, - defined_in = Object#ir_InterfaceDef.defined_in, - version = Object#ir_InterfaceDef.version, - operations = Ops, - attributes = Attrs, - base_interfaces = - Object#ir_InterfaceDef.base_interfaces, - type = Object#ir_InterfaceDef.type - }. - -create_attribute(#orber_light_ifr_ref{} = LRef, _Id, _Name, _Version, _Type, _Mode) -> - LRef; -create_attribute({ObjType, ObjID}, Id, Name, Version, Type, Mode) - ?tcheck(ir_InterfaceDef, ObjType) -> - New_attribute = #ir_AttributeDef{ir_Internal_ID = unique(), - def_kind = dk_Attribute, - id = Id, - name = Name, - version = Version, - defined_in = {ObjType, ObjID}, - absolute_name = - make_absolute_name({ObjType,ObjID}, Name), - containing_repository = - make_containing_repository({ObjType,ObjID}), - type = get_field(Type,type), - type_def = Type, - mode = Mode}, - orber_ifr_container:add_to_container({ObjType,ObjID}, New_attribute, - Id, ir_AttributeDef, - #ir_AttributeDef.id), - makeref(New_attribute). - -create_operation(#orber_light_ifr_ref{} = LRef, _Id, _Name, _Version, _Result, - _Mode, _Params, _Exceptions, _Contexts) -> - LRef; -create_operation({ObjType, ObjID}, Id, Name, Version, Result, Mode, Params, - Exceptions, Contexts) ?tcheck(ir_InterfaceDef, ObjType) -> - New_operation = #ir_OperationDef{ir_Internal_ID = unique(), - def_kind = dk_Operation, - id = Id, - name = Name, - version = Version, - defined_in = {ObjType, ObjID}, - absolute_name = - make_absolute_name({ObjType,ObjID}, Name), - containing_repository = - make_containing_repository({ObjType,ObjID}), - result = get_field(Result,type), - result_def = Result, - mode = Mode, - params = Params, - exceptions = Exceptions, - contexts = Contexts}, - orber_ifr_container:add_to_container({ObjType,ObjID}, New_operation, - Id, ir_OperationDef, - #ir_OperationDef.id), - makeref(New_operation). diff --git a/lib/orber/src/orber_ifr_irobject.erl b/lib/orber/src/orber_ifr_irobject.erl deleted file mode 100644 index 1111f00f81..0000000000 --- a/lib/orber/src/orber_ifr_irobject.erl +++ /dev/null @@ -1,73 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_irobject.erl -%% Purpose : Code for IRObject -%%---------------------------------------------------------------------- - --module(orber_ifr_irobject). - --export(['_get_def_kind'/1, - destroy/1 - ]). - --import(orber_ifr_utils,[get_field/2]). - --include("orber_ifr.hrl"). --include_lib("orber/include/corba.hrl"). - -%%%====================================================================== -%%% IRObject - -'_get_def_kind'({ObjType,ObjID}) -> - get_field({ObjType,ObjID},def_kind). - -%%% Note, that the destroy function is meant to be called within a -%%% transaction called in the destroy function of an object which -%%% inherits from IRObject. An IRObject should only be destroyed by -%%% destroying the object that inherits from an IRObject. An attempt -%%% to call this function in user code will result in unpredictable -%%% results. - -%%% Don't type check the object reference. We need to be able to -%%% handle several types of objects that inherit from IRObject. - -destroy(L) when is_list(L) -> - destroy2(lists:reverse(L)). - -destroy2([Things_HD | Things_TL]) -> - destroy2(Things_HD), - destroy2(Things_TL); - -destroy2([]) -> - ok; -destroy2(F) when is_function(F) -> - F(); -destroy2(Thing) when is_tuple(Thing) -> - mnesia:delete(Thing), - ok; -destroy2(Thing) -> - orber:dbg("[~p] ~p:destroy2(~p);~n" - "Strange argument for destroy.~n", - [?LINE, ?MODULE, Thing], ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}). - diff --git a/lib/orber/src/orber_ifr_moduledef.erl b/lib/orber/src/orber_ifr_moduledef.erl deleted file mode 100644 index add0feb31a..0000000000 --- a/lib/orber/src/orber_ifr_moduledef.erl +++ /dev/null @@ -1,184 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_moduledef.erl -%% Purpose : Code for Moduledef -%%---------------------------------------------------------------------- - --module(orber_ifr_moduledef). - --export(['_get_def_kind'/1, - destroy/1, - cleanup_for_destroy/1, %not in CORBA 2.0 - lookup/2, - contents/3, - lookup_name/5, - describe_contents/4, - create_module/4, - create_constant/6, - create_struct/5, - create_union/6, - create_enum/5, - create_alias/5, - create_interface/5, - create_exception/5, - '_get_id'/1, - '_set_id'/2, - '_get_name'/1, - '_set_name'/2, - '_get_version'/1, - '_set_version'/2, - '_get_defined_in'/1, - '_get_absolute_name'/1, - '_get_containing_repository'/1, - describe/1, - move/4 - ]). - --include("orber_ifr.hrl"). - -%%%====================================================================== -%%% ModuleDef (Container(IRObject), Contained(IRObject)) - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IRObject - -'_get_def_kind'({ObjType, ObjID}) ?tcheck(ir_ModuleDef, ObjType) -> - orber_ifr_irobject:'_get_def_kind'({ObjType, ObjID}). - -destroy({ObjType, ObjID}) ?tcheck(ir_ModuleDef, ObjType) -> - F = fun() -> '_clean'({ObjType, ObjID}) end, - orber_ifr_utils:ifr_transaction_write(F). - -'_clean'(ObjRef) -> - ObjList = cleanup_for_destroy(ObjRef), - orber_ifr_irobject:destroy([ObjRef | ObjList]). - - -cleanup_for_destroy({ObjType,ObjID}) ?tcheck(ir_ModuleDef, ObjType) -> - orber_ifr_container:cleanup_for_destroy({ObjType,ObjID}) ++ - orber_ifr_contained:cleanup_for_destroy({ObjType,ObjID}). - - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from Container - -lookup({ObjType, ObjID}, Search_name) ?tcheck(ir_ModuleDef, ObjType) -> - orber_ifr_container:lookup({ObjType, ObjID}, Search_name). - -contents({ObjType, ObjID}, Limit_type, Exclude_inherited) - ?tcheck(ir_ModuleDef, ObjType)-> - orber_ifr_container:contents({ObjType, ObjID},Limit_type, - Exclude_inherited). - -lookup_name({ObjType, ObjID}, Search_name, Levels_to_search, Limit_type, - Exclude_inherited) - ?tcheck(ir_ModuleDef, ObjType) -> - orber_ifr_container:lookup_name({ObjType,ObjID}, Search_name, - Levels_to_search, Limit_type, - Exclude_inherited). - -describe_contents({ObjType, ObjID}, Limit_type, Exclude_inherited, - Max_returned_objs) - ?tcheck(ir_ModuleDef, ObjType) -> - orber_ifr_container:describe_contents({ObjType, ObjID}, Limit_type, - Exclude_inherited,Max_returned_objs). - -create_module({ObjType, ObjID}, Id, Name, Version) - ?tcheck(ir_ModuleDef, ObjType) -> - orber_ifr_container:create_module({ObjType, ObjID}, Id, Name, Version). - -create_constant({ObjType, ObjID}, Id, Name, Version, Type, Value) - ?tcheck(ir_ModuleDef, ObjType) -> - orber_ifr_container:create_constant({ObjType, ObjID}, Id, Name, Version, - Type, Value). - -create_struct({ObjType, ObjID}, Id, Name, Version, Members) - ?tcheck(ir_ModuleDef, ObjType) -> - orber_ifr_container:create_struct({ObjType,ObjID},Id,Name,Version,Members). - -create_union({ObjType, ObjID}, Id, Name, Version, Discriminator_type, Members) - ?tcheck(ir_ModuleDef, ObjType) -> - orber_ifr_container:create_union({ObjType, ObjID}, Id, Name, Version, - Discriminator_type, Members). - -create_enum({ObjType, ObjID}, Id, Name, Version, Members) - ?tcheck(ir_ModuleDef, ObjType) -> - orber_ifr_container:create_enum({ObjType, ObjID},Id,Name,Version,Members). - -create_alias({ObjType, ObjID}, Id, Name, Version, Original_type) - ?tcheck(ir_ModuleDef, ObjType) -> - orber_ifr_container:create_alias({ObjType, ObjID}, Id, Name, Version, - Original_type). - -create_interface({ObjType, ObjID}, Id, Name, Version, Base_interfaces) - ?tcheck(ir_ModuleDef, ObjType) -> - orber_ifr_container:create_interface({ObjType, ObjID}, Id, Name, Version, - Base_interfaces). - -create_exception({ObjType, ObjID}, Id, Name, Version, Members) - ?tcheck(ir_ModuleDef, ObjType) -> - orber_ifr_container:create_exception({ObjType, ObjID}, Id, Name, Version, - Members). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from Contained - -'_get_id'({ObjType, ObjID}) ?tcheck(ir_ModuleDef, ObjType) -> - orber_ifr_contained:'_get_id'({ObjType,ObjID}). - -'_set_id'({ObjType,ObjID},EO_Value) ?tcheck(ir_ModuleDef,ObjType) -> - orber_ifr_contained:'_set_id'({ObjType,ObjID},EO_Value). - -'_get_name'({ObjType, ObjID}) ?tcheck(ir_ModuleDef, ObjType) -> - orber_ifr_contained:'_get_name'({ObjType,ObjID}). - -'_set_name'({ObjType, ObjID}, EO_Value) ?tcheck(ir_ModuleDef, ObjType) -> - orber_ifr_contained:'_set_name'({ObjType,ObjID}, EO_Value). - -'_get_version'({ObjType, ObjID}) ?tcheck(ir_ModuleDef, ObjType) -> - orber_ifr_contained:'_get_version'({ObjType,ObjID}). - -'_set_version'({ObjType, ObjID}, EO_Value) ?tcheck(ir_ModuleDef, ObjType) -> - orber_ifr_contained:'_set_version'({ObjType,ObjID},EO_Value). - -'_get_defined_in'({ObjType, ObjID}) ?tcheck(ir_ModuleDef, ObjType) -> - orber_ifr_contained:'_get_defined_in'({ObjType,ObjID}). - -'_get_absolute_name'({ObjType, ObjID}) ?tcheck(ir_ModuleDef, ObjType) -> - orber_ifr_contained:'_get_absolute_name'({ObjType,ObjID}). - -'_get_containing_repository'({ObjType, ObjID}) ?tcheck(ir_ModuleDef,ObjType) -> - orber_ifr_contained:'_get_containing_repository'({ObjType,ObjID}). - -describe({ObjType, ObjID}) ?tcheck(ir_ModuleDef, ObjType) -> - orber_ifr_contained:describe({ObjType,ObjID}). - -move({ObjType, ObjID}, New_container, New_name, New_version) - ?tcheck(ir_ModuleDef, ObjType) -> - orber_ifr_contained:move({ObjType,ObjID},New_container,New_name, - New_version). - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces - -%%% none %% diff --git a/lib/orber/src/orber_ifr_operationdef.erl b/lib/orber/src/orber_ifr_operationdef.erl deleted file mode 100644 index 4bc368487c..0000000000 --- a/lib/orber/src/orber_ifr_operationdef.erl +++ /dev/null @@ -1,192 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_operationdef.erl -%% Purpose : Code for Operationdef -%%---------------------------------------------------------------------- - --module(orber_ifr_operationdef). - --export(['_get_def_kind'/1, - destroy/1, - cleanup_for_destroy/1, %not in CORBA 2.0 - '_get_id'/1, - '_set_id'/2, - '_get_name'/1, - '_set_name'/2, - '_get_version'/1, - '_set_version'/2, - '_get_defined_in'/1, - '_get_absolute_name'/1, - '_get_containing_repository'/1, - describe/1, - move/4, - '_get_result'/1, - '_get_result_def'/1, - '_set_result_def'/2, - '_get_params'/1, - '_set_params'/2, - '_get_mode'/1, - '_set_mode'/2, - '_get_contexts'/1, - '_set_contexts'/2, - '_get_exceptions'/1, - '_set_exceptions'/2 - ]). - --import(orber_ifr_utils,[get_field/2, - set_field/3, - get_object/1, - set_object/1 - ]). - --include("orber_ifr.hrl"). --include("ifr_objects.hrl"). --include_lib("orber/include/ifr_types.hrl"). --include_lib("orber/include/corba.hrl"). - -%%%====================================================================== -%%% OperationDef (Contained(IRObject)) - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IRObject - -'_get_def_kind'({ObjType, ObjID}) ?tcheck(ir_OperationDef, ObjType) -> - orber_ifr_irobject:'_get_def_kind'({ObjType,ObjID}). - -destroy({ObjType, ObjID}) ?tcheck(ir_OperationDef, ObjType) -> - F = fun() -> ObjList = cleanup_for_destroy({ObjType, ObjID}), - orber_ifr_irobject:destroy([{ObjType,ObjID} | ObjList]) - end, - orber_ifr_utils:ifr_transaction_write(F). - -cleanup_for_destroy({ObjType,ObjID}) ?tcheck(ir_OperationDef, ObjType) -> - lists:map(fun(X) -> Idl = X#parameterdescription.type_def, - orber_ifr_idltype:cleanup_for_destroy(Idl) - end, - '_get_params'({ObjType,ObjID})) ++ - orber_ifr_idltype:cleanup_for_destroy('_get_result_def'({ObjType, - ObjID})) ++ - orber_ifr_contained:cleanup_for_destroy({ObjType,ObjID}). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from Contained - -'_get_id'({ObjType, ObjID}) ?tcheck(ir_OperationDef, ObjType) -> - orber_ifr_contained:'_get_id'({ObjType,ObjID}). - -'_set_id'({ObjType, ObjID}, EO_Value) ?tcheck(ir_OperationDef, ObjType) -> - orber_ifr_contained:'_set_id'({ObjType,ObjID},EO_Value). - -'_get_name'({ObjType, ObjID}) ?tcheck(ir_OperationDef, ObjType) -> - orber_ifr_contained:'_get_name'({ObjType,ObjID}). - -'_set_name'({ObjType, ObjID}, EO_Value) ?tcheck(ir_OperationDef, ObjType) -> - orber_ifr_contained:'_set_name'({ObjType,ObjID}, EO_Value). - -'_get_version'({ObjType, ObjID}) ?tcheck(ir_OperationDef, ObjType) -> - orber_ifr_contained:'_get_version'({ObjType,ObjID}). - -'_set_version'({ObjType, ObjID}, EO_Value) ?tcheck(ir_OperationDef, ObjType) -> - orber_ifr_contained:'_set_version'({ObjType,ObjID},EO_Value). - -'_get_defined_in'({ObjType, ObjID}) ?tcheck(ir_OperationDef, ObjType) -> - orber_ifr_contained:'_get_defined_in'({ObjType,ObjID}). - -'_get_absolute_name'({ObjType, ObjID}) ?tcheck(ir_OperationDef, ObjType) -> - orber_ifr_contained:'_get_absolute_name'({ObjType,ObjID}). - -'_get_containing_repository'({ObjType, ObjID}) ?tcheck(ir_OperationDef, ObjType) -> - orber_ifr_contained:'_get_containing_repository'({ObjType,ObjID}). - -describe({ObjType, ObjID}) ?tcheck(ir_OperationDef, ObjType) -> - orber_ifr_contained:describe({ObjType,ObjID}). - -move({ObjType, ObjID}, New_container, New_name, New_version) - ?tcheck(ir_OperationDef, ObjType) -> - orber_ifr_contained:move({ObjType,ObjID},New_container,New_name,New_version). - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces - -'_get_result'({ObjType, ObjID}) - ?tcheck(ir_OperationDef, ObjType) -> - get_field({ObjType,ObjID},result). - -'_get_result_def'({ObjType, ObjID}) - ?tcheck(ir_OperationDef, ObjType) -> - get_field({ObjType,ObjID},result_def). - -'_set_result_def'({ObjType, ObjID}, EO_Value) - ?tcheck(ir_OperationDef, ObjType) -> - OperationDef = get_object({ObjType, ObjID}), - New_OperationDef = - OperationDef#ir_OperationDef{result = EO_Value#ir_IDLType.type, - result_def = EO_Value}, - set_object(New_OperationDef). - -'_get_params'({ObjType,ObjID}) ?tcheck(ir_OperationDef,ObjType) -> - get_field({ObjType,ObjID},params). - -'_set_params'({ObjType, ObjID}, EO_Value) - ?tcheck(ir_OperationDef, ObjType) -> - set_field({ObjType,ObjID}, params, EO_Value). - -'_get_mode'({ObjType, ObjID}) ?tcheck(ir_OperationDef, ObjType) -> - get_field({ObjType,ObjID},mode). - -'_set_mode'({ObjType, ObjID}, EO_Value) ?tcheck(ir_OperationDef, ObjType) -> - OperationDef = get_object({ObjType, ObjID}), - Set_OK = case EO_Value of - 'OP_ONEWAY' -> - (OperationDef#ir_OperationDef.result == tk_void) - and - lists:foldl(fun(#parameterdescription{mode=Mode},AccIn) -> - (Mode == 'PARAM_IN') and AccIn - end, - true,OperationDef#ir_OperationDef.params); - _ -> - true - end, - set_mode(Set_OK,{ObjType,ObjID},EO_Value). - -set_mode(true,Objref,EO_Value) -> - set_field(Objref,mode,EO_Value); -set_mode(false, Objref, EO_Value) -> - orber:dbg("[~p] ~p:destroy(~p, ~p);~n" - "Illegal '_set_mode'.~n", - [?LINE, ?MODULE, Objref, EO_Value], ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}). - -'_get_contexts'({ObjType, ObjID}) ?tcheck(ir_OperationDef, ObjType) -> - get_field({ObjType,ObjID},contexts). - -'_set_contexts'({ObjType, ObjID}, EO_Value) - ?tcheck(ir_OperationDef, ObjType) -> - set_field({ObjType,ObjID}, contexts, EO_Value). - -'_get_exceptions'({ObjType, ObjID}) ?tcheck(ir_OperationDef, ObjType) -> - get_field({ObjType,ObjID},exceptions). - -'_set_exceptions'({ObjType, ObjID}, EO_Value) - ?tcheck(ir_OperationDef, ObjType) -> - set_field({ObjType,ObjID}, exceptions, EO_Value). diff --git a/lib/orber/src/orber_ifr_orb.erl b/lib/orber/src/orber_ifr_orb.erl deleted file mode 100644 index 3969bbf37a..0000000000 --- a/lib/orber/src/orber_ifr_orb.erl +++ /dev/null @@ -1,100 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_orb.erl -%% Purpose : Code for Orb -%%---------------------------------------------------------------------- - --module(orber_ifr_orb). - --export([create_struct_tc/3, - create_union_tc/4, - create_enum_tc/3, - create_alias_tc/3, - create_exception_tc/3, - create_interface_tc/2, - create_string_tc/1, - create_wstring_tc/1, - create_sequence_tc/2, - create_recursive_sequence_tc/2, - create_array_tc/2 - ]). - - --include("orber_ifr.hrl"). --include_lib("orber/include/ifr_types.hrl"). --include_lib("orber/include/corba.hrl"). - -%%%====================================================================== -%%% ORB - -%%%---------------------------------------------------------------------- -%%% Inherited interfaces - -%% none %% - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces - -create_struct_tc(Id, Name, Members) -> - {tk_struct,Id,Name,lists:map(fun(#structmember{name=MemName,type=Type}) -> - {MemName,Type} end, - Members)}. - -create_union_tc(Id, Name, Discriminator_type, Members) -> - {tk_union, Id, Name, Discriminator_type, -1, % *** is -1 correct??? - lists:map(fun(#unionmember{name=MemName, label=Label, type=Type}) -> - {Label,MemName,Type} end, - Members)}. - -create_enum_tc(Id, Name, Members) -> - {tk_enum, Id, Name, Members}. - -create_alias_tc(Id, Name, Original_type) -> - {tk_alias, Id, Name, orber_ifr_utils:get_field(Original_type,type)}. - -create_exception_tc(Id, Name, Members) -> - {tk_except,Id,Name,lists:map(fun(#structmember{name=MemName,type=Type}) -> - {MemName,Type} end, - Members)}. - -create_interface_tc(Id, Name) -> - {tk_objref, Id, Name}. - -create_string_tc(Bound) -> - {tk_string, Bound}. - -create_wstring_tc(Bound) -> - {tk_wstring, Bound}. - -create_sequence_tc(Bound, Element_type) -> - {tk_sequence,Element_type,Bound}. - --spec create_recursive_sequence_tc(_, _) -> no_return(). -create_recursive_sequence_tc(Bound, Offset) -> - orber:dbg("[~p] ~p:create_recursive_sequence_tc(~p, ~p);~n" - "Create_recursive_sequence is not implemented.~n", - [?LINE, ?MODULE, Bound, Offset], ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}). - -create_array_tc(Length, Element_type) -> - {tk_array, Element_type, Length}. diff --git a/lib/orber/src/orber_ifr_primitivedef.erl b/lib/orber/src/orber_ifr_primitivedef.erl deleted file mode 100644 index bf91bc87bb..0000000000 --- a/lib/orber/src/orber_ifr_primitivedef.erl +++ /dev/null @@ -1,70 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_primitivedef.erl -%% Purpose : Code for Primitivedef -%%---------------------------------------------------------------------- - --module(orber_ifr_primitivedef). - --export(['_get_def_kind'/1, - destroy/1, - cleanup_for_destroy/1, %not in CORBA 2.0 - '_get_type'/1, - '_get_kind'/1 - ]). - --import(orber_ifr_utils,[get_field/2 - ]). - --include("orber_ifr.hrl"). - -%%%====================================================================== -%%% PrimitiveDef (IDLType(IRObject)) - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IRObject - -'_get_def_kind'({ObjType, ObjID}) ?tcheck(ir_PrimitiveDef, ObjType) -> - orber_ifr_irobject:'_get_def_kind'({ObjType,ObjID}). - -destroy({ObjType, ObjID}) ?tcheck(ir_PrimitiveDef, ObjType) -> - F = fun() -> ObjList = cleanup_for_destroy({ObjType, ObjID}), - orber_ifr_irobject:destroy([{ObjType,ObjID} | ObjList]) - end, - orber_ifr_utils:ifr_transaction_write(F). - -cleanup_for_destroy({ObjType,ObjID}) ?tcheck(ir_PrimitiveDef, ObjType) -> - orber_ifr_idltype:cleanup_for_destroy({ObjType,ObjID}). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IDLType - -'_get_type'({ObjType, ObjID}) ?tcheck(ir_PrimitiveDef, ObjType) -> - orber_ifr_idltype:'_get_type'({ObjType, ObjID}). - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces - -'_get_kind'({ObjType, ObjID}) ?tcheck(ir_PrimitiveDef, ObjType) -> - get_field({ObjType,ObjID},kind). - diff --git a/lib/orber/src/orber_ifr_repository.erl b/lib/orber/src/orber_ifr_repository.erl deleted file mode 100644 index 8d52573e53..0000000000 --- a/lib/orber/src/orber_ifr_repository.erl +++ /dev/null @@ -1,288 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_repository.erl -%% Purpose : Code for Repository -%%---------------------------------------------------------------------- - --module(orber_ifr_repository). - --export(['_get_def_kind'/1, - destroy/1, - lookup/2, - contents/3, - lookup_name/5, - describe_contents/4, - create_module/4, - create_constant/6, - create_struct/5, - create_union/6, - create_enum/5, - create_alias/5, - create_interface/5, - create_exception/5, - lookup_id/2, - get_primitive/2, - create_string/2, - create_wstring/2, - create_fixed/3, - create_sequence/3, - create_array/3, - create_idltype/2, %not in CORBA 2.0 - create_primitivedef/1, %not in CORBA 2.0 - create_primitivedef/2 %not in CORBA 2.0 - ]). - - --include("orber_ifr.hrl"). --include("ifr_objects.hrl"). --include_lib("orber/include/corba.hrl"). - -%%%====================================================================== -%%% Repository (Container (IRObject)) - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IRObject - -'_get_def_kind'({ObjType, ObjID}) ?tcheck(ir_Repository, ObjType) -> - orber_ifr_irobject:'_get_def_kind'({ObjType, ObjID}). - --spec destroy(_) -> no_return(). -destroy({ObjType, ObjID}) ?tcheck(ir_Repository, ObjType) -> - orber:dbg("[~p] ~p:destroy(~p, ~p);~n" - "Destroying a repository is an error.~n", - [?LINE, ?MODULE, ObjType, ObjID], ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from Container - -lookup({ObjType,ObjID}, Search_name) ?tcheck(ir_Repository, ObjType) -> - orber_ifr_container:lookup({ObjType, ObjID}, Search_name). - -contents({ObjType,ObjID}, Limit_type, Exclude_inherited) - ?tcheck(ir_Repository, ObjType) -> - orber_ifr_container:contents({ObjType,ObjID},Limit_type,Exclude_inherited). - -lookup_name({ObjType,ObjID}, Search_name, Levels_to_search, Limit_type, - Exclude_inherited) ?tcheck(ir_Repository, ObjType) -> - orber_ifr_container:lookup_name({ObjType, ObjID}, Search_name, - Levels_to_search, Limit_type, - Exclude_inherited). - -describe_contents({ObjType,ObjID}, Limit_type, Exclude_inherited, - Max_returned_objs) ?tcheck(ir_Repository, ObjType) -> - orber_ifr_container:describe_contents({ObjType, ObjID}, Limit_type, - Exclude_inherited,Max_returned_objs). - -create_module({ObjType,ObjID}, Id, Name, Version) - ?tcheck(ir_Repository, ObjType) -> - orber_ifr_container:create_module({ObjType,ObjID}, Id, Name, Version). - -create_constant({ObjType,ObjID}, Id, Name, Version, Type, Value) - ?tcheck(ir_Repository, ObjType) -> - orber_ifr_container:create_constant({ObjType,ObjID}, Id, Name, Version, - Type, Value). - -create_struct({ObjType,ObjID}, Id, Name, Version, Members) - ?tcheck(ir_Repository, ObjType) -> - orber_ifr_container:create_struct({ObjType,ObjID}, Id, Name, Version, - Members). - -create_union({ObjType,ObjID}, Id, Name, Version, Discriminator_type, Members) - ?tcheck(ir_Repository, ObjType) -> - orber_ifr_container:create_union({ObjType,ObjID}, Id, Name, Version, - Discriminator_type, Members). - -create_enum({ObjType,ObjID}, Id, Name, Version, Members) - ?tcheck(ir_Repository, ObjType) -> - orber_ifr_container:create_enum({ObjType,ObjID},Id,Name,Version,Members). - -create_alias({ObjType,ObjID}, Id, Name, Version, Original_type) - ?tcheck(ir_Repository, ObjType) -> - orber_ifr_container:create_alias({ObjType,ObjID}, Id, Name, Version, - Original_type). - -create_interface({ObjType,ObjID}, Id, Name, Version, Base_interfaces) - ?tcheck(ir_Repository, ObjType) -> - orber_ifr_container:create_interface({ObjType,ObjID}, Id, Name, Version, - Base_interfaces). - -create_exception({ObjType, ObjID}, Id, Name, Version, Members) - ?tcheck(ir_Repository, ObjType) -> - orber_ifr_container:create_exception({ObjType, ObjID}, Id, Name, Version, - Members). - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces - -lookup_id({ObjType,ObjID}, Search_id) ?tcheck(ir_Repository, ObjType) -> - Contents = orber_ifr_container:contents({ObjType, ObjID}, dk_All, false), - case lists:filter(fun(X) -> orber_ifr_contained:'_get_id'(X) == Search_id - end, Contents) of - [] -> - []; - [ObjRef] -> - ObjRef; - [H|T] -> - %% This case is just a safety-guard; orber_ifr_container:contents - %% sometimes return duplicates due to inheritance. - case lists:any(fun(X) -> X =/= H end, T) of - false -> - H; - true -> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end - end. - -get_primitive({ObjType,ObjID}, Kind) ?tcheck(ir_Repository, ObjType) -> - Primitivedefs = orber_ifr_utils:get_field({ObjType,ObjID}, primitivedefs), - lists:filter(fun(X) -> orber_ifr_primitivedef:'_get_kind'(X) == Kind end, - Primitivedefs). - -%% It is probably incorrect to add the anonymous typedefs (string, -%% sequence and array) to the field primitivdefs in the Repository. -%% It is probably also not correct to add them to the contents field. -%% Perhaps it is necessary to add another field in the ir_Repository -%% record for anonymous typedefs? Then again, perhaps it is not -%% necessary to keep the anonymous typedefs anywhere? According to -%% the specification it is the callers responsibility to destroy the -%% anonymous typedef if it is not successfully used. - -create_string({ObjType,_ObjID}, Bound) ?tcheck(ir_Repository, ObjType) -> - New_string = #ir_StringDef{ir_Internal_ID = orber_ifr_utils:unique(), - def_kind = dk_String, - type = {tk_string, Bound}, - bound = Bound}, - orber_ifr_utils:makeref(New_string). - -create_wstring({ObjType,_ObjID}, Bound) ?tcheck(ir_Repository, ObjType) -> - NewWstring = #ir_WstringDef{ir_Internal_ID = orber_ifr_utils:unique(), - def_kind = dk_Wstring, - type = {tk_wstring, Bound}, - bound = Bound}, - orber_ifr_utils:makeref(NewWstring). - -create_fixed({ObjType,_ObjID}, Digits, Scale) ?tcheck(ir_Repository, ObjType) -> - NewFixed = #ir_FixedDef{ir_Internal_ID = orber_ifr_utils:unique(), - def_kind = dk_Fixed, - type = {tk_fixed, Digits, Scale}, - digits = Digits, - scale = Scale}, - orber_ifr_utils:makeref(NewFixed). - -create_sequence({ObjType,_ObjID}, Bound, Element_type) - ?tcheck(ir_Repository, ObjType) -> - Element_typecode = orber_ifr_utils:get_field(Element_type, type), - New_sequence = #ir_SequenceDef{ir_Internal_ID = orber_ifr_utils:unique(), - def_kind = dk_Sequence, - type = {tk_sequence,Element_typecode,Bound}, - bound = Bound, - element_type = Element_typecode, - element_type_def = Element_type}, - orber_ifr_utils:makeref(New_sequence). - -create_array({ObjType,_ObjID}, Length, Element_type) - ?tcheck(ir_Repository, ObjType) -> - Element_typecode = orber_ifr_utils:get_field(Element_type, type), - New_array = #ir_ArrayDef{ir_Internal_ID = orber_ifr_utils:unique(), - def_kind = dk_Array, - type = {tk_array, Element_typecode, Length}, - length = Length, - element_type = Element_typecode, - element_type_def = Element_type}, - orber_ifr_utils:makeref(New_array). - -%%%---------------------------------------------------------------------- -%%% Extra interfaces (not in the IDL-spec for the IFR). - -create_idltype(#orber_light_ifr_ref{} = LRef, _Typecode) -> - LRef; -create_idltype({ObjType,_ObjID}, Typecode) ?tcheck(ir_Repository, ObjType) -> - New_idltype = #ir_IDLType{ir_Internal_ID = orber_ifr_utils:unique(), - def_kind = dk_none, - type=Typecode}, - orber_ifr_utils:set_object(New_idltype), - orber_ifr_utils:makeref(New_idltype). - -create_primitivedef(Pkind) -> - create_primitivedef(Pkind, true). -create_primitivedef(Pkind, Transaction) -> - Typecode = case Pkind of - pk_void -> - tk_void; - pk_short -> - tk_short; - pk_long -> - tk_long; - pk_longlong -> - tk_longlong; - pk_ushort -> - tk_ushort; - pk_ulong -> - tk_ulong; - pk_ulonglong -> - tk_ulonglong; - pk_float -> - tk_float; - pk_double -> - tk_double; - pk_boolean -> - tk_boolean; - pk_char -> - tk_char; - pk_wchar -> - tk_wchar; - pk_fixed -> - tk_fixed; - pk_octet -> - tk_octet; - pk_any -> - tk_any; - pk_TypeCode -> - tk_TypeCode; - pk_Principal -> - tk_Principal; - pk_string -> - orber_ifr_orb:create_string_tc(0); - pk_wstring -> - orber_ifr_orb:create_wstring_tc(0); - pk_objref -> - %%*** what should the Id and Name be here? - orber_ifr_orb:create_interface_tc("", ""); - _ -> - orber:dbg("[~p] ~p:destroy(~p);~n" - "Illegal primitivekin.~n", - [?LINE, ?MODULE, Pkind], ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}) - end, - New_primitivedef = #ir_PrimitiveDef{ir_Internal_ID = orber_ifr_utils:unique(), - def_kind = dk_Primitive, - type = Typecode, - kind = Pkind}, - case Transaction of - true -> - orber_ifr_utils:set_object(New_primitivedef); - false -> - mnesia:write(New_primitivedef) - end, - orber_ifr_utils:makeref(New_primitivedef). diff --git a/lib/orber/src/orber_ifr_sequencedef.erl b/lib/orber/src/orber_ifr_sequencedef.erl deleted file mode 100644 index f3a9806828..0000000000 --- a/lib/orber/src/orber_ifr_sequencedef.erl +++ /dev/null @@ -1,104 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_sequencedef.erl -%% Purpose : Code for Sequencedef -%%---------------------------------------------------------------------- - --module(orber_ifr_sequencedef). - --export(['_get_def_kind'/1, - destroy/1, - cleanup_for_destroy/1, %not in CORBA 2.0 - '_get_type'/1, - '_get_bound'/1, - '_set_bound'/2, - '_get_element_type'/1, - '_get_element_type_def'/1, - '_set_element_type_def'/2 - ]). - --import(orber_ifr_utils,[get_field/2, - get_object/1, - set_object/1 - ]). - --include("orber_ifr.hrl"). --include("ifr_objects.hrl"). - -%%%====================================================================== -%%% SequenceDef (IDLType(IRObject)) - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IRObject - -'_get_def_kind'({ObjType,ObjID}) ?tcheck(ir_SequenceDef,ObjType) -> - orber_ifr_irobject:'_get_def_kind'({ObjType,ObjID}). - -destroy({ObjType, ObjID}) ?tcheck(ir_SequenceDef, ObjType) -> - F = fun() -> ObjList = cleanup_for_destroy({ObjType, ObjID}), - orber_ifr_irobject:destroy([{ObjType,ObjID} | ObjList]) - end, - orber_ifr_utils:ifr_transaction_write(F). - -cleanup_for_destroy({ObjType,ObjID}) ?tcheck(ir_SequenceDef, ObjType) -> - orber_ifr_idltype:cleanup_for_destroy( - '_get_element_type_def'({ObjType,ObjID})) ++ - orber_ifr_idltype:cleanup_for_destroy({ObjType,ObjID}). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IDLType - -'_get_type'({ObjType, ObjID}) ?tcheck(ir_SequenceDef, ObjType) -> - orber_ifr_idltype:'_get_type'({ObjType, ObjID}). - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces - -'_get_bound'({ObjType, ObjID}) ?tcheck(ir_SequenceDef, ObjType) -> - get_field({ObjType,ObjID},bound). - -'_set_bound'({ObjType, ObjID}, EO_Value) ?tcheck(ir_SequenceDef, ObjType) -> - SequenceDef = get_object({ObjType, ObjID}), - New_SequenceDef = - SequenceDef#ir_SequenceDef{type = {tk_sequence, - SequenceDef#ir_SequenceDef.type, - SequenceDef#ir_SequenceDef.bound}, - bound = EO_Value}, - set_object(New_SequenceDef). - -'_get_element_type'({ObjType, ObjID}) ?tcheck(ir_SequenceDef, ObjType) -> - get_field({ObjType,ObjID},element_type). - -'_get_element_type_def'({ObjType, ObjID}) ?tcheck(ir_SequenceDef, ObjType) -> - get_field({ObjType,ObjID},element_type_def). - -'_set_element_type_def'({ObjType, ObjID}, EO_Value) - ?tcheck(ir_SequenceDef, ObjType) -> - SequenceDef = get_object({ObjType, ObjID}), - New_type = {tk_sequence, - EO_Value#ir_IDLType.type, - SequenceDef#ir_SequenceDef.bound}, - New_SequenceDef = SequenceDef#ir_SequenceDef{type = New_type, - element_type = New_type, - element_type_def = EO_Value}, - set_object(New_SequenceDef). diff --git a/lib/orber/src/orber_ifr_stringdef.erl b/lib/orber/src/orber_ifr_stringdef.erl deleted file mode 100644 index b206a218c1..0000000000 --- a/lib/orber/src/orber_ifr_stringdef.erl +++ /dev/null @@ -1,75 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_stringdef.erl -%% Purpose : Code for Stringdef -%%---------------------------------------------------------------------- - --module(orber_ifr_stringdef). - --export(['_get_def_kind'/1, - destroy/1, - cleanup_for_destroy/1, %not in CORBA 2.0 - '_get_type'/1, - '_get_bound'/1, - '_set_bound'/2 - ]). - --import(orber_ifr_utils,[get_field/2, - set_field/3 - ]). - --include("orber_ifr.hrl"). - -%%%====================================================================== -%%% StringDef (IDLType(IRObject)) - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IRObject - -'_get_def_kind'({ObjType,ObjID}) ?tcheck(ir_StringDef, ObjType) -> - orber_ifr_irobject:'_get_def_kind'({ObjType,ObjID}). - -destroy({ObjType, ObjID}) ?tcheck(ir_StringDef, ObjType) -> - F = fun() -> ObjList = cleanup_for_destroy({ObjType, ObjID}), - orber_ifr_irobject:destroy([{ObjType,ObjID} | ObjList]) - end, - orber_ifr_utils:ifr_transaction_write(F). - -cleanup_for_destroy({ObjType,ObjID}) ?tcheck(ir_StringDef, ObjType) -> - orber_ifr_idltype:cleanup_for_destroy({ObjType,ObjID}). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IDLType - -'_get_type'({ObjType, ObjID}) ?tcheck(ir_StringDef, ObjType) -> - orber_ifr_idltype:'_get_type'({ObjType, ObjID}). - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces - -'_get_bound'({ObjType, ObjID}) ?tcheck(ir_StringDef, ObjType) -> - get_field({ObjType,ObjID},bound). - -'_set_bound'({ObjType, ObjID}, EO_Value) - ?tcheck(ir_StringDef, ObjType) -> - set_field({ObjType, ObjID}, bound, EO_Value). diff --git a/lib/orber/src/orber_ifr_structdef.erl b/lib/orber/src/orber_ifr_structdef.erl deleted file mode 100644 index 3a9cde353e..0000000000 --- a/lib/orber/src/orber_ifr_structdef.erl +++ /dev/null @@ -1,156 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_structdef.erl -%% Purpose : Code for Structdef -%%---------------------------------------------------------------------- - --module(orber_ifr_structdef). - --export(['_get_def_kind'/1, - destroy/1, - cleanup_for_destroy/1, %not in CORBA 2.0 - '_get_id'/1, - '_set_id'/2, - '_get_name'/1, - '_set_name'/2, - '_get_version'/1, - '_set_version'/2, - '_get_defined_in'/1, - '_get_absolute_name'/1, - '_get_containing_repository'/1, - describe/1, - move/4, - '_get_type'/1, - '_get_members'/1, - '_set_members'/2 - ]). - --import(orber_ifr_utils,[get_field/2,get_object/1,set_object/1]). --import(lists,[map/2]). - --include("orber_ifr.hrl"). --include("ifr_objects.hrl"). --include_lib("orber/include/ifr_types.hrl"). - -%%%====================================================================== -%%% StructDef (TypedefDef(Contained(IRObject), IDLType(IRObject))) - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IRObject - -'_get_def_kind'({ObjType, ObjID}) ?tcheck(ir_StructDef, ObjType) -> - orber_ifr_irobject:'_get_def_kind'({ObjType,ObjID}). - -destroy({ObjType, ObjID}) ?tcheck(ir_StructDef, ObjType) -> - F = fun() -> ObjList = cleanup_for_destroy({ObjType, ObjID}), - orber_ifr_irobject:destroy([{ObjType, ObjID} | ObjList]) - end, - orber_ifr_utils:ifr_transaction_write(F). - -cleanup_for_destroy({ObjType,ObjID}) ?tcheck(ir_StructDef, ObjType) -> - map(fun(X) -> orber_ifr_idltype:cleanup_for_destroy( - X#structmember.type_def) - end, - '_get_members'({ObjType, ObjID}) - ) ++ - orber_ifr_typedef:cleanup_for_destroy({ObjType,ObjID}). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from Contained - -'_get_id'({ObjType, ObjID}) ?tcheck(ir_StructDef, ObjType) -> - orber_ifr_contained:'_get_id'({ObjType,ObjID}). - -'_set_id'({ObjType, ObjID},EO_Value) ?tcheck(ir_StructDef,ObjType) -> - orber_ifr_contained:'_set_id'({ObjType,ObjID},EO_Value). - -'_get_name'({ObjType, ObjID}) ?tcheck(ir_StructDef, ObjType) -> - orber_ifr_contained:'_get_name'({ObjType,ObjID}). - -'_set_name'({ObjType, ObjID}, EO_Value) ?tcheck(ir_StructDef, ObjType) -> - orber_ifr_contained:'_set_name'({ObjType,ObjID}, EO_Value). - -'_get_version'({ObjType, ObjID}) ?tcheck(ir_StructDef, ObjType) -> - orber_ifr_contained:'_get_version'({ObjType,ObjID}). - -'_set_version'({ObjType, ObjID}, EO_Value) ?tcheck(ir_StructDef, ObjType) -> - orber_ifr_contained:'_set_version'({ObjType,ObjID},EO_Value). - -'_get_defined_in'({ObjType, ObjID}) ?tcheck(ir_StructDef, ObjType) -> - orber_ifr_contained:'_get_defined_in'({ObjType,ObjID}). - -'_get_absolute_name'({ObjType, ObjID}) ?tcheck(ir_StructDef, ObjType) -> - orber_ifr_contained:'_get_absolute_name'({ObjType,ObjID}). - -'_get_containing_repository'({ObjType, ObjID}) ?tcheck(ir_StructDef,ObjType) -> - orber_ifr_contained:'_get_containing_repository'({ObjType,ObjID}). - -describe({ObjType, ObjID}) ?tcheck(ir_StructDef, ObjType) -> - orber_ifr_contained:describe({ObjType,ObjID}). - -move({ObjType, ObjID}, New_container, New_name, New_version) - ?tcheck(ir_StructDef, ObjType) -> - orber_ifr_contained:move({ObjType,ObjID},New_container,New_name, - New_version). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IDLType - -'_get_type'({ObjType, ObjID}) ?tcheck(ir_StructDef, ObjType) -> - orber_ifr_idltype:'_get_type'({ObjType, ObjID}). - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces - -'_get_members'({ObjType, ObjID}) ?tcheck(ir_StructDef, ObjType) -> - get_field({ObjType,ObjID},members). - -'_set_members'({ObjType, ObjID}, EO_Value) ?tcheck(ir_StructDef, ObjType) -> - StructDef = get_object({ObjType, ObjID}), - Members = map(fun(Structmember) -> Structmember#structmember{type=tk_void} - end, EO_Value), - New_StructDef = - StructDef#ir_StructDef{type = - {tk_struct, - StructDef#ir_StructDef.id, - StructDef#ir_StructDef.name, - map(fun(#structmember{name=Name,type=Type}) -> - {Name,Type} - end, - EO_Value)}, - members=Members}, - set_object(New_StructDef). - - - - - - - - - - - - - - diff --git a/lib/orber/src/orber_ifr_typecode.erl b/lib/orber/src/orber_ifr_typecode.erl deleted file mode 100644 index 52263be719..0000000000 --- a/lib/orber/src/orber_ifr_typecode.erl +++ /dev/null @@ -1,108 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_typecode.erl -%% Purpose : Code for Typecode -%%---------------------------------------------------------------------- - -%%% NOTE: -%%% Only make_typcode is for real here. All of the TypeCode interfaces -%%% specified in the IDL specification needs to be implemented. -%%% - --module(orber_ifr_typecode). - --export([ - equal/2, - kind/1, - id/1, - name/1, - member_count/1, - member_name/2, - member_type/2, - member_label/2, - discriminator_type/1, - default_index/1, - '_length'/1, - content_type/1, - param_count/1, - parameter/2 - ]). - --import(orber_ifr_utils,[get_field/2]). - --include("orber_ifr.hrl"). --include("ifr_objects.hrl"). --include_lib("orber/include/corba.hrl"). - - - -%%%---------------------------------------------------------------------- -%%% Inherited interfaces - -%% none %% - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces - -equal({ObjType, ObjID}, {Tc_ObjType, Tc_ObjID}) -?tcheck(ir_TypeCode, ObjType) -> - get_field({ObjType,ObjID},kind) == get_field({Tc_ObjType,Tc_ObjID},kind). - -kind({ObjType, ObjID}) -> - {ok, {ObjType, ObjID}}. - -id({ObjType, ObjID}) -> - {ok, {ObjType, ObjID}}. - -name({ObjType, ObjID}) -> - {ok, {ObjType, ObjID}}. - -member_count({ObjType, ObjID}) -> - {ok, {ObjType, ObjID}}. - -member_name({ObjType, ObjID}, _Index) -> - {ok, {ObjType, ObjID}}. - -member_type({ObjType, ObjID}, _Index) -> - {ok, {ObjType, ObjID}}. - -member_label({ObjType, ObjID}, _Index) -> - {ok, {ObjType, ObjID}}. - -discriminator_type({ObjType, ObjID}) -> - {ok, {ObjType, ObjID}}. - -default_index({ObjType, ObjID}) -> - {ok, {ObjType, ObjID}}. - -'_length'({ObjType, ObjID}) -> - {ok, {ObjType, ObjID}}. - -content_type({ObjType, ObjID}) -> - {ok, {ObjType, ObjID}}. - -param_count({ObjType, ObjID}) -> - {ok, {ObjType, ObjID}}. - -parameter({ObjType, ObjID}, _Index) -> - {ok, {ObjType, ObjID}}. diff --git a/lib/orber/src/orber_ifr_typedef.erl b/lib/orber/src/orber_ifr_typedef.erl deleted file mode 100644 index 3441d7e7af..0000000000 --- a/lib/orber/src/orber_ifr_typedef.erl +++ /dev/null @@ -1,125 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_typedef.erl -%% Purpose : Code for Typedef -%%---------------------------------------------------------------------- - --module(orber_ifr_typedef). - --export(['_get_def_kind'/1, - destroy/1, - cleanup_for_destroy/1, %not in CORBA 2.0 - '_get_id'/1, - '_set_id'/2, - '_get_name'/1, - '_set_name'/2, - '_get_version'/1, - '_set_version'/2, - '_get_defined_in'/1, - '_get_absolute_name'/1, - '_get_containing_repository'/1, - describe/1, - move/4, - '_get_type'/1 - ]). - - --include("orber_ifr.hrl"). - -%%%====================================================================== -%%% TypedefDef (Contained(IRObject), IDLType(IRObject)) - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IRObject - -'_get_def_kind'({ObjType, ObjID}) -> - orber_ifr_irobject:'_get_def_kind'({ObjType, ObjID}). - -%%% Note, that the destroy function is meant to be called within a -%%% transaction called in the destroy function of an object which -%%% inherits from TypedefDef. A TypedefDef should only be destroyed by -%%% destroying the object that inherits from a TypedefDef. An attempt -%%% to call this function in user code will result in unpredictable -%%% results. - -%%% Don't type check the object reference. We need to be able to -%%% handle several types of objects that inherit from TypedefDef. - -destroy(TypedefDef_objref) -> - F = fun() -> ObjList = cleanup_for_destroy(TypedefDef_objref), - orber_ifr_irobject:destroy([TypedefDef_objref | ObjList]) - end, - orber_ifr_utils:ifr_transaction_write(F). - -cleanup_for_destroy(TypedefDef_objref) -> - orber_ifr_contained:cleanup_for_destroy(TypedefDef_objref) ++ - orber_ifr_idltype:cleanup_for_destroy(TypedefDef_objref). - - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from Contained - -'_get_id'({ObjType, ObjID}) -> - orber_ifr_contained:'_get_id'({ObjType,ObjID}). - -'_set_id'({ObjType, ObjID}, EO_Value) -> - orber_ifr_contained:'_set_id'({ObjType,ObjID},EO_Value). - -'_get_name'({ObjType, ObjID}) -> - orber_ifr_contained:'_get_name'({ObjType,ObjID}). - -'_set_name'({ObjType, ObjID}, EO_Value) -> - orber_ifr_contained:'_set_name'({ObjType,ObjID}, EO_Value). - -'_get_version'({ObjType, ObjID}) -> - orber_ifr_contained:'_get_version'({ObjType,ObjID}). - -'_set_version'({ObjType, ObjID}, EO_Value) -> - orber_ifr_contained:'_set_version'({ObjType,ObjID},EO_Value). - -'_get_defined_in'({ObjType,ObjID}) -> - orber_ifr_contained:'_get_defined_in'({ObjType,ObjID}). - -'_get_absolute_name'({ObjType, ObjID}) -> - orber_ifr_contained:'_get_absolute_name'({ObjType,ObjID}). - -'_get_containing_repository'({ObjType,ObjID}) -> - orber_ifr_contained:'_get_containing_repository'({ObjType,ObjID}). - -describe({ObjType, ObjID}) -> - orber_ifr_contained:describe({ObjType,ObjID}). - -move({ObjType, ObjID}, New_container, New_name, New_version) -> - orber_ifr_contained:move({ObjType,ObjID},New_container,New_name, - New_version). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IDLType - -'_get_type'({ObjType, ObjID}) -> - orber_ifr_idltype:'_get_type'({ObjType, ObjID}). - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces - -%%% none %% diff --git a/lib/orber/src/orber_ifr_uniondef.erl b/lib/orber/src/orber_ifr_uniondef.erl deleted file mode 100644 index 64d55ee581..0000000000 --- a/lib/orber/src/orber_ifr_uniondef.erl +++ /dev/null @@ -1,176 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_uniondef.erl -%% Purpose : Code for Uniondef -%%---------------------------------------------------------------------- - --module(orber_ifr_uniondef). - --export(['_get_def_kind'/1, - destroy/1, - cleanup_for_destroy/1, %not in CORBA 2.0 - '_get_id'/1, - '_set_id'/2, - '_get_name'/1, - '_set_name'/2, - '_get_version'/1, - '_set_version'/2, - '_get_defined_in'/1, - '_get_absolute_name'/1, - '_get_containing_repository'/1, - describe/1, - move/4, - '_get_type'/1, - '_get_discriminator_type'/1, - '_get_discriminator_type_def'/1, - '_set_discriminator_type_def'/2, - '_get_members'/1, - '_set_members'/2 - ]). - --import(orber_ifr_utils,[get_field/2, - get_object/1, - set_object/1 - ]). - --import(lists,[map/2]). - --include("orber_ifr.hrl"). --include("ifr_objects.hrl"). --include_lib("orber/include/ifr_types.hrl"). - -%%%====================================================================== -%%% UnionDef (TypedefDef(Contained(IRObject), IDLType(IRObject))) - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IRObject - -'_get_def_kind'({ObjType, ObjID}) ?tcheck(ir_UnionDef, ObjType) -> - orber_ifr_irobject:'_get_def_kind'({ObjType, ObjID}). - -destroy({ObjType, ObjID}) ?tcheck(ir_UnionDef, ObjType) -> - F = fun() -> ObjList = cleanup_for_destroy({ObjType, ObjID}), - orber_ifr_irobject:destroy([{ObjType, ObjID} | ObjList]) - end, - orber_ifr_utils:ifr_transaction_write(F). - -cleanup_for_destroy({ObjType,ObjID}) ?tcheck(ir_UnionDef, ObjType) -> - map(fun(X) -> orber_ifr_idltype:cleanup_for_destroy( - X#unionmember.type_def) - end, - '_get_members'({ObjType, ObjID}) - ) ++ - orber_ifr_idltype:cleanup_for_destroy( - '_get_discriminator_type_def'({ObjType,ObjID})) ++ - orber_ifr_typedef:cleanup_for_destroy({ObjType,ObjID}). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from Contained - -'_get_id'({ObjType, ObjID}) ?tcheck(ir_UnionDef, ObjType) -> - orber_ifr_contained:'_get_id'({ObjType,ObjID}). - -'_set_id'({ObjType, ObjID}, EO_Value) ?tcheck(ir_UnionDef, ObjType) -> - orber_ifr_contained:'_set_id'({ObjType,ObjID},EO_Value). - -'_get_name'({ObjType, ObjID}) ?tcheck(ir_UnionDef, ObjType) -> - orber_ifr_contained:'_get_name'({ObjType,ObjID}). - -'_set_name'({ObjType,ObjID},EO_Value) ?tcheck(ir_UnionDef,ObjType) -> - orber_ifr_contained:'_set_name'({ObjType,ObjID}, EO_Value). - -'_get_version'({ObjType, ObjID}) ?tcheck(ir_UnionDef, ObjType) -> - orber_ifr_contained:'_get_version'({ObjType,ObjID}). - -'_set_version'({ObjType, ObjID}, EO_Value) ?tcheck(ir_UnionDef, ObjType) -> - orber_ifr_contained:'_set_version'({ObjType,ObjID},EO_Value). - -'_get_defined_in'({ObjType, ObjID}) ?tcheck(ir_UnionDef, ObjType) -> - orber_ifr_contained:'_get_defined_in'({ObjType,ObjID}). - -'_get_absolute_name'({ObjType, ObjID}) ?tcheck(ir_UnionDef,ObjType) -> - orber_ifr_contained:'_get_absolute_name'({ObjType,ObjID}). - -'_get_containing_repository'({ObjType, ObjID}) ?tcheck(ir_UnionDef, ObjType) -> - orber_ifr_contained:'_get_containing_repository'({ObjType,ObjID}). - -describe({ObjType, ObjID}) ?tcheck(ir_UnionDef, ObjType) -> - orber_ifr_contained:describe({ObjType,ObjID}). - -move({ObjType, ObjID}, New_container, New_name, New_version) - ?tcheck(ir_UnionDef, ObjType) -> - orber_ifr_contained:move({ObjType,ObjID}, New_container, New_name, - New_version). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IDLType - -'_get_type'({ObjType, ObjID}) ?tcheck(ir_UnionDef, ObjType) -> - orber_ifr_idltype:'_get_type'({ObjType, ObjID}). - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces - -'_get_discriminator_type'({ObjType, ObjID}) ?tcheck(ir_UnionDef, ObjType) -> - get_field({ObjType,ObjID},discriminator_type). - -'_get_discriminator_type_def'({ObjType, ObjID}) ?tcheck(ir_UnionDef,ObjType) -> - get_field({ObjType,ObjID},discriminator_type_def). - -'_set_discriminator_type_def'({ObjType, ObjID}, EO_Value) - ?tcheck(ir_UnionDef, ObjType) -> - UnionDef = get_object({ObjType, ObjID}), - NewUnionDef = UnionDef#ir_UnionDef{type = EO_Value#ir_IDLType.type, - discriminator_type = - EO_Value#ir_IDLType.type, - discriminator_type_def = EO_Value}, - set_object(NewUnionDef). - -'_get_members'({ObjType, ObjID}) ?tcheck(ir_UnionDef, ObjType) -> - get_field({ObjType,ObjID},members). - -%%% *** What should the value of the discriminator-typecode be when -%%% updating the type attribute? (CORBA 2.0, p 6-20). For now we just -%%% leave it unchanged, but this is perhaps not the right thing to do. - --define(discr_tc(TC),element(4,TC)). --define(default(TC),element(5,TC)). - -'_set_members'({ObjType, ObjID}, EO_Value) ?tcheck(ir_UnionDef, ObjType) -> - UnionDef = get_object({ObjType, ObjID}), - Members=map(fun(Unionmember) -> Unionmember#unionmember{type=tk_void} end, - EO_Value), - NewUnionDef = UnionDef#ir_UnionDef{type = - {tk_union, - UnionDef#ir_UnionDef.id, - UnionDef#ir_UnionDef.name, - ?discr_tc(UnionDef#ir_UnionDef.type), - ?default(UnionDef#ir_UnionDef.type), - map(fun(#unionmember{name=Name, - label=Label, - type=Type}) -> - {Label,Name,Type} - end, - EO_Value)}, - members = Members}, - set_object(NewUnionDef). diff --git a/lib/orber/src/orber_ifr_utils.erl b/lib/orber/src/orber_ifr_utils.erl deleted file mode 100644 index 95a1d504bc..0000000000 --- a/lib/orber/src/orber_ifr_utils.erl +++ /dev/null @@ -1,437 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_utils.erl -%% Purpose : Common function for the Interface Repository -%%---------------------------------------------------------------------- - --module(orber_ifr_utils). - --export([ - select/2, - index/2, - construct/3, - get_object/1, - set_object/1, - get_field/2, - set_field/3, - write_result/1, - read_result/1, - ifr_transaction_read/1, - ifr_transaction_write/1, - ifr_transaction_read_write/1, - makeref/1, - unique/0, - existence_check/2, - existence_check/3, - create_repository/0, - init_DB/2, init_DB/3 - ]). - --include_lib("orber/include/corba.hrl"). --include("orber_ifr.hrl"). --include("ifr_objects.hrl"). - - -%%====================================================================== -%% Internal stuff - -%%---------------------------------------------------------------------- -%% Make a record selection. -%% -%% This code *must* be amended whenever a new record is added in the -%% files ifr_objects.hrl or ../include/ifr_types.hrl - -select(Record,Field) when is_record(Record,ir_IRObject) -> - select(Record,record_info(fields,ir_IRObject),Field); -select(Record,Field) when is_record(Record,ir_Contained) -> - select(Record,record_info(fields,ir_Contained),Field); -select(Record,Field) when is_record(Record,ir_Container) -> - select(Record,record_info(fields,ir_Container),Field); -select(Record,Field) when is_record(Record,ir_IDLType) -> - select(Record,record_info(fields,ir_IDLType),Field); -select(Record,Field) when is_record(Record,ir_Repository) -> - select(Record,record_info(fields,ir_Repository),Field); -select(Record,Field) when is_record(Record,ir_ModuleDef) -> - select(Record,record_info(fields,ir_ModuleDef),Field); -select(Record,Field) when is_record(Record,ir_ConstantDef) -> - select(Record,record_info(fields,ir_ConstantDef),Field); -select(Record,Field) when is_record(Record,ir_TypedefDef) -> - select(Record,record_info(fields,ir_TypedefDef),Field); -select(Record,Field) when is_record(Record,ir_StructDef) -> - select(Record,record_info(fields,ir_StructDef),Field); -select(Record,Field) when is_record(Record,ir_UnionDef) -> - select(Record,record_info(fields,ir_UnionDef),Field); -select(Record,Field) when is_record(Record,ir_EnumDef) -> - select(Record,record_info(fields,ir_EnumDef),Field); -select(Record,Field) when is_record(Record,ir_AliasDef) -> - select(Record,record_info(fields,ir_AliasDef),Field); -select(Record,Field) when is_record(Record,ir_PrimitiveDef) -> - select(Record,record_info(fields,ir_PrimitiveDef),Field); -select(Record,Field) when is_record(Record,ir_StringDef) -> - select(Record,record_info(fields,ir_StringDef),Field); -select(Record,Field) when is_record(Record,ir_WstringDef) -> - select(Record,record_info(fields,ir_WstringDef),Field); -select(Record,Field) when is_record(Record,ir_SequenceDef) -> - select(Record,record_info(fields,ir_SequenceDef),Field); -select(Record,Field) when is_record(Record,ir_ArrayDef) -> - select(Record,record_info(fields,ir_ArrayDef),Field); -select(Record,Field) when is_record(Record,ir_ExceptionDef) -> - select(Record,record_info(fields,ir_ExceptionDef),Field); -select(Record,Field) when is_record(Record,ir_AttributeDef) -> - select(Record,record_info(fields,ir_AttributeDef),Field); -select(Record,Field) when is_record(Record,ir_OperationDef) -> - select(Record,record_info(fields,ir_OperationDef),Field); -select(Record,Field) when is_record(Record,ir_InterfaceDef) -> - select(Record,record_info(fields,ir_InterfaceDef),Field); -select(Record,Field) when is_record(Record,ir_FixedDef) -> - select(Record,record_info(fields,ir_FixedDef),Field); -select([],_) -> []; -select(Record,Field) -> - orber:dbg("[~p] orber_ifr_utils:select(~p, ~p);~n" - "Unknown Record Type~n", [?LINE, Record,Field], ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}). - --define(ELEMENT_OFFSET, 2). - -select(Record,Fields,Field) -> - Index = index(Fields,Field), - element(?ELEMENT_OFFSET + Index, Record). - -index(List,Element) -> - index(List,Element,0). - -index([H|_T],Element,Index) when H == Element -> - Index; -index([_H|T],Element,Index) -> - index(T,Element,Index+1); -index([],Element,Index) -> - orber:dbg("[~p] orber_ifr_utils:index(~p, ~p);~n" - "Index error.~n", [?LINE, Element, Index], ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}). - -%%%---------------------------------------------------------------------- -%%% Construct a record. -%%% -%%% This code *must* be amended whenever a new record is added in the -%%% files ifr_objects.hrl or ../include/ifr_types.hrl - -construct(Record,Field,Value) when is_record(Record,ir_IRObject) -> - construct(Record,record_info(fields,ir_IRObject),Field,Value); -construct(Record,Field,Value) when is_record(Record,ir_Contained) -> - construct(Record,record_info(fields,ir_Contained),Field,Value); -construct(Record,Field,Value) when is_record(Record,ir_Container) -> - construct(Record,record_info(fields,ir_Container),Field,Value); -construct(Record,Field,Value) when is_record(Record,ir_IDLType) -> - construct(Record,record_info(fields,ir_IDLType),Field,Value); -construct(Record,Field,Value) when is_record(Record,ir_Repository) -> - construct(Record,record_info(fields,ir_Repository),Field,Value); -construct(Record,Field,Value) when is_record(Record,ir_ModuleDef) -> - construct(Record,record_info(fields,ir_ModuleDef),Field,Value); -construct(Record,Field,Value) when is_record(Record,ir_ConstantDef) -> - construct(Record,record_info(fields,ir_ConstantDef),Field,Value); -construct(Record,Field,Value) when is_record(Record,ir_TypedefDef) -> - construct(Record,record_info(fields,ir_TypedefDef),Field,Value); -construct(Record,Field,Value) when is_record(Record,ir_StructDef) -> - construct(Record,record_info(fields,ir_StructDef),Field,Value); -construct(Record,Field,Value) when is_record(Record,ir_UnionDef) -> - construct(Record,record_info(fields,ir_UnionDef),Field,Value); -construct(Record,Field,Value) when is_record(Record,ir_EnumDef) -> - construct(Record,record_info(fields,ir_EnumDef),Field,Value); -construct(Record,Field,Value) when is_record(Record,ir_AliasDef) -> - construct(Record,record_info(fields,ir_AliasDef),Field,Value); -construct(Record,Field,Value) when is_record(Record,ir_PrimitiveDef) -> - construct(Record,record_info(fields,ir_PrimitiveDef),Field,Value); -construct(Record,Field,Value) when is_record(Record,ir_StringDef) -> - construct(Record,record_info(fields,ir_StringDef),Field,Value); -construct(Record,Field,Value) when is_record(Record,ir_WstringDef) -> - construct(Record,record_info(fields,ir_WstringDef),Field,Value); -construct(Record,Field,Value) when is_record(Record,ir_SequenceDef) -> - construct(Record,record_info(fields,ir_SequenceDef),Field,Value); -construct(Record,Field,Value) when is_record(Record,ir_ArrayDef) -> - construct(Record,record_info(fields,ir_ArrayDef),Field,Value); -construct(Record,Field,Value) when is_record(Record,ir_ExceptionDef) -> - construct(Record,record_info(fields,ir_ExceptionDef),Field,Value); -construct(Record,Field,Value) when is_record(Record,ir_AttributeDef) -> - construct(Record,record_info(fields,ir_AttributeDef),Field,Value); -construct(Record,Field,Value) when is_record(Record,ir_OperationDef) -> - construct(Record,record_info(fields,ir_OperationDef),Field,Value); -construct(Record,Field,Value) when is_record(Record,ir_InterfaceDef) -> - construct(Record,record_info(fields,ir_InterfaceDef),Field,Value); -construct(Record,Field,Value) when is_record(Record,ir_FixedDef) -> - construct(Record,record_info(fields,ir_FixedDef),Field,Value); -construct(Record,Field,Value) -> - orber:dbg("[~p] orber_ifr_utils:construct(~p, ~p, ~p);~n" - "Unknown Record Type~n", - [?LINE, Record,Field,Value], ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}). - -construct(Record,Fields,Field,Value) -> - Index = index(Fields,Field), - setelement(?ELEMENT_OFFSET + Index,Record,Value). - -%%%---------------------------------------------------------------------- -%%% Read an object from the database - -get_object(Objref) -> -%%% Use mnesia:dirty_read/1. It is much faster than doing a transaction. - case mnesia:dirty_read(Objref) of - [Res] -> - Res; - [] -> - []; - Other -> - orber:dbg("[~p] orber_ifr_utils:get_object(~p);~n", - [?LINE, Other], ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}) - end. -%%% This is the old code, with a transaction. We might have to revert back -%%% to this at some future time... -%% _F = ?read_function(Objref), -%% read_result(ifr_transaction_read(_F)). - -%%%---------------------------------------------------------------------- -%%% Write an object to the database - -set_object(Object) -> - _F = fun() -> mnesia:write(Object) end, - write_result(ifr_transaction_write(_F)). - -%%%---------------------------------------------------------------------- -%%% Get the value of a field in a record in the DB - -get_field(Objref,FieldName) -> - Object = get_object(Objref), - select(Object,FieldName). - -%%%---------------------------------------------------------------------- -%%% Atomically set the value of a field in a record in the DB - -set_field(Objref,FieldName,Value) -> - _F = fun() -> Object = get_object(Objref), - New_object = construct(Object,FieldName,Value), - mnesia:write(New_object) - end, - write_result(ifr_transaction_write(_F)). - - -%%%---------------------------------------------------------------------- -%%% Check a write transaction - -write_result({atomic,ok}) -> ok; -write_result(Wres) -> - orber:dbg("[~p] orber_ifr_utils:write_result(~p);~n", - [?LINE, Wres], ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}). - -%%%---------------------------------------------------------------------- -%%% Extract the data from a read - -read_result({atomic,[Qres]}) -> Qres; -read_result({atomic,[]}) -> []; -read_result(Qres) -> - orber:dbg("[~p] orber_ifr_utils:read_result(~p);~n", - [?LINE, Qres], ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}). - -%%%---------------------------------------------------------------------- -%%% Execute a transaction or a dirty read/write. -%%% -%%% Since nested transctions will upgrade the inner activity to the -%%% same kind as the outer, we cannot use the check the result in the -%%% above simplistic manner. Therefore we will not mix transaction -%%% with async_dirty (or any of the other transaction-like -%%% activities). A rather extensive rewrite of the query extraction -%%% code must be done first. - -ifr_transaction_read(Fun) -> % read synchronously - Tr = mnesia:transaction(Fun), - {atomic, _} = Tr, - Tr. -ifr_transaction_write(Fun) -> % write synchronously - Tr = mnesia:transaction(Fun), - {atomic, _} = Tr, - Tr. -ifr_transaction_read_write(Fun) -> % write synchronously - Tr = mnesia:transaction(Fun), - {atomic, _} = Tr, - Tr. - -%%%---------------------------------------------------------------------- -%%% Make an object reference from an object - -makeref(Obj) -> - [ObjType, ObjID | _] = tuple_to_list(Obj), - {ObjType, ObjID}. - -%%%---------------------------------------------------------------------- -%%% Make a unique tag. -%%% -%%% The call to term_to_binary is made to hide the representation of the -%%% unique tag. I do this because the tuple generated takes a lot of space -%%% when I dump the database. A binary is simply printed as #Bin, which -%%% is much less obtrusive. - -unique() -> term_to_binary({node(), {erlang:system_time(), - erlang:unique_integer()}}). - -%%%---------------------------------------------------------------------- -%%% Check for an existing object with the Id of the object which is -%%% about to be created. - -existence_check({ObjType, ObjID}, Id) -> - Rep = case ObjType of - ir_Repository -> - {ObjType, ObjID}; - _ -> - orber_ifr_contained:'_get_containing_repository'({ObjType, - ObjID}) - end, - case orber_ifr_repository:lookup_id(Rep, Id) of - [] -> - ok; - What -> - orber:dbg("[~p] orber_ifr_utils:existence_check(~p, ~p, ~p);~n" - "Name clash(?): ~p", - [?LINE, ObjType, ObjID, Id, What], ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}) - end. - -existence_check(Id, Tab, FieldNum) -> - case mnesia:dirty_index_read(Tab, Id, FieldNum) of - [] -> - ok; - What -> - orber:dbg("[~p] orber_ifr_utils:existence_check(~p, ~p, ~p);~n" - "Name clash(?): ~p", - [?LINE, Id, Tab, FieldNum, What], ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}) - end. - -%%====================================================================== -%% Database initialization - -init_DB(Timeout, Options) -> - init_DB(Timeout, Options, false). - -init_DB(Timeout, Options, LightIFR) -> - Func = case Options of - {localCopy, IFR_storage_type} when LightIFR == true -> - ?ifr_light_record_tuple_list_local(IFR_storage_type); - {localCopy, IFR_storage_type} -> - ?ifr_record_tuple_list_local(IFR_storage_type); - _ when LightIFR == true -> - ?ifr_light_record_tuple_list(Options); - _ -> - ?ifr_record_tuple_list(Options) - end, - create_tables(Func), - Wait = wait_for_tables(LightIFR, Timeout), - db_error_check([Wait],"Database table waiting failed."). - -wait_for_tables(true, Timeout) -> - mnesia:wait_for_tables(?ifr_light_object_list, Timeout); -wait_for_tables(_, Timeout) -> - mnesia:wait_for_tables(?ifr_object_list, Timeout). - -db_error_check(Checkval,_Message) -> - case lists:any(fun(X) -> X/= ok end, Checkval) of - true -> - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}); - false -> - ok - end. - -create_tables([{T,F}|Rest]) -> - case F() of - ok -> - create_tables2(Rest); - {aborted,{already_exists,_}} -> - exit({error, "Orber Mnesia Table(s) already exist. Cannot install Orber."}); - Reason -> - orber:dbg("[~p] orber_ifr_utils:create_tables(~p);~n" - "Failed to create the Mnesia table.~n" - "Reason: ~p", [?LINE, T, Reason], ?DEBUG_LEVEL), - exit({error, "Unable to create Mnesia Table"}) - end. - -create_tables2([]) -> - ok; -create_tables2([{T,F}|Rest]) -> - case F() of - ok -> - create_tables2(Rest); - Reason -> - orber:dbg("[~p] orber_ifr_utils:create_tables2(~p);~n" - "Failed to create the Mnesia table.~n" - "Reason: ~p", [?LINE, T, Reason], ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}) - end. - - -%%%---------------------------------------------------------------------- -%%% Create an interface repository. This function should only be called -%%% once, after the database has been set up and initialized. - -create_repository() -> - case orber:light_ifr() of - true -> - #orber_light_ifr_ref{data = #lightdata{scope = "", - id = ""}}; - false -> - _R = fun() -> - Pat = mnesia:table_info(ir_Repository, wild_pattern), - case [X#ir_Repository.ir_Internal_ID || - X <- mnesia:match_object(Pat)] of - [] -> - PrimitiveDefs = create_primitivedefs(), - New = #ir_Repository{ir_Internal_ID = unique(), - def_kind = dk_Repository, - contents = [], - primitivedefs = PrimitiveDefs}, - mnesia:write(New), - {ir_Repository,New#ir_Repository.ir_Internal_ID}; - [Rep_ID] -> - {ir_Repository,Rep_ID}; - Error -> - mnesia:abort(Error) - end - end, - case mnesia:transaction(_R) of - {atomic, RepRef} -> - RepRef; - {aborted, Error} -> - orber:dbg("[~p] orber_ifr_utils:create_repository() failed;~n" - "Reason: ~p", [?LINE, Error], ?DEBUG_LEVEL), - corba:raise(#'INTF_REPOS'{completion_status=?COMPLETED_NO}) - end - end. - -create_primitivedefs() -> - lists:map(fun(Pk) -> - orber_ifr_repository:create_primitivedef(Pk, false) - end, - [pk_void,pk_short,pk_long,pk_longlong,pk_ulonglong,pk_ushort,pk_ulong, - pk_float,pk_double,pk_boolean,pk_char,pk_wchar,pk_octet,pk_any, - pk_TypeCode,pk_Principal,pk_string,pk_wstring,pk_objref]). - - diff --git a/lib/orber/src/orber_ifr_wstringdef.erl b/lib/orber/src/orber_ifr_wstringdef.erl deleted file mode 100644 index 2ff7d84c7a..0000000000 --- a/lib/orber/src/orber_ifr_wstringdef.erl +++ /dev/null @@ -1,73 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_ifr_wstringdef.erl -%% Description : -%% -%%---------------------------------------------------------------------- --module(orber_ifr_wstringdef). - --export(['_get_def_kind'/1, - destroy/1, - cleanup_for_destroy/1, %not in CORBA 2.0 - '_get_type'/1, - '_get_bound'/1, - '_set_bound'/2]). - --import(orber_ifr_utils, [get_field/2, - set_field/3]). - --include("orber_ifr.hrl"). - -%%%====================================================================== -%%% WstringDef (IDLType(IRObject)) - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IRObject - -'_get_def_kind'({ObjType,ObjID}) ?tcheck(ir_WstringDef, ObjType) -> - orber_ifr_irobject:'_get_def_kind'({ObjType,ObjID}). - -destroy({ObjType, ObjID}) ?tcheck(ir_WstringDef, ObjType) -> - F = fun() -> ObjList = cleanup_for_destroy({ObjType, ObjID}), - orber_ifr_irobject:destroy([{ObjType,ObjID} | ObjList]) - end, - orber_ifr_utils:ifr_transaction_write(F). - -cleanup_for_destroy({ObjType,ObjID}) ?tcheck(ir_WstringDef, ObjType) -> - orber_ifr_idltype:cleanup_for_destroy({ObjType,ObjID}). - -%%%---------------------------------------------------------------------- -%%% Interfaces inherited from IDLType - -'_get_type'({ObjType, ObjID}) ?tcheck(ir_WstringDef, ObjType) -> - orber_ifr_idltype:'_get_type'({ObjType, ObjID}). - -%%%---------------------------------------------------------------------- -%%% Non-inherited interfaces - -'_get_bound'({ObjType, ObjID}) ?tcheck(ir_WstringDef, ObjType) -> - get_field({ObjType,ObjID},bound). - -'_set_bound'({ObjType, ObjID}, EO_Value) - ?tcheck(ir_WstringDef, ObjType) -> - set_field({ObjType, ObjID}, bound, EO_Value). diff --git a/lib/orber/src/orber_iiop.erl b/lib/orber/src/orber_iiop.erl deleted file mode 100644 index 8cb39c7365..0000000000 --- a/lib/orber/src/orber_iiop.erl +++ /dev/null @@ -1,551 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: orber_iiop.erl -%% Description: -%% This file contains the interface to the iiop operations -%% -%%----------------------------------------------------------------- --module(orber_iiop). - --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). - --behaviour(supervisor). -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([start_sup/1, request/8, locate/4]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([init/1, terminate/2, handle_call/3]). - -%%----------------------------------------------------------------- -%% Internal defines -%%----------------------------------------------------------------- --define(DEBUG_LEVEL, 7). - - -%%----------------------------------------------------------------- -%% External interface functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: start_sup/1 -%%----------------------------------------------------------------- -start_sup(Opts) -> - supervisor:start_link({local, orber_iiop_sup}, ?MODULE, - {orber_iiop_sup, Opts}). - -%%%----------------------------------------------------------------- -%%% Func: connect/1 -%%%----------------------------------------------------------------- -%connect(OrbName) -> -% orber_iiop_net:connect(OrbName). - -%%%----------------------------------------------------------------- -%%% Func: request/5 -%%%----------------------------------------------------------------- -request({Host, Port, InitObjkey, Index, TaggedProfile, HostData}, - Op, Parameters, TypeCodes, ResponseExpected, Timeout, IOR, UserCtx) -> - {{Proxy, SysCtx, Interceptors, LocalInterface}, ObjKey, Version} = - connect(Host, Port, InitObjkey, Timeout, [Index], HostData, - TaggedProfile, IOR, UserCtx), - Ctx = add_user_context(SysCtx, UserCtx), - RequestId = orber_request_number:get(), - Env = #giop_env{interceptors = Interceptors, type = out, - flags = orber_env:get_flags(), host = LocalInterface, - version = Version, ctx = Ctx, request_id = RequestId, op = Op, - parameters = Parameters, tc = TypeCodes, objkey = ObjKey, - response_expected = ResponseExpected}, - Message = encode_request(Env), - case catch orber_iiop_outproxy:request(Proxy, ResponseExpected, Timeout, - Message, RequestId) of - {'EXCEPTION', MsgExc} -> - corba:raise(MsgExc); - _ when ResponseExpected == false -> - ok; - {reply, ReplyHeader, Rest, Len, ByteOrder, Bytes} -> - case catch decode_reply_body(Interceptors, ObjKey, Op, ReplyHeader, - Version, TypeCodes, Rest, Len, ByteOrder, - Bytes) of - {'EXCEPTION', DecodeException} -> - %% We cannot log this exception since it may be a correct exception. - corba:raise(DecodeException); - {'EXIT', message_error} -> - orber:dbg("[~p] orber_iiop:request(reply, ~p, ~p, ~p)~n" - "Got exit(message_error)", - [?LINE, Rest, Version, TypeCodes], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}); - {'EXIT', Why} -> - orber:dbg("[~p] orber_iiop:request(reply, ~p, ~p, ~p)~n" - "Got exit(~p)", - [?LINE, Rest, Version, TypeCodes, Why], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}); - 'message_error' -> - orber:dbg("[~p] orber_iiop:request(reply, ~p, ~p, ~p);~n" - "Got message_error", - [?LINE, Rest, Version, TypeCodes], ?DEBUG_LEVEL), - %% Perhaps a resend should be done when a message error occurs - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}); - {Result, Par} -> - %% Check request id - case ReplyHeader#reply_header.reply_status of - 'no_exception' -> - case Par of - [] -> - Result; - _ -> - list_to_tuple([Result | Par]) - end; - 'system_exception' -> - corba:raise(Result); - 'user_exception' -> - corba:raise(Result); - 'location_forward' -> - case get(orber_forward_notify) of - true -> - {location_forward, Result}; - _ -> - case catch corba:call(Result, Op, Parameters, - TypeCodes, - [{timeout, Timeout}, - {context, UserCtx}]) of - {'EXCEPTION', E} -> - corba:raise(E); - {'EXIT', Reason} -> - orber:dbg("[~p] orber_iiop:request(reply, ~p, ~p, ~p)~n" - "location_forward resulted in exit(~p)", - [?LINE, Rest, Version, TypeCodes, Reason], ?DEBUG_LEVEL), - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO}); - NewResult -> - NewResult - end - end; - 'location_forward_perm' -> - %% We should notify the client in this case. - case get(orber_forward_notify) of - true -> - {location_forward, Result}; - _ -> - case catch corba:call(Result, Op, Parameters, - TypeCodes, - [{timeout, Timeout}, - {context, UserCtx}]) of - {'EXCEPTION', E} -> - corba:raise(E); - {'EXIT', Reason} -> - orber:dbg("[~p] orber_iiop:request(reply, ~p, ~p, ~p)~n" - "location_forward_perm resulted in exit(~p)", - [?LINE, Rest, Version, TypeCodes, Reason], ?DEBUG_LEVEL), - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO}); - NewResult -> - NewResult - end - end; - 'needs_addressing_mode' -> - orber:dbg("[~p] orber_iiop:request(reply, ~p, ~p, ~p)~n" - "needs_addressing_mode not supported.", - [?LINE, Rest, Version, TypeCodes], ?DEBUG_LEVEL), - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO}) - end - end; - What -> - orber:dbg("[~p] orber_iiop:request(reply, ~p, ~p, ~p)~n" - "outproxy-request: ~p", [?LINE, Message, Version, TypeCodes, What], ?DEBUG_LEVEL), - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO}) - end. - --dialyzer({no_improper_lists, encode_request/1}). -encode_request(#giop_env{interceptors = false} = Env) -> - case catch cdr_encode:enc_request(Env) of - {'EXCEPTION', Exc} -> - orber:dbg("[~p] orber_iiop:request(~p)~n" - "Got exception(~p)", - [?LINE, Env, Exc], ?DEBUG_LEVEL), - corba:raise(Exc); - {'EXIT', R} -> - orber:dbg("[~p] orber_iiop:request:( ~p )~n" - "Got exit(~p)", - [?LINE, Env, R], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_NO}); - Msg -> - Msg - end; -encode_request(#giop_env{interceptors = {native, Ref, PIs}, - objkey = ObjKey, ctx = Ctx, op = Op, - parameters = Params} = Env) -> - Parameters = orber_pi:out_request(PIs, ObjKey, Ctx, Op, Ref, Params), - case catch cdr_encode:enc_request_split(Env) of - {'EXCEPTION', Exc} -> - orber:dbg("[~p] orber_iiop:request( ~p, ~p); exception(~p)", - [?LINE, Env, Parameters, Exc], ?DEBUG_LEVEL), - corba:raise(Exc); - {'EXIT', R} -> - orber:dbg("[~p] orber_iiop:request:( ~p, ~p); got exit(~p)", - [?LINE, Env, Parameters, R], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_NO}); - {Hdr, Body, HdrLen, _, Flags} -> - NewBody = orber_pi:out_request_enc(PIs, ObjKey, Ctx, Op, Ref, Body), - cdr_encode:enc_giop_message_header(Env, 'request', Flags, - HdrLen+size(NewBody), - [Hdr|NewBody]) - end; -encode_request(Env) -> - case catch cdr_encode:enc_request(Env) of - {'EXCEPTION', Exc} -> - orber:dbg("[~p] orber_iiop:request( ~p ); exception(~p)", - [?LINE, Env, Exc], ?DEBUG_LEVEL), - corba:raise(Exc); - {'EXIT', R} -> - orber:dbg("[~p] orber_iiop:request:( ~p ); got exit(~p)", - [?LINE, Env, R], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_NO}); - Msg -> - Msg - end. - -%%----------------------------------------------------------------- -%% Func: locate/1 -%%----------------------------------------------------------------- -locate({Host, Port, InitObjkey, Index, TaggedProfile, HostData}, - Timeout, IOR, UserCtx) -> - {{Proxy, _Ctx, _Interceptors, LocalInterface}, ObjKey, Version} = - connect(Host, Port, InitObjkey, Timeout, [Index], HostData, - TaggedProfile, IOR, UserCtx), - RequestId = orber_request_number:get(), - Env = #giop_env{version = Version, objkey = ObjKey, request_id = RequestId, - flags = orber_env:get_flags(), host = LocalInterface}, - Result = - case catch cdr_encode:enc_locate_request(Env) of - {'EXCEPTION', EncE} -> - orber:dbg("[~p] orber_iiop:locate(~p); exception(~p)", - [?LINE, ObjKey, EncE], ?DEBUG_LEVEL), - corba:raise(EncE); - {'EXIT', EncR} -> - orber:dbg("[~p] orber_iiop:locate(~p); exit(~p)", - [?LINE, ObjKey, EncR], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_NO}); - Request -> - (catch orber_iiop_outproxy:request(Proxy, true, Timeout, - Request, RequestId)) - end, - case Result of - {'EXCEPTION', MsgExc} -> - corba:raise(MsgExc); - {locate_reply, ReplyHeader, Rest, Len, ByteOrder} -> - case catch cdr_decode:dec_locate_reply_body(Version, - ReplyHeader#locate_reply_header.locate_status, - Rest, Len, ByteOrder) of - {'EXCEPTION', DecodeException} -> - orber:dbg("[~p] orber_iiop:locate(locate_reply, ~p, ~p); exception(~p)", - [?LINE, Rest, Version, DecodeException], ?DEBUG_LEVEL), - corba:raise(DecodeException); - {'EXIT', message_error} -> - orber:dbg("[~p] orber_iiop:locate(locate_reply, ~p, ~p); exit(message_error)", - [?LINE, Rest, Version], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}); - {'EXIT', R} -> - orber:dbg("[~p] orber_iiop:locate(locate_reply, ~p, ~p); exit(~p)", - [?LINE, Rest, Version, R], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}); - [] -> - ReplyHeader#locate_reply_header.locate_status; - ObjRef -> - {ReplyHeader#locate_reply_header.locate_status, ObjRef} - end; - Other -> - orber:dbg("[~p] orber_iiop:locate(~p); exit(~p)", - [?LINE, ObjKey, Other], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_NO}) - end. - -%%%----------------------------------------------------------------- -%%% Func: cancel/1 -%%%----------------------------------------------------------------- -%cancel(X) -> -% ok. - -%%%----------------------------------------------------------------- -%%% Func: message_error/1 -%%%----------------------------------------------------------------- -%message_error(X) -> -% ok. - -%%----------------------------------------------------------------- -%% Server functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: init/1 -%%----------------------------------------------------------------- -init({orber_iiop_sup, Opts}) -> - IIOP_port = orber:iiop_port(), - SSL_port = orber:iiop_ssl_port(), - SupFlags = {one_for_one, 5, 1000}, %Max 5 restarts in 1 second - PortList = if - SSL_port > -1 -> - [{port, ssl, SSL_port}]; - true -> - [] - end, - ChildSpec = - case orber:is_lightweight() of - true -> - [ - {orber_iiop_outsup, {orber_iiop_outsup, start, - [sup, Opts]}, - permanent, 10000, supervisor, [orber_iiop_outsup]}, - {orber_iiop_pm, {orber_iiop_pm, start, - [Opts]}, - permanent, 10000, worker, [orber_iiop_pm]} - ]; - false -> - [{orber_iiop_outsup, {orber_iiop_outsup, start, - [sup, Opts]}, - permanent, 10000, supervisor, [orber_iiop_outsup]}, - {orber_iiop_pm, {orber_iiop_pm, start, - [Opts]}, - permanent, 10000, worker, [orber_iiop_pm]}, - {orber_iiop_insup, {orber_iiop_insup, start, - [sup, Opts]}, - permanent, 10000, supervisor, [orber_iiop_insup]}, - {orber_iiop_socketsup, {orber_iiop_socketsup, start, - [sup, Opts]}, - permanent, 10000, supervisor, [orber_iiop_socketsup]}, - {orber_iiop_net, {orber_iiop_net, start, - [[{port, normal, IIOP_port} | PortList]]}, - permanent, 10000, worker, [orber_iiop_net]}] - end, - {ok, {SupFlags, ChildSpec}}. - - - - - -%%----------------------------------------------------------------- -%% Func: terminate/2 -%%----------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------------- -%% Func: handle_call/3 -%%----------------------------------------------------------------- -handle_call(_Req, _From, State) -> - {reply, ok, State}. - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- -add_user_context([], UserCtx) -> UserCtx; -add_user_context(SysCtx, []) -> SysCtx; -add_user_context(SysCtx, UserCtx) -> SysCtx ++ UserCtx. - -decode_reply_body(false, _ObjKey, _Op, ReplyHeader, Version, TypeCodes, - Rest, Len, ByteOrder, Bytes) -> - case ReplyHeader#reply_header.reply_status of - 'no_exception' -> - {R, P, _} = cdr_decode:dec_reply_body(Version, TypeCodes, Rest, Len, ByteOrder, Bytes), - {R, P}; - 'system_exception' -> - {R, _} = cdr_decode:dec_system_exception(Version, Rest, Len, ByteOrder), - {R, []}; - 'user_exception' -> - {R, _} = cdr_decode:dec_user_exception(Version, Rest, Len, ByteOrder), - {R, []}; - 'location_forward' -> - {R, _, _} = cdr_decode:dec_reply_body(Version, {{'tk_objref', "", ""}, [],[]}, - Rest, Len, ByteOrder, Bytes), - {R, []}; - 'location_forward_perm' -> - {R, _, _} = cdr_decode:dec_reply_body(Version, {{'tk_objref', "", ""}, [],[]}, - Rest, Len, ByteOrder, Bytes), - {R, []}; - 'needs_addressing_mode' -> - {R, _, _} = cdr_decode:dec_reply_body(Version, {'tk_short', [],[]}, - Rest, Len, ByteOrder, Bytes), - {R, []} - end; -decode_reply_body(Interceptors, ObjKey, Op, ReplyHeader, Version, TypeCodes, - RestIn, Len, ByteOrder, Bytes) -> - Rest = - case Interceptors of - {portable, _PIs} -> - RestIn; - {native, Ref, PIs} -> - orber_pi:in_reply_enc(PIs, ObjKey, - ReplyHeader#reply_header.service_context, - Op, Ref, RestIn) - end, - Reply = - case ReplyHeader#reply_header.reply_status of - 'no_exception' -> - {R, P, _} = cdr_decode:dec_reply_body(Version, TypeCodes, Rest, Len, ByteOrder, Bytes), - {R, P}; - 'system_exception' -> - {R, _} = cdr_decode:dec_system_exception(Version, Rest, Len, ByteOrder), - {R, []}; - 'user_exception' -> - {R, _} = cdr_decode:dec_user_exception(Version, Rest, Len, ByteOrder), - {R, []}; - 'location_forward' -> - {R, _, _} = cdr_decode:dec_reply_body(Version, {{'tk_objref', "", ""}, [],[]}, - Rest, Len, ByteOrder, Bytes), - {R, []}; - 'location_forward_perm' -> - {R, _, _} = cdr_decode:dec_reply_body(Version, {{'tk_objref', "", ""}, [],[]}, - Rest, Len, ByteOrder, Bytes), - {R, []}; - 'needs_addressing_mode' -> - {R, _, _} = cdr_decode:dec_reply_body(Version, {'tk_short', [],[]}, - Rest, Len, ByteOrder, Bytes), - {R, []} - end, - case Interceptors of - {portable, _PI} -> - Reply; - {native, Refs, PI} -> - orber_pi:in_reply(PI, ObjKey, - ReplyHeader#reply_header.service_context, - Op, Refs, Reply) - end. - -%% "Plain" TCP/IP. -connect(Host, Port, Objkey, Timeout, Index, - #host_data{protocol = normal, csiv2_mech = undefined} = HostData, - TaggedProfile, IOR, Ctx) -> - connect2([{Host, Port}], Objkey, Timeout, Index, HostData, - TaggedProfile, IOR, Ctx); -%% "Plain" SSL -connect(Host, _, Objkey, Timeout, Index, - #host_data{protocol = ssl, - ssl_data = #'SSLIOP_SSL'{port = Port}, - csiv2_mech = undefined} = HostData, - TaggedProfile, IOR, Ctx) -> - connect2([{Host, Port}], Objkey, Timeout, Index, HostData, - TaggedProfile, IOR, Ctx); -%% TEMPORARY FIX TO AVOID RUNNING CSIv2. -connect(Host, _, Objkey, Timeout, Index, - #host_data{protocol = ssl, - ssl_data = #'SSLIOP_SSL'{port = Port}} = HostData, - TaggedProfile, IOR, Ctx) -> - connect2([{Host, Port}], Objkey, Timeout, Index, HostData, - TaggedProfile, IOR, Ctx); -%% CSIv2 over SSL (TAG_TLS_SEC_TRANS) using the SAS protocol. Note port must equal 0. -connect(_Host, 0, Objkey, Timeout, Index, - #host_data{protocol = ssl, - csiv2_mech = - #'CSIIOP_CompoundSecMech'{target_requires = _TR} = _Mech, - csiv2_addresses = Addresses} = HostData, - TaggedProfile, IOR, Ctx) -> - NewCtx = [#'IOP_ServiceContext' - {context_id=?IOP_SecurityAttributeService, - context_data = #'CSI_SASContextBody' - {label = ?CSI_MsgType_MTEstablishContext, - value = #'CSI_EstablishContext' - {client_context_id = 0, %% Always 0 when stateless. - authorization_token = - [#'CSI_AuthorizationElement'{the_element = []}], - identity_token = - #'CSI_IdentityToken'{label = ?CSI_IdentityTokenType_ITTAbsent, - value = true}, - client_authentication_token = []}}}|Ctx], - connect2(Addresses, Objkey, Timeout, Index, HostData, - TaggedProfile, IOR, NewCtx); -%% CSIv2 over SSL (TAG_NULL_TAG) using the SAS protocol. -connect(Host, _, Objkey, Timeout, Index, - #host_data{protocol = ssl, - ssl_data = #'SSLIOP_SSL'{port = Port}, - csiv2_mech = Mech} = HostData, - TaggedProfile, IOR, Ctx) when is_record(Mech, 'CSIIOP_CompoundSecMech') -> - connect2([{Host, Port}], Objkey, Timeout, Index, HostData, - TaggedProfile, IOR, Ctx); -%% CSIv2 over TCP (TAG_NULL_TAG) using the SAS protocol. -connect(Host, Port, Objkey, Timeout, Index, - #host_data{protocol = normal, - csiv2_mech = Mech} = HostData, - TaggedProfile, IOR, Ctx) when is_record(Mech, 'CSIIOP_CompoundSecMech') -> - connect2([{Host, Port}], Objkey, Timeout, Index, HostData, - TaggedProfile, IOR, Ctx); -connect(_Host, _Port, _Objkey, _Timeout, _Index, HostData, _TaggedProfile, - IOR, _Ctx) -> - orber:dbg("[~p] orber_iiop:connect(~p)~n" - "Unable to use the supplied IOR.~n" - "Connection Data: ~p", [?LINE, IOR, HostData], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}). - - - -connect2(HostPort, Objkey, Timeout, Index, HostData, TaggedProfile, IOR, Ctx) -> - case try_connect(HostPort, HostData#host_data.protocol, Timeout, HostData, Ctx) of - error -> - Alts = iop_ior:get_alt_addr(TaggedProfile), - case try_connect(Alts, HostData#host_data.protocol, Timeout, HostData, Ctx) of - error -> - case iop_ior:get_key(IOR, Index) of - undefined -> - corba:raise(#'COMM_FAILURE'{completion_status = ?COMPLETED_NO}); - {'external', {NewHost, NewPort, NewObjkey, NewIndex, - NewTaggedProfile, NewHostData}} -> - connect(NewHost, NewPort, NewObjkey, Timeout, [NewIndex|Index], - NewHostData, NewTaggedProfile, IOR, Ctx); - _What -> - orber:dbg("[~p] orber_iiop:connect2(~p)~n" - "Illegal IOR; contains a mixture of local and external profiles.", - [?LINE, IOR], ?DEBUG_LEVEL), - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}) - end; - X -> - {X, Objkey, HostData#host_data.version} - end; - X -> - {X, Objkey, HostData#host_data.version} - end. - -try_connect([], _, _, _, _) -> - error; -try_connect([{Host, Port}|T], SocketType, Timeout, HostData, Ctx) -> - case catch orber_iiop_pm:connect(Host, Port, SocketType, Timeout, - HostData#host_data.charset, - HostData#host_data.wcharset, Ctx) of - {ok, P, Ctx2, Int, Interface} -> - {P, Ctx2, Int, Interface}; - {'EXCEPTION', #'BAD_CONTEXT'{} = CtxExc} -> - orber:dbg("[~p] orber_iiop:try_connect(~p, ~p) failed~n", - [?LINE, Host, Port], ?DEBUG_LEVEL), - corba:raise(CtxExc); - {'EXCEPTION', _PMExc} -> - try_connect(T, SocketType, Timeout, HostData, Ctx); - {'EXIT',{timeout,_}} -> - orber:dbg("[~p] orber_iiop:try_connect(~p, ~p, ~p)~n" - "Connect attempt timed out", - [?LINE, Host, Port, Timeout], ?DEBUG_LEVEL), - try_connect(T, SocketType, Timeout, HostData, Ctx); - {'EXIT', What} -> - orber:dbg("[~p] orber_iiop:try_connect(~p, ~p, ~p)~n" - "Connect attempt resulted in: ~p", - [?LINE, Host, Port, Timeout, What], ?DEBUG_LEVEL), - try_connect(T, SocketType, Timeout, HostData, Ctx) - end. - diff --git a/lib/orber/src/orber_iiop.hrl b/lib/orber/src/orber_iiop.hrl deleted file mode 100644 index ec502b6f09..0000000000 --- a/lib/orber/src/orber_iiop.hrl +++ /dev/null @@ -1,1016 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2017. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File: orber_iiop.hrl -%% -%%---------------------------------------------------------------------- --ifndef(orber_iiop_hrl). --define(orber_iiop_hrl, true). - --include_lib("orber/include/corba.hrl"). - -%% The identifiers which indicates if a fixed value has a negative or -%% positive scale. --define(FIXED_NEGATIVE, 13). --define(FIXED_POSITIVE, 12). - -%% Used instead of IFR-id's in TypeCode definitions for internal data types. --define(SYSTEM_TYPE, 0). - -%% Major version of GIOP protocol which are supported --define(GIOP_MAJOR, 1). - -%% Minor version of GIOP protocol which are supported --define(GIOP_MINOR, 0). - -%% Major version of IIOP protocol which are supported --define(IIOP_MAJOR, 1). - -%% Minor version of IIOP protocol which are supported --define(IIOP_MINOR, 0). - -%% Fragment flags for the flags bitfield in GIOP message headers --define(GIOP_BYTE_ORDER_MSB, 0). --define(GIOP_BYTE_ORDER_LSB, 1). - -%% Fragment flags for the flags bitfield in GIOP message headers --define(GIOP_MORE_FRAGMENTS_FALSE, 0). --define(GIOP_MORE_FRAGMENTS_TRUE, 1). - -%% GIOP Message Types --define(GIOP_MSG_REQUEST, 0). --define(GIOP_MSG_REPLY, 1). --define(GIOP_MSG_CANCEL_REQUEST, 2). --define(GIOP_MSG_LOCATE_REQUEST, 3). --define(GIOP_MSG_LOCATE_REPLY, 4). --define(GIOP_MSG_CLOSE_CONNECTION, 5). --define(GIOP_MSG_MESSAGE_ERROR, 6). --define(GIOP_MSG_FRAGMENT, 7). - -%% PROFILE_ID's --define(TAG_INTERNET_IOP, 0). --define(TAG_MULTIPLE_COMPONENTS, 1). --define(TAG_SCCP_IOP, 2). - - -%% COMPONENT_ID's --define(TAG_ORB_TYPE, 0). --define(TAG_CODE_SETS, 1). --define(TAG_POLICIES, 2). --define(TAG_ALTERNATE_IIOP_ADDRESS, 3). --define(TAG_COMPLETE_OBJECT_KEY, 5). --define(TAG_ENDPOINT_ID_POSITION, 6). --define(TAG_LOCATION_POLICY, 12). --define(TAG_ASSOCIATION_OPTIONS, 13). --define(TAG_SEC_NAME, 14). --define(TAG_SPKM_1_SEC_MECH, 15). --define(TAG_SPKM_2_SEC_MECH, 16). --define(TAG_KerberosV5_SEC_MECH, 17). --define(TAG_CSI_ECMA_Secret_SEC_MECH, 18). --define(TAG_CSI_ECMA_Hybrid_SEC_MECH, 19). --define(TAG_SSL_SEC_TRANS, 20). --define(TAG_CSI_ECMA_Public_SEC_MECH, 21). --define(TAG_GENERIC_SEC_MECH, 22). --define(TAG_FIREWALL_TRANS, 23). --define(TAG_SCCP_CONTACT_INFO, 24). --define(TAG_JAVA_CODEBASE, 25). --define(TAG_TRANSACTION_POLICY, 26). --define(TAG_FT_GROUP, 27). --define(TAG_FT_PRIMARY, 28). --define(TAG_FT_HEARTBEAT_ENABLED, 29). --define(TAG_MESSAGE_ROUTERS, 30). --define(TAG_OTS_POLICY, 31). --define(TAG_INV_POLICY, 32). --define(TAG_CSI_SEC_MECH_LIST, 33). --define(TAG_NULL_TAG, 34). --define(TAG_SECIOP_SEC_TRANS, 35). --define(TAG_TLS_SEC_TRANS, 36). --define(TAG_DCE_STRING_BINDING, 100). --define(TAG_DCE_BINDING_NAME, 101). --define(TAG_DCE_NO_PIPES, 102). --define(TAG_DCE_SEC_MECH, 103). --define(TAG_INET_SEC_TRANS, 123). - -%% COMPONENT_ID strings --define(TAG_ORB_TYPE_STR, "TAG_ORB_TYPE"). --define(TAG_CODE_SETS_STR, "TAG_CODE_SETS"). --define(TAG_POLICIES_STR, "TAG_POLICIES"). --define(TAG_ALTERNATE_IIOP_ADDRESS_STR, "TAG_ALTERNATE_IIOP_ADDRESS"). --define(TAG_COMPLETE_OBJECT_KEY_STR, "TAG_COMPLETE_OBJECT_KEY"). --define(TAG_ENDPOINT_ID_POSITION_STR, "TAG_ENDPOINT_ID_POSITION"). --define(TAG_LOCATION_POLICY_STR, "TAG_LOCATION_POLICY"). --define(TAG_ASSOCIATION_OPTIONS_STR, "TAG_ASSOCIATION_OPTIONS"). --define(TAG_SEC_NAME_STR, "TAG_SEC_NAME"). --define(TAG_SPKM_1_SEC_MECH_STR, "TAG_SPKM_1_SEC_MECH"). --define(TAG_SPKM_2_SEC_MECH_STR, "TAG_SPKM_2_SEC_MECH"). --define(TAG_KerberosV5_SEC_MECH_STR, "TAG_KerberosV5_SEC_MECH"). --define(TAG_CSI_ECMA_Secret_SEC_MECH_STR, "TAG_CSI_ECMA_Secret_SEC_MECH"). --define(TAG_CSI_ECMA_Hybrid_SEC_MECH_STR, "TAG_CSI_ECMA_Hybrid_SEC_MECH"). --define(TAG_SSL_SEC_TRANS_STR, "TAG_SSL_SEC_TRANS"). --define(TAG_CSI_ECMA_Public_SEC_MECH_STR, "(TAG_CSI_ECMA_Public_SEC_MECH"). --define(TAG_GENERIC_SEC_MECH_STR, "TAG_GENERIC_SEC_MECH"). --define(TAG_FIREWALL_TRANS_STR, "TAG_FIREWALL_TRANS"). --define(TAG_SCCP_CONTACT_INFO_STR, "TAG_SCCP_CONTACT_INFO"). --define(TAG_JAVA_CODEBASE_STR, "TAG_JAVA_CODEBASE"). --define(TAG_TRANSACTION_POLICY_STR, "TAG_TRANSACTION_POLICY"). --define(TAG_FT_GROUP_STR, "TAG_FT_GROUP"). --define(TAG_FT_PRIMARY_STR, "TAG_FT_PRIMARY"). --define(TAG_FT_HEARTBEAT_ENABLED_STR, "TAG_FT_HEARTBEAT_ENABLED"). --define(TAG_MESSAGE_ROUTERS_STR, "TAG_MESSAGE_ROUTERS"). --define(TAG_OTS_POLICY_STR, "TAG_OTS_POLICY"). --define(TAG_INV_POLICY_STR, "TAG_INV_POLICY"). --define(TAG_CSI_SEC_MECH_LIST_STR, "TAG_CSI_SEC_MECH_LIST"). --define(TAG_NULL_TAG_STR, "TAG_NULL_TAG"). --define(TAG_SECIOP_SEC_TRANS_STR, "TAG_SECIOP_SEC_TRANS"). --define(TAG_TLS_SEC_TRANS_STR, "TAG_TLS_SEC_TRANS"). --define(TAG_DCE_STRING_BINDING_STR, "TAG_DCE_STRING_BINDING"). --define(TAG_DCE_BINDING_NAME_STR, "TAG_DCE_BINDING_NAME"). --define(TAG_DCE_NO_PIPES_STR, "TAG_DCE_NO_PIPES"). --define(TAG_DCE_SEC_MECH_STR, "TAG_DCE_SEC_MECH"). --define(TAG_INET_SEC_TRANS_STR, "TAG_INET_SEC_TRANS"). - -%% GIOP header size --define(GIOP_HEADER_SIZE, 12). - -%% CODESET's we support. -%% Latin-1. This CodeSet is default if no information exists in the IOR. --define(ISO8859_1_ID, 16#00010001). - -%% UTF-16, UCS Transformation Format 16-bit form --define(UTF_16_ID, 16#00010109). - -%% X/Open UTF-8; UCS Transformation Format 8 (UTF-8) --define(UTF_8_ID, 16#05010001). - -%% The limited UTF-16 without the surrogate mechanism is called UCS-2. -%% The two-byte subset which is identical with the original Unicode. -%% UCS-2, Level 1. Used by JDK-1.3 as native wchar. --define(UCS_2_ID, 16#00010100). - -%% ISO 646:1991 IRV (International Reference Version). -%% Used by JavaIDL as Native Char (JDK-1.3). A.k.a PCS. --define(ISO646_IRV_ID, 16#00010020). - -%% Fallback is *not* the same thing as default!! --define(FALLBACK_CHAR, 16#05010001). --define(FALLBACK_WCHAR, 16#00010109). - -%% This is used when the wchar codeset is unknown. --define(UNSUPPORTED_WCHAR, 0). - -%% Integer limits --define(SHORTMIN, -32768). --define(SHORTMAX, 32767). --define(USHORTMIN, 0). --define(USHORTMAX, 65535). --define(LONGMIN, -2147483648). --define(LONGMAX, 2147483647). --define(ULONGMIN, 0). --define(ULONGMAX, 4294967295). --define(LONGLONGMIN, -9223372036854775808). --define(LONGLONGMAX, 9223372036854775807). --define(ULONGLONGMIN, 0). --define(ULONGLONGMAX, 18446744073709551615). - - --define(ORBER_GENERIC_CTX, {'tk_sequence', 'tk_octet', 0}). - - -%%---------------------------------------------------------------------- -%% GIOP Message Header -%% -%% magic: identifies the GIOP message headers, array of four characters. -%% giop_version: contains the version number of the giop protocol being -%% used in the message. -%% byte_order: indicating the byte order being used in subsequent -%% elements of the message. -%% 0 - big-endian byte ordering, 1 - little-endian byte ordering -%% fragments: true if more fragments follow, otherwise false. -%% message_type: indicating the type of the message -%% message_size: gives the length of the message following the message -%% headerin octets. -%%---------------------------------------------------------------------- --record(giop_message, {magic, - giop_version, - byte_order, - fragments = false, - message_type, - message_size, - message}). - - - -%%---------------------------------------------------------------------- -%% Request Message Header -%% -%% service_context: contains ORB service data being passed from client to server. -%% (IOP::ServiceContextList) -%% request_id: id used to assosciate reply messages with request messages. -%% response_expected: true if the request is expected to have a reply message. -%% object_key: identifies the object wich is the target of the invocation. -%% operation: contains the name of the operation being invoked. -%% requesting_principal: contains a value that identifying the requesting -%% principal. -%%---------------------------------------------------------------------- --record(request_header, {service_context, request_id, response_expected, object_key, operation, requesting_principal}). - - - -%%---------------------------------------------------------------------- -%% Reply Message Header -%% -%% service_context: contains ORB service data being passed from client to server. -%% (IOP::ServiceContextList) -%% request_id: id used to assosciate reply messages with request messages. -%% reply_status: indicates the completion status of the request -%%---------------------------------------------------------------------- --record(reply_header, {service_context, request_id, reply_status}). - - - -%%---------------------------------------------------------------------- -%% Cancel Request Message Header -%% -%% request_id: id used to assosciate reply messages with request messages. -%%---------------------------------------------------------------------- --record(cancel_request_header, {request_id}). - - - -%%---------------------------------------------------------------------- -%% Locate Request Message Header -%% -%% request_id: id used to assosciate reply messages with request messages. -%% object_key: identifies the object being located (octet sequence). -%%---------------------------------------------------------------------- --record(locate_request_header, {request_id, object_key}). - - - -%%---------------------------------------------------------------------- -%% Locate Reply Message Header -%% -%% request_id: id used to assosciate reply messages with request messages. -%% locate_status: indicates the completion status of the locate request -%%---------------------------------------------------------------------- --record(locate_reply_header, {request_id, locate_status}). - - - -%%---------------------------------------------------------------------- -%% Profile Body -%% -%% iiop_version: describes the version of IIOP that the agent at the -%% specified address is prepared to receive. -%% host: identifies the internet host to which the GIOP messages -%% for the specified object may be sent. -%% port: contains the TCP?IP port number where the target agnet is listening -%% for connection requests. -%% object_key: is an opaque value supplied by the agent producing the IOR. -%%---------------------------------------------------------------------- --record(profile_body, {iiop_version,host,port,object_key}). - -%%---------------------------------------------------------------------- -%% Version -%% -%% major: major version number of iiop protocol -%% minor: minor version number of iiop protocol. -%% -%% When an agnet generates profiles specifying a particular version, -%% it must be able to accept messages complying with the specified -%% version or any porevious minor version. -%%---------------------------------------------------------------------- --record(version, {major,minor}). - -%%---------------------------------------------------------------------- -%% Fragment Message Header -%% -%% request_id: -%%---------------------------------------------------------------------- --record(fragment_header, {request_id}). - - -%%---------------------------------------------------------------------- -%% ORB_FLAGS macros. Used in the local object references {_,_,_,_,_,Flags}. -%% -%%---------------------------------------------------------------------- - -%% Definition of flag positions: --define(ORB_SEC_ATTRIBUTES, 16#01). --define(ORB_CONTEXT, 16#02). --define(ORB_TYPECHECK, 16#04). --define(ORB_NO_SECURITY, 16#08). --define(ORB_SURVIVE_EXIT, 16#10). --define(ORB_USE_PI, 16#20). - --define(ORB_INIT_FLAGS, 16#00). - -%%---------------------------------------------------------------------- -%% Flags used as configuration parameters (application env). -%% -%%---------------------------------------------------------------------- --define(ORB_ENV_EXCLUDE_CODESET_COMPONENT, 16#01). %% FIXED!! --define(ORB_ENV_LOCAL_TYPECHECKING, 16#02). %% FIXED!! --define(ORB_ENV_HOSTNAME_IN_IOR, 16#04). %% FIXED!! --define(ORB_ENV_ENABLE_NAT, 16#08). %% FIXED!! --define(ORB_ENV_PARTIAL_SECURITY, 16#10). %% FIXED FOR NOW!! INTERNAL --define(ORB_ENV_USE_PI, 16#20). %% FIXED!! --define(ORB_ENV_USE_FT, 16#40). %% WILL PROBABLY BE FIXED!! --define(ORB_ENV_LIGHT_IFR, 16#80). %% FIXED!! --define(ORB_ENV_USE_IPV6, 16#100). %% FIXED!! --define(ORB_ENV_SURVIVE_EXIT, 16#200). %% FIXED!! --define(ORB_ENV_USE_ACL_INCOMING, 16#400). %% FIXED!! --define(ORB_ENV_USE_ACL_OUTGOING, 16#800). %% FIXED!! --define(ORB_ENV_LOCAL_INTERFACE, 16#1000). %% FIXED!! - --define(ORB_ENV_USE_BI_DIR_IIOP, 16#2000). %% CAN BE CHANGED --define(ORB_ENV_USE_CSIV2, 16#4000). %% CAN BE CHANGED --define(ORB_ENV_EXCLUDE_CODESET_CTX, 16#8000). %% CAN BE CHANGED - - --define(ORB_ENV_INIT_FLAGS, 16#00). - --define(ORB_ENV_FLAGS, - [{?ORB_ENV_EXCLUDE_CODESET_CTX, "Exclude CodeSet Ctx"}, - {?ORB_ENV_LOCAL_TYPECHECKING, "Local Typechecking"}, - {?ORB_ENV_HOSTNAME_IN_IOR, "Use Hostname in IOR"}, - {?ORB_ENV_EXCLUDE_CODESET_COMPONENT, "Exclude CodeSet Component"}, - {?ORB_ENV_ENABLE_NAT, "NAT Enabled"}, - {?ORB_ENV_USE_CSIV2, "CSIv2 Activated"}, - {?ORB_ENV_USE_FT, "Fault Tolerance Activated"}, - {?ORB_ENV_USE_IPV6, "IPv6 Activated"}, - {?ORB_ENV_SURVIVE_EXIT, "EXIT Tolerance Activated"}, - {?ORB_ENV_USE_PI, "Local Interceptors"}, - {?ORB_ENV_LIGHT_IFR, "Light IFR"}, - {?ORB_ENV_USE_BI_DIR_IIOP, "Use BiDirIIOP"}, - {?ORB_ENV_USE_ACL_INCOMING, "Use ACL for Incoming Connections"}, - {?ORB_ENV_USE_ACL_OUTGOING, "Use ACL for Outgoing Connections"}, - {?ORB_ENV_LOCAL_INTERFACE, "Use the Proxy Interface in Exported IOR:s"}]). - - -%%---------------------------------------------------------------------- -%% Definition of flag operations -%% -%%---------------------------------------------------------------------- -%% USAGE: Boolean = ?ORB_FLAG_TEST(Flags, ?ORB_SEC_ATTRIBUTES) --define(ORB_FLAG_TEST(_F1, _I1), ((_F1 band _I1) == _I1)). - -%% USAGE: NewFlags = ?ORB_SET_TRUE(Flags, ?ORB_CONTEXT) --define(ORB_SET_TRUE(_F2, _I2), (_I2 bor _F2)). - -%% USAGE: NewFlags = ?ORB_SET_FALSE(Flags, ?ORB_CONTEXT) --define(ORB_SET_FALSE(_F3, _I3), ((_I3 bxor 16#ff) band _F3)). - -%% USAGE: NewFlags = ?ORB_SET_FALSE_LIST(Flags, [?ORB_SEC_ATTRIBUTES, ?ORB_SOME]) --define(ORB_SET_FALSE_LIST(_F4, _IList1), - lists:foldl(fun(_I4, _F5) -> - ((_I4 bxor 16#ff) band _F5) - end, - _F4, _IList1)). - -%% USAGE: NewFlags = ?ORB_SET_TRUE_LIST(Flags, [?ORB_SEC_ATTRIBUTES, ?ORB_SOME]) --define(ORB_SET_TRUE_LIST(_F6, _IList2), - lists:foldl(fun(_I6, _F7) -> - (_I6 bor _F7) - end, - _F6, _IList2)). - -%% USAGE: Boolean = ?ORB_FLAG_TEST_LIST(Flags, [?ORB_CONTEXT, ?ORB_THING]) --define(ORB_FLAG_TEST_LIST(_F8, _IList3), - lists:all(fun(_I7) -> - ((_F8 band _I7) == _I7) - end, - _IList3)). - -%%---------------------------------------------------------------------- -%% IOR -%% -%%---------------------------------------------------------------------- --record('IOP_IOR', {type_id, profiles}). --record('IOP_TaggedProfile', {tag, profile_data}). --record('IIOP_ProfileBody_1_0', {iiop_version, - host, - port, - object_key}). --record('IIOP_ProfileBody_1_1', {iiop_version, - host, - port, - object_key, - components}). - --record('GIOP_Version', {major, minor}). - --record('IIOP_Version', {major, minor}). - --record('SSLIOP_SSL', {target_supports, target_requires, port}). - --record('IOP_TaggedComponent', {tag, component_data}). - --record('GIOP_TargetAddress', {label, value}). - --record('GIOP_IORAddressingInfo', {selected_profile_index, ior}). - - -%% -%% Nil object reference -%% --define(ORBER_NIL_OBJREF, #'IOP_IOR' {type_id = "", profiles = []}). - --define(IOR_TYPEDEF, {'tk_struct', ?SYSTEM_TYPE, 'IOP_IOR', - [{"type_id", {'tk_string', 0}}, - {"profiles", {'tk_sequence', {'tk_struct', ?SYSTEM_TYPE, - 'IOP_TaggedProfile', - [{"tag", 'tk_ulong'}, - {"profile_data", - {'tk_sequence', 'tk_octet', 0}}]}, 0}}]}). - --define(GIOP_VERSION, {'tk_struct', ?SYSTEM_TYPE, 'GIOP_Version', - [{"major", 'tk_octet'}, - {"minor", 'tk_octet'}]}). - --define(IIOP_VERSION, {'tk_struct', ?SYSTEM_TYPE, 'IIOP_Version', - [{"major vsn", 'tk_octet'}, - {"minor vsn", 'tk_octet'}]}). --define(IOP_TAGGEDCOMPONENT, {'tk_struct', ?SYSTEM_TYPE, - 'IOP_TaggedComponent', - [{"tag", 'tk_ulong'}, - {"component_data", - {'tk_sequence', - 'tk_octet', 0}}]}). --define(IOP_TAGGEDCOMPONENT_SEQ, {'tk_sequence', ?IOP_TAGGEDCOMPONENT, 0}). - --define(PROFILEBODY_1_0_TYPEDEF, {'tk_struct', ?SYSTEM_TYPE, 'IIOP_ProfileBody_1_0', - [{"iiop_version", ?IIOP_VERSION }, - {"host", {'tk_string', 0}}, - {"port", 'tk_ushort'}, - {"object_key", {'tk_sequence', 'tk_octet', 0}}]}). - --define(PROFILEBODY_1_1_TYPEDEF, {'tk_struct', ?SYSTEM_TYPE, 'IIOP_ProfileBody_1_1', - [{"iiop_version",?IIOP_VERSION }, - {"host", {'tk_string', 0}}, - {"port", 'tk_ushort'}, - {"object_key", {'tk_sequence', 'tk_octet', 0}}, - {"components", ?IOP_TAGGEDCOMPONENT_SEQ}]}). - --define(PROFILEBODY_1_2_TYPEDEF, {'tk_struct', ?SYSTEM_TYPE, 'IIOP_ProfileBody_1_1', - [{"iiop_version",?IIOP_VERSION }, - {"host", {'tk_string', 0}}, - {"port", 'tk_ushort'}, - {"object_key", {'tk_sequence', 'tk_octet', 0}}, - {"components", ?IOP_TAGGEDCOMPONENT_SEQ}]}). - --define(SSLIOP_SSL, {'tk_struct', ?SYSTEM_TYPE, 'SSLIOP_SSL', - [{"target_supports", 'tk_ushort'}, - {"target_requires", 'tk_ushort'}, - {"port", 'tk_ushort'}]}). - --define(GIOP_KeyAddr, 0). --define(GIOP_ProfileAddr, 1). --define(GIOP_ReferenceAddr, 2). - --define(TARGETADDRESS, {'tk_union', ?SYSTEM_TYPE, 'GIOP_TargetAddress', 'tk_short', -1, - [{?GIOP_KeyAddr, "object_key", {'tk_sequence', 'tk_octet', 0}}, - {?GIOP_ProfileAddr, "profile", {'tk_struct', ?SYSTEM_TYPE, - 'IOP_TaggedProfile', - [{"tag", 'tk_ulong'}, - {"profile_data", - {'tk_sequence', 'tk_octet', 0}}]}}, - {?GIOP_ReferenceAddr, "ior", {'tk_struct', ?SYSTEM_TYPE, - 'GIOP_IORAddressingInfo', - [{"selected_profile_index", 'tk_ulong'}, - {"ior", ?IOR_TYPEDEF}]}}]}). - -% Zero or more instances of the TAG_ALTERNATE_IIOP_ADDRESS component type -% may be included in a version 1.2 TAG_INTERNET_IOP Profile. --record('ALTERNATE_IIOP_ADDRESS', {'HostID', 'Port'}). --define(ALTERNATE_IIOP_ADDRESS, {'tk_struct', ?SYSTEM_TYPE, - 'ALTERNATE_IIOP_ADDRESS', - [{"HostID", {'tk_string', 0}}, - {"Port", 'tk_ushort'}]}). -% The TAG_ORB_TYPE component can appear at most once in any IOR profile. For -% profiles supporting IIOP 1.1 or greater, it is optionally present. --define(ORB_TYPE, 'tk_ulong'). - --record('CONV_FRAME_CodeSetComponent', {native_code_set, conversion_code_sets}). --record('CONV_FRAME_CodeSetComponentInfo', {'ForCharData', 'ForWcharData'}). --define(CONV_FRAME_CODESETCOMPONENT, {'tk_struct', ?SYSTEM_TYPE, - 'CONV_FRAME_CodeSetComponent', - [{"native_code_set", 'tk_ulong'}, - {"conversion_code_sets", - {'tk_sequence', 'tk_ulong', 0}}]}). --define(CONV_FRAME_CODESETCOMPONENTINFO, {'tk_struct', ?SYSTEM_TYPE, - 'CONV_FRAME_CodeSetComponentInfo', - [{"ForCharData", - ?CONV_FRAME_CODESETCOMPONENT}, - {"ForWcharData", - ?CONV_FRAME_CODESETCOMPONENT}]}). - - - - --define(DEFAULT_FOR_CHAR, #'CONV_FRAME_CodeSetComponent'{native_code_set=?ISO8859_1_ID, - conversion_code_sets=[]}). --define(DEFAULT_FOR_WCHAR, #'CONV_FRAME_CodeSetComponent'{native_code_set=?UTF_16_ID, - conversion_code_sets=[]}). --define(DEFAULT_CODESETS, - #'CONV_FRAME_CodeSetComponentInfo'{'ForCharData' = ?DEFAULT_FOR_CHAR, - 'ForWcharData' = ?DEFAULT_FOR_WCHAR}). - -%% Fragmentation - IIOP-1.1 & 1.2 --record('GIOP_FragmentHeader_1_2', {request_id}). - --define(GIOP_FragmentHeader_1_2, {'tk_struct', ?SYSTEM_TYPE, - 'GIOP_FragmentHeader_1_2', - [{"request_id", 'tk_ulong'}]}). - -%%------ MISC Definitions ------- -%% TimeBase::TimeT (TimeBase.idl) is defined as -%% typedef unsigned long long TimeT; --define(TimeBase_TimeT, 'tk_ulonglong'). - -%%------ Fault Tolerant Definitions ------- - -%% Specification for Interoperable Object Group References --define(FT_FTDomainId, {'tk_string', 0}). --define(FT_ObjectGroupId, 'tk_ulonglong'). --define(FT_ObjectGroupRefVersion, 'tk_ulong'). -%% A GIOP::Version of 1.0 indicates that the implementation is compliant -%% with the CORBA-2.6 specification. -%% tag = TAG_FT_GROUP --record('FT_TagFTGroupTaggedComponent', {version = #'GIOP_Version'{major = 1, - minor = 0}, - ft_domain_id, object_group_id, - object_group_ref_version}). --define(FT_TagFTGroupTaggedComponent, {'tk_struct', ?SYSTEM_TYPE, 'FT_TagFTGroupTaggedComponent', - [{"version", ?GIOP_VERSION}, - {"ft_domain_id", ?FT_FTDomainId}, - {"object_group_id", ?FT_ObjectGroupId}, - {"object_group_ref_version", ?FT_ObjectGroupRefVersion}]}). - -%% tag = TAG_FT_PRIMARY; --record('FT_TagFTPrimaryTaggedComponent', {primary}). --define(FT_TagFTPrimaryTaggedComponent, {'tk_struct', ?SYSTEM_TYPE, 'FT_TagFTPrimaryTaggedComponent', - [{"primary", 'tk_boolean'}]}). - - -%% Specification for Most Recent Object Group Reference -%% context_id = FT_GROUP_VERSION; --record('FT_FTGroupVersionServiceContext', {object_group_ref_version}). --define(FT_FTGroupVersionServiceContext, {'tk_struct', ?SYSTEM_TYPE, 'FT_FTGroupVersionServiceContext', - [{"object_group_ref_version", ?FT_ObjectGroupRefVersion}]}). - -%% Specification for Transparent Reinvocation --define(FT_PolicyType_REQUEST_DURATION_POLICY, 47). - -%% context_id = FT_REQUEST --record('FT_FTRequestServiceContext', {client_id, retention_id, expiration_time}). --define(FT_FTRequestServiceContext, {'tk_struct', ?SYSTEM_TYPE, 'FT_FTRequestServiceContext', - [{"client_id", {'tk_string', 0}}, - {"retention_id", 'tk_long'}, - {"expiration_time", ?TimeBase_TimeT}]}). - -%% Specification for Transport Heartbeats --define(FT_PolicyType_HEARTBEAT_POLICY, 48). --define(FT_PolicyType_HEARTBEAT_ENABLED_POLICY, 49). - -%% tag = TAG_FT_HEARTBEAT_ENABLED; --record('FT_TagFTHeartbeatEnabledTaggedComponent', {heartbeat_enabled}). --define(FT_TagFTHeartbeatEnabledTaggedComponent, {'tk_struct', ?SYSTEM_TYPE, 'FT_TagFTHeartbeatEnabledTaggedComponent', - [{"heartbeat_enabled", 'tk_boolean'}]}). - - -%%------ CSI stuff - required by the SAS protocol. ------- -%% This constant defines the current level we support. --define(CSIv2_MAX_TARGET_REQUIRES, 16#488). - -%% NOTE! The OMG VMCID is incorrect in the SAS specification, should be -%% OMGVMCID = 0x4f4d0000; --define(CSI_OMGVMCID, ?CORBA_OMGVMCID). - -%% ASN.1 Encoding of an OBJECT IDENTIFIER --define(CSI_OID, {'tk_sequence', 'tk_octet', 0}). --define(CSI_OIDList, {'tk_sequence', ?CSI_OID, 0}). - -%% An X509CertificateChain contains an ASN.1 BER encoded SEQUENCE -%% [1..MAX] OF X.509 certificates encapsulated in a sequence of octets. The -%% subject:s certificate shall come first in the list. Each following -%% certificate shall directly certify the one preceding it. The ASN.1 -%% representation of Certificate is as defined in [IETF RFC 2459]. --define(CSI_X509CertificateChain, {'tk_sequence', 'tk_octet', 0}). - -%% an X.501 type name or Distinguished Name encapsulated in a sequence of -%% octets containing the ASN.1 encoding. --define(CSI_X501DistinguishedName, {'tk_sequence', 'tk_octet', 0}). - -%% UTF-8 Encoding of String --define(CSI_UTF8String, {'tk_sequence', 'tk_octet', 0}). - -%% A sequence of octets containing a GSStoken. Initial context tokens are -%% ASN.1 encoded as defined in [IETF RFC 2743] Section 3.1, -%% "Mechanism-Independent token Format", pp. 81-82. Initial context tokens -%% contain an ASN.1 tag followed by a token length, a mechanism identifier, -%% and a mechanism-specific token (i.e. a GSSUP::InitialContextToken). The -%% encoding of all other GSS tokens (e.g. error tokens and final context -%% tokens) is mechanism dependent. --define(CSI_GSSToken, {'tk_sequence', 'tk_octet', 0}). - -%% An encoding of a GSS Mechanism-Independent Exported Name Object as -%% defined in [IETF RFC 2743] Section 3.2, "GSS Mechanism-Independent -%% Exported Name Object Format," p. 84. --define(CSI_GSS_NT_ExportedName, {'tk_sequence', 'tk_octet', 0}). --define(CSI_GSS_NT_ExportedNameList, {'tk_sequence', ?CSI_GSS_NT_ExportedName, 0}). - -%% The MsgType enumeration defines the complete set of service context -%% message types used by the CSI context management protocols, including -%% those message types pertaining only to the stateful application of the -%% protocols (to insure proper alignment of the identifiers between -%% stateless and stateful implementations). Specifically, the -%% MTMessageInContext is not sent by stateless clients (although it may -%% be received by stateless targets). --define(CSI_MsgType, 'tk_short'). --define(CSI_MsgType_MTEstablishContext, 0). --define(CSI_MsgType_MTCompleteEstablishContext, 1). --define(CSI_MsgType_MTContextError, 4). --define(CSI_MsgType_MTMessageInContext, 5). - -%% The ContextId type is used carry session identifiers. A stateless -%% application of the service context protocol is indicated by a session -%% identifier value of 0. --define(CSI_ContextId, 'tk_ulonglong'). - -%% The AuthorizationElementType defines the contents and encoding of -%% the_element field of the AuthorizationElement. -%% The high order 20-bits of each AuthorizationElementType constant -%% shall contain the Vendor Minor Codeset ID (VMCID) of the -%% organization that defined the element type. The low order 12 bits -%% shall contain the organization-scoped element type identifier. The -%% high-order 20 bits of all element types defined by the OMG shall -%% contain the VMCID allocated to the OMG (that is, 0x4F4D0). --define(CSI_AuthorizationElementType, 'tk_ulong'). - -%% An AuthorizationElementType of X509AttributeCertChain indicates that -%% the_element field of the AuthorizationElement contains an ASN.1 BER -%% SEQUENCE composed of an (X.509) AttributeCertificate followed by a -%% SEQUENCE OF (X.509) Certificate. The two-part SEQUENCE is encapsulated -%% in an octet stream. The chain of identity certificates is provided -%% to certify the attribute certificate. Each certificate in the chain -%% shall directly certify the one preceding it. The first certificate -%% in the chain shall certify the attribute certificate. The ASN.1 -%% representation of (X.509) Certificate is as defined in [IETF RFC 2459]. -%% The ASN.1 representation of (X.509) AtributeCertificate is as defined -%% in [IETF ID PKIXAC]. --define(CSI_X509AttributeCertChain, (?CSI_OMGVMCID bor 1)). --define(CSI_AuthorizationElementContents, {'tk_sequence', 'tk_octet', 0}). - -%% The AuthorizationElement contains one element of an authorization token. -%% Each element of an authorization token is logically a PAC. -%% The AuthorizationToken is made up of a sequence of AuthorizationElements -%% --- NOTE --- -%% OMG only defines 'CSI_X509AttributeCertChain' so we use it as default value. --record('CSI_AuthorizationElement', {the_type = ?CSI_X509AttributeCertChain, - the_element = []}). --define(CSIIOP_AuthorizationElement, {'tk_struct', ?SYSTEM_TYPE, 'CSI_AuthorizationElement', - [{"the_type", ?CSI_AuthorizationElementType}, - {"the_element", ?CSI_AuthorizationElementContents}]}). --define(CSI_AuthorizationToken, {'tk_sequence', ?CSIIOP_AuthorizationElement, 0}). - -%% Additional standard identity token types shall only be defined by the -%% OMG. All IdentityTokenType constants shall be a power of 2. --define(CSI_IdentityTokenType, 'tk_ulong'). --define(CSI_IdentityTokenType_ITTAbsent, 0). --define(CSI_IdentityTokenType_ITTAnonymous, 1). --define(CSI_IdentityTokenType_ITTPrincipalName, 2). --define(CSI_IdentityTokenType_ITTX509CertChain, 4). --define(CSI_IdentityTokenType_ITTDistinguishedName, 8). - --define(CSI_IdentityExtension, {'tk_sequence', 'tk_octet', 0}). --record('CSI_IdentityToken', {label, value}). --define(CSI_IdentityToken, - {'tk_union', ?SYSTEM_TYPE, 'CSI_IdentityToken', - ?CSI_IdentityTokenType, 5, - [{?CSI_IdentityTokenType_ITTAbsent, "absent", 'tk_boolean'}, - {?CSI_IdentityTokenType_ITTAnonymous, "anonymous", 'tk_boolean'}, - {?CSI_IdentityTokenType_ITTPrincipalName, "principal_name", ?CSI_GSS_NT_ExportedName}, - {?CSI_IdentityTokenType_ITTX509CertChain, "certificate_chain", ?CSI_X509CertificateChain}, - {?CSI_IdentityTokenType_ITTDistinguishedName, "dn", ?CSI_X501DistinguishedName}, - {default, "id", ?CSI_IdentityExtension}]}). - --record('CSI_EstablishContext', {client_context_id, authorization_token, - identity_token, client_authentication_token}). --define(CSI_EstablishContext, {'tk_struct', ?SYSTEM_TYPE, 'CSI_EstablishContext', - [{"client_context_id", ?CSI_ContextId}, - {"authorization_token", ?CSI_AuthorizationToken}, - {"identity_token", ?CSI_IdentityToken}, - {"client_authentication_token", ?CSI_GSSToken}]}). - --record('CSI_CompleteEstablishContext', {client_context_id, context_stateful, - final_context_token}). --define(CSI_CompleteEstablishContext, {'tk_struct', ?SYSTEM_TYPE, 'CSI_CompleteEstablishContext', - [{"client_context_id", ?CSI_ContextId}, - {"context_stateful", 'tk_boolean'}, - {"final_context_token", ?CSI_GSSToken}]}). - --record('CSI_ContextError', {client_context_id, major_status, - minor_status, error_token}). --define(CSI_ContextError, {'tk_struct', ?SYSTEM_TYPE, 'CSI_ContextError', - [{"client_context_id", ?CSI_ContextId}, - {"major_status", 'tk_long'}, - {"minor_status", 'tk_long'}, - {"error_token", ?CSI_GSSToken}]}). - -% Not sent by stateless clients. If received by a stateless server, a -% ContextError message should be returned, indicating the session does -% not exist. --record('CSI_MessageInContext', {client_context_id, discard_context}). --define(CSI_MessageInContext, {'tk_struct', ?SYSTEM_TYPE, 'CSI_MessageInContext', - [{"client_context_id", ?CSI_ContextId}, - {"discard_context", 'tk_boolean'}]}). - --record('CSI_SASContextBody', {label, value}). --define(CSI_SASContextBody, - {'tk_union', ?SYSTEM_TYPE, 'CSI_SASContextBody', ?CSI_MsgType, -1, - [{?CSI_MsgType_MTEstablishContext, "establish_msg", ?CSI_EstablishContext}, - {?CSI_MsgType_MTCompleteEstablishContext, "complete_msg", ?CSI_CompleteEstablishContext}, - {?CSI_MsgType_MTContextError, "error_msg", ?CSI_ContextError}, - {?CSI_MsgType_MTMessageInContext, "in_context_msg", ?CSI_MessageInContext}]}). - -%% The following type represents the string representation of an ASN.1 -%% OBJECT IDENTIFIER (OID). OIDs are represented by the string "oid:" -%% followed by the integer base 10 representation of the OID separated -%% by dots. For example, the OID corresponding to the OMG is represented -%% as: "oid:2.23.130" --define(CSI_StringOID, {'tk_string', 0}). - - -%% The GSS Object Identifier for the KRB5 mechanism is: -%% { iso(1) member-body(2) United States(840) mit(113554) infosys(1) -%% gssapi(2) krb5(2) } -%% Type ?CSI_StringOID --define(CSI_KRB5MechOID, "oid:1.2.840.113554.1.2.2"). - -%% The GSS Object Identifier for name objects of the Mechanism-independent -%% Exported Name Object type is: -%% { iso(1) org(3) dod(6) internet(1) security(5) nametypes(6) -%% gss-api-exported-name(4) } -%% Type ?CSI_StringOID --define(CSI_GSS_NT_Export_Name_OID, "oid:1.3.6.1.5.6.4"). - -%% The GSS Object Identifier for the scoped-username name form is: -%% { iso-itu-t (2) international-organization (23) omg (130) security (1) -%% naming (2) scoped-username(1) } -%% Type ?CSI_StringOID --define(CSI_GSS_NT_Scoped_Username_OID, "oid:2.23.130.1.2.1"). - -%%------ GSSUP stuff - required by the SAS protocol. ------- -%% The GSS Object Identifier allocated for the username/password mechanism is defined -%% below. -%% { iso-itu-t (2) international-organization (23) omg (130) -%% security (1) authentication (1) gssup-mechanism (1) } -%% Type ?CSI_StringOID --define(GSSUP_GSSUPMechOID, "oid:2.23.130.1.1.1"). - -%% The following structure defines the inner contents of the -%% username password initial context token. This structure is -%% CDR encapsulated and appended at the end of the -%% username/password GSS (initial context) Token. --record('GSSUP_InitialContextToken', {username, password, target_name}). --define(GSSUP_InitialContextToken, {'tk_struct', ?SYSTEM_TYPE, 'GSSUP_InitialContextToken', - [{"username", ?CSI_UTF8String}, - {"password", ?CSI_UTF8String}, - {"target_name", ?CSI_GSS_NT_ExportedName}]}). - --define(GSSUP_ErrorCode, 'tk_ulong'). - -%% GSSUP Mechanism-Specific Error Token --record('GSSUP_ErrorToken', {error_code}). --define(GSSUP_ErrorToken, {'tk_struct', ?SYSTEM_TYPE, 'GSSUP_ErrorToken', - [{"error_code", ?GSSUP_ErrorCode}]}). - -%% The context validator has chosen not to reveal the GSSUP -%% specific cause of the failure. -%% Type ?GSSUP_ErrorCode --define(GSSUP_GSS_UP_S_G_UNSPECIFIED, 1). - -%% The user identified in the username field of the -%% GSSUP::InitialContextToken is unknown to the target. -%% Type ?GSSUP_ErrorCode --define(GSSUP_GSS_UP_S_G_NOUSER, 2). - -%% The password supplied in the GSSUP::InitialContextToken was -%% incorrect. -%% Type ?GSSUP_ErrorCode --define(GSSUP_GSS_UP_S_G_BAD_PASSWORD, 3). - -%% The target_name supplied in the GSSUP::InitialContextToken does -%% not match a target_name in a mechanism definition of the target. -%% Type ?GSSUP_ErrorCode --define(GSSUP_GSS_UP_S_G_BAD_TARGET, 4). - - -%%----- CSIIOP stuff - required by the SAS protocol. ----- - -% AssociationOptions --define(CSIIOP_AssociationOptions, 'tk_ushort'). -%% AssociationOptions - constant definitions --define(CSIIOP_AssociationOptions_NoProtection, 1). --define(CSIIOP_AssociationOptions_Integrity, 2). --define(CSIIOP_AssociationOptions_Confidentiality, 4). --define(CSIIOP_AssociationOptions_DetectReplay, 8). --define(CSIIOP_AssociationOptions_DetectMisordering, 16). --define(CSIIOP_AssociationOptions_EstablishTrustInTarget, 32). --define(CSIIOP_AssociationOptions_EstablishTrustInClient, 64). --define(CSIIOP_AssociationOptions_NoDelegation, 128). --define(CSIIOP_AssociationOptions_SimpleDelegation, 256). --define(CSIIOP_AssociationOptions_CompositeDelegation, 512). --define(CSIIOP_AssociationOptions_IdentityAssertion, 1024). --define(CSIIOP_AssociationOptions_DelegationByClient, 2048). - -%% The high order 20-bits of each ServiceConfigurationSyntax constant -%% shall contain the Vendor Minor Codeset ID (VMCID) of the -%% organization that defined the syntax. The low order 12 bits shall -%% contain the organization-scoped syntax identifier. The high-order 20 -%% bits of all syntaxes defined by the OMG shall contain the VMCID -%% allocated to the OMG (that is, 0x4F4D0). -%% NOTE! The OMG VMCID is incorrect in the SAS specification, should be -%% OMGVMCID = 0x4f4d0000; --define(CSIIOP_ServiceConfigurationSyntax, 'tk_ulong'). --define(CSIIOP_ServiceConfigurationSyntax_SCS_GeneralNames, (?CSI_OMGVMCID bor 0)). --define(CSIIOP_ServiceConfigurationSyntax_SCS_GSSExportedName, (?CSI_OMGVMCID bor 1)). - --define(CSIIOP_ServiceSpecificName, {'tk_sequence', 'tk_octet', 0}). - -%% The name field of the ServiceConfiguration structure identifies a -%% privilege authority in the format identified in the syntax field. If the -%% syntax is SCS_GeneralNames, the name field contains an ASN.1 (BER) -%% SEQUENCE [1..MAX] OF GeneralName, as defined by the type GeneralNames in -%% [IETF RFC 2459]. If the syntax is SCS_GSSExportedName, the name field -%% contains a GSS exported name encoded according to the rules in -%% [IETF RFC 2743] Section 3.2, "Mechanism-Independent Exported Name -%% Object Format," p. 84 (CORBA-2.6) --record('CSIIOP_ServiceConfiguration', {syntax, name}). --define(CSIIOP_ServiceConfiguration, {'tk_struct', ?SYSTEM_TYPE, 'CSIIOP_ServiceConfiguration', - [{"syntax", ?CSIIOP_ServiceConfigurationSyntax}, - {"name", ?CSIIOP_ServiceSpecificName}]}). --define(CSIIOP_ServiceConfigurationList, {'tk_sequence', ?CSIIOP_ServiceConfiguration, 0}). - -%% The body of the TAG_NULL_TAG component is a sequence of octets of -%% length 0. - -%% type used to define AS layer functionality within a compound mechanism -%% definition --record('CSIIOP_AS_ContextSec', {target_supports = 0, target_requires = 0, - client_authentication_mech, target_name}). --define(CSIIOP_AS_ContextSec, {'tk_struct', ?SYSTEM_TYPE, 'CSIIOP_AS_ContextSec', - [{"target_supports", ?CSIIOP_AssociationOptions}, - {"target_requires", ?CSIIOP_AssociationOptions}, - {"client_authentication_mech", ?CSI_OID}, - {"target_name", ?CSI_GSS_NT_ExportedName}]}). - -%% type used to define SAS layer functionality within a compound mechanism -%% definition --record('CSIIOP_SAS_ContextSec', {target_supports = 0, target_requires = 0, - privilege_authorities, - supported_naming_mechanisms, - supported_identity_types}). --define(CSIIOP_SAS_ContextSec, {'tk_struct', ?SYSTEM_TYPE, 'CSIIOP_SAS_ContextSec', - [{"target_supports", ?CSIIOP_AssociationOptions}, - {"target_requires", ?CSIIOP_AssociationOptions}, - {"privilege_authorities", ?CSIIOP_ServiceConfigurationList}, - {"supported_naming_mechanisms", ?CSI_OIDList}, - {"supported_identity_types", ?CSI_IdentityTokenType}]}). - -%% Type used in the body of a TAG_CSI_SEC_MECH_LIST component to describe a -%% compound mechanism --record('CSIIOP_CompoundSecMech', {target_requires = 0, transport_mech, - as_context_mech, sas_context_mech}). --define(CSIIOP_CompoundSecMech, {'tk_struct', ?SYSTEM_TYPE, 'CSIIOP_CompoundSecMech', - [{"target_requires", ?CSIIOP_AssociationOptions}, - {"transport_mech", ?IOP_TAGGEDCOMPONENT}, - {"as_context_mech", ?CSIIOP_AS_ContextSec}, - {"sas_context_mech", ?CSIIOP_SAS_ContextSec}]}). --define(CSIIOP_CompoundSecMechanisms, {'tk_sequence', ?CSIIOP_CompoundSecMech, 0}). - -%% type corresponding to the body of a TAG_CSI_SEC_MECH_LIST component --record('CSIIOP_CompoundSecMechList', {stateful = false, mechanism_list}). --define(CSIIOP_CompoundSecMechList, {'tk_struct', ?SYSTEM_TYPE, 'CSIIOP_CompoundSecMechList', - [{"stateful", 'tk_boolean'}, - {"mechanism_list", ?CSIIOP_CompoundSecMechanisms}]}). -%% CSIIOP::TransportAddress --record('CSIIOP_TransportAddress', {host_name, port}). --define(CSIIOP_TransportAddress, {'tk_struct', ?SYSTEM_TYPE, 'CSIIOP_TransportAddress', - [{"host_name", {'tk_string', 0}}, - {"port", 'tk_ushort'}]}). --define(CSIIOP_TransportAddressList, {'tk_sequence', ?CSIIOP_TransportAddress, 0}). - -%% Tagged component (TAG_TLS_SEC_TRANS) for configuring TLS/SSL as a CSIv2 -%% transport mechanism. --record('CSIIOP_TLS_SEC_TRANS', {target_supports, target_requires, addresses}). --define(CSIIOP_TLS_SEC_TRANS, {'tk_struct', ?SYSTEM_TYPE, 'CSIIOP_TLS_SEC_TRANS', - [{"target_supports", ?CSIIOP_AssociationOptions}, - {"target_requires", ?CSIIOP_AssociationOptions}, - {"addresses", ?CSIIOP_TransportAddressList}]}). - -%% Tagged component (TAG_SECIOP_SEC_TRANS) for configuring SECIOP as a CSIv2 -%% transport mechanism --record('CSIIOP_SECIOP_SEC_TRANS', {target_supports = 0, target_requires = 0, mech_oid, - target_name, addresses}). --define(CSIIOP_SECIOP_SEC_TRANS, {'tk_struct', ?SYSTEM_TYPE, 'CSIIOP_SECIOP_SEC_TRANS', - [{"target_supports", ?CSIIOP_AssociationOptions}, - {"target_requires", ?CSIIOP_AssociationOptions}, - {"mech_oid", ?CSI_OID}, - {"target_name", ?CSI_GSS_NT_ExportedName}, - {"addresses", ?CSIIOP_TransportAddressList}]}). - - -%%-- ServiceContext ID's ------------ -%% Describes what type of context included, i.e., -%% typedef unsigned long ServiceId; -%% struct ServiceContext { -%% ServiceId context_id; -%% sequence context_data; -%% }; - -%% The record is defined in include/corba.hrl. -%%-record('IOP_ServiceContext', {context_id, context_data}). --define(IOP_SERVICECONTEXT, {'tk_sequence', - {'tk_struct', ?SYSTEM_TYPE, 'IOP_ServiceContext', - [{"context_id", 'tk_ulong'}, - {"context_data", - {'tk_sequence', 'tk_octet', 0}}]}, 0}). - --record('CONV_FRAME_CodeSetContext', {char_data, wchar_data}). --define(CONV_FRAME_CODESETCONTEXT, {'tk_struct', ?SYSTEM_TYPE, 'CONV_FRAME_CodeSetContext', - [{"char_data", 'tk_ulong'}, - {"wchar_data", 'tk_ulong'}]}). - - --record('IIOP_ListenPoint', {host, port}). --define(IIOP_LISTENPOINT, {'tk_struct', ?SYSTEM_TYPE, 'IIOP_ListenPoint', - [{"host", {'tk_string', 0}}, - {"port", 'tk_ushort'}]}). - --record('IIOP_BiDirIIOPServiceContext', {listen_points}). --define(IIOP_BIDIRIIOPSERVICECONTEXT, - {'tk_struct', ?SYSTEM_TYPE, 'IIOP_BiDirIIOPServiceContext', - [{"listen_points", {'tk_sequence', ?IIOP_LISTENPOINT, 0}}]}). - --define(IOP_TransactionService, 0). --define(IOP_CodeSets, 1). --define(IOP_ChainBypassCheck, 2). --define(IOP_ChainBypassInfo, 3). --define(IOP_LogicalThreadId, 4). --define(IOP_BI_DIR_IIOP, 5). --define(IOP_SendingContextRunTime, 6). --define(IOP_INVOCATION_POLICIES, 7). --define(IOP_FORWARDED_IDENTITY, 8). --define(IOP_UnknownExceptionInfo, 9). --define(IOP_RTCorbaPriority, 10). --define(IOP_RTCorbaPriorityRange, 11). --define(IOP_FT_GROUP_VERSION, 12). --define(IOP_FT_REQUEST, 13). --define(IOP_ExceptionDetailMessage, 14). --define(IOP_SecurityAttributeService, 15). - - - -%%---------------------------------------------------------------------- -%% host_data -%%---------------------------------------------------------------------- --record(host_data, {protocol = normal, ssl_data, version, csiv2_mech, - csiv2_statefull = false, csiv2_addresses = [], - charset = ?ISO8859_1_ID, wcharset = ?UTF_16_ID, - ft_heartbeat = false, ft_primary = false, ft_domain, - ft_group, ft_ref_version}). - -%%---------------------------------------------------------------------- -%% giop_env -%%---------------------------------------------------------------------- --record(giop_env, {interceptors, type, version, bytes, ctx = [], - request_id, op, parameters = [], tc, response_expected, - objkey, reply_status, result, flags, host, iiop_port, - iiop_ssl_port, domain, partial_security}). - --endif. - -%%---------------------------------------------------------------------- -%% END OF MODULE -%%---------------------------------------------------------------------- diff --git a/lib/orber/src/orber_iiop_inproxy.erl b/lib/orber/src/orber_iiop_inproxy.erl deleted file mode 100644 index b595586f84..0000000000 --- a/lib/orber/src/orber_iiop_inproxy.erl +++ /dev/null @@ -1,399 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: orber_iiop_inproxy.erl -%% -%% Description: -%% This file contains the IIOP "proxy" for incomming connections -%% -%%----------------------------------------------------------------- --module(orber_iiop_inproxy). - --behaviour(gen_server). - --include_lib("orber/src/orber_iiop.hrl"). --include_lib("orber/include/corba.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([start/0, start/1]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([init/1, handle_call/3, handle_cast/2, handle_info/2, - code_change/3, terminate/2, post_accept/3, stop/1]). - -%%----------------------------------------------------------------- -%% Macros -%%----------------------------------------------------------------- --define(DEBUG_LEVEL, 7). - --record(state, {stype, socket, db, timeout, max_fragments, - max_requests, request_counter = 1, giop_env, peer}). - -%%----------------------------------------------------------------- -%% External interface functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: start/0 -%%----------------------------------------------------------------- -start() -> - ignore. - -%%----------------------------------------------------------------- -%% Func: start/1 -%%----------------------------------------------------------------- -start(Opts) -> - gen_server:start_link(orber_iiop_inproxy, Opts, []). - -post_accept(Pid, ssl, Socket) -> - (catch gen_server:cast(Pid, {post_accept, ssl, Socket})), - ok; -post_accept(_, _, _) -> - ok. - -%%----------------------------------------------------------------- -%% Internal interface functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: stop/1 -%%----------------------------------------------------------------- -stop(Pid) -> - gen_server:cast(Pid, stop). - -%%----------------------------------------------------------------- -%% Server functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: init/1 -%%----------------------------------------------------------------- -init({connect, Type, Socket, Ref, Options}) -> - process_flag(trap_exit, true), - Flags = orber_tb:keysearch(flags, Options, orber_env:get_flags()), - {Address, Port} = PeerData = orber_socket:peerdata(Type, Socket), - {LAddress, LPort} = LocalData = orber_socket:sockdata(Type, Socket), - case {?ORB_FLAG_TEST(Flags, ?ORB_ENV_LOCAL_INTERFACE), LPort} of - {true, 0} -> - orber_tb:info("Unable to lookup the local address and port number.~n" - "Closing the incoming connection.", []), - ignore; - _ -> - orber_iiop_net:add_connection(Socket, Type, PeerData, LocalData, Ref), - Interceptors = - case orber_tb:keysearch(interceptors, Options, - orber_env:get_interceptors()) of - {native, PIs} -> - {native, orber_pi:new_in_connection(PIs, Address, Port, - LAddress, LPort), PIs}; - Other -> - Other - end, - Env = - case ?ORB_FLAG_TEST(Flags, ?ORB_ENV_LOCAL_INTERFACE) of - true when Type == ssl -> - #giop_env{interceptors = Interceptors, - flags = Flags, host = [LAddress], - iiop_port = - orber_tb:keysearch(iiop_port, Options, - orber_env:iiop_port()), - iiop_ssl_port = LPort, - domain = orber:domain(), - partial_security = orber:partial_security()}; - true -> - #giop_env{interceptors = Interceptors, - flags = Flags, host = [LAddress], - iiop_port = LPort, - iiop_ssl_port = - orber_tb:keysearch(iiop_ssl_port, Options, - orber_env:iiop_ssl_port()), - domain = orber:domain(), - partial_security = orber:partial_security()}; - false -> - case ?ORB_FLAG_TEST(Flags, ?ORB_ENV_ENABLE_NAT) of - false -> - #giop_env{interceptors = Interceptors, - flags = Flags, host = orber:host(), - iiop_port = orber:iiop_port(), - iiop_ssl_port = orber:iiop_ssl_port(), - domain = orber:domain(), - partial_security = orber:partial_security()}; - true -> - #giop_env{interceptors = Interceptors, - flags = Flags, - host = - orber_tb:keysearch(nat_ip_address, Options, - orber_env:nat_host()), - iiop_port = - orber_tb:keysearch(nat_iiop_port, Options, - orber_env:nat_iiop_port()), - iiop_ssl_port = - orber_tb:keysearch(nat_iiop_ssl_port, Options, - orber_env:nat_iiop_ssl_port()), - domain = orber:domain(), - partial_security = orber:partial_security()} - end - end, - Timeout = orber_tb:keysearch(iiop_in_connection_timeout, Options, - orber_env:iiop_in_connection_timeout()), - MaxFrags = orber_tb:keysearch(iiop_max_fragments, Options, - orber_env:iiop_max_fragments()), - MaxRequests = orber_tb:keysearch(iiop_max_in_requests, Options, - orber_env:iiop_max_in_requests()), - {ok, #state{stype = Type, - socket = Socket, - db = ets:new(orber_incoming_requests, [set]), - timeout = Timeout, - max_fragments = MaxFrags, - max_requests = MaxRequests, - giop_env = Env, peer = PeerData}, Timeout} - end. - - -%%----------------------------------------------------------------- -%% Func: terminate/2 -%%----------------------------------------------------------------- -%% We may want to kill all proxies before terminating, but the best -%% option should be to let the requests complete (especially for one-way -%% functions it's a better alternative. -terminate(_Reason, #state{db = IncRequests, giop_env = Env}) -> - ets:delete(IncRequests), - case Env#giop_env.interceptors of - false -> - ok; - {native, Ref, PIs} -> - orber_pi:closed_in_connection(PIs, Ref); - {_Type, _PIs} -> - ok - end. - -%%----------------------------------------------------------------- -%% Func: handle_call/3 -%%----------------------------------------------------------------- -handle_call(stop, _From, State) -> - {stop, normal, ok, State}; -handle_call(_, _, State) -> - {noreply, State, State#state.timeout}. - -%%----------------------------------------------------------------- -%% Func: handle_cast/2 -%%----------------------------------------------------------------- -handle_cast({post_accept, Type, Socket}, State) -> - Timeout = orber_env:iiop_ssl_accept_timeout(), - case catch orber_socket:post_accept(Type, Socket, Timeout) of - ok -> - {noreply, State}; - _Failed -> - orber_socket:close(Type, Socket), - {stop, normal, State} - end; -handle_cast(stop, State) -> - {stop, normal, State}; -handle_cast(_, State) -> - {noreply, State, State#state.timeout}. - -%%----------------------------------------------------------------- -%% Func: handle_info/2 -%%----------------------------------------------------------------- -%% Normal invocation -handle_info({tcp, Socket, Bytes}, State) -> - handle_msg(normal, Socket, Bytes, State); -handle_info({ssl, Socket, Bytes}, State) -> - handle_msg(ssl, Socket, Bytes, State); -%% Errors, closed connection -handle_info({tcp_closed, _Socket}, State) -> - {stop, normal, State}; -handle_info({tcp_error, _Socket, _Reason}, State) -> - {stop, normal, State}; -handle_info({ssl_closed, _Socket}, State) -> - {stop, normal, State}; -handle_info({ssl_error, _Socket, _Reason}, State) -> - {stop, normal, State}; -%% Servant termination. -handle_info({'EXIT', Pid, normal}, State) -> - ets:delete(State#state.db, Pid), - {noreply, decrease_counter(State), State#state.timeout}; -handle_info({message_error, _Pid, ReqId}, State) -> - ets:delete(State#state.db, ReqId), - {noreply, State, State#state.timeout}; -handle_info(timeout, State) -> - case ets:info(State#state.db, size) of - 0 -> - %% No pending requests, close the connection. - {stop, normal, State}; - _Amount -> - %% Still pending request, cannot close the connection. - {noreply, State, State#state.timeout} - end; -handle_info({reconfigure, Options}, State) -> - {noreply, update_state(State, Options), State#state.timeout}; -handle_info(_X,State) -> - {noreply, State, State#state.timeout}. - -handle_msg(Type, Socket, Bytes, #state{stype = Type, socket = Socket, - giop_env = Env} = State) -> - case catch cdr_decode:dec_giop_message_header(Bytes) of - %% Only when using IIOP-1.2 may the client send this message. - %% Introduced in CORBA-2.6 - #giop_message{message_type = ?GIOP_MSG_CLOSE_CONNECTION, - giop_version = {1,2}} -> - {stop, normal, State}; - #giop_message{message_type = ?GIOP_MSG_CLOSE_CONNECTION} -> - {noreply, State, State#state.timeout}; - #giop_message{message_type = ?GIOP_MSG_CANCEL_REQUEST} = GIOPHdr -> - ReqId = cdr_decode:peek_request_id(GIOPHdr#giop_message.byte_order, - GIOPHdr#giop_message.message), - case ets:lookup(State#state.db, ReqId) of - [{RId, PPid}] -> - ets:delete(State#state.db, RId), - PPid ! {self(), cancel_request_header}; - [] -> - send_msg_error(Type, Socket, Bytes, - Env#giop_env{version = - GIOPHdr#giop_message.giop_version}, - "No such request id") - end, - {noreply, State, State#state.timeout}; - %% A fragment; we must have received a Request or LocateRequest - %% with fragment-flag set to true. - %% We need to decode the header to get the request-id. - #giop_message{message_type = ?GIOP_MSG_FRAGMENT, - giop_version = {1,2}} = GIOPHdr -> - ReqId = cdr_decode:peek_request_id(GIOPHdr#giop_message.byte_order, - GIOPHdr#giop_message.message), - case ets:lookup(State#state.db, ReqId) of - [{_RId, PPid}] when GIOPHdr#giop_message.fragments == true -> - PPid ! {self(), GIOPHdr}; - [{RId, PPid}] -> - ets:delete(State#state.db, RId), - PPid ! {self(), GIOPHdr}; - [] -> - send_msg_error(Type, Socket, Bytes, - Env#giop_env{version = - GIOPHdr#giop_message.giop_version}, - "No such fragment id") - end, - {noreply, State, State#state.timeout}; - %% Must be a Request or LocateRequest which have been fragmented. - %% We need to decode the header to get the request-id. - #giop_message{fragments = true, - giop_version = {1,2}} = GIOPHdr -> - ReqId = cdr_decode:peek_request_id(GIOPHdr#giop_message.byte_order, - GIOPHdr#giop_message.message), - Pid = - orber_iiop_inrequest: - start_fragment_collector(GIOPHdr, Bytes, - Type, Socket, - ReqId, self(), - State#state.max_fragments, - Env#giop_env{version = {1,2}, - request_id = ReqId}), - ets:insert(State#state.db, {Pid, ReqId}), - ets:insert(State#state.db, {ReqId, Pid}), - {noreply, increase_counter(State), State#state.timeout}; - GIOPHdr when is_record(GIOPHdr, giop_message) -> - Pid = orber_iiop_inrequest:start(GIOPHdr, Bytes, Type, Socket, - Env#giop_env{version = - GIOPHdr#giop_message.giop_version}), - ets:insert(State#state.db, {Pid, undefined}), - {noreply, increase_counter(State), State#state.timeout}; - {'EXIT', message_error} -> - send_msg_error(Type, Socket, Bytes, - Env#giop_env{version = orber_env:giop_version()}, - "Unable to decode the GIOP-header"), - {noreply, State, State#state.timeout} - end; -handle_msg(Type, _, Bytes, State) -> - orber:dbg("[~p] orber_iiop_inproxy:handle_msg(~p);~n" - "Received a message from a socket of a different type.~n" - "Should be ~p but was ~p.", - [?LINE, Bytes, State#state.stype, Type], ?DEBUG_LEVEL), - {noreply, State, State#state.timeout}. - -send_msg_error(Type, Socket, Data, Env, Msg) -> - orber:dbg("[~p] orber_iiop_inproxy:handle_msg(~p); ~p.", - [?LINE, Data, Msg], ?DEBUG_LEVEL), - Reply = cdr_encode:enc_message_error(Env), - orber_socket:write(Type, Socket, Reply). - -increase_counter(#state{max_requests = infinity} = State) -> - State; -increase_counter(#state{max_requests = Max, - request_counter = Counter} = State) when Max > Counter -> - orber_socket:setopts(State#state.stype, State#state.socket, [{active, once}]), - State#state{request_counter = Counter + 1}; -increase_counter(State) -> - State#state{request_counter = State#state.request_counter + 1}. - -decrease_counter(#state{max_requests = infinity} = State) -> - State; -decrease_counter(#state{max_requests = Max, - request_counter = Counter} = State) when Max =< Counter -> - orber_socket:setopts(State#state.stype, State#state.socket, [{active, once}]), - State#state{request_counter = Counter - 1}; -decrease_counter(State) -> - State#state{request_counter = State#state.request_counter - 1}. - -update_state(#state{giop_env = Env} = State, - [{interceptors, false}|Options]) -> - update_state(State#state{giop_env = - Env#giop_env{interceptors = false}}, Options); -update_state(#state{giop_env = #giop_env{interceptors = false, host = [SH], - iiop_port = SP} = Env, - peer = {PH, PP}, stype = normal} = State, - [{interceptors, {native, LPIs}}|Options]) -> - %% No Interceptor(s). Add the same Ref used by the built in interceptors. - update_state(State#state{giop_env = - Env#giop_env{interceptors = - {native, {PH, PP, SH, SP}, LPIs}}}, - Options); -update_state(#state{giop_env = #giop_env{interceptors = false, host = [SH], - iiop_ssl_port = SP} = Env, - peer = {PH, PP}, stype = ssl} = State, - [{interceptors, {native, LPIs}}|Options]) -> - %% No Interceptor(s). Add the same Ref used by the built in interceptors. - update_state(State#state{giop_env = - Env#giop_env{interceptors = - {native, {PH, PP, SH, SP}, LPIs}}}, - Options); -update_state(#state{giop_env = #giop_env{interceptors = {native, Ref, _}} = Env} = - State, - [{interceptors, {native, LPIs}}|Options]) -> - %% Interceptor(s) already in use. We must use the same Ref as before. - update_state(State#state{giop_env = - Env#giop_env{interceptors = {native, Ref, LPIs}}}, - Options); -update_state(State, [H|T]) -> - orber:dbg("[~p] orber_iiop_inproxy:update_state(~p, ~p)~n" - "Couldn't change the state.", - [?LINE, H, State], ?DEBUG_LEVEL), - update_state(State, T); -update_state(State, []) -> - State. - -%%----------------------------------------------------------------- -%% Func: code_change/3 -%%----------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - diff --git a/lib/orber/src/orber_iiop_inrequest.erl b/lib/orber/src/orber_iiop_inrequest.erl deleted file mode 100644 index 9d84b63398..0000000000 --- a/lib/orber/src/orber_iiop_inrequest.erl +++ /dev/null @@ -1,541 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%-------------------------------------------------------------------- -%% File: orber_iiop_inrequest.erl -%% -%% Description: -%% This file contains the handling of incomming requests -%% -%%----------------------------------------------------------------- --module(orber_iiop_inrequest). - --include_lib("orber/src/orber_iiop.hrl"). --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/orber_pi.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([start/5, start_fragment_collector/8]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([handle_message/5, fragment_collector/8]). - -%%----------------------------------------------------------------- -%% Macros -%%----------------------------------------------------------------- --define(DEBUG_LEVEL, 8). - - -%%----------------------------------------------------------------- -%% External interface functions -%%----------------------------------------------------------------- -start(GIOPHdr, Message, Type, Socket, Env) -> - spawn_link(orber_iiop_inrequest, handle_message, - [GIOPHdr, Message, Type, Socket, Env]). - -start_fragment_collector(GIOPHdr, Message, Type, Socket, ReqId, Proxy, MaxFrags, Env) -> - spawn_link(orber_iiop_inrequest, fragment_collector, - [GIOPHdr, Message, Type, Socket, ReqId, Proxy, MaxFrags, Env]). - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- - -%%----------------------------------------------------------------- -%% Func: fragment_collector/4 -%%----------------------------------------------------------------- -fragment_collector(GIOPHdr, Bytes, SocketType, Socket, ReqId, Proxy, MaxFrags, Env) -> - case catch collect(Proxy, [], GIOPHdr#giop_message.byte_order, ReqId, - MaxFrags, 0) of - {ok, Buffer} -> - NewGIOP = GIOPHdr#giop_message - {message = list_to_binary([GIOPHdr#giop_message.message|Buffer])}, - %% NOTE, the third argument to dec_message_header must be complete - %% message (i.e. AllBytes), otherwise we cannot handle indirection. - case handle_message(NewGIOP, list_to_binary([Bytes| Buffer]), - SocketType, Socket, Env) of - message_error -> - Proxy ! {message_error, self(), ReqId}, - ok; - _ -> - ok - end; - ok -> - ok; - {'EXCEPTION', E} -> - Proxy ! {message_error, self(), ReqId}, - Reply = marshal_exception(Env, ReqId, E, enc_reply), - orber_socket:write(SocketType, Socket, Reply) - end. - - - -collect(_Proxy, _Buffer, _ByteOrder, _ReqId, MaxFrags, MaxFrags) -> - orber:dbg("[~p] ~p:collect(~p)~nMax fragments limit reached.", - [?LINE, ?MODULE, MaxFrags], ?DEBUG_LEVEL), - {'EXCEPTION', #'IMP_LIMIT'{completion_status=?COMPLETED_NO}}; -collect(Proxy, Buffer, ByteOrder, ReqId, MaxFrags, FragCounter) -> - receive - {Proxy, #giop_message{byte_order = ByteOrder, - message = Message, - fragments = true} = GIOPHdr} -> - {_, #fragment_header{request_id=ReqId}, FragBody, _, _} = - cdr_decode:dec_message_header(null, GIOPHdr, Message), - collect(Proxy, [FragBody | Buffer], ByteOrder, ReqId, - MaxFrags, FragCounter+1); - {Proxy, #giop_message{byte_order = ByteOrder, - message = Message, - fragments = false} = GIOPHdr} -> - {_, #fragment_header{request_id=ReqId}, FragBody, _, _} = - cdr_decode:dec_message_header(null, GIOPHdr, Message), - {ok, lists:reverse([FragBody | Buffer])}; - {Proxy, GIOPHdr, _Data, _} -> - orber:dbg("[~p] orber_iiop_inrequest:collect(~p, ~p)~n" - "Incorrect Fragment. Might be different byteorder.", - [?LINE, ByteOrder, GIOPHdr], ?DEBUG_LEVEL), - {'EXCEPTION', #'MARSHAL'{completion_status=?COMPLETED_NO}}; - {Proxy, cancel_request_header} -> - ok; - Other -> - orber:dbg("[~p] ~p:collect(~p)~n" - "Unable to collect all fragments: ~p", - [?LINE, ?MODULE, Buffer, Other], ?DEBUG_LEVEL), - {'EXCEPTION', #'MARSHAL'{completion_status=?COMPLETED_NO}} - end. - - -%%----------------------------------------------------------------- -%% Func: handle_message/4 -%%----------------------------------------------------------------- -handle_message(GIOPHdr, Message, SocketType, Socket, Env) -> - %% Warning. We shouldn't set the flags like this here. But, for now, we'll - %% do it due to performance reasons. - put(oe_orber_flags, Env#giop_env.flags), - case catch cdr_decode:dec_message_header(null, GIOPHdr, Message) of - Hdr when is_record(Hdr, cancel_request_header) -> - %% We just skips this message for the moment, the standard require that - %% the client handles the reply anyway. - message_error; - {location_forward, Object, ReqId, Version, OldObj} -> - Reply = call_interceptors_out(Env#giop_env{version = Version}, - ReqId, [Object], OldObj, - 'location_forward', - "location_forward", - {{'tk_objref', "", ""}, [],[]}), - orber_socket:write(SocketType, Socket, Reply); - {object_forward, Object, ReqId, Version, _OldObj} -> - Reply = handle_locate_request(Env#giop_env{version = Version}, - {object_forward, Object, ReqId}), - orber_socket:write(SocketType, Socket, Reply); - {Version, Hdr} when is_record(Hdr, locate_request_header) -> - Reply = handle_locate_request(Env#giop_env{version = Version}, Hdr), - orber_socket:write(SocketType, Socket, Reply); - {Version, ReqHdr, Rest, Len, ByteOrder} when is_record(ReqHdr, request_header) -> - handle_request(Env#giop_env{version = Version}, ReqHdr, Rest, Len, - ByteOrder, SocketType, Socket, Message); - Other -> - %% This cluase takes care of all erranous messages. - orber:dbg("[~p] orber_iiop_inrequest:handle_message(~p)~n" - "Decoding Msg Header failed: ~p", - [?LINE, Message, Other], ?DEBUG_LEVEL), - Reply = cdr_encode:enc_message_error(Env), - orber_socket:write(SocketType, Socket, Reply), - message_error - end. - - -send_reply(oneway, _SocketType, _Socket) -> - ok; -send_reply(Reply, SocketType, Socket) -> - orber_socket:write(SocketType, Socket, Reply). - -%%----------------------------------------------------------------- -%% Func: handle_request -%%----------------------------------------------------------------- -handle_request(#giop_env{interceptors = false} = Env, ReqHdr, Rest, Len, ByteOrder, - SocketType, Socket, Message) -> - NewEnv = check_context(ReqHdr#request_header.service_context, [], Env), - case decode_body(NewEnv, ReqHdr, Rest, Len, ByteOrder, Message, enc_reply) of - {error, E} -> - orber_socket:write(SocketType, Socket, E); - {NewEnv2, Hdr, Par, TypeCodes} -> - Result = invoke_request(Hdr, Par, SocketType, TypeCodes, Env), - Reply = evaluate(NewEnv2, Hdr, Result, TypeCodes, - enc_reply, 'no_exception'), - send_reply(Reply, SocketType, Socket) - end; -handle_request(Env, ReqHdr, Rest, Len, ByteOrder, SocketType, Socket, Message) -> - NewEnv = check_context(ReqHdr#request_header.service_context, [], Env), - case catch call_interceptors(SocketType, NewEnv, ReqHdr, - Rest, Len, ByteOrder, Message) of - {error, E} -> - %% Failed to decode body. - orber_socket:write(SocketType, Socket, E); - {'EXCEPTION', Exc} -> - orber:dbg("[~p] orber_iiop_inrequest:handle_message(~p)~n" - "Invoking the interceptors resulted in: ~p", - [?LINE, Message, Exc], ?DEBUG_LEVEL), - Reply = marshal_exception(NewEnv, - ReqHdr#request_header.request_id, - Exc, enc_reply), - orber_socket:write(SocketType, Socket, Reply); - {'EXIT', R} -> - orber:dbg("[~p] orber_iiop_inrequest:handle_message(~p)~n" - "Invoking the interceptors resulted in: ~p", - [?LINE, ReqHdr, R], ?DEBUG_LEVEL), - Reply = marshal_exception(NewEnv, - ReqHdr#request_header.request_id, - #'MARSHAL'{completion_status=?COMPLETED_MAYBE}, - enc_reply), - orber_socket:write(SocketType, Socket, Reply); - Reply -> - send_reply(Reply, SocketType, Socket) - end. - -check_context([], [], Env) -> - Env; -check_context([], Acc, Env) -> - Env#giop_env{ctx = Acc}; -check_context([#'CSI_SASContextBody' - {label = ?CSI_MsgType_MTEstablishContext, - value = #'CSI_EstablishContext' - {client_context_id = _Id, - authorization_token = _AuthToken, - identity_token = _IdToken, - client_authentication_token = _CAuthToken}}|Rest], Acc, Env) -> - check_context(Rest, [#'IOP_ServiceContext' - {context_id=?IOP_SecurityAttributeService, - context_data = #'CSI_SASContextBody' - {label = ?CSI_MsgType_MTCompleteEstablishContext, - value = #'CSI_CompleteEstablishContext' - {client_context_id = 0, - context_stateful = false, - final_context_token = [0,255]}}}|Acc], Env); -check_context([_|Rest], Acc, Env) -> - check_context(Rest, Acc, Env). - - -%%----------------------------------------------------------------- -%% Func: call_interceptors -%%----------------------------------------------------------------- --dialyzer({no_improper_lists, call_interceptors/7}). -call_interceptors(SocketType, #giop_env{interceptors = {native, Ref, PIs}, - ctx = Ctx} = Env, - ReqHdr, Rest, Len, ByteOrder, Msg) -> - NewRest = orber_pi:in_request_enc(PIs, ReqHdr, Ref, Rest), - case decode_body(Env, ReqHdr, NewRest, Len, ByteOrder, Msg, enc_reply) of - {NewEnv, Hdr, Par, TypeCodes} -> - NewPar = orber_pi:in_request(PIs, ReqHdr, Ref, Par), - ResultInv = invoke_request(Hdr, NewPar, SocketType, TypeCodes, NewEnv), - Result = orber_pi:out_reply(PIs, ReqHdr, Ref, ResultInv, Ctx), - - case evaluate(NewEnv, ReqHdr, Result, TypeCodes, enc_reply_split, - 'no_exception') of - {ReplyHdr, Reply, HdrL, _BodyL, Flags} -> - NewReply = orber_pi:out_reply_enc(PIs, ReqHdr, Ref, Reply, Ctx), - MessSize = HdrL+size(NewReply), - cdr_encode:enc_giop_message_header(NewEnv, 'reply', Flags, - MessSize, [ReplyHdr|NewReply]); - Other -> - Other - end; - Other -> - Other - end; -call_interceptors(SocketType, #giop_env{interceptors = {portable, _PIs}} = Env, - ReqHdr, Rest, Len, ByteOrder, Msg) -> - case decode_body(Env, ReqHdr, Rest, Len, ByteOrder, Msg, enc_reply) of - {NewEnv, Hdr, Par, TypeCodes} -> - Result = invoke_request(Hdr, Par, SocketType, TypeCodes, NewEnv), - evaluate(NewEnv, ReqHdr, Result, TypeCodes, enc_reply, 'no_exception'); - Other -> - Other - end. - -%%----------------------------------------------------------------- -%% Func: call_interceptors_out -%%----------------------------------------------------------------- --dialyzer({no_improper_lists, call_interceptors_out/7}). -call_interceptors_out(#giop_env{interceptors = {native, Ref, PIs}, ctx = Ctx} = Env, - ReqId, Result, Obj, Type, Operation, TypeCodes) -> - ReqHdr = #request_header{object_key = Obj, - service_context = Ctx, - response_expected = true, - request_id = ReqId, - operation = Operation}, - NewResult = (catch orber_pi:out_reply(PIs, ReqHdr, Ref, Result, Ctx)), - {ReplyHdr, Reply, HdrL, _BodyL, Flags} = - evaluate(Env, ReqHdr, NewResult, TypeCodes, enc_reply_split, Type), - NewReply = - case catch orber_pi:out_reply_enc(PIs, ReqHdr, Ref, Reply, Ctx) of - {'EXCEPTION', Exception} -> - %% Since evaluate don't need TypeCodes or Status no need to supply - %% them. - evaluate(Env, ReqHdr, {'EXCEPTION', Exception}, undefined, - enc_reply_split, undefined); - {'EXIT', E} -> - orber:dbg("[~p] orber_iiop_inrequest:handle_location_forward(~p)~n" - "Resulted in exit: ~p", [?LINE, PIs, E], ?DEBUG_LEVEL), - marshal_exception(Env, ReqId, - #'MARSHAL'{completion_status=?COMPLETED_NO}, - enc_reply); - R -> - R - end, - MessSize = HdrL+size(NewReply), - cdr_encode:enc_giop_message_header(Env, 'reply', Flags, MessSize, - [ReplyHdr|NewReply]); -call_interceptors_out(#giop_env{interceptors = {portable, _PIs}} = Env, - ReqId, Result, _Obj, Type, _, TypeCodes) -> - Hdr = #request_header{response_expected = true, - request_id = ReqId}, - evaluate(Env, Hdr, Result, TypeCodes, enc_reply, Type); -call_interceptors_out(Env, ReqId, Result, _Obj, Type, _, TypeCodes) -> - Hdr = #request_header{response_expected = true, - request_id = ReqId}, - evaluate(Env, Hdr, Result, TypeCodes, enc_reply, Type). - - -%%----------------------------------------------------------------- -%% Func: decode_body/2 -%%----------------------------------------------------------------- -decode_body(#giop_env{version = Version} = Env, ReqHdr, Rest, Len, - ByteOrder, Message, Func) -> - case catch cdr_decode:dec_request_body(Version, ReqHdr, Rest, Len, - ByteOrder, Message) of - {NewVersion, ReqHdr, Par, TypeCodes} -> - {Env#giop_env{version = NewVersion}, ReqHdr, Par, TypeCodes}; - {'EXCEPTION', E} -> - orber:dbg("[~p] orber_iiop_inrequest:decode_body(~p, ~p)~n" - "Failed decoding request body: ~p", - [?LINE, ReqHdr, Message, E], ?DEBUG_LEVEL), - {error, marshal_exception(Env, ReqHdr#request_header.request_id, - E, Func)}; - Other -> - %% This cluase takes care of all erranous messages. - orber:dbg("[~p] orber_iiop_inrequest:decode_body(~p, ~p)~n" - "Failed decoding request body: ~p", - [?LINE, ReqHdr, Message, Other], ?DEBUG_LEVEL), - {error, marshal_exception(Env, ReqHdr#request_header.request_id, - #'MARSHAL'{completion_status=?COMPLETED_NO}, - Func)} - end. - - -%%----------------------------------------------------------------- -%% Func: handle_locate_request/2 -%%----------------------------------------------------------------- -handle_locate_request(Env, {object_forward, Object, ReqId}) -> - case catch cdr_encode:enc_locate_reply( - Env#giop_env{request_id = ReqId, - tc = {'tk_objref', "", ""}, - result = Object, - reply_status = 'object_forward'}) of - {'EXCEPTION', Exception} -> - orber:dbg("[~p] orber_iiop_inrequest:handle_locate_request(object_forward)~n" - "Raised the exception: ~p", [?LINE, Exception], ?DEBUG_LEVEL), - marshal_locate_exception(Env, ReqId, Exception); - {'EXIT', E} -> - orber:dbg("[~p] orber_iiop_inrequest:handle_locate_request(object_forward)~n" - "Resulted in exit: ~p", [?LINE, E], ?DEBUG_LEVEL), - marshal_locate_exception(Env, ReqId, - #'MARSHAL'{completion_status=?COMPLETED_NO}); - R -> - R - end; -handle_locate_request(Env, Hdr) -> - Location = orber_objectkeys:check(Hdr#locate_request_header.object_key), - case catch cdr_encode:enc_locate_reply( - Env#giop_env{request_id = Hdr#locate_request_header.request_id, - reply_status = Location}) of - {'EXCEPTION', Exception} -> - orber:dbg("[~p] orber_iiop_inrequest:handle_locate_request(~p)~n" - "Raised the exception: ~p", - [?LINE, Location, Exception], ?DEBUG_LEVEL), - marshal_locate_exception(Env, Hdr#locate_request_header.request_id, Exception); - {'EXIT', E} -> - orber:dbg("[~p] orber_iiop_inrequest:handle_locate_request(~p)~n" - "Resulted in exit: ~p", [?LINE, Location, E], ?DEBUG_LEVEL), - marshal_locate_exception(Env, Hdr#locate_request_header.request_id, - #'MARSHAL'{completion_status=?COMPLETED_NO}); - R -> - R - end. - -%%----------------------------------------------------------------- -%% Func: invoke_request/2 -%%----------------------------------------------------------------- -invoke_request(Hdr, Par, normal, TypeCodes, #giop_env{iiop_ssl_port = SSLPort, - partial_security = PartialSec}) -> - Result = - case SSLPort of - -1 -> - corba:request_from_iiop(Hdr#request_header.object_key, - Hdr#request_header.operation, - Par, [], Hdr#request_header.response_expected, - Hdr#request_header.service_context); - _ -> - case Hdr#request_header.object_key of - {_,registered,orber_init,_,_,_} -> - corba:request_from_iiop(Hdr#request_header.object_key, - Hdr#request_header.operation, - Par, [], - Hdr#request_header.response_expected, - Hdr#request_header.service_context); - {_,_,_,_,_,Flags} when PartialSec == true, - ?ORB_FLAG_TEST(Flags, ?ORB_NO_SECURITY) == true -> - corba:request_from_iiop(Hdr#request_header.object_key, - Hdr#request_header.operation, - Par, [], - Hdr#request_header.response_expected, - Hdr#request_header.service_context); - _ -> - orber:dbg("[~p] orber_iiop_inrequest:invoke_request(~p)~n" - "SSL do not permit", - [?LINE, Hdr#request_header.object_key], ?DEBUG_LEVEL), - {'EXCEPTION', #'NO_PERMISSION'{completion_status=?COMPLETED_NO}} - end - end, - result_to_list(Result, TypeCodes); -invoke_request(Hdr, Par, ssl, TypeCodes, _) -> - Result = corba:request_from_iiop(Hdr#request_header.object_key, - Hdr#request_header.operation, - Par, [], Hdr#request_header.response_expected, - Hdr#request_header.service_context), - result_to_list(Result, TypeCodes). - -%%----------------------------------------------------------------- -%% Func: evaluate/4 -%%----------------------------------------------------------------- -evaluate(_, Hdr,_,_,_,_) when Hdr#request_header.response_expected == 'false' -> - oneway; -evaluate(Env, Hdr, _, _, Func, _) - when Hdr#request_header.response_expected == 'true_oneway' -> - %% Special case which only occurs when using IIOP-1.2 - cdr_encode:Func(Env#giop_env{request_id = Hdr#request_header.request_id, - reply_status = 'no_exception', - tc = {tk_null,[],[]}, result = null}); -evaluate(Env, Hdr, {'EXCEPTION', Exc}, _, Func, _) -> - %% The exception can be user defined. Hence, we must check the result. - case catch marshal_exception(Env, Hdr#request_header.request_id, Exc, Func) of - {'EXCEPTION', Exception} -> - orber:dbg("[~p] orber_iiop_inrequest:evaluate(~p)~n" - "Encoding (reply) exception: ~p", - [?LINE, Hdr, Exception], ?DEBUG_LEVEL), - marshal_exception(Env, Hdr#request_header.request_id, Exception, Func); - {'EXIT', E} -> - orber:dbg("[~p] orber_iiop_inrequest:evaluate(~p)~n" - "Encode (reply) resulted in: ~p", - [?LINE, Hdr, E], ?DEBUG_LEVEL), - marshal_exception(Env, Hdr#request_header.request_id, - #'MARSHAL'{completion_status=?COMPLETED_YES}, Func); - R -> - R - end; -evaluate(#giop_env{version = {1,2}} = Env, Hdr, {'location_forward_perm', NewIOR}, _, - Func, _)-> - case catch cdr_encode:Func(#giop_env{version = {1,2}, - request_id = Hdr#request_header.request_id, - reply_status = 'location_forward_perm', - tc = {{'tk_objref', "", ""}, [],[]}, - result = NewIOR}) of - {'EXCEPTION', Exception} -> - orber:dbg("[~p] orber_iiop_inrequest:evaluate(~p) " ++ - "Encoding (reply) exception: ~p", - [?LINE, Hdr, Exception], ?DEBUG_LEVEL), - marshal_exception(Env, Hdr#request_header.request_id, Exception, Func); - {'EXIT', E} -> - orber:dbg("[~p] orber_iiop_inrequest:evaluate(~p) " ++ - "Encode (reply) resulted in: ~p", - [?LINE, Hdr, E], ?DEBUG_LEVEL), - marshal_exception(Env, Hdr#request_header.request_id, - #'MARSHAL'{completion_status=?COMPLETED_YES}, Func); - R -> - R - end; -evaluate(Env, Hdr, [Res |OutPar], TypeCodes, Func, Type) -> - case catch cdr_encode:Func(Env#giop_env{request_id = Hdr#request_header.request_id, - reply_status = Type, - tc = TypeCodes, result = Res, - parameters = OutPar}) of - {'EXCEPTION', Exception} -> - orber:dbg("[~p] orber_iiop_inrequest:evaluate(~p, ~p, ~p)~n" - "Encode exception: ~p", - [?LINE, Hdr, Res, OutPar, Exception], ?DEBUG_LEVEL), - marshal_exception(Env, Hdr#request_header.request_id, Exception, Func); - {'EXIT', E} -> - orber:dbg("[~p] orber_iiop_inrequest:evaluate(~p, ~p, ~p)~n" - "Encode exit: ~p", - [?LINE, Hdr, Res, OutPar, E], ?DEBUG_LEVEL), - marshal_exception(Env, Hdr#request_header.request_id, - #'MARSHAL'{completion_status=?COMPLETED_YES}, Func); - R -> - R - end; -evaluate(Env, Hdr, What, TypeCodes, Func, _) -> - orber:dbg("[~p] orber_iiop_inrequest:evaluate(~p)~n" - "Bad reply: ~p~n" - "Should be: ~p~n" - "GIOP Env : ~p", [?LINE, Hdr, What, TypeCodes, Env], ?DEBUG_LEVEL), - marshal_exception(Env, Hdr#request_header.request_id, - #'INTERNAL'{completion_status=?COMPLETED_MAYBE}, Func). - -%%----------------------------------------------------------------- -%% Utility Functions -%%----------------------------------------------------------------- -result_to_list({'oe_location_forward_perm', NewIOR}, _) -> - {'location_forward_perm', NewIOR}; -result_to_list({'EXCEPTION', E}, _) -> - {'EXCEPTION', E}; -result_to_list(Result, {_TkRes, _, []}) -> - [Result]; -result_to_list(Result, {_TkRes, _, _TkOut}) -> - tuple_to_list(Result). - -marshal_exception(Env, Id, Exception, Func) -> - {TypeOfException, ExceptionTypeCode, NewExc} = - orber_exceptions:get_def(Exception), - cdr_encode:Func(Env#giop_env{request_id = Id, - reply_status = TypeOfException, - tc = {ExceptionTypeCode, [], []}, - result = NewExc}). - -marshal_locate_exception(#giop_env{version = {1,2}} = Env, Id, Exception) -> - case orber_exceptions:get_def(Exception) of - {?SYSTEM_EXCEPTION, ExceptionTypeCode, NewExc} -> - cdr_encode:enc_locate_reply( - Env#giop_env{request_id = Id, - reply_status = 'loc_system_exception', - tc = ExceptionTypeCode, result = NewExc}); - _ -> - %% This case is impossible (i.e. Orber only throws system - %% exceptions). But to be on the safe side... - marshal_locate_exception(Env, Id, #'MARSHAL' - {completion_status=?COMPLETED_YES}) - end; -marshal_locate_exception(Env, _Id, _Exception) -> - %% There is no way to define an exception for IIOP-1.0/1.1 in a - %% locate_reply. - cdr_encode:enc_message_error(Env). diff --git a/lib/orber/src/orber_iiop_insup.erl b/lib/orber/src/orber_iiop_insup.erl deleted file mode 100644 index 2885cf06c0..0000000000 --- a/lib/orber/src/orber_iiop_insup.erl +++ /dev/null @@ -1,86 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: orber_iiop_insup.erl -%% -%% Description: -%% This file contains the IIOP communication supervisor which -%% holds all active "in proxies" -%% -%%----------------------------------------------------------------- --module(orber_iiop_insup). - --behaviour(supervisor). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([start/2, start_connection/4]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([init/1, terminate/2]). - -%%----------------------------------------------------------------- -%% External interface functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: start/2 -%%----------------------------------------------------------------- -start(sup, Opts) -> - supervisor:start_link({local, orber_iiop_insup}, orber_iiop_insup, - {sup, Opts}); -start(_A1, _A2) -> - ok. - - -%%----------------------------------------------------------------- -%% Server functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: init/1 -%%----------------------------------------------------------------- -init({sup, _Opts}) -> - SupFlags = {simple_one_for_one, 500, 100}, - ChildSpec = [ - {name1, {orber_iiop_inproxy, start, []}, temporary, - 10000, worker, [orber_iiop_inproxy]} - ], - {ok, {SupFlags, ChildSpec}}; -init(_Opts) -> - {ok, []}. - - -%%----------------------------------------------------------------- -%% Func: terminate/1 -%%----------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------------- -%% Func: start_connection/2 -%%----------------------------------------------------------------- -start_connection(Type, Socket, Ref, ProxyOptions) -> - supervisor:start_child(orber_iiop_insup, [{connect, Type, Socket, - Ref, ProxyOptions}]). - diff --git a/lib/orber/src/orber_iiop_net.erl b/lib/orber/src/orber_iiop_net.erl deleted file mode 100644 index e7f54891a2..0000000000 --- a/lib/orber/src/orber_iiop_net.erl +++ /dev/null @@ -1,511 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: orber_iiop_net.erl -%% -%% Description: -%% This file contains the IIOP communication server -%% -%%----------------------------------------------------------------- --module(orber_iiop_net). - --behaviour(gen_server). - --include_lib("orber/src/orber_iiop.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([start/1, connect/5, connections/0, - sockname2peername/2, peername2sockname/2, - add_connection/5, - add/3, remove/1, reconfigure/1, reconfigure/2]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([init/1, terminate/2, handle_call/3, - handle_cast/2, handle_info/2, code_change/3]). - -%%----------------------------------------------------------------- -%% Server state record and definitions -%%----------------------------------------------------------------- --define(CONNECTION_DB, orber_iiop_net_db). - --record(state, {ports=[], max_connections, db, counter = 1, queue}). - --record(connection, {pid, socket, type, peerdata, localdata, ref = 0}). - --record(listen, {pid, socket, port, type, ref = 0, options, proxy_options = []}). - -%%----------------------------------------------------------------- -%% External interface functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: start/1 -%%----------------------------------------------------------------- -start(Opts) -> - gen_server:start_link({local, orber_iiop_net}, orber_iiop_net, Opts, []). - -add(IP, normal, Options) -> - Port = orber_tb:keysearch(iiop_port, Options, orber_env:iiop_port()), - gen_server:call(orber_iiop_net, {add, IP, normal, Port, Options}, infinity); -add(IP, ssl, Options) -> - Port = orber_tb:keysearch(iiop_ssl_port, Options, orber_env:iiop_ssl_port()), - gen_server:call(orber_iiop_net, {add, IP, ssl, Port, Options}, infinity). - -remove(Ref) -> - gen_server:call(orber_iiop_net, {remove, Ref}, infinity). - -reconfigure(Options) -> - lists:foreach(fun(P) -> - P ! {reconfigure, Options} - end, - do_select([{#connection{pid = '$1', _='_'}, - [], ['$1']}])). - -reconfigure(Options, Ref) -> - case do_select([{#connection{ref = Ref, pid = '$1', _='_'}, - [], ['$1']}]) of - [Pid] when is_pid(Pid) -> - Pid ! {reconfigure, Options}, - ok; - _ -> - {error, "No proxy matched the supplied reference"} - end. - -connect(Type, S, AcceptPid, Ref, ProxyOptions) -> - gen_server:call(orber_iiop_net, {connect, Type, S, AcceptPid, - Ref, ProxyOptions}, infinity). - -connections() -> - do_select([{#connection{peerdata = '$1', _='_'}, [], ['$1']}]). - -sockname2peername(SockHost, SockPort) -> - do_select([{#connection{peerdata = '$1', - localdata = {match_type(SockHost), - match_type(SockPort)}, - _='_'}, [], ['$1']}]). - - -peername2sockname(PeerHost, PeerPort) -> - do_select([{#connection{peerdata = {match_type(PeerHost), - match_type(PeerPort)}, - localdata = '$1', - _='_'}, [], ['$1']}]). - -do_select(Pattern) -> - case catch ets:select(?CONNECTION_DB, Pattern) of - {'EXIT', _What} -> - []; - Result -> - Result - end. - -match_type(0) -> - %% Wildcard port number - '_'; -match_type("") -> - %% Wildcard host - '_'; -match_type(Key) -> - %% Wildcard not used. - Key. - -add_connection(Socket, Type, PeerData, LocalData, Ref) -> - ets:insert(?CONNECTION_DB, #connection{pid = self(), socket = Socket, - type = Type, peerdata = PeerData, - localdata = LocalData, ref = Ref}). - -%%----------------------------------------------------------------- -%% Server functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: init/1 -%%----------------------------------------------------------------- -init(Options) -> - process_flag(trap_exit, true), - {ok, parse_options(Options, - #state{max_connections = orber:iiop_max_in_connections(), - db = ets:new(?CONNECTION_DB, [set, public, - named_table, - {keypos, 2}]), - queue = queue:new()})}. - -%%----------------------------------------------------------------- -%% Func: terminate/1 -%%----------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------------- -%% Func: get_options/2 -%%----------------------------------------------------------------- -get_options(normal, _Options) -> - []; -get_options(ssl, Options) -> - SSLOpts = - case orber_tb:keysearch(ssl_server_options, Options, - orber_env:ssl_server_options()) of - [] -> - Verify = orber_tb:keysearch(ssl_server_verify, Options, - orber_env:ssl_server_verify()), - Depth = orber_tb:keysearch(ssl_server_depth, Options, - orber_env:ssl_server_depth()), - Cert = orber_tb:keysearch(ssl_server_certfile, Options, - orber_env:ssl_server_certfile()), - CaCert = orber_tb:keysearch(ssl_server_cacertfile, Options, - orber_env:ssl_server_cacertfile()), - Pwd = orber_tb:keysearch(ssl_server_password, Options, - orber_env:ssl_server_password()), - Key = orber_tb:keysearch(ssl_server_keyfile, Options, - orber_env:ssl_server_keyfile()), - Ciphers = orber_tb:keysearch(ssl_server_ciphers, Options, - orber_env:ssl_server_ciphers()), - Timeout = orber_tb:keysearch(ssl_server_cachetimeout, Options, - orber_env:ssl_server_cachetimeout()), - KeepAlive = orber_tb:keysearch(ssl_server_cachetimeout, Options, - orber_env:iiop_ssl_in_keepalive()), - [{verify, Verify}, - {depth, Depth}, - {certfile, Cert}, - {cacertfile, CaCert}, - {password, Pwd}, - {keyfile, Key}, - {ciphers, Ciphers}, - {cachetimeout, Timeout}, - {keepalive, KeepAlive}]; - Opts -> - case orber_tb:check_illegal_tcp_options(Opts) of - ok -> - check_old_ssl_server_options(Options), - Opts; - {error, IllegalOpts} -> - error_logger:error_report([{application, orber}, - "TCP options not allowed to set on a connection", - IllegalOpts]), - error("Illegal TCP option") - end - end, - ssl_server_extra_options(SSLOpts, []). - -%%----------------------------------------------------------------- -%% Func: parse_options/2 -%%----------------------------------------------------------------- -parse_options([{port, Type, Port} | Rest], State) -> - Options = get_options(Type, []), - Family = orber_env:ip_version(), - IPFamilyOptions = - case Family of - inet -> [inet]; - inet6 -> [inet6, {ipv6_v6only, true}] - end, - Options2 = - case orber_env:ip_address_variable_defined() of - false -> - IPFamilyOptions ++ Options; - Host -> - {ok, IP} = inet:getaddr(Host, Family), - IPFamilyOptions ++ [{ip, IP} |Options] - end, - - {ok, Listen, NewPort} = orber_socket:listen(Type, Port, Options2, true), - {ok, Pid} = orber_iiop_socketsup:start_accept(Type, Listen, 0), - link(Pid), - ets:insert(?CONNECTION_DB, #listen{pid = Pid, socket = Listen, - port = NewPort, type = Type, - options = Options2}), - parse_options(Rest, State); -parse_options([], State) -> - State. - -ssl_server_extra_options([], Acc) -> - Acc; -ssl_server_extra_options([{_Type, []}|T], Acc) -> - ssl_server_extra_options(T, Acc); -ssl_server_extra_options([{_Type, infinity}|T], Acc) -> - ssl_server_extra_options(T, Acc); -ssl_server_extra_options([{Type, Value}|T], Acc) -> - ssl_server_extra_options(T, [{Type, Value}|Acc]). - -filter_options([], Acc) -> - Acc; -filter_options([{verify, _}|T], Acc) -> - filter_options(T, Acc); -filter_options([{depth, _}|T], Acc) -> - filter_options(T, Acc); -filter_options([{certfile, _}|T], Acc) -> - filter_options(T, Acc); -filter_options([{cacertfile, _}|T], Acc) -> - filter_options(T, Acc); -filter_options([{password, _}|T], Acc) -> - filter_options(T, Acc); -filter_options([{keyfile, _}|T], Acc) -> - filter_options(T, Acc); -filter_options([{ciphers, _}|T], Acc) -> - filter_options(T, Acc); -filter_options([{cachetimeout, _}|T], Acc) -> - filter_options(T, Acc); -filter_options([H|T], Acc) -> - filter_options(T, [H|Acc]). - -%%----------------------------------------------------------------- -%% Func: handle_call/3 -%%----------------------------------------------------------------- -handle_call({remove, Ref}, _From, State) -> - case do_select([{#listen{ref = Ref, pid = '$1', socket = '$2', - type = '$3', _='_'}, [], [{{'$1', '$2', '$3'}}]}]) of - [{Pid, Listen, Type}|_] when is_pid(Pid) -> - unlink(Pid), - ets:delete(?CONNECTION_DB, Pid), - %% Just close the listen socket. Will cause the accept processs - %% to terminate. - orber_socket:close(Type, Listen), - stop_proxies(do_select([{#connection{ref = Ref, pid = '$1', _='_'}, - [], ['$1']}])), - {reply, ok, - State#state{queue = - from_list( - lists:keydelete(Pid, 1, - queue:to_list(State#state.queue)))}}; - _ -> - {reply, ok, State} - end; -handle_call({add, IP, Type, Port, AllOptions}, _From, State) -> - Family = orber_tb:keysearch(ip_family, AllOptions, orber_env:ip_version()), - IPFamilyOptions = - case Family of - inet -> [inet]; - inet6 -> [inet6, {ipv6_v6only, true}] - end, - case inet:getaddr(IP, Family) of - {ok, IPTuple} -> - try - Options = IPFamilyOptions ++ [{ip, IPTuple} |get_options(Type, AllOptions)], - Ref = make_ref(), - ProxyOptions = filter_options(AllOptions, []), - case orber_socket:listen(Type, Port, Options, false) of - {ok, Listen, NewPort} -> - {ok, Pid} = orber_iiop_socketsup:start_accept(Type, Listen, Ref, - ProxyOptions), - link(Pid), - ets:insert(?CONNECTION_DB, #listen{pid = Pid, - socket = Listen, - port = NewPort, - type = Type, ref = Ref, - options = Options, - proxy_options = ProxyOptions}), - {reply, {ok, Ref}, State}; - Error -> - {reply, Error, State} - end - catch - error:Reason -> - {reply, {error, Reason}, State} - end; - Other -> - {reply, Other, State} - end; -handle_call({connect, Type, Socket, _AcceptPid, AccepRef, ProxyOptions}, _From, State) - when State#state.max_connections == infinity; - State#state.max_connections > State#state.counter -> - case catch access_allowed(Type, Socket, Type) of - true -> - case orber_iiop_insup:start_connection(Type, Socket, - AccepRef, ProxyOptions) of - {ok, Pid} when is_pid(Pid) -> - link(Pid), - {reply, {ok, Pid, true}, update_counter(State, 1)}; - Other -> - {reply, Other, State} - end; - _ -> - {H, P} = orber_socket:peerdata(Type, Socket), - orber_tb:info("Blocked connect attempt from ~s - ~p", [H, P]), - {reply, denied, State} - end; -handle_call({connect, Type, Socket, AcceptPid, AccepRef, ProxyOptions}, _From, - #state{queue = Q} = State) -> - case catch access_allowed(Type, Socket, Type) of - true -> - case orber_iiop_insup:start_connection(Type, Socket, - AccepRef, ProxyOptions) of - {ok, Pid} when is_pid(Pid) -> - link(Pid), - Ref = erlang:make_ref(), - {reply, {ok, Pid, Ref}, - update_counter(State#state{queue = - queue:in({AcceptPid, Ref}, Q)}, 1)}; - Other -> - {reply, Other, State} - end; - _ -> - {H, P} = orber_socket:peerdata(Type, Socket), - orber_tb:info("Blocked connect attempt from ~s - ~p", [H, P]), - {reply, denied, State} - end; -handle_call(_, _, State) -> - {noreply, State}. - -stop_proxies([H|T]) -> - catch orber_iiop_inproxy:stop(H), - stop_proxies(T); -stop_proxies([]) -> - ok. - -access_allowed(Type, Socket, Type) -> - Flags = orber:get_flags(), - case ?ORB_FLAG_TEST(Flags, ?ORB_ENV_USE_ACL_INCOMING) of - false -> - true; - true -> - SearchFor = - case Type of - normal -> - tcp_in; - ssl -> - ssl_in - end, - {ok, {Host, Port}} = orber_socket:peername(Type, Socket), - case orber_acl:match(Host, SearchFor, true) of - {true, [], 0} -> - true; - {true, [], Port} -> - true; - {true, [], {Min, Max}} when Port >= Min, Port =< Max -> - true; - {true, Interfaces, 0} -> - get_sockethost(Type, Socket), - lists:member(get_sockethost(Type, Socket), Interfaces); - {true, Interfaces, Port} -> - lists:member(get_sockethost(Type, Socket), Interfaces); - {true, Interfaces, {Min, Max}} when Port >= Min, Port =< Max -> - lists:member(get_sockethost(Type, Socket), Interfaces); - _ -> - false - end - end. - -get_sockethost(Type, Socket) -> - case orber_socket:peername(Type, Socket) of - {ok, {Addr, _Port}} -> - orber_env:addr2str(Addr); - _ -> - false - end. - -%%------------------------------------------------------------ -%% Standard gen_server cast handle -%%------------------------------------------------------------ -handle_cast(_, State) -> - {noreply, State}. - -%%------------------------------------------------------------ -%% Standard gen_server handles -%%------------------------------------------------------------ -handle_info({'EXIT', Pid, _Reason}, State) when is_pid(Pid) -> - case ets:lookup(?CONNECTION_DB, Pid) of - [#listen{pid = Pid, socket = Listen, port = Port, type = Type, - ref = Ref, options = Options, proxy_options = POpts}] -> - ets:delete(?CONNECTION_DB, Pid), - unlink(Pid), - {ok, NewPid} = orber_iiop_socketsup:start_accept(Type, Listen, - Ref, POpts), - link(NewPid), - ets:insert(?CONNECTION_DB, #listen{pid = NewPid, socket = Listen, - port = Port, type = Type, - ref = Ref, options = Options, - proxy_options = POpts}), - %% Remove the connection if it's in the queue. - {noreply, - State#state{queue = - from_list( - lists:keydelete(Pid, 1, - queue:to_list(State#state.queue)))}}; - [#connection{pid = Pid}] -> - ets:delete(?CONNECTION_DB, Pid), - unlink(Pid), - case queue:out(State#state.queue) of - {empty, _} -> - {noreply, update_counter(State, -1)}; - {{value, {AcceptPid, Ref}}, Q} -> - AcceptPid ! {Ref, ok}, - {noreply, update_counter(State#state{queue = Q}, -1)} - end; - [] -> - {noreply, State} - end; -handle_info(_, State) -> - {noreply, State}. - -from_list(List) -> - from_list(List, queue:new()). - -from_list([], Q) -> - Q; -from_list([H|T], Q) -> - NewQ = queue:in(H, Q), - from_list(T, NewQ). - - -%%----------------------------------------------------------------- -%% Func: code_change/3 -%%----------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%----------------------------------------------------------------- -%% Internal Functions -%%----------------------------------------------------------------- -update_counter(#state{max_connections = infinity} = State, _) -> - State; -update_counter(State, Value) -> - State#state{counter = State#state.counter + Value}. - - -check_old_ssl_server_options(Options) -> - try - 0 = orber_tb:keysearch(ssl_server_verify, Options, - orber_env:ssl_server_verify()), - 1 = orber_tb:keysearch(ssl_server_depth, Options, - orber_env:ssl_server_depth()), - [] = orber_tb:keysearch(ssl_server_certfile, Options, - orber_env:ssl_server_certfile()), - [] = orber_tb:keysearch(ssl_server_cacertfile, Options, - orber_env:ssl_server_cacertfile()), - [] = orber_tb:keysearch(ssl_server_password, Options, - orber_env:ssl_server_password()), - [] = orber_tb:keysearch(ssl_server_keyfile, Options, - orber_env:ssl_server_keyfile()), - [] = orber_tb:keysearch(ssl_server_ciphers, Options, - orber_env:ssl_server_ciphers()), - infinity = orber_tb:keysearch(ssl_server_cachetimeout, Options, - orber_env:ssl_server_cachetimeout()), - false = orber_tb:keysearch(iiop_ssl_in_keepalive, Options, - orber_env:iiop_ssl_in_keepalive()) - catch - _:_ -> - io:format("hej\n",[]), - error_logger:warning_report([{application, orber}, - "Ignoring deprecated ssl server options used together with the ssl_server_options"]) - end. - diff --git a/lib/orber/src/orber_iiop_net_accept.erl b/lib/orber/src/orber_iiop_net_accept.erl deleted file mode 100644 index 2a53d55cea..0000000000 --- a/lib/orber/src/orber_iiop_net_accept.erl +++ /dev/null @@ -1,95 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: orber_iiop_net_accept.erl -%% -%% Description: -%% This file contains the process which are waiting in accept for new -%% connections. -%% -%% -%%----------------------------------------------------------------- --module(orber_iiop_net_accept). - - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([start/4]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([net_accept/5]). - -%%----------------------------------------------------------------- -%% External interface functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: start/2 -%%----------------------------------------------------------------- -start(Type, Listen, Ref, ProxyOptions) -> - Pid = proc_lib:spawn_link(?MODULE, net_accept, - [Type, Listen, self(), Ref, ProxyOptions]), - {ok, Pid}. - -%%----------------------------------------------------------------- -%% Internal Functions -%%----------------------------------------------------------------- - -%%----------------------------------------------------------------- -%% Func: net_accept/3 -%%----------------------------------------------------------------- -net_accept(Type, ListenFd, Parent, Ref, ProxyOptions) -> - case catch orber_socket:accept(Type, ListenFd) of - {'EXCEPTION', _E} -> - ok; - S -> - case orber_iiop_net:connect(Type, S, self(), Ref, ProxyOptions) of - {ok, Pid, ReadyToGo} -> - case orber_socket:controlling_process(Type, S, Pid) of - ok -> - orber_iiop_inproxy:post_accept(Pid, Type, S); - _Reason -> - orber_socket:close(Type, S), - gen_server:cast(Pid, stop), - orber_socket:clear(Type, S) - end, - ready_to_go(ReadyToGo); - denied -> - orber_socket:close(Type, S), - orber_socket:clear(Type, S); - _ -> - orber_socket:close(Type, S), - orber_socket:clear(Type, S) - end, - net_accept(Type, ListenFd, Parent, Ref, ProxyOptions) - end. - -ready_to_go(true) -> - ok; -ready_to_go(Ref) -> - receive - {Ref, ok} -> - ok - end. - diff --git a/lib/orber/src/orber_iiop_outproxy.erl b/lib/orber/src/orber_iiop_outproxy.erl deleted file mode 100644 index 1406a1ad56..0000000000 --- a/lib/orber/src/orber_iiop_outproxy.erl +++ /dev/null @@ -1,511 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: orber_iiop_outproxy.erl -%% -%% Description: -%% This file contains the IIOP "proxy" for outgoing connections -%% -%% -%%----------------------------------------------------------------- --module(orber_iiop_outproxy). - --behaviour(gen_server). - --include_lib("orber/src/orber_iiop.hrl"). --include_lib("orber/include/corba.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([start/0, start/1, request/5, cancel/2, cancel/3]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([init/1, handle_call/3, handle_cast/2, handle_info/2, - code_change/3, terminate/2, stop/2, stop/1, checkheaders/1]). - -%%----------------------------------------------------------------- -%% Macros/Defines -%%----------------------------------------------------------------- --define(DEBUG_LEVEL, 7). - --record(state, {stype, socket, db, timeout, client_timeout, host, port, parent, - error_reason = {'EXCEPTION', #'COMM_FAILURE' - {completion_status=?COMPLETED_MAYBE}}}). - -%%----------------------------------------------------------------- -%% External interface functions -%%----------------------------------------------------------------- -start() -> - ignore. - -start(Opts) -> - gen_server:start_link(orber_iiop_outproxy, Opts, []). - -request(Pid, true, Timeout, Msg, RequestId) -> - %% Why not simply use gen_server:call? We must be able to receive - %% more than one reply (i.e. fragmented messages). - MRef = erlang:monitor(process, Pid), - gen_server:cast(Pid, {request, Timeout, Msg, RequestId, self(), MRef}), - receive - {MRef, Reply} -> - erlang:demonitor(MRef, [flush]), - Reply; - {'DOWN', MRef, _, Pid, _Reason} when is_pid(Pid) -> - receive - %% Clear EXIT message from queue - {'EXIT', _Pid, _What} -> - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_MAYBE}) - after 0 -> - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_MAYBE}) - end; - {fragmented, GIOPHdr, Bytes, RequestId, MRef} -> - collect_fragments(GIOPHdr, [], Bytes, Pid, RequestId, MRef) - end; -request(Pid, _, _, Msg, _RequestId) -> - %% No response expected - gen_server:cast(Pid, {oneway_request, Msg}). - -cancel(Pid, RequestId) -> - gen_server:cast(Pid, {cancel, RequestId}). - -cancel(Pid, RequestId, MRef) -> - gen_server:cast(Pid, {cancel, RequestId, MRef, self()}). - -%%----------------------------------------------------------------- -%% Internal interface functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: stop/2 -%%----------------------------------------------------------------- -stop(Pid, Timeout) -> - gen_server:call(Pid, stop, Timeout). -stop(Pid) -> - gen_server:cast(Pid, stop). - - -%%----------------------------------------------------------------- -%% Server functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: init/1 -%%----------------------------------------------------------------- -init({connect, Host, Port, SocketType, SocketOptions, Parent, Key, NewKey}) -> - process_flag(trap_exit, true), - case catch orber_socket:connect(SocketType, Host, Port, - orber_socket:get_ip_family_opts(Host) ++ SocketOptions) of - {'EXCEPTION', _E} -> - ignore; - %% We used to reply the below but since this would generate a CRASH REPORT - %% if '-boot start_sasl' used. Due to a request to change this behaviour - %% we did. - %% {stop, {'EXCEPTION', E}}; - Socket -> - SockData = orber_socket:sockdata(SocketType, Socket), - orber_iiop_pm:add_connection(Key, NewKey, SockData), - Timeout = orber:iiop_connection_timeout(), - {ok, #state{stype = SocketType, socket = Socket, - db = ets:new(orber_outgoing_requests, [set]), - timeout = Timeout, client_timeout = orber:iiop_timeout(), - host = Host, port = Port, parent = Parent}, Timeout} - end. - -%%----------------------------------------------------------------- -%% Func: terminate/2 -%%----------------------------------------------------------------- -terminate(_Reason, #state{db = OutRequests, error_reason = ER}) -> - %% Kill all proxies and delete table before terminating - notify_clients(OutRequests, ets:first(OutRequests), ER), - ets:delete(OutRequests), - ok. - -notify_clients(_, '$end_of_table', _ER) -> - ok; -notify_clients(OutRequests, Key, ER) -> - case ets:lookup(OutRequests, Key) of - [{_, Pid, TRef, MRef}] -> - cancel_timer(TRef), - Pid ! {MRef, ER}, - notify_clients(OutRequests, ets:next(OutRequests, Key), ER) - end. - -%%----------------------------------------------------------------- -%% Func: handle_call/3 -%%----------------------------------------------------------------- -handle_call(stop, _From, State) -> - {stop, normal, ok, State}; -handle_call(X, From, State) -> - orber:dbg("[~p] orber_iiop_outproxy:handle_call(~p);~n" - "Un-recognized call from ~p", [?LINE, X, From], ?DEBUG_LEVEL), - {noreply, State, State#state.timeout}. - -%%----------------------------------------------------------------- -%% Func: handle_cast/2 -%%----------------------------------------------------------------- -handle_cast({request, Timeout, Msg, RequestId, From, MRef}, - #state{client_timeout = DefaultTimeout} = State) -> - orber_socket:write(State#state.stype, State#state.socket, Msg), - true = ets:insert(State#state.db, {RequestId, From, - start_timer(Timeout, DefaultTimeout, RequestId), - MRef}), - {noreply, State, State#state.timeout}; -handle_cast({oneway_request, Msg}, State) -> - orber_socket:write(State#state.stype, State#state.socket, Msg), - {noreply, State, State#state.timeout}; -handle_cast({cancel, ReqId}, State) -> - case ets:lookup(State#state.db, ReqId) of - [{ReqId, _From, TRef, _MRef}] -> - cancel_timer(TRef), - ets:delete(State#state.db, ReqId), - orber:dbg("[~p] orber_iiop_outproxy:handle_info(~p);~n" - "Request cancelled", [?LINE, State], ?DEBUG_LEVEL), - {noreply, State, State#state.timeout}; - _ -> - {noreply, State, State#state.timeout} - end; -handle_cast({cancel, ReqId, MRef, From}, State) -> - case ets:lookup(State#state.db, ReqId) of - [{ReqId, From, TRef, MRef}] -> - cancel_timer(TRef), - ets:delete(State#state.db, ReqId), - From ! {MRef, ReqId, cancelled}, - orber:dbg("[~p] orber_iiop_outproxy:handle_info(~p); -Request cancelled", [?LINE, State], ?DEBUG_LEVEL), - {noreply, State, State#state.timeout}; - _ -> - From ! {MRef, ReqId, cancelled}, - {noreply, State, State#state.timeout} - end; -handle_cast(stop, State) -> - {stop, normal, State}; -handle_cast(X, State) -> - orber:dbg("[~p] orber_iiop_outproxy:handle_cast(~p); -Un-recognized cast.", [?LINE, X], ?DEBUG_LEVEL), - {noreply, State, State#state.timeout}. - -%%----------------------------------------------------------------- -%% Func: handle_info/2 -%%----------------------------------------------------------------- -handle_info({tcp, _Socket, Bytes}, State) -> - handle_reply(Bytes, State); -handle_info({ssl, _Socket, Bytes}, State) -> - handle_reply(Bytes, State); -handle_info({tcp_closed, _Socket}, State) -> - {stop, normal, State}; -handle_info({ssl_closed, _Socket}, State) -> - {stop, normal, State}; -handle_info({tcp_error, Socket, Reason}, #state{socket = Socket, host = Host, - port = Port} = State) -> - orber:error("[~p] IIOP proxy received the TCP error message: ~p~n" - "The server-side ORB is located at '~p:~p'~n" - "See the gen_tcp/inet documentation for more information.", - [?LINE, Reason, Host, Port], ?DEBUG_LEVEL), - {stop, normal, State}; -handle_info({ssl_error, Socket, Reason}, #state{socket = Socket, host = Host, - port = Port} = State) -> - orber:error("[~p] IIOP proxy received the SSL error message: ~p~n" - "The server-side ORB is located at '~p:~p'~n" - "See the SSL-application documentation for more information.", - [?LINE, Reason, Host, Port], ?DEBUG_LEVEL), - {stop, normal, State}; -handle_info({timeout, _TRef, ReqId}, State) -> - case ets:lookup(State#state.db, ReqId) of - [{ReqId, Pid, _, MRef}] -> - ets:delete(State#state.db, ReqId), - Pid ! {MRef, {'EXCEPTION', #'TIMEOUT'{completion_status=?COMPLETED_MAYBE}}}, - orber:dbg("[~p] orber_iiop_outproxy:handle_info(~p, ~p);~n" - "Request timed out", - [?LINE, State#state.host, State#state.port], ?DEBUG_LEVEL), - {noreply, State, State#state.timeout}; - _ -> - {noreply, State, State#state.timeout} - end; -handle_info(stop, State) -> - {stop, normal, State}; -handle_info(timeout, State) -> - case ets:info(State#state.db, size) of - 0 -> - orber:dbg("[~p] orber_iiop_outproxy:handle_info(~p, ~p);~n" - "Outgoing connection timed out after ~p msec", - [?LINE, State#state.host, State#state.port, - State#state.timeout], ?DEBUG_LEVEL), - {stop, normal, State}; - _Amount -> - %% Still pending request, cannot close the connection. - {noreply, State, State#state.timeout} - end; -handle_info({'EXIT', Parent, Reason}, #state{parent = Parent} = State) -> - orber:dbg("[~p] orber_iiop_outproxy:handle_info(~p);~nParent terminated.", - [?LINE, Reason], ?DEBUG_LEVEL), - {stop, normal, State}; -handle_info({reconfigure, _Options}, State) -> - %% Currently there are no parameters that can be changed. - {noreply, State, State#state.timeout}; -handle_info(X, State) -> - orber:dbg("[~p] orber_iiop_outproxy:handle_info(~p);~nUn-recognized info.", - [?LINE, X], ?DEBUG_LEVEL), - {noreply, State, State#state.timeout}. - - -handle_reply(Bytes, State) -> - %% Check IIOP headers and fetch request id - case catch checkheaders(cdr_decode:dec_giop_message_header(Bytes)) of - {'reply', ReplyHeader, Rest, Len, ByteOrder} -> - case ets:lookup(State#state.db, ReplyHeader#reply_header.request_id) of - [{_, Pid, TRef, MRef}] -> - %% Send reply to the correct request process - cancel_timer(TRef), - Pid ! {MRef, {reply, ReplyHeader, Rest, Len, ByteOrder, Bytes}}, - ets:delete(State#state.db, ReplyHeader#reply_header.request_id), - {noreply, State, State#state.timeout}; - _ -> - {noreply, State, State#state.timeout} - end; - {'locate_reply', LocateReplyHeader, LocateRest, LocateLen, LocateByteOrder} -> - case ets:lookup(State#state.db, - LocateReplyHeader#locate_reply_header.request_id) of - [{_, Pid, TRef, MRef}] -> - %% Send reply to the correct request process - cancel_timer(TRef), - Pid ! {MRef, {locate_reply, LocateReplyHeader, - LocateRest, LocateLen, LocateByteOrder}}, - ets:delete(State#state.db, - LocateReplyHeader#locate_reply_header.request_id), - {noreply, State, State#state.timeout}; - _ -> - {noreply, State, State#state.timeout} - end; - {fragment, GIOPHdr, ReqId, false} -> - %% Last fragment, cancel timer and remove from DB. - case ets:lookup(State#state.db, ReqId) of - [{_, Pid, TRef, MRef}] -> - cancel_timer(TRef), - Pid ! {fragment, GIOPHdr, ReqId, MRef}, - ets:delete(State#state.db, ReqId), - {noreply, State, State#state.timeout}; - _ -> - %% Probably cancelled - {noreply, State, State#state.timeout} - end; - {fragment, GIOPHdr, ReqId, _} -> - %% More fragments expected - case ets:lookup(State#state.db, ReqId) of - [{_, Pid, _, MRef}] -> - Pid ! {fragment, GIOPHdr, ReqId, MRef}, - {noreply, State, State#state.timeout}; - _ -> - %% Probably cancelled - {noreply, State, State#state.timeout} - end; - {fragmented, GIOPHdr, ReqId} -> - %% This the initial message (i.e. a LocateReply or Reply). - case ets:lookup(State#state.db, ReqId) of - [{_, Pid, _TRef, MRef}] -> - Pid ! {fragmented, GIOPHdr, Bytes, ReqId, MRef}, - {noreply, State, State#state.timeout}; - _ -> - {noreply, State, State#state.timeout} - end; - {'EXCEPTION', DecodeException} -> - orber:dbg("[~p] orber_iiop_outproxy:handle_reply(~p); decode exception(~p).", - [?LINE, Bytes, DecodeException], ?DEBUG_LEVEL), - {noreply, State, State#state.timeout}; - {'EXIT', message_error} -> - orber:dbg("[~p] orber_iiop_outproxy:handle_reply(~p); message error.", - [?LINE, Bytes], ?DEBUG_LEVEL), - ME = cdr_encode:enc_message_error(#giop_env{version = - orber:giop_version()}), - orber_socket:write(State#state.stype, State#state.socket, ME), - {noreply, State, State#state.timeout}; - {'EXIT', R} -> - orber:dbg("[~p] orber_iiop_outproxy:handle_reply(~p); got exit(~p)", - [?LINE, Bytes, R], ?DEBUG_LEVEL), - {noreply, State, State#state.timeout}; - close_connection -> - orber:dbg("[~p] orber_iiop_outproxy:handle_reply(); -The Server-side ORB closed the connection.", [?LINE], ?DEBUG_LEVEL), - {stop, normal, State}; - {error, no_reply} -> - {noreply, State, State#state.timeout}; - X -> - orber:dbg("[~p] orber_iiop_outproxy:handle_reply(~p); message error(~p).", - [?LINE, Bytes, X], ?DEBUG_LEVEL), - {noreply, State, State#state.timeout} - end. - - -%%----------------------------------------------------------------- -%% Func: code_change/3 -%%----------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- -checkheaders(#giop_message{message_type = ?GIOP_MSG_CLOSE_CONNECTION}) -> - close_connection; -checkheaders(#giop_message{message_type = ?GIOP_MSG_FRAGMENT, - giop_version = {1,2}, - fragments = MoreFrag} = GIOPHdr) -> - %% A fragment; we must have received a Request or LocateRequest - %% with fragment-flag set to true. - %% We need to decode the header to get the request-id. - ReqId = cdr_decode:peek_request_id(GIOPHdr#giop_message.byte_order, - GIOPHdr#giop_message.message), - {fragment, GIOPHdr, ReqId, MoreFrag}; -checkheaders(#giop_message{fragments = true, - giop_version = {1,2}} = GIOPHdr) -> - %% Must be a Reply or LocateReply which have been fragmented. - %% We need to decode the header to get the request-id. - ReqId = cdr_decode:peek_request_id(GIOPHdr#giop_message.byte_order, - GIOPHdr#giop_message.message), - {fragmented, GIOPHdr, ReqId}; -checkheaders(#giop_message{fragments = false, - message_type = ?GIOP_MSG_REPLY} = GIOPHdr) -> - {ReplyHeader, Rest, Len} = - cdr_decode:dec_reply_header(GIOPHdr#giop_message.giop_version, - GIOPHdr#giop_message.message, - ?GIOP_HEADER_SIZE, - GIOPHdr#giop_message.byte_order), - {'reply', ReplyHeader, Rest, Len, GIOPHdr#giop_message.byte_order}; -checkheaders(#giop_message{fragments = false, - message_type = ?GIOP_MSG_LOCATE_REPLY} = GIOPHdr) -> - {LocateReplyHeader, Rest, Len} = - cdr_decode:dec_locate_reply_header(GIOPHdr#giop_message.giop_version, - GIOPHdr#giop_message.message, - ?GIOP_HEADER_SIZE, - GIOPHdr#giop_message.byte_order), - {'locate_reply', LocateReplyHeader, Rest, Len, GIOPHdr#giop_message.byte_order}; -checkheaders(What) -> - orber:dbg("[~p] orber_iiop_outproxy:checkheaders(~p) -Un-recognized GIOP header.", [?LINE, What], ?DEBUG_LEVEL), - {error, no_reply}. - - -cancel_timer(infinity) -> - ok; -cancel_timer(TRef) -> - erlang:cancel_timer(TRef). - -start_timer(infinity, infinity, _) -> - infinity; -start_timer(infinity, Timeout, RequestId) -> - erlang:start_timer(Timeout, self(), RequestId); -start_timer(Timeout, _, RequestId) -> - erlang:start_timer(Timeout, self(), RequestId). - - - -collect_fragments(GIOPHdr1, InBuffer, Bytes, Proxy, RequestId, MRef) -> - receive - %% There are more framents to come; just collect this message and wait for - %% the rest. - {fragment, #giop_message{byte_order = _ByteOrder, - message = Message, - fragments = true} = GIOPHdr2, RequestId, MRef} -> - case catch cdr_decode:dec_message_header(null, GIOPHdr2, Message) of - {_, #fragment_header{}, FragBody, _, _} -> - collect_fragments(GIOPHdr1, [FragBody|InBuffer], - Bytes, Proxy, RequestId, MRef); - Other -> - cancel(Proxy, RequestId, MRef), - clear_queue(Proxy, RequestId, MRef), - orber:dbg("[~p] orber_iiop:collect_fragments(~p)", - [?LINE, Other], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 18), - completion_status=?COMPLETED_YES}) - end; - %% This is the last fragment. Now we can but together the fragments, decode - %% the reply and send it to the client. - {fragment, #giop_message{byte_order = ByteOrder, - message = Message} = GIOPHdr2, RequestId, MRef} -> - erlang:demonitor(MRef, [flush]), - case catch cdr_decode:dec_message_header(null, GIOPHdr2, Message) of - {_, #fragment_header{}, FragBody, _, _} -> - %% This buffer is all the fragments concatenated. - Buffer = lists:reverse([FragBody|InBuffer]), - - %% Create a GIOP-message which is exactly as if hadn't been fragmented. - NewGIOP = GIOPHdr1#giop_message - {message = list_to_binary([GIOPHdr1#giop_message.message|Buffer]), - fragments = false}, - case checkheaders(NewGIOP) of - {'reply', ReplyHeader, Rest, Len, ByteOrder} -> - %% We must keep create a copy of all bytes, as if the - %% message wasn't fragmented, to be able handle TypeCode - %% indirection. - {'reply', ReplyHeader, Rest, Len, ByteOrder, - list_to_binary([Bytes|Buffer])}; - {'locate_reply', ReplyHdr, Rest, Len, ByteOrder} -> - {'locate_reply', ReplyHdr, Rest, Len, ByteOrder}; - Error -> - orber:dbg("[~p] orber_iiop:collect_fragments(~p, ~p); -Unable to decode Reply or LocateReply header",[?LINE, NewGIOP, Error], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 18), - completion_status=?COMPLETED_YES}) - end; - Other -> - orber:dbg("[~p] orber_iiop:collect_fragments(~p);", - [?LINE, Other], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{minor=(?ORBER_VMCID bor 18), - completion_status=?COMPLETED_YES}) - end; - {MRef, {'EXCEPTION', E}} -> - orber:dbg("[~p] orber_iiop:collect_fragments(~p);", - [?LINE, E], ?DEBUG_LEVEL), - erlang:demonitor(MRef, [flush]), - corba:raise(E); - {'DOWN', MRef, _, Proxy, Reason} when is_pid(Proxy) -> - orber:dbg("[~p] orber_iiop:collect_fragments(~p);~n" - "Monitor generated a DOWN message.", - [?LINE, Reason], ?DEBUG_LEVEL), - receive - %% Clear EXIT message from queue - {'EXIT', _Proxy, _What} -> - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_MAYBE}) - after 0 -> - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_MAYBE}) - end - end. - -clear_queue(Proxy, RequestId, MRef) -> - receive - {fragment, _, RequestId, MRef} -> - clear_queue(Proxy, RequestId, MRef); - {MRef, RequestId, cancelled} -> - %% This is the last message that the proxy will send - %% after we've cancelled the request. - erlang:demonitor(MRef, [flush]), - ok; - {'DOWN', MRef, _, Proxy, _Reason} -> - %% The proxy terminated. Clear EXIT message from queue - receive - {'EXIT', Proxy, _What} -> - ok - after 0 -> - ok - end - end. - diff --git a/lib/orber/src/orber_iiop_outsup.erl b/lib/orber/src/orber_iiop_outsup.erl deleted file mode 100644 index f3627e01a0..0000000000 --- a/lib/orber/src/orber_iiop_outsup.erl +++ /dev/null @@ -1,88 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: orber_iiop_outsup.erl -%% -%% Description: -%% This file contains the outgoing IIOP communication supervisor which -%% holds all active "proxies" -%% -%%----------------------------------------------------------------- --module(orber_iiop_outsup). - --behaviour(supervisor). - - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([start/2, connect/7]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([init/1, terminate/2]). - -%%----------------------------------------------------------------- -%% External interface functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: start/2 -%%----------------------------------------------------------------- -start(sup, Opts) -> - supervisor:start_link({local, orber_iiop_outsup}, orber_iiop_outsup, - {sup, Opts}); -start(_A1, _A2) -> - ok. - - -%%----------------------------------------------------------------- -%% Server functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: init/1 -%%----------------------------------------------------------------- -init({sup, _Opts}) -> - SupFlags = {simple_one_for_one, 500, 100}, - ChildSpec = [ - {name2, {orber_iiop_outproxy, start, []}, temporary, - 10000, worker, [orber_iiop_outproxy]} - ], - {ok, {SupFlags, ChildSpec}}; -init(_Opts) -> - {ok, []}. - - -%%----------------------------------------------------------------- -%% Func: terminate/1 -%%----------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------------- -%% Func: connect/6 -%%----------------------------------------------------------------- -connect(Host, Port, SocketType, SocketOptions, Parent, Key, NewKey) -> - supervisor:start_child(orber_iiop_outsup, - [{connect, Host, Port, SocketType, - SocketOptions, Parent, Key, NewKey}]). - diff --git a/lib/orber/src/orber_iiop_pm.erl b/lib/orber/src/orber_iiop_pm.erl deleted file mode 100644 index 72084227aa..0000000000 --- a/lib/orber/src/orber_iiop_pm.erl +++ /dev/null @@ -1,894 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: orber_iiop_pm.erl -%% Description: -%% This file contains the mapping of addresses on the format {Host, Port} -%% to a proxy pid. -%% -%%----------------------------------------------------------------- --module(orber_iiop_pm). - --behaviour(gen_server). - --include_lib("orber/src/orber_iiop.hrl"). --include_lib("orber/include/corba.hrl"). --include_lib("kernel/include/inet.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([start/0, start/1]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([connect/7, - close_connection/1, close_connection/2, - list_existing_connections/0, - list_setup_connections/0, - list_all_connections/0, - init/1, handle_call/3, handle_cast/2, handle_info/2, - code_change/3, terminate/2, stop/0, setup_connection/8, - reconfigure/1, reconfigure/3, reconfigure/4, add_connection/3, - sockname2peername/2, peername2sockname/2]). - -%%----------------------------------------------------------------- -%% Macros/Defines -%%----------------------------------------------------------------- --define(DEBUG_LEVEL, 7). - --define(PM_CONNECTION_DB, orber_iiop_pm_db). - --record(state, {connections, queue}). - --record(connection, {hp, child, interceptors, slave, - flags = 0, alias = 0, socketdata = {"Unavailable", 0}}). - -%%----------------------------------------------------------------- -%% External interface functions -%%----------------------------------------------------------------- -start() -> - ignore. -start(Opts) -> - gen_server:start_link({local, 'orber_iiop_pm'}, ?MODULE, Opts, []). - - -connect(Host, Port, SocketType, Timeout, Chars, Wchars, Ctx) - when SocketType == normal -> - Key = create_key(Host, Port, Ctx), - case ets:lookup(?PM_CONNECTION_DB, Key) of - [#connection{child = connecting}] -> - gen_server:call(orber_iiop_pm, {connect, Host, Port, SocketType, - [], Chars, Wchars, Key}, Timeout); - [] -> - gen_server:call(orber_iiop_pm, {connect, Host, Port, SocketType, - [], Chars, Wchars, Key}, Timeout); - [#connection{hp = {_, _, 0}, child = P, interceptors = I}] -> - {ok, P, [], I, 0}; - [#connection{hp = {_, _, Interface}, child = P, interceptors = I}] -> - {ok, P, [], I, [Interface]} - end; -connect(Host, Port, SocketType, Timeout, Chars, Wchars, Ctx) - when SocketType == ssl -> - Key = create_key(Host, Port, Ctx), - case ets:lookup(?PM_CONNECTION_DB, Key) of - [#connection{child = connecting}] -> - SocketOptions = get_ssl_socket_options(Ctx), - gen_server:call(orber_iiop_pm, {connect, Host, Port, SocketType, - SocketOptions, Chars, Wchars, Key}, - Timeout); - [] -> - SocketOptions = get_ssl_socket_options(Ctx), - gen_server:call(orber_iiop_pm, {connect, Host, Port, SocketType, - SocketOptions, Chars, Wchars, Key}, - Timeout); - [#connection{hp = {_, _, 0}, child = P, interceptors = I}] -> - {ok, P, [], I, 0}; - [#connection{hp = {_, _, Interface}, child = P, interceptors = I}] -> - {ok, P, [], I, [Interface]} - end. - -get_ssl_socket_options([]) -> - SSLOpts = - case orber_env:ssl_client_options() of - [] -> - [{verify, orber_env:ssl_client_verify()}, - {depth, orber_env:ssl_client_depth()}, - {certfile, orber_env:ssl_client_certfile()}, - {cacertfile, orber_env:ssl_client_cacertfile()}, - {password, orber_env:ssl_client_password()}, - {keyfile, orber_env:ssl_client_keyfile()}, - {ciphers, orber_env:ssl_client_ciphers()}, - {cachetimeout, orber_env:ssl_client_cachetimeout()}, - {keepalive, orber_env:iiop_ssl_out_keepalive()}]; - Opts -> - case orber_tb:check_illegal_tcp_options(Opts) of - ok -> - check_old_ssl_client_options([]), - Opts; - {error, IllegalOpts} -> - error_logger:error_report([{application, orber}, - "TCP options not allowed to set on a connection", - IllegalOpts]), - error("Illegal TCP option") - end - end, - ssl_client_extra_options(SSLOpts, []); -get_ssl_socket_options([#'IOP_ServiceContext' - {context_id=?ORBER_GENERIC_CTX_ID, - context_data = {configuration, Options}}|_]) -> - SSLOpts = - case orber_tb:keysearch(ssl_client_options, Options, - orber_env:ssl_client_options()) of - [] -> - Verify = orber_tb:keysearch(ssl_client_verify, Options, - orber_env:ssl_client_verify()), - Depth = orber_tb:keysearch(ssl_client_depth, Options, - orber_env:ssl_client_depth()), - Cert = orber_tb:keysearch(ssl_client_certfile, Options, - orber_env:ssl_client_certfile()), - CaCert = orber_tb:keysearch(ssl_client_cacertfile, Options, - orber_env:ssl_client_cacertfile()), - Pwd = orber_tb:keysearch(ssl_client_password, Options, - orber_env:ssl_client_password()), - Key = orber_tb:keysearch(ssl_client_keyfile, Options, - orber_env:ssl_client_keyfile()), - Ciphers = orber_tb:keysearch(ssl_client_ciphers, Options, - orber_env:ssl_client_ciphers()), - Timeout = orber_tb:keysearch(ssl_client_cachetimeout, Options, - orber_env:ssl_client_cachetimeout()), - KeepAlive = orber_tb:keysearch(ssl_server_cachetimeout, Options, - orber_env:iiop_ssl_out_keepalive()), - [{verify, Verify}, - {depth, Depth}, - {certfile, Cert}, - {cacertfile, CaCert}, - {password, Pwd}, - {keyfile, Key}, - {ciphers, Ciphers}, - {cachetimeout, Timeout}, - {keepalive, KeepAlive}]; - Opts -> - case orber_tb:check_illegal_tcp_options(Opts) of - ok -> - check_old_ssl_client_options(Options), - Opts; - {error, IllegalOpts} -> - error_logger:error_report([{application, orber}, - "TCP options not allowed to set on a connection", - IllegalOpts]), - error("Illegal TCP option") - end - end, - ssl_client_extra_options(SSLOpts, []); -get_ssl_socket_options([_|T]) -> - get_ssl_socket_options(T). - - -ssl_client_extra_options([], Acc) -> - Acc; -ssl_client_extra_options([{_Type, []}|T], Acc) -> - ssl_client_extra_options(T, Acc); -ssl_client_extra_options([{_Type, infinity}|T], Acc) -> - ssl_client_extra_options(T, Acc); -ssl_client_extra_options([{Type, Value}|T], Acc) -> - ssl_client_extra_options(T, [{Type, Value}|Acc]). - -add_connection(Key, Key, SockData) -> - case ets:lookup(?PM_CONNECTION_DB, Key) of - [Connection] -> - ets:insert(?PM_CONNECTION_DB, - Connection#connection{socketdata = SockData}); - [] -> - ets:insert(?PM_CONNECTION_DB, - #connection{hp= Key, child = connecting, - socketdata = SockData}) - end; -add_connection(Key, NewKey, SockData) -> - add_connection(Key, Key, SockData), - add_connection(NewKey, NewKey, SockData). - -get_socket_data(Key) -> - case ets:lookup(?PM_CONNECTION_DB, Key) of - [#connection{socketdata = SockData}] -> - SockData; - _ -> - {"Unable to extract socket information", 0} - end. - -sockname2peername(SockHost, SockPort) -> - orber_tb:unique( - do_select([{#connection{hp = {'$1', '$2', '_'}, - socketdata = {match_type(SockHost), - match_type(SockPort)}, - _='_'}, [], [{{'$1', '$2'}}]}])). - - -peername2sockname(PeerHost, PeerPort) -> - orber_tb:unique( - do_select([{#connection{hp = {match_type(PeerHost), - match_type(PeerPort), - '_'}, - socketdata = '$1', - _='_'}, [], ['$1']}])). - -match_type(0) -> - %% Wildcard port number - '_'; -match_type("") -> - %% Wildcard host - '_'; -match_type(Key) -> - %% Wildcard not used. - Key. - -create_key(Host, Port, []) -> - {Host, Port, 0}; -create_key(Host, Port, - [#'IOP_ServiceContext' - {context_id=?ORBER_GENERIC_CTX_ID, - context_data = {interface, Interface}}|_]) when is_list(Interface) -> - {Host, Port, Interface}; -create_key(Host, Port, - [#'IOP_ServiceContext' - {context_id=?ORBER_GENERIC_CTX_ID, - context_data = {interface, Interface}}|_]) -> - orber:dbg("[~p] orber_iiop_pm:create_key(~p, ~p);~n" - "The supplied interface must be a string.", - [?LINE, Host, Port, Interface], ?DEBUG_LEVEL), - corba:raise(#'BAD_CONTEXT'{completion_status=?COMPLETED_NO}); -create_key(Host, Port, [_|T]) -> - create_key(Host, Port, T). - -reconfigure(Options) -> - {Local, Proxy} = check_options(Options, [], []), - reconfigure_local(Local), - reconfigure_proxy(Proxy). - - -reconfigure(Options, Host, Port) -> - reconfigure(Options, Host, Port, 0). -reconfigure(Options, Host, Port, Interface) -> - case ets:lookup(?PM_CONNECTION_DB, {Host, Port, Interface}) of - [#connection{child = P}] when is_pid(P) -> - case check_options(Options, [], []) of - {[], Proxy} -> - reconfigure_proxy(Proxy, [P]); - {Local, Proxy} -> - reconfigure_proxy(Proxy, [P]), - gen_server:call(orber_iiop_pm, {reconfigure, Local, - Host, Port, Interface}, infinity) - end; - _ -> - {error, "No proxy matched the supplied reference"} - end. - -reconfigure_local([]) -> - ok; -reconfigure_local(Options) -> - gen_server:call(orber_iiop_pm, {reconfigure, Options}, infinity). - -reconfigure_proxy([]) -> - ok; -reconfigure_proxy(Options) -> - reconfigure_proxy(Options, do_select([{#connection{child = '$1', _='_'}, - [], ['$1']}])). - -reconfigure_proxy(Options, [Pid|T]) -> - Pid ! {reconfigure, Options}, - reconfigure_proxy(Options, T); -reconfigure_proxy(_Options, []) -> - ok. - - -check_options([{interceptors, false}|Options], Local, Proxy) -> - check_options(Options, [{interceptors, false}|Local], Proxy); -check_options([{interceptors, {native, LPIs}}|Options], Local, Proxy) -> - check_options(Options, [{interceptors, {native, LPIs}}|Local], Proxy); -check_options([{fake, option}|Options], Local, Proxy) -> - check_options(Options, Local, [{fake, option}|Proxy]); -check_options([_|Options], Local, Proxy) -> - check_options(Options, Local, Proxy); -check_options([], Local, Proxy) -> - {Local, Proxy}. - - -close_connection(PeerData) -> - close_connection(PeerData, 0). - -close_connection(PeerData, Interface) -> - gen_server:call(orber_iiop_pm, {disconnect, PeerData, Interface}, infinity). - - -list_existing_connections() -> - transform( - lists:sort( - do_select([{#connection{hp = {'$2','$3','$4'}, child = '$1', _='_'}, - [{is_pid, '$1'}], [{{'$1', '$2','$3','$4'}}]}])), []). - -list_setup_connections() -> - transform( - lists:sort( - do_select([{#connection{hp = {'$1','$2','$3'}, child = connecting, _='_'}, [], - [{{'$1','$2','$3'}}]}])), []). - -list_all_connections() -> - transform( - lists:sort( - do_select([{#connection{hp = {'$2','$3','$4'}, child = '$1', _='_'}, [], - [{{'$1','$2','$3', '$4'}}]}])), []). - -%% Since the connections interface can be 0 or an ip-address we want to -%% transform those containing 0. -transform([{C, H, P, 0}, {C, H, P, I}|T], Acc) -> - %% ACL defined interface. Drop the anonymous one. - transform(T, [{H, P, I}|Acc]); -transform([{_C, H, P, 0}|T], Acc) -> - %% No interface supplied. Drop the 0. - transform(T, [{H, P}|Acc]); -transform([{_C, H, P, I}|T], Acc) -> - %% Interface supplied. Keep it. - transform(T, [{H, P, I}|Acc]); -transform([{H,P,0}|T], Acc) -> - transform(T, [{H,P}|Acc]); -transform([{H,P,I}|T], Acc) -> - transform(T, [{H,P,I}|Acc]); -transform([H|T], Acc) -> - transform(T, [H|Acc]); -transform([], Acc) -> - Acc. - -do_select(Pattern) -> - case catch ets:select(?PM_CONNECTION_DB, Pattern) of - {'EXIT', _What} -> - []; - Result -> - Result - end. - -%%----------------------------------------------------------------- -%% Internal interface functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: stop/0 (Only used for test purpose !!!!!!) -%%----------------------------------------------------------------- -stop() -> - gen_server:call(orber_iiop_pm, stop). - -%%----------------------------------------------------------------- -%% Server functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: init/1 -%%----------------------------------------------------------------- -init(_Opts) -> - process_flag(trap_exit, true), - {ok, #state{connections = ets:new(orber_iiop_pm_db, - [{keypos, 2}, set, public, named_table]), - queue = ets:new(orber_iiop_pm_queue, [bag])}}. - -%%----------------------------------------------------------------- -%% Func: terminate/2 -%%----------------------------------------------------------------- -terminate(_Reason, #state{queue = Q}) -> - %% Kill all proxies and close table before terminating - stop_all_proxies(ets:first(?PM_CONNECTION_DB)), - ets:delete(?PM_CONNECTION_DB), - ets:delete(Q), - ok. - -stop_all_proxies('$end_of_table') -> - ok; -stop_all_proxies(Key) -> - case ets:lookup(?PM_CONNECTION_DB, Key) of - [] -> - ok; - [#connection{child = connecting, interceptors = I}] -> - invoke_connection_closed(I); - [#connection{child = P, interceptors = I}] -> - invoke_connection_closed(I), - catch orber_iiop_outproxy:stop(P) - end, - stop_all_proxies(ets:next(?PM_CONNECTION_DB, Key)). - -%%----------------------------------------------------------------- -%% Func: handle_call/3 -%%----------------------------------------------------------------- -handle_call({connect, Host, Port, SocketType, SocketOptions, Chars, Wchars, Key}, - From, State) -> - case ets:lookup(?PM_CONNECTION_DB, Key) of - [#connection{child = connecting}] -> - %% Another client already requested a connection to the given host/port. - %% Just add this client to the queue. - ets:insert(State#state.queue, {Key, From}), - {noreply, State}; - [#connection{hp = {_,_,0}, child = P, interceptors = I}] -> - %% This case will occur if the PortMapper completed a connection - %% between the client's ets:lookup and receiving this request. - {reply, {ok, P, [], I, 0}, State}; - [#connection{hp = {_,_,Intf}, child = P, interceptors = I}] -> - %% This case will occur if the PortMapper completed a connection - %% between the client's ets:lookup and receiving this request. - {reply, {ok, P, [], I, [Intf]}, State}; - [] -> - %% The first time a connection is requested to the given host/port. - case catch spawn_link(?MODULE, setup_connection, - [self(), Host, Port, SocketType, - SocketOptions, Chars, Wchars, Key]) of - Slave when is_pid(Slave) -> - ets:insert(?PM_CONNECTION_DB, - #connection{hp = Key, child = connecting, - interceptors = false, slave = Slave}), - ets:insert(State#state.queue, {Key, From}), - {noreply, State}; - What -> - orber:dbg("[~p] orber_iiop_pm:handle_call(connect);~n" - "Unable to invoke setup_connection due to: ~n~p~n", - [?LINE, What], ?DEBUG_LEVEL), - {reply, - {'EXCEPTION', #'INTERNAL'{completion_status=?COMPLETED_NO}}, - State} - end - end; -handle_call({disconnect, PeerData, Interface}, _From, State) -> - {reply, do_disconnect(PeerData, Interface, State), State}; -handle_call({reconfigure, Options, Host, Port, Interface}, - _From, State) -> - case ets:lookup(?PM_CONNECTION_DB, {Host, Port, Interface}) of - [] -> - {reply, {error, "No proxy matched the supplied reference"}, State}; - [Connection] -> - NewConnection = update_connection(Connection, Options), - ets:insert(?PM_CONNECTION_DB, NewConnection), - {reply, ok, State} - end; -handle_call({reconfigure, Options}, _From, State) -> - case catch update_db(ets:first(?PM_CONNECTION_DB), Options) of - ok -> - {reply, ok, State}; - _What -> - {reply, {error, "Unable to change configuration"}, State} - end; -handle_call(stop, _From, State) -> - {stop, normal, ok, State}; -handle_call(_, _, State) -> - {noreply, State}. - -update_db('$end_of_table', _) -> - ok; -update_db(Key, Options) -> - [Connection] = ets:lookup(?PM_CONNECTION_DB, Key), - NewConnection = update_connection(Connection, Options), - ets:insert(?PM_CONNECTION_DB, NewConnection), - update_db(ets:next(?PM_CONNECTION_DB, Key), Options). - - -update_connection(Connection, [{interceptors, false}|Options]) -> - update_connection(Connection#connection{interceptors = false}, Options); -update_connection(#connection{interceptors = false, - hp = {PH, PP, _}, - socketdata = {SH, SP}} = Connection, - [{interceptors, {native, LPIs}}|Options]) -> - %% No Interceptor(s). Add the same Ref used by the built in interceptors. - update_connection(Connection#connection{interceptors = - {native, {PH, PP, SH, SP}, LPIs}}, - Options); -update_connection(#connection{interceptors = {native, Ref, _}} = Connection, - [{interceptors, {native, LPIs}}|Options]) -> - %% Interceptor(s) already in use. We must use the same Ref as before. - update_connection(Connection#connection{interceptors = - {native, Ref, LPIs}}, - Options); -update_connection(Connection, [H|T]) -> - orber:dbg("[~p] orber_iiop_pm:update_connection(~p, ~p)~n" - "Unable to update the connection.~n", - [?LINE, Connection, H], ?DEBUG_LEVEL), - update_connection(Connection, T); -update_connection(Connection, []) -> - Connection. - -do_disconnect([], _Interface, _State) -> - ok; -do_disconnect([{Host, Port}|T], Interface, State) -> - case ets:lookup(?PM_CONNECTION_DB, {Host, Port, Interface}) of - [] -> - ok; - [#connection{child = connecting, interceptors = I}] -> - ets:delete(?PM_CONNECTION_DB, {Host, Port, Interface}), - Exc = {'EXCEPTION',#'INTERNAL'{completion_status = ?COMPLETED_NO}}, - send_reply_to_queue(ets:lookup(State#state.queue, - {Host, Port, Interface}), Exc), - ets:delete(State#state.queue, {Host, Port, Interface}), - invoke_connection_closed(I); - [#connection{child = P, interceptors = I}] -> - unlink(P), - catch orber_iiop_outproxy:stop(P), - ets:delete(?PM_CONNECTION_DB, {Host, Port, Interface}), - invoke_connection_closed(I) - end, - do_disconnect(T, Interface, State). - -%%----------------------------------------------------------------- -%% Func: handle_cast/2 -%%----------------------------------------------------------------- -handle_cast(stop, State) -> - {stop, normal, State}; -handle_cast(_, State) -> - {noreply, State}. - -%%----------------------------------------------------------------- -%% Func: handle_info/2 -%%----------------------------------------------------------------- -%% Trapping exits -handle_info({'EXIT', Pid, Reason}, State) -> - %% Check the most common scenario first, i.e., a proxy terminates. - case ets:match_object(?PM_CONNECTION_DB, #connection{child = Pid, _='_'}) of - [#connection{hp = K, interceptors = I}] -> - ets:delete(?PM_CONNECTION_DB, K), - invoke_connection_closed(I), - {noreply, State}; - [#connection{hp = K, interceptors = I}, #connection{hp = K2}] -> - ets:delete(?PM_CONNECTION_DB, K), - ets:delete(?PM_CONNECTION_DB, K2), - invoke_connection_closed(I), - {noreply, State}; - [] when Reason == normal -> - %% This might have been a spawned 'setup_connection' which terminated - %% after sucessfully setting up a new connection. - {noreply, State}; - [] -> - %% Wasn't a proxy. Hence, we must test if it was a spawned - %% 'setup_connection' that failed. - case ets:match_object(?PM_CONNECTION_DB, #connection{slave = Pid, _='_'}) of - [#connection{hp = K, child = connecting, interceptors = I}] -> - ets:delete(?PM_CONNECTION_DB, K), - invoke_connection_closed(I), - Exc = {'EXCEPTION',#'INTERNAL'{completion_status = ?COMPLETED_NO}}, - send_reply_to_queue(ets:lookup(State#state.queue, K), Exc), - ets:delete(State#state.queue, K), - orber:dbg("[~p] orber_iiop_pm:handle_info(setup_failed ~p);~n" - "It was not possible to create a connection to the" - " given host/port.", - [?LINE, K], ?DEBUG_LEVEL), - {noreply, State}; - [#connection{hp = K, child = connecting, interceptors = I}, - #connection{hp = K2}] -> - ets:delete(?PM_CONNECTION_DB, K), - ets:delete(?PM_CONNECTION_DB, K2), - invoke_connection_closed(I), - Exc = {'EXCEPTION',#'INTERNAL'{completion_status = ?COMPLETED_NO}}, - send_reply_to_queue(ets:lookup(State#state.queue, K), Exc), - ets:delete(State#state.queue, K), - orber:dbg("[~p] orber_iiop_pm:handle_info(setup_failed ~p);~n" - "It was not possible to create a connection to the" - " given host/port.", - [?LINE, K], ?DEBUG_LEVEL), - {noreply, State}; - _ -> - {noreply, State} - end - end; -handle_info({setup_failed, {Host, Port, _} = Key, Key, Exc}, State) -> - %% Deletet the data from the connection DB first to avoid clients from - %% trying to access it again. - ets:delete(?PM_CONNECTION_DB, Key), - %% Now we can send whatever exception received. - send_reply_to_queue(ets:lookup(State#state.queue, Key), Exc), - ets:delete(State#state.queue, Key), - orber:dbg("[~p] orber_iiop_pm:handle_info(setup_failed ~p ~p);~n" - "It was not possible to create a connection to the given host/port.", - [?LINE, Host, Port], ?DEBUG_LEVEL), - {noreply, State}; -handle_info({setup_failed, {Host, Port, _} = Key, NewKey, Exc}, State) -> - %% Deletet the data from the connection DB first to avoid clients from - %% trying to access it again. - ets:delete(?PM_CONNECTION_DB, Key), - ets:delete(?PM_CONNECTION_DB, NewKey), - %% Now we can send whatever exception received. - send_reply_to_queue(ets:lookup(State#state.queue, Key), Exc), - ets:delete(State#state.queue, Key), - orber:dbg("[~p] orber_iiop_pm:handle_info(setup_failed ~p ~p);~n" - "It was not possible to create a connection to the given host/port.", - [?LINE, Host, Port], ?DEBUG_LEVEL), - {noreply, State}; -handle_info({setup_successfull, Key, Key, {Child, Ctx, Int}}, State) -> - %% Create a link to the proxy and store it in the connection DB. - link(Child), - case ets:lookup(?PM_CONNECTION_DB, Key) of - [Connection] -> - ets:insert(?PM_CONNECTION_DB, - Connection#connection{hp = Key, child = Child, - interceptors = Int, - slave = undefined}); - [] -> - ets:insert(?PM_CONNECTION_DB, - #connection{hp = Key, child = Child, - interceptors = Int, - slave = undefined}) - end, - %% Send the Proxy reference to all waiting clients. - case Key of - {_, _, 0} -> - send_reply_to_queue(ets:lookup(State#state.queue, Key), - {ok, Child, Ctx, Int, 0}); - {_, _, Interface} -> - send_reply_to_queue(ets:lookup(State#state.queue, Key), - {ok, Child, Ctx, Int, [Interface]}) - end, - %% Reset the queue. - ets:delete(State#state.queue, Key), - {noreply, State}; -handle_info({setup_successfull, Key, NewKey, {Child, Ctx, Int}}, State) -> - %% Create a link to the proxy and store it in the connection DB. - link(Child), - case ets:lookup(?PM_CONNECTION_DB, NewKey) of - [Connection] -> - ets:insert(?PM_CONNECTION_DB, - Connection#connection{hp = NewKey, child = Child, - interceptors = Int, - slave = undefined}); - [] -> - ets:insert(?PM_CONNECTION_DB, - #connection{hp = NewKey, child = Child, - interceptors = Int, - slave = undefined}) - end, - case ets:lookup(?PM_CONNECTION_DB, Key) of - [Connection2] -> - ets:insert(?PM_CONNECTION_DB, - Connection2#connection{hp = Key, child = Child, - interceptors = Int, - slave = undefined}); - [] -> - ets:insert(?PM_CONNECTION_DB, - #connection{hp = Key, child = Child, - interceptors = Int, - slave = undefined}) - end, - %% Send the Proxy reference to all waiting clients. - case NewKey of - {_, _, 0} -> - send_reply_to_queue(ets:lookup(State#state.queue, Key), - {ok, Child, Ctx, Int, 0}); - {_, _, Interface} -> - send_reply_to_queue(ets:lookup(State#state.queue, Key), - {ok, Child, Ctx, Int, [Interface]}) - end, - %% Reset the queue. - ets:delete(State#state.queue, Key), - {noreply, State}; -handle_info(_, State) -> - {noreply, State}. - - -send_reply_to_queue([], _) -> - ok; -send_reply_to_queue([{_, Client}|T], Reply) -> - gen_server:reply(Client, Reply), - send_reply_to_queue(T, Reply). - -%%----------------------------------------------------------------- -%% Func: code_change/3 -%%----------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- -setup_connection(PMPid, Host, Port, SocketType, SocketOptions, Chars, Wchars, Key) -> - case catch access_allowed(Host, Port, SocketType, Key) of - ok -> - do_setup_connection(PMPid, Host, Port, SocketType, SocketOptions, - Chars, Wchars, Key, Key); - {ok, Interface} -> - do_setup_connection(PMPid, Host, Port, SocketType, - [{ip, Interface}|SocketOptions], - Chars, Wchars, Key, Key); - {ok, Interface, NewKey} -> - do_setup_connection(PMPid, Host, Port, SocketType, - [{ip, Interface}|SocketOptions], - Chars, Wchars, Key, NewKey); - false -> - orber_tb:info("Blocked connect attempt to ~s - ~p", [Host, Port]), - PMPid ! {setup_failed, Key, Key, - {'EXCEPTION', #'NO_PERMISSION'{completion_status=?COMPLETED_NO}}}, - ok; - Reason -> - orber:dbg("[~p] orber_iiop_pm:handle_call(connect ~p ~p); failed~n" - "Reason: ~p", - [?LINE, Host, Port, Reason], ?DEBUG_LEVEL), - PMPid ! {setup_failed, Key, Key, - {'EXCEPTION', #'COMM_FAILURE'{completion_status=?COMPLETED_NO}}}, - ok - end. - - -do_setup_connection(PMPid, Host, Port, SocketType, SocketOptions, Chars, - Wchars, Key, NewKey) -> - case catch orber_iiop_outsup:connect(Host, Port, SocketType, - SocketOptions, PMPid, Key, NewKey) of - {error, {'EXCEPTION', E}} -> - orber:dbg("[~p] orber_iiop_pm:handle_call(connect ~p ~p);~n" - "Raised Exc: ~p", - [?LINE, Host, Port, E], ?DEBUG_LEVEL), - PMPid ! {setup_failed, Key, NewKey, {'EXCEPTION', E}}, - ok; - {error, Reason} -> - orber:dbg("[~p] orber_iiop_pm:handle_call(connect ~p ~p);~n" - "Got EXIT: ~p", - [?LINE, Host, Port, Reason], ?DEBUG_LEVEL), - PMPid ! {setup_failed, Key, NewKey, - {'EXCEPTION', #'INTERNAL'{completion_status=?COMPLETED_NO}}}, - ok; - {ok, undefined} -> - orber:dbg("[~p] orber_iiop_pm:handle_call(connect ~p ~p);~n" - "Probably no listener on the given Node/Port or timedout.", - [?LINE, Host, Port], ?DEBUG_LEVEL), - PMPid ! {setup_failed, Key, NewKey, - {'EXCEPTION', #'COMM_FAILURE'{minor=(?ORBER_VMCID bor 1), - completion_status=?COMPLETED_NO}}}, - ok; - {ok, Child} -> - case init_interceptors(Host, Port, get_socket_data(Key)) of - {'EXCEPTION', E} -> - PMPid ! {setup_failed, Key, NewKey, {'EXCEPTION', E}}, - ok; - Interceptors -> - BiDirCtx = orber:bidir_context(), - Ctx = case orber:exclude_codeset_ctx() of - true -> - BiDirCtx; - _ -> - CodeSetCtx = - #'CONV_FRAME_CodeSetContext' - {char_data = Chars, - wchar_data = Wchars}, - [#'IOP_ServiceContext' - {context_id=?IOP_CodeSets, - context_data = CodeSetCtx} | BiDirCtx] - end, - PMPid ! {setup_successfull, Key, NewKey, - {Child, Ctx, Interceptors}}, - ok - end - end. - -access_allowed(Host, Port, Type, {_,_,UserInterface}) -> - Flags = orber:get_flags(), - case ?ORB_FLAG_TEST(Flags, ?ORB_ENV_USE_ACL_OUTGOING) of - false when UserInterface == 0 -> - get_local_interface(Type); - false -> - inet:getaddr(UserInterface, get_ip_family(UserInterface)); - true -> - SearchFor = - case Type of - normal -> - tcp_out; - ssl -> - ssl_out - end, - {ok, Ip} = inet:getaddr(Host, get_ip_family(Host)), - case orber_acl:match(Ip, SearchFor, true) of - {true, [], 0} -> - get_local_interface(Type); - {true, [], Port} -> - get_local_interface(Type); - {true, [], {Min, Max}} when Port >= Min, Port =< Max -> - get_local_interface(Type); - {true, [Interface], 0} -> - {ok, NewIp} = inet:getaddr(Interface, get_ip_family(Interface)), - {ok, NewIp, {Host, Port, 0}}; - {true, [Interface], Port} -> - - {ok, NewIp} = inet:getaddr(Interface, get_ip_family(Interface)), - {ok, NewIp, {Host, Port, 0}}; - {true, [Interface], {Min, Max}} when Port >= Min, Port =< Max -> - - {ok, NewIp} = inet:getaddr(Interface, get_ip_family(Interface)), - {ok, NewIp, {Host, Port, 0}}; - _ -> - false - end - end. - -get_local_interface(normal) -> - case orber_env:ip_address_local() of - [] -> - ok; - [Interface] -> - inet:getaddr(Interface, get_ip_family(Interface)) - end; -get_local_interface(ssl) -> - case orber_env:iiop_ssl_ip_address_local() of - [] -> - ok; - [Interface] -> - inet:getaddr(Interface, get_ip_family(Interface)) - end. - -get_ip_family(Addr) -> - [Family] = orber_socket:get_ip_family_opts(Addr), - Family. - -invoke_connection_closed(false) -> - ok; -invoke_connection_closed({native, Ref, PIs}) -> - (catch orber_pi:closed_out_connection(PIs, Ref)); -invoke_connection_closed({_Type, _PIs}) -> - ok. - - -init_interceptors(Host, Port, {SHost, SPort}) -> - case orber:get_interceptors() of - {native, PIs} -> - case catch orber_pi:new_out_connection(PIs, Host, Port, SHost, SPort) of - {'EXIT', R} -> - orber:dbg("[~p] orber_iiop_pm:init_interceptors(~p); Got Exit: ~p.~n" - "One or more Interceptor incorrect or undefined?", - [?LINE, PIs, R], ?DEBUG_LEVEL), - {'EXCEPTION', #'COMM_FAILURE'{minor=(?ORBER_VMCID bor 2), - completion_status=?COMPLETED_NO}}; - IntRef -> - {native, IntRef, PIs} - end; - Other -> - %% Either 'false' or {Type, PIs}. - Other - end. - - -check_old_ssl_client_options(Options) -> - try - 0 = orber_tb:keysearch(ssl_client_verify, Options, - orber_env:ssl_client_verify()), - 1 = orber_tb:keysearch(ssl_client_depth, Options, - orber_env:ssl_client_depth()), - [] = orber_tb:keysearch(ssl_client_certfile, Options, - orber_env:ssl_client_certfile()), - [] = orber_tb:keysearch(ssl_client_cacertfile, Options, - orber_env:ssl_client_cacertfile()), - [] = orber_tb:keysearch(ssl_client_password, Options, - orber_env:ssl_client_password()), - [] = orber_tb:keysearch(ssl_client_keyfile, Options, - orber_env:ssl_client_keyfile()), - [] = orber_tb:keysearch(ssl_client_ciphers, Options, - orber_env:ssl_client_ciphers()), - infinity = orber_tb:keysearch(ssl_client_cachetimeout, Options, - orber_env:ssl_client_cachetimeout()), - false = orber_tb:keysearch(iiop_ssl_out_keepalive, Options, - orber_env:iiop_ssl_out_keepalive()) - - catch - _:_ -> - error_logger:warning_report([{application, orber}, - "Ignoring deprecated ssl client options used together with the ssl_client_options"]) - end. - - - - -%%----------------------------------------------------------------- -%% END OF MODULE -%%----------------------------------------------------------------- diff --git a/lib/orber/src/orber_iiop_socketsup.erl b/lib/orber/src/orber_iiop_socketsup.erl deleted file mode 100644 index 43b5444c82..0000000000 --- a/lib/orber/src/orber_iiop_socketsup.erl +++ /dev/null @@ -1,86 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: orber_iiop_socketsup.erl -%% Description: -%% This file contains the supervisor for the socket accept processes. -%% -%%----------------------------------------------------------------- --module(orber_iiop_socketsup). - --behaviour(supervisor). - - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([start/2, start_accept/3, start_accept/4]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([init/1, terminate/2]). - -%%----------------------------------------------------------------- -%% External interface functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: start/2 -%%----------------------------------------------------------------- -start(sup, Opts) -> - supervisor:start_link({local, orber_iiop_socketsup}, orber_iiop_socketsup, - {sup, Opts}); -start(_A1, _A2) -> - ok. - - -%%----------------------------------------------------------------- -%% Server functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: init/1 -%%----------------------------------------------------------------- -init({sup, _Opts}) -> - SupFlags = {simple_one_for_one, 500, 100}, - ChildSpec = [ - {name3, {orber_iiop_net_accept, start, []}, temporary, - 10000, worker, [orber_iiop_net_accept]} - ], - {ok, {SupFlags, ChildSpec}}; -init(_Opts) -> - {ok, []}. - - -%%----------------------------------------------------------------- -%% Func: terminate/2 -%%----------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -%%----------------------------------------------------------------- -%% Func: start_connection/1 -%%----------------------------------------------------------------- -start_accept(Type, Listen, Ref) -> - start_accept(Type, Listen, Ref, []). -start_accept(Type, Listen, Ref, ProxyOptions) -> - supervisor:start_child(orber_iiop_socketsup, [Type, Listen, Ref, ProxyOptions]). - diff --git a/lib/orber/src/orber_iiop_tracer.erl b/lib/orber/src/orber_iiop_tracer.erl deleted file mode 100644 index 8d6cd2e8b8..0000000000 --- a/lib/orber/src/orber_iiop_tracer.erl +++ /dev/null @@ -1,232 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%-------------------------------------------------------------------- -%% File : orber_iiop_tracer.erl -%% Purpose : Use for debugging only. -%%-------------------------------------------------------------------- - --module(orber_iiop_tracer). - - - - - -%% Interceptor functions. --export([new_out_connection/5, - new_in_connection/5, - closed_in_connection/1, - closed_out_connection/1, - in_request_encoded/6, - in_reply_encoded/6, - out_reply_encoded/6, - out_request_encoded/6, - in_request/6, - in_reply/6, - out_reply/6, - out_request/6]). - - -%%--------------- INTERCEPTOR FUNCTIONS ---------------------- -%%------------------------------------------------------------ -%% function : new_in_connection -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -new_in_connection(_Arg, PHost, PPort, SHost, SPort) -> - error_logger:info_msg("=============== new_in_connection ========~n" - "Node : ~p~n" - "From : ~s:~p~n" - "To : ~s:~p~n" - "==========================================~n", - [node(), PHost, PPort, SHost, SPort]), - {PHost, PPort, SHost, SPort}. - -%%------------------------------------------------------------ -%% function : new_out_connection -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -new_out_connection(_Arg, PHost, PPort, SHost, SPort) -> - error_logger:info_msg("=============== new_out_connection =======~n" - "Node : ~p~n" - "From : ~s:~p~n" - "To : ~s:~p~n" - "==========================================~n", - [node(), SHost, SPort, PHost, PPort]), - {PHost, PPort, SHost, SPort}. - -%%------------------------------------------------------------ -%% function : closed_in_connection -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -closed_in_connection(Arg) -> - error_logger:info_msg("=============== closed_in_connection =====~n" - "Node : ~p~n" - "Connection: ~p~n" - "==========================================~n", - [node(), Arg]), - Arg. - -%%------------------------------------------------------------ -%% function : closed_out_connection -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -closed_out_connection(Arg) -> - error_logger:info_msg("=============== closed_out_connection ====~n" - "Node : ~p~n" - "Connection: ~p~n" - "==========================================~n", - [node(), Arg]), - Arg. - -%%------------------------------------------------------------ -%% function : in_request_encoded -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -in_request_encoded(Ref, _ObjKey, Ctx, Op, Bin, Args) -> - error_logger:info_msg("=============== in_request_encoded =======~n" - "Connection: ~p~n" - "Operation : ~p~n" - "Body : ~p~n" - "Context : ~p~n" - "==========================================~n", - [Ref, Op, Bin, Ctx]), - {Bin, Args}. - -%%------------------------------------------------------------ -%% function : in_reply_encoded -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -in_reply_encoded(Ref, _ObjKey, Ctx, Op, Bin, Args) -> - error_logger:info_msg("============== in_reply_encoded ==========~n" - "Connection: ~p~n" - "Operation : ~p~n" - "Body : ~p~n" - "Context : ~p~n" - "==========================================~n", - [Ref, Op, Bin, Ctx]), - {Bin, Args}. - -%%------------------------------------------------------------ -%% function : out_reply_encoded -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -out_reply_encoded(Ref, ObjKey, Ctx, Op, Bin, Args) -> - error_logger:info_msg("============== out_reply_encoded =========~n" - "Connection: ~p~n" - "Operation : ~p~n" - "Body : ~p~n" - "Context : ~p~n" - "Object : ~p~n" - "==========================================~n", - [Ref, Op, Bin, Ctx, ObjKey]), - {Bin, Args}. - -%%------------------------------------------------------------ -%% function : out_request_encoded -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -out_request_encoded(Ref, _ObjKey, Ctx, Op, Bin, Args) -> - error_logger:info_msg("============== out_request_encoded =======~n" - "Connection: ~p~n" - "Operation : ~p~n" - "Body : ~p~n" - "Context : ~p~n" - "==========================================~n", - [Ref, Op, Bin, Ctx]), - {Bin, Args}. - -%%------------------------------------------------------------ -%% function : in_request -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -in_request(Ref, ObjKey, Ctx, Op, Params, Args) -> - error_logger:info_msg("=============== in_request ===============~n" - "Connection: ~p~n" - "Operation : ~p~n" - "Parameters: ~p~n" - "Context : ~p~n" - "Object : ~p~n" - "==========================================~n", - [Ref, Op, Params, Ctx, ObjKey]), - {Params, Args}. - -%%------------------------------------------------------------ -%% function : in_reply -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -in_reply(Ref, _ObjKey, Ctx, Op, Reply, Args) -> - error_logger:info_msg("=============== in_reply =================~n" - "Connection: ~p~n" - "Operation : ~p~n" - "Reply : ~p~n" - "Context : ~p~n" - "==========================================~n", - [Ref, Op, Reply, Ctx]), - {Reply, Args}. - -%%------------------------------------------------------------ -%% function : out_reply -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -out_reply(Ref, ObjKey, Ctx, Op, Reply, Args) -> - error_logger:info_msg("=============== out_reply ================~n" - "Connection: ~p~n" - "Operation : ~p~n" - "Reply : ~p~n" - "Context : ~p~n" - "Object : ~p~n" - "==========================================~n", - [Ref, Op, Reply, Ctx, ObjKey]), - {Reply, Args}. - -%%------------------------------------------------------------ -%% function : out_request -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -out_request(Ref, _ObjKey, Ctx, Op, Params, Args) -> - error_logger:info_msg("=============== out_request ==============~n" - "Connection: ~p~n" - "Operation : ~p~n" - "Parameters: ~p~n" - "Context : ~p~n" - "==========================================~n", - [Ref, Op, Params, Ctx]), - {Params, Args}. - - - - -%%====================================================================== -%% END OF MODULE -%%====================================================================== - diff --git a/lib/orber/src/orber_iiop_tracer_silent.erl b/lib/orber/src/orber_iiop_tracer_silent.erl deleted file mode 100644 index 659de0acee..0000000000 --- a/lib/orber/src/orber_iiop_tracer_silent.erl +++ /dev/null @@ -1,191 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2002-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%-------------------------------------------------------------------- -%% File : orber_iiop_tracer_silent.erl -%% Purpose : Use for debugging only. -%%-------------------------------------------------------------------- - --module(orber_iiop_tracer_silent). - - -%% Interceptor functions. --export([new_out_connection/5, - new_in_connection/5, - closed_in_connection/1, - closed_out_connection/1, - in_request_encoded/6, - in_reply_encoded/6, - out_reply_encoded/6, - out_request_encoded/6, - in_request/6, - in_reply/6, - out_reply/6, - out_request/6]). - - -%%--------------- INTERCEPTOR FUNCTIONS ---------------------- -%%------------------------------------------------------------ -%% function : new_in_connection -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -new_in_connection(_Arg, PHost, PPort, SHost, SPort) -> - error_logger:info_msg("=============== new_in_connection ========~n" - "Node : ~p~n" - "From : ~s:~p~n" - "To : ~s:~p~n" - "==========================================~n", - [node(), PHost, PPort, SHost, SPort]), - {PHost, PPort, SHost, SPort}. - -%%------------------------------------------------------------ -%% function : new_out_connection -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -new_out_connection(_Arg, PHost, PPort, SHost, SPort) -> - error_logger:info_msg("=============== new_out_connection =======~n" - "Node : ~p~n" - "From : ~s:~p~n" - "To : ~s:~p~n" - "==========================================~n", - [node(), SHost, SPort, PHost, PPort]), - {PHost, PPort, SHost, SPort}. - -%%------------------------------------------------------------ -%% function : closed_in_connection -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -closed_in_connection(Arg) -> - error_logger:info_msg("=============== closed_in_connection =====~n" - "Node : ~p~n" - "Connection: ~p~n" - "==========================================~n", - [node(), Arg]), - Arg. - -%%------------------------------------------------------------ -%% function : closed_out_connection -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -closed_out_connection(Arg) -> - error_logger:info_msg("=============== closed_out_connection ====~n" - "Node : ~p~n" - "Connection: ~p~n" - "==========================================~n", - [node(), Arg]), - Arg. - -%%------------------------------------------------------------ -%% function : in_request_encoded -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -in_request_encoded(_Ref, _ObjKey, _Ctx, _Op, Bin, Args) -> - {Bin, Args}. - -%%------------------------------------------------------------ -%% function : in_reply_encoded -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -in_reply_encoded(_Ref, _ObjKey, _Ctx, _Op, Bin, Args) -> - {Bin, Args}. - -%%------------------------------------------------------------ -%% function : out_reply_encoded -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -out_reply_encoded(_Ref, _ObjKey, _Ctx, _Op, Bin, Args) -> - {Bin, Args}. - -%%------------------------------------------------------------ -%% function : out_request_encoded -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -out_request_encoded(_Ref, _ObjKey, _Ctx, _Op, Bin, Args) -> - {Bin, Args}. - -%%------------------------------------------------------------ -%% function : in_request -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -in_request(Ref, _ObjKey, _Ctx, Op, Params, Args) -> - error_logger:info_msg("=============== in_request ===============~n" - "Connection: ~p~n" - "Operation : ~p~n" - "Parameters: ~p~n" - "==========================================~n", - [Ref, Op, Params]), - {Params, Args}. - -%%------------------------------------------------------------ -%% function : in_reply -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -in_reply(Ref, _ObjKey, _Ctx, Op, Reply, Args) -> - error_logger:info_msg("=============== in_reply =================~n" - "Connection: ~p~n" - "Operation : ~p~n" - "Reply : ~p~n" - "==========================================~n", - [Ref, Op, Reply]), - {Reply, Args}. - -%%------------------------------------------------------------ -%% function : out_reply -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -out_reply(Ref, _ObjKey, _Ctx, Op, Reply, Args) -> - error_logger:info_msg("=============== out_reply ================~n" - "Connection: ~p~n" - "Operation : ~p~n" - "Reply : ~p~n" - "==========================================~n", - [Ref, Op, Reply]), - {Reply, Args}. - -%%------------------------------------------------------------ -%% function : out_request -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -out_request(Ref, _ObjKey, _Ctx, Op, Params, Args) -> - error_logger:info_msg("=============== out_request ==============~n" - "Connection: ~p~n" - "Operation : ~p~n" - "Parameters: ~p~n" - "==========================================~n", - [Ref, Op, Params]), - {Params, Args}. - -%%====================================================================== -%% END OF MODULE -%%====================================================================== - diff --git a/lib/orber/src/orber_iiop_tracer_stealth.erl b/lib/orber/src/orber_iiop_tracer_stealth.erl deleted file mode 100644 index 8eaa945d3f..0000000000 --- a/lib/orber/src/orber_iiop_tracer_stealth.erl +++ /dev/null @@ -1,187 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%-------------------------------------------------------------------- -%% File : orber_iiop_tracer_stealth.erl -%% Purpose : Use for debugging only. -%%-------------------------------------------------------------------- - --module(orber_iiop_tracer_stealth). - - -%% Interceptor functions. --export([new_out_connection/5, - new_in_connection/5, - closed_in_connection/1, - closed_out_connection/1, - in_request_encoded/6, - in_reply_encoded/6, - out_reply_encoded/6, - out_request_encoded/6, - in_request/6, - in_reply/6, - out_reply/6, - out_request/6]). - - -%%--------------- INTERCEPTOR FUNCTIONS ---------------------- -%%------------------------------------------------------------ -%% function : new_in_connection -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -new_in_connection(_Arg, PHost, PPort, SHost, SPort) -> - error_logger:info_msg("=============== new_in_connection ========~n" - "Node : ~p~n" - "From : ~s:~p~n" - "To : ~s:~p~n" - "==========================================~n", - [node(), PHost, PPort, SHost, SPort]), - {PHost, PPort, SHost, SPort}. - -%%------------------------------------------------------------ -%% function : new_out_connection -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -new_out_connection(_Arg, PHost, PPort, SHost, SPort) -> - error_logger:info_msg("=============== new_out_connection =======~n" - "Node : ~p~n" - "From : ~s:~p~n" - "To : ~s:~p~n" - "==========================================~n", - [node(), SHost, SPort, PHost, PPort]), - {PHost, PPort, SHost, SPort}. - -%%------------------------------------------------------------ -%% function : closed_in_connection -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -closed_in_connection(Arg) -> - error_logger:info_msg("=============== closed_in_connection =====~n" - "Node : ~p~n" - "Connection: ~p~n" - "==========================================~n", - [node(), Arg]), - Arg. - -%%------------------------------------------------------------ -%% function : closed_out_connection -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -closed_out_connection(Arg) -> - error_logger:info_msg("=============== closed_out_connection ====~n" - "Node : ~p~n" - "Connection: ~p~n" - "==========================================~n", - [node(), Arg]), - Arg. - -%%------------------------------------------------------------ -%% function : in_request_encoded -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -in_request_encoded(_Ref, _ObjKey, _Ctx, _Op, Bin, Args) -> - {Bin, Args}. - -%%------------------------------------------------------------ -%% function : in_reply_encoded -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -in_reply_encoded(_Ref, _ObjKey, _Ctx, _Op, Bin, Args) -> - {Bin, Args}. - -%%------------------------------------------------------------ -%% function : out_reply_encoded -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -out_reply_encoded(_Ref, _ObjKey, _Ctx, _Op, Bin, Args) -> - {Bin, Args}. - -%%------------------------------------------------------------ -%% function : out_request_encoded -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -out_request_encoded(_Ref, _ObjKey, _Ctx, _Op, Bin, Args) -> - {Bin, Args}. - -%%------------------------------------------------------------ -%% function : in_request -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -in_request(Ref, _ObjKey, _Ctx, Op, Params, Args) -> - error_logger:info_msg("=============== in_request ===============~n" - "Connection: ~p~n" - "Operation : ~p~n" - "==========================================~n", - [Ref, Op]), - {Params, Args}. - -%%------------------------------------------------------------ -%% function : in_reply -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -in_reply(Ref, _ObjKey, _Ctx, Op, Reply, Args) -> - error_logger:info_msg("=============== in_reply =================~n" - "Connection: ~p~n" - "Operation : ~p~n" - "==========================================~n", - [Ref, Op]), - {Reply, Args}. - -%%------------------------------------------------------------ -%% function : out_reply -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -out_reply(Ref, _ObjKey, _Ctx, Op, Reply, Args) -> - error_logger:info_msg("=============== out_reply ================~n" - "Connection: ~p~n" - "Operation : ~p~n" - "==========================================~n", - [Ref, Op]), - {Reply, Args}. - -%%------------------------------------------------------------ -%% function : out_request -%% Arguments: -%% Returns : -%%------------------------------------------------------------ -out_request(Ref, _ObjKey, _Ctx, Op, Params, Args) -> - error_logger:info_msg("=============== out_request ==============~n" - "Connection: ~p~n" - "Operation : ~p~n" - "==========================================~n", - [Ref, Op]), - {Params, Args}. - -%%====================================================================== -%% END OF MODULE -%%====================================================================== - diff --git a/lib/orber/src/orber_initial_references.erl b/lib/orber/src/orber_initial_references.erl deleted file mode 100644 index 9140563881..0000000000 --- a/lib/orber/src/orber_initial_references.erl +++ /dev/null @@ -1,328 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2017. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: orber_initial_references.erl -%% -%% Description: -%% This file contains the CORBA::InitialReferences interface -%% -%%----------------------------------------------------------------- --module(orber_initial_references). - --behaviour(gen_server). - --include_lib("orber/include/corba.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([start/1, shutdown/1, init/1, - terminate/2, handle_call/3, code_change/3, - get/2, list/1, add/3, remove/2, - get/1, list/0, add/2, remove/1, - typeID/0, install/2, oe_is_a/1, oe_tc/1, oe_get_interface/0]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([handle_cast/2, handle_info/2]). - -%%----------------------------------------------------------------- -%% Mnesia Table definition record -%%----------------------------------------------------------------- --record(orber_references, {key, objref, type}). - --define(DEBUG_LEVEL, 6). - -%%----------------------------------------------------------------- -%% External interface functions -%%----------------------------------------------------------------- -start(Env) -> - gen_server:start_link({local, 'orber_init'}, ?MODULE, Env, []). - -shutdown(EO_this) -> - gen_server:call(EO_this, stop). - - -install(Timeout, Options) -> - AllTabs = mnesia:system_info(tables), - DB_Result = case lists:member(orber_references, AllTabs) of - true -> - case lists:member({local_content, true}, - Options) of - true-> - mnesia:add_table_copy(orber_references, - node(), - ram_copies); - _ -> - mnesia:create_table(orber_references, - [{attributes, - record_info(fields, - orber_references)} - |Options]) - end; - _ -> - mnesia:create_table(orber_references, - [{attributes, - record_info(fields, - orber_references)} - |Options]) - end, - - Wait = mnesia:wait_for_tables([orber_references], Timeout), - %% Check if any error has occurred yet. If there are errors, return them. - if - DB_Result == {atomic, ok}, - Wait == ok -> - ok; - true -> - {error, {DB_Result, Wait}} - end. - - -%%----------------------------------------------------------------- -%% InitialReferences Interface -%%----------------------------------------------------------------- -'get'(Id) -> - case read(Id) of - {'EXCEPTION', E} -> - corba:raise(E); - Result -> - Result - end. - -list() -> - case list_keys() of - {'EXCEPTION', E} -> - corba:raise(E); - Result -> - Result - end. - - -add(Id, ObjRef) -> - case write(Id, ObjRef, external) of - {'EXCEPTION', E} -> - corba:raise(E); - Result -> - Result - end. - - -remove(Id) -> - case delete(Id) of - {'EXCEPTION', E} -> - corba:raise(E); - Result -> - Result - end. - - -'get'(EO_this, Id) -> - corba:call(EO_this, 'get', [Id], ?MODULE). - -list(EO_this) -> - corba:call(EO_this, 'list', [], ?MODULE). - -add(EO_this, Id, ObjRef) -> - corba:call(EO_this, 'add', [Id, ObjRef], ?MODULE). - -remove(EO_this, Id) -> - corba:call(EO_this, 'remove', [Id], ?MODULE). - -typeID() -> - "IDL:Orber/InitialReferences:1.0". - -oe_is_a("IDL:Orber/InitialReferences:1.0") -> - true; -oe_is_a(_) -> - false. - -%%----------------------------------------------------------------- -%% Internal interface functions -%%----------------------------------------------------------------- -init([]) -> - case mnesia:wait_for_tables(['orber_references'], infinity) of - ok -> - NSObjKey = 'CosNaming_NamingContextExt':oe_create([], [{pseudo, true}, - {no_security, orber:partial_security()}]), - rewrite("NameService", NSObjKey), - ErlIfr = 'OrberApp_IFR':oe_create([], [{pseudo, true}]), - rewrite("OrberIFR", ErlIfr), - {ok, []}; - StopReason -> - {stop, StopReason} - end. - -terminate(_Reason, _State) -> - ok. - - -%%----------------------------------------------------------------- -%% Handle incomming calls -handle_call({_EO_this, _OE_Context, 'get', [Id]}, _From, State) -> - {'reply', read(Id), State}; -handle_call({_EO_this, _OE_Context, 'list', []}, _From, State) -> - {'reply', list_keys(), State}; - -handle_call({_EO_this, _OE_Context, 'add', [Id, ObjectRef]}, _From, State) -> - {'reply', write(Id, ObjectRef, external), State}; - -handle_call({_EO_this, _OE_Context, 'remove', [Id]}, _From, State) -> - {'reply', delete(Id), State}; -handle_call('stop', _From, State) -> - {'stop', normal, 'ok', State}; -handle_call(_Req, _From,State) -> - {'reply', {'ok', 'nil', 'nil'}, State}. - -oe_tc(get) -> - {{'tk_objref', 12, "object"}, [{'tk_string', 0}], []}; -oe_tc(list) -> - {{'tk_sequence',{'tk_string', 0}, 0}, [], []}; -oe_tc(add) -> - {'tk_boolean', [{'tk_string', 0}, {'tk_objref', 12, "object"}], []}; -oe_tc(remove) -> - {'tk_boolean', [{'tk_string', 0}], []}; -oe_tc(_) -> - undefined. - -oe_get_interface() -> - [{"get", oe_tc(get)}, - {"list", oe_tc(list)}, - {"add", oe_tc(add)}]. - - -%%----------------------------------------------------------------- -%% Standard gen_server cast handle -%%----------------------------------------------------------------- -handle_cast(_, State) -> - {noreply, State}. - - -%%----------------------------------------------------------------- -%% Standard gen_server handles -%%----------------------------------------------------------------- -handle_info(_, State) -> - {noreply, State}. - -%%----------------------------------------------------------------- -%% Func: code_change/3 -%%----------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -read(Key) -> - case mnesia:dirty_read({orber_references, Key}) of - [] -> - corba:create_nil_objref(); - [#orber_references{objref = ObjRef}] -> - ObjRef; - What -> - orber:dbg("[~p] orber_initial_references:lookup(~p);~n" - "Failed to read from DB: ~p", - [?LINE, Key, What], ?DEBUG_LEVEL), - {'EXCEPTION', #'INTERNAL'{completion_status=?COMPLETED_NO}} - end. - -write(Key, ObjRef, Type) -> - _WF = fun() -> - case mnesia:wread({orber_references, Key}) of - [] -> - %% No key exists. Ok to register. - mnesia:write(#orber_references{key=Key, objref = ObjRef, - type=Type}); - [X] -> - orber:dbg("[~p] orber_initial_references:write(~p);~n" - "Already bound to: ~p", - [?LINE, Key, X], ?DEBUG_LEVEL), - false; - Why -> - %% Something else occured. - orber:dbg("[~p] orber_initial_references:write(~p);~n" - "Error reading from DB (~p)", [?LINE, Key, Why], ?DEBUG_LEVEL), - mnesia:abort({'EXCEPTION', #'INTERNAL'{completion_status=?COMPLETED_NO}}) - end - end, - case mnesia:transaction(_WF) of - {atomic, ok} -> - true; - {atomic, Result} -> - Result; - {aborted, Reason} -> - Reason - end. - -rewrite(Key, ObjRef) -> - rewrite(Key, ObjRef, internal). -rewrite(Key, ObjRef, Type) -> - _WF = fun() -> - mnesia:write(#orber_references{key=Key, objref = ObjRef, type=Type}) - end, - case mnesia:transaction(_WF) of - {atomic, ok} -> - true; - {aborted, Reason} -> - orber:dbg("[~p] orber_initial_references:rewrite(~p);~n" - "Error over writing in DB (~p)", - [?LINE, Key, Reason], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - - -delete(Key) -> - _DF = fun() -> - case mnesia:read({orber_references, Key}) of - [] -> - %% No key exists. - orber:dbg("[~p] orber_initial_references:delete(~p);~n" - "Does not exist.", [?LINE, Key], ?DEBUG_LEVEL), - false; - [_X] -> - mnesia:delete({orber_references, Key}); - Why -> - %% Something else occured. - orber:dbg("[~p] orber_initial_references:delete(~p);~n" - "Error reading from DB (~p)", - [?LINE, Key, Why], ?DEBUG_LEVEL), - mnesia:abort({'EXCEPTION', #'INTERNAL'{completion_status=?COMPLETED_NO}}) - end - end, - case mnesia:transaction(_DF) of - {atomic, ok} -> - true; - {atomic, Result} -> - Result; - {aborted, Reason} -> - Reason - end. - -list_keys() -> - _LF = fun() -> mnesia:all_keys(orber_references) end, - case mnesia:transaction(_LF) of - {atomic, Result} -> - %% We do not want OrberIFR to exported, remove it. - lists:delete("OrberIFR", Result); - {aborted, Reason} -> - orber:dbg("[~p] orber_initial_references:list_keys();~n" - "Error reading from DB (~p)", [?LINE, Reason], ?DEBUG_LEVEL), - {'EXCEPTION', #'INTERNAL'{completion_status=?COMPLETED_NO}} - end. diff --git a/lib/orber/src/orber_interceptors.erl b/lib/orber/src/orber_interceptors.erl deleted file mode 100644 index 4bfb2ae9a5..0000000000 --- a/lib/orber/src/orber_interceptors.erl +++ /dev/null @@ -1,154 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1999-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: orber_interceptors.erl -%% -%% Description: -%% This file contains the code for calling interceptors -%% -%%----------------------------------------------------------------- --module(orber_interceptors). - --include_lib("orber/include/corba.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([call_send_message_interceptors/2, call_receive_message_interceptors/1, - call_request_interceptors/2]). --export([push_system_message_interceptor/2, pop_system_message_interceptor/1, - create_interceptor_table/0]). -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - - -%%----------------------------------------------------------------- -%% External interface functions -%%----------------------------------------------------------------- -call_receive_message_interceptors(Bytes) -> - case getInMessageInterceptors() of - [] -> - Bytes; - Interceptors -> - apply_message_interceptors(Interceptors, receive_message, corba:create_nil_objref(), - lists:flatten(Bytes)) - end. -call_send_message_interceptors(ObjRef, Bytes) -> - case getOutMessageInterceptors() of - [] -> - Bytes; - Interceptors -> - apply_message_interceptors(Interceptors, send_message, ObjRef, lists:flatten(Bytes)) - end. - - -call_request_interceptors(in, Bytes) -> - case getInRequestInterceptors() of - [] -> - Bytes; - Interceptors -> - Bytes - end; -call_request_interceptors(out, Bytes) -> - case getOutRequestInterceptors() of - [] -> - Bytes; - Interceptors -> - Bytes - end. - -create_interceptor_table() -> - %% Should be replicated mnesia - ets:new(orber_interceptors, [protected, named_table, set]), - ets:insert(orber_interceptors, {message_in_interceptors, []}), - ets:insert(orber_interceptors, {message_out_interceptors, []}). - -push_system_message_interceptor(in, Mod) -> - case ets:lookup(orber_interceptors, message_in_interceptors) of - [{_, Interceptors}] -> - ets:insert(orber_interceptors, {message_in_interceptors, [Mod | Interceptors]}); - _ -> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; -push_system_message_interceptor(out, Mod) -> - case ets:lookup(orber_interceptors, message_out_interceptors) of - [{_, Interceptors}] -> - ets:insert(orber_interceptors, {message_out_interceptors, Interceptors ++ [Mod]}); - _ -> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -pop_system_message_interceptor(in) -> - case ets:lookup(orber_interceptors, message_in_interceptors) of - [{_, []}] -> - ok; - [{_, [_ | Interceptors]}] -> - ets:insert(orber_interceptors, {message_in_interceptors, Interceptors}); - _ -> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end; -pop_system_message_interceptor(out) -> - case ets:lookup(orber_interceptors, message_out_interceptors) of - [{_, []}] -> - ok; - [{_, Interceptors}] -> - ets:insert(orber_interceptors, {message_out_interceptors, lists:droplast(Interceptors)}); - _ -> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - - - -%%----------------------------------------------------------------- -%% Internal functions -%%----------------------------------------------------------------- -getInMessageInterceptors() -> - case ets:lookup(orber_interceptors, message_in_interceptors) of - [{_, Interceptors}] -> - Interceptors; - _ -> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - -getOutMessageInterceptors() -> - case ets:lookup(orber_interceptors, message_out_interceptors) of - [{_, Interceptors}] -> - Interceptors; - _ -> - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) - end. - - -getInRequestInterceptors() -> - []. - -getOutRequestInterceptors() -> - []. - - -apply_message_interceptors([], F, ObjRef, Bytes) -> - Bytes; -apply_message_interceptors([M | Rest], F, ObjRef, Bytes) -> - apply_message_interceptors(Rest, F, ObjRef, apply(M, F, [ObjRef, Bytes])). - diff --git a/lib/orber/src/orber_objectkeys.erl b/lib/orber/src/orber_objectkeys.erl deleted file mode 100644 index 12ed1a2f85..0000000000 --- a/lib/orber/src/orber_objectkeys.erl +++ /dev/null @@ -1,571 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2017. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: orber_objectkeys.erl -%% -%% Description: -%% This file contains the object keyserver in Orber -%% -%%----------------------------------------------------------------- --module(orber_objectkeys). - --behaviour(gen_server). - --include_lib("orber/include/corba.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([start/1, stop/0, stop_all/0, get_pid/1, is_persistent/1, - register/2, register/3, delete/1, create_schema/1, check/1, - remove_old_keys/0]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([init/1, terminate/2, install/2, handle_call/3, handle_info/2, code_change/3]). --export([handle_cast/2, dump/0, get_key_from_pid/1, gc/1]). - -%%----------------------------------------------------------------- -%% Mnesia Table definition record -%%----------------------------------------------------------------- --record(orber_objkeys, {object_key, pid, persistent=false, timestamp}). - -%%----------------------------------------------------------------- -%% Macros -%%----------------------------------------------------------------- --define(dirty_query_context, true). - -%% This macro returns a read fun suitable for evaluation in a transaction --define(read_function(Objkey), - fun() -> - mnesia:dirty_read(Objkey) - end). - -%% This macro returns a write fun suitable for evaluation in a transaction --define(write_function(R), - fun() -> - mnesia:dirty_write(R) - end). - -%% This macro returns a delete fun suitable for evaluation in a transaction --define(delete_function(R), - fun() -> - mnesia:delete(R) - end). - -%% Use this fun inside a transaction to get a list of all keys. --define(match_function(), - fun() -> - mnesia:match_object({orber_objkeys, '_', '_','_','_'}) - end). - --ifdef(dirty_query_context). --define(query_check(Q_res), Q_res). --else. --define(query_check(Q_res), {atomic, Q_res}). --endif. - - --define(CHECK_EXCEPTION(Res), case Res of - {'EXCEPTION', E} -> - corba:raise(E); - R -> - R - end). - --define(DEBUG_LEVEL, 6). - - - -%%----------------------------------------------------------------- -%% Debugging function -%%----------------------------------------------------------------- -dump() -> - case catch mnesia:dirty_first('orber_objkeys') of - {'EXIT', R} -> - io:format("Exited with ~p\n",[R]); - Key -> - dump_print(Key), - dump_loop(Key) - end. - -dump_loop(PreviousKey) -> - case catch mnesia:dirty_next('orber_objkeys', PreviousKey) of - {'EXIT', R} -> - io:format("Exited with ~p\n",[R]); - '$end_of_table' -> - ok; - Key -> - dump_print(Key), - dump_loop(Key) - end. - -dump_print(Key) -> - case catch mnesia:dirty_read({'orber_objkeys', Key}) of - {'EXIT', R} -> - io:format("Exited with ~p\n",[R]); - [X] -> - io:format("object_key: ~p, pid: ~p, persistent: ~p, timestamp: ~p\n", - [binary_to_term(X#orber_objkeys.object_key), - X#orber_objkeys.pid, - X#orber_objkeys.persistent, - X#orber_objkeys.timestamp]); - _ -> - ok - end. - - -%%----------------------------------------------------------------- -%% External interface functions -%%----------------------------------------------------------------- -start(Opts) -> - gen_server:start_link({local, orber_objkeyserver}, orber_objectkeys, Opts, []). - -stop() -> - gen_server:call(orber_objkeyserver, stop, infinity). - -remove_old_keys() -> - %% This function may ONLY be used when restarting a crashed node. - %% We must remove all objects started with {global, "name"} otherwise - %% we cannot restart the node using the same name. - Fun = fun() -> - Node = node(), - mnesia:write_lock_table(orber_objkeys), - Objects = mnesia:match_object(orber_objkeys, - mnesia:table_info(orber_objkeys, - wild_pattern), - read), - lists:foreach(fun(Obj) -> - case node(Obj#orber_objkeys.pid) of - Node -> - mnesia:delete({orber_objkeys, - Obj#orber_objkeys.object_key}); - _-> - ok - end - end, - Objects), - ok - end, - write_result(mnesia:transaction(Fun)). - -stop_and_remove_local(Reason) -> - %% This function may ONLY be used when this server terminates with reason - %% normal or shutdown. - Fun = fun() -> - Node = node(), - mnesia:write_lock_table(orber_objkeys), - Objects = mnesia:match_object(orber_objkeys, - mnesia:table_info(orber_objkeys, - wild_pattern), - read), - lists:foreach(fun(Obj) -> - case node(Obj#orber_objkeys.pid) of - Node -> - exit(Obj#orber_objkeys.pid, Reason), - mnesia:delete({orber_objkeys, - Obj#orber_objkeys.object_key}); - _-> - ok - end - end, - Objects), - ok - end, - write_result(mnesia:transaction(Fun)). - -stop_all() -> - Fun = ?match_function(), - case mnesia:transaction(Fun) of - {atomic, Objects} -> - lists:foreach(fun(Obj) -> - gen_server:call(Obj#orber_objkeys.pid, - stop, infinity) - end, - Objects); - R -> - R - end. - -get_pid(Objkey) -> - case catch ets:lookup_element(orber_objkeys, Objkey, 3) of - Pid when is_pid(Pid) -> - Pid; - dead -> - {error, "unable to contact object"}; - _ -> - %% This call is necessary if a persistent object have died - %% and the objectkey server is currently updating the Pid - %% to equal 'dead'. Without this case 'OBJECT_NOT_EXIST' - %% would be raised which is uncorrect if the object is - %% persistent. - ?CHECK_EXCEPTION(gen_server:call(orber_objkeyserver, - {get_pid, Objkey}, - infinity)) - end. - -is_persistent(Pid) when is_pid(Pid) -> - case catch get_key_from_pid(Pid) of - {'EXCEPTION', _} -> - corba:raise(#'OBJECT_NOT_EXIST'{completion_status=?COMPLETED_NO}); - Key -> - is_persistent(Key) - end; -is_persistent(Objkey) -> - case catch ets:lookup_element(orber_objkeys, Objkey, 4) of - {'EXIT', _R} -> - corba:raise(#'OBJECT_NOT_EXIST'{completion_status=?COMPLETED_NO}); - Boolean -> - Boolean - end. - - -gc(Sec) when is_integer(Sec) -> - Fun = fun() -> - mnesia:write_lock_table(orber_objkeys), - Objects = mnesia:match_object({orber_objkeys, '_', dead, true,'_'}), - lists:foreach(fun(Obj) -> - case timetest(Sec, Obj#orber_objkeys.timestamp) of - true -> - mnesia:delete({orber_objkeys, - Obj#orber_objkeys.object_key}); - _-> - ok - end - end, - Objects), - ok - end, - write_result(mnesia:transaction(Fun)). - -register(Objkey, Pid) -> - 'register'(Objkey, Pid, false). - -register(Objkey, Pid, Type) when is_pid(Pid) -> - ?CHECK_EXCEPTION(gen_server:call(orber_objkeyserver, - {register, Objkey, Pid, Type}, - infinity)); -register(Objkey, Pid, Type) -> - orber:dbg("[~p] orber_objectkeys:register(~p, ~p); Not a Pid ~p", - [?LINE, Objkey, Type, Pid], ?DEBUG_LEVEL), - corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). - -delete(Objkey) -> - ?CHECK_EXCEPTION(gen_server:call(orber_objkeyserver, - {delete, Objkey}, infinity)). - -check(Objkey) -> - ?CHECK_EXCEPTION(gen_server:call(orber_objkeyserver, - {check, Objkey}, infinity)). - -%%----------------------------------------------------------------- -%% Server functions -%%----------------------------------------------------------------- -init(_Env) -> - case mnesia:wait_for_tables(['orber_objkeys'], infinity) of - ok -> - process_flag(trap_exit, true), - start_gc_timer(orber:objectkeys_gc_time()); - StopReason -> - {stop, StopReason} - end. - -terminate(shutdown, _State) -> - stop_and_remove_local(shutdown), - ok; -terminate(normal, _State) -> - stop_and_remove_local(normal), - ok; -terminate(_Reason, _State) -> - ok. - -start_gc_timer(infinity) -> - {ok, []}; -start_gc_timer(Time) -> - timer:start(), - case timer:send_after(timer:seconds(Time), - orber_objkeyserver, {oe_gc, Time}) of - {ok, _} -> - {ok, []}; - StopReason -> - {stop, StopReason} - end. - -install(Timeout, Options) -> - %% check if there already exists a database. If not, create one. - %% DB_initialized = perhaps_create_schema(Nodelist), - %% check if mnesia is running. If not, start mnesia. - perhaps_start_mnesia(), - - %% Do we have a complete set of IFR tables? If not, create them. - AllTabs = mnesia:system_info(tables), - - DB_Result = case lists:member(orber_objkeys, AllTabs) of - true -> - case lists:member({local_content, true}, - Options) of - true-> - mnesia:add_table_copy(orber_objkeys, - node(), - ram_copies); - _ -> - mnesia:create_table(orber_objkeys, - [{attributes, - record_info(fields, - orber_objkeys)} - |Options]) - end; - _ -> - mnesia:create_table(orber_objkeys, - [{attributes, - record_info(fields, - orber_objkeys)} - |Options]) - end, - - Wait = mnesia:wait_for_tables([orber_objkeys], Timeout), - %% Check if any error has occurred yet. If there are errors, return them. - if - DB_Result == {atomic, ok}, - Wait == ok -> - ok; - true -> - {error, {DB_Result, Wait}} - end. - -%%----------------------------------------------------------------- -%% Func: handle_call/3 -%% -%% Comment: -%% In objectkey gen_server all exceptions are tupples and corba:raise -%% may not be used. It is too time consuming to add catches in every -%% function before returning. On the client side there is a case which -%% maps every tupple on the format {'exception', E} to corba:raise(E). -%%----------------------------------------------------------------- -handle_call(stop, _From, State) -> - {stop, normal, [], State}; -handle_call({get, Objkey}, _From, State) -> - R = query_result(mnesia:dirty_read({orber_objkeys, Objkey})), - {reply, R, State}; - -handle_call({register, Objkey, Pid, Type}, _From, State) -> - _WF = fun() -> - case mnesia:wread({orber_objkeys, Objkey}) of - [] -> - %% No key exists. Ok to register. - mnesia:write(#orber_objkeys{object_key=Objkey, pid=Pid, - persistent=Type, - timestamp=erlang:monotonic_time(seconds)}); - [X] when X#orber_objkeys.persistent==true, - X#orber_objkeys.pid == dead -> - %% A persistent object is being restarted. Update Pid & time. - mnesia:write(X#orber_objkeys{pid=Pid, timestamp=erlang:monotonic_time(seconds)}); - [X] when is_pid(X#orber_objkeys.pid) -> - %% Object exists, i.e., trying to create an object with - %% the same name. - orber:dbg("[~p] orber_objectkeys:register(~p, ~p); Object already exists.", - [?LINE, Objkey, Type], ?DEBUG_LEVEL), - {'EXCEPTION', #'BAD_PARAM'{completion_status=?COMPLETED_NO}}; - Why -> - %% Something else occured. - orber:dbg("[~p] orber_objectkeys:register(~p, ~p); error reading from DB(~p)", - [?LINE, Objkey, Type, Why], ?DEBUG_LEVEL), - {'EXCEPTION', #'INTERNAL'{completion_status=?COMPLETED_NO}} - end - end, - R = write_result(mnesia:transaction(_WF)), - if - R == ok andalso is_pid(Pid) -> - link(Pid); - true -> - true - end, - {reply, R, State}; - -handle_call({delete, Objkey}, _From, State) -> - ?query_check(Qres) = mnesia:dirty_read({orber_objkeys, Objkey}), - case Qres of - [] -> - true; - [X] when is_pid(X#orber_objkeys.pid) -> - unlink(X#orber_objkeys.pid); - _ -> - true - end, - _F = ?delete_function({orber_objkeys, Objkey}), - R = write_result(mnesia:transaction(_F)), - {reply, R, State}; - -handle_call({get_pid, Objkey}, _From, State) -> - _F = fun() -> - mnesia:read({orber_objkeys, Objkey}) - end, - case mnesia:transaction(_F) of - {atomic, [X]} when is_pid(X#orber_objkeys.pid) -> - {reply, X#orber_objkeys.pid, State}; - {atomic, [X]} when X#orber_objkeys.pid == dead -> - {reply, - {'EXCEPTION', #'TRANSIENT'{completion_status=?COMPLETED_NO}}, - State}; - _Res -> - {reply, - {'EXCEPTION', #'OBJECT_NOT_EXIST'{completion_status=?COMPLETED_NO}}, - State} - end; -handle_call({check, {_, 'key', Objkey, _, _, _}}, _From, State) -> - ?query_check(Qres) = mnesia:dirty_read({orber_objkeys, Objkey}), - case Qres of - [_X] -> - {reply, 'object_here', State}; - _ -> - {reply, 'unknown_object', State} - end; -handle_call({check, {_, 'registered', Objkey, _, _, _}}, _From, State) -> - case whereis(Objkey) of - undefined -> - case catch ets:lookup_element(orber_objkeys, Objkey, 4) of - true -> - {reply, 'object_here', State}; - _-> - {reply, 'unknown_object', State} - end; - _ -> - {reply, 'object_here', State} - end; -handle_call({check, {_, 'pseudo', Module, _, _, _}}, _From, State) -> - case code:is_loaded(Module) of - false -> - {reply, 'unknown_object', State}; - _ -> - {reply, 'object_here', State} - end; - -handle_call({check, "INIT"}, _From, State) -> - {reply, 'object_here', State}; -handle_call({check, _}, _From, State) -> - {reply, 'unknown_object', State}. - - -handle_info({'EXIT', Pid, Reason}, State) when is_pid(Pid) -> - _WF = fun() -> - case mnesia:match_object({orber_objkeys, '_', Pid,'_','_'}) of - [] -> - ok; - [X] when X#orber_objkeys.persistent==false -> - mnesia:delete({orber_objkeys, X#orber_objkeys.object_key}); - [X] when is_pid(X#orber_objkeys.pid) andalso - X#orber_objkeys.persistent==true andalso - Reason /= normal andalso - Reason /= shutdown -> - mnesia:write(X#orber_objkeys{pid=dead, - timestamp=erlang:monotonic_time(seconds)}); - [X] when X#orber_objkeys.persistent==true -> - mnesia:delete({orber_objkeys, X#orber_objkeys.object_key}); - _-> - ok - end - end, - case write_result(mnesia:transaction(_WF)) of - ok -> - unlink(Pid); - _-> - true - end, - {noreply, State}; - -handle_info({oe_gc, Secs}, State) -> - catch gc(Secs), - {noreply, State}. - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%----------------------------------------------------------------- -%% Internal Functions -%%----------------------------------------------------------------- - -timetest(S, TimeStamp) -> - TimeStamp+S < erlang:monotonic_time(seconds). - -get_key_from_pid(Pid) -> - case mnesia:dirty_match_object({orber_objkeys, '_', Pid,'_','_'}) of - [Keys] -> - Keys#orber_objkeys.object_key; - _ -> - corba:raise(#'OBJECT_NOT_EXIST'{completion_status=?COMPLETED_NO}) - end. - -%remove_keys([], _) -> -% ok; -%remove_keys([H|T], R) when H#orber_objkeys.persistent==false -> -% _F = ?delete_function({orber_objkeys, H#orber_objkeys.object_key}), -% write_result(mnesia:transaction(_F)), -% remove_keys(T, R). - -%%----------------------------------------------------------------- -%% Check a read transaction -query_result(?query_check(Qres)) -> - case Qres of - [Hres] -> - Hres#orber_objkeys.pid; - [] -> - {'EXCEPTION', #'OBJECT_NOT_EXIST'{completion_status=?COMPLETED_NO}}; - Other -> - orber:dbg("[~p] orber_objectkeys:query_result(); DB lookup failed(~p)", - [?LINE, Other], ?DEBUG_LEVEL), - {'EXCEPTION', #'INTERNAL'{completion_status=?COMPLETED_NO}} - end. - -%%----------------------------------------------------------------- -%% Check a write transaction -write_result({atomic,ok}) -> ok; -write_result(Foo) -> - orber:dbg("[~p] orber_objectkeys:query_result(); DB write failed(~p)", - [?LINE, Foo], ?DEBUG_LEVEL), - {'EXCEPTION', #'INTERNAL'{completion_status=?COMPLETED_NO}}. - - -create_schema(Nodes) -> - case mnesia:system_info(use_dir) of - false -> - mnesia:create_schema(Nodes); - _ -> - ok - end. - -perhaps_start_mnesia() -> - case mnesia:system_info(is_running) of - no -> - mnesia:start(); - _ -> - ok - end. - - -%%------------------------------------------------------------ -%% Standard gen_server cast handle -%% -handle_cast(_, State) -> - {noreply, State}. - - diff --git a/lib/orber/src/orber_pi.erl b/lib/orber/src/orber_pi.erl deleted file mode 100644 index 19bb7af6c0..0000000000 --- a/lib/orber/src/orber_pi.erl +++ /dev/null @@ -1,1213 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_pi.erl -%% Purpose : -%% Comments: -%% * Each Interceptor is represented by Module where -%% Module - refers to a module which must export the functions: -%% (1) receive_request -%% (2) send_other -%% (3) receive_service_contexts -%% (4) send_reply -%% (5) send_exception -%% (6) send_request -%% (7) send_poll -%% (8) receive_reply -%% (9) receive_exception -%% (10) receive_other -%% or -%% (11) new_out_connection -%% (12) new_in_connection -%% (13) in_request -%% (14) out_reply -%% (15) out_request -%% (16) in_reply -%% -%% Functions (1) - (10) for Portable and (11) - (16) for -%% Native Interceptors. -%% -%%---------------------------------------------------------------------- - --module(orber_pi). - -%%--------------- INCLUDES ----------------------------------- --include_lib("orber/include/corba.hrl"). --include_lib("orber/include/ifr_types.hrl"). --include_lib("orber/include/orber_pi.hrl"). --include_lib("orber/src/orber_iiop.hrl"). - -%%--------------- EXPORTS------------------------------------- -%% API external --export([%% Native Intercepotors API - new_out_connection/5, - new_in_connection/5, - closed_in_connection/2, - closed_out_connection/2, - in_request_enc/4, - out_reply_enc/5, - out_request_enc/6, - in_reply_enc/6, - in_request/4, - out_reply/5, - out_request/6, - in_reply/6, - %% Portable Interceptors - server_start_receive/7, - server_start_send/2, - client_receive/2, - client_send/2, - codefactory_create_codec/1, - codec_encode/2, - codec_encode_value/2, - codec_decode/2, - codec_decode_value/3, - %% RequestInfo - '_get_request_id'/1, - '_get_operation'/1, - '_get_arguments'/1, - '_get_exceptions'/1, - '_get_contexts'/1, - '_get_operation_context'/1, - '_get_result'/1, - '_get_response_expected'/1, - '_get_sync_scope'/1, - '_get_reply_status'/1, - '_get_forward_reference'/1, - get_slot/2, - get_request_service_context/2, - get_reply_service_context/2, - %% ClientRequestInfo (inherrits RequestInfo) - '_get_target'/1, - '_get_effective_target'/1, - '_get_effective_profile'/1, - '_get_received_exception'/1, - '_get_received_exception_id'/1, - get_effective_component/2, - get_effective_components/2, - get_request_policy/2, - add_request_service_policy/3, - %% ServerRequestInfo (inherrits RequestInfo) - '_get_sending_exception'/1, - '_get_object_id'/1, - '_get_adapter_id'/1, - '_get_target_most_derived_interface'/1, - get_server_policy/2, - set_slot/3, - target_is_a/2, - add_reply_service_context/3]). - -%%=============== DATA STRUCTURES ============================ -%%--------------- ClientRequestInfo -------------------------- --record('ClientRequestInfo', - {request_id, - operation, - arguments, - exceptions, - contexts, - operation_context, - result, - response_expected, - sync_scope = 'SYNC_NONE', - reply_status, - forward_reference, - endian, - target, - effective_target, - effective_profile, - received_exception, - received_exception_id}). - --define(createInitCRI(_ReqID, _Op, _Args, _Ctxs, _OpCtx, _RespExp, _Target, - _ETarget, _EProf), - #'ClientRequestInfo'{request_id = _ReqID, - operation = _Op, - arguments = _Args, - contexts = _Ctxs, - operation_context = _OpCtx, - response_expected = _RespExp, - target = _Target, - effective_target = _ETarget, - effective_profile = _EProf}). - - -%%--------------- ServerRequestInfo -------------------------- --record('ServerRequestInfo', - {request_id, - operation, - arguments, - exceptions, - contexts, - operation_context, - result, - response_expected, - sync_scope = 'SYNC_NONE', - reply_status, - forward_reference, - endian, - sending_exception, - object_id, - adapter_id, - target_most_derived_interface}). - --define(createInitSRI(_ReqID, _Op, _RespExp), - #'ServerRequestInfo'{request_id = _ReqID, - operation = _Op, - response_expected = _RespExp}). - - -%%--------------- DEFINES ------------------------------------ --define(DEBUG_LEVEL, 9). - --define(EFORMAT(_F, _A), exit(lists:flatten(io_lib:format(_F, _A)))). - -%%------------------------------------------------------------ -%%------------- NATIVE INTERCEPTOR FUNCTIONS------------------ -%%------------------------------------------------------------ -%% function : new_in_connection -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -new_in_connection(PIs, Host, Port, SHost, SPort) -> - case catch new_in_connection(PIs, undefined, Host, Port, SHost, SPort) of - {'EXIT', R} -> - orber:dbg("[~p] orber_pi:new_in_connection(~p); exit(~p)", - [?LINE, PIs, R], ?DEBUG_LEVEL), - ?EFORMAT("Supplied Interceptors unable to create a valid new_in_connection" - "Reason: ~p", [{'EXIT', R}]); - {'EXCEPTION', E} -> - orber:dbg("[~p] orber_pi:new_in_connection(~p); exception(~p)", - [?LINE, PIs, E], ?DEBUG_LEVEL), - ?EFORMAT("Supplied Interceptors unable to create a valid new_in_connection" - "Reason: ~p", [{'EXCEPTION', E}]); - Ref -> - Ref - end. - -new_in_connection([], Ref, _, _, _, _) -> - Ref; -new_in_connection([Mod|T], Ref, Host, Port, SHost, SPort) -> - case get_arity(Mod, new_in_connection) of - 5 -> - NewRef = Mod:new_in_connection(Ref, Host, Port, SHost, SPort), - new_in_connection(T, NewRef, Host, Port, SHost, SPort); - 3 -> - NewRef = Mod:new_in_connection(Ref, Host, Port), - new_in_connection(T, NewRef, Host, Port, SHost, SPort) - end. - -get_arity(Mod, Func) -> - get_arity(Mod, Func, true). -get_arity(Mod, Func, Retry) -> - case erlang:function_exported(Mod, Func, 5) of - true -> - 5; - false -> - case erlang:function_exported(Mod, Func, 3) of - true -> - 3; - false when Retry == true -> - {module, _} = code:ensure_loaded(Mod), - get_arity(Mod, Func, false); - false -> - exit("Unable to load interceptor") - end - end. - -%%------------------------------------------------------------ -%% function : closed_in_connection -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -closed_in_connection(PIs, Ref) -> - case catch closed_in_connection_helper(PIs, Ref) of - {'EXIT', R} -> - orber:dbg("[~p] orber_pi:closed_in_connection(~p, ~p); exit(~p)", - [?LINE, PIs, Ref, R], ?DEBUG_LEVEL), - ok; - {'EXCEPTION', E} -> - orber:dbg("[~p] orber_pi:closed_in_connection(~p, ~p); exception(~p)", - [?LINE, PIs, Ref, E], ?DEBUG_LEVEL), - ok; - _ -> - ok - end. - -closed_in_connection_helper([], _Ref) -> - ok; -closed_in_connection_helper([Mod|T], Ref) -> - NewRef = Mod:closed_in_connection(Ref), - closed_in_connection_helper(T, NewRef). - - -%%------------------------------------------------------------ -%% function : new_out_connection -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -new_out_connection(PIs, Host, Port, SHost, SPort) -> - case catch new_out_connection(PIs, undefined, Host, Port, SHost, SPort) of - {'EXIT', R} -> - orber:dbg("[~p] orber_pi:new_out_connection(~p); exit(~p)", - [?LINE, PIs, R], ?DEBUG_LEVEL), - ?EFORMAT("Supplied Interceptors unable to create a valid new_out_connection" - "Reason: ~p", [{'EXIT', R}]); - {'EXCEPTION', E} -> - orber:dbg("[~p] orber_pi:new_out_connection(~p); exception(~p)", - [?LINE, PIs, E], ?DEBUG_LEVEL), - ?EFORMAT("Supplied Interceptors unable to create a valid new_out_connection" - "Reason: ~p", [{'EXCEPTION', E}]); - Ref -> - Ref - end. - -new_out_connection([], Ref, _, _, _, _) -> - Ref; -new_out_connection([Mod|T], Ref, Host, Port, SHost, SPort) -> - case get_arity(Mod, new_out_connection) of - 5 -> - NewRef = Mod:new_out_connection(Ref, Host, Port, SHost, SPort), - new_out_connection(T, NewRef, Host, Port, SHost, SPort); - 3 -> - NewRef = Mod:new_out_connection(Ref, Host, Port), - new_out_connection(T, NewRef, Host, Port, SHost, SPort) - end. - -%%------------------------------------------------------------ -%% function : closed_out_connection -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -closed_out_connection(PIs, Ref) -> - case catch closed_out_connection_helper(PIs, Ref) of - {'EXIT', R} -> - orber:dbg("[~p] orber_pi:closed_out_connection(~p); exit(~p)", - [?LINE, PIs, R], ?DEBUG_LEVEL), - ok; - {'EXCEPTION', E} -> - orber:dbg("[~p] orber_pi:closed_out_connection(~p); exception(~p)", - [?LINE, PIs, E], ?DEBUG_LEVEL), - ok; - _ -> - ok - end. - -closed_out_connection_helper([], _Ref) -> - ok; -closed_out_connection_helper([Mod|T], Ref) -> - NewRef = Mod:closed_out_connection(Ref), - closed_out_connection_helper(T, NewRef). - -%%------------------------------------------------------------ -%% function : in_request_enc -%% Arguments: -%% Returns : -%% Exception: -%% Effect : Intercepts an incoming request (server-side). -%%------------------------------------------------------------ -in_request_enc(PIs, ReqHdr, Ref, Msg) -> - case catch in_request_enc(PIs, ReqHdr, Ref, Msg, undefined) of - {'EXIT', R} -> - orber:dbg("[~p] orber_pi:in_request_enc(~p, ~p, ~p); exit(~p)", - [?LINE, PIs, Ref, Msg, R], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_NO}); - {'EXCEPTION', E} -> - orber:dbg("[~p] orber_pi:in_request_enc(~p, ~p, ~p); exception(~p)", - [?LINE, PIs, Ref, Msg, E], ?DEBUG_LEVEL), - corba:raise(E); - NewMsg -> - NewMsg - end. - -in_request_enc([], _, _, Msg, _) -> - Msg; -in_request_enc([Mod|T], ReqHdr, Ref, Msg, Args) -> - {NewMsg, NewArgs} = Mod:in_request_encoded(Ref, ReqHdr#request_header.object_key, - ReqHdr#request_header.service_context, - ReqHdr#request_header.operation, - Msg, Args), - in_request_enc(T, ReqHdr, Ref, NewMsg, NewArgs). - -%%------------------------------------------------------------ -%% function : in_request -%% Arguments: -%% Returns : -%% Exception: -%% Effect : Intercepts an incoming request (server-side). -%%------------------------------------------------------------ -in_request(PIs, ReqHdr, Ref, Msg) -> - case catch in_request(PIs, ReqHdr, Ref, Msg, undefined) of - {'EXIT', R} -> - orber:dbg("[~p] orber_pi:in_request(~p, ~p, ~p); exit(~p)", - [?LINE, PIs, Ref, Msg, R], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_NO}); - {'EXCEPTION', E} -> - orber:dbg("[~p] orber_pi:in_request(~p, ~p, ~p); exception(~p)", - [?LINE, PIs, Ref, Msg, E], ?DEBUG_LEVEL), - corba:raise(E); - NewMsg -> - NewMsg - end. - -in_request([], _, _, Msg, _) -> - Msg; -in_request([Mod|T], ReqHdr, Ref, Msg, Args) -> - {NewMsg, NewArgs} = Mod:in_request(Ref, ReqHdr#request_header.object_key, - ReqHdr#request_header.service_context, - ReqHdr#request_header.operation, - Msg, Args), - in_request(T, ReqHdr, Ref, NewMsg, NewArgs). - -%%------------------------------------------------------------ -%% function : out_reply_enc -%% Arguments: -%% Returns : -%% Exception: -%% Effect : Intercept an outgoing reply (server-side). -%%------------------------------------------------------------ -out_reply_enc(PIs, ReqHdr, Ref, Msg, Ctx) -> - case catch out_reply_enc(PIs, ReqHdr, Ref, Msg, undefined, Ctx) of - {'EXIT', R} -> - orber:dbg("[~p] orber_pi:out_reply_enc(~p, ~p, ~p); exit(~p)", - [?LINE, PIs, Ref, Msg, R], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}); - {'EXCEPTION', E} -> - orber:dbg("[~p] orber_pi:out_reply_enc(~p, ~p, ~p); exception(~p)", - [?LINE, PIs, Ref, Msg, E], ?DEBUG_LEVEL), - corba:raise(E); - NewMsg -> - NewMsg - end. -out_reply_enc([], _, _, Msg, _, _) -> - Msg; -out_reply_enc([Mod|T], ReqHdr, Ref, Msg, Args, Ctx) -> - {NewMsg, NewArgs} = Mod:out_reply_encoded(Ref, ReqHdr#request_header.object_key, - Ctx, %% Out Context. - ReqHdr#request_header.operation, - Msg, Args), - out_reply_enc(T, ReqHdr, Ref, NewMsg, NewArgs, Ctx). - - -%%------------------------------------------------------------ -%% function : out_reply -%% Arguments: -%% Returns : -%% Exception: -%% Effect : Intercept an outgoing reply (server-side). -%%------------------------------------------------------------ -out_reply(PIs, ReqHdr, Ref, Msg, Ctx) -> - case catch out_reply(PIs, ReqHdr, Ref, Msg, undefined, Ctx) of - {'EXIT', R} -> - orber:dbg("[~p] orber_pi:out_reply(~p, ~p, ~p); exit(~p)", - [?LINE, PIs, Ref, Msg, R], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}); - NewMsg -> - NewMsg - end. -out_reply([], _, _, Msg, _, _) -> - Msg; -out_reply([Mod|T], ReqHdr, Ref, Msg, Args, Ctx) -> - {NewMsg, NewArgs} = Mod:out_reply(Ref, ReqHdr#request_header.object_key, - Ctx, %% Out Context. - ReqHdr#request_header.operation, - Msg, Args), - out_reply(T, ReqHdr, Ref, NewMsg, NewArgs, Ctx). - - -%%------------------------------------------------------------ -%% function : out_request_enc -%% Arguments: -%% Returns : -%% Exception: -%% Effect : Intercept an outgoing request (client-side). -%%------------------------------------------------------------ -out_request_enc(PIs, ObjKey, Ctx, Op, Ref, Msg) -> - case catch out_request_enc(PIs, ObjKey, Ctx, Op, Ref, Msg, undefined) of - {'EXIT', R} -> - orber:dbg("[~p] orber_pi:out_request_enc(~p, ~p, ~p); exit(~p)", - [?LINE, PIs, Ref, Msg, R], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_NO}); - {'EXCEPTION', E} -> - orber:dbg("[~p] orber_pi:out_request_enc(~p, ~p, ~p); exception(~p)", - [?LINE, PIs, Ref, Msg, E], ?DEBUG_LEVEL), - corba:raise(E); - NewMsg -> - NewMsg - end. - -out_request_enc([], _, _, _, _, Msg, _) -> - Msg; -out_request_enc([Mod|T], ObjKey, Ctx, Op, Ref, Msg, Args) -> - {NewMsg, NewArgs} = Mod:out_request_encoded(Ref, ObjKey, Ctx, Op, Msg, Args), - out_request_enc(T, ObjKey, Ctx, Op, Ref, NewMsg, NewArgs). - - -%%------------------------------------------------------------ -%% function : out_request -%% Arguments: -%% Returns : -%% Exception: -%% Effect : Intercept an outgoing request (client-side). -%%------------------------------------------------------------ -out_request(PIs, ObjKey, Ctx, Op, Ref, Msg) -> - case catch out_request(PIs, ObjKey, Ctx, Op, Ref, Msg, undefined) of - {'EXIT', R} -> - orber:dbg("[~p] orber_pi:out_request(~p, ~p, ~p); exit(~p)", - [?LINE, PIs, Ref, Msg, R], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_NO}); - {'EXCEPTION', E} -> - orber:dbg("[~p] orber_pi:out_request(~p, ~p, ~p); exception(~p)", - [?LINE, PIs, Ref, Msg, E], ?DEBUG_LEVEL), - corba:raise(E); - NewMsg -> - NewMsg - end. - -out_request([], _, _, _, _, Msg, _) -> - Msg; -out_request([Mod|T], ObjKey, Ctx, Op, Ref, Msg, Args) -> - {NewMsg, NewArgs} = Mod:out_request(Ref, ObjKey, Ctx, Op, Msg, Args), - out_request(T, ObjKey, Ctx, Op, Ref, NewMsg, NewArgs). - - -%%------------------------------------------------------------ -%% function :in_reply_enc -%% Arguments: -%% Returns : -%% Exception: -%% Effect : Intercept an incoming reply (client-side) -%%------------------------------------------------------------ -in_reply_enc(PIs, ObjKey, Ctx, Op, Ref, Msg) -> - case catch in_reply_enc(PIs, ObjKey, Ctx, Op, Ref, Msg, undefined) of - {'EXIT', R} -> - orber:dbg("[~p] orber_pi:in_reply_enc(~p, ~p, ~p); exit(~p)", - [?LINE, PIs, Ref, Msg, R], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}); - {'EXCEPTION', E} -> - orber:dbg("[~p] orber_pi:in_reply_enc(~p, ~p, ~p); exception(~p)", - [?LINE, PIs, Ref, Msg, E], ?DEBUG_LEVEL), - corba:raise(E); - NewMsg -> - NewMsg - end. - -in_reply_enc([], _, _, _, _, Msg, _) -> - Msg; -in_reply_enc([Mod|T], ObjKey, Ctx, Op, Ref, Msg, Args) -> - {NewMsg, NewArgs} = Mod:in_reply_encoded(Ref, ObjKey, Ctx, Op, Msg, Args), - in_reply_enc(T, ObjKey, Ctx, Op, Ref, NewMsg, NewArgs). - -%%------------------------------------------------------------ -%% function :in_reply -%% Arguments: -%% Returns : -%% Exception: -%% Effect : Intercept an incoming reply (client-side) -%%------------------------------------------------------------ -in_reply(PIs, ObjKey, Ctx, Op, Ref, Msg) -> - case catch in_reply(PIs, ObjKey, Ctx, Op, Ref, Msg, undefined) of - {'EXIT', R} -> - orber:dbg("[~p] orber_pi:in_reply(~p, ~p, ~p); exit(~p)", - [?LINE, PIs, Ref, Msg, R], ?DEBUG_LEVEL), - corba:raise(#'MARSHAL'{completion_status=?COMPLETED_MAYBE}); - NewMsg -> - NewMsg - end. - -in_reply([], _, _, _, _, Msg, _) -> - Msg; -in_reply([Mod|T], ObjKey, Ctx, Op, Ref, Msg, Args) -> - {NewMsg, NewArgs} = Mod:in_reply(Ref, ObjKey, Ctx, Op, Msg, Args), - in_reply(T, ObjKey, Ctx, Op, Ref, NewMsg, NewArgs). - - - - -%%------------------------------------------------------------ -%%------------- CODEC FUNCTIONS ------------------------------ -%%------------------------------------------------------------ -%% function : codefactory_create_codec -%% Arguments: #IOP_N_Encoding{} -%% Returns : CodecRef -%% Exception: -%% Effect : -%%------------------------------------------------------------ -codefactory_create_codec(#'IOP_N_Encoding'{format = 'IOP_N_ENCODING_CDR_ENCAPS', - major_version = Major, - minor_version = Minor}) - when is_integer(Major) andalso is_integer(Minor) -> - {Major, Minor}; -codefactory_create_codec(_) -> - corba:raise(#'IOP_N_CodecFactory_UnknownEncoding'{}). - -%%------------------------------------------------------------ -%% function : codec_encode -%% Arguments: Version - GIOP version -%% Any - #any{} -%% Returns : CORBA::OctetSeq -%% Exception: -%% Effect : -%%------------------------------------------------------------ -codec_encode(Version, Any) when is_record(Any, any) -> - %% Encode ByteOrder - {Bytes, Len} = cdr_encode:enc_type('tk_octet', Version, 0, [], 0), - {Bytes2, _Len2} = cdr_encode:enc_type('tk_any', Version, Any, Bytes, Len), - list_to_binary(lists:reverse(Bytes2)); -codec_encode(_Version, _Any) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%------------------------------------------------------------ -%% function : codec_encode_value -%% Arguments: Version - GIOP version -%% Any - #any{} -%% Returns : CORBA::OctetSeq -%% Exception: -%% Effect : Encode the Any#any.value only. -%%------------------------------------------------------------ -codec_encode_value(Version, #any{typecode = TC, value = Val}) -> - %% Encode ByteOrder - {Bytes, Len} = cdr_encode:enc_type('tk_octet', Version, 0, [], 0), - {Bytes2, _Len2} = cdr_encode:enc_type(TC, Version, Val, Bytes, Len), - list_to_binary(lists:reverse(Bytes2)); -codec_encode_value(_Version, _NotAnAny) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%------------------------------------------------------------ -%% function : codec_decode -%% Arguments: Version - GIOP version -%% Bytes - CORBA::OctetSeq -%% Returns : Any - #any{} -%% Exception: -%% Effect : -%%------------------------------------------------------------ -codec_decode(Version, Bytes) when is_binary(Bytes) -> - {ByteOrder, Rest} = cdr_decode:dec_byte_order(Bytes), - case catch cdr_decode:dec_type('tk_any', Version, Rest, 0, ByteOrder) of - {Any, [], _} -> - Any; - _-> - corba:raise(#'IOP_N_Codec_FormatMismatch'{}) - end; -codec_decode(_Version, _Any) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - -%%------------------------------------------------------------ -%% function : codec_decode_value -%% Arguments: Version - GIOP version -%% Bytes - CORBA::OctetSeq -%% TypeCode - CORBA::TypeCode -%% Returns : Any - #any{} -%% Exception: -%% Effect : -%%------------------------------------------------------------ -codec_decode_value(Version, Bytes, TypeCode) when is_binary(Bytes) -> - {ByteOrder, Rest} = cdr_decode:dec_byte_order(Bytes), - case catch cdr_decode:dec_type(TypeCode, Version, Rest, 0, ByteOrder) of - {Val, [], _} -> - #any{typecode = TypeCode, value = Val}; - _-> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) - end; -codec_decode_value(_Version, _Bytes, _TypeCode) -> - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). - - -%%------------------------------------------------------------ -%%------------- SERVER SIDE FUNCTIONS ------------------------ -%%------------------------------------------------------------ -%% To make a long story short, you find an conceptual description -%% of how, and in which order, the different functions is -%% supposed to be invoked. -%% -%%request_from_iiop(Bytes) -> -%% Reply = -%% case receive_service_contexts(ServerRequestInfo) of -%% SYSTEM EXC -> -%% send_exception(..); -%% ForwardRequest EXC -> -%% send_other(..); -%% NoEXC -> -%% case receive_request(..) of -%% SYSTEM EXC -> -%% send_exception(..); -%% ForwardRequest EXC -> -%% send_other(..); -%% No EXC -> -%% InvokeServer -%% end -%% end, -%% case Reply of -%% EXC -> -%% send_exception(..); -%% No EXC, Normal Reply -> -%% case send_reply(..) of -%% SYSTEM EXC -> -%% send_exception(..); -%% ForwardRequest EXC -> -%% send_other(..); -%% No Exc -> -%% Done -%% end; -%% No EXC, LOCATION_FORWARD -> -%% send_other(..) -%% end. -%% -%% -%%------------------------------------------------------------ -%% function : server_start_receive -%% Arguments: Msg - #giop_message{} -%% PIs - a list of Interceptors (see 'Comments' in the module header) -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -server_start_receive(PIs, Version, ReqHdr, Rest, Len, ByteOrder, Msg) -> - cdr_decode:dec_request_body(Version, ReqHdr, Rest, Len, ByteOrder, Msg), - SRI = ?createInitSRI(ReqHdr#request_header.request_id, - ReqHdr#request_header.operation, - ReqHdr#request_header.response_expected), - server_receive(receive_service_contexts, SRI, PIs, [], PIs). - -server_receive(receive_service_contexts, SRI, [], _Acc, PIs) -> - server_receive(receive_request, SRI, PIs, [], PIs); -server_receive(receive_service_contexts, SRI, [H|T], Acc, PIs) -> - case catch receive_service_contexts(SRI, H) of - {'EXCEPTION', #'PortableInterceptor_ForwardRequest'{forward=_Obj, - permanent=_Bool}} -> - server_send(send_other, SRI, Acc, [], PIs); - {'EXCEPTION', _E} -> - server_send(send_exception, SRI, Acc, [], PIs); - _ -> - server_receive(receive_service_contexts, SRI, T, Acc, PIs) - end; -server_receive(receive_request, SRI, [], _Acc, _PIs) -> - %% Done with receive interceptors, now we can call the server. - SRI; -server_receive(receive_request, SRI, [H|T], Acc, PIs) -> - case catch receive_request(SRI, H) of - {'EXCEPTION', #'PortableInterceptor_ForwardRequest'{forward=_Obj, - permanent=_Bool}} -> - server_send(send_other, SRI, Acc, [], PIs); - {'EXCEPTION', _E} -> - server_send(send_exception, SRI, Acc, [], PIs); - _ -> - server_receive(receive_request, SRI, T, Acc, PIs) - end. - - -%%------------------------------------------------------------ -%% function : server_start_send -%% Arguments: SRI - ServerRequestInfo -%% PIs - a list of Interceptors (see 'Comments' in the module header) -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ -server_start_send(PIs, SRI) -> - case SRI#'ServerRequestInfo'.reply_status of - 'PortableInterceptor_SUCCESSFUL' -> - server_send(send_reply, SRI, PIs, [], PIs); - 'PortableInterceptor_SYSTEM_EXCEPTION' -> - server_send(send_exception, SRI, PIs, [], PIs); - 'PortableInterceptor_USER_EXCEPTION' -> - server_send(send_exception, SRI, PIs, [], PIs); - _ -> - server_send(send_other, SRI, PIs, [], PIs) - end. - -server_send(_, SRI, [], _Acc, _PIs) -> - %% Done - SRI; -server_send(send_exception, SRI, [H|T], Acc, PIs) -> - case catch send_exception(SRI, H) of - {'EXCEPTION', #'PortableInterceptor_ForwardRequest'{forward=_Obj, - permanent=_Bool}} -> - server_send(send_other, SRI, Acc, [], PIs); - {'EXCEPTION', _E} -> - server_send(send_exception, SRI, Acc, [], PIs); - _ -> - server_send(send_exception, SRI, T, Acc, PIs) - end; -server_send(send_other, SRI, [H|T], Acc, PIs) -> - case catch send_other(SRI, H) of - {'EXCEPTION', #'PortableInterceptor_ForwardRequest'{forward=_Obj, - permanent=_Bool}} -> - server_send(send_other, SRI, T, Acc, PIs); - {'EXCEPTION', _E} -> - server_send(send_exception, SRI, T, Acc, PIs); - _ -> - server_send(send_other, SRI, T, Acc, PIs) - end; -server_send(send_reply, SRI, [H|T], Acc, PIs) -> - case catch send_reply(SRI, H) of - {'EXCEPTION', _E} -> - server_send(send_exception, SRI, T, Acc, PIs); - _ -> - server_send(send_reply, SRI, T, Acc, PIs) - end. - -receive_request(SRI, Mod) -> - apply(Mod, receive_request, [SRI]). - -send_other(SRI, Mod) -> - apply(Mod, send_other, [SRI]). - -receive_service_contexts(SRI, Mod) -> - apply(Mod, receive_service_contexts, [SRI]). - -send_reply(SRI, Mod) -> - apply(Mod, send_reply, [SRI]). - -send_exception(SRI, Mod) -> - apply(Mod, send_exception, [SRI]). - - -%%------------------------------------------------------------ -%%------------- CLIENT SIDE FUNCTIONS ------------------------ -%%------------------------------------------------------------ -%% To make a long story short, you find an conceptual description -%% of how, and in which order, the different functions is -%% supposed to be invoked. -%% -%%request(Data) -> -%% Reply = -%% case send_request(CRI) of -%% SYSTEM EXC -> -%% receive_exception(..); -%% ForwardRequest EXC -> -%% receive_other(..); -%% NoEXC -> -%% IIOP-send -%% end, -%% case Reply of -%% EXC -> -%% receive_exception(..); May raise system exc => receive_other(..); -%% No EXC, Normal Reply -> -%% receive_reply(..) May raise system exc => receive_exception(..); -%% Non-normal reply (e.g. LOCATION_FORWARD) -> -%% receive_other(..) May raise system exc => receive_exception(..); -%% end. -%%------------------------------------------------------------ -%% function : client_send -%% Arguments: CRI - ClientRequestInfo -%% PIs - a list of Interceptors (see 'Comments' in the module header) -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ - -client_send(CRI, PIs) -> - client_send(send_request, CRI, PIs, [], PIs). - -client_send(send_request, CRI, [], _, _) -> - CRI; -client_send(send_request, CRI, [H|T], Acc, PIs) -> - case catch send_request(CRI, H) of - {'EXCEPTION', #'PortableInterceptor_ForwardRequest'{forward=_Obj, - permanent=_Bool}} -> - client_receive(receive_other, CRI, T, [], PIs); - {'EXCEPTION', _E} -> - client_receive(receive_exception, CRI, Acc, [], PIs); - _ -> - client_send(send_request, CRI, T, Acc, PIs) - end. - - - -%%------------------------------------------------------------ -%% function : client_receive -%% Arguments: CRI - ClientRequestInfo -%% PIs - a list of Interceptors (see 'Comments' in the module header) -%% Returns : -%% Exception: -%% Effect : -%%------------------------------------------------------------ - -client_receive(CRI, PIs) -> - case CRI#'ClientRequestInfo'.reply_status of - 'PortableInterceptor_SUCCESSFUL' -> - client_receive(receive_reply, CRI, PIs, [], PIs); - 'PortableInterceptor_SYSTEM_EXCEPTION' -> - client_receive(receive_exception, CRI, PIs, [], PIs); - 'PortableInterceptor_USER_EXCEPTION' -> - client_receive(receive_exception, CRI, PIs, [], PIs); - _ -> - client_receive(receive_other, CRI, PIs, [], PIs) - end. - -client_receive(_, CRI, [], _, _) -> - %% Done - CRI; -client_receive(receive_reply, CRI, [H|T], Acc, PIs) -> - case catch receive_reply(CRI, H) of - {'EXCEPTION', _E} -> - client_receive(receive_exception, CRI, T, [H|Acc], PIs); - _ -> - client_receive(receive_reply, CRI, T, [H|Acc], PIs) - end; -client_receive(receive_exception, CRI, [H|T], Acc, PIs) -> - case catch receive_exception(CRI, H) of - {'EXCEPTION', #'PortableInterceptor_ForwardRequest'{forward=_Obj, - permanent=_Bool}} -> - client_receive(receive_other, CRI, T, [], PIs); - {'EXCEPTION', _E} -> - client_receive(receive_exception, CRI, T, [H|Acc], PIs); - _ -> - client_receive(receive_exception, CRI, T, [H|Acc], PIs) - end; -client_receive(receive_other, CRI, [H|T], Acc, PIs) -> - case catch receive_other(CRI, H) of - {'EXCEPTION', #'PortableInterceptor_ForwardRequest'{forward=_Obj, - permanent=_Bool}} -> - client_receive(receive_other, CRI, T, [], PIs); - {'EXCEPTION', _E} -> - client_receive(receive_exception, CRI, T, [H|Acc], PIs); - _ -> - client_receive(receive_other, CRI, T, [H|Acc], PIs) - end. - - - -send_request(CRI, Mod) -> - apply(Mod, send_request, [CRI]). - -receive_reply(CRI, Mod) -> - apply(Mod, receive_reply, [CRI]). - -receive_other(CRI, Mod) -> - apply(Mod, receive_other, [CRI]). - -receive_exception(CRI, Mod) -> - apply(Mod, receive_exception, [CRI]). - -%%------------------------------------------------------------ -%% Functions for retrieving info from RequestInfo -%% ServerRequestInfo and ClientRequestInfo. The ones matching -%% both ServerRequestInfo and ClientRequestInfo eq. RequestInfo. -%% Note, RequestInfo is inherrited by the others. -%%------------------------------------------------------------ -%%-----------------------------------------------------------% -%% function : _get_request_id -%% Arguments: ClientRequestInfo or ServerRequestInfo -%% Returns : ulong() -%%------------------------------------------------------------ -'_get_request_id'(#'ClientRequestInfo'{request_id = ID}) -> - ID; -'_get_request_id'(#'ServerRequestInfo'{request_id = ID}) -> - ID. - -%%-----------------------------------------------------------% -%% function : _get_operation -%% Arguments: ClientRequestInfo or ServerRequestInfo -%% Returns : string() -%%------------------------------------------------------------ -'_get_operation'(#'ClientRequestInfo'{operation = Op}) -> - Op; -'_get_operation'(#'ServerRequestInfo'{operation = Op}) -> - Op. - -%%-----------------------------------------------------------% -%% function : _get_arguments -%% Arguments: ClientRequestInfo or ServerRequestInfo -%% Returns : A list of #'Dynamic_Parameter'{} -%%------------------------------------------------------------ -'_get_arguments'(#'ClientRequestInfo'{arguments = Args}) -> - Args; -'_get_arguments'(#'ServerRequestInfo'{arguments = Args}) -> - Args. - -%%-----------------------------------------------------------% -%% function : _get_exceptions -%% Arguments: ClientRequestInfo or ServerRequestInfo -%% Returns : A list of CORBA::TypeCode -%%------------------------------------------------------------ -'_get_exceptions'(#'ClientRequestInfo'{exceptions = Exc}) -> - Exc; -'_get_exceptions'(#'ServerRequestInfo'{exceptions = Exc}) -> - Exc. - -%%-----------------------------------------------------------% -%% function : _get_contexts -%% Arguments: ClientRequestInfo or ServerRequestInfo -%% Returns : A list of CORBA::StringSeq -%%------------------------------------------------------------ -'_get_contexts'(#'ClientRequestInfo'{contexts = Ctx}) -> - Ctx; -'_get_contexts'(#'ServerRequestInfo'{contexts = Ctx}) -> - Ctx. - -%%-----------------------------------------------------------% -%% function : _get_operation_context -%% Arguments: ClientRequestInfo or ServerRequestInfo -%% Returns : A list of CORBA::StringSeq -%%------------------------------------------------------------ -'_get_operation_context'(#'ClientRequestInfo'{operation_context = OpCtx}) -> - OpCtx; -'_get_operation_context'(#'ServerRequestInfo'{operation_context = OpCtx}) -> - OpCtx. - -%%-----------------------------------------------------------% -%% function : _get_result -%% Arguments: ClientRequestInfo or ServerRequestInfo -%% Returns : #any{} -%%------------------------------------------------------------ -'_get_result'(#'ClientRequestInfo'{result = Res}) -> - Res; -'_get_result'(#'ServerRequestInfo'{result = Res}) -> - Res. - -%%-----------------------------------------------------------% -%% function : _get_response_expected -%% Arguments: ClientRequestInfo or ServerRequestInfo -%% Returns : boolean() -%%------------------------------------------------------------ -'_get_response_expected'(#'ClientRequestInfo'{response_expected = Bool}) -> - Bool; -'_get_response_expected'(#'ServerRequestInfo'{response_expected = Bool}) -> - Bool. - -%%-----------------------------------------------------------% -%% function : _get_sync_scope -%% Arguments: ClientRequestInfo or ServerRequestInfo -%% Returns : Messaging::SyncScoope ('SYNC_NONE', 'SYNC_WITH_TRANSPORT', -%% 'SYNC_WITH_SERVER', 'SYNC_WITH_TARGET') -%%------------------------------------------------------------ -'_get_sync_scope'(#'ClientRequestInfo'{sync_scope = SS}) -> - SS; -'_get_sync_scope'(#'ServerRequestInfo'{sync_scope = SS}) -> - SS. - -%%-----------------------------------------------------------% -%% function : _get_reply_status -%% Arguments: ClientRequestInfo or ServerRequestInfo -%% Returns : ReplyStatus (short), defined in orber_pi.hrl -%%------------------------------------------------------------ -'_get_reply_status'(#'ClientRequestInfo'{reply_status = RS}) -> - RS; -'_get_reply_status'(#'ServerRequestInfo'{reply_status = RS}) -> - RS. - -%%-----------------------------------------------------------% -%% function : _get_forward_reference -%% Arguments: ClientRequestInfo or ServerRequestInfo -%% Returns : Object -%%------------------------------------------------------------ -'_get_forward_reference'(#'ClientRequestInfo'{forward_reference = FR}) -> - FR; -'_get_forward_reference'(#'ServerRequestInfo'{forward_reference = FR}) -> - FR. - -%%------------------------------------------------------------ -%% function : get_slot -%% Arguments: ClientRequestInfo or ServerRequestInfo -%% SlotId - ulong() -%% Returns : {'EXCEPTION', #'PortableInterceptor_InvalidSlot'{}} -%%------------------------------------------------------------ --spec get_slot(_, _) -> no_return(). -get_slot(_XRI, _SlotId) -> - corba:raise(#'PortableInterceptor_InvalidSlot'{}). - -%%------------------------------------------------------------ -%% function : get_request_service_context -%% Arguments: ClientRequestInfo or ServerRequestInfo -%% ServiceId - IOP::ServiceId (defined in orber_iiop.hrl) -%% Returns : IOP::ServiceContext -%%------------------------------------------------------------ -get_request_service_context(#'ClientRequestInfo'{contexts = Ctx}, _ServiceId) -> - Ctx; -get_request_service_context(#'ServerRequestInfo'{contexts = Ctx}, _ServiceId) -> - Ctx. - -%%------------------------------------------------------------ -%% function : get_reply_service_context -%% Arguments: ClientRequestInfo or ServerRequestInfo -%% ServiceId - IOP::ServiceId (defined in orber_iiop.hrl) -%% Returns : IOP::ServiceContext -%%------------------------------------------------------------ -get_reply_service_context(#'ClientRequestInfo'{contexts = Ctx}, _ServiceId) -> - Ctx; -get_reply_service_context(#'ServerRequestInfo'{contexts = Ctx}, _ServiceId) -> - Ctx. - -%%------------------------------------------------------------ -%%-------------- ClientRequestInfo only ---------------------- -%%-----------------------------------------------------------% -%% function : _get_target -%% Arguments: ClientRequestInfo -%% Returns : Object -%%------------------------------------------------------------ -'_get_target'(#'ClientRequestInfo'{target = Target}) -> - Target. - -%%-----------------------------------------------------------% -%% function : _get_effective_target -%% Arguments: ClientRequestInfo -%% Returns : Object -%%------------------------------------------------------------ -'_get_effective_target'(#'ClientRequestInfo'{effective_target = ET}) -> - ET. - -%%-----------------------------------------------------------% -%% function : _get_effective_profile -%% Arguments: ClientRequestInfo -%% Returns : IOP:TaggedProfile -%%------------------------------------------------------------ -'_get_effective_profile'(#'ClientRequestInfo'{effective_profile = EP}) -> - EP. - -%%-----------------------------------------------------------% -%% function : _get_received_exception -%% Arguments: ClientRequestInfo -%% Returns : #any{} -%%------------------------------------------------------------ -'_get_received_exception'(#'ClientRequestInfo'{received_exception = RE}) -> - RE. - -%%-----------------------------------------------------------% -%% function : _get_received_exception -%% Arguments: ClientRequestInfo -%% Returns : CORBA::RepositoryId -%%------------------------------------------------------------ -'_get_received_exception_id'(#'ClientRequestInfo'{received_exception_id = REId}) -> - REId. - -%%------------------------------------------------------------ -%% function : get_effective_component -%% Arguments: ClientRequestInfo -%% Returns : IOR::TaggedComponent -%%------------------------------------------------------------ -get_effective_component(#'ClientRequestInfo'{target = Target}, _Id) -> - Target. - -%%------------------------------------------------------------ -%% function : get_effective_components -%% Arguments: ClientRequestInfo -%% Id -IOP::ComponentId (ulong()) -%% Returns : IOP_N::TaggedComponentSeq -%%------------------------------------------------------------ -get_effective_components(#'ClientRequestInfo'{target = Target}, _Id) -> - Target. - -%%------------------------------------------------------------ -%% function : get_request_policy -%% Arguments: ClientRequestInfo -%% Type - CORBA::PolicyType -%% Returns : IOP_N::TaggedComponentSeq -%%------------------------------------------------------------ -get_request_policy(#'ClientRequestInfo'{target = Target}, _Type) -> - Target. - -%%------------------------------------------------------------ -%% function : add_request_service_context -%% Arguments: ClientRequestInfo -%% Ctx - IOP::ServiceContext -%% Replace - boolean() -%% Returns : - -%%------------------------------------------------------------ -add_request_service_policy(#'ClientRequestInfo'{target = _Target}, - _Ctx, _Replace) -> - ok. - -%%------------------------------------------------------------ -%%-------------- ServerRequestInfo only ---------------------- -%%-----------------------------------------------------------% -%% function : _get_sending_exception -%% Arguments: ServerRequestInfo -%% Returns : #any{} -%%------------------------------------------------------------ -'_get_sending_exception'(#'ServerRequestInfo'{sending_exception = Exc}) -> - Exc. - -%%-----------------------------------------------------------% -%% function : _get_object_id -%% Arguments: ServerRequestInfo -%% Returns : CORBA::OctetSeq -%%------------------------------------------------------------ -'_get_object_id'(#'ServerRequestInfo'{object_id = OI}) -> - OI. - -%%-----------------------------------------------------------% -%% function : _get_adapter_id -%% Arguments: ServerRequestInfo -%% Returns : CORBA::OctetSeq -%%------------------------------------------------------------ -'_get_adapter_id'(#'ServerRequestInfo'{adapter_id = AI}) -> - AI. - -%%-----------------------------------------------------------% -%% function : _get_target_most_derived_interface -%% Arguments: ServerRequestInfo -%% Returns : CORBA::RepositoryId -%%------------------------------------------------------------ -'_get_target_most_derived_interface'(#'ServerRequestInfo' - {target_most_derived_interface = TMDI}) -> - TMDI. - -%%------------------------------------------------------------ -%% function : get_server_policy -%% Arguments: ServerRequestInfo -%% PolicyType - CORBA::PolicyType -%% Returns : CORBA::Policy -%%------------------------------------------------------------ -get_server_policy(#'ServerRequestInfo'{contexts = Ctxs}, _PolicyType) -> - Ctxs. - -%%------------------------------------------------------------ -%% function : set_slot -%% Arguments: ServerRequestInfo -%% SlotId - ulong() -%% Data - #any{} -%% Returns : {'EXCEPTION', #'PortableInterceptor_InvalidSlot'{}} -%%------------------------------------------------------------ --spec set_slot(_, _, _) -> no_return(). -set_slot(_SRI, _SlotId, _Data) -> - corba:raise(#'PortableInterceptor_InvalidSlot'{}). - -%%-----------------------------------------------------------% -%% function : target_is_a -%% Arguments: ServerRequestInfo -%% IFRId - CORBA::RepositoryId -%% Returns : boolean() -%%------------------------------------------------------------ -target_is_a(#'ServerRequestInfo'{object_id = ObjId}, IFRId) -> - corba_object:is_a(ObjId, IFRId). - -%%------------------------------------------------------------ -%% function : add_reply_service_context -%% Arguments: ServerRequestInfo -%% Ctx - IOP::ServiceContext -%% Replace - boolean() -%% Returns : - -%%------------------------------------------------------------ -add_reply_service_context(#'ServerRequestInfo'{contexts = Ctxs}, _Ctx, _Replace) -> - Ctxs. - - -%%--------------- END OF MODULE ------------------------------ diff --git a/lib/orber/src/orber_request_number.erl b/lib/orber/src/orber_request_number.erl deleted file mode 100644 index 755b999c13..0000000000 --- a/lib/orber/src/orber_request_number.erl +++ /dev/null @@ -1,83 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: orber_request_number.erl -%% -%% Description: -%% This file contains the request number server in Orber -%% -%%----------------------------------------------------------------- --module(orber_request_number). - --behaviour(gen_server). - --include_lib("orber/src/orber_iiop.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([start/1, get/0, reset/0]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([init/1, terminate/2, handle_call/3]). --export([handle_cast/2, handle_info/2, code_change/3]). - -%%----------------------------------------------------------------- -%% External interface functions -%%----------------------------------------------------------------- -start(Opts) -> - gen_server:start_link({local, orber_reqno}, orber_request_number, Opts, []). - -get() -> - gen_server:call(orber_reqno, get, infinity). - -reset() -> - gen_server:call(orber_reqno, reset, infinity). - -%%----------------------------------------------------------------- -%% Server functions -%%----------------------------------------------------------------- -init(_Opts) -> - {ok, 0}. - -terminate(_Reason, _State) -> - ok. -%% Max is ulong 0 .. 2^32-1 -handle_call(get, _From, State) when State < ?ULONGMAX -> - {reply, State, State+1}; -handle_call(get, _From, _State) -> - {reply, ?ULONGMAX, 0}; -handle_call(reset, _From, _State) -> - {reply, ok, 0}. - -handle_cast(_, State) -> - {noreply, State}. - -handle_info(_, State) -> - {noreply, State}. - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - - diff --git a/lib/orber/src/orber_socket.erl b/lib/orber/src/orber_socket.erl deleted file mode 100644 index 9b39dad928..0000000000 --- a/lib/orber/src/orber_socket.erl +++ /dev/null @@ -1,530 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%%%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: orber_socket.erl -%% -%% Description: -%% This file contains a standard interface to the sockets to handle the differences -%% between the implementations used. -%% -%%----------------------------------------------------------------- --module(orber_socket). - --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). - - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([start/0, connect/4, listen/3, listen/4, accept/2, accept/3, write/3, - controlling_process/3, close/2, peername/2, sockname/2, - peerdata/2, peercert/2, sockdata/2, setopts/3, - clear/2, shutdown/3, post_accept/2, post_accept/3, - get_ip_family_opts/1]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% Internal defines -%%----------------------------------------------------------------- --define(DEBUG_LEVEL, 6). - -%%----------------------------------------------------------------- -%% External functions -%%----------------------------------------------------------------- -start() -> - inet_db:start(). - -%%----------------------------------------------------------------- -%% Invoke the required setopts (i.e., inet or ssl) -setopts(normal, Socket, Opts) -> - inet:setopts(Socket, Opts); -setopts(ssl, Socket, Opts) -> - ssl:setopts(Socket, Opts). - -%%----------------------------------------------------------------- -%% Connect to IIOP Port at Host in CDR mode, in order to -%% establish a connection. -%% -connect(Type, Host, Port, Options) -> - Timeout = orber:iiop_setup_connection_timeout(), - Generation = orber_env:ssl_generation(), - Options1 = check_options(Type, Options, Generation), - Options2 = - case Type of - normal -> - [{keepalive, orber_env:iiop_out_keepalive()}|Options1]; - _ -> - Options1 - end, - case orber:iiop_out_ports() of - {Min, Max} when Type == normal -> - multi_connect(get_port_sequence(Min, Max), orber_env:iiop_out_ports_attempts(), - Type, Host, Port, [binary, {reuseaddr, true}, - {packet,cdr}| Options2], Timeout); - {Min, Max} when Generation > 2 -> - multi_connect(get_port_sequence(Min, Max), orber_env:iiop_out_ports_attempts(), - Type, Host, Port, [binary, {reuseaddr, true}, - {packet,cdr}| Options2], Timeout); - {Min, Max} -> - %% reuseaddr not available for older SSL versions - multi_connect(get_port_sequence(Min, Max), orber_env:iiop_out_ports_attempts(), - Type, Host, Port, [binary, {packet,cdr}| Options2], Timeout); - _ -> - connect(Type, Host, Port, [binary, {packet,cdr}| Options2], Timeout) - end. - -connect(normal, Host, Port, Options, Timeout) -> - case catch gen_tcp:connect(Host, Port, Options, Timeout) of - {ok, Socket} -> - Socket; - {error, timeout} -> - orber:dbg("[~p] orber_socket:connect(normal, ~p, ~p, ~p);~n" - "Timeout after ~p msec.", - [?LINE, Host, Port, Options, Timeout], ?DEBUG_LEVEL), - corba:raise(#'COMM_FAILURE'{minor=(?ORBER_VMCID bor 4), - completion_status=?COMPLETED_NO}); - Error -> - orber:dbg("[~p] orber_socket:connect(normal, ~p, ~p, ~p);~n" - "Failed with reason: ~p", - [?LINE, Host, Port, Options, Error], ?DEBUG_LEVEL), - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO}) - end; -connect(ssl, Host, Port, Options, Timeout) -> - case catch ssl:connect(Host, Port, Options, Timeout) of - {ok, Socket} -> - Socket; - {error, timeout} -> - orber:dbg("[~p] orber_socket:connect(ssl, ~p, ~p, ~p);~n" - "Timeout after ~p msec.", - [?LINE, Host, Port, Options, Timeout], ?DEBUG_LEVEL), - corba:raise(#'COMM_FAILURE'{minor=(?ORBER_VMCID bor 4), - completion_status=?COMPLETED_NO}); - Error -> - orber:dbg("[~p] orber_socket:connect(ssl, ~p, ~p, ~p);~n" - "Failed with reason: ~p", - [?LINE, Host, Port, Options, Error], ?DEBUG_LEVEL), - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO}) - end. - -multi_connect([], _Retries, Type, Host, Port, Options, _) -> - orber:dbg("[~p] orber_socket:multi_connect(~p, ~p, ~p, ~p);~n" - "Unable to use any of the sockets defined by 'iiop_out_ports'.~n" - "Either all ports are in use or to many connections already exists.", - [?LINE, Type, Host, Port, Options], ?DEBUG_LEVEL), - corba:raise(#'IMP_LIMIT'{minor=(?ORBER_VMCID bor 1), completion_status=?COMPLETED_NO}); -multi_connect([CurrentPort|Rest], Retries, normal, Host, Port, Options, Timeout) -> - case catch gen_tcp:connect(Host, Port, [{port, CurrentPort}|Options], Timeout) of - {ok, Socket} -> - Socket; - {error, timeout} when Retries =< 1 -> - orber:dbg("[~p] orber_socket:multi_connect(normal, ~p, ~p, ~p);~n" - "Timeout after ~p msec.", - [?LINE, Host, Port, [{port, CurrentPort}|Options], - Timeout], ?DEBUG_LEVEL), - corba:raise(#'COMM_FAILURE'{minor=(?ORBER_VMCID bor 4), - completion_status=?COMPLETED_NO}); - _ -> - multi_connect(Rest, Retries - 1, normal, Host, Port, Options, Timeout) - end; -multi_connect([CurrentPort|Rest], Retries, ssl, Host, Port, Options, Timeout) -> - case catch ssl:connect(Host, Port, [{port, CurrentPort}|Options], Timeout) of - {ok, Socket} -> - Socket; - {error, timeout} when Retries =< 1 -> - orber:dbg("[~p] orber_socket:multi_connect(ssl, ~p, ~p, ~p);~n" - "Timeout after ~p msec.", - [?LINE, Host, Port, [{port, CurrentPort}|Options], - Timeout], ?DEBUG_LEVEL), - corba:raise(#'COMM_FAILURE'{minor=(?ORBER_VMCID bor 4), - completion_status=?COMPLETED_NO}); - _ -> - multi_connect(Rest, Retries - 1, ssl, Host, Port, Options, Timeout) - end. - - -get_port_sequence(Min, Max) -> - case orber_env:iiop_out_ports_random() of - true -> - Seq = lists:seq(Min, Max), - random_sequence((Max - Min) + 1, Seq, []); - _ -> - lists:seq(Min, Max) - end. - -random_sequence(0, _, Acc) -> - Acc; -random_sequence(Length, Seq, Acc) -> - Nth = rand:uniform(Length), - Value = lists:nth(Nth, Seq), - NewSeq = lists:delete(Value, Seq), - random_sequence(Length-1, NewSeq, [Value|Acc]). - -%%----------------------------------------------------------------- -%% Create a listen socket at Port in CDR mode for -%% data connection. -%% -listen(Type, Port, Options) -> - listen(Type, Port, Options, true). - -listen(normal, Port, Options, Exception) -> - Options1 = check_options(normal, Options, 0), - Backlog = orber:iiop_backlog(), - Keepalive = orber_env:iiop_in_keepalive(), - Options2 = case orber:iiop_max_in_requests() of - infinity -> - Options1; - _MaxRequests -> - [{active, once}|Options1] - end, - Options3 = case orber_env:iiop_packet_size() of - infinity -> - Options2; - MaxSize -> - [{packet_size, MaxSize}|Options2] - end, - Options4 = [binary, {packet,cdr}, {keepalive, Keepalive}, - {reuseaddr,true}, {backlog, Backlog} | - Options3], - - case catch gen_tcp:listen(Port, Options4) of - {ok, ListenSocket} -> - {ok, ListenSocket, check_port(Port, normal, ListenSocket)}; - {error, Reason} when Exception == false -> - {error, Reason}; - {error, eaddrinuse} -> - orber:dbg("[~p] orber_socket:listen(normal, ~p, ~p);~n" - "Looks like the listen port is already in use.~n" - "Check if another Orber is started~n" - "on the same node and uses the same listen port (iiop_port). But it may also~n" - "be used by any other application; confirm with 'netstat'.", - [?LINE, Port, Options4], ?DEBUG_LEVEL), - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO}); - Error -> - orber:dbg("[~p] orber_socket:listen(normal, ~p, ~p);~n" - "Failed with reason: ~p", - [?LINE, Port, Options4, Error], ?DEBUG_LEVEL), - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO}) - end; -listen(ssl, Port, Options, Exception) -> - Backlog = orber:iiop_ssl_backlog(), - Generation = orber_env:ssl_generation(), - Options1 = check_options(ssl, Options, Generation), - Options2 = case orber:iiop_max_in_requests() of - infinity -> - Options1; - _MaxRequests -> - [{active, once}|Options1] - end, - Options3 = case orber_env:iiop_packet_size() of - infinity -> - Options2; - MaxSize -> - [{packet_size, MaxSize}|Options2] - end, - Options4 = if - Generation > 2 -> - [{reuseaddr, true} |Options3]; - true -> - Options3 - end, - Options5 = [binary, {packet,cdr}, {backlog, Backlog} | Options4], - case catch ssl:listen(Port, Options5) of - {ok, ListenSocket} -> - {ok, ListenSocket, check_port(Port, ssl, ListenSocket)}; - {error, Reason} when Exception == false -> - {error, Reason}; - {error, eaddrinuse} -> - orber:dbg("[~p] orber_socket:listen(ssl, ~p, ~p);~n" - "Looks like the listen port is already in use. Check if~n" - "another Orber is started on the same node and uses the~n" - "same listen port (iiop_port). But it may also~n" - "be used by any other application; confirm with 'netstat'.", - [?LINE, Port, Options5], ?DEBUG_LEVEL), - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO}); - Error -> - orber:dbg("[~p] orber_socket:listen(ssl, ~p, ~p);~n" - "Failed with reason: ~p", - [?LINE, Port, Options5, Error], ?DEBUG_LEVEL), - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO}) - end. - -%%----------------------------------------------------------------- -%% Wait in accept on the socket -%% -accept(Type, ListenSocket) -> - accept(Type, ListenSocket, infinity). - -accept(normal, ListenSocket, _Timeout) -> - case catch gen_tcp:accept(ListenSocket) of - {ok, S} -> - S; - Error -> - orber:dbg("[~p] orber_socket:accept(normal, ~p);~n" - "Failed with reason: ~p", - [?LINE, ListenSocket, Error], ?DEBUG_LEVEL), - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO}) - end; -accept(ssl, ListenSocket, Timeout) -> - case catch ssl:transport_accept(ListenSocket, Timeout) of - {ok, S} -> - S; - Error -> - orber:dbg("[~p] orber_socket:accept(ssl, ~p);~n" - "Failed with reason: ~p", - [?LINE, ListenSocket, Error], ?DEBUG_LEVEL), - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO}) - end. - -post_accept(Type, Socket) -> - post_accept(Type, Socket, infinity). - -post_accept(normal, _Socket, _Timeout) -> - ok; -post_accept(ssl, Socket, Timeout) -> - case catch ssl:ssl_accept(Socket, Timeout) of - ok -> - ok; - Error -> - orber:dbg("[~p] orber_socket:post_accept(ssl, ~p);~n" - "Failed with reason: ~p", - [?LINE, Socket, Error], ?DEBUG_LEVEL), - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO}) - end. - - -%%----------------------------------------------------------------- -%% Close the socket -%% -close(normal, Socket) -> - (catch gen_tcp:close(Socket)); -close(ssl, Socket) -> - (catch ssl:close(Socket)). - -%%----------------------------------------------------------------- -%% Write to socket -%% -write(normal, Socket, Bytes) -> - gen_tcp:send(Socket, Bytes); -write(ssl, Socket, Bytes) -> - ssl:send(Socket, Bytes). - -%%----------------------------------------------------------------- -%% Change the controlling process for the socket -%% -controlling_process(normal, Socket, Pid) -> - gen_tcp:controlling_process(Socket, Pid); -controlling_process(ssl, Socket, Pid) -> - ssl:controlling_process(Socket, Pid). - -%%----------------------------------------------------------------- -%% Get peername -%% -peername(normal, Socket) -> - inet:peername(Socket); -peername(ssl, Socket) -> - ssl:peername(Socket). - -%%----------------------------------------------------------------- -%% Get peercert -%% -peercert(ssl, Socket) -> - ssl:peercert(Socket); -peercert(Type, _Socket) -> - orber:dbg("[~p] orber_socket:peercert(~p);~n" - "Only available for SSL sockets.", - [?LINE, Type], ?DEBUG_LEVEL), - {error, ebadsocket}. - -%%----------------------------------------------------------------- -%% Get peerdata -%% -peerdata(normal, Socket) -> - create_data(inet:peername(Socket)); -peerdata(ssl, Socket) -> - create_data(ssl:peername(Socket)). - -%%----------------------------------------------------------------- -%% Get sockname -%% -sockname(normal, Socket) -> - inet:sockname(Socket); -sockname(ssl, Socket) -> - ssl:sockname(Socket). - -%%----------------------------------------------------------------- -%% Get sockdata -%% -sockdata(normal, Socket) -> - create_data(inet:sockname(Socket)); -sockdata(ssl, Socket) -> - create_data(ssl:sockname(Socket)). - - -create_data({ok, {Addr, Port}}) -> - {orber_env:addr2str(Addr), Port}; -create_data(What) -> - orber:dbg("[~p] orber_socket:peername() or orber_socket:sockname();~n" - "Failed with reason: ~p", [?LINE, What], ?DEBUG_LEVEL), - {"Unable to lookup peer- or sockname", 0}. - - -%%----------------------------------------------------------------- -%% Shutdown Connection -%% How = read | write | read_write -shutdown(normal, Socket, How) -> - gen_tcp:shutdown(Socket, How); -shutdown(ssl, Socket, How) -> - Generation = orber_env:ssl_generation(), - if - Generation > 2 -> - ssl:shutdown(Socket, How); - How == read_write -> - %% Older versions of SSL do no support shutdown. - %% For now we'll use this solution instead. - close(ssl, Socket); - true -> - {error, undefined} - end. - -%%----------------------------------------------------------------- -%% Remove Messages from queue -%% -clear(normal, Socket) -> - tcp_clear(Socket); -clear(ssl, Socket) -> - ssl_clear(Socket). - - - -%% Inet also checks for the following messages: -%% * {S, {data, Data}} -%% * {inet_async, S, Ref, Status}, -%% * {inet_reply, S, Status} -%% SSL doesn't. -tcp_clear(Socket) -> - receive - {tcp, Socket, _Data} -> - tcp_clear(Socket); - {tcp_closed, Socket} -> - tcp_clear(Socket); - {tcp_error, Socket, _Reason} -> - tcp_clear(Socket) - after 0 -> - ok - end. - -ssl_clear(Socket) -> - receive - {ssl, Socket, _Data} -> - ssl_clear(Socket); - {ssl_closed, Socket} -> - ssl_clear(Socket); - {ssl_error, Socket, _Reason} -> - ssl_clear(Socket) - after 0 -> - ok - end. - - - -%%----------------------------------------------------------------- -%% Check Port. If the user supplies 0 we pick any vacant port. But then -%% we must change the associated environment variable -check_port(0, normal, Socket) -> - case inet:port(Socket) of - {ok, Port} -> - orber:configure_override(iiop_port, Port), - Port; - What -> - orber:dbg("[~p] orber_socket:check_port(~p);~n" - "Unable to extract the port number via inet:port/1~n", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO}) - end; -check_port(0, ssl, Socket) -> - case ssl:sockname(Socket) of - {ok, {_Address, Port}} -> - orber:configure_override(iiop_ssl_port, Port), - Port; - What -> - orber:dbg("[~p] orber_socket:check_port(~p);~n" - "Unable to extract the port number via ssl:sockname/1~n", - [?LINE, What], ?DEBUG_LEVEL), - corba:raise(#'COMM_FAILURE'{completion_status=?COMPLETED_NO}) - end; -check_port(Port, _, _) -> - Port. - -%%----------------------------------------------------------------- -%% Check Options. -check_options(normal, Options, _Generation) -> - Options; -check_options(ssl, Options, Generation) -> - if - Generation > 2 -> - [{ssl_imp, new}|Options]; - true -> - [{ssl_imp, old}|Options] - end. - - -%%----------------------------------------------------------------- -%% Check IP Family. -get_ip_family_opts(Host) -> - case inet:parse_address(Host) of - {ok, {_,_,_,_}} -> - [inet]; - {ok, {_,_,_,_,_,_,_,_}} -> - [inet6]; - {error, einval} -> - check_family_for_name(Host, orber_env:ip_version()) - end. - -check_family_for_name(Host, inet) -> - case inet:getaddr(Host, inet) of - {ok, _Address} -> - [inet]; - {error, _} -> - case inet:getaddr(Host, inet6) of - {ok, _Address} -> - [inet6]; - {error, _} -> - [inet] - end - end; -check_family_for_name(Host, inet6) -> - case inet:getaddr(Host, inet6) of - {ok, _Address} -> - [inet6]; - {error, _} -> - case inet:getaddr(Host, inet) of - {ok, _Address} -> - [inet]; - {error, _} -> - [inet6] - end - end. - diff --git a/lib/orber/src/orber_tb.erl b/lib/orber/src/orber_tb.erl deleted file mode 100644 index 6a758330cd..0000000000 --- a/lib/orber/src/orber_tb.erl +++ /dev/null @@ -1,222 +0,0 @@ -%%---------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File: orber_tb.erl -%% -%% Description: -%% Handling MISC functions. -%% -%% Creation date: 040723 -%% -%%---------------------------------------------------------------------- --module(orber_tb). - --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). - -%%---------------------------------------------------------------------- -%% External exports -%%---------------------------------------------------------------------- -%% Avoid warning for local function error/2 clashing with autoimported BIF. --compile({no_auto_import,[error/2]}). --export([wait_for_tables/1, wait_for_tables/2, wait_for_tables/3, - is_loaded/0, is_loaded/1, is_running/0, is_running/1, - info/2, error/2, unique/1, keysearch/2, keysearch/3, - check_illegal_tcp_options/1]). - -%%---------------------------------------------------------------------- -%% Internal exports -%%---------------------------------------------------------------------- --define(DEBUG_LEVEL, 5). - --define(FORMAT(_F, _A), {error, lists:flatten(io_lib:format(_F, _A))}). --define(EFORMAT(_F, _A), exit(lists:flatten(io_lib:format(_F, _A)))). - -%%---------------------------------------------------------------------- -%% Record Definitions -%%---------------------------------------------------------------------- - -%%---------------------------------------------------------------------- -%% External functions -%%---------------------------------------------------------------------- -%%---------------------------------------------------------------------- -%% Function : is_loaded/is_running -%% Arguments : -%% Returns : -%% Raises : -%% Description: -%%---------------------------------------------------------------------- -is_loaded() -> - is_loaded(orber). -is_loaded(Appl) -> - find_application(application:loaded_applications(), Appl). - -is_running() -> - is_running(orber). -is_running(Appl) -> - find_application(application:which_applications(), Appl). - -find_application([], _) -> - false; -find_application([{Appl, _, _} |_], Appl) -> - true; -find_application([_ |As], Appl) -> - find_application(As, Appl). - -%%---------------------------------------------------------------------- -%% function : keysearch/2/3 -%% Arguments: KeyValue - [{Key, Value}] -%% Key - term() -%% Value - term() -%% Default - term() -%% Returns : Value | Default -%% Exception: -%% Effect : -%%---------------------------------------------------------------------- -keysearch(Key, KeyValue) -> - keysearch(Key, KeyValue, undefined). -keysearch(Key, KeyValue, Default) -> - case lists:keysearch(Key, 1, KeyValue) of - {value, {Key, Value}} -> - Value; - _ -> - Default - end. - -%%---------------------------------------------------------------------- -%% function : wait_for_tables/1 -%% Arguments: Tables - list of mnesia tables -%% Timeout - integer (no point in allowing infinity) -%% Attempts - integer > 0 How many times should we try -%% Returns : -%% Exception: -%% Effect : -%%---------------------------------------------------------------------- -wait_for_tables(Tables) -> - wait_for_tables(Tables, 30000, -1). -wait_for_tables(Tables, Timeout) -> - wait_for_tables(Tables, Timeout, -1). -wait_for_tables(Tables, _Timeout, 0) -> - error("Mnesia failed to load the some or all of the following" - "tables:~n~p", [Tables]), - {error, "The requested Mnesia tables not yet available."}; -wait_for_tables(Tables, Timeout, Attempts) -> - case mnesia:wait_for_tables(Tables, Timeout) of - ok -> - ok; - {timeout, BadTabList} -> - info("Mnesia hasn't loaded the following tables (~p msec):~n~p", - [Timeout, BadTabList]), - wait_for_tables(BadTabList, Timeout, Attempts-1); - {error, Reason} -> - error("Mnesia failed to load the some or all of the following" - "tables:~n~p", [Tables]), - {error, Reason} - end. - -%%---------------------------------------------------------------------- -%% function : unique/1 -%% Arguments: List - [term()] -%% Returns : [term()] -%% Exception: -%% Effect : Remove all duplicates from the list. -%%---------------------------------------------------------------------- -unique([]) -> []; -unique(List) -> - Sorted = lists:sort(List), - unique(hd(Sorted), - tl(Sorted), []). - -unique(A, [A|R], Acc) -> - unique(A, R, Acc); -unique(A, [B|R], Acc) -> - unique(B, R, [A|Acc]); -unique(A, [], Acc) -> - lists:reverse([A|Acc]). - - -%%---------------------------------------------------------------------- -%% function : info/2 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%---------------------------------------------------------------------- -info(Format, Args) -> - catch error_logger:info_msg("=================== Orber =================~n"++ - Format++ - "~n===========================================~n", - Args). - -%%---------------------------------------------------------------------- -%% function : error/2 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%---------------------------------------------------------------------- -error(Format, Args) -> - catch error_logger:error_msg("=================== Orber =================~n"++ - Format++ - "~n===========================================~n", - Args). - - - - - -%%---------------------------------------------------------------------- -%% function : check_illegal_tcp_options/1 -%% Arguments: -%% Returns : -%% Exception: -%% Effect : -%%---------------------------------------------------------------------- -check_illegal_tcp_options(Options) -> - check_illegal_tcp_options(Options, []). - -check_illegal_tcp_options([],[]) -> - ok; -check_illegal_tcp_options([],IllegalOpts) -> - {error, IllegalOpts}; -check_illegal_tcp_options([{active, V} |T], IllegalOpts) -> - check_illegal_tcp_options(T,[{active, V} |IllegalOpts]); -check_illegal_tcp_options([{packet, V} |T], IllegalOpts) -> - check_illegal_tcp_options(T,[{packet, V} |IllegalOpts]); -check_illegal_tcp_options([{mode, V} |T], IllegalOpts) -> - check_illegal_tcp_options(T,[{mode, V} |IllegalOpts]); -check_illegal_tcp_options([list |T], IllegalOpts) -> - check_illegal_tcp_options(T,[list |IllegalOpts]); -check_illegal_tcp_options([binary |T], IllegalOpts) -> - check_illegal_tcp_options(T,[binary |IllegalOpts]); -check_illegal_tcp_options([{reuseaddr, V} |T], IllegalOpts) -> - check_illegal_tcp_options(T,[{reuseaddr, V} |IllegalOpts]); -check_illegal_tcp_options([_H|T], IllegalOpts) -> - check_illegal_tcp_options(T, IllegalOpts). - -%%---------------------------------------------------------------------- -%% Internal functions -%%---------------------------------------------------------------------- - -%%---------------------------------------------------------------------- -%%------------- END OF MODULE ------------------------------------------ -%%---------------------------------------------------------------------- diff --git a/lib/orber/src/orber_tc.erl b/lib/orber/src/orber_tc.erl deleted file mode 100644 index 9a8a9259ed..0000000000 --- a/lib/orber/src/orber_tc.erl +++ /dev/null @@ -1,284 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1998-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: orber_tc.erl -%% Description: -%% This file contains utility functions to create TypeCodes -%% -%%----------------------------------------------------------------- --module(orber_tc). - --include_lib("orber/include/ifr_types.hrl"). --include_lib("orber/include/corba.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([null/0, void/0, short/0, unsigned_short/0, - long/0, longdouble/0, unsigned_long/0, long_long/0, - unsigned_long_long/0, float/0, double/0, - boolean/0, char/0, wchar/0, octet/0, any/0, - typecode/0, principal/0, - object_reference/2, struct/3, - union/5, enum/3, - string/1, wstring/1, sequence/2, array/2, alias/3, - exception/3, fixed/2, value/5, value_box/3, native/2, abstract_interface/2, - get_tc/1, check_tc/1]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - -%%----------------------------------------------------------------- -%% External interface functions -%%----------------------------------------------------------------- - -%%----------------------------------------------------------------- -%% Macros -%%----------------------------------------------------------------- --define(DEBUG_LEVEL, 5). - -%%----------------------------------------------------------------- -%% A number of function which can be used to create TypeCodes -null() -> - tk_null. -void() -> - tk_void. -short() -> - tk_short. -unsigned_short() -> - tk_ushort. -long() -> - tk_long. -unsigned_long() -> - tk_ulong. -long_long() -> - tk_longlong. -unsigned_long_long() -> - tk_ulonglong. -float() -> - tk_float. -double() -> - tk_double. -longdouble() -> - tk_longdouble. - -boolean() -> - tk_boolean. -char() -> - tk_char. -wchar() -> - tk_wchar. -octet() -> - tk_octet. -any() -> - tk_any. -typecode() -> - tk_TypeCode. -principal() -> - tk_Principal. - -object_reference(Id, Name) -> - {tk_objref, Id, Name}. - -struct(Id, Name, ElementList) -> - {tk_struct, Id, Name, ElementList}. - -union(Id, Name, DiscrTC, Default, ElementList) -> - {tk_union, Id, Name, DiscrTC, Default, ElementList}. - -enum(Id, Name, ElementList) -> - {tk_enum, Id, Name, ElementList}. - -string(Length) -> - {tk_string, Length}. - -wstring(Length) -> - {tk_wstring, Length}. - -sequence(ElemTC, Length) -> - {tk_sequence, ElemTC, Length}. - -array(ElemTC, Length) -> - {tk_array, ElemTC, Length}. - -alias(Id, Name, TC) -> - {tk_alias, Id, Name, TC}. - -exception(Id, Name, ElementList) -> - {tk_except, Id, Name, ElementList}. - -fixed(Digits, Scale) -> - {tk_fixed, Digits, Scale}. - -value(RepId, Name, ValueModifier, TC, ElementList) -> - {tk_value, RepId, Name, ValueModifier, TC, ElementList}. - -value_box(RepId, Name, TC) -> - {tk_value_box, RepId, Name, TC}. - -native(RepId, Name) -> - {tk_native, RepId, Name}. - -abstract_interface(RepId, Name) -> - {tk_abstract_interface, RepId, Name}. - - -%%----------------------------------------------------------------- -%% Get TypeCode (can be used for constructed types like structs, -%% unions and exceptions) -%% -get_tc(T) when is_tuple(T) -> - Type = element(1, T), - case catch Type:tc() of - {'EXIT', R} -> - orber:dbg("[~p] ~p:get_tc(~p); Exit: ~p", - [?LINE, ?MODULE, T, R], ?DEBUG_LEVEL), - corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}); - X -> - X - end; -%% This call can be used if one have the IFR id and wants a typecode. -get_tc(IFRId) when is_list(IFRId) -> - Rep = orber_ifr:find_repository(), - Def = orber_ifr:lookup_id(Rep, IFRId), - Descr = orber_ifr:describe(Def), - TypeDescr = Descr#contained_description.value, - TypeDescr#typedescription.type. - - -%%----------------------------------------------------------------- -%% Check TypeCode format -%% -check_tc('tk_null') -> true; -check_tc('tk_void') -> true; -check_tc('tk_short') -> true; -check_tc('tk_ushort') -> true; -check_tc('tk_long') -> true; -check_tc('tk_ulong') -> true; -check_tc('tk_longlong') -> true; -check_tc('tk_ulonglong') -> true; -check_tc('tk_float') -> true; -check_tc('tk_double') -> true; -check_tc('tk_longdouble') -> true; -check_tc('tk_boolean') -> true; -check_tc('tk_char') -> true; -check_tc('tk_wchar') -> true; -check_tc('tk_octet') -> true; -check_tc('tk_any') -> true; -check_tc('tk_TypeCode') -> true; -check_tc('tk_Principal') -> true; -check_tc({'tk_objref', RepId, Name}) when is_list(RepId) andalso - is_list(Name) -> true; -check_tc({'tk_struct', RepId, Name, ElementList}) when is_list(RepId) andalso - is_list(Name) -> - Fun = fun(X) -> - case X of - {MemberName, MemberTC} when is_list(MemberName) -> - check_tc(MemberTC); - _ -> - false - end - end, - lists:all(Fun, ElementList); -check_tc({'tk_union', RepId, Name, DiscrTC, - Default, ElementList}) when is_list(RepId) andalso - is_list(Name) andalso - is_integer(Default) -> - case check_tc(DiscrTC) of - false -> - false; - true -> - Fun = fun(X) -> - case X of - {_, MemberName, MemberTC} when - is_list(MemberName) -> - check_tc(MemberTC); - _ -> - false - end - end, - lists:all(Fun, ElementList) - end; -check_tc({'tk_enum', RepId, Name, ElementList}) when is_list(RepId) andalso - is_list(Name) -> - Fun = fun(X) -> - if - is_list(X) -> - true; - true -> - false - end - end, - lists:all(Fun, ElementList); -check_tc({'tk_string', MaxLength}) when is_integer(MaxLength) -> true; -check_tc({'tk_wstring', MaxLength}) when is_integer(MaxLength) -> true; -check_tc({'tk_fixed', Digits, Scale}) when is_integer(Digits) andalso - is_integer(Scale) -> true; -check_tc({'tk_sequence', ElemTC, MaxLength}) when is_integer(MaxLength) -> - check_tc(ElemTC); -check_tc({'tk_array', ElemTC, Length}) when is_integer(Length) -> - check_tc(ElemTC); -check_tc({'tk_alias', RepId, Name, TC}) when is_list(RepId) andalso - is_list(Name) -> - check_tc(TC); -check_tc({'tk_except', RepId, Name, ElementList}) when is_list(RepId) andalso - is_list(Name) -> - Fun = fun(X) -> - case X of - {MemberName, TC} when is_list(MemberName) -> - check_tc(TC); - _ -> - false - end - end, - lists:all(Fun, ElementList); -check_tc({'tk_value', RepId, Name, ValueModifier, - TC, ElementList}) when is_list(RepId) andalso - is_list(Name) andalso - is_integer(ValueModifier) -> - case check_tc(TC) of - false -> - false; - true -> - Fun = fun(X) -> - case X of - {MemberName, MemberTC, Visibility} when - is_list(MemberName) andalso is_integer(Visibility) -> - check_tc(MemberTC); - _ -> - false - end - end, - lists:all(Fun, ElementList) - end; -check_tc({'tk_value_box', RepId, Name, TC}) when is_list(RepId) andalso - is_list(Name) -> - check_tc(TC); -check_tc({'tk_native', RepId, Name}) when is_list(RepId) andalso - is_list(Name) -> true; -check_tc({'tk_abstract_interface', RepId, Name}) when is_list(RepId) andalso - is_list(Name) -> true; -check_tc({'none', Indirection}) when is_integer(Indirection) -> true; -check_tc(_) -> false. - diff --git a/lib/orber/src/orber_typedefs.erl b/lib/orber/src/orber_typedefs.erl deleted file mode 100644 index 30c03974c2..0000000000 --- a/lib/orber/src/orber_typedefs.erl +++ /dev/null @@ -1,83 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 1997-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%----------------------------------------------------------------- -%% File: orber_typedefs.erl -%% Description: -%% This file contains some functions for internal typedef checking -%% -%%----------------------------------------------------------------- --module(orber_typedefs). - --include("orber_iiop.hrl"). --include_lib("orber/include/corba.hrl"). - -%%----------------------------------------------------------------- -%% External exports -%%----------------------------------------------------------------- --export([get_op_def/2]). - -%%----------------------------------------------------------------- -%% Internal exports -%%----------------------------------------------------------------- --export([]). - --define(DEBUG_LEVEL, 5). - -%%----------------------------------------------------------------- -%% External interface functions -%%----------------------------------------------------------------- -%%----------------------------------------------------------------- -%% Func: get_op_def/2 -%% -get_op_def(_Objkey, '_is_a') -> - {orber_tc:boolean(),[orber_tc:string(0)],[]}; -%% First the OMG specified this operation to be '_not_existent' and then -%% changed it to '_non_existent' without suggesting that both must be supported. -%% See CORBA2.3.1 page 15-34, Minor revision 2.3.1: October 1999 -get_op_def(_Objkey, '_not_existent') -> - {orber_tc:boolean(),[],[]}; -get_op_def(_Objkey, '_non_existent') -> - {orber_tc:boolean(),[],[]}; -%% Defined in the Fault Tolerant section of the CORBA specification. -get_op_def(_Objkey, '_FT_HB') -> - {orber_tc:void(),[],[]}; -get_op_def(Objkey, Op) -> - case catch iop_ior:get_key(Objkey) of - {_Local, _Key, _, _, Module} -> - case catch Module:oe_tc(Op) of - {'EXIT', What} -> - orber:dbg("[~p] orber_typedefs:get_op_def(~p);~n" - "The call-back module does not exist or incorrect~n" - "IC-version used. Reason:~n~p", - [?LINE, Module, What], ?DEBUG_LEVEL), - corba:raise(#'TRANSIENT'{minor=(?ORBER_VMCID bor 7), - completion_status=?COMPLETED_NO}); - undefined -> - corba:raise(#'BAD_OPERATION'{minor = (?ORBER_VMCID bor 4), - completion_status=?COMPLETED_NO}); - TC -> - TC - end; - _ -> - corba:raise(#'INV_OBJREF'{completion_status=?COMPLETED_NO}) - end. - diff --git a/lib/orber/src/orber_web.erl b/lib/orber/src/orber_web.erl deleted file mode 100644 index cc24b2cb19..0000000000 --- a/lib/orber/src/orber_web.erl +++ /dev/null @@ -1,864 +0,0 @@ -%%-------------------------------------------------------------------- -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2001-2016. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% -%% -%%---------------------------------------------------------------------- -%% File : orber_web.erl -%% Purpose : -%%---------------------------------------------------------------------- - --module(orber_web). - --export([menu/2, - configure/2, - info/2, - nameservice/2, - ifr_select/2, - ifr_data/2, - create/2, - delete_ctx/2, - add_ctx/2, - delete_obj/2]). - -%%---------------------------------------------------------------------- -%%-------------- Defines & Includes ------------------------------------ -%%---------------------------------------------------------------------- - --include("ifr_objects.hrl"). --include_lib("orber/COSS/CosNaming/CosNaming.hrl"). --include_lib("orber/COSS/CosNaming/CosNaming_NamingContext.hrl"). --include_lib("orber/include/corba.hrl"). --include_lib("orber/src/orber_iiop.hrl"). - --define(DEBUG_LEVEL, 5). - --define(INFO_DATA, - [{iiop_timeout, "IIOP Request Timeout"}, - {iiop_connection_timeout, "IIOP Connection Timeout"}, - {iiop_setup_connection_timeout, "IIOP Setup Connection Timeout"}, - {iiop_port, "IIOP Port"}, - {domain, "Orber Domain"}, - {orber_nodes, "Nodes in Domain"}, - {giop_version, "Default GIOP Version"}, - {objectkeys_gc_time, "Objectkeys GC"}, - {get_interceptors, "Using Interceptors"}, - {get_debug_level, "Debug Level"}, - {get_ORBInitRef, "ORBInitRef"}, - {get_ORBDefaultInitRef, "ORBDefaultInitRef"}]). - --define(IFR_DATA, [{"ir_ModuleDef", "Modules"}, - {"ir_InterfaceDef", "Interfaces"}, - {"ir_StructDef", "Structs"}, - {"ir_UnionDef", "Unions"}, - {"ir_ExceptionDef", "Exceptions"}, - {"ir_ConstantDef", "Constants"}, - {"ir_EnumDef", "Enumerants"}, - {"ir_AliasDef", "Aliases"}, - {"ir_AttributeDef", "Attributes"}, - {"ir_OperationDef", "Operations"}, - {"ir_Contained", "Contained"}, - {"ir_TypedefDef", "Typedef"}]). - - -%%---------------------------------------------------------------------- -%%-------------- External API ------------------------------------------ -%%---------------------------------------------------------------------- -%% Function : create -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -create(_Env, [{"node",NodeStr}]) -> - Node = list_to_atom(NodeStr), - is_running(Node, NodeStr), - [" - - - - - - - - -
Create a New Object
-
-
Module
Arguments
Options
Name String
Operation to use   Bind -    Rebind
"]; -create(_Env, [{"node",NodeStr}, {"module", ModStr}, {"arguments",ArgsStr}, - {"options",OptionsStr}, {"namestr", Name}, {"bind", How}]) -> - Node = list_to_atom(NodeStr), - Mod = list_to_atom(ModStr), - Args = parse_data(ArgsStr), - Options = parse_data(OptionsStr), - case catch rpc:call(Node, Mod, oe_create, [Args, [{sup_child, true}|Options]]) of - {ok, Pid, Object} -> - case catch bind(Node, Object, Name, How) of - {ok, IOR} -> - ["
Successfully created the object:

", IOR]; - {ok, IOR, Path} -> - ["
Successfully created and stored the object as: \"", - Path, "\" (", pid_to_list(Pid), ")

", IOR]; - What -> - rpc:call(Node, corba, dispose, [Object]), - orber:dbg("[~p] orber_web:create(~p, ~p, ~p, ~p, ~p); -Unable to bind object: ~p", [?LINE, Node, Mod, Args, Options, Name, What], ?DEBUG_LEVEL), - ["Unable to bind object in the NameService using: ", Name] - end; - Object when element(2, Object) == pseudo -> - case catch bind(Node, Object, Name, How) of - {ok, IOR} -> - ["
Successfully created the object:

", IOR]; - {ok, IOR, _} -> - ["
Successfully created and stored the object as :\"", Name, "\"

", IOR]; - What -> - rpc:call(Node, corba, dispose, [Object]), - orber:dbg("[~p] orber_web:create(~p, ~p, ~p, ~p, ~p); -Unable to bind object: ~p", [?LINE, Node, Mod, Args, Options, Name, What], ?DEBUG_LEVEL), - ["Unable to bind object in the NameService using: ", Name] - end; - What-> - orber:dbg("[~p] orber_web:create(~p, ~p, ~p, ~p, ~p); -Unable to create object: ~p", [?LINE, Node, Mod, Args, Options, Name, What], ?DEBUG_LEVEL), - ["Unable to create the object."] - end. - -bind(Node, Obj, "", _) -> - IOR = rpc:call(Node, corba, object_to_string, [Obj]), - {ok, IOR}; -bind(Node, Obj, NameStr, How) -> - NS = check(rpc:call(Node, corba, resolve_initial_references, ["NameService"])), - Name = check(rpc:call(Node, 'CosNaming_NamingContextExt', to_name, [NS, NameStr])), - case How of - "bind" -> - check(rpc:call(Node, 'CosNaming_NamingContext', bind, [NS, Name, Obj])), - IOR = rpc:call(Node, corba, object_to_string, [Obj]), - {ok, IOR, NameStr}; - "rebind" -> - check(rpc:call(Node, 'CosNaming_NamingContext', rebind, [NS, Name, Obj])), - IOR = rpc:call(Node, corba, object_to_string, [Obj]), - {ok, IOR, NameStr} - end. - - -%%---------------------------------------------------------------------- -%% Function : delete_ctx -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -delete_ctx(_Env, [{"node",NodeStr}, {"context", Ref}]) -> - Node = list_to_atom(NodeStr), - {Ctx, NS} = remote_resolve(Node, Ref), - Name = check(rpc:call(Node, 'CosNaming_NamingContextExt', to_name, [NS, Ref])), - check(rpc:call(Node, 'CosNaming_NamingContextExt', unbind, [NS, Name])), - check(rpc:call(Node, 'CosNaming_NamingContextExt', destroy, [Ctx])), - [" -
- Successfully deleted the Context: ", Ref, "\n -
-
\n
"]. - -%%---------------------------------------------------------------------- -%% Function : add_ctx -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -add_ctx(_Env, [{"node",_NodeStr}, {"context", "root"}, {"id", ""}]) -> - [" -
- You must supply a NameString such as:
- See also 'Interoperable Naming Service' in the User's Guide.
\n -
-
\n
"]; -add_ctx(_Env, [{"node",NodeStr}, {"context", "root"}, {"id", Id}]) -> - Node = list_to_atom(NodeStr), - NS = check(rpc:call(Node, corba, resolve_initial_references, ["NameService"])), - Name = check(rpc:call(Node, 'CosNaming_NamingContextExt', to_name, [NS, Id])), - check(rpc:call(Node, 'CosNaming_NamingContextExt', bind_new_context, [NS, Name])), - [" -
- Successfully bound the new Context: ", Id, "\n -
-
\n
"]; -add_ctx(_Env, [{"node",NodeStr}, {"context", Ref}, {"id", Id}]) -> - NameStr = Ref ++ "/" ++ Id, - Node = list_to_atom(NodeStr), - NS = check(rpc:call(Node, corba, resolve_initial_references, ["NameService"])), - Name = check(rpc:call(Node, 'CosNaming_NamingContextExt', to_name, [NS, NameStr])), - check(rpc:call(Node, 'CosNaming_NamingContextExt', bind_new_context, [NS, Name])), - [" -
- Successfully bound the new Context: ", NameStr, "\n -
-
\n
"]. - -%%---------------------------------------------------------------------- -%% Function : delete_obj -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -delete_obj(_Env, [{"node",NodeStr}, {"context", Ref}, {"action", "unbind"}]) -> - Node = list_to_atom(NodeStr), - NS = check(rpc:call(Node, corba, resolve_initial_references, ["NameService"])), - Name = check(rpc:call(Node, 'CosNaming_NamingContextExt', to_name, [NS, Ref])), - check(rpc:call(Node, 'CosNaming_NamingContextExt', unbind, [NS, Name])), - [" -
- Successfully unbound the Object: ", Ref, "\n -
-
\n
"]; -delete_obj(_Env, [{"node",NodeStr}, {"context", Ref}, {"action", "both"}]) -> - Node = list_to_atom(NodeStr), - {Obj, NS} = remote_resolve(Node, Ref), - check(rpc:call(Node, corba, dispose, [Obj])), - Name = check(rpc:call(Node, 'CosNaming_NamingContextExt', to_name, [NS, Ref])), - check(rpc:call(Node, 'CosNaming_NamingContextExt', unbind, [NS, Name])), - [" -
- Successfully disposed an unbound the Object: ", Ref, "\n -
-
\n
"]. - - - -%%---------------------------------------------------------------------- -%% Function : nameservice -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -nameservice(_Env, [{"node",NodeStr}, {"context", "root"}]) -> - Node = list_to_atom(NodeStr), - is_running(Node, NodeStr), - Object = check(rpc:call(Node, corba, resolve_initial_references, ["NameService"])), - Prefix = "
- [" - ", Data, - " -
- NameService\n -
- Root Context\n -
- - -
"]; - Why -> - orber:dbg("[~p] orber_web:nameservice(~p, root); -Unable to create context list: ~p", [?LINE, NodeStr, Why], ?DEBUG_LEVEL), - throw({error, "Unable to create a look up the Root Context data"}) - end; -nameservice(_Env, [{"node",NodeStr}, {"context", Ref}]) -> - Node = list_to_atom(NodeStr), - {Object, _NS} = remote_resolve(Node, Ref), - Prefix = "
- [" - - ", Data, - " - -
- NameService
- ", Ref, "
- - -
-
"]; - Why -> - orber:dbg("[~p] orber_web:nameservice(~p, ~p); -Unable to create context list: ~p", [?LINE, NodeStr, Ref, Why], ?DEBUG_LEVEL), - throw({error, ["Unable to look up the Context: ", Ref, - "

If You just deleted it, use the 'Go Back' button next time."]}) - end; -nameservice(_Env, [{"node",NodeStr}, {"context", Ref}, {"object", Obj}]) -> - case catch create_object_data(NodeStr, Ref, Obj) of - {ok, Data} -> - Data; - Why -> - orber:dbg("[~p] orber_web:nameservice(~p, ~p, ~p); -Unable to create data for object: ~p", [?LINE, NodeStr, Ref, Obj, Why], ?DEBUG_LEVEL), - throw({error, ["Unable to look up the Object stored as: ", Ref, - "

If You just unbound it, use the 'Go Back' button next time."]}) - end. - -create_context_list(Node, NodeStr, Prefix, Object, Ref) -> - case check(rpc:call(Node, 'CosNaming_NamingContext', list, [Object, 100])) of - {ok, [], BI} when Ref == "root" -> - catch rpc:call(Node, 'CosNaming_BindingIterator', destroy, [BI]), - {ok, "EMPTY"}; - {ok, [], BI} -> - catch rpc:call(Node, 'CosNaming_BindingIterator', destroy, [BI]), - {ok, "EMPTY -
- - -
"}; - {ok, BL, BI} when length(BL) < 100 -> - catch rpc:call(Node, 'CosNaming_BindingIterator', destroy, [BI]), - {ok, convert_contexts(BL, [], Prefix, Object, Node)}; - {ok, BL, BI} -> - Data = convert_contexts(BL, [], Prefix, Object, Node), - {ok, create_context_list_helper(Node, BI, Data, Object, Prefix)} - end. - -create_context_list_helper(Node, BI, Acc, Ctx, Prefix) -> - case check(rpc:call(Node, 'CosNaming_BindingIterator', next_n, [BI, 100])) of - {true, BL} -> - NewAcc = convert_contexts(BL, Acc, Prefix, Ctx, Node), - create_context_list_helper(Node, BI, NewAcc, Ctx, Prefix); - {false, BL} -> - catch rpc:call(Node, 'CosNaming_BindingIterator', destroy, [BI]), - convert_contexts(BL, Acc, Prefix, Ctx, Node) - end. - -convert_contexts([], Acc, _Prefix, _Ctx, _Node) -> - Acc; -convert_contexts([#'CosNaming_Binding'{binding_name = Name, - binding_type = ncontext}|T], - Acc, Prefix, Ctx, Node) -> - NameStr = check(rpc:call(Node, 'CosNaming_NamingContextExt', to_string, [Ctx, Name])), - convert_contexts(T, [Prefix, NameStr, "\" TARGET=main>", NameStr, "
ncontext"|Acc], - Prefix, Ctx, Node); -convert_contexts([#'CosNaming_Binding'{binding_name = Name, - binding_type = nobject}|T], - Acc, Prefix, Ctx, Node) -> - NameStr = check(rpc:call(Node, 'CosNaming_NamingContextExt', to_string, [Ctx, Name])), - convert_contexts(T, [Prefix, NameStr, "&object=o \" TARGET=main>", NameStr, "nobject"|Acc], - Prefix, Ctx, Node). - - -create_object_data(NodeStr, Ref, _Obj) -> - Node = list_to_atom(NodeStr), - {Object, _NS} = remote_resolve(Node, Ref), - LongIORStr = check(rpc:call(Node, corba, object_to_string, [Object])), - IFRId = check(rpc:call(Node, iop_ior, get_typeID, [Object])), - Exists = check(rpc:call(Node, corba_object, non_existent, [Object])), - IORStr = split_IOR(1, LongIORStr, []), - {Data, External} - = case rpc:call(Node, iop_ior, get_key, [Object]) of - {external, {Host, Port, _OK, _, _, #host_data{version = {Ma, Mi}}}} -> - {[{"IFR Id", IFRId}, - {"Stored As", Ref}, - {"External Object", "true"}, - {"Non Existent", atom_to_list(Exists)}, - {"Host", Host}, - {"Port", integer_to_list(Port)}, - {"IIOP Version", integer_to_list(Ma) ++"."++ integer_to_list(Mi)}, - {"IOR String", IORStr}], true}; - {'internal', _Key, _, _, _} -> - Pid = check(rpc:call(Node, corba, get_pid, [Object])), - Interface = check(rpc:call(Node, corba, request_from_iiop, - [Object, oe_get_interface, false, false, false, []])), - InterfaceData = parse_interface(Interface, []), - {[{"IFR Id", IFRId}, - {"Stored As", Ref}, - {"External Object", "false"}, - {"Non Existent", atom_to_list(Exists)}, - {"Pid", pid_to_list(Pid)}, - {"IOR String", IORStr}|InterfaceData], false}; - {'internal_registered', {pseudo, Key}, _, _, _} -> - Interface = check(rpc:call(Node, corba, request_from_iiop, - [Object, oe_get_interface, false, false, false, []])), - InterfaceData = parse_interface(Interface, []), - {[{"IFR Id", IFRId}, - {"Stored As", Ref}, - {"External Object", "false"}, - {"Non Existent", atom_to_list(Exists)}, - {"Pseudo Object", atom_to_list(Key)}, - {"IOR", IORStr}|InterfaceData], false}; - {'internal_registered', Key, _, _, _} -> - Pid = check(rpc:call(Node, corba, get_pid, [Object])), - Interface = check(rpc:call(Node, corba, request_from_iiop, - [Object, oe_get_interface, false, false, false, []])), - InterfaceData = parse_interface(Interface, []), - {[{"IFR Id", IFRId}, - {"Stored As", Ref}, - {"External Object", "false"}, - {"Non Existent", atom_to_list(Exists)}, - {"Locally Registered", atom_to_list(Key)}, - {"Pid", pid_to_list(Pid)}, - {"IOR String", IORStr}|InterfaceData], false} - end, - Buttons = case {Exists, External} of - {false, false} -> - [" - - -
-
- - - -
- - - -
"]; - _ -> - [" -
-
- - - -
"] - end, - {ok, ["", - simple_table("2", "NameService", [{"Key", "Value"}|Data]), - Buttons]}. - -parse_interface([], [{_, Op}|Acc]) -> - [{"Operations", Op}|Acc]; -parse_interface([], []) -> - [{"Operations", "-"}]; -parse_interface([{Operation,{_,Args,_}}|T], Acc) -> - parse_interface(T, [{"", Operation ++ "/" ++ integer_to_list(length(Args))}|Acc]). - - -split_IOR(_, [], Acc) -> - lists:reverse(Acc); -split_IOR(50, Str, Acc) -> - split_IOR(1, Str, ["
"|Acc]); -split_IOR(N, [H|T], Acc) -> - split_IOR(N+1, T, [H|Acc]). - - - -%%---------------------------------------------------------------------- -%% Function : configure -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -configure(_Env, [{"node",NodeStr}, {"data", DataStr}]) -> - Node = list_to_atom(NodeStr), - Data = parse_data(DataStr), - case catch rpc:call(Node, orber, multi_configure, [Data]) of - ok -> - "Configuration successfull."; - Why -> - orber:dbg("[~p] orber_web:configure(~p, ~p); -Unable to change configuration due to: ~p", [?LINE, NodeStr, DataStr, Why], ?DEBUG_LEVEL), - "Unable to change the configuration.
- Check the spelling and/or if it is possible to update all the keys if Orber is started." - end. - - -%%---------------------------------------------------------------------- -%% Function : ifr_select -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -ifr_select(_Env, [{"node",NodeStr}]) -> - Node = list_to_atom(NodeStr), - is_running(Node, NodeStr), - [" - ", create_ifr_table(?IFR_DATA, NodeStr, []), "
- Interface Repository -
"]. - -%%---------------------------------------------------------------------- -%% Function : ifr_data -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -ifr_data(_Env, [{"node",NodeStr}, {"table", TableStr}]) -> - Node = list_to_atom(NodeStr), - Table = list_to_atom(TableStr), - WildPattern = get_wild_pattern(Table, Node), - Records = check(rpc:call(Node, mnesia, dirty_match_object, [WildPattern])), - Data = extract_ids(Records, []), - ["", - simple_table("1", "Interface Repository", [TableStr|Data]), - "
"]. - -extract_ids([], Acc) -> - lists:sort(Acc); -extract_ids([#ir_ModuleDef{id=Id}|T], Acc) -> - extract_ids(T, [Id|Acc]); -extract_ids([#ir_InterfaceDef{id=Id}|T], Acc) -> - extract_ids(T, [Id|Acc]); -extract_ids([#ir_StructDef{id=Id}|T], Acc) -> - extract_ids(T, [Id|Acc]); -extract_ids([#ir_UnionDef{id=Id}|T], Acc) -> - extract_ids(T, [Id|Acc]); -extract_ids([#ir_ExceptionDef{id=Id}|T], Acc) -> - extract_ids(T, [Id|Acc]); -extract_ids([#ir_ConstantDef{id=Id}|T], Acc) -> - extract_ids(T, [Id|Acc]); -extract_ids([#ir_EnumDef{id=Id}|T], Acc) -> - extract_ids(T, [Id|Acc]); -extract_ids([#ir_AliasDef{id=Id}|T], Acc) -> - extract_ids(T, [Id|Acc]); -extract_ids([#ir_AttributeDef{id=Id}|T], Acc) -> - extract_ids(T, [Id|Acc]); -extract_ids([#ir_OperationDef{id=Id}|T], Acc) -> - extract_ids(T, [Id|Acc]); -extract_ids([#ir_Contained{id=Id}|T], Acc) -> - extract_ids(T, [Id|Acc]); -extract_ids([#ir_TypedefDef{id=Id}|T], Acc) -> - extract_ids(T, [Id|Acc]). - -get_wild_pattern(ir_ModuleDef, Node) -> - P = check(rpc:call(Node, mnesia, table_info, [ir_ModuleDef, wild_pattern])), - P#ir_ModuleDef{id='$1'}; -get_wild_pattern(ir_InterfaceDef, Node) -> - P = check(rpc:call(Node, mnesia, table_info, [ir_InterfaceDef, wild_pattern])), - P#ir_InterfaceDef{id='$1'}; -get_wild_pattern(ir_StructDef, Node) -> - P = check(rpc:call(Node, mnesia, table_info, [ir_StructDef, wild_pattern])), - P#ir_StructDef{id='$1'}; -get_wild_pattern(ir_UnionDef, Node) -> - P = check(rpc:call(Node, mnesia, table_info, [ir_UnionDef, wild_pattern])), - P#ir_UnionDef{id='$1'}; -get_wild_pattern(ir_ExceptionDef, Node) -> - P = check(rpc:call(Node, mnesia, table_info, [ir_ExceptionDef, wild_pattern])), - P#ir_ExceptionDef{id='$1'}; -get_wild_pattern(ir_ConstantDef, Node) -> - P = check(rpc:call(Node, mnesia, table_info, [ir_ConstantDef, wild_pattern])), - P#ir_ConstantDef{id='$1'}; -get_wild_pattern(ir_EnumDef, Node) -> - P = check(rpc:call(Node, mnesia, table_info, [ir_EnumDef, wild_pattern])), - P#ir_EnumDef{id='$1'}; -get_wild_pattern(ir_AliasDef, Node) -> - P = check(rpc:call(Node, mnesia, table_info, [ir_AliasDef, wild_pattern])), - P#ir_AliasDef{id='$1'}; -get_wild_pattern(ir_AttributeDef, Node) -> - P = check(rpc:call(Node, mnesia, table_info, [ir_AttributeDef, wild_pattern])), - P#ir_AttributeDef{id='$1'}; -get_wild_pattern(ir_OperationDef, Node) -> - P = check(rpc:call(Node, mnesia, table_info, [ir_OperationDef, wild_pattern])), - P#ir_OperationDef{id='$1'}; -get_wild_pattern(ir_Contained, Node) -> - P = check(rpc:call(Node, mnesia, table_info, [ir_Contained, wild_pattern])), - P#ir_Contained{id='$1'}; -get_wild_pattern(ir_TypedefDef, Node) -> - P = check(rpc:call(Node, mnesia, table_info, [ir_TypedefDef, wild_pattern])), - P#ir_TypedefDef{id='$1'}. - -create_ifr_table([], _Node, Result) -> - lists:append(lists:reverse(Result)); -create_ifr_table([{Table,Desc}|Rest], Node, Result) -> - create_ifr_table(Rest, Node, - ["" ++ Desc ++""|Result]). - - -%%---------------------------------------------------------------------- -%% Function : info -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -info(_Env, [{"node",NodeStr}]) -> - Node = list_to_atom(NodeStr), - is_running(Node, NodeStr), - Data = create_info_data(?INFO_DATA, Node, []), - ["", - simple_table("2", "Configuration", [{"Key", "Value"}|Data], - ["
- - -
"])]. - - -create_info_data([], _Node, Result) -> - lists:reverse(Result); -create_info_data([{Func,Desc}|Rest], Node, Result) -> - Data = convert_type(check(rpc:call(Node, orber, Func, []))), - create_info_data(Rest, Node, [{Desc, Data}|Result]). - -convert_type(Data) when is_integer(Data) -> - integer_to_list(Data); -convert_type(Data) when is_atom(Data) -> - atom_to_list(Data); -convert_type(Data) when is_float(Data) -> - float_to_list(Data); -convert_type(Data) when is_pid(Data) -> - pid_to_list(Data); -convert_type(Data) when is_port(Data) -> - erlang:port_to_list(Data); -convert_type(Data) when is_tuple(Data) -> - io_lib:write(Data); -convert_type([]) -> - []; -convert_type(Data) when is_list(Data) -> - case io_lib:printable_list(Data) of - true-> - Data; - _-> - io_lib:write(Data) - end; -convert_type(_Data) -> - []. - - -%%---------------------------------------------------------------------- -%% Function : menu -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -menu(_Env, Args)-> - ["", node_selections_javascripts(), node_body(Args, [node()|nodes()])]. - -menu_title()-> - " - -
Menu
\n". - - -node_body([], Nodes)-> - Node = node(), - [node_selections_javascripts(), node_selection(Node, Nodes), menu_title(), - menu_options(atom_to_list(Node))]; -node_body([{"node",Node}|_], Nodes)-> - [node_selections_javascripts(), node_selection(list_to_atom(Node), Nodes), menu_title(), - menu_options(Node)]; -node_body([_|Rest], Nodes) -> - node_body(Rest, Nodes). - - - -%%---------------------------------------------------------------------- -%% Function : node_selections_javascripts -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -node_selections_javascripts()-> - "". - - - -%%---------------------------------------------------------------------- -%% Function : node_selection -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -node_selection(Node, Nodes)-> - ["
\n - \n - \n -
\n - \n -
\n -
"]. - -%%---------------------------------------------------------------------- -%% Function : print_nodes -%% Returns : -%% Description: -%%---------------------------------------------------------------------- -print_nodes(Node,Nodes)-> - print_nodes_helper([Node|lists:delete(Node,Nodes)]). - -print_nodes_helper([])-> - []; -print_nodes_helper([Node|Rest])-> - NodeStr = atom_to_list(Node), - ["