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)  

sockComm.cpp File Reference
#include "sockComm.h"
#include "rcMisc.h"
#include "rcGlobalExtern.h"
#include "miscServerFunct.hpp"
#include "getHostForPut.h"
#include "getHostForGet.h"
#include "QUANTAnet_rbudpBase_c.h"
#include "rcConnect.h"
#include "rodsConnect.h"
#include <setjmp.h>
#include "irods_stacktrace.hpp"
#include "irods_client_server_negotiation.hpp"
#include "irods_network_plugin.hpp"
#include "irods_network_manager.hpp"
#include "irods_network_factory.hpp"
#include "irods_network_constants.hpp"
#include "irods_environment_properties.hpp"
#include "irods_server_properties.hpp"
#include "sockCommNetworkInterface.hpp"
#include "irods_random.hpp"
Include dependency graph for sockComm.cpp:

Go to the source code of this file.

Functions

irods::error sockClientStart (irods::network_object_ptr _ptr, rodsEnv *_env)
 
irods::error sockClientStop (irods::network_object_ptr _ptr, rodsEnv *_env)
 
irods::error sockAgentStart (irods::network_object_ptr _ptr)
 
irods::error sockAgentStop (irods::network_object_ptr _ptr)
 
irods::error readMsgHeader (irods::network_object_ptr _ptr, msgHeader_t *_header, struct timeval *_time_val)
 
irods::error readMsgBody (irods::network_object_ptr _ptr, msgHeader_t *_header, bytesBuf_t *_input_struct_buf, bytesBuf_t *_bs_buf, bytesBuf_t *_error_buf, irodsProt_t _protocol, struct timeval *_time_val)
 
int sockOpenForInConn (rsComm_t *rsComm, int *portNum, char **addr, int proto)
 
int rsAcceptConn (rsComm_t *svrComm)
 
irods::error writeMsgHeader (irods::network_object_ptr _ptr, msgHeader_t *_header)
 
irods::error readVersion (irods::network_object_ptr _ptr, version_t **_version)
 
int set_tcp_buffer_size (const int sock, const int tcp_buffer_size, const int socket_option_number)
 
int rodsSetSockOpt (int sock, int tcp_buffer_size)
 
int connectToRhostPortal (char *rodsHost, int rodsPort, int cookie, int windowSize)
 
int connectToRhost (rcComm_t *conn, int connectCnt, int reconnFlag)
 
int try_twice_to_create_socket (void)
 
int connectToRhostWithRaddr (struct sockaddr_in *remoteAddr, int windowSize, int timeoutFlag)
 
int create_nonblocking_socket (void)
 
int connectToRhostWithTout (struct sockaddr *sin)
 
int setConnAddr (rcComm_t *conn)
 
int setRemoteAddr (int sock, struct sockaddr_in *remoteAddr)
 
int setLocalAddr (int sock, struct sockaddr_in *localAddr)
 
int sendStartupPack (rcComm_t *conn, int connectCnt, int reconnFlag)
 
irods::error sendVersion (irods::network_object_ptr _ptr, int versionStatus, int reconnPort, char *reconnAddr, int cookie)
 
irods::error sendRodsMsg (irods::network_object_ptr _ptr, const char *_msg_type, bytesBuf_t *_msg_buf, bytesBuf_t *_bs_buf, bytesBuf_t *_error_buf, int _int_info, irodsProt_t _protocol)
 
int rodsSleep (int sec, int microSec)
 
irods::error readReconMsg (irods::network_object_ptr _ptr, reconnMsg_t **_msg)
 
irods::error sendReconnMsg (irods::network_object_ptr _ptr, reconnMsg_t *_msg)
 
int svrSwitchConnect (rsComm_t *rsComm)
 
int cliSwitchConnect (rcComm_t *conn)
 
int addUdpPortToPortList (portList_t *thisPortList, int udpport)
 
int getUdpPortFromPortList (portList_t *thisPortList)
 
int getTcpPortFromPortList (portList_t *thisPortList)
 
int addUdpSockToPortList (portList_t *thisPortList, int udpsock)
 
int getUdpSockFromPortList (portList_t *thisPortList)
 
int getTcpSockFromPortList (portList_t *thisPortList)
 
int isReadMsgError (int status)
 
