irods  4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.
  Fossies Dox: irods-4.2.8.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

rsGetMiscSvrInfo.cpp
Go to the documentation of this file.
1 
3 /* rsGetMiscSvrInfo.c - server routine that handles the the GetMiscSvrInfo
4  * API
5  */
6 
7 /* script generated code */
8 #include "getMiscSvrInfo.h"
10 #include "irods_log.hpp"
11 #include "rodsVersion.h"
12 #include "miscServerFunct.hpp"
13 #include "rsGetMiscSvrInfo.hpp"
14 
15 int
16 rsGetMiscSvrInfo( rsComm_t *rsComm, miscSvrInfo_t **outSvrInfo ) {
17  if ( !rsComm || !outSvrInfo ) {
19  }
20 
21  miscSvrInfo_t *myOutSvrInfo;
22  char *tmpStr;
23 
24  myOutSvrInfo = *outSvrInfo = ( miscSvrInfo_t* )malloc( sizeof( miscSvrInfo_t ) );
25 
26  memset( myOutSvrInfo, 0, sizeof( miscSvrInfo_t ) );
27 
28  std::string svc_role;
29  irods::error ret = get_catalog_service_role(svc_role);
30  if(!ret.ok()) {
31  irods::log(PASS(ret));
32  return ret.code();
33  }
34 
35  if( irods::CFG_SERVICE_ROLE_PROVIDER == svc_role ) {
36  myOutSvrInfo->serverType = RCAT_ENABLED;
37  } else if( irods::CFG_SERVICE_ROLE_CONSUMER == svc_role ) {
38  myOutSvrInfo->serverType = RCAT_NOT_ENABLED;
39  } else {
40  rodsLog(
41  LOG_ERROR,
42  "role not supported [%s]",
43  svc_role.c_str() );
45  }
46 
47  rstrcpy( myOutSvrInfo->relVersion, RODS_REL_VERSION, NAME_LEN );
48  rstrcpy( myOutSvrInfo->apiVersion, RODS_API_VERSION, NAME_LEN );
49 
50  const auto& zone_name = irods::get_server_property<const std::string>(irods::CFG_ZONE_NAME);
51  if ( !ret.ok() ) {
52  irods::log( PASS( ret ) );
53  return ret.code();
54 
55  }
56 
57  snprintf( myOutSvrInfo->rodsZone, NAME_LEN, "%s", zone_name.c_str() );
58  if ( ( tmpStr = getenv( SERVER_BOOT_TIME ) ) != NULL ) {
59  myOutSvrInfo->serverBootTime = atoi( tmpStr );
60  }
61 
62  return 0;
63 }
rodsLog
void rodsLog(int level, const char *formatStr,...)
Definition: rodsLog.cpp:86
NULL
#define NULL
Definition: rodsDef.h:70
rsComm_t
Definition: rcConnect.h:145
irods::CFG_SERVICE_ROLE_CONSUMER
const std::string CFG_SERVICE_ROLE_CONSUMER("consumer")
MiscSvrInfo::rodsZone
char rodsZone[64]
Definition: getMiscSvrInfo.h:18
SYS_SERVICE_ROLE_NOT_SUPPORTED
@ SYS_SERVICE_ROLE_NOT_SUPPORTED
Definition: rodsErrorTable.h:217
RCAT_NOT_ENABLED
#define RCAT_NOT_ENABLED
Definition: getMiscSvrInfo.h:10
irods_server_properties.hpp
PASS
#define PASS(prev_error_)
Definition: irods_error.hpp:118
rsGetMiscSvrInfo
int rsGetMiscSvrInfo(rsComm_t *rsComm, miscSvrInfo_t **outSvrInfo)
Definition: rsGetMiscSvrInfo.cpp:16
MiscSvrInfo::serverType
int serverType
Definition: getMiscSvrInfo.h:14
manual_cleanup.zone_name
zone_name
Definition: manual_cleanup.py:16
LOG_ERROR
#define LOG_ERROR
Definition: rodsLog.h:43
SYS_INVALID_INPUT_PARAM
@ SYS_INVALID_INPUT_PARAM
Definition: rodsErrorTable.h:195
getMiscSvrInfo.h
irods::error::code
long long code() const
Definition: irods_error.cpp:194
irods::CFG_SERVICE_ROLE_PROVIDER
const std::string CFG_SERVICE_ROLE_PROVIDER("provider")
rsGetMiscSvrInfo.hpp
SERVER_BOOT_TIME
#define SERVER_BOOT_TIME
Definition: rodsDef.h:267
MiscSvrInfo::apiVersion
char apiVersion[64]
Definition: getMiscSvrInfo.h:17
RCAT_ENABLED
#define RCAT_ENABLED
Definition: getMiscSvrInfo.h:11
irods::log
void log(const error &)
Definition: irods_log.cpp:13
irods::error
Definition: irods_error.hpp:23
miscServerFunct.hpp
get_catalog_service_role
irods::error get_catalog_service_role(std::string &_role)
Definition: miscServerFunct.cpp:3153
MiscSvrInfo::relVersion
char relVersion[64]
Definition: getMiscSvrInfo.h:16
irods::CFG_ZONE_NAME
const std::string CFG_ZONE_NAME("zone_name")
rstrcpy
char * rstrcpy(char *dest, const char *src, int maxLen)
Definition: stringOpr.cpp:51
NAME_LEN
#define NAME_LEN
Definition: rodsDef.h:55
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
MiscSvrInfo
Definition: getMiscSvrInfo.h:13
MiscSvrInfo::serverBootTime
uint serverBootTime
Definition: getMiscSvrInfo.h:15
irods_log.hpp