From 568c4fde540e8f83ccb7478af10178b09f9d2697 Mon Sep 17 00:00:00 2001 From: Kory Draughn Date: Fri, 9 Nov 2018 19:53:48 -0500 Subject: [PATCH] [#3729] Removed all code related to Xmsg. Created api number validator. Cleaned up api number indentation and wrapped it in guards for clang-format. --- CMakeLists.txt | 20 +- cmake/development_library.cmake | 9 - cmake/server.cmake | 1 - .../samples/sample-grid_status.json | 2 - .../samples/sample-zone_bundle.json | 1 - configuration_schemas/v3/server_config.json | 1 - configuration_schemas/v3/server_status.json | 5 +- .../v3/service_account_environment.json | 4 +- doxygen/microservices.cpp | 10 - doxygen/modules.cpp | 2 - lib/api/include/apiHeaderAll.h | 3 - lib/api/include/apiNumber.h | 248 +++--- lib/api/include/apiPackTable.h | 2 - lib/api/include/apiTable.hpp | 37 +- lib/api/include/getXmsgTicket.h | 13 - lib/api/include/rcvXmsg.h | 12 - lib/api/include/sendXmsg.h | 12 - lib/api/src/rcGetXmsgTicket.cpp | 41 - lib/api/src/rcRcvXmsg.cpp | 41 - lib/api/src/rcSendXmsg.cpp | 39 - lib/core/include/getRodsEnv.h | 2 - .../include/irods_configuration_keywords.hpp | 3 - lib/core/include/irods_server_properties.hpp | 3 - lib/core/include/msParam.h | 6 - lib/core/include/rcConnect.h | 2 - lib/core/include/rcMisc.h | 3 - lib/core/include/rods.h | 1 - lib/core/include/rodsClient.h | 2 - lib/core/include/rodsDef.h | 6 +- lib/core/include/rodsErrorTable.h | 24 +- lib/core/include/rodsKeyWdDef.h | 5 +- lib/core/include/rodsPackInstruct.h | 6 - lib/core/include/rodsPackTable.h | 4 - lib/core/include/rodsType.h | 4 + lib/core/include/rodsUser.h | 3 - lib/core/include/rodsXmsg.h | 105 --- lib/core/src/getRodsEnv.cpp | 18 - lib/core/src/rcConnect.cpp | 16 - lib/core/src/rcMisc.cpp | 32 - packaging/server_config.json.template | 1 - .../include/reFuncDefs.hpp | 5 - ...rule_engine_plugin-irods_rule_language.cpp | 3 - .../nre.reHelpers1.cpp | 521 +----------- .../nre.reLib1.cpp | 7 - scripts/irods/configuration.py | 4 - scripts/irods/controller.py | 3 +- .../irods/convert_configuration_to_json.py | 5 +- scripts/irods/paths.py | 5 - scripts/irods/test/test_all_rules.py | 16 - scripts/irods/test/test_xmsg.py | 65 -- scripts/irods/upgrade_configuration.py | 3 - server/api/include/rsGetXmsgTicket.hpp | 9 - server/api/include/rsRcvXmsg.hpp | 9 - server/api/include/rsSendXmsg.hpp | 9 - server/api/src/rsGetXmsgTicket.cpp | 59 -- server/api/src/rsRcvXmsg.cpp | 35 - server/api/src/rsSendXmsg.cpp | 73 -- server/core/include/irodsXmsgServer.hpp | 26 - .../include/irods_api_calling_functions.hpp | 32 - .../include/irods_api_number_validator.hpp | 12 + server/core/include/rodsConnect.h | 3 - server/core/include/rsLog.hpp | 1 - server/core/include/xmsgLib.hpp | 75 -- server/core/src/initServer.cpp | 20 - server/core/src/irodsXmsgServer.cpp | 240 ------ .../core/src/irods_api_calling_functions.cpp | 36 - .../core/src/irods_api_number_validator.cpp | 20 + .../core/src/irods_server_control_plane.cpp | 12 - server/core/src/rodsConnect.cpp | 27 - server/core/src/rodsServer.cpp | 20 - server/core/src/rsApiHandler.cpp | 36 +- server/core/src/xmsgLib.cpp | 756 ------------------ server/re/include/reAction.hpp | 40 - server/re/src/printMS.cpp | 150 ---- server/re/src/xmsgMS.cpp | 580 -------------- 75 files changed, 214 insertions(+), 3452 deletions(-) delete mode 100644 lib/api/include/getXmsgTicket.h delete mode 100644 lib/api/include/rcvXmsg.h delete mode 100644 lib/api/include/sendXmsg.h delete mode 100644 lib/api/src/rcGetXmsgTicket.cpp delete mode 100644 lib/api/src/rcRcvXmsg.cpp delete mode 100644 lib/api/src/rcSendXmsg.cpp delete mode 100644 lib/core/include/rodsXmsg.h delete mode 100644 scripts/irods/test/test_xmsg.py delete mode 100644 server/api/include/rsGetXmsgTicket.hpp delete mode 100644 server/api/include/rsRcvXmsg.hpp delete mode 100644 server/api/include/rsSendXmsg.hpp delete mode 100644 server/api/src/rsGetXmsgTicket.cpp delete mode 100644 server/api/src/rsRcvXmsg.cpp delete mode 100644 server/api/src/rsSendXmsg.cpp delete mode 100644 server/core/include/irodsXmsgServer.hpp create mode 100644 server/core/include/irods_api_number_validator.hpp delete mode 100644 server/core/include/xmsgLib.hpp delete mode 100644 server/core/src/irodsXmsgServer.cpp create mode 100644 server/core/src/irods_api_number_validator.cpp delete mode 100644 server/core/src/xmsgLib.cpp delete mode 100644 server/re/src/xmsgMS.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 9497088445..c4fa220fb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -306,7 +306,6 @@ set( ${CMAKE_SOURCE_DIR}/lib/api/src/rcGetRescQuota.cpp ${CMAKE_SOURCE_DIR}/lib/api/src/rcGetTempPassword.cpp ${CMAKE_SOURCE_DIR}/lib/api/src/rcGetTempPasswordForOther.cpp - ${CMAKE_SOURCE_DIR}/lib/api/src/rcGetXmsgTicket.cpp ${CMAKE_SOURCE_DIR}/lib/api/src/rcIESClientHints.cpp ${CMAKE_SOURCE_DIR}/lib/api/src/rcL3FileGetSingleBuf.cpp ${CMAKE_SOURCE_DIR}/lib/api/src/rcL3FilePutSingleBuf.cpp @@ -322,7 +321,6 @@ set( ${CMAKE_SOURCE_DIR}/lib/api/src/rcPhyPathReg.cpp ${CMAKE_SOURCE_DIR}/lib/api/src/rcProcStat.cpp ${CMAKE_SOURCE_DIR}/lib/api/src/rcQuerySpecColl.cpp - ${CMAKE_SOURCE_DIR}/lib/api/src/rcRcvXmsg.cpp ${CMAKE_SOURCE_DIR}/lib/api/src/rcReadCollection.cpp ${CMAKE_SOURCE_DIR}/lib/api/src/rcRegColl.cpp ${CMAKE_SOURCE_DIR}/lib/api/src/rcRegDataObj.cpp @@ -331,7 +329,6 @@ set( ${CMAKE_SOURCE_DIR}/lib/api/src/rcRuleExecDel.cpp ${CMAKE_SOURCE_DIR}/lib/api/src/rcRuleExecMod.cpp ${CMAKE_SOURCE_DIR}/lib/api/src/rcRuleExecSubmit.cpp - ${CMAKE_SOURCE_DIR}/lib/api/src/rcSendXmsg.cpp ${CMAKE_SOURCE_DIR}/lib/api/src/rcServerReport.cpp ${CMAKE_SOURCE_DIR}/lib/api/src/rcSimpleQuery.cpp ${CMAKE_SOURCE_DIR}/lib/api/src/rcSpecificQuery.cpp @@ -518,7 +515,6 @@ set( ${CMAKE_SOURCE_DIR}/server/api/src/rsGetRescQuota.cpp ${CMAKE_SOURCE_DIR}/server/api/src/rsGetTempPassword.cpp ${CMAKE_SOURCE_DIR}/server/api/src/rsGetTempPasswordForOther.cpp - ${CMAKE_SOURCE_DIR}/server/api/src/rsGetXmsgTicket.cpp ${CMAKE_SOURCE_DIR}/server/api/src/rsIESClientHints.cpp ${CMAKE_SOURCE_DIR}/server/api/src/rsL3FileGetSingleBuf.cpp ${CMAKE_SOURCE_DIR}/server/api/src/rsL3FilePutSingleBuf.cpp @@ -534,7 +530,6 @@ set( ${CMAKE_SOURCE_DIR}/server/api/src/rsPhyPathReg.cpp ${CMAKE_SOURCE_DIR}/server/api/src/rsProcStat.cpp ${CMAKE_SOURCE_DIR}/server/api/src/rsQuerySpecColl.cpp - ${CMAKE_SOURCE_DIR}/server/api/src/rsRcvXmsg.cpp ${CMAKE_SOURCE_DIR}/server/api/src/rsReadCollection.cpp ${CMAKE_SOURCE_DIR}/server/api/src/rsRegColl.cpp ${CMAKE_SOURCE_DIR}/server/api/src/rsRegDataObj.cpp @@ -543,7 +538,6 @@ set( ${CMAKE_SOURCE_DIR}/server/api/src/rsRuleExecDel.cpp ${CMAKE_SOURCE_DIR}/server/api/src/rsRuleExecMod.cpp ${CMAKE_SOURCE_DIR}/server/api/src/rsRuleExecSubmit.cpp - ${CMAKE_SOURCE_DIR}/server/api/src/rsSendXmsg.cpp ${CMAKE_SOURCE_DIR}/server/api/src/rsServerReport.cpp ${CMAKE_SOURCE_DIR}/server/api/src/rsSetRoundRobinContext.cpp ${CMAKE_SOURCE_DIR}/server/api/src/rsSimpleQuery.cpp @@ -584,6 +578,7 @@ set( ${CMAKE_SOURCE_DIR}/server/core/src/fileOpr.cpp ${CMAKE_SOURCE_DIR}/server/core/src/initServer.cpp ${CMAKE_SOURCE_DIR}/server/core/src/irods_api_calling_functions.cpp + ${CMAKE_SOURCE_DIR}/server/core/src/irods_api_number_validator.cpp ${CMAKE_SOURCE_DIR}/server/core/src/irods_collection_object.cpp ${CMAKE_SOURCE_DIR}/server/core/src/irods_data_object.cpp ${CMAKE_SOURCE_DIR}/server/core/src/irods_database_factory.cpp @@ -621,7 +616,6 @@ set( ${CMAKE_SOURCE_DIR}/server/core/src/rsIcatOpr.cpp ${CMAKE_SOURCE_DIR}/server/core/src/rsLog.cpp ${CMAKE_SOURCE_DIR}/server/core/src/specColl.cpp - ${CMAKE_SOURCE_DIR}/server/core/src/xmsgLib.cpp ${CMAKE_SOURCE_DIR}/server/drivers/src/fileDriver.cpp ${CMAKE_SOURCE_DIR}/server/icat/src/icatHighLevelRoutines.cpp ${CMAKE_SOURCE_DIR}/server/re/src/extractAvuMS.cpp @@ -647,7 +641,6 @@ set( ${CMAKE_SOURCE_DIR}/server/re/src/reSysDataObjOpr.cpp ${CMAKE_SOURCE_DIR}/server/re/src/sharedmemory.cpp ${CMAKE_SOURCE_DIR}/server/re/src/testMS.cpp - ${CMAKE_SOURCE_DIR}/server/re/src/xmsgMS.cpp ) add_library( irods_server @@ -929,9 +922,6 @@ set( ${CMAKE_SOURCE_DIR}/lib/api/src/rcSubStructFileReaddir.cpp ${CMAKE_SOURCE_DIR}/lib/api/src/rcSubStructFileClosedir.cpp ${CMAKE_SOURCE_DIR}/lib/api/src/rcGeneralUpdate.cpp - ${CMAKE_SOURCE_DIR}/lib/api/src/rcGetXmsgTicket.cpp - ${CMAKE_SOURCE_DIR}/lib/api/src/rcSendXmsg.cpp - ${CMAKE_SOURCE_DIR}/lib/api/src/rcRcvXmsg.cpp ${CMAKE_SOURCE_DIR}/lib/api/src/rcSubStructFileGet.cpp ${CMAKE_SOURCE_DIR}/lib/api/src/rcSubStructFilePut.cpp ${CMAKE_SOURCE_DIR}/lib/api/src/rcSyncMountedColl.cpp @@ -1147,11 +1137,6 @@ set( ${CMAKE_SOURCE_DIR}/server/core/src/irods_server_control_plane.cpp ) -set( - IRODS_MAIN_EXECUTABLE_IRODSXMSGSERVER_SOURCES - ${CMAKE_SOURCE_DIR}/server/core/src/irodsXmsgServer.cpp - ) - set( IRODS_MAIN_EXECUTABLE_HOSTNAME_RESOLVES_TO_LOCAL_ADDRESS_SOURCES ${CMAKE_SOURCE_DIR}/server/core/src/hostname_resolves_to_local_address.cpp @@ -1161,7 +1146,6 @@ set( IRODS_MAIN_EXECUTABLES # irodsAgent irodsServer - irodsXmsgServer hostname_resolves_to_local_address ) @@ -1521,7 +1505,7 @@ foreach(DATABASE_PLUGIN postgres oracle mysql) COMMAND python ${CMAKE_SOURCE_DIR}/configuration_schemas/update_schema_ids_for_cmake.py ${CMAKE_INSTALL_PREFIX}/${IRODS_HOME_DIRECTORY}/configuration_schemas/v${IRODS_CONFIGURATION_SCHEMA_VERSION} ${CMAKE_INSTALL_PREFIX}/${IRODS_HOME_DIRECTORY}/configuration_schemas/v${IRODS_CONFIGURATION_SCHEMA_VERSION} DEPENDS - irodsServer irodsReServer irodsXmsgServer hostname_resolves_to_local_address irodsPamAuthCheck irods_client irods_server irods_common irods_plugin_dependencies RodsAPIs helloworld_server helloworld_client msisync_to_archive msi_update_unixfilesystem_resource_free_space compound deferred load_balanced mockarchive nonblocking passthru random replication roundrobin structfile univmss unixfilesystem irods_rule_engine_plugin-irods_rule_language irods_rule_engine_plugin-cpp_default_policy native_client native_server osauth_client osauth_server pam_client pam_server ssl_client ssl_server tcp_client tcp_server genOSAuth mytest + irodsServer irodsReServer hostname_resolves_to_local_address irodsPamAuthCheck irods_client irods_server irods_common irods_plugin_dependencies RodsAPIs helloworld_server helloworld_client msisync_to_archive msi_update_unixfilesystem_resource_free_space compound deferred load_balanced mockarchive nonblocking passthru random replication roundrobin structfile univmss unixfilesystem irods_rule_engine_plugin-irods_rule_language irods_rule_engine_plugin-cpp_default_policy native_client native_server osauth_client osauth_server pam_client pam_server ssl_client ssl_server tcp_client tcp_server genOSAuth mytest ${DATABASE_PLUGIN} IRODS_PHONY_TARGET_icatSysTables_${DATABASE_PLUGIN}.sql ) endforeach() diff --git a/cmake/development_library.cmake b/cmake/development_library.cmake index e4d5f88957..b848bb77e7 100644 --- a/cmake/development_library.cmake +++ b/cmake/development_library.cmake @@ -126,7 +126,6 @@ set( ${CMAKE_SOURCE_DIR}/lib/core/include/rodsQuota.h ${CMAKE_SOURCE_DIR}/lib/core/include/rodsType.h ${CMAKE_SOURCE_DIR}/lib/core/include/rodsUser.h - ${CMAKE_SOURCE_DIR}/lib/core/include/rodsXmsg.h ${CMAKE_SOURCE_DIR}/lib/core/include/rsyncUtil.h ${CMAKE_SOURCE_DIR}/lib/core/include/scanUtil.h ${CMAKE_SOURCE_DIR}/lib/core/include/sockComm.h @@ -231,7 +230,6 @@ set( ${CMAKE_SOURCE_DIR}/lib/api/include/getRescQuota.h ${CMAKE_SOURCE_DIR}/lib/api/include/getTempPassword.h ${CMAKE_SOURCE_DIR}/lib/api/include/getTempPasswordForOther.h - ${CMAKE_SOURCE_DIR}/lib/api/include/getXmsgTicket.h ${CMAKE_SOURCE_DIR}/lib/api/include/get_hier_from_leaf_id.h ${CMAKE_SOURCE_DIR}/lib/api/include/ies_client_hints.h ${CMAKE_SOURCE_DIR}/lib/api/include/l3FileGetSingleBuf.h @@ -248,7 +246,6 @@ set( ${CMAKE_SOURCE_DIR}/lib/api/include/phyPathReg.h ${CMAKE_SOURCE_DIR}/lib/api/include/procStat.h ${CMAKE_SOURCE_DIR}/lib/api/include/querySpecColl.h - ${CMAKE_SOURCE_DIR}/lib/api/include/rcvXmsg.h ${CMAKE_SOURCE_DIR}/lib/api/include/readCollection.h ${CMAKE_SOURCE_DIR}/lib/api/include/regColl.h ${CMAKE_SOURCE_DIR}/lib/api/include/regDataObj.h @@ -257,7 +254,6 @@ set( ${CMAKE_SOURCE_DIR}/lib/api/include/ruleExecDel.h ${CMAKE_SOURCE_DIR}/lib/api/include/ruleExecMod.h ${CMAKE_SOURCE_DIR}/lib/api/include/ruleExecSubmit.h - ${CMAKE_SOURCE_DIR}/lib/api/include/sendXmsg.h ${CMAKE_SOURCE_DIR}/lib/api/include/server_report.h ${CMAKE_SOURCE_DIR}/lib/api/include/set_round_robin_context.h ${CMAKE_SOURCE_DIR}/lib/api/include/simpleQuery.h @@ -381,7 +377,6 @@ set( ${CMAKE_SOURCE_DIR}/server/api/include/rsGetRescQuota.hpp ${CMAKE_SOURCE_DIR}/server/api/include/rsGetTempPassword.hpp ${CMAKE_SOURCE_DIR}/server/api/include/rsGetTempPasswordForOther.hpp - ${CMAKE_SOURCE_DIR}/server/api/include/rsGetXmsgTicket.hpp ${CMAKE_SOURCE_DIR}/server/api/include/rsIESClientHints.hpp ${CMAKE_SOURCE_DIR}/server/api/include/rsL3FileGetSingleBuf.hpp ${CMAKE_SOURCE_DIR}/server/api/include/rsL3FilePutSingleBuf.hpp @@ -397,7 +392,6 @@ set( ${CMAKE_SOURCE_DIR}/server/api/include/rsPhyPathReg.hpp ${CMAKE_SOURCE_DIR}/server/api/include/rsProcStat.hpp ${CMAKE_SOURCE_DIR}/server/api/include/rsQuerySpecColl.hpp - ${CMAKE_SOURCE_DIR}/server/api/include/rsRcvXmsg.hpp ${CMAKE_SOURCE_DIR}/server/api/include/rsReadCollection.hpp ${CMAKE_SOURCE_DIR}/server/api/include/rsRegColl.hpp ${CMAKE_SOURCE_DIR}/server/api/include/rsRegDataObj.hpp @@ -406,7 +400,6 @@ set( ${CMAKE_SOURCE_DIR}/server/api/include/rsRuleExecDel.hpp ${CMAKE_SOURCE_DIR}/server/api/include/rsRuleExecMod.hpp ${CMAKE_SOURCE_DIR}/server/api/include/rsRuleExecSubmit.hpp - ${CMAKE_SOURCE_DIR}/server/api/include/rsSendXmsg.hpp ${CMAKE_SOURCE_DIR}/server/api/include/rsServerReport.hpp ${CMAKE_SOURCE_DIR}/server/api/include/rsSetRoundRobinContext.hpp ${CMAKE_SOURCE_DIR}/server/api/include/rsSimpleQuery.hpp @@ -451,7 +444,6 @@ set( ${CMAKE_SOURCE_DIR}/server/core/include/fileOpr.hpp ${CMAKE_SOURCE_DIR}/server/core/include/initServer.hpp ${CMAKE_SOURCE_DIR}/server/core/include/irodsReServer.hpp - ${CMAKE_SOURCE_DIR}/server/core/include/irodsXmsgServer.hpp ${CMAKE_SOURCE_DIR}/server/core/include/irods_api_calling_functions.hpp ${CMAKE_SOURCE_DIR}/server/core/include/irods_at_scope_exit.hpp ${CMAKE_SOURCE_DIR}/server/core/include/irods_collection_object.hpp @@ -500,7 +492,6 @@ set( ${CMAKE_SOURCE_DIR}/server/core/include/rsIcatOpr.hpp ${CMAKE_SOURCE_DIR}/server/core/include/rsLog.hpp ${CMAKE_SOURCE_DIR}/server/core/include/specColl.hpp - ${CMAKE_SOURCE_DIR}/server/core/include/xmsgLib.hpp ) set( diff --git a/cmake/server.cmake b/cmake/server.cmake index 4a032ecd96..3e50928c46 100644 --- a/cmake/server.cmake +++ b/cmake/server.cmake @@ -5,7 +5,6 @@ install( # irodsAgent irodsServer irodsReServer - irodsXmsgServer hostname_resolves_to_local_address RUNTIME DESTINATION usr/sbin diff --git a/configuration_schemas/samples/sample-grid_status.json b/configuration_schemas/samples/sample-grid_status.json index 6e9a2b88c2..7cf7a24322 100644 --- a/configuration_schemas/samples/sample-grid_status.json +++ b/configuration_schemas/samples/sample-grid_status.json @@ -5,7 +5,6 @@ "hostname": "awesome", "irods_server_pid": 1234, "re_server_pid": 1234, - "xmsg_server_pid": 1234, "status": "perfect", "agents": [ { @@ -22,7 +21,6 @@ "hostname": "again", "irods_server_pid": 12345, "re_server_pid": 12345, - "xmsg_server_pid": 12345, "status": "notsogood", "agents": [ { diff --git a/configuration_schemas/samples/sample-zone_bundle.json b/configuration_schemas/samples/sample-zone_bundle.json index 40af1e767e..cfd669dcf9 100644 --- a/configuration_schemas/samples/sample-zone_bundle.json +++ b/configuration_schemas/samples/sample-zone_bundle.json @@ -265,7 +265,6 @@ "server_control_plane_timeout_milliseconds": 10000, "server_port_range_end": 20199, "server_port_range_start": 20000, - "xmsg_port": 1279, "zone_auth_scheme": "native", "zone_key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "zone_name": "tempZone", diff --git a/configuration_schemas/v3/server_config.json b/configuration_schemas/v3/server_config.json index 4664a46135..2aae9a03d2 100644 --- a/configuration_schemas/v3/server_config.json +++ b/configuration_schemas/v3/server_config.json @@ -89,7 +89,6 @@ "server_control_plane_timeout_milliseconds": {"type": "integer"}, "server_port_range_end": {"type": "integer"}, "server_port_range_start": {"type": "integer"}, - "xmsg_port": {"type": "integer"}, "zone_auth_scheme" : {"type": "string"}, "zone_key": {"type": "string", "pattern": "^[A-Za-z0-9_]+$", "maxLength": 49}, "zone_name": {"type": "string", "pattern": "^[A-Za-z0-9_\\.]+$", "maxLength": 63}, diff --git a/configuration_schemas/v3/server_status.json b/configuration_schemas/v3/server_status.json index b1830b4d20..06699c0972 100644 --- a/configuration_schemas/v3/server_status.json +++ b/configuration_schemas/v3/server_status.json @@ -17,8 +17,7 @@ "hostname": {"type": "string"}, "irods_server_pid": {"type": "integer"}, "re_server_pid": {"type": "integer"}, - "status": {"type": "string"}, - "xmsg_server_pid": {"type": "integer"} + "status": {"type": "string"} }, - "required": ["agents","hostname","irods_server_pid","re_server_pid","status","xmsg_server_pid"] + "required": ["agents","hostname","irods_server_pid","re_server_pid","status"] } diff --git a/configuration_schemas/v3/service_account_environment.json b/configuration_schemas/v3/service_account_environment.json index 6f3405a33f..54241fa602 100644 --- a/configuration_schemas/v3/service_account_environment.json +++ b/configuration_schemas/v3/service_account_environment.json @@ -32,9 +32,7 @@ "irods_ssl_certificate_chain_file": {"type": "string"}, "irods_ssl_certificate_key_file": {"type": "string"}, "irods_ssl_dh_params_file": {"type": "string"}, - "irods_ssl_verify_server": {"enum": ["cert","hostname","none"]}, - "irods_xmsg_host": {"type": "string"}, - "irods_xmsg_port": {"type": "integer"} + "irods_ssl_verify_server": {"enum": ["cert","hostname","none"]} }, "required": [ "irods_client_server_negotiation", diff --git a/doxygen/microservices.cpp b/doxygen/microservices.cpp index f9e1e2f629..9f7df59f4d 100644 --- a/doxygen/microservices.cpp +++ b/doxygen/microservices.cpp @@ -116,16 +116,6 @@ - #msiPrintGenQueryOutToBuffer - Writes the contents of a GenQueryOut_MS_T into a BUF_LEN_MS_T - #msiDeleteUnusedAVUs - Deletes unused AVUs from the iCAT - \subsection msixmsg XMessaging System Microservices - - #msiXmsgServerConnect - Connects to the XMessage Server as designate by iRODS Environment file/variable - - #msiXmsgCreateStream - Creates a new Message Stream - - #msiCreateXmsgInp - Creates an Xmsg packet, given all information values - - #msiSendXmsg - Sends an Xmsg packet - - #msiRcvXmsg - Receives an Xmsg packet - - #msiXmsgServerDisConnect - Disconnects from the XMessage Server - - #readXMsg - Reads a message packet from an XMsgStream - - #writeXMsg - Writes a given string into an XMsgStream - \subsection msistring String Manipulation Microservices - #msiStrlen - Returns the length of a given string - #msiStrchop - Removes the last character of a given string diff --git a/doxygen/modules.cpp b/doxygen/modules.cpp index d141c1f96a..de945f8b55 100644 --- a/doxygen/modules.cpp +++ b/doxygen/modules.cpp @@ -74,8 +74,6 @@ @defgroup msi_icat iCAT Microservices @brief iCAT System Services - @defgroup msi_xmsg XMessaging System Microservices - @defgroup msi_string String Manipulation Microservices @defgroup msi_email Email Microservices diff --git a/lib/api/include/apiHeaderAll.h b/lib/api/include/apiHeaderAll.h index 10229be9f2..81838fa7d6 100644 --- a/lib/api/include/apiHeaderAll.h +++ b/lib/api/include/apiHeaderAll.h @@ -90,9 +90,6 @@ #include "fileTruncate.h" #include "subStructFileTruncate.h" #include "generalUpdate.h" -#include "getXmsgTicket.h" -#include "sendXmsg.h" -#include "rcvXmsg.h" #include "subStructFileGet.h" #include "subStructFilePut.h" #include "syncMountedColl.h" diff --git a/lib/api/include/apiNumber.h b/lib/api/include/apiNumber.h index 812ae970a7..b8f1e1a3bd 100644 --- a/lib/api/include/apiNumber.h +++ b/lib/api/include/apiNumber.h @@ -4,55 +4,55 @@ /* apiNumber.h - header file for API number assignment */ - - #ifndef API_NUMBER_H__ #define API_NUMBER_H__ +// clang-format off + /* 500 - 599 - Internal File I/O API calls */ -#define FILE_CREATE_AN 500 -#define FILE_OPEN_AN 501 -#define FILE_WRITE_AN 502 -#define FILE_CLOSE_AN 503 -#define FILE_LSEEK_AN 504 -#define FILE_READ_AN 505 -#define FILE_UNLINK_AN 506 -#define FILE_MKDIR_AN 507 -#define FILE_CHMOD_AN 508 -#define FILE_RMDIR_AN 509 -#define FILE_STAT_AN 510 -#define FILE_FSTAT_AN 511 -#define FILE_FSYNC_AN 512 +#define FILE_CREATE_AN 500 +#define FILE_OPEN_AN 501 +#define FILE_WRITE_AN 502 +#define FILE_CLOSE_AN 503 +#define FILE_LSEEK_AN 504 +#define FILE_READ_AN 505 +#define FILE_UNLINK_AN 506 +#define FILE_MKDIR_AN 507 +#define FILE_CHMOD_AN 508 +#define FILE_RMDIR_AN 509 +#define FILE_STAT_AN 510 +#define FILE_FSTAT_AN 511 +#define FILE_FSYNC_AN 512 -#define FILE_STAGE_AN 513 -#define FILE_GET_FS_FREE_SPACE_AN 514 -#define FILE_OPENDIR_AN 515 -#define FILE_CLOSEDIR_AN 516 -#define FILE_READDIR_AN 517 -#define FILE_PUT_AN 518 -#define FILE_GET_AN 519 -#define FILE_CHKSUM_AN 520 -#define CHK_N_V_PATH_PERM_AN 521 -#define FILE_RENAME_AN 522 -#define FILE_TRUNCATE_AN 523 -#define FILE_STAGE_TO_CACHE_AN 524 -#define FILE_SYNC_TO_ARCH_AN 525 +#define FILE_STAGE_AN 513 +#define FILE_GET_FS_FREE_SPACE_AN 514 +#define FILE_OPENDIR_AN 515 +#define FILE_CLOSEDIR_AN 516 +#define FILE_READDIR_AN 517 +#define FILE_PUT_AN 518 +#define FILE_GET_AN 519 +#define FILE_CHKSUM_AN 520 +#define CHK_N_V_PATH_PERM_AN 521 +#define FILE_RENAME_AN 522 +#define FILE_TRUNCATE_AN 523 +#define FILE_STAGE_TO_CACHE_AN 524 +#define FILE_SYNC_TO_ARCH_AN 525 /* 600 - 699 - Object File I/O API calls */ #define DATA_OBJ_CREATE_AN 601 #define DATA_OBJ_OPEN_AN 602 -#define DATA_OBJ_PUT_AN 606 -#define DATA_PUT_AN 607 -#define DATA_OBJ_GET_AN 608 -#define DATA_GET_AN 609 -#define DATA_COPY_AN 611 -#define SIMPLE_QUERY_AN 614 +#define DATA_OBJ_PUT_AN 606 +#define DATA_PUT_AN 607 +#define DATA_OBJ_GET_AN 608 +#define DATA_GET_AN 609 +#define DATA_COPY_AN 611 +#define SIMPLE_QUERY_AN 614 #define DATA_OBJ_UNLINK_AN 615 #define REG_DATA_OBJ_AN 619 #define UNREG_DATA_OBJ_AN 620 #define REG_REPLICA_AN 621 -#define MOD_DATA_OBJ_META_AN 622 -#define RULE_EXEC_SUBMIT_AN 623 +#define MOD_DATA_OBJ_META_AN 622 +#define RULE_EXEC_SUBMIT_AN 623 #define RULE_EXEC_DEL_AN 624 #define EXEC_MY_RULE_AN 625 #define OPR_COMPLETE_AN 626 @@ -61,111 +61,111 @@ #define DATA_OBJ_CHKSUM_AN 629 #define PHY_PATH_REG_AN 630 #define DATA_OBJ_TRIM_AN 632 -#define OBJ_STAT_AN 633 -#define SUB_STRUCT_FILE_CREATE_AN 635 -#define SUB_STRUCT_FILE_OPEN_AN 636 -#define SUB_STRUCT_FILE_READ_AN 637 -#define SUB_STRUCT_FILE_WRITE_AN 638 -#define SUB_STRUCT_FILE_CLOSE_AN 639 -#define SUB_STRUCT_FILE_UNLINK_AN 640 -#define SUB_STRUCT_FILE_STAT_AN 641 -#define SUB_STRUCT_FILE_FSTAT_AN 642 -#define SUB_STRUCT_FILE_LSEEK_AN 643 -#define SUB_STRUCT_FILE_RENAME_AN 644 -#define QUERY_SPEC_COLL_AN 645 -#define SUB_STRUCT_FILE_MKDIR_AN 647 -#define SUB_STRUCT_FILE_RMDIR_AN 648 -#define SUB_STRUCT_FILE_OPENDIR_AN 649 -#define SUB_STRUCT_FILE_READDIR_AN 650 -#define SUB_STRUCT_FILE_CLOSEDIR_AN 651 -#define DATA_OBJ_TRUNCATE_AN 652 -#define SUB_STRUCT_FILE_TRUNCATE_AN 653 -#define GET_XMSG_TICKET_AN 654 -#define SEND_XMSG_AN 655 -#define RCV_XMSG_AN 656 -#define SUB_STRUCT_FILE_GET_AN 657 -#define SUB_STRUCT_FILE_PUT_AN 658 -#define SYNC_MOUNTED_COLL_AN 659 -#define STRUCT_FILE_SYNC_AN 660 -#define CLOSE_COLLECTION_AN 661 -#define STRUCT_FILE_EXTRACT_AN 664 -#define STRUCT_FILE_EXT_AND_REG_AN 665 -#define STRUCT_FILE_BUNDLE_AN 666 -#define CHK_OBJ_PERM_AND_STAT_AN 667 -#define GET_REMOTE_ZONE_RESC_AN 668 -#define DATA_OBJ_OPEN_AND_STAT_AN 669 -#define L3_FILE_GET_SINGLE_BUF_AN 670 -#define L3_FILE_PUT_SINGLE_BUF_AN 671 -#define DATA_OBJ_CREATE_AND_STAT_AN 672 -#define DATA_OBJ_CLOSE_AN 673 -#define DATA_OBJ_LSEEK_AN 674 -#define DATA_OBJ_READ_AN 675 -#define DATA_OBJ_WRITE_AN 676 -#define COLL_REPL_AN 677 -#define OPEN_COLLECTION_AN 678 -#define RM_COLL_AN 679 -#define MOD_COLL_AN 680 -#define COLL_CREATE_AN 681 -#define DATA_OBJ_UNLOCK_AN 682 -#define REG_COLL_AN 683 +#define OBJ_STAT_AN 633 +#define SUB_STRUCT_FILE_CREATE_AN 635 +#define SUB_STRUCT_FILE_OPEN_AN 636 +#define SUB_STRUCT_FILE_READ_AN 637 +#define SUB_STRUCT_FILE_WRITE_AN 638 +#define SUB_STRUCT_FILE_CLOSE_AN 639 +#define SUB_STRUCT_FILE_UNLINK_AN 640 +#define SUB_STRUCT_FILE_STAT_AN 641 +#define SUB_STRUCT_FILE_FSTAT_AN 642 +#define SUB_STRUCT_FILE_LSEEK_AN 643 +#define SUB_STRUCT_FILE_RENAME_AN 644 +#define QUERY_SPEC_COLL_AN 645 +#define SUB_STRUCT_FILE_MKDIR_AN 647 +#define SUB_STRUCT_FILE_RMDIR_AN 648 +#define SUB_STRUCT_FILE_OPENDIR_AN 649 +#define SUB_STRUCT_FILE_READDIR_AN 650 +#define SUB_STRUCT_FILE_CLOSEDIR_AN 651 +#define DATA_OBJ_TRUNCATE_AN 652 +#define SUB_STRUCT_FILE_TRUNCATE_AN 653 +#define GET_XMSG_TICKET_AN 654 +#define SEND_XMSG_AN 655 +#define RCV_XMSG_AN 656 +#define SUB_STRUCT_FILE_GET_AN 657 +#define SUB_STRUCT_FILE_PUT_AN 658 +#define SYNC_MOUNTED_COLL_AN 659 +#define STRUCT_FILE_SYNC_AN 660 +#define CLOSE_COLLECTION_AN 661 +#define STRUCT_FILE_EXTRACT_AN 664 +#define STRUCT_FILE_EXT_AND_REG_AN 665 +#define STRUCT_FILE_BUNDLE_AN 666 +#define CHK_OBJ_PERM_AND_STAT_AN 667 +#define GET_REMOTE_ZONE_RESC_AN 668 +#define DATA_OBJ_OPEN_AND_STAT_AN 669 +#define L3_FILE_GET_SINGLE_BUF_AN 670 +#define L3_FILE_PUT_SINGLE_BUF_AN 671 +#define DATA_OBJ_CREATE_AND_STAT_AN 672 +#define DATA_OBJ_CLOSE_AN 673 +#define DATA_OBJ_LSEEK_AN 674 +#define DATA_OBJ_READ_AN 675 +#define DATA_OBJ_WRITE_AN 676 +#define COLL_REPL_AN 677 +#define OPEN_COLLECTION_AN 678 +#define RM_COLL_AN 679 +#define MOD_COLL_AN 680 +#define COLL_CREATE_AN 681 +#define DATA_OBJ_UNLOCK_AN 682 +#define REG_COLL_AN 683 #define PHY_BUNDLE_COLL_AN 684 -#define UNBUN_AND_REG_PHY_BUNFILE_AN 685 +#define UNBUN_AND_REG_PHY_BUNFILE_AN 685 #define GET_HOST_FOR_PUT_AN 686 -#define GET_RESC_QUOTA_AN 687 +#define GET_RESC_QUOTA_AN 687 #define BULK_DATA_OBJ_REG_AN 688 #define BULK_DATA_OBJ_PUT_AN 689 #define PROC_STAT_AN 690 #define STREAM_READ_AN 691 #define EXEC_CMD_AN 692 -#define STREAM_CLOSE_AN 693 +#define STREAM_CLOSE_AN 693 #define GET_HOST_FOR_GET_AN 694 #define DATA_OBJ_REPL_AN 695 #define DATA_OBJ_COPY_AN 696 #define DATA_OBJ_PHYMV_AN 697 -#define DATA_OBJ_FSYNC_AN 698 -#define DATA_OBJ_LOCK_AN 699 // JMC - backport 4599 +#define DATA_OBJ_FSYNC_AN 698 +#define DATA_OBJ_LOCK_AN 699 // JMC - backport 4599 /* 700 - 799 - Metadata API calls */ -#define GET_MISC_SVR_INFO_AN 700 -#define GENERAL_ADMIN_AN 701 -#define GEN_QUERY_AN 702 -#define AUTH_REQUEST_AN 703 -#define AUTH_RESPONSE_AN 704 -#define AUTH_CHECK_AN 705 -#define MOD_AVU_METADATA_AN 706 -#define MOD_ACCESS_CONTROL_AN 707 -#define RULE_EXEC_MOD_AN 708 -#define GET_TEMP_PASSWORD_AN 709 -#define GENERAL_UPDATE_AN 710 -#define READ_COLLECTION_AN 713 -#define USER_ADMIN_AN 714 -#define GENERAL_ROW_INSERT_AN 715 -#define GENERAL_ROW_PURGE_AN 716 -#define END_TRANSACTION_AN 718 -#define DATABASE_RESC_OPEN_AN 719 -#define DATABASE_OBJ_CONTROL_AN 720 -#define DATABASE_RESC_CLOSE_AN 721 -#define SPECIFIC_QUERY_AN 722 -#define TICKET_ADMIN_AN 723 -#define GET_TEMP_PASSWORD_FOR_OTHER_AN 724 -#define PAM_AUTH_REQUEST_AN 725 -#define GET_LIMITED_PASSWORD_AN 726 +#define GET_MISC_SVR_INFO_AN 700 +#define GENERAL_ADMIN_AN 701 +#define GEN_QUERY_AN 702 +#define AUTH_REQUEST_AN 703 +#define AUTH_RESPONSE_AN 704 +#define AUTH_CHECK_AN 705 +#define MOD_AVU_METADATA_AN 706 +#define MOD_ACCESS_CONTROL_AN 707 +#define RULE_EXEC_MOD_AN 708 +#define GET_TEMP_PASSWORD_AN 709 +#define GENERAL_UPDATE_AN 710 +#define READ_COLLECTION_AN 713 +#define USER_ADMIN_AN 714 +#define GENERAL_ROW_INSERT_AN 715 +#define GENERAL_ROW_PURGE_AN 716 +#define END_TRANSACTION_AN 718 +#define DATABASE_RESC_OPEN_AN 719 +#define DATABASE_OBJ_CONTROL_AN 720 +#define DATABASE_RESC_CLOSE_AN 721 +#define SPECIFIC_QUERY_AN 722 +#define TICKET_ADMIN_AN 723 +#define GET_TEMP_PASSWORD_FOR_OTHER_AN 724 +#define PAM_AUTH_REQUEST_AN 725 +#define GET_LIMITED_PASSWORD_AN 726 /* 1100 - 1200 - SSL API calls */ -#define SSL_START_AN 1100 -#define SSL_END_AN 1101 - -#define AUTH_PLUG_REQ_AN 1201 -#define AUTH_PLUG_RESP_AN 1202 -#define GET_HIER_FOR_RESC_AN 1203 -#define GET_HIER_FROM_LEAF_ID_AN 1204 -#define SET_RR_CTX_AN 1205 -#define EXEC_RULE_EXPRESSION_AN 1206 +#define SSL_START_AN 1100 +#define SSL_END_AN 1101 +#define AUTH_PLUG_REQ_AN 1201 +#define AUTH_PLUG_RESP_AN 1202 +#define GET_HIER_FOR_RESC_AN 1203 +#define GET_HIER_FROM_LEAF_ID_AN 1204 +#define SET_RR_CTX_AN 1205 +#define EXEC_RULE_EXPRESSION_AN 1206 -#define SERVER_REPORT_AN 10204 -#define ZONE_REPORT_AN 10205 -#define CLIENT_HINTS_AN 10215 +#define SERVER_REPORT_AN 10204 +#define ZONE_REPORT_AN 10205 +#define CLIENT_HINTS_AN 10215 +// clang-format on #endif // API_NUMBER_H__ diff --git a/lib/api/include/apiPackTable.h b/lib/api/include/apiPackTable.h index e1353aff0c..5235ff93bd 100644 --- a/lib/api/include/apiPackTable.h +++ b/lib/api/include/apiPackTable.h @@ -63,8 +63,6 @@ packInstruct_t api_pack_table_init[] = { {"SubStructFileLseekInp_PI", SubStructFileLseekInp_PI, irods::clearInStruct_noop}, {"SubStructFileRenameInp_PI", SubStructFileRenameInp_PI, irods::clearInStruct_noop}, {"getTempPasswordOut_PI", getTempPasswordOut_PI, irods::clearInStruct_noop}, - {"GetXmsgTicketInp_PI", GetXmsgTicketInp_PI, irods::clearInStruct_noop}, - {"SendXmsgInp_PI", SendXmsgInp_PI, irods::clearInStruct_noop}, {"StructFileOprInp_PI", StructFileOprInp_PI, irods::clearInStruct_noop}, {"StructFileExtAndRegInp_PI", StructFileExtAndRegInp_PI, irods::clearInStruct_noop}, {"ChkObjPermAndStat_PI", ChkObjPermAndStat_PI, irods::clearInStruct_noop}, diff --git a/lib/api/include/apiTable.hpp b/lib/api/include/apiTable.hpp index ac2f3c0e1e..bf80d76ca4 100644 --- a/lib/api/include/apiTable.hpp +++ b/lib/api/include/apiTable.hpp @@ -95,7 +95,6 @@ #include "rsGetRescQuota.hpp" #include "rsGetTempPassword.hpp" #include "rsGetTempPasswordForOther.hpp" -#include "rsGetXmsgTicket.hpp" #include "rsIESClientHints.hpp" #include "rsL3FileGetSingleBuf.hpp" #include "rsL3FilePutSingleBuf.hpp" @@ -111,7 +110,6 @@ #include "rsPhyPathReg.hpp" #include "rsProcStat.hpp" #include "rsQuerySpecColl.hpp" -#include "rsRcvXmsg.hpp" #include "rsReadCollection.hpp" #include "rsRegColl.hpp" #include "rsRegDataObj.hpp" @@ -120,7 +118,6 @@ #include "rsRuleExecDel.hpp" #include "rsRuleExecMod.hpp" #include "rsRuleExecSubmit.hpp" -#include "rsSendXmsg.hpp" #include "rsServerReport.hpp" #include "rsSetRoundRobinContext.hpp" #include "rsSimpleQuery.hpp" @@ -243,7 +240,6 @@ #define RS_GET_RESC_QUOTA NULLPTR_FOR_CLIENT_TABLE(rsGetRescQuota) #define RS_GET_TEMP_PASSWORD NULLPTR_FOR_CLIENT_TABLE(rsGetTempPassword) #define RS_GET_TEMP_PASSWORD_FOR_OTHER NULLPTR_FOR_CLIENT_TABLE(rsGetTempPasswordForOther) -#define RS_GET_XMSG_TICKET NULLPTR_FOR_CLIENT_TABLE(rsGetXmsgTicket) #define RS_IES_CLIENT_HINTS NULLPTR_FOR_CLIENT_TABLE(rsClientHints) #define RS_L3_FILE_GET_SINGLE_BUF NULLPTR_FOR_CLIENT_TABLE(rsL3FileGetSingleBuf) #define RS_L3_FILE_PUT_SINGLE_BUF NULLPTR_FOR_CLIENT_TABLE(rsL3FilePutSingleBuf) @@ -259,7 +255,6 @@ #define RS_PHY_PATH_REG NULLPTR_FOR_CLIENT_TABLE(rsPhyPathReg) #define RS_PROC_STAT NULLPTR_FOR_CLIENT_TABLE(rsProcStat) #define RS_QUERY_SPEC_COLL NULLPTR_FOR_CLIENT_TABLE(rsQuerySpecColl) -#define RS_RCV_XMSG NULLPTR_FOR_CLIENT_TABLE(rsRcvXmsg) #define RS_READ_COLLECTION NULLPTR_FOR_CLIENT_TABLE(rsReadCollection) #define RS_REG_COLL NULLPTR_FOR_CLIENT_TABLE(rsRegColl) #define RS_REG_DATA_OBJ NULLPTR_FOR_CLIENT_TABLE(rsRegDataObj) @@ -268,7 +263,6 @@ #define RS_RULE_EXEC_DEL NULLPTR_FOR_CLIENT_TABLE(rsRuleExecDel) #define RS_RULE_EXEC_MOD NULLPTR_FOR_CLIENT_TABLE(rsRuleExecMod) #define RS_RULE_EXEC_SUBMIT NULLPTR_FOR_CLIENT_TABLE(rsRuleExecSubmit) -#define RS_SEND_XMSG NULLPTR_FOR_CLIENT_TABLE(rsSendXmsg) #define RS_SERVER_REPORT NULLPTR_FOR_CLIENT_TABLE(rsServerReport) #define RS_SET_ROUNDROBIN_CONTEXT NULLPTR_FOR_CLIENT_TABLE(rsSetRoundRobinContext) #define RS_SIMPLE_QUERY NULLPTR_FOR_CLIENT_TABLE(rsSimpleQuery) @@ -596,7 +590,7 @@ static irods::apidef_t client_api_table_inp[] = { (funcPtr)CALL_GENQUERYINP_GENQUERYOUT }, { - AUTH_REQUEST_AN, RODS_API_VERSION, NO_USER_AUTH | XMSG_SVR_ALSO, NO_USER_AUTH | XMSG_SVR_ALSO, + AUTH_REQUEST_AN, RODS_API_VERSION, NO_USER_AUTH, NO_USER_AUTH, NULL, 0, "authRequestOut_PI", 0, boost::any(std::function(RS_AUTH_REQUEST)), "api_auth_request", irods::clearInStruct_noop, @@ -604,7 +598,7 @@ static irods::apidef_t client_api_table_inp[] = { }, { - AUTH_RESPONSE_AN, RODS_API_VERSION, NO_USER_AUTH | XMSG_SVR_ALSO, NO_USER_AUTH | XMSG_SVR_ALSO, + AUTH_RESPONSE_AN, RODS_API_VERSION, NO_USER_AUTH, NO_USER_AUTH, "authResponseInp_PI", 0, NULL, 0, boost::any(std::function(RS_AUTH_RESPONSE)), "api_auth_response", clearAuthResponseInp, @@ -656,7 +650,7 @@ static irods::apidef_t client_api_table_inp[] = { }, { PAM_AUTH_REQUEST_AN, RODS_API_VERSION, - NO_USER_AUTH | XMSG_SVR_ALSO, NO_USER_AUTH | XMSG_SVR_ALSO, + NO_USER_AUTH, NO_USER_AUTH, "pamAuthRequestInp_PI", 0, "pamAuthRequestOut_PI", 0, boost::any(std::function(RS_PAM_AUTH_REQUEST)), "api_pam_auth_request", irods::clearInStruct_noop, @@ -1008,27 +1002,6 @@ static irods::apidef_t client_api_table_inp[] = { "api_sub_struct_file_truncate", irods::clearInStruct_noop, (funcPtr)CALL_SUBFILEINP }, - { - GET_XMSG_TICKET_AN, RODS_API_VERSION, REMOTE_USER_AUTH | XMSG_SVR_ONLY, REMOTE_USER_AUTH | XMSG_SVR_ONLY, - "GetXmsgTicketInp_PI", 0, "XmsgTicketInfo_PI", 0, - boost::any(std::function(RS_GET_XMSG_TICKET)), - "api_get_xmsg_ticket", irods::clearInStruct_noop, - (funcPtr)CALL_GETXMSGTICKETINP_XMSGTICKETINFOOUT - }, - { - SEND_XMSG_AN, RODS_API_VERSION, XMSG_SVR_ONLY, XMSG_SVR_ONLY, - "SendXmsgInp_PI", 0, NULL, 0, - boost::any(std::function(RS_SEND_XMSG)), - "api_send_xmsg", irods::clearInStruct_noop, - (funcPtr)CALL_SENDXMSGINP - }, - { - RCV_XMSG_AN, RODS_API_VERSION, XMSG_SVR_ONLY, XMSG_SVR_ONLY, - "RcvXmsgInp_PI", 0, "RcvXmsgOut_PI", 0, - boost::any(std::function(RS_RCV_XMSG)), - "api_rcv_xmsg", irods::clearInStruct_noop, - (funcPtr)CALL_RCVXMSGINP_RCVXMSGOUT - }, { SUB_STRUCT_FILE_GET_AN, RODS_API_VERSION, REMOTE_USER_AUTH, REMOTE_USER_AUTH, "SubFile_PI", 0, NULL, 1, @@ -1220,7 +1193,7 @@ static irods::apidef_t client_api_table_inp[] = { }, { SSL_START_AN, RODS_API_VERSION, - NO_USER_AUTH | XMSG_SVR_ALSO, NO_USER_AUTH | XMSG_SVR_ALSO, + NO_USER_AUTH, NO_USER_AUTH, "sslStartInp_PI", 0, NULL, 0, boost::any(std::function(RS_SSL_START)), "api_ssl_start", irods::clearInStruct_noop, @@ -1228,7 +1201,7 @@ static irods::apidef_t client_api_table_inp[] = { }, { SSL_END_AN, RODS_API_VERSION, - NO_USER_AUTH | XMSG_SVR_ALSO, NO_USER_AUTH | XMSG_SVR_ALSO, + NO_USER_AUTH, NO_USER_AUTH, "sslEndInp_PI", 0, NULL, 0, boost::any(std::function(RS_SSL_END)), "api_ssl_end", irods::clearInStruct_noop, diff --git a/lib/api/include/getXmsgTicket.h b/lib/api/include/getXmsgTicket.h deleted file mode 100644 index 7b0e8fe8aa..0000000000 --- a/lib/api/include/getXmsgTicket.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef GET_XMSG_TICKET_H__ -#define GET_XMSG_TICKET_H__ - -#include "rcConnect.h" -#include "rodsXmsg.h" - - -#ifdef __cplusplus -extern "C" -#endif -int rcGetXmsgTicket( rcComm_t *conn, getXmsgTicketInp_t *getXmsgTicketInp, xmsgTicketInfo_t **outXmsgTicketInfo ); - -#endif diff --git a/lib/api/include/rcvXmsg.h b/lib/api/include/rcvXmsg.h deleted file mode 100644 index 388d5064b5..0000000000 --- a/lib/api/include/rcvXmsg.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef RCV_XMSG_H__ -#define RCV_XMSG_H__ - -#include "rcConnect.h" -#include "rodsXmsg.h" - -#ifdef __cplusplus -extern "C" -#endif -int rcRcvXmsg( rcComm_t *conn, rcvXmsgInp_t *rcvXmsgInp, rcvXmsgOut_t **rcvXmsgOut ); - -#endif diff --git a/lib/api/include/sendXmsg.h b/lib/api/include/sendXmsg.h deleted file mode 100644 index bf650b34a4..0000000000 --- a/lib/api/include/sendXmsg.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef SEND_XMSG_H__ -#define SEND_XMSG_H__ - -#include "rcConnect.h" -#include "rodsXmsg.h" - -#ifdef __cplusplus -extern "C" -#endif -int rcSendXmsg( rcComm_t *conn, sendXmsgInp_t *sendXmsgInp ); - -#endif diff --git a/lib/api/src/rcGetXmsgTicket.cpp b/lib/api/src/rcGetXmsgTicket.cpp deleted file mode 100644 index 8492b869be..0000000000 --- a/lib/api/src/rcGetXmsgTicket.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "getXmsgTicket.h" -#include "procApiRequest.h" -#include "apiNumber.h" - -/** - * \fn rcGetXmsgTicket( rcComm_t *conn, getXmsgTicketInp_t *getXmsgTicketInp, xmsgTicketInfo_t **outXmsgTicketInfo ) - * - * \brief Get an XMessage ticket. - * - * \user client - * - * \ingroup xmessage - * - * \since 1.0 - * - * \author Arcot Rajasekar - * - * \remark none - * - * \note none - * - * \param[in] conn - A rcComm_t connection handle to the server. - * \param[in] getXmsgTicketInp - * \param[out] outXmsgTicketInfo - * - * \return integer - * \retval 0 on success. - * \sideeffect none - * \pre none - * \post none - * \sa none -**/ -int -rcGetXmsgTicket( rcComm_t *conn, getXmsgTicketInp_t *getXmsgTicketInp, - xmsgTicketInfo_t **outXmsgTicketInfo ) { - int status; - status = procApiRequest( conn, GET_XMSG_TICKET_AN, getXmsgTicketInp, NULL, - ( void ** ) outXmsgTicketInfo, NULL ); - - return status; -} diff --git a/lib/api/src/rcRcvXmsg.cpp b/lib/api/src/rcRcvXmsg.cpp deleted file mode 100644 index 385d52b02a..0000000000 --- a/lib/api/src/rcRcvXmsg.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "rcvXmsg.h" -#include "procApiRequest.h" -#include "apiNumber.h" - -/** - * \fn rcRcvXmsg( rcComm_t *conn, rcvXmsgInp_t *rcvXmsgInp, rcvXmsgOut_t **rcvXmsgOut ) - * - * \brief Receive an XMessage. - * - * \user client - * - * \ingroup xmessage - * - * \since 1.0 - * - * \author Arcot Rajasekar - * - * \remark none - * - * \note none - * - * \param[in] conn - A rcComm_t connection handle to the server. - * \param[in] rcvXmsgInp - * \param[out] rcvXmsgOut - * - * \return integer - * \retval 0 on success. - * \sideeffect none - * \pre none - * \post none - * \sa none -**/ -int -rcRcvXmsg( rcComm_t *conn, rcvXmsgInp_t *rcvXmsgInp, - rcvXmsgOut_t **rcvXmsgOut ) { - int status; - status = procApiRequest( conn, RCV_XMSG_AN, rcvXmsgInp, NULL, - ( void ** ) rcvXmsgOut, NULL ); - - return status; -} diff --git a/lib/api/src/rcSendXmsg.cpp b/lib/api/src/rcSendXmsg.cpp deleted file mode 100644 index e30163e5ab..0000000000 --- a/lib/api/src/rcSendXmsg.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "sendXmsg.h" -#include "procApiRequest.h" -#include "apiNumber.h" - -/** - * \fn rcSendXmsg( rcComm_t *conn, sendXmsgInp_t *sendXmsgInp ) - * - * \brief Send an XMessage. - * - * \user client - * - * \ingroup xmessage - * - * \since 1.0 - * - * \author Arcot Rajasekar - * - * \remark none - * - * \note none - * - * \param[in] conn - A rcComm_t connection handle to the server. - * \param[in] sendXmsgInp - * - * \return integer - * \retval 0 on success. - * \sideeffect none - * \pre none - * \post none - * \sa none -**/ -int -rcSendXmsg( rcComm_t *conn, sendXmsgInp_t *sendXmsgInp ) { - int status; - status = procApiRequest( conn, SEND_XMSG_AN, sendXmsgInp, NULL, - ( void ** ) NULL, NULL ); - - return status; -} diff --git a/lib/core/include/getRodsEnv.h b/lib/core/include/getRodsEnv.h index 661fafa849..a4919efe4e 100644 --- a/lib/core/include/getRodsEnv.h +++ b/lib/core/include/getRodsEnv.h @@ -9,8 +9,6 @@ typedef struct { char rodsUserName[NAME_LEN]; char rodsHost[NAME_LEN]; int rodsPort; - char xmsgHost[NAME_LEN]; - int xmsgPort; char rodsHome[MAX_NAME_LEN]; char rodsCwd[MAX_NAME_LEN]; char rodsAuthScheme[NAME_LEN]; diff --git a/lib/core/include/irods_configuration_keywords.hpp b/lib/core/include/irods_configuration_keywords.hpp index 7c5d126454..5cab847b55 100644 --- a/lib/core/include/irods_configuration_keywords.hpp +++ b/lib/core/include/irods_configuration_keywords.hpp @@ -79,8 +79,6 @@ namespace irods { const std::string CFG_IRODS_USER_NAME_KW( "irods_user_name" ); const std::string CFG_IRODS_HOST_KW( "irods_host" ); const std::string CFG_IRODS_PORT_KW( "irods_port" ); - const std::string CFG_IRODS_XMSG_HOST_KW( "xmsg_host" ); - const std::string CFG_IRODS_XMSG_PORT_KW( "xmsg_port" ); const std::string CFG_IRODS_HOME_KW( "irods_home" ); const std::string CFG_IRODS_CWD_KW( "irods_cwd" ); const std::string CFG_IRODS_AUTHENTICATION_SCHEME_KW( @@ -153,7 +151,6 @@ namespace irods { const std::string CFG_ZONE_USER( "zone_user" ); const std::string CFG_ZONE_PORT( "zone_port" ); const std::string CFG_ZONE_AUTH_SCHEME( "zone_auth_scheme" ); - const std::string CFG_XMSG_PORT( "xmsg_port" ); // irods control plane values const std::string CFG_SERVER_CONTROL_PLANE_PORT( diff --git a/lib/core/include/irods_server_properties.hpp b/lib/core/include/irods_server_properties.hpp index c300870c14..62d68d0fe6 100644 --- a/lib/core/include/irods_server_properties.hpp +++ b/lib/core/include/irods_server_properties.hpp @@ -33,9 +33,6 @@ namespace irods { /// @brief kw for storing the process id of the rule engine server const std::string RE_PID_KW( "rule_engine_process_id" ); -/// @brief kw for storing the process id of the xmessage server - const std::string XMSG_PID_KW( "x_message_process_id" ); - /// @brief kw for storing client user name const std::string CLIENT_USER_NAME_KW( "client_user_name" ); diff --git a/lib/core/include/msParam.h b/lib/core/include/msParam.h index 48c6c656e6..5fa4f7d73a 100644 --- a/lib/core/include/msParam.h +++ b/lib/core/include/msParam.h @@ -48,12 +48,6 @@ #define IntArray_MS_T "IntArray_PI" #define GenQueryInp_MS_T "GenQueryInp_PI" #define GenQueryOut_MS_T "GenQueryOut_PI" -#define XmsgTicketInfo_MS_T "XmsgTicketInfo_PI" -#define SendXmsgInfo_MS_T "SendXmsgInfo_PI" -#define GetXmsgTicketInp_MS_T "GetXmsgTicketInp_PI" -#define SendXmsgInp_MS_T "SendXmsgInp_PI" -#define RcvXmsgInp_MS_T "RcvXmsgInp_PI" -#define RcvXmsgOut_MS_T "RcvXmsgOut_PI" #define StructFileExtAndRegInp_MS_T "StructFileExtAndRegInp_PI" #define RuleSet_MS_T "RuleSet_PI" #define RuleStruct_MS_T "RuleStruct_PI" diff --git a/lib/core/include/rcConnect.h b/lib/core/include/rcConnect.h index 50b158f41c..5dc25b9401 100644 --- a/lib/core/include/rcConnect.h +++ b/lib/core/include/rcConnect.h @@ -247,8 +247,6 @@ getSessionSignatureClientside(); int clientLoginWithPassword( rcComm_t *conn, char* password ); -rcComm_t * -rcConnectXmsg( rodsEnv *myRodsEnv, rErrMsg_t *errMsg ); void cliReconnManager( rcComm_t *conn ); int diff --git a/lib/core/include/rcMisc.h b/lib/core/include/rcMisc.h index 4784e6da11..bc664d0679 100644 --- a/lib/core/include/rcMisc.h +++ b/lib/core/include/rcMisc.h @@ -239,9 +239,6 @@ separateSelFuncFromAttr( char *t, char **aggOp, char **colNm ); int getSelVal( char *c ); -int -clearSendXmsgInfo( sendXmsgInfo_t *sendXmsgInfo ); - int parseCachedStructFileStr( char *collInfo2, specColl_t *specColl ); int diff --git a/lib/core/include/rods.h b/lib/core/include/rods.h index bbc8d17d53..b41c980052 100644 --- a/lib/core/include/rods.h +++ b/lib/core/include/rods.h @@ -23,7 +23,6 @@ #include "rodsGenQuery.h" #include "parseCommandLine.h" #include "obf.h" -#include "rodsXmsg.h" #include "rcConnect.h" #ifdef _WIN32 diff --git a/lib/core/include/rodsClient.h b/lib/core/include/rodsClient.h index 3ef6653dc5..d73cb30419 100644 --- a/lib/core/include/rodsClient.h +++ b/lib/core/include/rodsClient.h @@ -4,8 +4,6 @@ /* rodsClient.h - common header file for rods client */ - - #ifndef RODS_CLIENT_H__ #define RODS_CLIENT_H__ diff --git a/lib/core/include/rodsDef.h b/lib/core/include/rodsDef.h index 932cf81742..7b647daa9a 100644 --- a/lib/core/include/rodsDef.h +++ b/lib/core/include/rodsDef.h @@ -28,8 +28,6 @@ #include #include - - #if defined(solaris_platform) #include #endif @@ -49,6 +47,7 @@ #include #endif +// clang-format off #define HEADER_TYPE_LEN 128 /* changed by Raja to 128 from 16 */ #define TIME_LEN 32 @@ -78,7 +77,6 @@ #define SERVER_PT 1 /* server process type */ #define AGENT_PT 2 /* agent process type */ #define RE_SERVER_PT 3 /* reServer type */ -#define XMSG_SERVER_PT 4 /* xmsgServer type */ /* definition for rcat type */ @@ -370,4 +368,6 @@ typedef struct { char progName[NAME_LEN]; } procLog_t; +// clang-format on + #endif // RODS_DEF_H__ diff --git a/lib/core/include/rodsErrorTable.h b/lib/core/include/rodsErrorTable.h index 62f176feab..a3ced46874 100644 --- a/lib/core/include/rodsErrorTable.h +++ b/lib/core/include/rodsErrorTable.h @@ -10,10 +10,22 @@ * @brief Defines ERRORS for iRODS server and agents */ - #ifndef RODS_ERROR_TABLE_H__ #define RODS_ERROR_TABLE_H__ +/** + * IMPORTANT - END OF LIFE ERROR CODES + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * Error codes having a prefix of "END_OF_LIFE_" must NEVER be used + * in new code. + * + * This prefix is an indicator to the implementer that the error code + * is no longer used by iRODS. + * + * These error codes only exist as placeholders. + */ + /** * @defgroup error_codes iRODS ERROR Codes * @note ERROR code format: @@ -59,6 +71,8 @@ enum IRODS_ERROR_ENUM { #endif +// clang-format off + /* 1,000 - 299,000 - system type */ /** @defgroup system_errors System ERRORs * @ingroup error_codes @@ -125,9 +139,9 @@ NEW_ERROR(SYS_REG_OBJ_IN_SPEC_COLL, -57000) NEW_ERROR(SYS_DEST_SPEC_COLL_SUB_EXIST, -58000) NEW_ERROR(SYS_SRC_DEST_SPEC_COLL_CONFLICT, -59000) NEW_ERROR(SYS_UNKNOWN_SPEC_COLL_CLASS, -60000) -NEW_ERROR(SYS_DUPLICATE_XMSG_TICKET, -61000) -NEW_ERROR(SYS_UNMATCHED_XMSG_TICKET, -62000) -NEW_ERROR(SYS_NO_XMSG_FOR_MSG_NUMBER, -63000) +NEW_ERROR(END_OF_LIFE_SYS_DUPLICATE_XMSG_TICKET, -61000) // EOL since iRODS v4.3.0 +NEW_ERROR(END_OF_LIFE_SYS_UNMATCHED_XMSG_TICKET, -62000) // EOL since iRODS v4.3.0 +NEW_ERROR(END_OF_LIFE_SYS_NO_XMSG_FOR_MSG_NUMBER, -63000) // EOL since iRODS v4.3.0 NEW_ERROR(SYS_COLLINFO_2_FORMAT_ERR, -64000) NEW_ERROR(SYS_CACHE_STRUCT_FILE_RESC_ERR, -65000) NEW_ERROR(SYS_NOT_SUPPORTED, -66000) @@ -876,4 +890,6 @@ NEW_ERROR(SYS_NO_HANDLER_REPLY_MSG, -99999999) }; #endif +// clang-format on + #endif /* RODS_ERROR_TABLE_H__ */ diff --git a/lib/core/include/rodsKeyWdDef.h b/lib/core/include/rodsKeyWdDef.h index d3335f6ee5..57c77ec484 100644 --- a/lib/core/include/rodsKeyWdDef.h +++ b/lib/core/include/rodsKeyWdDef.h @@ -5,6 +5,8 @@ #ifndef RODS_KEYWD_DEF_H__ #define RODS_KEYWD_DEF_H__ +// clang-format off + /* The following are the keyWord definition for the condInput key/value pair */ #define ALL_KW "all" /* operation done on all replica */ @@ -292,7 +294,6 @@ #define INSTANCE_NAME_KW "instance_name" - - +// clang-format on #endif // RODS_KEYWD_DEF_H__ diff --git a/lib/core/include/rodsPackInstruct.h b/lib/core/include/rodsPackInstruct.h index ea3a8c2400..dd66185e98 100644 --- a/lib/core/include/rodsPackInstruct.h +++ b/lib/core/include/rodsPackInstruct.h @@ -115,12 +115,6 @@ #define SpecColl_PI "int collClass; int type; str collection[MAX_NAME_LEN]; str objPath[MAX_NAME_LEN]; str resource[NAME_LEN]; str rescHier[MAX_NAME_LEN]; str phyPath[MAX_NAME_LEN]; str cacheDir[MAX_NAME_LEN]; int cacheDirty; int replNum;" #define SubFile_PI "struct RHostAddr_PI; str subFilePath[MAX_NAME_LEN]; int mode; int flags; double offset; struct *SpecColl_PI;" -#define XmsgTicketInfo_PI "int sendTicket; int rcvTicket; int expireTime; int flag;" -#define SendXmsgInfo_PI "int msgNumber; str msgType[HEADER_TYPE_LEN]; int numRcv; int flag; str *msg; int numDel; str *delAddress[numDel]; int *delPort(numDel); str *miscInfo;" -#define GetXmsgTicketInp_PI "int expireTime; int flag;" -#define SendXmsgInp_PI "struct XmsgTicketInfo_PI; str sendAddr[NAME_LEN]; struct SendXmsgInfo_PI;" -#define RcvXmsgInp_PI "int rcvTicket; int msgNumber; int seqNumber; str msgCondition[MAX_NAME_LEN];" -#define RcvXmsgOut_PI "str msgType[HEADER_TYPE_LEN]; str sendUserName[NAME_LEN]; str sendAddr[NAME_LEN]; int msgNumber; int seqNumber; str *msg;" /* XXXXX start of HDF5 PI */ #define h5error_PI "str major[MAX_ERROR_SIZE]; str minor[MAX_ERROR_SIZE];" #define h5File_PI "int fopID; str *filename; int ffid; struct *h5Group_PI; struct h5error_PI;int ftime;" diff --git a/lib/core/include/rodsPackTable.h b/lib/core/include/rodsPackTable.h index c96856470a..7c40d5acd8 100644 --- a/lib/core/include/rodsPackTable.h +++ b/lib/core/include/rodsPackTable.h @@ -113,10 +113,6 @@ const packInstruct_t RodsPackTable[] = { {"IntArray_PI", IntArray_PI, NULL}, {"SpecColl_PI", SpecColl_PI, NULL}, {"SubFile_PI", SubFile_PI, NULL}, - {"XmsgTicketInfo_PI", XmsgTicketInfo_PI, NULL}, - {"SendXmsgInfo_PI", SendXmsgInfo_PI, NULL}, - {"RcvXmsgInp_PI", RcvXmsgInp_PI, NULL}, - {"RcvXmsgOut_PI", RcvXmsgOut_PI, NULL}, /* HDF5 PI */ {"h5File_PI", h5File_PI, NULL}, {"h5error_PI", h5error_PI, NULL}, diff --git a/lib/core/include/rodsType.h b/lib/core/include/rodsType.h index 2a6d1f6274..d8d7507572 100644 --- a/lib/core/include/rodsType.h +++ b/lib/core/include/rodsType.h @@ -15,6 +15,8 @@ #endif #include "rodsDef.h" +// clang-format off + #if defined(osx_platform) typedef int64_t rodsLong_t; typedef u_int64_t rodsULong_t; @@ -75,4 +77,6 @@ typedef struct rodsDirent { char d_name[DIR_LEN]; } rodsDirent_t; +// clang-format on + #endif /* RODS_TYPE_H__ */ diff --git a/lib/core/include/rodsUser.h b/lib/core/include/rodsUser.h index 5088888d0f..1daf4ccfe2 100644 --- a/lib/core/include/rodsUser.h +++ b/lib/core/include/rodsUser.h @@ -35,9 +35,6 @@ #define REMOTE_PRIV_USER_AUTH 4 /* auth as a remote priv user */ #define LOCAL_PRIV_USER_AUTH 5 /* auth as local priv user */ -#define XMSG_SVR_ONLY 0x4000 /* execute only xmsgServer only */ -#define XMSG_SVR_ALSO 0x8000 /* execute on xmsgServer server also -* in addition to agent server */ typedef struct { char authScheme[NAME_LEN]; /* Authentication scheme */ int authFlag; /* the status of authentication */ diff --git a/lib/core/include/rodsXmsg.h b/lib/core/include/rodsXmsg.h deleted file mode 100644 index 964cd3c462..0000000000 --- a/lib/core/include/rodsXmsg.h +++ /dev/null @@ -1,105 +0,0 @@ -/*** Copyright (c), The Regents of the University of California *** - *** For more information please refer to files in the COPYRIGHT directory ***/ -/* rodsXmsg.h - Header for for xmsg */ - -#ifndef RODS_XMSG_H__ -#define RODS_XMSG_H__ - -#define DEF_EXPIRE_INT (3600 * 4) // default expire interval -#define MAX_EXPIRE_INT (3600 * 48) // max expire interval -#define INC_EXPIRE_INT (3600 * 2) // minimum inteval after new inteval was sent -// definition for msgNumber -#define ANY_MSG_NUMBER 0 // get the msg with the smallest msgNumber - -typedef struct { - uint expireTime; // unix time of ticket expiration - uint flag; // flag set to XmsgTicketInfo.flag -} getXmsgTicketInp_t; - -// definition for XmsgTicketInfo.flag -#define SINGLE_MSG_TICKET 0 // ticket for just a single msg. ticket will be - // deleted after the msg is received -#define MULTI_MSG_TICKET 1 // ticket for MULTIPLE MSG -typedef struct XmsgTicketInfo { - uint sendTicket; - uint rcvTicket; - uint expireTime; // unix time of ticket expiration - uint flag; -} xmsgTicketInfo_t; - -typedef struct SendXmsgInfo { - uint msgNumber; - char msgType[HEADER_TYPE_LEN]; // msg type, 16 char - uint numRcv; // number of receiver - int flag; // not used by client - char *msg; // the msg - int numDeli; // number of msg to deliver - char **deliAddress; // array of str pointer of addr - uint *deliPort; // array of port number to deliver - char *miscInfo; // for expiration, etc -} sendXmsgInfo_t; - -typedef struct { - xmsgTicketInfo_t ticket; // xmsgTicketInfo from getXmsgTicket - char sendAddr[NAME_LEN]; // send Addr can contain pid after - sendXmsgInfo_t sendXmsgInfo; -} sendXmsgInp_t; - -/* xmsg struct */ - -typedef struct IrodsXmsg { - sendXmsgInfo_t *sendXmsgInfo; - uint sendTime; // unix time of the send - char sendUserName[NAME_LEN]; // userName@zone of clientUser - char sendAddr[NAME_LEN]; // sender's network address - struct IrodsXmsg *prev; // the link list with XmsgReqHead - struct IrodsXmsg *next; - struct IrodsXmsg *tnext; // the link list within the same ticket (diff msgNumber) - struct IrodsXmsg *tprev; - uint seqNumber; - void *ticketMsgStruct; // points to the ticketMsgStruct_t this xmsg belongs -} irodsXmsg_t; - -typedef struct XmsgQue { - irodsXmsg_t *head; - irodsXmsg_t *tail; -} xmsgQue_t; - -typedef struct TicketMsgStruct { - xmsgTicketInfo_t ticket; - xmsgQue_t xmsgQue; // the link list of msg with the same ticket - struct TicketMsgStruct *hprev; // the hash link list. sort by rcvTicket - struct TicketMsgStruct *hnext; - void *ticketHashQue; // points to the ticketHashQue_t this ticket belongs - uint nxtSeqNumber; -} ticketMsgStruct_t; - -// queue of msg hashed to the same slot -typedef struct TicketHashQue { - ticketMsgStruct_t *head; - ticketMsgStruct_t *tail; -} ticketHashQue_t; - -typedef struct XmsgReq { - int sock; - struct XmsgReq *next; -} xmsgReq_t; - -typedef struct RcvXmsgInp { - uint rcvTicket; - uint msgNumber; - uint seqNumber; - char msgCondition[MAX_NAME_LEN]; -} rcvXmsgInp_t; - -typedef struct RcvXmsgOut { - char msgType[HEADER_TYPE_LEN]; // msg type, 16 char - char sendUserName[NAME_LEN]; // userName@zone of clientUser - char sendAddr[NAME_LEN]; // sender's network address - uint msgNumber; // msgNumber as set by sender - uint seqNumber; // internal sequence number - char *msg; // the msg -} rcvXmsgOut_t; - - -#endif // RODS_XMSG_H__ diff --git a/lib/core/src/getRodsEnv.cpp b/lib/core/src/getRodsEnv.cpp index 07811d8950..353515cd0a 100644 --- a/lib/core/src/getRodsEnv.cpp +++ b/lib/core/src/getRodsEnv.cpp @@ -204,10 +204,6 @@ extern "C" { irods::CFG_IRODS_HOST_KW, _env->rodsHost ); - capture_string_property( - irods::CFG_IRODS_XMSG_HOST_KW, - _env->xmsgHost ); - capture_string_property( irods::CFG_IRODS_HOME_KW, _env->rodsHome ); @@ -224,10 +220,6 @@ extern "C" { irods::CFG_IRODS_PORT_KW, _env->rodsPort ); - capture_integer_property( - irods::CFG_IRODS_XMSG_PORT_KW, - _env->xmsgPort ); - capture_string_property( irods::CFG_IRODS_DEFAULT_RESOURCE_KW, _env->rodsDefResource ); @@ -481,21 +473,11 @@ extern "C" { env_var, _env->rodsHost ); - env_var = irods::CFG_IRODS_XMSG_HOST_KW; - capture_string_env_var( - env_var, - _env->xmsgHost ); - env_var = irods::CFG_IRODS_PORT_KW; capture_integer_env_var( env_var, _env->rodsPort ); - env_var = irods::CFG_IRODS_XMSG_PORT_KW; - capture_integer_env_var( - env_var, - _env->xmsgPort ); - env_var = irods::CFG_IRODS_HOME_KW; capture_string_env_var( env_var, diff --git a/lib/core/src/rcConnect.cpp b/lib/core/src/rcConnect.cpp index 7a318fe880..bca4ed7558 100644 --- a/lib/core/src/rcConnect.cpp +++ b/lib/core/src/rcConnect.cpp @@ -353,22 +353,6 @@ cleanRcComm( rcComm_t *conn ) { return 0; } -rcComm_t * -rcConnectXmsg( rodsEnv *myRodsEnv, rErrMsg_t *errMsg ) { - rcComm_t *conn; - - if ( myRodsEnv == NULL ) { - fprintf( stderr, "rcConnectXmsg: NULL myRodsEnv input\n" ); - return NULL; - } - - conn = rcConnect( myRodsEnv->xmsgHost, myRodsEnv->xmsgPort, - myRodsEnv->rodsUserName, myRodsEnv->rodsZone, 0, errMsg ); - - return conn; -} - - void cliReconnManager( rcComm_t *conn ) { struct sockaddr_in remoteAddr; diff --git a/lib/core/src/rcMisc.cpp b/lib/core/src/rcMisc.cpp index 45b5100cd3..2cd9dfbd65 100644 --- a/lib/core/src/rcMisc.cpp +++ b/lib/core/src/rcMisc.cpp @@ -3467,38 +3467,6 @@ keyValFromString( char * string, keyValPair_t** list ) { return 0; } -int -clearSendXmsgInfo( sendXmsgInfo_t * sendXmsgInfo ) { - if ( sendXmsgInfo == NULL ) { - return 0; - } - - if ( sendXmsgInfo->msg != NULL ) { - free( sendXmsgInfo->msg ); - } - - if ( sendXmsgInfo->deliPort != NULL ) { - free( sendXmsgInfo->deliPort ); - } - - if ( sendXmsgInfo->miscInfo != NULL ) { - free( sendXmsgInfo->miscInfo ); - } - - if ( sendXmsgInfo->deliAddress != NULL && - *sendXmsgInfo->deliAddress != NULL ) { - int i; - - for ( i = 0; i < sendXmsgInfo->numDeli; i++ ) { - free( sendXmsgInfo->deliAddress[i] ); - } - free( sendXmsgInfo->deliAddress ); - } - memset( sendXmsgInfo, 0, sizeof( sendXmsgInfo_t ) ); - - return 0; -} - void clearModAccessControlInp( void* voidInp ) { modAccessControlInp_t * modAccessControlInp = ( modAccessControlInp_t* )voidInp; diff --git a/packaging/server_config.json.template b/packaging/server_config.json.template index 32e13f6f6c..0dd779a720 100644 --- a/packaging/server_config.json.template +++ b/packaging/server_config.json.template @@ -71,6 +71,5 @@ "server_control_plane_encryption_algorithm": "AES-256-CBC", "server_control_plane_encryption_num_hash_rounds": 16, "server_control_plane_timeout_milliseconds": 10000, - "xmsg_port": 1279, "zone_auth_scheme": "native" } diff --git a/plugins/rule_engines/irods_rule_engine_plugin-irods_rule_language/include/reFuncDefs.hpp b/plugins/rule_engines/irods_rule_engine_plugin-irods_rule_language/include/reFuncDefs.hpp index 7cc8e313b9..c4788d7664 100644 --- a/plugins/rule_engines/irods_rule_engine_plugin-irods_rule_language/include/reFuncDefs.hpp +++ b/plugins/rule_engines/irods_rule_engine_plugin-irods_rule_language/include/reFuncDefs.hpp @@ -232,11 +232,6 @@ int readMsrvcStructFromFile( char *msrvcFileName, msrvcStruct_t* inMsrvcStruct ) int writeMSrvcsIntoFile( char * inFileName, msrvcStruct_t *myMsrvcStruct, ruleExecInfo_t *rei ); - -int _writeXMsg( int streamId, char *hdr, char *msg ); -int _readXMsg( int streamId, char *contRead, int *msgNum, int *seqNum, char **hdr, char **msg, char **user, char **addr ); - - int _applyRule( char *inAction, msParamArray_t *inMsParamArray, ruleExecInfo_t *rei, int reiSaveFlag ); int _applyAllRules( char *inAction, msParamArray_t *inMsParamArray, ruleExecInfo_t *rei, int reiSaveFlag, int allRuleExecFlag ); diff --git a/plugins/rule_engines/irods_rule_engine_plugin-irods_rule_language/libirods_rule_engine_plugin-irods_rule_language.cpp b/plugins/rule_engines/irods_rule_engine_plugin-irods_rule_language/libirods_rule_engine_plugin-irods_rule_language.cpp index 2b10a00058..c808b97d12 100644 --- a/plugins/rule_engines/irods_rule_engine_plugin-irods_rule_language/libirods_rule_engine_plugin-irods_rule_language.cpp +++ b/plugins/rule_engines/irods_rule_engine_plugin-irods_rule_language/libirods_rule_engine_plugin-irods_rule_language.cpp @@ -201,10 +201,7 @@ irods::error start(irods::default_re_ctx&,const std::string& _instance_name ) { } -int finalizeRuleEngine(); irods::error stop(irods::default_re_ctx& _u, const std::string& _instance_name) { - (void) _u; - finalizeRuleEngine(); return SUCCESS(); } diff --git a/plugins/rule_engines/irods_rule_engine_plugin-irods_rule_language/nre.reHelpers1.cpp b/plugins/rule_engines/irods_rule_engine_plugin-irods_rule_language/nre.reHelpers1.cpp index a40a537bfa..cacdf19ecd 100644 --- a/plugins/rule_engines/irods_rule_engine_plugin-irods_rule_language/nre.reHelpers1.cpp +++ b/plugins/rule_engines/irods_rule_engine_plugin-irods_rule_language/nre.reHelpers1.cpp @@ -49,11 +49,7 @@ int myPID; int initializeReDebug( rsComm_t *svrComm ) { char condRead[NAME_LEN]; - int i, s, m, status; - char *readhdr = NULL; - char *readmsg = NULL; - char *user = NULL; - char *addr = NULL; + int s, m; if ( svrComm == NULL ) { return 0; @@ -69,401 +65,9 @@ int initializeReDebug( rsComm_t *svrComm ) { gethostname( myHostName, MAX_NAME_LEN ); sprintf( condRead, "(*XUSER == \"%s@%s\") && (*XHDR == \"STARTDEBUG\")", svrComm->clientUser.userName, svrComm->clientUser.rodsZone ); - status = _readXMsg( GlobalREDebugFlag, condRead, &m, &s, &readhdr, &readmsg, &user, &addr ); - if ( status >= 0 ) { - if ( ( readmsg != NULL ) && strlen( readmsg ) > 0 ) { - GlobalREDebugFlag = atoi( readmsg ); - } - if ( readhdr != NULL ) { - free( readhdr ); - } - if ( readmsg != NULL ) { - free( readmsg ); - } - if ( user != NULL ) { - free( user ); - } - if ( addr != NULL ) { - free( addr ); - } - /* initialize reDebug stack space*/ - for ( i = 0; i < REDEBUG_STACK_SIZE_FULL; i++ ) { - reDebugStackFull[i] = NULL; - } - for ( i = 0; i < REDEBUG_STACK_SIZE_CURR; i++ ) { - reDebugStackCurr[i].label = -1; - reDebugStackCurr[i].step = NULL; - } - memset( breakPoints, 0, sizeof( struct Breakpoint ) * 100 ); - - reDebugStackFullPtr = 0; - reDebugStackCurrPtr = 0; - snprintf( waitHdr, HEADER_TYPE_LEN - 1, "idbug:" ); - - rodsLog( LOG_NOTICE, "reDebugInitialization: Got Debug StreamId:%i\n", GlobalREDebugFlag ); - snprintf( waitMsg, MAX_NAME_LEN, "PROCESS BEGIN at %s:%i. Client connected from %s at port %i\n", - myHostName, myPID, svrComm->clientAddr, ntohs( svrComm->localAddr.sin_port ) ); - _writeXMsg( GlobalREDebugFlag, "idbug", waitMsg ); - snprintf( waitMsg, MAX_NAME_LEN, "%s:%i is waiting\n", myHostName, myPID ); - } return 0; } - -int processXMsg( int streamId, char *readmsg, - RuleEngineEventParam *param, Node *node, - Env *env, ruleExecInfo_t *rei ) { - - char myhdr[HEADER_TYPE_LEN]; - char mymsg[MAX_NAME_LEN]; - char *outStr = NULL; - int i, n; - int iLevel, wCnt; - int ruleInx = 0; - Region *r; - Res *res; - rError_t errmsg; - errmsg.len = 0; - errmsg.errMsg = NULL; - r = make_region( 0, NULL ); - ParserContext *context = newParserContext( &errmsg, r ); - Pointer *e = newPointer2( readmsg ); - int rulegen = 1; - int found; - int grdf[2]; - int cmd = 0; - int smallW; - - snprintf( myhdr, HEADER_TYPE_LEN - 1, "idbug:%s", param->actionName ); - memset( mymsg, 0, sizeof( mymsg ) ); - - PARSER_BEGIN( DbgCmd ) - TRY( DbgCmd ) - TTEXT2( "n", "next" ); - cmd = REDEBUG_STEP_OVER; - OR( DbgCmd ) - TTEXT2( "s", "step" ); - cmd = REDEBUG_NEXT; - OR( DbgCmd ) - TTEXT2( "f", "finish" ); - cmd = REDEBUG_STEP_OUT; - OR( DbgCmd ) - TTEXT2( "b", "break" ); - TRY( Param ) - TTYPE( TK_TEXT ); - int breakPointsInx2; - for ( breakPointsInx2 = 0; breakPointsInx2 < 100; breakPointsInx2++ ) { - if ( breakPoints[breakPointsInx2].actionName == NULL ) { - break; - } - } - if ( breakPointsInx2 == 100 ) { - _writeXMsg( streamId, myhdr, "Maximum breakpoint count reached. Breakpoint not set.\n" ); - cmd = REDEBUG_WAIT; - } - else { - breakPoints[breakPointsInx2].actionName = strdup( token->text ); - char * base_ptr = NULL; - TRY( loc ) - TTYPE( TK_TEXT ); - base_ptr = ( char * ) malloc( sizeof( token->text ) + 2 ); - base_ptr[0] = 'f'; - strcpy( base_ptr + 1, token->text ); - TTEXT( ":" ); - TTYPE( TK_INT ); - breakPoints[breakPointsInx2].base = strdup( base_ptr ); - breakPoints[breakPointsInx2].line = atoi( token->text ); - rodsLong_t range[2]; - char rulesFileName[MAX_NAME_LEN]; - getRuleBasePath( base_ptr, rulesFileName ); - - FILE *file; - /* char errbuf[ERR_MSG_LEN]; */ - file = fopen( rulesFileName, "r" ); - if ( file == NULL ) { - free( context ); - deletePointer( e ); - free( base_ptr ); - return RULES_FILE_READ_ERROR; - } - Pointer *p = newPointer( file, base_ptr ); - - - if ( getLineRange( p, breakPoints[breakPointsInx2].line, range ) == 0 ) { - breakPoints[breakPointsInx2].start = range[0]; - breakPoints[breakPointsInx2].finish = range[1]; - } - else { - breakPoints[breakPointsInx2].actionName = NULL; - } - deletePointer( p ); - OR( loc ) - TTYPE( TK_INT ); - if ( node != NULL ) { - breakPoints[breakPointsInx2].base = strdup( node->base ); - breakPoints[breakPointsInx2].line = atoi( token->text ); - rodsLong_t range[2]; - Pointer *p = newPointer2( breakPoints[breakPointsInx2].base ); - if ( getLineRange( p, breakPoints[breakPointsInx2].line, range ) == 0 ) { - breakPoints[breakPointsInx2].start = range[0]; - breakPoints[breakPointsInx2].finish = range[1]; - } - else { - breakPoints[breakPointsInx2].actionName = NULL; - } - deletePointer( p ); - } - else { - breakPoints[breakPointsInx2].actionName = NULL; - } - OR( loc ) - /* breakPoints[breakPointsInx].base = NULL; */ - END_TRY( loc ) - - free( base_ptr ); - if ( breakPoints[breakPointsInx2].actionName != NULL ) - snprintf( mymsg, MAX_NAME_LEN, "Breakpoint %i set at %s\n", breakPointsInx2, - breakPoints[breakPointsInx2].actionName ); - else { - snprintf( mymsg, MAX_NAME_LEN, "Cannot set breakpoint, source not available\n" ); - } - _writeXMsg( streamId, myhdr, mymsg ); - if ( breakPointsInx <= breakPointsInx2 ) { - breakPointsInx = breakPointsInx2 + 1; - } - cmd = REDEBUG_WAIT; - } - OR( Param ) - NEXT_TOKEN_BASIC; - _writeXMsg( streamId, myhdr, "Unknown parameter type.\n" ); - cmd = REDEBUG_WAIT; - OR( Param ) - _writeXMsg( streamId, myhdr, "Debugger command \'break\' requires at least one argument.\n" ); - cmd = REDEBUG_WAIT; - END_TRY( Param ) - - OR( DbgCmd ) - TRY( Where ) - TTEXT2( "w", "where" ); - smallW = 1; - OR( Where ) - TTEXT2( "W", "Where" ); - smallW = 0; - END_TRY( Where ) - wCnt = 20; - OPTIONAL_BEGIN( Param ) - TTYPE( TK_INT ); - wCnt = atoi( token->text ); - OPTIONAL_END( Param ) - iLevel = 0; - - i = reDebugStackCurrPtr - 1; - while ( i >= 0 && wCnt > 0 ) { - if ( !smallW || ( reDebugPCType( ( RuleEngineEvent ) reDebugStackCurr[i].label ) & 1 ) != 0 ) { - snprintf( myhdr, HEADER_TYPE_LEN - 1, "idbug: Level %3i", iLevel ); - char msg[HEADER_TYPE_LEN - 1]; - RuleEngineEventParam param; - param.ruleIndex = 0; - param.actionName = reDebugStackCurr[i].step; - printRuleEngineEventLabel( msg, HEADER_TYPE_LEN - 1, ( RuleEngineEvent ) reDebugStackCurr[i].label, ¶m ); - _writeXMsg( streamId, myhdr, msg ); - if ( reDebugStackCurr[i].label != EXEC_ACTION_BEGIN ) { - iLevel++; - } - wCnt--; - } - i--; - } - OR( DbgCmd ) - TTEXT2( "l", "list" ); - TRY( Param ) - TTEXT2( "r", "rule" ); - TRY( ParamParam ) - TTYPE( TK_TEXT ); - - mymsg[0] = '\n'; - mymsg[1] = '\0'; - snprintf( myhdr, HEADER_TYPE_LEN - 1, "idbug: Listing %s", token->text ); - RuleIndexListNode *node; - found = 0; - while ( findNextRule2( token->text, ruleInx, &node ) != NO_MORE_RULES_ERR ) { - found = 1; - if ( node->secondaryIndex ) { - n = node->condIndex->valIndex->len; - int i; - for ( i = 0; i < n; i++ ) { - Bucket *b = node->condIndex->valIndex->buckets[i]; - while ( b != NULL ) { - RuleDesc *rd = getRuleDesc( *( int * )b->value ); - char buf[MAX_RULE_LEN]; - ruleToString( buf, MAX_RULE_LEN, rd ); - snprintf( mymsg + strlen( mymsg ), MAX_NAME_LEN - strlen( mymsg ), "%i: %s\n%s\n", node->ruleIndex, rd->node->base[0] == 's' ? "" : rd->node->base + 1, buf ); - b = b->next; - } - } - } - else { - RuleDesc *rd = getRuleDesc( node->ruleIndex ); - char buf[MAX_RULE_LEN]; - ruleToString( buf, MAX_RULE_LEN, rd ); - snprintf( mymsg + strlen( mymsg ), MAX_NAME_LEN - strlen( mymsg ), "\n %i: %s\n%s\n", node->ruleIndex, rd->node->base[0] == 's' ? "" : rd->node->base + 1, buf ); - } - ruleInx ++; - } - if ( !found ) { - snprintf( mymsg, MAX_NAME_LEN, "Rule %s not found\n", token->text ); - } - _writeXMsg( streamId, myhdr, mymsg ); - cmd = REDEBUG_WAIT; - OR( ParamParam ) - _writeXMsg( streamId, myhdr, "Debugger command \'list rule\' requires one argument.\n" ); - cmd = REDEBUG_WAIT; - END_TRY( ParamParam ) - OR( Param ) - TTEXT2( "b", "breakpoints" ); - snprintf( myhdr, HEADER_TYPE_LEN - 1, "idbug: Listing %s", token->text ); - mymsg[0] = '\n'; - mymsg[1] = '\0'; - for ( i = 0; i < breakPointsInx; i++ ) { - if ( breakPoints[i].actionName != NULL ) { - if ( breakPoints[i].base != NULL ) { - snprintf( mymsg + strlen( mymsg ), MAX_NAME_LEN - strlen( mymsg ), "Breaking at BreakPoint %i:%s %s:%d\n", i , breakPoints[i].actionName, breakPoints[i].base[0] == 's' ? "" : breakPoints[i].base + 1, breakPoints[i].line ); - } - else { - snprintf( mymsg + strlen( mymsg ), MAX_NAME_LEN - strlen( mymsg ), "Breaking at BreakPoint %i:%s\n", i , breakPoints[i].actionName ); - } - } - } - _writeXMsg( streamId, myhdr, mymsg ); - cmd = REDEBUG_WAIT; - OR( Param ) - TTEXT( "*" ); - snprintf( myhdr, HEADER_TYPE_LEN - 1, "idbug: Listing %s", token->text ); - Env *cenv = env; - mymsg[0] = '\n'; - mymsg[1] = '\0'; - found = 0; - while ( cenv != NULL ) { - n = cenv->current->size; - for ( i = 0; i < n; i++ ) { - Bucket *b = cenv->current->buckets[i]; - while ( b != NULL ) { - if ( b->key[0] == '*' ) { /* skip none * variables */ - found = 1; - char typeString[128]; - typeToString( ( ( Res * )b->value )->exprType, NULL, typeString, 128 ); - snprintf( mymsg + strlen( mymsg ), MAX_NAME_LEN - strlen( mymsg ), "%s of type %s\n", b->key, typeString ); - } - b = b->next; - } - } - cenv = cenv->previous; - } - if ( !found ) { - snprintf( mymsg + strlen( mymsg ), MAX_NAME_LEN - strlen( mymsg ), "\n" ); - } - _writeXMsg( streamId, myhdr, mymsg ); - cmd = REDEBUG_WAIT; - OR( Param ) - syncTokenQueue( e, context ); - skipWhitespace( e ); - ABORT( lookAhead( e, 0 ) != '$' ); - snprintf( myhdr, HEADER_TYPE_LEN - 1, "idbug: Listing %s", token->text ); - mymsg[0] = '\n'; - mymsg[1] = '\0'; - Hashtable *vars = newHashTable( 100 ); - for ( i = 0; i < coreRuleVarDef .MaxNumOfDVars; i++ ) { - if ( lookupFromHashTable( vars, coreRuleVarDef.varName[i] ) == NULL ) { - snprintf( &mymsg[strlen( mymsg )], MAX_NAME_LEN - strlen( mymsg ), "$%s\n", coreRuleVarDef.varName[i] ); - insertIntoHashTable( vars, coreRuleVarDef.varName[i], coreRuleVarDef.varName[i] ); - } - } - deleteHashTable( vars, NULL ); - _writeXMsg( streamId, myhdr, mymsg ); - cmd = REDEBUG_WAIT; - OR( Param ) - NEXT_TOKEN_BASIC; - _writeXMsg( streamId, myhdr, "Unknown parameter type.\n" ); - cmd = REDEBUG_WAIT; - OR( Param ) - _writeXMsg( streamId, myhdr, "Debugger command \'list\' requires at least one argument.\n" ); - cmd = REDEBUG_WAIT; - END_TRY( Param ) - OR( DbgCmd ) - TTEXT2( "c", "continue" ); - cmd = REDEBUG_STEP_CONTINUE; - OR( DbgCmd ) - TTEXT2( "C", "Continue" ); - cmd = REDEBUG_CONTINUE_VERBOSE; - OR( DbgCmd ) - TTEXT2( "del", "delete" ); - TRY( Param ) - TTYPE( TK_INT ); - n = atoi( token->text ); - if ( breakPoints[n].actionName != NULL ) { - free( breakPoints[n].actionName ); - if ( breakPoints[n].base != NULL ) { - free( breakPoints[n].base ); - } - breakPoints[n].actionName = NULL; - breakPoints[n].base = NULL; - snprintf( mymsg, MAX_NAME_LEN, "Breakpoint %i deleted\n", n ); - } - else { - snprintf( mymsg, MAX_NAME_LEN, "Breakpoint %i has not been defined\n", n ); - } - _writeXMsg( streamId, myhdr, mymsg ); - cmd = REDEBUG_WAIT; - OR( Param ) - _writeXMsg( streamId, myhdr, "Debugger command \'delete\' requires one argument.\n" ); - cmd = REDEBUG_WAIT; - END_TRY( Param ) - OR( DbgCmd ) - TTEXT2( "p", "print" ); - Node *n = parseTermRuleGen( e, 1, context ); - if ( getNodeType( n ) == N_ERROR ) { - errMsgToString( context->errmsg, mymsg + strlen( mymsg ), MAX_NAME_LEN - strlen( mymsg ) ); - } - else { - snprintf( myhdr, HEADER_TYPE_LEN - 1, "idbug: Printing " ); - char * ptr = myhdr + strlen( myhdr ); - i = HEADER_TYPE_LEN - 1 - strlen( myhdr ); - termToString( &ptr, &i, 0, MIN_PREC, n, 0 ); - snprintf( ptr, i, "\n" ); - if ( env != NULL ) { - disableReDebugger( grdf ); - res = computeNode( n, NULL, regionRegionCpEnv( env, r, ( RegionRegionCopyFuncType * ) regionRegionCpNode ), rei, 0, &errmsg, r ); - enableReDebugger( grdf ); - outStr = convertResToString( res ); - snprintf( mymsg, MAX_NAME_LEN, "%s\n", outStr ); - free( outStr ); - if ( getNodeType( res ) == N_ERROR ) { - errMsgToString( &errmsg, mymsg + strlen( mymsg ), MAX_NAME_LEN - strlen( mymsg ) ); - } - } - else { - snprintf( mymsg, MAX_NAME_LEN, "Runtime environment: \n" ); - } - } - _writeXMsg( streamId, myhdr, mymsg ); - - cmd = REDEBUG_WAIT; - OR( DbgCmd ) - TTEXT2( "d", "discontinue" ); - cmd = REDEBUG_WAIT; - OR( DbgCmd ) - snprintf( mymsg, MAX_NAME_LEN, "Unknown Action: %s", readmsg ); - _writeXMsg( streamId, myhdr, mymsg ); - cmd = REDEBUG_WAIT; - END_TRY( DbgCmd ) - PARSER_END( DbgCmd ) - freeRErrorContent( &errmsg ); - region_free( r ); - deletePointer( e ); - free( context ); - return cmd; -} - int processBreakPoint( int streamId, RuleEngineEventParam *param, Node *node, int curStat ) { @@ -481,9 +85,7 @@ processBreakPoint( int streamId, RuleEngineEventParam *param, snprintf( buf, MAX_NAME_LEN, "Breaking at BreakPoint %i:%s\n", i , breakPoints[i].actionName ); char mymsg[MAX_NAME_LEN]; generateErrMsg( buf, node->expr, node->base, mymsg ); - _writeXMsg( streamId, myhdr, mymsg ); snprintf( mymsg, MAX_NAME_LEN, "%s\n", param->actionName ); - _writeXMsg( streamId, myhdr, mymsg ); return REDEBUG_WAIT; } } @@ -541,10 +143,6 @@ pushReStack( RuleEngineEvent label, char* step ) { } -int sendWaitXMsg( int streamId ) { - _writeXMsg( streamId, waitHdr, waitMsg ); - return 0; -} int cleanUpDebug() { int i; for ( i = 0 ; i < REDEBUG_STACK_SIZE_CURR; i++ ) { @@ -643,15 +241,8 @@ reDebug( RuleEngineEvent label, int flag, RuleEngineEventParam *param, Node *nod if ( ruleEngineConfig.logging == 0 ) { return 0; } - int i, m, s, status, sleepT, j; - int processedBreakPoint = 0; + int sleepT, j; char hdr[HEADER_TYPE_LEN]; - char *readhdr = NULL; - char *readmsg = NULL; - char *user = NULL; - char *addr = NULL; - static int mNum = 0; - static int sNum = 0; static int curStat = 0; static int reDebugStackPtr = -1; static int reDebugStopAt = 1; @@ -661,7 +252,6 @@ reDebug( RuleEngineEvent label, int flag, RuleEngineEventParam *param, Node *nod char seActionStr[10 * MAX_NAME_LEN + 100]; char timestamp[TIME_LEN]; rsComm_t *svrComm; - int waitCnt = 0; sleepT = 1; char buf[HEADER_TYPE_LEN - 1]; @@ -711,15 +301,6 @@ reDebug( RuleEngineEvent label, int flag, RuleEngineEventParam *param, Node *nod } } - /* Write audit trail */ - if ( GlobalREAuditFlag == 3 ) { - i = _writeXMsg( GlobalREAuditFlag, hdr, seActionStr ); - if ( i < 0 ) { - irods::log( ERROR( i, "_writeXMsg failed." ) ); - } - } - - /* Send current position for debugging */ if ( GlobalREDebugFlag > 5 ) { /* modify stack */ @@ -736,106 +317,8 @@ reDebug( RuleEngineEvent label, int flag, RuleEngineEventParam *param, Node *nod } if ( curStat != REDEBUG_CONTINUE ) { snprintf( hdr, HEADER_TYPE_LEN - 1, "idbug:%s", param->actionName ); - i = _writeXMsg( GlobalREDebugFlag, hdr, buf ); - if ( i < 0 ) { - irods::log( ERROR( i, "_writeXMsg failed." ) ); - } - } - - while ( GlobalREDebugFlag > 5 ) { - s = sNum; - m = mNum; - /* what should be the condition */ - sprintf( condRead, "(*XSEQNUM >= %d) && (*XADDR != \"%s:%i\") && (*XUSER == \"%s@%s\") && ((*XHDR == \"CMSG:ALL\") %%%% (*XHDR == \"CMSG:%s:%i\"))", - s, myHostName, myPID, svrComm->clientUser.userName, svrComm->clientUser.rodsZone, myHostName, myPID ); - - /* - sprintf(condRead, "(*XSEQNUM >= %d) && ((*XHDR == CMSG:ALL) %%%% (*XHDR == CMSG:%s:%i))", - s, myHostName, getpid()); - */ - status = _readXMsg( GlobalREDebugFlag, condRead, &m, &s, &readhdr, &readmsg, &user, &addr ); - if ( status == SYS_UNMATCHED_XMSG_TICKET ) { - cleanUpDebug(); - return 0; - } - if ( status >= 0 ) { - rodsLog( LOG_NOTICE, "Getting XMsg:%i:%s:%s\n", s, readhdr, readmsg ); - curStat = processXMsg( GlobalREDebugFlag, readmsg, - param, node, env, rei ); - if ( readhdr != NULL ) { - free( readhdr ); - } - if ( readmsg != NULL ) { - free( readmsg ); - } - if ( user != NULL ) { - free( user ); - } - if ( addr != NULL ) { - free( addr ); - } - - mNum = m; - sNum = s + 1; - if ( curStat == REDEBUG_WAIT ) { - sendWaitXMsg( GlobalREDebugFlag ); - } - else if ( curStat == REDEBUG_STEP_OVER ) { - reDebugStackPtr = reDebugStackCurrPtr; - reDebugStopAt = 1; - curStat = REDEBUG_CONTINUE; - break; - } - else if ( curStat == REDEBUG_STEP_OUT ) { - reDebugStackPtr = reDebugStackCurrPtr - 1; - reDebugStopAt = 2; - curStat = REDEBUG_CONTINUE; - break; - } - else if ( curStat == REDEBUG_STEP_CONTINUE ) { - reDebugStackPtr = -1; - curStat = REDEBUG_CONTINUE; - break; - } - else if ( curStat == REDEBUG_NEXT ) { - break; - } - } - else { - if ( !( curStat == REDEBUG_CONTINUE || curStat == REDEBUG_CONTINUE_VERBOSE ) ) { - - /*#if _POSIX_C_SOURCE >= 199309L - struct timespec time = {0, 100000000}, rem; - nanosleep(&time, &rem); - waitCnt+=10; - #else*/ - sleep( sleepT ); - waitCnt += 100; - /*#endif*/ - if ( waitCnt > 6000 ) { - sendWaitXMsg( GlobalREDebugFlag ); - waitCnt = 0; - } - } - } - if ( curStat == REDEBUG_CONTINUE || curStat == REDEBUG_CONTINUE_VERBOSE ) { - if ( processedBreakPoint == 1 ) { - break; - } - curStat = processBreakPoint( GlobalREDebugFlag, - param, node, curStat ); - processedBreakPoint = 1; - if ( curStat == REDEBUG_WAIT ) { - sendWaitXMsg( GlobalREDebugFlag ); - continue; - } - else { - break; - } - } } } - return 0; } diff --git a/plugins/rule_engines/irods_rule_engine_plugin-irods_rule_language/nre.reLib1.cpp b/plugins/rule_engines/irods_rule_engine_plugin-irods_rule_language/nre.reLib1.cpp index e5ea9ea89f..95082c7c49 100644 --- a/plugins/rule_engines/irods_rule_engine_plugin-irods_rule_language/nre.reLib1.cpp +++ b/plugins/rule_engines/irods_rule_engine_plugin-irods_rule_language/nre.reLib1.cpp @@ -1507,10 +1507,3 @@ writeMSrvcsIntoFile( char * inFileName, msrvcStruct_t *myMsrvcStruct, return 0; } -int -finalizeRuleEngine() { - if ( GlobalREDebugFlag > 5 ) { - _writeXMsg( GlobalREDebugFlag, "idbug", "PROCESS END" ); - } - return 0; -} diff --git a/scripts/irods/configuration.py b/scripts/irods/configuration.py index 914c865743..c5d38fc570 100644 --- a/scripts/irods/configuration.py +++ b/scripts/irods/configuration.py @@ -403,10 +403,6 @@ def server_executable(self): def rule_engine_executable(self): return paths.rule_engine_executable() - @property - def xmsg_server_executable(self): - return paths.xmsg_server_executable() - @property def database_schema_update_directory(self): return paths.database_schema_update_directory() diff --git a/scripts/irods/controller.py b/scripts/irods/controller.py index 97afe36a5e..5eee13be17 100644 --- a/scripts/irods/controller.py +++ b/scripts/irods/controller.py @@ -211,8 +211,7 @@ def get_binary_to_pids_dict(self, binaries=None): if binaries is None: binaries = [ self.config.server_executable, - self.config.rule_engine_executable, - self.config.xmsg_server_executable] + self.config.rule_engine_executable] d = {} for b in binaries: pids = lib.get_pids_executing_binary_file(b) diff --git a/scripts/irods/convert_configuration_to_json.py b/scripts/irods/convert_configuration_to_json.py index 2ff578fb73..65dc4b7984 100644 --- a/scripts/irods/convert_configuration_to_json.py +++ b/scripts/irods/convert_configuration_to_json.py @@ -147,8 +147,6 @@ def convert_hostaccesscontrol(): legacy_key_map["irodsUserName"] = "irods_user_name" legacy_key_map["irodsHost"] = "irods_host" legacy_key_map["irodsPort"] = "irods_port" -legacy_key_map["xmsgHost"] = "irods_xmsg_host" -legacy_key_map["xmsgPort"] = "irods_xmsg_port" legacy_key_map["irodsHome"] = "irods_home" legacy_key_map["irodsCwd"] = "irods_cwd" legacy_key_map["irodsAuthScheme"] = "irods_authentication_scheme" @@ -179,7 +177,6 @@ def convert_hostaccesscontrol(): # integer list should_be_integers.append('irods_port') -should_be_integers.append('irods_xmsg_port') should_be_integers.append('irods_encryption_key_size') should_be_integers.append('irods_encryption_salt_size') should_be_integers.append('irods_encryption_num_hash_rounds') @@ -234,7 +231,7 @@ def convert_irodsenv(): new_value = int(new_value) container_name[new_key] = new_value # sniff the environment variables, and use them if defined (they take priority) - for x in ['irodsUserName', 'irodsHost', 'irodsPort', 'xmsgHost', 'xmsgPort', 'irodsHome', + for x in ['irodsUserName', 'irodsHost', 'irodsPort', 'irodsHome', 'irodsCwd', 'irodsAuthScheme', 'irodsDefResource', 'irodsZone', 'irodsServerDn', 'irodsLogLevel', 'irodsAuthFileName', 'irodsDebug', 'irodsClientServerPolicy', 'irodsClientServerNegotiation', 'irodsEncryptionKeySize', 'irodsEncryptionSaltSize', 'irodsEncryptionNumHashRounds', 'irodsEncryptionAlgorithm', 'irodsDefaultHashScheme', diff --git a/scripts/irods/paths.py b/scripts/irods/paths.py index 921229c646..9da882fcc9 100644 --- a/scripts/irods/paths.py +++ b/scripts/irods/paths.py @@ -132,11 +132,6 @@ def rule_engine_executable(): server_bin_directory(), 'irodsReServer') -def xmsg_server_executable(): - return os.path.join( - server_bin_directory(), - 'irodsXmsgServer') - def service_account_file_path(): return os.path.join(config_directory(), 'service_account.config') diff --git a/scripts/irods/test/test_all_rules.py b/scripts/irods/test/test_all_rules.py index bc80139612..f7c8d88d88 100644 --- a/scripts/irods/test/test_all_rules.py +++ b/scripts/irods/test/test_all_rules.py @@ -256,22 +256,6 @@ def filter_rulefiles(rulefile): # print("skipping " + rulefile + " ----- ERA") return False - # XMSG - names_to_skip = [ - "rulemsiCreateXmsgInp", - "rulemsiRcvXmsg", - "rulemsiSendXmsg", - "rulemsiXmsgCreateStream", - "rulemsiXmsgServerConnect", - "rulemsiXmsgServerDisConnect", - "rulereadXMsg", - "rulewriteXMsg", - ] - for n in names_to_skip: - if n in rulefile: - # print("skipping " + rulefile + " ----- XMSG") - return False - # FTP names_to_skip = [ "rulemsiFtpGet", diff --git a/scripts/irods/test/test_xmsg.py b/scripts/irods/test/test_xmsg.py deleted file mode 100644 index dc306d6ff0..0000000000 --- a/scripts/irods/test/test_xmsg.py +++ /dev/null @@ -1,65 +0,0 @@ -from __future__ import print_function -import shutil -import sys -import os -import subprocess -import json -if sys.version_info >= (2, 7): - import unittest -else: - import unittest2 as unittest - -from .. import test -from . import settings -from .. import lib -from ..configuration import IrodsConfig -from ..controller import IrodsController - - -class Test_Xmsg(unittest.TestCase): - serverConfigFile = IrodsConfig().server_config_path - serverConfigFileBackup = serverConfigFile + '_orig' - xmsgHost = 'localhost' - xmsgPort = 1279 - - def setUp(self): - # add Xmsg settings to server_config.json - shutil.copyfile(self.serverConfigFile, self.serverConfigFileBackup) - contents = IrodsConfig().server_config - update = { - 'xmsg_host': self.xmsgHost, - 'xmsg_port': self.xmsgPort, - } - lib.update_json_file_from_dict(self.serverConfigFile, update) - - # apparently needed by the server too... - my_env = os.environ.copy() - my_env['XMSG_HOST'] = self.xmsgHost - my_env['XMSG_PORT'] = str(self.xmsgPort) - - IrodsController(IrodsConfig(injected_environment=my_env)).restart() - - def tearDown(self): - shutil.move(self.serverConfigFileBackup, self.serverConfigFile) - IrodsController().restart() - - @unittest.skipIf(test.settings.TOPOLOGY_FROM_RESOURCE_SERVER or test.settings.USE_SSL, "Skip for topology testing from resource server or SSL") - def test_send_and_receive_one_xmsg(self): - message = 'Hello World!' - - # set up Xmsg in client environment - my_env = os.environ.copy() - my_env['XMSG_HOST'] = self.xmsgHost - my_env['XMSG_PORT'] = str(self.xmsgPort) - - # send msg - args = ['ixmsg', 's', '-M "{0}"'.format(message)] - subprocess.Popen(args, env=my_env).communicate() - - # receive msg - args = ['ixmsg', 'r', '-n 1'] - res = subprocess.Popen(args, env=my_env, stdout=subprocess.PIPE).communicate() - - # assertion - print('looking for "{0}" in "{1}"'.format(message, res[0].rstrip())) - assert res[0].decode().find(message) >= 0 diff --git a/scripts/irods/upgrade_configuration.py b/scripts/irods/upgrade_configuration.py index 63fd677337..a150e672fb 100644 --- a/scripts/irods/upgrade_configuration.py +++ b/scripts/irods/upgrade_configuration.py @@ -273,7 +273,6 @@ def convert_legacy_configuration_to_json(irods_config): "server_control_plane_timeout_milliseconds": 10000, "server_port_range_end": legacy_irods_config.get('$SVR_PORT_RANGE_END', 20199), "server_port_range_start": legacy_irods_config.get('$SVR_PORT_RANGE_START', 20000), - "xmsg_port": 1279, "zone_auth_scheme": "native", "zone_key": legacy_server_config.get('LocalZoneSID', "TEMPORARY_zone_key"), "zone_name": legacy_irods_environment.get('irodsZone', 'tempZone'), @@ -356,8 +355,6 @@ def convert_legacy_configuration_to_json(irods_config): #optional irods environment keys for old_key, new_key_and_type in { - "xmsgHost": ("irods_xmsg_host", str), - "xmsgPort": ("irods_xmsg_port", int), "irodsAuthScheme": ("irods_authentication_scheme", str), "irodsServerDn": ("irods_gsi_server_dn", str), "irodsLogLevel": ("irods_log_level", str), diff --git a/server/api/include/rsGetXmsgTicket.hpp b/server/api/include/rsGetXmsgTicket.hpp deleted file mode 100644 index cee0c9b6db..0000000000 --- a/server/api/include/rsGetXmsgTicket.hpp +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef RS_GET_XMSG_TICKET_HPP -#define RS_GET_XMSG_TICKET_HPP - -#include "rodsConnect.h" -#include "rodsXmsg.h" - -int rsGetXmsgTicket( rsComm_t *rsComm, getXmsgTicketInp_t *getXmsgTicketInp, xmsgTicketInfo_t **outXmsgTicketInfo ); - -#endif diff --git a/server/api/include/rsRcvXmsg.hpp b/server/api/include/rsRcvXmsg.hpp deleted file mode 100644 index c17407339f..0000000000 --- a/server/api/include/rsRcvXmsg.hpp +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef RS_RCV_XMSG_HPP -#define RS_RCV_XMSG_HPP - -#include "rcConnect.h" -#include "rodsXmsg.h" - -int rsRcvXmsg( rsComm_t *rsComm, rcvXmsgInp_t *rcvXmsgInp, rcvXmsgOut_t **rcvXmsgOut ); - -#endif diff --git a/server/api/include/rsSendXmsg.hpp b/server/api/include/rsSendXmsg.hpp deleted file mode 100644 index f5b498b46e..0000000000 --- a/server/api/include/rsSendXmsg.hpp +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef RS_SEND_XMSG_HPP -#define RS_SEND_XMSG_HPP - -#include "rcConnect.h" -#include "rodsXmsg.h" - -int rsSendXmsg( rsComm_t *rsComm, sendXmsgInp_t *sendXmsgInp ); - -#endif diff --git a/server/api/src/rsGetXmsgTicket.cpp b/server/api/src/rsGetXmsgTicket.cpp deleted file mode 100644 index d783b10ecb..0000000000 --- a/server/api/src/rsGetXmsgTicket.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/*** Copyright (c), The Regents of the University of California *** - *** For more information please refer to files in the COPYRIGHT directory ***/ -/* getXmsgTicket.c - */ - -#include "rcMisc.h" -#include "getXmsgTicket.h" -#include "xmsgLib.hpp" -#include "irods_random.hpp" -#include "rsGetXmsgTicket.hpp" - -extern ticketHashQue_t XmsgHashQue[]; - -int -rsGetXmsgTicket( rsComm_t*, getXmsgTicketInp_t *getXmsgTicketInp, - xmsgTicketInfo_t **outXmsgTicketInfo ) { - int status; - int hashSlotNum; - time_t thisTime; - time_t inpExpireTime; - - *outXmsgTicketInfo = ( xmsgTicketInfo_t* )calloc( 1, sizeof( xmsgTicketInfo_t ) ); - - /** (*outXmsgTicketInfo)->sendTicket = random(); **/ - thisTime = time( NULL ); - inpExpireTime = getXmsgTicketInp->expireTime; - if ( inpExpireTime > 0 ) { - if ( inpExpireTime - thisTime > MAX_EXPIRE_INT ) { - ( *outXmsgTicketInfo )->expireTime = thisTime + MAX_EXPIRE_INT; - } - else if ( inpExpireTime - thisTime <= 0 ) { - ( *outXmsgTicketInfo )->expireTime = thisTime + DEF_EXPIRE_INT; - } - else { - ( *outXmsgTicketInfo )->expireTime = inpExpireTime; - } - } - else { - ( *outXmsgTicketInfo )->expireTime = thisTime + DEF_EXPIRE_INT; - } - ( *outXmsgTicketInfo )->flag = getXmsgTicketInp->flag; - while ( 1 ) { - ( *outXmsgTicketInfo )->rcvTicket = irods::getRandom(); - ( *outXmsgTicketInfo )->sendTicket = ( *outXmsgTicketInfo )->rcvTicket; - hashSlotNum = ticketHashFunc( ( *outXmsgTicketInfo )->rcvTicket ); - status = addTicketToHQue( - *outXmsgTicketInfo, &XmsgHashQue[hashSlotNum] ); - if ( status != SYS_DUPLICATE_XMSG_TICKET ) { - break; - } - } - - if ( status < 0 ) { - free( *outXmsgTicketInfo ); - *outXmsgTicketInfo = NULL; - } - - return status; -} diff --git a/server/api/src/rsRcvXmsg.cpp b/server/api/src/rsRcvXmsg.cpp deleted file mode 100644 index 06edb248fe..0000000000 --- a/server/api/src/rsRcvXmsg.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/*** Copyright (c), The Regents of the University of California *** - *** For more information please refer to files in the COPYRIGHT directory ***/ -/* rcvXmsg.c - */ - -#include "rcvXmsg.h" -#include "xmsgLib.hpp" -#include "rsRcvXmsg.hpp" - -extern ticketHashQue_t XmsgHashQue[]; -extern xmsgQue_t XmsgQue; - -int -rsRcvXmsg( rsComm_t*, rcvXmsgInp_t *rcvXmsgInp, - rcvXmsgOut_t **rcvXmsgOut ) { - int status; - irodsXmsg_t *irodsXmsg = NULL; - /* - status = getIrodsXmsgByMsgNum (rcvXmsgInp->rcvTicket, - rcvXmsgInp->msgNumber, &irodsXmsg); - */ - status = getIrodsXmsg( rcvXmsgInp, &irodsXmsg ); - - if ( status < 0 ) { - return status; - } - - /* get the msg */ - - *rcvXmsgOut = ( rcvXmsgOut_t* )calloc( 1, sizeof( rcvXmsgOut_t ) ); - - status = _rsRcvXmsg( irodsXmsg, *rcvXmsgOut ); - - return status; -} diff --git a/server/api/src/rsSendXmsg.cpp b/server/api/src/rsSendXmsg.cpp deleted file mode 100644 index 14fe0126cc..0000000000 --- a/server/api/src/rsSendXmsg.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/*** Copyright (c), The Regents of the University of California *** - *** For more information please refer to files in the COPYRIGHT directory ***/ -/* rsSendXmsg.cpp - */ - -#include "rcMisc.h" -#include "sendXmsg.h" -#include "xmsgLib.hpp" -#include "rsSendXmsg.hpp" - -extern ticketHashQue_t XmsgHashQue[]; -extern xmsgQue_t XmsgQue; - -int -rsSendXmsg( rsComm_t *rsComm, sendXmsgInp_t *sendXmsgInp ) { - int status, i; - ticketMsgStruct_t *ticketMsgStruct = NULL; - irodsXmsg_t *irodsXmsg; - char *miscInfo; - - status = getTicketMsgStructByTicket( sendXmsgInp->ticket.rcvTicket, - &ticketMsgStruct ); - - if ( status < 0 || NULL == ticketMsgStruct ) { // JMC cppcheck - nullptr - clearSendXmsgInfo( &sendXmsgInp->sendXmsgInfo ); - return status; - } - - /* match sendTicket */ - if ( ticketMsgStruct->ticket.sendTicket != sendXmsgInp->ticket.sendTicket ) { - /* unmatched sendTicket */ - rodsLog( LOG_ERROR, - "rsSendXmsg: sendTicket mismatch, input %d, in cache %d", - sendXmsgInp->ticket.sendTicket, ticketMsgStruct->ticket.sendTicket ); - return SYS_UNMATCHED_XMSG_TICKET; - } - - /* dropping and clearing a messageStream */ - miscInfo = sendXmsgInp->sendXmsgInfo.miscInfo; - if ( miscInfo != NULL && strlen( miscInfo ) > 0 ) { - if ( !strcmp( miscInfo, "CLEAR_STREAM" ) ) { - i = clearAllXMessages( ticketMsgStruct ); - return i; - } - else if ( !strcmp( miscInfo, "DROP_STREAM" ) ) { - if ( sendXmsgInp->ticket.rcvTicket > 5 ) { - i = clearAllXMessages( ticketMsgStruct ); - if ( i < 0 ) { - return i; - } - i = rmTicketMsgStructFromHQue( ticketMsgStruct, - ( ticketHashQue_t * ) ticketMsgStruct->ticketHashQue ); - return i; - } - } - else if ( !strcmp( miscInfo, "ERASE_MESSAGE" ) ) { - /* msgNumber actually is the sequence Number in the queue*/ - i = clearOneXMessage( ticketMsgStruct, sendXmsgInp->sendXmsgInfo.msgNumber ); - return i; - } - } - - /* create a irodsXmsg_t */ - - irodsXmsg = ( irodsXmsg_t* )calloc( 1, sizeof( irodsXmsg_t ) ); - irodsXmsg->sendXmsgInfo = ( sendXmsgInfo_t* )calloc( 1, sizeof( sendXmsgInfo_t ) ); - *irodsXmsg->sendXmsgInfo = sendXmsgInp->sendXmsgInfo; - irodsXmsg->sendTime = time( 0 ); - snprintf( irodsXmsg->sendUserName, NAME_LEN, "%s@%s", rsComm->clientUser.userName, rsComm->clientUser.rodsZone ); - rstrcpy( irodsXmsg->sendAddr, sendXmsgInp->sendAddr, NAME_LEN ); - status = addXmsgToQues( irodsXmsg, ticketMsgStruct ); - return status; -} diff --git a/server/core/include/irodsXmsgServer.hpp b/server/core/include/irodsXmsgServer.hpp deleted file mode 100644 index 2ed2ddfbb2..0000000000 --- a/server/core/include/irodsXmsgServer.hpp +++ /dev/null @@ -1,26 +0,0 @@ -/*** Copyright (c), The Regents of the University of California *** - *** For more information please refer to files in the COPYRIGHT directory ***/ - -/* irodsXmsgServer.h - header file for irodsXmsgServer - */ - - - -#ifndef XMSG_SERVER_HPP -#define XMSG_SERVER_HPP - -#include "rods.h" -#include "rsGlobalExtern.hpp" /* server global */ -#include "rcGlobalExtern.h" /* client global */ -#include "rsLog.hpp" -#include "rodsLog.h" -#include "sockComm.h" -#include "getRodsEnv.h" -#include "rcConnect.h" - -#define v_FLAG 0x1 - -int -xmsgServerMain(); -int usage( char *prog ); -#endif /* XMSG_SERVER_H */ diff --git a/server/core/include/irods_api_calling_functions.hpp b/server/core/include/irods_api_calling_functions.hpp index 76906955bd..3a7a5bf3a2 100644 --- a/server/core/include/irods_api_calling_functions.hpp +++ b/server/core/include/irods_api_calling_functions.hpp @@ -800,38 +800,6 @@ int call_subStructFileFdOprInp_rodsDirentOut( #define CALL_SUBSTRUCTFILEFDOPRINP_RODSDIRENTOUT nullptr #endif -#ifdef CREATE_API_TABLE_FOR_SERVER -int call_getXmsgTicketInp_xmsgTicketInfoOut( - irods::api_entry*, - rsComm_t*, - getXmsgTicketInp_t*, - xmsgTicketInfo_t**); -#define CALL_GETXMSGTICKETINP_XMSGTICKETINFOOUT call_getXmsgTicketInp_xmsgTicketInfoOut -#else -#define CALL_GETXMSGTICKETINP_XMSGTICKETINFOOUT nullptr -#endif - -#ifdef CREATE_API_TABLE_FOR_SERVER -int call_sendXmsgInp( - irods::api_entry*, - rsComm_t*, - sendXmsgInp_t*); -#define CALL_SENDXMSGINP call_sendXmsgInp -#else -#define CALL_SENDXMSGINP nullptr -#endif - -#ifdef CREATE_API_TABLE_FOR_SERVER -int call_rcvXmsgInp_rcvXmsgOut( - irods::api_entry*, - rsComm_t*, - rcvXmsgInp_t*, - rcvXmsgOut_t**); -#define CALL_RCVXMSGINP_RCVXMSGOUT call_rcvXmsgInp_rcvXmsgOut -#else -#define CALL_RCVXMSGINP_RCVXMSGOUT nullptr -#endif - #ifdef CREATE_API_TABLE_FOR_SERVER int call_subFileInp_bytesBufOut( irods::api_entry*, diff --git a/server/core/include/irods_api_number_validator.hpp b/server/core/include/irods_api_number_validator.hpp new file mode 100644 index 0000000000..d6b70b6313 --- /dev/null +++ b/server/core/include/irods_api_number_validator.hpp @@ -0,0 +1,12 @@ +#ifndef IRODS_API_NUMBER_VALIDATOR_HPP +#define IRODS_API_NUMBER_VALIDATOR_HPP + +#include + +namespace irods { + +std::tuple is_api_number_supported(int _api_number); + +} // namespace irods + +#endif // IRODS_API_NUMBER_VALIDATOR_HPP diff --git a/server/core/include/rodsConnect.h b/server/core/include/rodsConnect.h index d0a293e15a..ed6b51c933 100644 --- a/server/core/include/rodsConnect.h +++ b/server/core/include/rodsConnect.h @@ -64,7 +64,6 @@ typedef struct rodsServerHost { rcComm_t *conn; int rcatEnabled; int reHostFlag; - int xmsgHostFlag; int localFlag; int status; void *zoneInfo; @@ -136,8 +135,6 @@ resetRcatHost( int rcatType, const char *rcatZoneHint ); int isLocalHost( const char *hostAddr ); int -getXmsgHost( rodsServerHost_t **rodsServerHost ); -int getLocalZoneInfo( zoneInfo_t **outZoneInfo ); char * getLocalZoneName(); diff --git a/server/core/include/rsLog.hpp b/server/core/include/rsLog.hpp index f1effda973..c78d1f7949 100644 --- a/server/core/include/rsLog.hpp +++ b/server/core/include/rsLog.hpp @@ -11,7 +11,6 @@ #define RODS_LOGFILE "rodsLog" #define RODS_SERVER_LOGFILE "rodsServerLog" #define RULE_EXEC_LOGFILE "reLog" -#define XMSG_SVR_LOGFILE "xmsgLog" #define DEF_LOG_DIR "../../var/lib/irods/log" #define PROC_LOG_DIR_NAME "proc" diff --git a/server/core/include/xmsgLib.hpp b/server/core/include/xmsgLib.hpp deleted file mode 100644 index f12a4c3058..0000000000 --- a/server/core/include/xmsgLib.hpp +++ /dev/null @@ -1,75 +0,0 @@ -/*** Copyright (c), The Regents of the University of California *** - *** For more information please refer to files in the COPYRIGHT directory ***/ - -/* xmsgLib.h - header file for xmsgLib - */ - - - -#ifndef XMSG_LIB_HPP -#define XMSG_LIB_HPP - -#include "rods.h" -#include "rsGlobalExtern.hpp" /* server global */ -#include "rcGlobalExtern.h" /* client global */ -#include "rsLog.hpp" -#include "rodsLog.h" -#include "sockComm.h" -#include "getRodsEnv.h" -#include "rcConnect.h" -#include "rodsXmsg.h" - -#define REQ_MSG_TIMEOUT_TIME 5 /* 5 sec timeout for req msg */ - -#define NUM_HASH_SLOT 47 /* number of slots for the ticket -* hash key */ -#define NUM_XMSG_THR 40 /* used to be 10 */ - -int -initThreadEnv(); -int -addXmsgToXmsgQue( irodsXmsg_t *xmsg, xmsgQue_t *xmsgQue ); -int -rmXmsgFromXmsgQue( irodsXmsg_t *xmsg, xmsgQue_t *xmsgQue ); -int -addTicketToHQue( xmsgTicketInfo_t *ticket, ticketHashQue_t *ticketHQue ); -int -addTicketMsgStructToHQue( ticketMsgStruct_t *ticketMsgStruct, - ticketHashQue_t *ticketHQue ); -int -rmTicketMsgStructFromHQue( ticketMsgStruct_t *ticketMsgStruct, - ticketHashQue_t *ticketHQue ); -int -addReqToQue( int sock ); -xmsgReq_t *getReqFromQue(); -int -startXmsgThreads(); -void -procReqRoutine(); -int -ticketHashFunc( uint rcvTicket ); -int -initXmsgHashQue(); -int -getTicketMsgStructByTicket( uint rcvTicket, - ticketMsgStruct_t **outTicketMsgStruct ); -int -addXmsgToTicketMsgStruct( irodsXmsg_t *xmsg, - ticketMsgStruct_t *ticketMsgStruct ); - -int checkMsgCondition( irodsXmsg_t *irodsXmsg, char *msgCond ); - -int getIrodsXmsg( rcvXmsgInp_t *rcvXmsgInp, irodsXmsg_t **outIrodsXmsg ); - -int -getIrodsXmsgByMsgNum( int rcvTicket, int msgNumber, - irodsXmsg_t **outIrodsXmsg ); -int -_rsRcvXmsg( irodsXmsg_t *irodsXmsg, rcvXmsgOut_t *rcvXmsgOut ); - -int clearAllXMessages( ticketMsgStruct_t *ticketMsgStruct ); -int clearOneXMessage( ticketMsgStruct_t *ticketMsgStruct, int seqNum ); - -int addXmsgToQues( irodsXmsg_t *irodsXmsg, ticketMsgStruct_t *ticketMsgStruct ); -#endif /* XMSG_LIB_H */ - diff --git a/server/core/src/initServer.cpp b/server/core/src/initServer.cpp index 9029b72a7c..845b2f665c 100644 --- a/server/core/src/initServer.cpp +++ b/server/core/src/initServer.cpp @@ -217,26 +217,6 @@ initRcatServerHostByFile() { return e.code(); } - // re host - // xmsg host - try { - rodsHostAddr_t addr; - memset( &addr, 0, sizeof( addr ) ); - rodsServerHost_t* tmp_host = 0; - snprintf( addr.hostAddr, sizeof( addr.hostAddr ), "%s", irods::get_server_property(irods::CFG_IRODS_XMSG_HOST_KW).c_str() ); - int rem_flg = resolveHost( - &addr, - &tmp_host ); - if ( rem_flg < 0 ) { - rodsLog( LOG_SYS_FATAL, - "initRcatServerHostByFile: resolveHost error for %s, status = %d", - addr.hostAddr, - rem_flg ); - return rem_flg; - } - tmp_host->xmsgHostFlag = 1; - } catch ( const irods::exception& e ) {} - // slave icat host try { diff --git a/server/core/src/irodsXmsgServer.cpp b/server/core/src/irodsXmsgServer.cpp deleted file mode 100644 index 47022ab7d1..0000000000 --- a/server/core/src/irodsXmsgServer.cpp +++ /dev/null @@ -1,240 +0,0 @@ -/*** Copyright (c), The Regents of the University of California - *** For more information please refer to files in the COPYRIGHT directory ***/ - -/* irodsXmsgServer.cpp - The irods xmsg server */ -#include "reconstants.hpp" -#include "irodsXmsgServer.hpp" -#include "xmsgLib.hpp" -#include "irods_exception.hpp" -#include "irods_server_properties.hpp" -#include "irods_client_server_negotiation.hpp" -#include "irods_network_factory.hpp" -#include "irods_re_plugin.hpp" -#include "irods_signal.hpp" -#include "sockCommNetworkInterface.hpp" -#include "initServer.hpp" -#include "miscServerFunct.hpp" - -int loopCnt = -1; /* make it -1 to run infinitely */ - - -int -main( int argc, char **argv ) { - int c; - int runMode = SERVER; - int flagval = 0; - char *logDir = NULL; - char *tmpStr; - int logFd; - - ProcessType = XMSG_SERVER_PT; - - irods::error ret = setRECacheSaltFromEnv(); - if ( !ret.ok() ) { - rodsLog( LOG_ERROR, "irodsXmsgServer::main: Failed to set RE cache mutex name\n%s", ret.result().c_str() ); - exit( 1 ); - } - - irods::re_plugin_globals.reset(new irods::global_re_plugin_mgr); - - signal( SIGINT, signalExit ); - signal( SIGHUP, signalExit ); - signal( SIGTERM, signalExit ); - signal( SIGUSR1, signalExit ); - signal( SIGPIPE, rsPipeSignalHandler ); - - /* Handle option to log sql commands */ - tmpStr = getenv( SP_LOG_SQL ); - if ( tmpStr != NULL ) { - rodsLogSqlReq( 1 ); - } - - /* Set the logging level */ - tmpStr = getenv( SP_LOG_LEVEL ); - if ( tmpStr != NULL ) { - int i; - i = atoi( tmpStr ); - rodsLogLevel( i ); - } - else { - rodsLogLevel( LOG_NOTICE ); /* default */ - } - - while ( ( c = getopt( argc, argv, "sSc:vD:" ) ) != EOF ) { - switch ( c ) { - case 's': - runMode = SINGLE_PASS; - break; - case 'S': - runMode = STANDALONE_SERVER; - break; - case 'v': /* verbose */ - flagval |= v_FLAG; - break; - case 'c': - loopCnt = atoi( optarg ); - break; - case 'D': /* user specified a log directory */ - logDir = strdup( optarg ); - break; - default: - usage( argv[0] ); - exit( 1 ); - } - } - - if ( ( logFd = logFileOpen( runMode, logDir, XMSG_SVR_LOGFILE ) ) < 0 ) { - exit( 1 ); - } - - daemonize( runMode, logFd ); - - xmsgServerMain(); - sleep( 5 ); - exit( 0 ); -} - -int usage( char *prog ) { - fprintf( stderr, "Usage: %s [-scva] [-D logDir] \n", prog ); - return 0; -} - -int -xmsgServerMain() { - int status = 0; - rsComm_t rsComm; - rsComm_t svrComm; /* rsComm is connection to icat, svrComm is the - * server's listening socket */ - fd_set sockMask; - int numSock; - - initThreadEnv(); - initXmsgHashQue(); - - status = startXmsgThreads(); - - if ( status < 0 ) { - rodsLog( LOG_ERROR, - "xmsgServerMain: startXmsgThreads error. status = %d", status ); - return status; - } - - status = initRsComm( &rsComm ); - - if ( status < 0 ) { - rodsLog( LOG_ERROR, "xmsgServerMain: initRsComm error. status = %d", - status ); - return status; - } - - status = initRsComm( &svrComm ); - - if ( status < 0 ) { - rodsLog( LOG_ERROR, "xmsgServerMain: initRsComm error. status = %d", - status ); - return status; - } - - status = initAgent( RULE_ENGINE_NO_CACHE, &rsComm ); - - if ( status < 0 ) { - rodsLog( LOG_ERROR, "xmsgServerMain: initAgent error. status = %d", - status ); - return status; - } - - - // =-=-=-=-=-=-=- - // handle negotiations with the client regarding TLS if requested - irods::error ret; - - // =-=-=-=-=-=-=- - // manufacture a network object for comms - irods::network_object_ptr net_obj; - ret = irods::network_factory( &rsComm, net_obj ); - if ( !ret.ok() ) { - irods::log( PASS( ret ) ); - } - - std::string neg_results; - ret = irods::client_server_negotiation_for_server( net_obj, neg_results ); - if ( !ret.ok() || neg_results == irods::CS_NEG_FAILURE ) { - irods::log( PASS( ret ) ); - // =-=-=-=-=-=-=- - // send a 'we failed to negotiate' message here?? - // or use the error stack rule engine thingie - irods::log( PASS( ret ) ); - sendVersion( net_obj, SYS_AGENT_INIT_ERR, 0, NULL, 0 ); - cleanupAndExit( ret.code() ); - - } - else { - // =-=-=-=-=-=-=- - // copy negotiation results to comm for action by network objects - snprintf( rsComm.negotiation_results, sizeof( rsComm.negotiation_results ), - "%s", neg_results.c_str() ); - //rsComm.ssl_do_accept = 1; - - } - - /* open a socket and listen for connection */ - try { - int xmsgPort = irods::get_server_property(irods::CFG_XMSG_PORT); - svrComm.sock = sockOpenForInConn( - &svrComm, - &xmsgPort, - NULL, - SOCK_STREAM ); - } catch ( const irods::exception& e ) { - irods::log( irods::error(e) ); - return e.code(); - } - - if ( svrComm.sock < 0 ) { - rodsLog( LOG_NOTICE, "xmsgServerMain: sockOpenForInConn error. status = %d", - svrComm.sock ); - exit( 1 ); - } - - listen( svrComm.sock, MAX_LISTEN_QUE ); - - FD_ZERO( &sockMask ); - - rodsLog( LOG_NOTICE, "xmsgServer version %s is up", RODS_REL_VERSION ); - - while ( 1 ) { /* infinite loop */ - FD_SET( svrComm.sock, &sockMask ); - while ( ( numSock = select( svrComm.sock + 1, &sockMask, - ( fd_set * ) NULL, ( fd_set * ) NULL, ( struct timeval * ) NULL ) ) < 0 ) { - - if ( errno == EINTR ) { - rodsLog( LOG_NOTICE, "xmsgServerMain: select() interrupted" ); - FD_SET( svrComm.sock, &sockMask ); - continue; - } - else { - rodsLog( LOG_NOTICE, "xmsgServerMain: select() error, errno = %d", errno ); - return -1; - } - } - - const int newSock = rsAcceptConn( &svrComm ); - - if ( newSock < 0 ) { - rodsLog( LOG_NOTICE, - "xmsgServerMain: acceptConn () error, errno = %d", errno ); - continue; - } - - addReqToQue( newSock ); - - if ( loopCnt > 0 ) { - loopCnt--; - if ( loopCnt == 0 ) { - return 0; - } - } - - } - return 0; -} diff --git a/server/core/src/irods_api_calling_functions.cpp b/server/core/src/irods_api_calling_functions.cpp index 8e41852642..9c3f39de85 100644 --- a/server/core/src/irods_api_calling_functions.cpp +++ b/server/core/src/irods_api_calling_functions.cpp @@ -866,42 +866,6 @@ int call_subStructFileFdOprInp_rodsDirentOut( _out); } -int call_getXmsgTicketInp_xmsgTicketInfoOut( - irods::api_entry* _api, - rsComm_t* _comm, - getXmsgTicketInp_t* _inp, - xmsgTicketInfo_t** _out ) { - return _api->call_handler< - getXmsgTicketInp_t*, - xmsgTicketInfo_t**>( - _comm, - _inp, - _out); -} - -int call_sendXmsgInp( - irods::api_entry* _api, - rsComm_t* _comm, - sendXmsgInp_t* _inp ) { - return _api->call_handler< - sendXmsgInp_t*>( - _comm, - _inp); -} - -int call_rcvXmsgInp_rcvXmsgOut( - irods::api_entry* _api, - rsComm_t* _comm, - rcvXmsgInp_t* _inp, - rcvXmsgOut_t** _out ) { - return _api->call_handler< - rcvXmsgInp_t*, - rcvXmsgOut_t**>( - _comm, - _inp, - _out); -} - int call_subFileInp_bytesBufOut( irods::api_entry* _api, rsComm_t* _comm, diff --git a/server/core/src/irods_api_number_validator.cpp b/server/core/src/irods_api_number_validator.cpp new file mode 100644 index 0000000000..040457abea --- /dev/null +++ b/server/core/src/irods_api_number_validator.cpp @@ -0,0 +1,20 @@ +#include "irods_api_number_validator.hpp" + +#include "procApiRequest.h" +#include "rodsErrorTable.h" + +#include + +namespace irods { + +std::tuple is_api_number_supported(int _api_number) +{ + if (auto ec = apiTableLookup(_api_number); SYS_UNMATCHED_API_NUM == ec) { + return {false, ec}; + } + + return {true, 0}; +} + +} // namespace irods + diff --git a/server/core/src/irods_server_control_plane.cpp b/server/core/src/irods_server_control_plane.cpp index 7394b329d3..ebe1d2b06d 100644 --- a/server/core/src/irods_server_control_plane.cpp +++ b/server/core/src/irods_server_control_plane.cpp @@ -271,12 +271,6 @@ namespace irods { irods::log( PASS( ret ) ); } - // kill the xmessage server - ret = kill_server( irods::XMSG_PID_KW ); - if ( !ret.ok() ) { - irods::log( PASS( ret ) ); - } - // actually shut down the server svr_state( server_state::STOPPED ); @@ -397,11 +391,6 @@ namespace irods { re_pid = get_server_property(irods::RE_PID_KW); } catch ( const irods::exception& ) {} - int xmsg_pid = 0; - try { - xmsg_pid = get_server_property(irods::XMSG_PID_KW); - } catch ( const irods::exception& ) {} - int my_pid = getpid(); json_t* obj = json_object(); @@ -414,7 +403,6 @@ namespace irods { json_object_set_new( obj, "hostname", json_string( my_env.rodsHost ) ); json_object_set_new( obj, "irods_server_pid", json_integer( my_pid ) ); json_object_set_new( obj, "re_server_pid", json_integer( re_pid ) ); - json_object_set_new( obj, "xmsg_server_pid", json_integer( xmsg_pid ) ); server_state& s = server_state::instance(); json_object_set_new( obj, "status", json_string( s().c_str() ) ); diff --git a/server/core/src/rodsConnect.cpp b/server/core/src/rodsConnect.cpp index b5184dd823..5c9b1ea6e9 100644 --- a/server/core/src/rodsConnect.cpp +++ b/server/core/src/rodsConnect.cpp @@ -642,15 +642,6 @@ printZoneInfo() { exp::log::server::info({{"re_host", "error"}}); } - if ( getXmsgHost( &tmpRodsServerHost ) >= 0 ) { -#ifdef SYSLOG - rodsLog( LOG_NOTICE, "xmsgHost", tmpRodsServerHost->hostName->name ); -#else /* SYSLOG */ - fprintf( stderr, "xmsgHost: %s\n\n", tmpRodsServerHost->hostName->name ); -#endif /* SYSLOG */ - exp::log::server::info({{"xmsg_host", tmpRodsServerHost->hostName->name}}); - } - return 0; } @@ -1042,24 +1033,6 @@ getReHost( rodsServerHost_t **rodsServerHost ) { return status; } -int -getXmsgHost( rodsServerHost_t **rodsServerHost ) { - rodsServerHost_t *tmpRodsServerHost; - - tmpRodsServerHost = ServerHostHead; - while ( tmpRodsServerHost != NULL ) { - if ( tmpRodsServerHost->xmsgHostFlag == 1 ) { - *rodsServerHost = tmpRodsServerHost; - return 0; - } - tmpRodsServerHost = tmpRodsServerHost->next; - } - *rodsServerHost = NULL; - - return SYS_INVALID_SERVER_HOST; -} - - /* getAndConnReHost - Get the irodsReServer host (result given in * rodsServerHost). * If the is remote, it will automatically connect to the server where diff --git a/server/core/src/rodsServer.cpp b/server/core/src/rodsServer.cpp index 0d989a06e7..8c315f5371 100644 --- a/server/core/src/rodsServer.cpp +++ b/server/core/src/rodsServer.cpp @@ -1258,26 +1258,6 @@ initServerMain( rsComm_t *svrComm ) { } } - rodsServerHost_t *xmsgServerHost = NULL; - getXmsgHost( &xmsgServerHost ); - if ( xmsgServerHost != NULL && xmsgServerHost->localFlag == LOCAL_HOST ) { - int xmsg_pid = RODS_FORK(); - if ( 0 == xmsg_pid ) { // child - char *av[NAME_LEN]; - - close( svrComm->sock ); - memset( av, 0, sizeof( av ) ); - rodsLog( LOG_NOTICE, "Starting irodsXmsgServer" ); - av[0] = "irodsXmsgServer"; - execv( av[0], av ); - exit( 1 ); - } - else { - irods::set_server_property( irods::XMSG_PID_KW, xmsg_pid ); - } - - } - return 0; } diff --git a/server/core/src/rsApiHandler.cpp b/server/core/src/rsApiHandler.cpp index ce59ca6b90..7edc75f5a4 100644 --- a/server/core/src/rsApiHandler.cpp +++ b/server/core/src/rsApiHandler.cpp @@ -31,13 +31,25 @@ jmp_buf Jenv; #include "irods_threads.hpp" #include "sockCommNetworkInterface.hpp" #include "irods_hierarchy_parser.hpp" - +#include "irods_api_number_validator.hpp" +#include "irods_logger.hpp" int rsApiHandler( rsComm_t* rsComm, int apiNumber, bytesBuf_t* inputStructBBuf, - bytesBuf_t* bsBBuf ) { + bytesBuf_t* bsBBuf ) +{ + if (auto [supported, ec] = irods::is_api_number_supported(apiNumber); !supported) { + irods::experimental::log::server::error({ + {"msg", "unsupported api number"}, + {"api_number", std::to_string(apiNumber)}, + {"error_code", std::to_string(ec)} + }); + + return ec; + } + int apiInx; int status = 0; char *myInStruct = NULL; @@ -372,30 +384,10 @@ int chkApiPermission( rsComm_t * rsComm, int apiInx ) { int clientUserAuth; int proxyUserAuth; - int xmsgSvrOnly; - int xmsgSvrAlso; irods::api_entry_table& RsApiTable = irods::get_server_api_table(); clientUserAuth = RsApiTable[apiInx]->clientUserAuth; - xmsgSvrOnly = clientUserAuth & XMSG_SVR_ONLY; - xmsgSvrAlso = clientUserAuth & XMSG_SVR_ALSO; - - if ( ProcessType == XMSG_SERVER_PT ) { - if ( ( xmsgSvrOnly + xmsgSvrAlso ) == 0 ) { - rodsLog( LOG_ERROR, - "chkApiPermission: xmsgServer not allowed to handle api %d", - RsApiTable[apiInx]->apiNumber ); - return SYS_NO_API_PRIV; - } - } - else if ( xmsgSvrOnly != 0 ) { - rodsLog( LOG_ERROR, - "chkApiPermission: non xmsgServer not allowed to handle api %d", - RsApiTable[apiInx]->apiNumber ); - return SYS_NO_API_PRIV; - } - clientUserAuth = clientUserAuth & 0xfff; /* take out XMSG_SVR_* flags */ if ( clientUserAuth > rsComm->clientUser.authInfo.authFlag ) { diff --git a/server/core/src/xmsgLib.cpp b/server/core/src/xmsgLib.cpp deleted file mode 100644 index b48cd55079..0000000000 --- a/server/core/src/xmsgLib.cpp +++ /dev/null @@ -1,756 +0,0 @@ -/*** Copyright (c), The Regents of the University of California *** - *** For more information please refer to files in the COPYRIGHT directory ***/ - -/* xmsgLib.c - library routines for irodsXmsg - */ - -// =-=-=-=-=-=-=- -// boost includes -#include -#include -#include - -// =-=-=-=-=-=-=- -// irods includes -#include "rsApiHandler.hpp" -//#include "reGlobalsExtern.hpp" -#include "miscServerFunct.hpp" -#include "xmsgLib.hpp" -//#include "reFuncDefs.hpp" -#include "irods_network_factory.hpp" -#include "initServer.hpp" - -#include "sockCommNetworkInterface.hpp" - -static boost::mutex ReqQueCondMutex; -static boost::mutex MessQueCondMutex; -static boost::thread* ProcReqThread[ NUM_XMSG_THR ]; -static boost::condition_variable ReqQueCond; - -static xmsgQue_t XmsgQue; -static xmsgReq_t* XmsgReqHead = NULL; -static xmsgReq_t* XmsgReqTail = NULL; /* points to last item in queue */ -static msParamArray_t XMsgMsParamArray; - -// =-=-=-=-=-=-=- -// globally referenced variable -ticketHashQue_t XmsgHashQue[NUM_HASH_SLOT]; - - - -int -initThreadEnv() { - return 0; -} - - -int -addXmsgToQues( irodsXmsg_t *irodsXmsg, ticketMsgStruct_t *ticketMsgStruct ) { - - - MessQueCondMutex.lock(); - - addXmsgToXmsgQue( irodsXmsg, &XmsgQue ); - int status = addXmsgToTicketMsgStruct( irodsXmsg, ticketMsgStruct ); - - MessQueCondMutex.unlock(); - - return status; - -} - -int -addXmsgToXmsgQue( irodsXmsg_t *xmsg, xmsgQue_t *xmsgQue ) { - - if ( xmsg == NULL || xmsgQue == NULL ) { - rodsLog( LOG_ERROR, - "addXmsgToQue: input xmsg or xmsgQue is NULL" ); - return SYS_INTERNAL_NULL_INPUT_ERR; - } - - xmsg->next = xmsg->prev = NULL; - - if ( xmsgQue->head == NULL ) { - xmsgQue->head = xmsgQue->tail = xmsg; - } - else { - /* que it on top */ - xmsgQue->head->prev = xmsg; - xmsg->next = xmsgQue->head; - xmsgQue->head = xmsg; - } - - return 0; -} - -int -rmXmsgFromXmsgQue( irodsXmsg_t *xmsg, xmsgQue_t *xmsgQue ) { - if ( xmsg == NULL || xmsgQue == NULL ) { - rodsLog( LOG_ERROR, - "addXmsgToQue: input xmsg or xmsgQue is NULL" ); - return SYS_INTERNAL_NULL_INPUT_ERR; - } - - if ( xmsg->prev == NULL ) { - /* at head */ - xmsgQue->head = xmsg->next; - } - else { - xmsg->prev->next = xmsg->next; - } - - if ( xmsg->next == NULL ) { - /* at tail */ - xmsgQue->tail = xmsg->prev; - } - else { - xmsg->next->prev = xmsg->prev; - } - - xmsg->prev = xmsg->next = NULL; - - return 0; -} - -int -rmXmsgFromXmsgTcketQue( irodsXmsg_t *xmsg, xmsgQue_t *xmsgQue ) { - if ( xmsg == NULL || xmsgQue == NULL ) { - rodsLog( LOG_ERROR, - "addXmsgToQue: input xmsg or xmsgQue is NULL" ); - return SYS_INTERNAL_NULL_INPUT_ERR; - } - - if ( xmsg->tprev == NULL ) { - /* at head */ - xmsgQue->head = xmsg->tnext; - } - else { - xmsg->tprev->tnext = xmsg->tnext; - } - - if ( xmsg->tnext == NULL ) { - /* at tail */ - xmsgQue->tail = xmsg->tprev; - } - else { - xmsg->tnext->tprev = xmsg->tprev; - } - - xmsg->tprev = xmsg->tnext = NULL; - - return 0; -} - -int -addXmsgToTicketMsgStruct( irodsXmsg_t *xmsg, - ticketMsgStruct_t *ticketMsgStruct ) { - if ( xmsg == NULL || ticketMsgStruct == NULL ) { - rodsLog( LOG_ERROR, - "addXmsgToTicketMsgStruct: input xmsg or ticketMsgStruct is NULL" ); - return SYS_INTERNAL_NULL_INPUT_ERR; - } - - /* up the expire time */ - if ( xmsg->sendTime + INC_EXPIRE_INT > ticketMsgStruct->ticket.expireTime ) { - ticketMsgStruct->ticket.expireTime = xmsg->sendTime + INC_EXPIRE_INT; - } - - if ( ticketMsgStruct->xmsgQue.head == NULL ) { - ticketMsgStruct->xmsgQue.head = ticketMsgStruct->xmsgQue.tail = xmsg; - xmsg->tnext = xmsg->tprev = NULL; - } - else { - /* link it to the end */ - ticketMsgStruct->xmsgQue.tail->tnext = xmsg; - xmsg->tprev = ticketMsgStruct->xmsgQue.tail; - ticketMsgStruct->xmsgQue.tail = xmsg; - xmsg->tnext = NULL; - } - xmsg->ticketMsgStruct = ticketMsgStruct; - xmsg->seqNumber = ticketMsgStruct->nxtSeqNumber; - ticketMsgStruct->nxtSeqNumber = ticketMsgStruct->nxtSeqNumber + 1; - - return xmsg->seqNumber; -} - -int checkMsgCondition( irodsXmsg_t *irodsXmsg, char *msgCond ) { - char condStr[MAX_NAME_LEN * 2];//, res[MAX_NAME_LEN * 2]; - - if ( msgCond == NULL || strlen( msgCond ) == 0 ) { - return 0; - } - - strcpy( condStr, msgCond ); - - XMsgMsParamArray.msParam[0]->inOutStruct = ( char * ) irodsXmsg->sendXmsgInfo->msgType; /* *XHDR*/ - XMsgMsParamArray.msParam[1]->inOutStruct = ( char * ) irodsXmsg->sendUserName; /* *XUSER*/ - XMsgMsParamArray.msParam[2]->inOutStruct = ( char * ) irodsXmsg->sendAddr; /* *XADDR*/ - XMsgMsParamArray.msParam[3]->inOutStruct = ( char * ) irodsXmsg->sendXmsgInfo->miscInfo; /* *XMISC*/ - * ( int * ) XMsgMsParamArray.msParam[4]->inOutStruct = ( int ) irodsXmsg->sendXmsgInfo->msgNumber; /* *XMSGNUM*/ - * ( int * ) XMsgMsParamArray.msParam[5]->inOutStruct = ( int ) irodsXmsg->seqNumber; /* *XSEQNUM*/ - * ( int * ) XMsgMsParamArray.msParam[6]->inOutStruct = ( int ) irodsXmsg->sendTime; /* *XTIME*/ - - if ( strcmp( condStr, "" ) == 0 ) { - return 0; - } - //int ret = 1; - //int grdf[2]; - // disableReDebugger( grdf ); - // ret = !( computeExpression( condStr, &XMsgMsParamArray, NULL, 0, res ) == 0 ); - // enableReDebugger( grdf ); - return 0;//ret; - -} - - - - - -int getIrodsXmsg( rcvXmsgInp_t *rcvXmsgInp, irodsXmsg_t **outIrodsXmsg ) { - int rcvTicket = rcvXmsgInp->rcvTicket; - char *msgCond = rcvXmsgInp->msgCondition; - - if ( outIrodsXmsg == NULL ) { - rodsLog( LOG_ERROR, - "getIrodsXmsgByMsgNum: input outIrodsXmsg is NULL" ); - return SYS_INTERNAL_NULL_INPUT_ERR; - } - - /* locate the ticketMsgStruct_t */ - - ticketMsgStruct_t *ticketMsgStruct; - int status = getTicketMsgStructByTicket( rcvTicket, &ticketMsgStruct ); - - if ( status < 0 ) { - return status; - } - - /* now locate the irodsXmsg_t */ - - MessQueCondMutex.lock(); - irodsXmsg_t *tmpIrodsXmsg = ticketMsgStruct->xmsgQue.head; - - while ( tmpIrodsXmsg != NULL && checkMsgCondition( tmpIrodsXmsg, msgCond ) != 0 ) { - tmpIrodsXmsg = tmpIrodsXmsg->tnext; - } - - *outIrodsXmsg = tmpIrodsXmsg; - MessQueCondMutex.unlock(); - if ( tmpIrodsXmsg == NULL ) { - return SYS_NO_XMSG_FOR_MSG_NUMBER; - } - return 0; -} - -int -getIrodsXmsgByMsgNum( int rcvTicket, int msgNumber, - irodsXmsg_t **outIrodsXmsg ) { - int status; - irodsXmsg_t *tmpIrodsXmsg; - ticketMsgStruct_t *ticketMsgStruct; - - if ( outIrodsXmsg == NULL ) { - rodsLog( LOG_ERROR, - "getIrodsXmsgByMsgNum: input outIrodsXmsg is NULL" ); - return SYS_INTERNAL_NULL_INPUT_ERR; - } - - /* locate the ticketMsgStruct_t */ - - status = getTicketMsgStructByTicket( rcvTicket, &ticketMsgStruct ); - - if ( status < 0 ) { - return status; - } - - /* now locate the irodsXmsg_t */ - - tmpIrodsXmsg = ticketMsgStruct->xmsgQue.head; - - if ( msgNumber != ANY_MSG_NUMBER ) { - while ( tmpIrodsXmsg != NULL ) { - if ( ( int ) tmpIrodsXmsg->sendXmsgInfo->msgNumber == msgNumber ) { - break; - } - tmpIrodsXmsg = tmpIrodsXmsg->tnext; - } - } - *outIrodsXmsg = tmpIrodsXmsg; - if ( tmpIrodsXmsg == NULL ) { - return SYS_NO_XMSG_FOR_MSG_NUMBER; - } - else { - return 0; - } -} - -int -addTicketToHQue( xmsgTicketInfo_t *ticket, ticketHashQue_t *ticketHQue ) { - int status; - - ticketMsgStruct_t *tmpTicketMsgStruct; - - if ( ticket == NULL || ticketHQue == NULL ) { - rodsLog( LOG_ERROR, - "addTicketToHQue: input ticket or ticketHQue is NULL" ); - return SYS_INTERNAL_NULL_INPUT_ERR; - } - - tmpTicketMsgStruct = ( ticketMsgStruct_t* )calloc( 1, sizeof( ticketMsgStruct_t ) ); - - /* copy the content of the ticket */ - - tmpTicketMsgStruct->ticket = *ticket; - status = addTicketMsgStructToHQue( tmpTicketMsgStruct, ticketHQue ); - - if ( status < 0 ) { - free( tmpTicketMsgStruct ); - } - - return status; -} - -int -addTicketMsgStructToHQue( ticketMsgStruct_t *ticketMsgStruct, - ticketHashQue_t *ticketHQue ) { - ticketMsgStruct_t *tmpTicketMsgStruct; - - if ( ticketMsgStruct == NULL || ticketHQue == NULL ) { - rodsLog( LOG_ERROR, - "addTicketMsgStructToHQue: ticketMsgStruct or ticketHQue is NULL" ); - return SYS_INTERNAL_NULL_INPUT_ERR; - } - - ticketMsgStruct->hnext = ticketMsgStruct->hprev = NULL; - ticketMsgStruct->nxtSeqNumber = 0; - ticketMsgStruct->ticketHashQue = ticketHQue; - - if ( ticketHQue->head == NULL ) { - ticketHQue->head = ticketHQue->tail = ticketMsgStruct; - return 0; - } - - - /* que in descending order of rcvTicket */ - tmpTicketMsgStruct = ticketHQue->head; - while ( tmpTicketMsgStruct != NULL ) { - if ( ticketMsgStruct->ticket.rcvTicket == - tmpTicketMsgStruct->ticket.rcvTicket ) { - return SYS_DUPLICATE_XMSG_TICKET; - } - else if ( ticketMsgStruct->ticket.rcvTicket > - tmpTicketMsgStruct->ticket.rcvTicket ) { - break; - } - else { - tmpTicketMsgStruct = tmpTicketMsgStruct->hnext; - } - } - if ( tmpTicketMsgStruct == NULL ) { - /* reached the end */ - ticketHQue->tail->hnext = ticketMsgStruct; - ticketMsgStruct->hprev = ticketHQue->tail; - ticketHQue->tail = ticketMsgStruct; - } - else if ( tmpTicketMsgStruct == ticketHQue->head ) { - /* need to put ticketMsgStruct at the head */ - ticketHQue->head->hprev = ticketMsgStruct; - ticketMsgStruct->hnext = ticketHQue->head; - ticketHQue->head = ticketMsgStruct; - } - else { - /* in the middle */ - ticketMsgStruct->hprev = tmpTicketMsgStruct->hprev; - ticketMsgStruct->hnext = tmpTicketMsgStruct; - tmpTicketMsgStruct->hprev->hnext = ticketMsgStruct; - tmpTicketMsgStruct->hprev = tmpTicketMsgStruct; - } - - return 0; -} - -int -rmTicketMsgStructFromHQue( ticketMsgStruct_t *ticketMsgStruct, - ticketHashQue_t *ticketHQue ) { - if ( ticketMsgStruct == NULL || ticketHQue == NULL ) { - rodsLog( LOG_ERROR, - "rmTicketMsgStructFromHQue: ticketMsgStruct or ticketHQue is NULL" ); - return SYS_INTERNAL_NULL_INPUT_ERR; - } - - if ( ticketMsgStruct->hprev == NULL ) { - /* at head */ - ticketHQue->head = ticketMsgStruct->hnext; - } - else { - ticketMsgStruct->hprev->hnext = ticketMsgStruct->hnext; - } - - if ( ticketMsgStruct->hnext == NULL ) { - /* at tail */ - ticketHQue->tail = ticketMsgStruct->hprev; - } - else { - ticketMsgStruct->hnext->hprev = ticketMsgStruct->hprev; - } - - ticketMsgStruct->hprev = ticketMsgStruct->hnext = NULL; - - return 0; -} - -/* add incoming request to the bottom of the link list */ - -int -addReqToQue( int sock ) { - xmsgReq_t *myXmsgReq; - - myXmsgReq = ( xmsgReq_t* )calloc( 1, sizeof( xmsgReq_t ) ); - - myXmsgReq->sock = sock; - - ReqQueCondMutex.lock(); - - if ( XmsgReqHead == NULL ) { - XmsgReqHead = myXmsgReq; - XmsgReqTail = myXmsgReq; /* points to last item in queue */ - } - else { - XmsgReqTail->next = myXmsgReq; - XmsgReqTail = myXmsgReq; - } - - ReqQueCondMutex.unlock(); - - ReqQueCond.notify_all(); - - return 0; -} - -xmsgReq_t * -getReqFromQue() { - xmsgReq_t *myXmsgReq = NULL; - - while ( myXmsgReq == NULL ) { - - ReqQueCondMutex.lock(); - - if ( XmsgReqHead != NULL ) { - myXmsgReq = XmsgReqHead; - XmsgReqHead = XmsgReqHead->next; - ReqQueCondMutex.unlock(); - - break; - } - - ReqQueCondMutex.unlock(); - - boost::unique_lock boost_lock( ReqQueCondMutex ); - ReqQueCond.wait( boost_lock ); - if ( XmsgReqHead == NULL ) { - boost_lock.unlock(); - - continue; - } - else { - myXmsgReq = XmsgReqHead; - XmsgReqHead = XmsgReqHead->next; - boost_lock.unlock(); - - break; - } - } - - return myXmsgReq; -} - -int -startXmsgThreads() { - for ( int i = 0; i < NUM_XMSG_THR; i++ ) { - try { - ProcReqThread[i] = new boost::thread( procReqRoutine ); - } - catch ( const boost::thread_resource_error& ) { - return SYS_THREAD_RESOURCE_ERR; - } - } - - return 0; -} - -void -procReqRoutine() { - struct timeval msgTimeout; - memset( &msgTimeout, 0, sizeof( msgTimeout ) ); - msgTimeout.tv_sec = REQ_MSG_TIMEOUT_TIME; - - while ( 1 ) { - xmsgReq_t * myXmsgReq = getReqFromQue(); - if ( myXmsgReq == NULL ) { - /* someone else took care of it */ - continue; - } - - rsComm_t rsComm; - memset( &rsComm, 0, sizeof( rsComm ) ); - rsComm.sock = myXmsgReq->sock; - - // =-=-=-=-=-=-=- - // manufacture a network object - irods::network_object_ptr net_obj; - irods::error ret = irods::network_factory( &rsComm, net_obj ); - if ( !ret.ok() ) { - irods::log( PASS( ret ) ); - } - - startupPack_t *startupPack; - ret = readStartupPack( net_obj, &startupPack, NULL ); - if ( !ret.ok() ) { - rodsLog( LOG_ERROR, - "procReqRoutine: readStartupPack error, status = %d", ret.code() ); - free( myXmsgReq ); - continue; - } - initRsCommWithStartupPack( &rsComm, startupPack ); - free( startupPack ); - - ret = sendVersion( net_obj, 0, 0, NULL, 0 ); - if ( !ret.ok() ) { - sendVersion( net_obj, SYS_AGENT_INIT_ERR, 0, NULL, 0 ); - free( myXmsgReq ); - continue; - } - fd_set sockMask; - FD_ZERO( &sockMask ); - while ( 1 ) { - int numSock; - - FD_SET( rsComm.sock, &sockMask ); - while ( ( numSock = select( rsComm.sock + 1, &sockMask, - ( fd_set * ) NULL, ( fd_set * ) NULL, &msgTimeout ) ) <= 0 ) { - if ( errno == EINTR ) { - rodsLog( LOG_NOTICE, - "procReqRoutine: select() interrupted" ); - FD_SET( rsComm.sock, &sockMask ); - continue; - } - else { - break; /* timedout or something */ - } - } - if ( numSock < 0 ) { - break; - } - if ( readAndProcClientMsg( &rsComm, 0 ) < 0 ) { - break; - } - } - close( rsComm.sock ); - free( myXmsgReq ); - } -} - -/* The hash function which use rcvTicket as the key. It take the modulo of - * rcvTicket/NUM_HASH_SLOT - */ - -int -ticketHashFunc( uint rcvTicket ) { - const int mySlot = rcvTicket % NUM_HASH_SLOT; - return mySlot; -} - -int -initXmsgHashQue() { - - xmsgTicketInfo_t *outXmsgTicketInfo; - time_t thisTime; - int hashSlotNum; - - memset( XmsgHashQue, 0, NUM_HASH_SLOT * sizeof( ticketHashQue_t ) ); - memset( &XmsgQue, 0, sizeof( XmsgQue ) ); - - /*** have a permanent message queue with ticket-id =1,2,3,4,5***/ - - thisTime = time( NULL ); - - outXmsgTicketInfo = ( xmsgTicketInfo_t* )calloc( 1, sizeof( xmsgTicketInfo_t ) ); - outXmsgTicketInfo->expireTime = thisTime + ( MAX_EXPIRE_INT * 500 ); - outXmsgTicketInfo->rcvTicket = 1; - outXmsgTicketInfo->sendTicket = 1; - outXmsgTicketInfo->flag = 1; - hashSlotNum = ticketHashFunc( outXmsgTicketInfo->rcvTicket ); - addTicketToHQue( outXmsgTicketInfo, &XmsgHashQue[hashSlotNum] ); - free( outXmsgTicketInfo ); // JMC cppcheck - leak - outXmsgTicketInfo = ( xmsgTicketInfo_t* )calloc( 1, sizeof( xmsgTicketInfo_t ) ); - outXmsgTicketInfo->expireTime = thisTime + ( MAX_EXPIRE_INT * 500 ); - outXmsgTicketInfo->rcvTicket = 2; - outXmsgTicketInfo->sendTicket = 2; - outXmsgTicketInfo->flag = 1; - hashSlotNum = ticketHashFunc( outXmsgTicketInfo->rcvTicket ); - addTicketToHQue( outXmsgTicketInfo, &XmsgHashQue[hashSlotNum] ); - free( outXmsgTicketInfo ); // JMC cppcheck - leak - - outXmsgTicketInfo = ( xmsgTicketInfo_t* )calloc( 1, sizeof( xmsgTicketInfo_t ) ); - outXmsgTicketInfo->expireTime = thisTime + ( MAX_EXPIRE_INT * 500 ); - outXmsgTicketInfo->rcvTicket = 3; - outXmsgTicketInfo->sendTicket = 3; - outXmsgTicketInfo->flag = 1; - hashSlotNum = ticketHashFunc( outXmsgTicketInfo->rcvTicket ); - addTicketToHQue( outXmsgTicketInfo, &XmsgHashQue[hashSlotNum] ); - free( outXmsgTicketInfo ); // JMC cppcheck - leak - - outXmsgTicketInfo = ( xmsgTicketInfo_t* )calloc( 1, sizeof( xmsgTicketInfo_t ) ); - outXmsgTicketInfo->expireTime = thisTime + ( MAX_EXPIRE_INT * 500 ); - outXmsgTicketInfo->rcvTicket = 4; - outXmsgTicketInfo->sendTicket = 4; - outXmsgTicketInfo->flag = 1; - hashSlotNum = ticketHashFunc( outXmsgTicketInfo->rcvTicket ); - addTicketToHQue( outXmsgTicketInfo, &XmsgHashQue[hashSlotNum] ); - free( outXmsgTicketInfo ); // JMC cppcheck - leak - - outXmsgTicketInfo = ( xmsgTicketInfo_t* )calloc( 1, sizeof( xmsgTicketInfo_t ) ); - outXmsgTicketInfo->expireTime = thisTime + ( MAX_EXPIRE_INT * 500 ); - outXmsgTicketInfo->rcvTicket = 5; - outXmsgTicketInfo->sendTicket = 5; - outXmsgTicketInfo->flag = 1; - hashSlotNum = ticketHashFunc( outXmsgTicketInfo->rcvTicket ); - addTicketToHQue( outXmsgTicketInfo, &XmsgHashQue[hashSlotNum] ); - free( outXmsgTicketInfo ); // JMC cppcheck - leak - - addMsParam( &XMsgMsParamArray, "*XHDR", STR_MS_T, NULL, NULL ); - addMsParam( &XMsgMsParamArray, "*XUSER", STR_MS_T, NULL, NULL ); - addMsParam( &XMsgMsParamArray, "*XADDR", STR_MS_T, NULL, NULL ); - addMsParam( &XMsgMsParamArray, "*XMISC", STR_MS_T, NULL, NULL ); - addIntParamToArray( &XMsgMsParamArray, "*XMSGNUM", 0 ); - addIntParamToArray( &XMsgMsParamArray, "*XSEQNUM", 0 ); - addIntParamToArray( &XMsgMsParamArray, "*XTIME", 0 ); - - /*** have a permanent message queue with ticket-id = 1,2,3,4,5***/ - - return 0; -} - -int -getTicketMsgStructByTicket( uint rcvTicket, - ticketMsgStruct_t **outTicketMsgStruct ) { - int hashSlotNum; - ticketMsgStruct_t *tmpTicketMsgStruct; - - hashSlotNum = ticketHashFunc( rcvTicket ); - - tmpTicketMsgStruct = XmsgHashQue[hashSlotNum].head; - - while ( tmpTicketMsgStruct != NULL ) { - if ( rcvTicket == tmpTicketMsgStruct->ticket.rcvTicket ) { - *outTicketMsgStruct = tmpTicketMsgStruct; - return 0; - } - else if ( rcvTicket > tmpTicketMsgStruct->ticket.rcvTicket ) { - *outTicketMsgStruct = NULL; - return SYS_UNMATCHED_XMSG_TICKET; - } - else { - tmpTicketMsgStruct = tmpTicketMsgStruct->hnext; - } - } - - /* no match */ - *outTicketMsgStruct = NULL; - return SYS_UNMATCHED_XMSG_TICKET; -} - -int -_rsRcvXmsg( irodsXmsg_t *irodsXmsg, rcvXmsgOut_t *rcvXmsgOut ) { - sendXmsgInfo_t *sendXmsgInfo; - ticketMsgStruct_t *ticketMsgStruct; - - if ( irodsXmsg == NULL || rcvXmsgOut == NULL ) { - rodsLog( LOG_ERROR, - "_rsRcvXmsg: input irodsXmsg or rcvXmsgOut is NULL" ); - MessQueCondMutex.unlock(); - return SYS_INTERNAL_NULL_INPUT_ERR; - } - - sendXmsgInfo = irodsXmsg->sendXmsgInfo; - ticketMsgStruct = ( ticketMsgStruct_t* )irodsXmsg->ticketMsgStruct; - - /* rodsLog (LOG_NOTICE, - "_rsRcvXmsg: SEQNum=%d, numRcv=%d", irodsXmsg->seqNumber, - sendXmsgInfo->numRcv); */ - - sendXmsgInfo->numRcv--; - - if ( sendXmsgInfo->numRcv <= 0 && sendXmsgInfo->numDeli <= 0 ) { - /* done with this msg */ - rcvXmsgOut->msg = sendXmsgInfo->msg; - rcvXmsgOut->seqNumber = irodsXmsg->seqNumber; - rcvXmsgOut->msgNumber = sendXmsgInfo->msgNumber; - sendXmsgInfo->msg = NULL; - rstrcpy( rcvXmsgOut->msgType, sendXmsgInfo->msgType, HEADER_TYPE_LEN ); - rstrcpy( rcvXmsgOut->sendUserName, irodsXmsg->sendUserName, - NAME_LEN ); - rstrcpy( rcvXmsgOut->sendAddr, irodsXmsg->sendAddr, - NAME_LEN ); - rmXmsgFromXmsgQue( irodsXmsg, &XmsgQue ); - rmXmsgFromXmsgTcketQue( irodsXmsg, &ticketMsgStruct->xmsgQue ); - clearSendXmsgInfo( sendXmsgInfo ); - free( sendXmsgInfo ); - free( irodsXmsg ); - } - else { - rcvXmsgOut->msg = strdup( sendXmsgInfo->msg ); - rcvXmsgOut->seqNumber = irodsXmsg->seqNumber; - rcvXmsgOut->msgNumber = sendXmsgInfo->msgNumber; - rstrcpy( rcvXmsgOut->msgType, sendXmsgInfo->msgType, HEADER_TYPE_LEN ); - rstrcpy( rcvXmsgOut->sendUserName, irodsXmsg->sendUserName, - NAME_LEN ); - rstrcpy( rcvXmsgOut->sendAddr, irodsXmsg->sendAddr, - NAME_LEN ); - } - MessQueCondMutex.unlock(); - return 0; -} - -int -clearOneXMessage( ticketMsgStruct_t *ticketMsgStruct, int seqNum ) { - - - irodsXmsg_t *tmpIrodsXmsg; - - tmpIrodsXmsg = ticketMsgStruct->xmsgQue.head; - while ( tmpIrodsXmsg != NULL ) { - if ( ( int ) tmpIrodsXmsg->seqNumber == seqNum ) { - rmXmsgFromXmsgQue( tmpIrodsXmsg, &XmsgQue ); - rmXmsgFromXmsgTcketQue( tmpIrodsXmsg, &ticketMsgStruct->xmsgQue ); - clearSendXmsgInfo( tmpIrodsXmsg->sendXmsgInfo ); - free( tmpIrodsXmsg->sendXmsgInfo ); - free( tmpIrodsXmsg ); - return 0; - } - tmpIrodsXmsg = tmpIrodsXmsg->tnext; - } - - - return 0; -} - -int -clearAllXMessages( ticketMsgStruct_t *ticketMsgStruct ) { - - irodsXmsg_t *tmpIrodsXmsg, *tmpIrodsXmsg2; - - tmpIrodsXmsg = ticketMsgStruct->xmsgQue.head; - while ( tmpIrodsXmsg != NULL ) { - tmpIrodsXmsg2 = tmpIrodsXmsg->tnext; - rmXmsgFromXmsgQue( tmpIrodsXmsg, &XmsgQue ); - clearSendXmsgInfo( tmpIrodsXmsg->sendXmsgInfo ); - free( tmpIrodsXmsg->sendXmsgInfo ); - free( tmpIrodsXmsg ); - tmpIrodsXmsg = tmpIrodsXmsg2; - } - - ticketMsgStruct->xmsgQue.head = NULL; - ticketMsgStruct->xmsgQue.tail = NULL; - return 0; -} diff --git a/server/re/include/reAction.hpp b/server/re/include/reAction.hpp index 5942fe2f0c..a96d267fd2 100644 --- a/server/re/include/reAction.hpp +++ b/server/re/include/reAction.hpp @@ -85,33 +85,6 @@ int recover_print_hello( ruleExecInfo_t *c ); int recover_msiCreateUser( ruleExecInfo_t *rei ); int recover_msiCreateCollByAdmin( msParam_t *parColl, msParam_t *childName, ruleExecInfo_t *rei ); -int msiXmsgServerConnect( msParam_t* outConnParam, ruleExecInfo_t *rei ); -int msiXmsgCreateStream( msParam_t* inConnParam, - msParam_t* inGgetXmsgTicketInpParam, - msParam_t* outXmsgTicketInfoParam, - ruleExecInfo_t *rei ); -int msiCreateXmsgInp( msParam_t* inMsgNumber, - msParam_t* inMsgType, - msParam_t* inNumberOfReceivers, - msParam_t* inMsg, - msParam_t* inNumberOfDeliverySites, - msParam_t* inDeliveryAddressList, - msParam_t* inDeliveryPortList, - msParam_t* inMiscInfo, - msParam_t* inXmsgTicketInfoParam, - msParam_t* outSendXmsgInfoParam, - ruleExecInfo_t *rei ); -int msiSendXmsg( msParam_t* inConnParam, - msParam_t* inSendXmsgInpParam, - ruleExecInfo_t *rei ); -int msiRcvXmsg( msParam_t* inConnParam, - msParam_t* inTicketNumber, - msParam_t* inMsgNumber, - msParam_t* outMsgType, - msParam_t* outMsg, - msParam_t* outSendUser, - ruleExecInfo_t *rei ); -int msiXmsgServerDisConnect( msParam_t* inConnParam, ruleExecInfo_t *rei ); int msiString2KeyValPair( msParam_t *inBufferP, msParam_t* outKeyValPairP, ruleExecInfo_t *rei ); int msiStrArray2String( msParam_t* inSAParam, msParam_t* outStr, ruleExecInfo_t *rei ); @@ -134,11 +107,6 @@ msiPrintGenQueryInp( msParam_t *where, msParam_t* genQueryInpParam, ruleExecInfo int msiGetContInxFromGenQueryOut( msParam_t* genQueryOutParam, msParam_t* continueInx, ruleExecInfo_t *rei ); -int writeXMsg( msParam_t* inStreamId, msParam_t *inHdr, msParam_t *inMsg, ruleExecInfo_t *rei ); -int readXMsg( msParam_t* inStreamId, msParam_t* inCondRead, - msParam_t *outMsgNum, msParam_t *outSeqNum, - msParam_t *outHdr, msParam_t *outMsg, - msParam_t *outUser, msParam_t *outAddr, ruleExecInfo_t *rei ); int msiSetReplComment( msParam_t *inpParam1, msParam_t *inpParam2, msParam_t *inpParam3, msParam_t *inpParam4, ruleExecInfo_t *rei ); int @@ -257,12 +225,6 @@ namespace irods { table_[ "msiCheckHostAccessControl" ] = new irods::ms_table_entry( "msiCheckHostAccessControl", 0, std::function( msiCheckHostAccessControl ) ); table_[ "msiGetIcatTime" ] = new irods::ms_table_entry( "msiGetIcatTime", 2, std::function( msiGetIcatTime ) ); table_[ "msiGetTaggedValueFromString" ] = new irods::ms_table_entry( "msiGetTaggedValueFromString", 3, std::function( msiGetTaggedValueFromString ) ); - table_[ "msiXmsgServerConnect" ] = new irods::ms_table_entry( "msiXmsgServerConnect", 1, std::function( msiXmsgServerConnect ) ); - table_[ "msiXmsgCreateStream" ] = new irods::ms_table_entry( "msiXmsgCreateStream", 3, std::function( msiXmsgCreateStream ) ); - table_[ "msiCreateXmsgInp" ] = new irods::ms_table_entry( "msiCreateXmsgInp", 10, std::function( msiCreateXmsgInp ) ); - table_[ "msiSendXmsg" ] = new irods::ms_table_entry( "msiSendXmsg", 2, std::function( msiSendXmsg ) ); - table_[ "msiRcvXmsg" ] = new irods::ms_table_entry( "msiRcvXmsg", 6, std::function( msiRcvXmsg ) ); - table_[ "msiXmsgServerDisConnect" ] = new irods::ms_table_entry( "msiXmsgServerDisConnect", 1, std::function( msiXmsgServerDisConnect ) ); table_[ "msiString2KeyValPair" ] = new irods::ms_table_entry( "msiString2KeyValPair", 2, std::function( msiString2KeyValPair ) ); table_[ "msiStrArray2String" ] = new irods::ms_table_entry( "msiStrArray2String", 2, std::function( msiStrArray2String ) ); table_[ "msiString2StrArray" ] = new irods::ms_table_entry( "msiString2StrArray", 2, std::function( msiString2StrArray ) ); @@ -283,8 +245,6 @@ namespace irods { table_[ "msiGetContInxFromGenQueryOut" ] = new irods::ms_table_entry( "msiGetContInxFromGenQueryOut", 2, std::function( msiGetContInxFromGenQueryOut ) ); table_[ "msiSetACL" ] = new irods::ms_table_entry( "msiSetACL", 4, std::function( msiSetACL ) ); table_[ "msiSetRescQuotaPolicy" ] = new irods::ms_table_entry( "msiSetRescQuotaPolicy", 1, std::function( msiSetRescQuotaPolicy ) ); - table_[ "writeXMsg" ] = new irods::ms_table_entry( "writeXMsg", 3, std::function( writeXMsg ) ); - table_[ "readXMsg" ] = new irods::ms_table_entry( "readXMsg", 8, std::function( readXMsg ) ); table_[ "msiSetReplComment" ] = new irods::ms_table_entry( "msiSetReplComment", 4, std::function( msiSetReplComment ) ); table_[ "msiSetBulkPutPostProcPolicy" ] = new irods::ms_table_entry( "msiSetBulkPutPostProcPolicy", 1, std::function( msiSetBulkPutPostProcPolicy ) ); table_[ "msiCutBufferInHalf" ] = new irods::ms_table_entry( "msiCutBufferInHalf", 1, std::function( msiCutBufferInHalf ) ); diff --git a/server/re/src/printMS.cpp b/server/re/src/printMS.cpp index 7ef6407b84..9febe93ace 100644 --- a/server/re/src/printMS.cpp +++ b/server/re/src/printMS.cpp @@ -310,153 +310,3 @@ int writeKeyValPairs( msParam_t *where, msParam_t *inKVPair, msParam_t *separato return rei->status; } - - -/** - * \fn writeXMsg(msParam_t* inStreamId, msParam_t *inHdr, msParam_t *inMsg, ruleExecInfo_t *rei) - * - * \brief This microservice writes a given string into an XMsgStream - * - * \module core - * - * \since 2.4 - * - * - * \note This microservice takes a given buffer string and sends it as a message packet to the XMsg Server - * - * \usage See clients/icommands/test/rules/ - * - * \param[in] inStreamId - of type STR_MS_T or INT_MAS_T - the XMsg streamId number - * possibly generated by a msiXmsgCreateStream micro-serice or a supported standard stream with ids 1 thru 5 - * \param[in] inHdr - of type STR_MS_T - header string to be sent in the message packet - * \param[in] inMsg - of type STR_MS_T - message string to be sent in the message packet - * \param[in,out] rei - The RuleExecInfo structure that is automatically - * handled by the rule engine. The user does not include rei as a - * parameter in the rule invocation. - * - * \DolVarDependence none - * \DolVarModified none - * \iCatAttrDependence none - * \iCatAttrModified none - * \sideeffect an Xmsg gets sent and queued in the Xmsg server - * - * \return integer - * \retval 0 on success - * \pre none - * \post none - * \sa msiXmsgCreateStream, readXMsg - **/ -int _writeXMsg( int streamId, char *hdr, char *msg ); - -int -writeXMsg( msParam_t* inStreamId, msParam_t *inHdr, msParam_t *inMsg, ruleExecInfo_t *rei ) { - int i; - int streamId; - xmsgTicketInfo_t *xmsgTicketInfo; - - RE_TEST_MACRO( " Calling writeXMsg" ) - - if ( !strcmp( inStreamId->type, XmsgTicketInfo_MS_T ) ) { - xmsgTicketInfo = ( xmsgTicketInfo_t * ) inStreamId->inOutStruct; - streamId = ( int ) xmsgTicketInfo->rcvTicket; - } - else if ( !strcmp( inStreamId->type, STR_MS_T ) ) { - streamId = ( int ) atoi( ( char* )inStreamId->inOutStruct ); - } - else { - streamId = CAST_PTR_INT inStreamId->inOutStruct; - } - - i = _writeXMsg( streamId, ( char* )inHdr->inOutStruct, ( char* )inMsg->inOutStruct ); - return i; -} - -/** - * \fn readXMsg(msParam_t* inStreamId, msParam_t *inCondRead, - * msParam_t *outMsgNum, msParam_t *outSeqNum, - * msParam_t *outHdr, msParam_t *outMsg, - * msParam_t *outUser, msParam_t *outAddr, ruleExecInfo_t *rei) - * - * \brief Reads a message packet from an XMsgStream - * - * \module core - * - * \since 2.4 - * - * - * \note Reads into buffer a message packet from the XMsg Server - * - * \usage See clients/icommands/test/rules/ - * - * \param[in] inStreamId - of type STR_MS_T or INT_MAS_T - the XMsg streamId number - * possibly generated by a msiXmsgCreateStream microservice or a supported standard stream with ids 1 thru 5 - * \param[in] inCondRead - of type STR_MS_T - boolean condition for a packet to satisfy and the first packet that satisfies - * the condition is read from the XMsg Stream - * \param[out] outMsgNum - of type INT_MS_T - message number of the incoming packet (as given by message source) - * \param[out] outSeqNum - of type INT_MS_T - sequence number of the incoming packet (as given by Xmsg Server) - * \param[out] outHdr - of type STR_MS_T - header string of the incoming message packet - * \param[out] outMsg - of type STR_MS_T - message string of the incoming message packet - * \param[out] outUser - of type STR_MS_T - userName\@Zone of the sender of the packet - * \param[out] outAddr - of type STR_MS_T - address of the sending site of the packet (host address and process-id) - * \param[in,out] rei - The RuleExecInfo structure that is automatically - * handled by the rule engine. The user does not include rei as a - * parameter in the rule invocation. - * - * \DolVarDependence none - * \DolVarModified none - * \iCatAttrDependence none - * \iCatAttrModified none - * \sideeffect message packet may have its status changed in the XMsg Server - * - * \return integer - * \retval 0 on success - * \pre none - * \post none - * \sa msiXmsgCreateStream, writeXMsg - **/ -int _readXMsg( int streamId, char *condRead, int *msgNum, int *seqNum, char **hdr, char **msg, char **user, char **addr ); -int -readXMsg( msParam_t* inStreamId, msParam_t *inCondRead, - msParam_t *outMsgNum, msParam_t *outSeqNum, - msParam_t *outHdr, msParam_t *outMsg, - msParam_t *outUser, msParam_t *outAddr, ruleExecInfo_t *rei ) { - int i; - int sNum = 0; - int mNum = 0; - char *hdr = NULL; - char *msg = NULL; - char *user = NULL; - char *addr = NULL; - int streamId; - xmsgTicketInfo_t *xmsgTicketInfo; - char *condRead = NULL; - RE_TEST_MACRO( " Calling readXMsg" ); - - if ( !strcmp( inStreamId->type, XmsgTicketInfo_MS_T ) ) { - xmsgTicketInfo = ( xmsgTicketInfo_t * ) inStreamId->inOutStruct; - streamId = xmsgTicketInfo->rcvTicket; - } - else if ( !strcmp( inStreamId->type, STR_MS_T ) ) { - streamId = ( int ) atoi( ( char* )inStreamId->inOutStruct ); - } - else { - streamId = CAST_PTR_INT inStreamId->inOutStruct; - } - condRead = ( char * ) inCondRead->inOutStruct; - i = _readXMsg( streamId, condRead, &mNum, &sNum, &hdr, &msg, &user, &addr ); - if ( i >= 0 ) { - outHdr->inOutStruct = ( void * ) hdr; - outHdr->type = strdup( STR_MS_T ); - outMsg->inOutStruct = ( void * ) msg; - outMsg->type = strdup( STR_MS_T ); - fillIntInMsParam( outMsgNum, mNum ); - fillIntInMsParam( outSeqNum, sNum ); - outUser->inOutStruct = ( void * ) user; - outUser->type = strdup( STR_MS_T ); - outAddr->inOutStruct = ( void * ) addr; - outAddr->type = strdup( STR_MS_T ); - - } - return i; -} - diff --git a/server/re/src/xmsgMS.cpp b/server/re/src/xmsgMS.cpp deleted file mode 100644 index e45d348c61..0000000000 --- a/server/re/src/xmsgMS.cpp +++ /dev/null @@ -1,580 +0,0 @@ -/** - * @file xmsgMS.cpp - * - */ - -/*** Copyright (c), The Regents of the University of California *** - *** For more information please refer to files in the COPYRIGHT directory ***/ -//#include "reGlobalsExtern.hpp" -#include "icatHighLevelRoutines.hpp" -#include "rodsXmsg.h" -#include "getXmsgTicket.h" -#include "sendXmsg.h" -#include "rcvXmsg.h" - -#if defined(_LP64) || defined(__LP64__) -#define CAST_PTR_INT (long int) -#else -#define CAST_PTR_INT (uint) -#endif - -static rcComm_t *xmsgServerConn = NULL; -static rodsEnv myRodsXmsgEnv; - -/** - * \fn msiXmsgServerConnect(msParam_t* outConnParam, ruleExecInfo_t *rei) - * - * \brief Connect to the XMessage server. - * - * \module core - * - * \since pre-2.1 - * - * - * \usage See clients/icommands/test/rules/ - * - * \param[out] outConnParam - a msParam of type RcComm_MS_T which is a connection descriptor. - * \param[in,out] rei - The RuleExecInfo structure that is automatically - * handled by the rule engine. The user does not include rei as a - * parameter in the rule invocation. - * - * \DolVarDependence none - * \DolVarModified none - * \iCatAttrDependence none - * \iCatAttrModified none - * \sideeffect none - * - * \return integer - * \retval 0 on success - * \pre needs the XMessage Server host name in irods_environment.json file - * \post none - * \sa none -**/ -int msiXmsgServerConnect( msParam_t* outConnParam, ruleExecInfo_t *rei ) { - - rcComm_t *conn; - rodsEnv myRodsEnv; - rErrMsg_t errMsg; - int status; - - RE_TEST_MACRO( " Calling msiXmsgServerConnect" ); - - status = getRodsEnv( &myRodsEnv ); - if ( status < 0 ) { - rodsLog( LOG_ERROR, "msiXmsgServerConnect: getRodsEnv failed:%i", status ); - return status; - } - conn = rcConnectXmsg( &myRodsEnv, &errMsg ); - if ( conn == NULL ) { - rodsLog( LOG_ERROR, - "msiXmsgServerConnect: rcConnectXmsg failed:%i :%s\n", errMsg.status, errMsg.msg ); - return errMsg.status; - } - status = clientLogin( conn ); - if ( status != 0 ) { - rodsLog( LOG_ERROR, "msiXmsgServerConnect: clientLogin failed:%i", status ); - return status; - } - - outConnParam->inOutStruct = ( void * ) conn; - outConnParam->type = strdup( "RcComm_MS_T" ); - - return 0; - -} - -/** - * \fn msiXmsgCreateStream(msParam_t* inConnParam, msParam_t* inGgetXmsgTicketInpParam, msParam_t* outXmsgTicketInfoParam, ruleExecInfo_t *rei) - * - * \brief This microservice creates a new Message Stream. - * - * \module core - * - * \since pre-2.1 - * - * - * \usage See clients/icommands/test/rules/ - * - * \param[in] inConnParam - a msParam of type RcComm_MS_T which is a connection descriptor obtained by msiXmsgServerConnect. - * \param[in] inGgetXmsgTicketInpParam - a msParam of type GetXmsgTicketInp_MS_T which is actually an integer giving expiration time. - * \param[out] outXmsgTicketInfoParam - a msParam of type XmsgTicketInfo_MS_T which is an information struct for the ticket generated for this stream. - * \param[in,out] rei - The RuleExecInfo structure that is automatically - * handled by the rule engine. The user does not include rei as a - * parameter in the rule invocation. - * - * \DolVarDependence none - * \DolVarModified none - * \iCatAttrDependence none - * \iCatAttrModified none - * \sideeffect none - * - * \return integer - * \retval 0 on success - * \pre msiXmsgServerConnect should have been done earlier to get the inConnParam. - * \post none - * \sa msiXmsgServerConnect -**/ -int msiXmsgCreateStream( msParam_t* inConnParam, - msParam_t* inGgetXmsgTicketInpParam, - msParam_t* outXmsgTicketInfoParam, - ruleExecInfo_t *rei ) { - - rcComm_t *conn; - getXmsgTicketInp_t *getXmsgTicketInp; - xmsgTicketInfo_t *outXmsgTicketInfo = NULL; - int status; - int allocFlag = 0; - - RE_TEST_MACRO( " Calling msiXmsgCreateStream" ); - - if ( inConnParam->inOutStruct == NULL ) { - rodsLog( LOG_ERROR, - "msiXmsgCreateStream: input inConnParam is NULL" ); - return SYS_INTERNAL_NULL_INPUT_ERR; - } - conn = ( rcComm_t * ) inConnParam->inOutStruct; - - if ( inGgetXmsgTicketInpParam->inOutStruct != NULL && !( strcmp( inGgetXmsgTicketInpParam->type, STR_MS_T ) == 0 && strcmp( ( char * )inGgetXmsgTicketInpParam->inOutStruct, "" ) == 0 ) ) { - getXmsgTicketInp = ( getXmsgTicketInp_t * ) inGgetXmsgTicketInpParam->inOutStruct; - } - else { - getXmsgTicketInp = ( getXmsgTicketInp_t * ) malloc( sizeof( getXmsgTicketInp_t ) ); - memset( getXmsgTicketInp, 0, sizeof( getXmsgTicketInp_t ) ); - allocFlag = 1; - } - - status = rcGetXmsgTicket( conn, getXmsgTicketInp, &outXmsgTicketInfo ); - if ( status != 0 ) { - rodsLog( LOG_ERROR, "msiXmsgCreateStream: rcGetXmsgTicket failed:%i", status ); - free( getXmsgTicketInp ); - return status; - } - - outXmsgTicketInfoParam->inOutStruct = ( void * ) outXmsgTicketInfo; - outXmsgTicketInfoParam->type = strdup( XmsgTicketInfo_MS_T ); - if ( allocFlag == 1 ) { - free( getXmsgTicketInp ); - } - return 0; - -} - -/** - * \fn msiCreateXmsgInp(msParam_t* inMsgNumber, msParam_t* inMsgType, msParam_t* inNumberOfReceivers, msParam_t* inMsg, msParam_t* inNumberOfDeliverySites, - * msParam_t* inDeliveryAddressList, msParam_t* inDeliveryPortList, msParam_t* inMiscInfo, msParam_t* inXmsgTicketInfoParam, - * msParam_t* outSendXmsgInpParam, ruleExecInfo_t *) - * - * \brief Given all information values this microservice creates an Xmsg packet. - * - * \module core - * - * \since pre-2.1 - * - * - * \usage See clients/icommands/test/rules/ - * - * \param[in] inMsgNumber - a msParam of type uint or STR_MS_T which is a message serial number. - * \param[in] inMsgType - a msParam of type uint or STR_MS_T which is currently 0 (SINGLE_MSG_TICKET) or 1 (MULTI_MSG_TICKET). - * \param[in] inNumberOfReceivers - a msParam of type uint or STR_MS_T which is a number of receivers of the message. - * \param[in] inMsg - a msParam of type STR_MS_T which is a message body. - * \param[in] inNumberOfDeliverySites - a msParam of type int or STR_MS_T which is a Number of Receiving Addresses. - * \param[in] inDeliveryAddressList - a msParam of type STR_MS_T which is a List of Host Addresses (comma separated). - * \param[in] inDeliveryPortList - a msParam of type STR_MS_T which is a List of Correspondng Ports (comma separated). - * \param[in] inMiscInfo - a msParam of type STR_MS_T which is other Information. - * \param[in] inXmsgTicketInfoParam - a msParam of type XmsgTicketInfo_MS_T which is outXmsgTicketInfoParam from msiXmsgCreateStream - * \param[out] outSendXmsgInpParam - a msParam of type SendXmsgInp_MS_T which is a Xmsg packet. - * \param[in,out] - The RuleExecInfo structure that is automatically - * handled by the rule engine. The user does not include rei as a - * parameter in the rule invocation. - * - * \DolVarDependence none - * \DolVarModified none - * \iCatAttrDependence none - * \iCatAttrModified none - * \sideeffect none - * - * \return integer - * \retval 0 on success - * \pre none - * \post none - * \sa none -**/ -int msiCreateXmsgInp( msParam_t* inMsgNumber, - msParam_t* inMsgType, - msParam_t* inNumberOfReceivers, - msParam_t* inMsg, - msParam_t* inNumberOfDeliverySites, - msParam_t* inDeliveryAddressList, - msParam_t* inDeliveryPortList, - msParam_t* inMiscInfo, - msParam_t* inXmsgTicketInfoParam, - msParam_t* outSendXmsgInpParam, - ruleExecInfo_t* ) { - - - sendXmsgInp_t *sendXmsgInp; - xmsgTicketInfo_t *xmsgTicketInfo; - - if ( inXmsgTicketInfoParam == NULL ) { - rodsLog( LOG_ERROR, "msiSendXmsg: input inXmsgTicketInfoParam is NULL" ); - return SYS_INTERNAL_NULL_INPUT_ERR; - } - xmsgTicketInfo = ( xmsgTicketInfo_t * ) inXmsgTicketInfoParam->inOutStruct; - - sendXmsgInp = ( sendXmsgInp_t * ) malloc( sizeof( sendXmsgInp_t ) ); - /* memset (&sendXmsgInp, 0, sizeof (sendXmsgInp_t));*/ - - sendXmsgInp->ticket.sendTicket = xmsgTicketInfo->sendTicket; - sendXmsgInp->ticket.rcvTicket = xmsgTicketInfo->rcvTicket; - sendXmsgInp->ticket.expireTime = xmsgTicketInfo->expireTime; - sendXmsgInp->ticket.flag = xmsgTicketInfo->flag; - if ( !strcmp( inMsgNumber->type, STR_MS_T ) ) { - sendXmsgInp->sendXmsgInfo.msgNumber = ( uint ) atoi( ( char* )inMsgNumber->inOutStruct ); - } - else { - sendXmsgInp->sendXmsgInfo.msgNumber = CAST_PTR_INT inMsgNumber->inOutStruct; - } - snprintf( sendXmsgInp->sendXmsgInfo.msgType, sizeof( sendXmsgInp->sendXmsgInfo.msgType ), "%s", ( char* )inMsgType->inOutStruct ); - if ( !strcmp( inNumberOfReceivers->type, STR_MS_T ) ) { - sendXmsgInp->sendXmsgInfo.numRcv = ( uint ) atoi( ( char* )inNumberOfReceivers->inOutStruct ); - } - else { - sendXmsgInp->sendXmsgInfo.numRcv = CAST_PTR_INT inNumberOfReceivers->inOutStruct; - } - sendXmsgInp->sendXmsgInfo.msg = strdup( ( char * ) inMsg->inOutStruct ); - if ( !strcmp( inNumberOfDeliverySites->type, STR_MS_T ) ) { - sendXmsgInp->sendXmsgInfo.numDeli = ( int ) atoi( ( char* )inNumberOfDeliverySites->inOutStruct ); - } - else { - sendXmsgInp->sendXmsgInfo.numDeli = CAST_PTR_INT inNumberOfDeliverySites->inOutStruct; - } - if ( sendXmsgInp->sendXmsgInfo.numDeli == 0 ) { - sendXmsgInp->sendXmsgInfo.deliAddress = NULL; - sendXmsgInp->sendXmsgInfo.deliPort = NULL; - } - else { - sendXmsgInp->sendXmsgInfo.deliAddress = ( char** )inDeliveryAddressList->inOutStruct; - sendXmsgInp->sendXmsgInfo.deliPort = ( uint* )inDeliveryPortList->inOutStruct; - } - sendXmsgInp->sendXmsgInfo.miscInfo = strdup( ( char * ) inMiscInfo->inOutStruct ); - - outSendXmsgInpParam->inOutStruct = ( void * ) sendXmsgInp; - outSendXmsgInpParam->type = strdup( SendXmsgInp_MS_T ); - return 0; - - -} - - -/** - * \fn msiSendXmsg(msParam_t* inConnParam, msParam_t* inSendXmsgInpParam, ruleExecInfo_t *rei) - * - * \brief This microservice sends an Xmsg packet. - * - * \module core - * - * \since pre-2.1 - * - * - * \note Sends an Xmsg packet created by #msiCreateXmsgInp using the connection made by #msiXmsgServerConnect - * - * \usage See clients/icommands/test/rules/ - * - * \param[in] inConnParam - a msParam of type RcComm_MS_T which is a connection descriptor obtained by msiXmsgServerConnect. - * \param[in] inSendXmsgInpParam - a msParam of type SendXmsgInp_MS_T outSendXmsgInpParam from inSendXmsgInpParam. - * \param[in,out] rei - The RuleExecInfo structure that is automatically - * handled by the rule engine. The user does not include rei as a - * parameter in the rule invocation. - * - * \DolVarDependence none - * \DolVarModified none - * \iCatAttrDependence none - * \iCatAttrModified none - * \sideeffect none - * - * \return integer - * \retval 0 on success - * \pre msiXmsgServerConnect should've been done earlier to get the inConnParam. - * \post none - * \sa none -**/ -int msiSendXmsg( msParam_t* inConnParam, - msParam_t* inSendXmsgInpParam, - ruleExecInfo_t *rei ) { - - rcComm_t *conn; - sendXmsgInp_t *sendXmsgInp; - int status; - - - - RE_TEST_MACRO( " Calling msiSendXmsg" ); - - if ( inConnParam->inOutStruct == NULL ) { - rodsLog( LOG_ERROR, "msiSendXmsg: input inConnParam is NULL" ); - return SYS_INTERNAL_NULL_INPUT_ERR; - } - conn = ( rcComm_t * ) inConnParam->inOutStruct; - - if ( inSendXmsgInpParam == NULL ) { - rodsLog( LOG_ERROR, "msiSendXmsg: input inSendXmsgInpParam is NULL" ); - return SYS_INTERNAL_NULL_INPUT_ERR; - } - sendXmsgInp = ( sendXmsgInp_t * ) inSendXmsgInpParam->inOutStruct; - - - status = rcSendXmsg( conn, sendXmsgInp ); - if ( status < 0 ) { - rodsLog( LOG_ERROR, "msiSendXmsg: rcSendXmsg failed:%i", status ); - return status; - } - return status; -} - - - -/** - * \fn msiRcvXmsg(msParam_t* inConnParam, msParam_t* inTicketNumber, msParam_t* inMsgNumber, msParam_t* outMsgType, msParam_t* outMsg, - * msParam_t* outSendUser, ruleExecInfo_t *rei) - * - * \brief This microservice receives an Xmsg packet. - * - * \module core - * - * \since pre-2.1 - * - * - * \note Uses the connection made by #msiXmsgServerConnect. - * - * \usage See clients/icommands/test/rules/ - * - * \param[in] inConnParam - a msParam of type RcComm_MS_T which is a connection descriptor obtained by msiXmsgServerConnect. - * \param[in] inTicketNumber - a msParam of type XmsgTicketInfo_MS_T or STR_MS_T or unit which is outXmsgTicketInfoParam from msiXmsgCreateStream or outXmsgTicketInfoParam->rcvTicket (a string which the sender passes to the receiver). - * \param[in] inMsgNumber - a msParam of type unit or STR_MS_T which is a message serial number to fetch. - * \param[out] outMsgType - a msParam of type STR_MS_T which is a message type. - * \param[out] outMsg - a msParam of type STR_MS_T which is a message body. - * \param[out] outSendUser - a msParam of type STR_MS_T which is a sender information. - * \param[in,out] rei - The RuleExecInfo structure that is automatically - * handled by the rule engine. The user does not include rei as a - * parameter in the rule invocation. - * - * \DolVarDependence none - * \DolVarModified none - * \iCatAttrDependence none - * \iCatAttrModified none - * \sideeffect none - * - * \return integer - * \retval 0 on success - * \pre msiXmsgServerConnect should've been done earlier to get the inConnParam. - * \post none - * \sa none -**/ -int msiRcvXmsg( msParam_t* inConnParam, - msParam_t* inTicketNumber, - msParam_t* inMsgNumber, - msParam_t* outMsgType, - msParam_t* outMsg, - msParam_t* outSendUser, - ruleExecInfo_t *rei ) { - - rcComm_t *conn; - rcvXmsgInp_t rcvXmsgInp; - rcvXmsgOut_t *rcvXmsgOut = NULL; - xmsgTicketInfo_t *xmsgTicketInfo = NULL; - int status; - - - RE_TEST_MACRO( " Calling msiRcvXmsg" ); - - if ( inConnParam->inOutStruct == NULL ) { - rodsLog( LOG_ERROR, "msiRcvXmsg: input inConnParam is NULL" ); - return SYS_INTERNAL_NULL_INPUT_ERR; - } - conn = ( rcComm_t * ) inConnParam->inOutStruct; - - memset( &rcvXmsgInp, 0, sizeof( rcvXmsgInp ) ); - if ( !strcmp( inTicketNumber->type, XmsgTicketInfo_MS_T ) ) { - xmsgTicketInfo = ( xmsgTicketInfo_t * ) inTicketNumber->inOutStruct; - rcvXmsgInp.rcvTicket = xmsgTicketInfo->rcvTicket; - } - else if ( !strcmp( inTicketNumber->type, STR_MS_T ) ) { - rcvXmsgInp.rcvTicket = ( uint ) atoi( ( char* )inTicketNumber->inOutStruct ); - } - else { - rcvXmsgInp.rcvTicket = CAST_PTR_INT inTicketNumber->inOutStruct; - } - if ( !strcmp( inMsgNumber->type, STR_MS_T ) ) { - rcvXmsgInp.msgNumber = ( uint ) atoi( ( char* )inMsgNumber->inOutStruct ); - } - else { - rcvXmsgInp.msgNumber = CAST_PTR_INT inMsgNumber->inOutStruct; - } - - status = rcRcvXmsg( conn, &rcvXmsgInp, &rcvXmsgOut ); - if ( status < 0 || rcvXmsgOut == NULL ) { // JMC cppcheck - rodsLog( LOG_ERROR, "msiRcvXmsg: rcRcvXmsg failed:%i", status ); - return status; - } - - outMsgType->inOutStruct = ( void * ) strdup( rcvXmsgOut->msgType ); - outMsgType->type = strdup( STR_MS_T ); - outMsg->inOutStruct = ( void * ) rcvXmsgOut->msg; - outMsg->type = strdup( STR_MS_T ); - outSendUser->inOutStruct = ( void * ) strdup( rcvXmsgOut->sendUserName ); - outSendUser->type = strdup( STR_MS_T ); - return status; -} - -/** - * \fn msiXmsgServerDisConnect(msParam_t* inConnParam, ruleExecInfo_t *rei) - * - * \brief This microservice disconnects from the XMessage Server. - * - * \module core - * - * \since pre-2.1 - * - * - * \usage See clients/icommands/test/rules/ - * - * \param[in] inConnParam - a msParam of type RcComm_MS_T which is a connection descriptor obtained by msiXmsgServerConnect. - * \param[in,out] rei - The RuleExecInfo structure that is automatically - * handled by the rule engine. The user does not include rei as a - * parameter in the rule invocation. - * - * \DolVarDependence none - * \DolVarModified none - * \iCatAttrDependence none - * \iCatAttrModified none - * \sideeffect none - * - * \return integer - * \retval 0 on success - * \pre msiXmsgServerConnect should've been done earlier to get the inConnParam. - * \post none - * \sa none -**/ -int msiXmsgServerDisConnect( msParam_t* inConnParam, ruleExecInfo_t *rei ) { - - rcComm_t *conn; - int status; - - RE_TEST_MACRO( " Calling msiXmsgServerDisConnect" ); - - if ( inConnParam->inOutStruct == NULL ) { - rodsLog( LOG_ERROR, "msiSendXmsg: input inConnParam is NULL" ); - return SYS_INTERNAL_NULL_INPUT_ERR; - } - conn = ( rcComm_t * ) inConnParam->inOutStruct; - status = rcDisconnect( conn ); - if ( status == 0 ) { - inConnParam->inOutStruct = NULL; - } - return status; - -} - - -int _writeXMsg( int streamId, char *hdr, char *msg ) { - int i; - xmsgTicketInfo_t xmsgTicketInfo; - sendXmsgInp_t sendXmsgInp; - rcComm_t *conn; - rErrMsg_t errMsg; - char myHostName[MAX_NAME_LEN]; - - - if ( xmsgServerConn == NULL ) { - i = getRodsEnv( &myRodsXmsgEnv ); - if ( i < 0 ) { - rodsLog( LOG_ERROR, "_writeXMsg: getRodsEnv failed:%i", i ); - return i; - } - conn = rcConnectXmsg( &myRodsXmsgEnv, &errMsg ); - if ( conn == NULL ) { - rodsLog( LOG_ERROR, "_writeXMsg: rcConnectXmsg failed:%i:%s", errMsg.status, errMsg.msg ); - return errMsg.status; - } - i = clientLogin( conn ); - if ( i != 0 ) { - rodsLog( LOG_ERROR, "msiXmsgServerConnect: clientLogin failed:%i", i ); - rcDisconnect( conn ); - return i; - } - xmsgServerConn = conn; - } - else { - conn = xmsgServerConn; - } - myHostName[0] = '\0'; - gethostname( myHostName, MAX_NAME_LEN ); - - memset( &xmsgTicketInfo, 0, sizeof( xmsgTicketInfo ) ); - memset( &sendXmsgInp, 0, sizeof( sendXmsgInp ) ); - xmsgTicketInfo.sendTicket = streamId; - xmsgTicketInfo.rcvTicket = streamId; - xmsgTicketInfo.flag = 1; - sendXmsgInp.ticket = xmsgTicketInfo; - sendXmsgInp.sendXmsgInfo.numRcv = 1; - sendXmsgInp.sendXmsgInfo.msgNumber = 0; - snprintf( sendXmsgInp.sendXmsgInfo.msgType, HEADER_TYPE_LEN, "%s", hdr ); - snprintf( sendXmsgInp.sendAddr, NAME_LEN, "%s:%i", myHostName, getpid() ); - sendXmsgInp.sendXmsgInfo.msg = msg; - i = rcSendXmsg( conn, &sendXmsgInp ); - if ( i < 0 ) { - rodsLog( LOG_NOTICE, "_writeXmsg: Unable to send message to stream %i\n", streamId ); - } - /* rcDisconnect(conn); */ - return i; -} - -int _readXMsg( int streamId, char *condRead, int *msgNum, int *seqNum, - char **hdr, char **msg, char **user, char **addr ) { - int i; - rcvXmsgInp_t rcvXmsgInp; - rcvXmsgOut_t *rcvXmsgOut = NULL; - rcComm_t *conn; - rErrMsg_t errMsg; - - if ( xmsgServerConn == NULL ) { - i = getRodsEnv( &myRodsXmsgEnv ); - if ( i < 0 ) { - rodsLog( LOG_ERROR, "_readXMsg: getRodsEnv failed:%i", i ); - return i; - } - conn = rcConnectXmsg( &myRodsXmsgEnv, &errMsg ); - if ( conn == NULL ) { - rodsLog( LOG_ERROR, "_readXMsg: rcConnectXmsg failed:%i:%s", errMsg.status, errMsg.msg ); - return errMsg.status; - } - i = clientLogin( conn ); - if ( i != 0 ) { - rodsLog( LOG_ERROR, "msiXmsgServerConnect: clientLogin failed:%i", i ); - rcDisconnect( conn ); - return i; - } - xmsgServerConn = conn; - } - else { - conn = xmsgServerConn; - } - memset( &rcvXmsgInp, 0, sizeof( rcvXmsgInp ) ); - rcvXmsgInp.rcvTicket = streamId; - rcvXmsgInp.msgNumber = 0; - snprintf( rcvXmsgInp.msgCondition, MAX_NAME_LEN, "%s", condRead ); - i = rcRcvXmsg( conn, &rcvXmsgInp, &rcvXmsgOut ); - if ( i < 0 || rcvXmsgOut == NULL ) { // JMC cppcheck - /* rcDisconnect(conn); */ - rodsLog( LOG_NOTICE, "_readXmsg: Unable to receive message from stream %i\n", streamId ); - return i; - } - *msgNum = rcvXmsgOut->msgNumber; - *seqNum = rcvXmsgOut->seqNumber; - *hdr = strdup( rcvXmsgOut->msgType ); - *msg = strdup( rcvXmsgOut->msg ); - *user = strdup( rcvXmsgOut->sendUserName ); - *addr = strdup( rcvXmsgOut->sendAddr ); - /* rcDisconnect(conn);*/ - return i; -}