int redirectConnToRescSvr (rcComm_t **conn, dataObjInp_t *dataObjInp, rodsEnv *myEnv, int reconnFlag)
 
int rcReconnect (rcComm_t **conn, char *newHost, rodsEnv *myEnv, int reconnFlag)
 
int mySockClose (int sock)
 

Variables

jmp_buf Jcenv
 

Function Documentation

◆ addUdpPortToPortList()

int addUdpPortToPortList ( portList_t thisPortList,
int  udpport 
)

Definition at line 1468 of file sockComm.cpp.

References portList_t::portNum.

Referenced by createSrvPortal().

◆ addUdpSockToPortList()

int addUdpSockToPortList ( portList_t thisPortList,
int  udpsock 
)

Definition at line 1487 of file sockComm.cpp.

References portList_t::sock.

Referenced by createSrvPortal().

◆ cliSwitchConnect()

int cliSwitchConnect ( rcComm_t conn)

Definition at line 1438 of file sockComm.cpp.

References rcComm_t::agentState, irods::error::code(), irods::log(), irods::network_factory(), irods::error::ok(), PASS, PROCESSING_STATE, RECEIVING_STATE, rcComm_t::reconnectedSock, sendReconnMsg(), and rcComm_t::sock.

Referenced by cliReconnManager(), readAndProcApiReply(), and sendApiRequest().

Here is the call graph for this function:

◆ connectToRhost()

◆ connectToRhostPortal()

int connectToRhostPortal ( char *  rodsHost,
int  rodsPort,
int  cookie,
int  windowSize 
)

Definition at line 655 of file sockComm.cpp.

References CLOSE_SOCK, connectToRhostWithRaddr(), LOG_ERROR, LOG_NOTICE, myWrite(), NULL, rodsLog(), setSockAddr(), irods.pypyodbc::status, and SYS_PORT_COOKIE_ERR.

Referenced by getFileFromPortal(), initRbudpClient(), putFileToPortal(), and remLocCopy().

Here is the call graph for this function:

◆ connectToRhostWithRaddr()

int connectToRhostWithRaddr ( struct sockaddr_in *  remoteAddr,
int  windowSize,
int  timeoutFlag 
)

Definition at line 810 of file sockComm.cpp.

References irods.pypyodbc::connect, connectToRhostWithTout(), rodsSetSockOpt(), irods.pypyodbc::status, try_twice_to_create_socket(), and USER_SOCK_CONNECT_ERR.

Referenced by cliReconnManager(), connectToRhost(), and connectToRhostPortal().

Here is the call graph for this function:

◆ connectToRhostWithTout()

int connectToRhostWithTout ( struct sockaddr *  sin)

Definition at line 902 of file sockComm.cpp.

References irods.pypyodbc::connect, CONNECT_TIMEOUT_TIME, create_nonblocking_socket(), int(), LOG_DEBUG, LOG_ERROR, LOG_NOTICE, MAX_CONN_RETRY_CNT, NULL, rodsLog(), irods.pypyodbc::status, USER_SOCK_CONNECT_ERR, and USER_SOCK_CONNECT_TIMEDOUT.

Referenced by connectToRhostWithRaddr().

Here is the call graph for this function:

◆ create_nonblocking_socket()

int create_nonblocking_socket ( void  )

Definition at line 879 of file sockComm.cpp.

References LOG_ERROR, NULL, rodsLog(), try_twice_to_create_socket(), and USER_SOCK_CONNECT_ERR.

Referenced by connectToRhostWithTout().

Here is the call graph for this function:

◆ getTcpPortFromPortList()

int getTcpPortFromPortList ( portList_t thisPortList)

Definition at line 1482 of file sockComm.cpp.

References portList_t::portNum.

Referenced by initRbudpClient(), and svrPortalPutGetRbudp().

◆ getTcpSockFromPortList()

int getTcpSockFromPortList ( portList_t thisPortList)

Definition at line 1501 of file sockComm.cpp.

References portList_t::sock.

Referenced by acceptSrvPortal(), svrPortalPutGet(), and svrPortalPutGetRbudp().

◆ getUdpPortFromPortList()

int getUdpPortFromPortList ( portList_t thisPortList)

◆ getUdpSockFromPortList()

int getUdpSockFromPortList ( portList_t thisPortList)

