Skip to content

Commit

Permalink
[irods#168] Add missing iRODS types and members
Browse files Browse the repository at this point in the history
This change adds missing check_auth_credentials type.

Adds tcp_keepalive members to rodsEnv as well as connection pool timeout
member which was not added before.

Also added session_signature member of RcComm and session_props member of
RsComm.

-Wmissing-field-initializers is raised by a missing member of sockaddr_in
called sin_zero. This member has been removed in bwg2001-004. For more
information, see http://www.opengroup.org/platform/resolutions/bwg2001-many.html

Even though sin_zero must be included in the member list for sockaddr_in
for a complete member initialization list, we do not expose it as a
property for this type in the rule engine because sin_zero is not part
of the standard and may not be available in the future.

The missing member is included to silence the warning.
  • Loading branch information
alanking committed Oct 13, 2023
1 parent 599dc75 commit 9253546
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ add_library(
"${CMAKE_CURRENT_SOURCE_DIR}/src/types/system/sys/stat.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/types/system/sys/time.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/types/irods/bulkDataObjPut.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/types/irods/check_auth_credentials.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/types/irods/dataCopy.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/types/irods/dataObjCopy.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/types/irods/dataObjInpOut.cpp"
Expand Down Expand Up @@ -127,6 +128,7 @@ set(
"${CMAKE_CURRENT_SOURCE_DIR}/include/irods/private/re/python/types/system/sys/stat.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/irods/private/re/python/types/system/sys/time.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/irods/private/re/python/types/irods/bulkDataObjPut.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/irods/private/re/python/types/irods/check_auth_credentials.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/irods/private/re/python/types/irods/dataCopy.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/irods/private/re/python/types/irods/dataObjCopy.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/irods/private/re/python/types/irods/dataObjInpOut.hpp"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef RE_PYTHON_TYPES_IRODS_CHECK_AUTH_CREDENTIALS_HPP
#define RE_PYTHON_TYPES_IRODS_CHECK_AUTH_CREDENTIALS_HPP

namespace irods::re::python::types
{
void export_CheckAuthCredentialsInput();
} //namespace irods::re::python::types

#endif // RE_PYTHON_TYPES_IRODS_CHECK_AUTH_CREDENTIALS_HPP
3 changes: 3 additions & 0 deletions src/irods_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "irods/private/re/python/types/system/sys/stat.hpp"
#include "irods/private/re/python/types/system/sys/time.hpp"
#include "irods/private/re/python/types/irods/bulkDataObjPut.hpp"
#include "irods/private/re/python/types/irods/check_auth_credentials.hpp"
#include "irods/private/re/python/types/irods/dataCopy.hpp"
#include "irods/private/re/python/types/irods/dataObjCopy.hpp"
#include "irods/private/re/python/types/irods/dataObjInpOut.hpp"
Expand Down Expand Up @@ -226,5 +227,7 @@ namespace

py_types::export_FileLseekInp_t();
py_types::export_FileLseekOut_t();

py_types::export_CheckAuthCredentialsInput();
}
} //namespace
41 changes: 41 additions & 0 deletions src/types/irods/check_auth_credentials.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// include this first for defines and pyconfig
#include "irods/private/re/python/types/config.hpp"

#include "irods/private/re/python/types/irods/check_auth_credentials.hpp"

#include <irods/check_auth_credentials.h>

#include "irods/private/re/python/types/array_ref.hpp"
#include "irods/private/re/python/types/init_struct.hpp"

#include <patchlevel.h>
#include <boost/version.hpp>
#pragma GCC diagnostic push
#if PY_VERSION_HEX < 0x030400A2
# pragma GCC diagnostic ignored "-Wregister"
#endif
#if PY_VERSION_HEX >= 0x03090000 && BOOST_VERSION < 107500
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#include <boost/python/class.hpp>
#pragma GCC diagnostic pop

namespace bp = boost::python;

namespace irods::re::python::types
{
__attribute__((visibility("hidden"))) void export_CheckAuthCredentialsInput()
{
// clang-format off
bp::class_<CheckAuthCredentialsInput>("CheckAuthCredentialsInput", bp::no_init)
.def("__init__", make_init_function<CheckAuthCredentialsInput>(
&CheckAuthCredentialsInput::username,
&CheckAuthCredentialsInput::zone,
&CheckAuthCredentialsInput::password))
.add_property("username", +[](CheckAuthCredentialsInput *s) { return array_ref<char>{s->username}; })
.add_property("zone", +[](CheckAuthCredentialsInput *s) { return array_ref<char>{s->zone}; })
.add_property("password", +[](CheckAuthCredentialsInput *s) { return array_ref<char>{s->password}; })
;
// clang-format on
}
} //namespace irods::re::python::types
10 changes: 9 additions & 1 deletion src/types/irods/getRodsEnv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ namespace irods::re::python::types
&rodsEnv::irodsMaxSizeForSingleBuffer,
&rodsEnv::irodsDefaultNumberTransferThreads,
&rodsEnv::irodsTransBufferSizeForParaTrans,
&rodsEnv::irodsPluginHome))
&rodsEnv::irodsConnectionPoolRefreshTime,
&rodsEnv::irodsPluginHome,
&rodsEnv::tcp_keepalive_intvl,
&rodsEnv::tcp_keepalive_probes,
&rodsEnv::tcp_keepalive_time))
.add_property("rodsUserName", +[](rodsEnv *s) { return array_ref<char>{s->rodsUserName}; })
.add_property("rodsHost", +[](rodsEnv *s) { return array_ref<char>{s->rodsHost}; })
.add_property("rodsPort", &rodsEnv::rodsPort)
Expand Down Expand Up @@ -94,7 +98,11 @@ namespace irods::re::python::types
.add_property("irodsMaxSizeForSingleBuffer", &rodsEnv::irodsMaxSizeForSingleBuffer)
.add_property("irodsDefaultNumberTransferThreads", &rodsEnv::irodsDefaultNumberTransferThreads)
.add_property("irodsTransBufferSizeForParaTrans", &rodsEnv::irodsTransBufferSizeForParaTrans)
.add_property("irodsConnectionPoolRefreshTime", &rodsEnv::irodsConnectionPoolRefreshTime)
.add_property("irodsPluginHome", +[](rodsEnv *s) { return array_ref<char>{s->irodsPluginHome}; })
.add_property("tcp_keepalive_intvl", &rodsEnv::tcp_keepalive_intvl)
.add_property("tcp_keepalive_probes", &rodsEnv::tcp_keepalive_probes)
.add_property("tcp_keepalive_time", &rodsEnv::tcp_keepalive_time)
;
// clang-format on
}
Expand Down
8 changes: 6 additions & 2 deletions src/types/irods/rcConnect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ namespace irods::re::python::types
&rcComm_t::ssl_on,
&rcComm_t::ssl_ctx,
&rcComm_t::ssl,
&rcComm_t::fileRestart))
&rcComm_t::fileRestart,
&rcComm_t::session_signature))
.add_property("irodsProt", &rcComm_t::irodsProt)
.add_property("host", +[](rcComm_t *s) { return array_ref<char>{s->host}; })
.add_property("sock", &rcComm_t::sock)
Expand Down Expand Up @@ -212,6 +213,7 @@ namespace irods::re::python::types
// bp::make_getter(&rcComm_t::ssl, bp::return_internal_reference<1>{}),
// bp::make_setter(&rcComm_t::ssl, bp::with_custodian_and_ward<1, 2>{}))
.add_property("fileRestart", &rcComm_t::fileRestart)
.add_property("session_signature", +[](rcComm_t *s) { return array_ref<char>{s->session_signature}; })
;
// clang-format on
}
Expand Down Expand Up @@ -274,7 +276,8 @@ namespace irods::re::python::types
&rsComm_t::key_size,
&rsComm_t::salt_size,
&rsComm_t::num_hash_rounds,
&rsComm_t::encryption_algorithm))
&rsComm_t::encryption_algorithm,
&rsComm_t::session_props))
.add_property("irodsProt", &rsComm_t::irodsProt)
.add_property("sock", &rsComm_t::sock)
.add_property("connectCnt", &rsComm_t::connectCnt)
Expand Down Expand Up @@ -325,6 +328,7 @@ namespace irods::re::python::types
.add_property("salt_size", &rsComm_t::salt_size)
.add_property("num_hash_rounds", &rsComm_t::num_hash_rounds)
.add_property("encryption_algorithm", +[](rsComm_t *s) { return array_ref<char>{s->encryption_algorithm}; })
.add_property("session_props", &rsComm_t::session_props)
;
// clang-format on
}
Expand Down
8 changes: 7 additions & 1 deletion src/types/system/netinet/in.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,16 @@ namespace irods::re::python::types
.def("__init__", make_init_function<sockaddr_in>(
&sockaddr_in::sin_family,
&sockaddr_in::sin_port,
&sockaddr_in::sin_addr))
&sockaddr_in::sin_addr,
&sockaddr_in::sin_zero))
.add_property("sin_family", &sockaddr_in::sin_family)
.add_property("sin_port", &sockaddr_in::sin_port)
.add_property("sin_addr", &sockaddr_in::sin_addr)
// sin_zero is intentionally omitted here because the member is not part of the standard. It is included
// above in the list of members for sockaddr_in because all currently supported platforms include the
// sin_zero member. As such, the struct member is included for make_init_function, but it is not exposed
// as a property in the event that it must be removed in the future. For more information, see bwg2001-004
// here: http://www.opengroup.org/platform/resolutions/bwg2001-many.html
;
// clang-format on
}
Expand Down

0 comments on commit 9253546

Please sign in to comment.