Definition at line 1494 of file sockComm.cpp.

References portList_t::sock.

Referenced by svrPortalPutGetRbudp().

◆ isReadMsgError()

int isReadMsgError ( int  status)

Definition at line 1506 of file sockComm.cpp.

References getIrodsErrno(), irods.pypyodbc::status, SYS_HEADER_READ_LEN_ERR, SYS_HEADER_WRITE_LEN_ERR, and SYS_READ_MSG_BODY_LEN_ERR.

Here is the call graph for this function:

◆ mySockClose()

int mySockClose ( int  sock)

◆ rcReconnect()

int rcReconnect ( rcComm_t **  conn,
char *  newHost,
rodsEnv myEnv,
int  reconnFlag 
)

Definition at line 1547 of file sockComm.cpp.

References clientLogin(), NULL, rcConnect(), rcDisconnect(), rodsEnv::rodsPort, rodsEnv::rodsUserName, rodsEnv::rodsZone, rErrMsg_t::status, and irods.pypyodbc::status.

Referenced by getUtil(), putUtil(), and redirectConnToRescSvr().

Here is the call graph for this function:

◆ readMsgBody()

irods::error readMsgBody ( irods::network_object_ptr  _ptr,
msgHeader_t _header,
bytesBuf_t _input_struct_buf,
bytesBuf_t _bs_buf,
bytesBuf_t _error_buf,
irodsProt_t  _protocol,
struct timeval *  _time_val 
)

Definition at line 236 of file sockComm.cpp.

References irods::error::code(), CODE, irods::NETWORK_INTERFACE(), irods::NETWORK_OP_READ_BODY(), irods::error::ok(), and PASSMSG.

Referenced by irods::read_client_server_negotiation_message(), readAndProcApiReply(), readAndProcClientMsg(), readReconMsg(), readStartupPack(), readVersion(), and ssl_agent_start().

Here is the call graph for this function:

◆ readMsgHeader()

irods::error readMsgHeader ( irods::network_object_ptr  _ptr,
msgHeader_t _header,
struct timeval *  _time_val 
)

Definition at line 173 of file sockComm.cpp.

References ERROR, MAX_NAME_LEN, irods::NETWORK_INTERFACE(), irods::NETWORK_OP_READ_HEADER(), irods::error::ok(), PASSMSG, RodsPackTable, irods.pypyodbc::status, SUCCESS, unpackStruct(), and XML_PROT.

Referenced by irods::read_client_server_negotiation_message(), readAndProcApiReply(), readAndProcClientMsg(), readReconMsg(), readStartupPack(), readVersion(), and ssl_agent_start().

Here is the call graph for this function:

◆ readReconMsg()

irods::error readReconMsg ( irods::network_object_ptr  _ptr,
reconnMsg_t **  _msg 
)

Definition at line 1276 of file sockComm.cpp.

References msgHeader::bsLen, BytesBuf::buf, clearBBuf(), CODE, ERROR, msgHeader::errorLen, LOG_NOTICE, msgHeader::msgLen, NULL, irods::error::ok(), PASS, PASSMSG, readMsgBody(), readMsgHeader(), RODS_CONNECT_T, RODS_RECONNECT_T, rodsLog(), rodsLogError(), RodsPackTable, irods.pypyodbc::status, SYS_HEADER_READ_LEN_ERR, SYS_HEADER_TYPE_LEN_ERR, msgHeader::type, unpackStruct(), and XML_PROT.

Referenced by cliReconnManager(), and reconnManager().

Here is the call graph for this function:

◆ readVersion()

irods::error readVersion ( irods::network_object_ptr  _ptr,
version_t **  _version 
)

Definition at line 484 of file sockComm.cpp.

References msgHeader::bsLen, BytesBuf::buf, CODE, ERROR, msgHeader::errorLen, LOG_NOTICE, msgHeader::msgLen, NULL, irods::error::ok(), PASS, READ_VERSION_TOUT_SEC, readMsgBody(), readMsgHeader(), RODS_VERSION_T, rodsLog(), rodsLogError(), RodsPackTable, irods.pypyodbc::status, SYS_HEADER_READ_LEN_ERR, SYS_HEADER_TYPE_LEN_ERR, msgHeader::type, unpackStruct(), and XML_PROT.

Referenced by connectToRhost().

Here is the call graph for this function:

◆ redirectConnToRescSvr()

int redirectConnToRescSvr ( rcComm_t **  conn,
dataObjInp_t dataObjInp,
rodsEnv myEnv,
int  reconnFlag 
)

Definition at line 1520 of file sockComm.cpp.

References GET_OPR, LOG_NOTICE, NULL, DataObjInp::oprType, PUT_OPR, rcGetHostForGet(), rcGetHostForPut(), rcReconnect(), rodsLog(), irods.pypyodbc::status, and THIS_ADDRESS.

Referenced by getCollUtil(), and putDirUtil().

Here is the call graph for this function:

◆ rodsSetSockOpt()

int rodsSetSockOpt ( int  sock,
int  tcp_buffer_size 
)

Definition at line 598 of file sockComm.cpp.

References LOG_ERROR, rodsLog(), set_tcp_buffer_size(), and irods.pypyodbc::status.

Referenced by acceptSrvPortal(), connectToRhostWithRaddr(), rsAcceptConn(), and sockOpenForInConn().

Here is the call graph for this function:

◆ rodsSleep()

int rodsSleep ( int  sec,
int  microSec 
)

Definition at line 1270 of file sockComm.cpp.

Referenced by cliReconnManager(), msiSleep(), purgeLockFileWorkerTask(), and serverMain().

◆ rsAcceptConn()

int rsAcceptConn ( rsComm_t svrComm)

Definition at line 407 of file sockComm.cpp.

References LOG_NOTICE, rsComm_t::remoteAddr, rodsLogError(), rodsSetSockOpt(), rsComm_t::sock, irods.pypyodbc::status, SYS_SOCK_ACCEPT_ERR, and rsComm_t::windowSize.

Referenced by serverMain(), and xmsgServerMain().

Here is the call graph for this function:

◆ sendReconnMsg()

irods::error sendReconnMsg ( irods::network_object_ptr  _ptr,
reconnMsg_t _msg 
)

Definition at line 1366 of file sockComm.cpp.

References CODE, ERROR, freeBBuf(), LOG_ERROR, NULL, irods::error::ok(), packStruct(), RODS_RECONNECT_T, rodsLogError(), RodsPackTable, sendRodsMsg(), irods.pypyodbc::status, USER__NULL_INPUT_ERR, and XML_PROT.

Referenced by cliReconnManager(), cliSwitchConnect(), reconnManager(), and svrSwitchConnect().

Here is the call graph for this function:

◆ sendRodsMsg()

irods::error sendRodsMsg ( irods::network_object_ptr  _ptr,
const char *  _msg_type,
bytesBuf_t _msg_buf,
bytesBuf_t _bs_buf,
bytesBuf_t _error_buf,
int  _int_info,
irodsProt_t  _protocol 
)

Definition at line 1221 of file sockComm.cpp.

References irods::error::code(), CODE, int(), irods::NETWORK_INTERFACE(), irods::NETWORK_OP_WRITE_BODY(), irods::error::ok(), PASSMSG, and SUCCESS.

Referenced by rcDisconnect(), rsApiHandler(), irods::send_client_server_negotiation_message(), sendApiReply(), sendApiRequest(), sendReconnMsg(), sendStartupPack(), sendVersion(), and ssl_client_start().

Here is the call graph for this function:

◆ sendStartupPack()

◆ sendVersion()

irods::error sendVersion ( irods::network_object_ptr  _ptr,
int  versionStatus,
int  reconnPort,
char *  reconnAddr,
int  cookie 
)

◆ set_tcp_buffer_size()

int set_tcp_buffer_size ( const int  sock,
const int  tcp_buffer_size,
const int  socket_option_number 
)

Definition at line 575 of file sockComm.cpp.

References LOG_ERROR, rodsLog(), irods.pypyodbc::status, and SYS_INTERNAL_NULL_INPUT_ERR.

Referenced by rodsSetSockOpt().

Here is the call graph for this function:

◆ setConnAddr()

int setConnAddr ( rcComm_t conn)

Definition at line 1015 of file sockComm.cpp.

References rcComm_t::localAddr, rcComm_t::remoteAddr, setLocalAddr(), setRemoteAddr(), and rcComm_t::sock.

Referenced by connectToRhost().

Here is the call graph for this function:

◆ setLocalAddr()

int setLocalAddr ( int  sock,
struct sockaddr_in *  localAddr 
)

Definition at line 1057 of file sockComm.cpp.

References LOG_NOTICE, rodsLog(), and USER_RODS_HOSTNAME_ERR.

Referenced by initRbudpClient(), initRsCommWithStartupPack(), and setConnAddr().

Here is the call graph for this function:

◆ setRemoteAddr()

int setRemoteAddr ( int  sock,
struct sockaddr_in *  remoteAddr 
)

Definition at line 1034 of file sockComm.cpp.

References LOG_NOTICE, rodsLog(), and USER_RODS_HOSTNAME_ERR.

Referenced by initRsCommWithStartupPack(), and setConnAddr().

Here is the call graph for this function:

◆ sockAgentStart()

irods::error sockAgentStart ( irods::network_object_ptr  _ptr)

Definition at line 113 of file sockComm.cpp.

References irods::error::code(), CODE, irods::NETWORK_INTERFACE(), irods::NETWORK_OP_AGENT_START(), irods::error::ok(), and PASSMSG.

Here is the call graph for this function:

◆ sockAgentStop()

irods::error sockAgentStop ( irods::network_object_ptr  _ptr)

Definition at line 144 of file sockComm.cpp.

References irods::error::code(), CODE, irods::NETWORK_INTERFACE(), irods::NETWORK_OP_AGENT_STOP(), irods::error::ok(), and PASSMSG.

Here is the call graph for this function:

◆ sockClientStart()

irods::error sockClientStart ( irods::network_object_ptr  _ptr,
rodsEnv _env 
)

Definition at line 47 of file sockComm.cpp.

References irods::error::code(), CODE, irods::NETWORK_INTERFACE(), irods::NETWORK_OP_CLIENT_START(), irods::error::ok(), and PASSMSG.

Referenced by connectToRhost().

Here is the call graph for this function:

◆ sockClientStop()

irods::error sockClientStop ( irods::network_object_ptr  _ptr,
rodsEnv _env 
)

Definition at line 80 of file sockComm.cpp.

References irods::error::code(), CODE, irods::NETWORK_INTERFACE(), irods::NETWORK_OP_CLIENT_STOP(), irods::error::ok(), and PASSMSG.

Referenced by rcDisconnect().

Here is the call graph for this function:

◆ sockOpenForInConn()

int sockOpenForInConn ( rsComm_t rsComm,
int portNum,
char **  addr,
int  proto 
)

◆ svrSwitchConnect()

int svrSwitchConnect ( rsComm_t rsComm)

Definition at line 1408 of file sockComm.cpp.

References rsComm_t::clientState, irods::error::code(), irods::log(), LOG_NOTICE, irods::network_factory(), irods::error::ok(), PASS, PROCESSING_STATE, RECEIVING_STATE, rsComm_t::reconnectedSock, rodsLog(), sendReconnMsg(), and rsComm_t::sock.

Referenced by readAndProcClientMsg(), reconnManager(), sendApiReply(), svrChkReconnAtReadStart(), and svrChkReconnAtSendStart().

Here is the call graph for this function:

◆ try_twice_to_create_socket()

int try_twice_to_create_socket ( void  )

Definition at line 795 of file sockComm.cpp.

References LOG_ERROR, rodsLog(), and USER_SOCK_OPEN_ERR.

Referenced by connectToRhostWithRaddr(), and create_nonblocking_socket().

Here is the call graph for this function:

◆ writeMsgHeader()

irods::error writeMsgHeader ( irods::network_object_ptr  _ptr,
msgHeader_t _header 
)

Definition at line 435 of file sockComm.cpp.

References ERROR, freeBBuf(), irods::NETWORK_INTERFACE(), irods::NETWORK_OP_WRITE_HEADER(), irods::error::ok(), packStruct(), PASS, PASSMSG, RodsPackTable, irods.pypyodbc::status, SUCCESS, and XML_PROT.

Referenced by ssl_client_start(), ssl_send_rods_msg(), and tcp_send_rods_msg().

Here is the call graph for this function:

Variable Documentation

◆ Jcenv

jmp_buf Jcenv

Definition at line 29 of file sockComm.cpp.