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
Go to the documentation of this file.
1 
3 /* sockComm.c - sock communication routines
4  */
5 
6 #include "sockComm.h"
7 #include "rcMisc.h"
8 #include "rcGlobalExtern.h"
9 #include "miscServerFunct.hpp"
10 #include "getHostForPut.h"
11 #include "getHostForGet.h"
12 #include "QUANTAnet_rbudpBase_c.h"
13 #include "rcConnect.h"
14 #include "rodsConnect.h"
15 
16 #ifdef windows_platform
17 #include "irodsntutil.hpp"
18 #endif
19 
20 #ifdef _WIN32
21 #include <mmsystem.h>
22 int win_connect_timeout;
23 MMRESULT win_connect_timer_id;
24 #endif
25 
26 #ifndef _WIN32
27 
28 #include <setjmp.h>
29 jmp_buf Jcenv;
30 
31 #endif /* _WIN32 */
32 
33 // =-=-=-=-=-=-=-
34 #include "irods_stacktrace.hpp"
36 #include "irods_network_plugin.hpp"
43 #include "irods_random.hpp"
44 
45 // =-=-=-=-=-=-=-
46 //
49  rodsEnv* _env ) {
50  // =-=-=-=-=-=-=-
51  // resolve a network interface plugin from the
52  // network object
53  irods::plugin_ptr p_ptr;
54  irods::error ret_err = _ptr->resolve( irods::NETWORK_INTERFACE, p_ptr );
55  if ( !ret_err.ok() ) {
56  return PASSMSG( "failed to resolve network interface", ret_err );
57 
58  }
59 
60  // =-=-=-=-=-=-=-
61  // make the call to the "read" interface
62  irods::network_ptr net = boost::dynamic_pointer_cast< irods::network >( p_ptr );
63  ret_err = net->call< rodsEnv* >( nullptr, irods::NETWORK_OP_CLIENT_START, _ptr, _env );
64 
65  // =-=-=-=-=-=-=-
66  // pass along an error from the interface or return SUCCESS
67  if ( !ret_err.ok() ) {
68  return PASSMSG( "failed to call 'client start'", ret_err );
69 
70  }
71  else {
72  return CODE( ret_err.code() );
73 
74  }
75 
76 } // sockClientStart
77 
78 // =-=-=-=-=-=-=-
79 //
82  rodsEnv* _env ) {
83  // =-=-=-=-=-=-=-
84  // resolve a network interface plugin from the
85  // network object
86  irods::plugin_ptr p_ptr;
87  irods::error ret_err = _ptr->resolve( irods::NETWORK_INTERFACE, p_ptr );
88  if ( !ret_err.ok() ) {
89  return PASSMSG( "failed to resolve network interface", ret_err );
90 
91  }
92 
93  // =-=-=-=-=-=-=-
94  // make the call to the "read" interface
95  irods::network_ptr net = boost::dynamic_pointer_cast< irods::network >( p_ptr );
96  ret_err = net->call< rodsEnv* >( nullptr, irods::NETWORK_OP_CLIENT_STOP, _ptr, _env );
97 
98  // =-=-=-=-=-=-=-
99  // pass along an error from the interface or return SUCCESS
100  if ( !ret_err.ok() ) {
101  return PASSMSG( "failed to call 'client stop'", ret_err );
102 
103  }
104  else {
105  return CODE( ret_err.code() );
106 
107  }
108 
109 } // sockClientStop
110 
111 // =-=-=-=-=-=-=-
112 //
115  // =-=-=-=-=-=-=-
116  // resolve a network interface plugin from the
117  // network object
118  irods::plugin_ptr p_ptr;
119  irods::error ret_err = _ptr->resolve( irods::NETWORK_INTERFACE, p_ptr );
120  if ( !ret_err.ok() ) {
121  return PASSMSG( "failed to resolve network interface", ret_err );
122  }
123 
124  // =-=-=-=-=-=-=-
125  // make the call to the "read" interface
126  irods::network_ptr net = boost::dynamic_pointer_cast< irods::network >( p_ptr );
127  ret_err = net->call( nullptr, irods::NETWORK_OP_AGENT_START, _ptr );
128 
129  // =-=-=-=-=-=-=-
130  // pass along an error from the interface or return SUCCESS
131  if ( !ret_err.ok() ) {
132  return PASSMSG( "failed to call 'agent start'", ret_err );
133 
134  }
135  else {
136  return CODE( ret_err.code() );
137 
138  }
139 
140 } // sockAgentStart
141 
142 // =-=-=-=-=-=-=-
143 //
146  // =-=-=-=-=-=-=-
147  // resolve a network interface plugin from the
148  // network object
149  irods::plugin_ptr p_ptr;
150  irods::error ret_err = _ptr->resolve( irods::NETWORK_INTERFACE, p_ptr );
151  if ( !ret_err.ok() ) {
152  return PASSMSG( "failed to resolve network interface", ret_err );
153  }
154 
155  // =-=-=-=-=-=-=-
156  // make the call to the "read" interface
157  irods::network_ptr net = boost::dynamic_pointer_cast< irods::network >( p_ptr );
158  ret_err = net->call( nullptr, irods::NETWORK_OP_AGENT_STOP, _ptr );
159 
160  // =-=-=-=-=-=-=-
161  // pass along an error from the interface or return SUCCESS
162  if ( !ret_err.ok() ) {
163  return PASSMSG( "failed to call 'agent stop'", ret_err );
164  }
165  else {
166  return CODE( ret_err.code() );
167  }
168 
169 } // sockAgentStop
170 
171 // =-=-=-=-=-=-=-
172 //
175  msgHeader_t* _header,
176  struct timeval* _time_val ) {
177  // =-=-=-=-=-=-=-
178  // resolve a network interface plugin from the
179  // network object
180  irods::plugin_ptr p_ptr;
181  irods::error ret_err = _ptr->resolve( irods::NETWORK_INTERFACE, p_ptr );
182  if ( !ret_err.ok() ) {
183  return PASSMSG( "failed to resolve network interface", ret_err );
184  }
185 
186  // =-=-=-=-=-=-=-
187  // make the call to the "read" interface
188  char tmp_buf[ MAX_NAME_LEN ];
189  irods::first_class_object_ptr ptr = boost::dynamic_pointer_cast< irods::first_class_object >( _ptr );
190  irods::network_ptr net = boost::dynamic_pointer_cast< irods::network >( p_ptr );
191  ret_err = net->call< void*, struct timeval* >(
192  nullptr,
194  ptr,
195  tmp_buf,
196  _time_val );
197 
198  // =-=-=-=-=-=-=-
199  // pass along an error from the interface or return SUCCESS
200  if ( !ret_err.ok() ) {
201  return PASSMSG( "failed to call 'read header'", ret_err );
202  }
203 
204  // =-=-=-=-=-=-=-
205  // unpack the header message, always use XML_PROT for the header
206  msgHeader_t* out_header = 0;
207  int status = unpackStruct(
208  static_cast<void*>( tmp_buf ),
209  ( void ** )( static_cast< void * >( &out_header ) ),
210  "MsgHeader_PI",
212  XML_PROT );
213  if ( status < 0 ) {
214  return ERROR( status, "unpackStruct error" );
215  }
216 
217  if ( !out_header ) {
218  return ERROR( -1, "" );
219  }
220 
221  // =-=-=-=-=-=-=-
222  // need to do an assignment due to something potentially going out
223  // of scope from unpackStruct.
224  // NOTE :: look into why this is necessary
225  *_header = *out_header;
226  free( out_header );
227 
228  // =-=-=-=-=-=-=-
229  // win!
230  return SUCCESS();
231 
232 } // readMsgHeader
233 
234 // =-=-=-=-=-=-=-
235 //
238  msgHeader_t* _header,
239  bytesBuf_t* _input_struct_buf,
240  bytesBuf_t* _bs_buf,
241  bytesBuf_t* _error_buf,
242  irodsProt_t _protocol,
243  struct timeval* _time_val ) {
244  // =-=-=-=-=-=-=-
245  // resolve a network interface plugin from the
246  // network object
247  irods::plugin_ptr p_ptr;
248  irods::error ret_err = _ptr->resolve( irods::NETWORK_INTERFACE, p_ptr );
249  if ( !ret_err.ok() ) {
250  return PASSMSG( "failed to resolve network interface", ret_err );
251 
252  }
253 
254  // =-=-=-=-=-=-=-
255  // make the call to the "read" interface
256  irods::first_class_object_ptr ptr = boost::dynamic_pointer_cast< irods::first_class_object >( _ptr );
257  irods::network_ptr net = boost::dynamic_pointer_cast< irods::network >( p_ptr );
258  ret_err = net->call < msgHeader_t*,
259  bytesBuf_t*,
260  bytesBuf_t*,
261  bytesBuf_t*,
262  irodsProt_t,
263  struct timeval* > (
264  nullptr,
266  ptr,
267  _header,
268  _input_struct_buf,
269  _bs_buf,
270  _error_buf,
271  _protocol,
272  _time_val );
273  // =-=-=-=-=-=-=-
274  // pass along an error from the interface or return SUCCESS
275  if ( !ret_err.ok() ) {
276  return PASSMSG( "failed to call 'read message body'", ret_err );
277 
278  }
279  else {
280  return CODE( ret_err.code() );
281 
282  }
283 
284 } // readMsgBody
285 
286 
287 /* open sock for incoming connection */
288 int
289 sockOpenForInConn( rsComm_t *rsComm, int *portNum, char **addr, int proto ) {
290  int status = 0;
291 
292  if ( proto != SOCK_DGRAM && proto != SOCK_STREAM ) {
294  "sockOpenForInConn() -- invalid input protocol %d", proto );
296  }
297 
298  struct sockaddr_in mySockAddr;
299  memset( ( char * ) &mySockAddr, 0, sizeof mySockAddr );
300 
301  const int sock = socket( AF_INET, proto, 0 );
302 
303  if ( sock < 0 ) {
304  status = SYS_SOCK_OPEN_ERR - errno;
306  "sockOpenForInConn: open socket error." );
307  return status;
308  }
309 
310  /* For SOCK_DGRAM, done in checkbuf */
311  if ( proto == SOCK_STREAM ) {
312  rodsSetSockOpt( sock, rsComm->windowSize );
313  }
314 
315  mySockAddr.sin_family = AF_INET;
316  mySockAddr.sin_addr.s_addr = htonl( INADDR_ANY );
317 
318  /* if portNum is <= 0 and server_port_range_start is set in
319  * server_config.json pick a port in the range.
320  */
321 
322  boost::optional<int> svr_port_range_start_wrapper;
323  try {
324  svr_port_range_start_wrapper.reset(irods::get_server_property<const int>(irods::CFG_SERVER_PORT_RANGE_START_KW));
325  } catch ( const irods::exception& ) {}
326  if ( *portNum <= 0 && svr_port_range_start_wrapper ) {
327  int svr_port_range_start = *svr_port_range_start_wrapper;
328  if ( svr_port_range_start < 1 || svr_port_range_start > 65535 ) {
329  rodsLog( LOG_ERROR, "port %d not in between 1 and 65535, inclusive.", svr_port_range_start );
330  close( sock );
332  }
333 
334  int svr_port_range_end;
335  try {
336  svr_port_range_end = irods::get_server_property<const int>(irods::CFG_SERVER_PORT_RANGE_END_KW);
337  if ( svr_port_range_end < svr_port_range_start ) {
339  "sockOpenForInConn: PortRangeStart %d > PortRangeEnd %d",
340  svr_port_range_start, svr_port_range_end );
341  svr_port_range_end = svr_port_range_start + DEF_NUMBER_SVR_PORT - 1;
342  }
343  if ( svr_port_range_end > 65535 ) {
345  "sockOpenForInConn: PortRangeEnd %d > 65535",
346  svr_port_range_start, svr_port_range_end );
347  svr_port_range_end = 65535;
348  }
349  } catch (irods::exception& e ) {
350  svr_port_range_end = svr_port_range_start + DEF_NUMBER_SVR_PORT - 1;
351  }
352  svr_port_range_end = svr_port_range_end < 65535 ? svr_port_range_end : 65535;
353  int portRangeCount = svr_port_range_end - svr_port_range_start + 1;
354 
355  int myPortNum = svr_port_range_start + irods::getRandom<unsigned int>() % portRangeCount;
356  int bindCnt = 0;
357  while ( bindCnt < portRangeCount ) {
358  if ( myPortNum > svr_port_range_end ) {
359  myPortNum = svr_port_range_start;
360  }
361  mySockAddr.sin_port = htons( myPortNum );
362 
363  if ( ( status = bind( sock, ( struct sockaddr * ) &mySockAddr,
364  sizeof mySockAddr ) ) >= 0 ) {
365  *portNum = myPortNum;
367  "sockOpenForInConn: port number = %d", myPortNum );
368  break;
369  }
370  bindCnt ++;
371  myPortNum ++;
372  }
373  if ( bindCnt >= portRangeCount ) {
376  "port range exhausted, errno = %d",
377  errno );
378  }
379 
380  }
381  else {
382  mySockAddr.sin_port = htons( *portNum );
383  status = bind( sock, ( struct sockaddr * ) &mySockAddr,
384  sizeof mySockAddr );
385  }
386 
387  if ( status < 0 ) {
388  status = SYS_SOCK_BIND_ERR - errno;
390  "sockOpenForInConn: bind socket error. portNum = %d, errno = %d",
391  *portNum, errno );
392  close( sock );
393  return status;
394  }
395 
396  if ( addr != NULL ) {
397  *addr = ( char * )malloc( sizeof( char ) * LONG_NAME_LEN );
398  gethostname( *addr, LONG_NAME_LEN );
399  }
400 
401  return sock;
402 }
403 
404 /* rsAcceptConn - Server accept connection */
405 
406 int
407 rsAcceptConn( rsComm_t *svrComm ) {
408  socklen_t len = sizeof( svrComm->remoteAddr );
409 
410  const int saved_socket_flags = fcntl( svrComm->sock, F_GETFL );
411  int status = fcntl( svrComm->sock, F_SETFL, saved_socket_flags | O_NONBLOCK );
412  if ( status < 0 ) {
413  rodsLogError( LOG_NOTICE, status, "failed to set flags with nonblock on fnctl" );
414  }
415  const int newSock = accept( svrComm->sock, ( struct sockaddr * ) &svrComm->remoteAddr, &len );
416  status = fcntl( svrComm->sock, F_SETFL, saved_socket_flags );
417  if ( status < 0 ) {
418  rodsLogError( LOG_NOTICE, status, "failed to revert flags on fnctl" );
419  }
420 
421  if ( newSock < 0 ) {
422  const int status = SYS_SOCK_ACCEPT_ERR - errno;
424  "rsAcceptConn: accept error for socket %d",
425  svrComm->sock );
426  return newSock;
427  }
428  rodsSetSockOpt( newSock, svrComm->windowSize );
429 
430  return newSock;
431 }
432 
433 // =-=-=-=-=-=-=-
434 //
437  msgHeader_t* _header ) {
438  // =-=-=-=-=-=-=-
439  // always use XML_PROT for the Header
440  bytesBuf_t* header_buf = 0;
441  int status = packStruct(
442  static_cast<void *>( _header ),
443  &header_buf,
444  "MsgHeader_PI",
446  0, XML_PROT );
447  if ( status < 0 ||
448  0 == header_buf ) {
449  return ERROR( status, "packstruct error" );
450  }
451 
452  // =-=-=-=-=-=-=-
453  // resolve a network interface plugin from the
454  // network object
455  irods::plugin_ptr p_ptr;
456  irods::error ret = _ptr->resolve( irods::NETWORK_INTERFACE, p_ptr );
457  if ( !ret.ok() ) {
458  freeBBuf( header_buf );
459  return PASSMSG( "failed to resolve network interface", ret );
460  }
461 
462  // =-=-=-=-=-=-=-
463  // make the call to the plugin interface
464  irods::first_class_object_ptr ptr = boost::dynamic_pointer_cast< irods::first_class_object >( _ptr );
465  irods::network_ptr net = boost::dynamic_pointer_cast< irods::network >( p_ptr );
466  ret = net->call< bytesBuf_t* >(
467  nullptr,
469  ptr,
470  header_buf );
471 
472  freeBBuf( header_buf );
473 
474  if ( !ret.ok() ) {
475  return PASS( ret );
476  }
477 
478  return SUCCESS();
479 
480 } // writeMsgHeader
481 
482 // =-=-=-=-=-=-=-
483 //
486  version_t** _version ) {
487  // =-=-=-=-=-=-=-
488  // init timval struct for header call
489  struct timeval tv;
490  tv.tv_sec = READ_VERSION_TOUT_SEC;
491  tv.tv_usec = 0;
492 
493  // =-=-=-=-=-=-=-
494  // call interface to read message header
495  msgHeader_t myHeader;
496  memset( &myHeader, 0, sizeof( myHeader ) );
497  irods::error ret = readMsgHeader( _ptr, &myHeader, &tv );
498  if ( !ret.ok() ) {
499  return PASS( ret );
500  }
501 
502  // =-=-=-=-=-=-=-
503  // call interface to read message body
504  bytesBuf_t inputStructBBuf, bsBBuf, errorBBuf;
505  memset( &inputStructBBuf, 0, sizeof( inputStructBBuf ) );
506  memset( &bsBBuf, 0, sizeof( bsBBuf ) );
507  memset( &errorBBuf, 0, sizeof( errorBBuf ) );
508  ret = readMsgBody( _ptr, &myHeader, &inputStructBBuf, &bsBBuf,
509  &errorBBuf, XML_PROT, NULL );
510  if ( !ret.ok() ) {
511  return PASS( ret );
512  }
513 
514  // =-=-=-=-=-=-=-
515  // basic error checking of message type
516  if ( strcmp( myHeader.type, RODS_VERSION_T ) != 0 ) {
517  free( inputStructBBuf.buf );
518  free( bsBBuf.buf );
519  free( errorBBuf.buf );
520  std::stringstream msg;
521  msg << "wrong msg type ["
522  << myHeader.type
523  << " expected ["
524  << RODS_VERSION_T
525  << "]";
526  return ERROR( SYS_HEADER_TYPE_LEN_ERR, msg.str() );
527  }
528 
529  // =-=-=-=-=-=-=-
530  // check length of byte stream buffer, should be 0
531  if ( myHeader.bsLen != 0 ) {
532  free( bsBBuf.buf );
533  rodsLog( LOG_NOTICE, "readVersion: myHeader.bsLen = %d is not 0",
534  myHeader.bsLen );
535  }
536 
537  // =-=-=-=-=-=-=-
538  // check length of error buffer, should be 0
539  if ( myHeader.errorLen != 0 ) {
540  free( errorBBuf.buf );
541  rodsLog( LOG_NOTICE, "readVersion: myHeader.errorLen = %d is not 0",
542  myHeader.errorLen );
543  }
544 
545  // =-=-=-=-=-=-=-
546  // bounds check message size
547  if ( myHeader.msgLen > ( int ) sizeof( version_t ) * 2 || myHeader.msgLen <= 0 ) {
548  free( inputStructBBuf.buf );
549  std::stringstream msg;
550  msg << "header length is not within bounds: "
551  << myHeader.msgLen;
552  return ERROR( SYS_HEADER_READ_LEN_ERR, msg.str() );
553  }
554 
555  // =-=-=-=-=-=-=-
556  // unpack the message, always use XML for this message type
557  int status = unpackStruct(
558  inputStructBBuf.buf,
559  ( void** )( _version ),
560  "Version_PI",
562  XML_PROT );
563  free( inputStructBBuf.buf );
564  if ( status < 0 ) {
566  "readVersion:unpackStruct error." );
567  }
568 
569  return CODE( status );
570 
571 } // readVersion
572 
573 
574 
575 int set_tcp_buffer_size(const int sock, const int tcp_buffer_size, const int socket_option_number) {
576  int status = setsockopt(sock, SOL_SOCKET, socket_option_number, &tcp_buffer_size, sizeof(tcp_buffer_size));
577  if (status < 0) {
578  rodsLog(LOG_ERROR, "set_tcp_buffer_size: failed to set socket option %d to %d, errno %d", socket_option_number, tcp_buffer_size, errno);
579  return status;
580  }
581 
582  int getsockopt_return_value;
583  unsigned int getsockopt_return_value_len = sizeof(getsockopt_return_value);
584  status = getsockopt(sock, SOL_SOCKET, socket_option_number, &getsockopt_return_value, &getsockopt_return_value_len); // getsockopt SO_{SND,RCV}BUF return is doubled, as it includes OS overhead
585  if (status < 0) {
586  rodsLog(LOG_ERROR, "set_tcp_buffer_size: failed to get option %d errno %d", socket_option_number, errno);
587  return status;
588  }
589 
590  if (getsockopt_return_value/2 != tcp_buffer_size) {
591  rodsLog(LOG_ERROR, "set_tcp_buffer_size: option %d was set to %d instead of requested %d", socket_option_number, getsockopt_return_value/2, tcp_buffer_size);
593  }
594  return 0;
595 }
596 
597 int
598 rodsSetSockOpt( int sock, int tcp_buffer_size ) {
599 #ifdef _WIN32
600 #error socket settings not implemented for windows
601 #endif
602 
603  if ( tcp_buffer_size < 0 ) {
604  rodsLog(LOG_ERROR, "rodsSetSockOpt: requested tcp buffer size is negative, changing to zero: %d", tcp_buffer_size);
605  tcp_buffer_size = 0;
606  }
607 
608  int savedStatus = 0;
609  int temp = 1;
610  int status = setsockopt( sock, IPPROTO_TCP, TCP_NODELAY, &temp, sizeof(temp) );
611  if ( status < 0 ) {
612  rodsLog(LOG_ERROR, "rodsSetSockOpt: failed to set TCP_NODELAY, errno %d", errno);
613  savedStatus = status;
614  }
615 
616  status = setsockopt( sock, SOL_SOCKET, SO_REUSEADDR, &temp, sizeof( temp ) );
617  if ( status < 0 ) {
618  rodsLog(LOG_ERROR, "rodsSetSockOpt: failed to set SO_REUSEADDR, errno %d", errno);
619  savedStatus = status;
620  }
621 
622  temp = 1;
623  status = setsockopt( sock, SOL_SOCKET, SO_KEEPALIVE, &temp, sizeof( temp ) );
624  if ( status < 0 ) {
625  rodsLog(LOG_ERROR, "rodsSetSockOpt: failed to set SO_KEEPALIVE, errno %d", errno);
626  savedStatus = status;
627  }
628 
629  struct linger linger;
630  linger.l_onoff = 1;
631  linger.l_linger = 5;
632  status = setsockopt( sock, SOL_SOCKET, SO_LINGER, &linger, sizeof( linger ) );
633  if ( status < 0 ) {
634  rodsLog(LOG_ERROR, "rodsSetSockOpt: failed to set SO_LINGER, errno %d", errno);
635  savedStatus = status;
636  }
637 
638  if (tcp_buffer_size == 0) {
639  return savedStatus;
640  }
641 
642  status = set_tcp_buffer_size(sock, tcp_buffer_size, SO_RCVBUF);
643  if (status < 0) {
644  savedStatus = status;
645  }
646 
647  status = set_tcp_buffer_size(sock, tcp_buffer_size, SO_SNDBUF);
648  if (status < 0) {
649  savedStatus = status;
650  }
651  return savedStatus;
652 }
653 
654 int
655 connectToRhostPortal( char *rodsHost, int rodsPort,
656  int cookie, int windowSize ) {
657  int status, nbytes;
658  struct sockaddr_in remoteAddr;
659  int sock, myCookie;
660 
661  status = setSockAddr( &remoteAddr, rodsHost, rodsPort );
662  if ( status < 0 ) {
664  "connectToRhostPortal: setSockAddr error for %s, errno = %d",
665  rodsHost, errno );
666  return status;
667  }
668  /* set timeout 11/13/2009 */
669  sock = connectToRhostWithRaddr( &remoteAddr, windowSize, 1 );
670 
671  if ( sock < 0 ) {
673  "connectToRhostPortal: connectTo Rhost %s port %d error, status = %d",
674  rodsHost, rodsPort, sock );
675  return sock;
676  }
677 
678  myCookie = htonl( cookie );
679  nbytes = myWrite( sock, &myCookie, sizeof( myCookie ), NULL );
680 
681  if ( nbytes != sizeof( myCookie ) ) {
682  CLOSE_SOCK( sock );
683  return SYS_PORT_COOKIE_ERR;
684  }
685 
686  return sock;
687 }
688 
689 int
690 connectToRhost( rcComm_t *conn, int connectCnt, int reconnFlag ) {
691  int status;
692  conn->sock = connectToRhostWithRaddr( &conn->remoteAddr,
693  conn->windowSize, 1 );
694  if ( conn->sock < 0 ) {
695  rodsLogError( LOG_NOTICE, conn->sock,
696  "connectToRhost: connect to host %s on port %d failed",
697  conn->host, conn->portNum );
698  return conn->sock;
699  }
700 
701  setConnAddr( conn );
702  status = sendStartupPack( conn, connectCnt, reconnFlag );
703 
704  if ( status < 0 ) {
706  "connectToRhost: sendStartupPack to %s failed",
707  conn->host );
708  close( conn->sock );
709  return status;
710  }
711 
712  // =-=-=-=-=-=-=-
713  // create a network object
715  irods::error ret = irods::network_factory( conn, net_obj );
716  if ( !ret.ok() ) {
717  irods::log( PASS( ret ) );
718  return ret.code();
719  }
720 
721  // =-=-=-=-=-=-=-
722  // if the client requests the connection negotiation then wait for a
723  // response here from the Agent
725  // =-=-=-=-=-=-=-
726  // politely do the negotiation
727  std::string results;
729  net_obj,
730  conn->host,
731  results );
732  if ( !ret.ok() ) {
733  return ret.code();
734  }
735 
736 
737  // =-=-=-=-=-=-=-
738  // enable SSL if requested
739  // NOTE:: this is disabled in rcDisconnect if the conn->ssl_on flag is set
740  if ( irods::CS_NEG_FAILURE == results ) {
741  return ret.code();
742  }
743 
744  // =-=-=-=-=-=-=-
745  // copy results to connection for network object factory
746  snprintf( conn->negotiation_results, MAX_NAME_LEN, "%s", results.c_str() );
747  }
748 
749  ret = readVersion( net_obj, &conn->svrVersion );
750  if ( !ret.ok() ) {
751  irods::log(PASS(ret));
752  close( conn->sock );
753  return ret.code();
754  }
755 
756  if ( conn->svrVersion->status < 0 ) {
758  "connectToRhost: error returned from host %s",
759  conn->host );
760  if ( conn->svrVersion->status == SYS_EXCEED_CONNECT_CNT )
762  "It is likely %s is a localhost but not recognized by this server. A line can be added to the server/config/irodsHost file to fix the problem", conn->host );
763  close( conn->sock );
764  return conn->svrVersion->status;
765  }
766 
767  // =-=-=-=-=-=-=-
768  // call initialization for network plugin as negotiated
769  irods::network_object_ptr new_net_obj;
770  ret = irods::network_factory( conn, new_net_obj );
771  if ( !ret.ok() ) {
772  irods::log( PASS( ret ) );
773  return ret.code();
774  }
775 
776  // =-=-=-=-=-=-=-
777  // get rods env to pass to client start for policy decisions
778  rodsEnv rods_env;
779  getRodsEnv( &rods_env );
780 
781  ret = sockClientStart( new_net_obj, &rods_env );
782  if ( !ret.ok() ) {
783  irods::log( PASS( ret ) );
784  return ret.code();
785  }
786 
787  new_net_obj->to_client( conn );
788 
789  return 0;
790 
791 } // connectToRhost
792 
793 
794 int
796  int sock = socket( AF_INET, SOCK_STREAM, 0 );
797  if ( sock < 0 ) { /* the ol' one-two */
798  sock = socket( AF_INET, SOCK_STREAM, 0 );
799  }
800  if ( sock < 0 ) {
802  "try_twice_to_create_socket() - socket() failed: errno=%d",
803  errno );
804  return USER_SOCK_OPEN_ERR - errno;
805  }
806  return sock;
807 }
808 
809 int
810 connectToRhostWithRaddr( struct sockaddr_in *remoteAddr, int windowSize,
811  int timeoutFlag ) {
812  int sock = -1;
813  if (timeoutFlag > 0) {
814  sock = connectToRhostWithTout( ( struct sockaddr * ) remoteAddr );
815  if (sock < 0) {
816  return sock;
817  }
818  } else {
820  if (sock < 0) {
821  return sock;
822  }
823  const int status = connect( sock, ( struct sockaddr * ) remoteAddr,
824  sizeof( struct sockaddr ) );
825  if ( status < 0 ) {
826 #ifdef _WIN32
827  closesocket( sock );
828 #else
829  close( sock );
830 #endif /* WIN32 */
831  if ( status == -1 ) {
832  return USER_SOCK_CONNECT_ERR - errno;
833  }
834  return status;
835  }
836  }
837 
838  rodsSetSockOpt( sock, windowSize );
839 
840 #ifdef PORTNAME_solaris
841  flag = fcntl( sock, F_GETFL );
842  if ( flag & O_NONBLOCK ) {
843  fcntl( sock, F_SETFL, ( flag & ( ~O_NONBLOCK ) ) );
844  }
845 #endif
846 
847  return sock;
848 }
849 
850 #ifdef _WIN32
851 int
852 connectToRhostWithTout(struct sockaddr *sin ) {
853  // A Windows console app has very limited timeout functionality.
854  // An pseudo timeout is implemented.
855  int timeoutCnt = 0;
856  int status = 0;
857  const int sock = try_twice_to_create_socket();
858  if (sock < 0) {
859  return sock;
860  }
861 
862  while ( ( timeoutCnt < MAX_CONN_RETRY_CNT ) && ( !win_connect_timeout ) ) {
863  if ( ( status = connect( sock, sin, sizeof( struct sockaddr ) ) ) < 0 ) {
864  timeoutCnt ++;
865  rodsSleep( 0, 200000 );
866  }
867  else {
868  break;
869  }
870  }
871  if ( status != 0 ) {
873  }
874 
875  return 0;
876 }
877 #else
878 int
880  const int sock = try_twice_to_create_socket();
881  if (sock < 0) {
882  return sock;
883  }
884  long flags = fcntl( sock, F_GETFL, NULL );
885  if ( flags < 0 ) {
886  close( sock );
888  "create_nonblocking_socket: fcntl F_GETFL error, errno = %d", errno );
889  return USER_SOCK_CONNECT_ERR - errno;
890  }
891  flags |= O_NONBLOCK;
892  if ( fcntl( sock, F_SETFL, flags ) < 0 ) {
893  close( sock );
895  "create_nonblocking_socket: fcntl F_SETFL error, errno = %d", errno );
896  return USER_SOCK_CONNECT_ERR - errno;
897  }
898  return sock;
899 }
900 
901 int
902 connectToRhostWithTout(struct sockaddr *sin ) {
903  int timeoutCnt = 0;
904  int status = 0;
905  int sock = -1;
906  while ( timeoutCnt < MAX_CONN_RETRY_CNT ) {
907  sock = create_nonblocking_socket();
908  if (sock < 0) {
909  return sock;
910  }
911  status = connect( sock, sin, sizeof( struct sockaddr ) );
912  if ( status >= 0 ) {
913  break;
914  }
915  if ( errno == EISCONN ) {
916  /* already connected. seen this error on AIX */
917  status = 0;
918  break;
919  }
920  if ( errno == EINPROGRESS || errno == EINTR ) {
921  struct timeval tv;
922  tv.tv_sec = CONNECT_TIMEOUT_TIME;
923  tv.tv_usec = 0;
924  fd_set myset;
925  FD_ZERO( &myset );
926  FD_SET( sock, &myset );
927  status = select( sock + 1, NULL, &myset, NULL, &tv );
928  if ( status < 0 ) {
929  if ( errno != EINTR ) {
931  "connectToRhostWithTout: connect error, errno = %d",
932  errno );
933  timeoutCnt++;
934  }
935  close( sock );
936  continue;
937  }
938  else if ( status > 0 ) {
939  int myval;
940 #if defined(aix_platform)
941  socklen_t mylen = sizeof( int );
942 #else
943  uint mylen = sizeof( int );
944 #endif
945  if ( getsockopt( sock, SOL_SOCKET, SO_ERROR, ( void* )( &myval ),
946  &mylen ) < 0 ) {
948  "connectToRhostWithTout: getsockopt error, errno = %d",
949  errno );
950  close( sock );
951  return USER_SOCK_CONNECT_ERR - errno;
952  }
953  /* Check the returned value */
954  if ( myval ) {
956  "connectToRhostWithTout: myval error, errno = %d",
957  myval );
958  timeoutCnt++;
959  status = USER_SOCK_CONNECT_ERR - myval;
960  close( sock );
961  continue;
962  }
963  else {
964  break;
965  }
966  }
967  else {
968  /* timed out */
970  close( sock );
971  break;
972  }
973  }
974  else {
976  "connectToRhostWithTout: connect error, errno = %d", errno );
977  timeoutCnt++;
978  status = USER_SOCK_CONNECT_ERR - errno;
979  close( sock );
980  continue;
981  }
982  }
983 
984  if ( status < 0 ) {
985  if ( status == -1 ) {
986  return USER_SOCK_CONNECT_ERR - errno;
987  }
988  else {
989  return status;
990  }
991  }
992 
993  /* Set to blocking again */
994  int socket_flags = fcntl( sock, F_GETFL, NULL );
995  if ( socket_flags < 0 ) {
996  close( sock );
998  "connectToRhostWithTout: fcntl F_GETFL error, errno = %d", errno );
999  return USER_SOCK_CONNECT_ERR - errno;
1000  }
1001 
1002  socket_flags &= ( ~O_NONBLOCK );
1003  if ( fcntl( sock, F_SETFL, socket_flags ) < 0 ) {
1004  close( sock );
1005  rodsLog( LOG_ERROR,
1006  "connectToRhostWithTout: fcntl F_SETFL error, errno = %d", errno );
1007  return USER_SOCK_CONNECT_ERR - errno;
1008  }
1009  return sock;
1010 }
1011 
1012 #endif
1013 
1014 int
1016  int status1, status2;
1017 
1018  status1 = setLocalAddr( conn->sock, &conn->localAddr );
1019 
1020  status2 = setRemoteAddr( conn->sock, &conn->remoteAddr );
1021 
1022  if ( status1 < 0 ) {
1023  return status1;
1024  }
1025  else if ( status2 < 0 ) {
1026  return status2;
1027  }
1028  else {
1029  return 0;
1030  }
1031 }
1032 
1033 int
1034 setRemoteAddr( int sock, struct sockaddr_in *remoteAddr ) {
1035 #if defined(aix_platform)
1036  socklen_t laddrlen = sizeof( struct sockaddr );
1037 #elif defined(windows_platform)
1038  int laddrlen = sizeof( struct sockaddr );
1039 #else
1040  uint laddrlen = sizeof( struct sockaddr );
1041 #endif
1042 
1043  /* fill in the server address. This is for case where the conn->host
1044  * is not a real host but an address that select a host from a pool
1045  * of hosts */
1046  if ( getpeername( sock, ( struct sockaddr * ) remoteAddr,
1047  &laddrlen ) < 0 ) {
1049  "setLocalAddr() -- getpeername() failed: errno=%d, errstring=%s", errno, strerror(errno) );
1050  return USER_RODS_HOSTNAME_ERR;
1051  }
1052 
1053  return 0;
1054 }
1055 
1056 int
1057 setLocalAddr( int sock, struct sockaddr_in *localAddr ) {
1058 #if defined(aix_platform)
1059  socklen_t laddrlen = sizeof( struct sockaddr );
1060 #elif defined(windows_platform)
1061  int laddrlen = sizeof( struct sockaddr );
1062 #else
1063  uint laddrlen = sizeof( struct sockaddr );
1064 #endif
1065 
1066 
1067  /* fill in the client address */
1068  if ( getsockname( sock, ( struct sockaddr * ) localAddr,
1069  &laddrlen ) < 0 ) {
1071  "setLocalAddr() -- getsockname() failed: errno=%d, errstring=%s",
1072  errno, strerror(errno) );
1073  return USER_RODS_HOSTNAME_ERR;
1074  }
1075  return ntohs( localAddr->sin_port );
1076 }
1077 
1078 int
1079 sendStartupPack( rcComm_t *conn, int connectCnt, int reconnFlag ) {
1081  int status;
1082  char *tmpStr;
1083  bytesBuf_t *startupPackBBuf = NULL;
1084 
1085  /* setup the startup pack */
1086 
1088  startupPack.connectCnt = connectCnt;
1089  startupPack.reconnFlag = reconnFlag;
1090 
1095 
1096  rstrcpy( startupPack.relVersion, RODS_REL_VERSION, NAME_LEN );
1097  rstrcpy( startupPack.apiVersion, RODS_API_VERSION, NAME_LEN );
1098 
1099  if ( ( tmpStr = getenv( SP_OPTION ) ) != NULL ) {
1100  rstrcpy( startupPack.option, tmpStr, NAME_LEN );
1101  }
1102  else {
1103  startupPack.option[0] = '\0';
1104  }
1105 
1106  // =-=-=-=-=-=-=-
1107  // if the advanced negotiation is requested from the irodsEnv,
1108  // tack those results onto the startup pack option string
1109  rodsEnv rods_env;
1110  status = getRodsEnv( &rods_env );
1111 
1112  if( 0 == strcmp( REQ_SVR_NEG, rods_env.rodsClientServerNegotiation ) ) {
1113  // only add the negotiation request if it matches the required token
1114  size_t cs_neg_len = strlen( rods_env.rodsClientServerNegotiation );
1115  if ( status >= 0 && cs_neg_len > 0 ) {
1116  size_t opt_sz = sizeof( startupPack.option );
1117  size_t opt_len = strlen( startupPack.option );
1118  if( ( opt_sz - opt_len ) <= cs_neg_len ) {
1119  rodsLogError(
1120  LOG_ERROR,
1121  SYS_BAD_INPUT,
1122  "sendStartupPack :: insufficient room in option string - %d vs %d",
1123  opt_sz,
1124  opt_sz - opt_len );
1125  return SYS_BAD_INPUT;
1126  }
1127 
1128  strncat( startupPack.option,
1129  rods_env.rodsClientServerNegotiation,
1130  opt_sz - opt_len );
1131  }
1132  }
1133 
1134  /* always use XML_PROT for the startupPack */
1135  status = packStruct( ( void * ) &startupPack, &startupPackBBuf,
1136  "StartupPack_PI", RodsPackTable, 0, XML_PROT );
1137  if ( status < 0 ) {
1139  "sendStartupPack: packStruct error" );
1140  return status;
1141  }
1142 
1143  irods::network_object_ptr net_obj;
1144  irods::error ret = irods::network_factory( conn, net_obj );
1145  if ( !ret.ok() ) {
1146  irods::log( PASS( ret ) );
1147  freeBBuf( startupPackBBuf );
1148  return ret.code();
1149  }
1150 
1151  ret = sendRodsMsg(
1152  net_obj,
1154  startupPackBBuf,
1155  NULL, NULL, 0,
1156  XML_PROT );
1157  freeBBuf( startupPackBBuf );
1158  if ( !ret.ok() ) {
1159  irods::log( PASS( ret ) );
1160  return ret.code();
1161  }
1162 
1163  return ret.code();
1164 
1165 } // sendStartupPack
1166 
1167 
1170  int versionStatus,
1171  int reconnPort,
1172  char* reconnAddr,
1173  int cookie ) {
1174  version_t myVersion;
1175  int status;
1176  bytesBuf_t *versionBBuf = NULL;
1177 
1178 
1179  /* setup the version struct */
1180 
1181  memset( &myVersion, 0, sizeof( myVersion ) );
1182  myVersion.status = versionStatus;
1183  rstrcpy( myVersion.relVersion, RODS_REL_VERSION, NAME_LEN );
1184  rstrcpy( myVersion.apiVersion, RODS_API_VERSION, NAME_LEN );
1185  if ( reconnAddr != NULL ) {
1186  myVersion.reconnPort = reconnPort;
1187  rstrcpy( myVersion.reconnAddr, reconnAddr, LONG_NAME_LEN );
1188  myVersion.cookie = cookie;
1189  }
1190  else {
1191  // =-=-=-=-=-=-=-
1192  // super secret jargon irods detection
1193  // sshhhhhhh...
1194  myVersion.cookie = 400;
1195 
1196  }
1197 
1198  /* alway use XML for version */
1199  status = packStruct( ( char * ) &myVersion, &versionBBuf,
1200  "Version_PI", RodsPackTable, 0, XML_PROT );
1201  if ( status < 0 ) {
1202  return ERROR( status, "packStruct error" );
1203  }
1204 
1205  irods::error ret = sendRodsMsg(
1206  _ptr,
1208  versionBBuf,
1209  NULL, NULL, 0,
1210  XML_PROT );
1211  freeBBuf( versionBBuf );
1212  if ( !ret.ok() ) {
1213  return PASS( ret );
1214  }
1215 
1216  return SUCCESS();
1217 
1218 } // sendVersion
1219 
1220 
1223  const char* _msg_type,
1224  bytesBuf_t* _msg_buf,
1225  bytesBuf_t* _bs_buf,
1226  bytesBuf_t* _error_buf,
1227  int _int_info,
1228  irodsProt_t _protocol ) {
1229  // =-=-=-=-=-=-=-
1230  // resolve a network interface plugin from the
1231  // network object
1232  irods::plugin_ptr p_ptr;
1233  irods::error ret_err = _ptr->resolve( irods::NETWORK_INTERFACE, p_ptr );
1234  if ( !ret_err.ok() ) {
1235  return PASSMSG( "failed to resolve network interface", ret_err );
1236 
1237  }
1238 
1239  // =-=-=-=-=-=-=-
1240  // make the call to the "write body" interface
1241  irods::first_class_object_ptr ptr = boost::dynamic_pointer_cast< irods::first_class_object >( _ptr );
1242  irods::network_ptr net = boost::dynamic_pointer_cast< irods::network >( p_ptr );
1243  ret_err = net->call< const char*, bytesBuf_t*, bytesBuf_t*, bytesBuf_t*, int, irodsProt_t >(
1244  nullptr,
1246  ptr,
1247  _msg_type,
1248  _msg_buf,
1249  _bs_buf,
1250  _error_buf,
1251  _int_info,
1252  _protocol );
1253 
1254  // =-=-=-=-=-=-=-
1255  // pass along an error from the interface or return SUCCESS
1256  if ( !ret_err.ok() ) {
1257  return PASSMSG( "failed to call 'write body'", ret_err );
1258 
1259  }
1260  else {
1261  return CODE( ret_err.code() );
1262 
1263  }
1264 
1265  return SUCCESS();
1266 
1267 } // sendRodsMsg
1268 
1269 int
1270 rodsSleep( int sec, int microSec ) {
1271  unsigned int us = ( sec * 1000000 ) + ( microSec );
1272  usleep( us );
1273  return 0;
1274 }
1275 
1278  reconnMsg_t** _msg ) {
1279  int status;
1280  msgHeader_t myHeader;
1281  memset( &myHeader, 0, sizeof( myHeader ) );
1282  irods::error ret = readMsgHeader( _ptr, &myHeader, NULL );
1283  if ( !ret.ok() ) {
1284  return PASSMSG( "read msg header error", ret );
1285  }
1286 
1287  bytesBuf_t inputStructBBuf, bsBBuf, errorBBuf;
1288  memset( &bsBBuf, 0, sizeof( bsBBuf ) );
1289  memset( &inputStructBBuf, 0, sizeof( inputStructBBuf ) );
1290  memset( &errorBBuf, 0, sizeof( errorBBuf ) );
1291  ret = readMsgBody(
1292  _ptr,
1293  &myHeader,
1294  &inputStructBBuf,
1295  &bsBBuf,
1296  &errorBBuf,
1297  XML_PROT,
1298  NULL );
1299  if ( !ret.ok() ) {
1300  return PASS( ret );
1301  }
1302 
1303  /* some sanity check */
1304 
1305  if ( strcmp( myHeader.type, RODS_RECONNECT_T ) != 0 ) {
1306  free( inputStructBBuf.buf );
1307  free( bsBBuf.buf );
1308  free( errorBBuf.buf );
1309  std::stringstream msg;
1310  msg << "wrong msg type ["
1311  << myHeader.type
1312  << "] expected ["
1313  << RODS_CONNECT_T
1314  << "]";
1315  return ERROR( SYS_HEADER_TYPE_LEN_ERR, msg.str() );
1316  }
1317 
1318  if ( myHeader.bsLen != 0 ) {
1319  if ( bsBBuf.buf != NULL ) {
1320  free( bsBBuf.buf );
1321  }
1322  rodsLog( LOG_NOTICE, "readReconMsg: myHeader.bsLen = %d is not 0",
1323  myHeader.bsLen );
1324  }
1325 
1326  if ( myHeader.errorLen != 0 ) {
1327  if ( errorBBuf.buf != NULL ) {
1328  free( errorBBuf.buf );
1329  }
1331  "readReconMsg: myHeader.errorLen = %d is not 0",
1332  myHeader.errorLen );
1333  }
1334 
1335  if ( myHeader.msgLen <= 0 ) {
1336  if ( inputStructBBuf.buf != NULL ) {
1337  free( inputStructBBuf.buf );
1338  }
1340  "readReconMsg: problem with myHeader.msgLen = %d",
1341  myHeader.msgLen );
1342  std::stringstream msg;
1343  msg << "message length is invalid: "
1344  << myHeader.msgLen;
1345  return ERROR( SYS_HEADER_READ_LEN_ERR, msg.str() );
1346  }
1347 
1348  /* always use XML_PROT for the startup pack */
1349  status = unpackStruct(
1350  inputStructBBuf.buf,
1351  ( void** )( _msg ),
1352  "ReconnMsg_PI",
1353  RodsPackTable,
1354  XML_PROT );
1355  clearBBuf( &inputStructBBuf );
1356  if ( status < 0 ) {
1358  "readReconMsg:unpackStruct error." );
1359  }
1360 
1361  return CODE( status );
1362 }
1363 
1364 // =-=-=-=-=-=-=-
1365 // interface for requesting a reconnection
1368  reconnMsg_t* _msg ) {
1369  // =-=-=-=-=-=-=-
1370  // trap invalid param
1371  if ( _msg == NULL ) {
1372  return ERROR( USER__NULL_INPUT_ERR, "null msg buf" );
1373  }
1374 
1375  // =-=-=-=-=-=-=-
1376  // pack outgoing message - alway use XML for version
1377  bytesBuf_t* recon_buf = NULL;
1378  int status = packStruct(
1379  static_cast<void*>( _msg ),
1380  &recon_buf,
1381  "ReconnMsg_PI",
1382  RodsPackTable,
1383  0, XML_PROT );
1384  if ( status < 0 ) {
1385  return ERROR( status, "failed to pack struct" );
1386  }
1387 
1388  // =-=-=-=-=-=-=-
1389  // pack outgoing message - alway use XML for version
1390  irods::error ret = sendRodsMsg(
1391  _ptr,
1393  recon_buf,
1394  NULL,
1395  NULL,
1396  0,
1397  XML_PROT );
1398  freeBBuf( recon_buf );
1399  if ( !ret.ok() ) {
1401  "sendReconnMsg: sendRodsMsg of reconnect msg failed" );
1402  }
1403 
1404  return CODE( status );
1405 
1406 } // sendReconnMsg
1407 
1409  rsComm_t *rsComm ) {
1410  // =-=-=-=-=-=-=-
1411  // construct a network object from the comm
1412  irods::network_object_ptr net_obj;
1413  irods::error ret = irods::network_factory( rsComm, net_obj );
1414  if ( !ret.ok() ) {
1415  irods::log( PASS( ret ) );
1416  return ret.code();
1417  }
1418 
1419  if ( rsComm->reconnectedSock > 0 ) {
1420  if ( rsComm->clientState == RECEIVING_STATE ) {
1422  bzero( &reconnMsg, sizeof( reconnMsg ) );
1423  sendReconnMsg( net_obj, &reconnMsg );
1424  rsComm->clientState = PROCESSING_STATE;
1425  }
1426  close( rsComm->sock );
1427  rsComm->sock = rsComm->reconnectedSock;
1428  rsComm->reconnectedSock = 0;
1430  "svrSwitchConnect: Switch connection" );
1431  return 1;
1432  }
1433  else {
1434  return 0;
1435  }
1436 }
1437 
1439  // =-=-=-=-=-=-=-
1440  // construct a network object from the comm
1441  irods::network_object_ptr net_obj;
1442  irods::error ret = irods::network_factory( conn, net_obj );
1443  if ( !ret.ok() ) {
1444  irods::log( PASS( ret ) );
1445  return ret.code();
1446  }
1447 
1448  if ( conn->reconnectedSock > 0 ) {
1449  if ( conn->agentState == RECEIVING_STATE ) {
1451  bzero( &reconnMsg, sizeof( reconnMsg ) );
1452  sendReconnMsg( net_obj, &reconnMsg );
1453  conn->agentState = PROCESSING_STATE;
1454  }
1455  close( conn->sock );
1456  conn->sock = conn->reconnectedSock;
1457  conn->reconnectedSock = 0;
1458  fprintf( stderr,
1459  "The client/server socket connection has been renewed\n" );
1460  return 1;
1461  }
1462  else {
1463  return 0;
1464  }
1465 }
1466 
1467 int
1468 addUdpPortToPortList( portList_t *thisPortList, int udpport ) {
1469  /* put udpport in the upper 16 bits of portNum */
1470  thisPortList->portNum |= udpport << 16;
1471  return 0;
1472 }
1473 
1474 int
1476  int udpport = 0;
1477  udpport = ( thisPortList->portNum & 0xffff0000 ) >> 16;
1478  return udpport;
1479 }
1480 
1481 int
1483  return thisPortList->portNum & 0xffff;
1484 }
1485 
1486 int
1487 addUdpSockToPortList( portList_t *thisPortList, int udpsock ) {
1488  /* put udpport in the upper 16 bits of portNum */
1489  thisPortList->sock |= udpsock << 16;
1490  return 0;
1491 }
1492 
1493 int
1495  int udpsock = 0;
1496  udpsock = ( thisPortList->sock & 0xffff0000 ) >> 16;
1497  return udpsock;
1498 }
1499 
1500 int
1502  return thisPortList->sock & 0xffff;
1503 }
1504 
1505 int
1507  int irodsErr = getIrodsErrno( status );
1508 
1509  if ( irodsErr == SYS_READ_MSG_BODY_LEN_ERR ||
1510  irodsErr == SYS_HEADER_READ_LEN_ERR ||
1511  irodsErr == SYS_HEADER_WRITE_LEN_ERR ) {
1512  return 1;
1513  }
1514  else {
1515  return 0;
1516  }
1517 }
1518 
1519 int
1521  rodsEnv *myEnv, int reconnFlag ) {
1522  int status;
1523  char *outHost = NULL;
1524 
1525  if ( dataObjInp->oprType == PUT_OPR ) {
1526  status = rcGetHostForPut( *conn, dataObjInp, &outHost );
1527  }
1528  else if ( dataObjInp->oprType == GET_OPR ) {
1529  status = rcGetHostForGet( *conn, dataObjInp, &outHost );
1530  }
1531  else {
1533  "redirectConnToRescSvr: Unknown oprType %d\n",
1534  dataObjInp->oprType );
1535  return 0;
1536  }
1537 
1538  if ( status < 0 || outHost == NULL || strcmp( outHost, THIS_ADDRESS ) == 0 ) {
1539  return status;
1540  }
1541 
1542  status = rcReconnect( conn, outHost, myEnv, reconnFlag );
1543  return status;
1544 }
1545 
1546 int
1547 rcReconnect( rcComm_t **conn, char *newHost, rodsEnv *myEnv, int reconnFlag ) {
1548  int status;
1549  rcComm_t *newConn = NULL;
1550  rErrMsg_t errMsg;
1551 
1552  bzero( &errMsg, sizeof( errMsg ) );
1553 
1554  newConn = rcConnect( newHost, myEnv->rodsPort, myEnv->rodsUserName,
1555  myEnv->rodsZone, reconnFlag, &errMsg );
1556 
1557  if ( newConn != NULL ) {
1558  status = clientLogin( newConn );
1559  if ( status != 0 ) {
1560  rcDisconnect( newConn );
1561  return status;
1562  }
1563  rcDisconnect( *conn );
1564  *conn = newConn;
1565  return 0;
1566  }
1567  else {
1568  return errMsg.status;
1569  }
1570 }
1571 
1572 int
1573 mySockClose( int sock ) {
1574  // A socket write immediately followed by a socket close can cause the
1575  // receiver to get errno 104 (reset by peer) and not receive the message,
1576  // even with SO_LINGER. Calling shutdown prevents this behavior.
1577 #if defined(solaris_platform) || defined(linux_platform) || defined(osx_platform)
1578  shutdown( sock, SHUT_WR );
1579 #endif
1580 
1581 #if defined(windows_platform)
1582  return closesocket( sock );
1583 #else
1584  return close( sock );
1585 #endif
1586 }
msgHeader::errorLen
int errorLen
Definition: rodsDef.h:213
rcComm_t::localAddr
struct sockaddr_in localAddr
Definition: rcConnect.h:101
rodsLog
void rodsLog(int level, const char *formatStr,...)
Definition: rodsLog.cpp:86
irods::plugin_ptr
boost::shared_ptr< plugin_base > plugin_ptr
Definition: irods_first_class_object.hpp:18
sockAgentStart
irods::error sockAgentStart(irods::network_object_ptr _ptr)
Definition: sockComm.cpp:113
msgHeader::bsLen
int bsLen
Definition: rodsDef.h:214
rcComm_t
Definition: rcConnect.h:95
NULL
#define NULL
Definition: rodsDef.h:70
rsComm_t
Definition: rcConnect.h:145
irods::CS_NEG_FAILURE
const std::string CS_NEG_FAILURE("CS_NEG_FAILURE")
SYS_INTERNAL_NULL_INPUT_ERR
@ SYS_INTERNAL_NULL_INPUT_ERR
Definition: rodsErrorTable.h:92
rcComm_t::agentState
procState_t agentState
Definition: rcConnect.h:116
msgHeader
Definition: rodsDef.h:210
setRemoteAddr
int setRemoteAddr(int sock, struct sockaddr_in *remoteAddr)
Definition: sockComm.cpp:1034
connectToRhostPortal
int connectToRhostPortal(char *rodsHost, int rodsPort, int cookie, int windowSize)
Definition: sockComm.cpp:655
rodsEnv::rodsPort
int rodsPort
Definition: getRodsEnv.h:11
irods.pypyodbc.connect
connect
Definition: pypyodbc.py:2689
getRodsEnv
int getRodsEnv(rodsEnv *myRodsEnv)
Definition: getRodsEnv.cpp:112
rErrMsg_t
Definition: rodsError.h:19
irods_server_properties.hpp
rcComm_t::host
char host[64]
Definition: rcConnect.h:97
irods::NETWORK_OP_WRITE_BODY
const std::string NETWORK_OP_WRITE_BODY("network_write_body")
BytesBuf::buf
void * buf
Definition: rodsDef.h:199
reconnMsg
Definition: rcConnect.h:49
isReadMsgError
int isReadMsgError(int status)
Definition: sockComm.cpp:1506
redirectConnToRescSvr
int redirectConnToRescSvr(rcComm_t **conn, dataObjInp_t *dataObjInp, rodsEnv *myEnv, int reconnFlag)
Definition: sockComm.cpp:1520
userInfo_t::userName
char userName[64]
Definition: rodsUser.h:66
startupPack::clientRodsZone
char clientRodsZone[64]
Definition: rodsDef.h:241
rcComm_t::proxyUser
userInfo_t proxyUser
Definition: rcConnect.h:103
irods_environment_properties.hpp
irods_stacktrace.hpp
PASS
#define PASS(prev_error_)
Definition: irods_error.hpp:118
msgHeader::type
char type[128]
Definition: rodsDef.h:211
irods::NETWORK_OP_AGENT_STOP
const std::string NETWORK_OP_AGENT_STOP("network_agent_stop")
cliSwitchConnect
int cliSwitchConnect(rcComm_t *conn)
Definition: sockComm.cpp:1438
rodsEnv::rodsZone
char rodsZone[64]
Definition: getRodsEnv.h:18
version_t::reconnAddr
char reconnAddr[256]
Definition: rodsDef.h:291
startupPack::relVersion
char relVersion[64]
Definition: rodsDef.h:242
rErrMsg_t::status
int status
Definition: rodsError.h:20
sockAgentStop
irods::error sockAgentStop(irods::network_object_ptr _ptr)
Definition: sockComm.cpp:144
XML_PROT
@ XML_PROT
Definition: rodsDef.h:149
irods::NETWORK_OP_CLIENT_START
const std::string NETWORK_OP_CLIENT_START("network_client_start")
RODS_CONNECT_T
#define RODS_CONNECT_T
Definition: rodsDef.h:223
rcMisc.h
rcConnect.h
rsComm_t::windowSize
int windowSize
Definition: rcConnect.h:163
setLocalAddr
int setLocalAddr(int sock, struct sockaddr_in *localAddr)
Definition: sockComm.cpp:1057
CONNECT_TIMEOUT_TIME
#define CONNECT_TIMEOUT_TIME
Definition: sockComm.h:17
irods::NETWORK_INTERFACE
const std::string NETWORK_INTERFACE("irods_network_interface")
connectToRhost
int connectToRhost(rcComm_t *conn, int connectCnt, int reconnFlag)
Definition: sockComm.cpp:690
PUT_OPR
#define PUT_OPR
Definition: dataObjInpOut.h:167
LONG_NAME_LEN
#define LONG_NAME_LEN
Definition: rodsDef.h:57
sendVersion
irods::error sendVersion(irods::network_object_ptr _ptr, int versionStatus, int reconnPort, char *reconnAddr, int cookie)
Definition: sockComm.cpp:1168
SYS_PORT_COOKIE_ERR
@ SYS_PORT_COOKIE_ERR
Definition: rodsErrorTable.h:96
unpackStruct
int unpackStruct(const void *inPackStr, void **outStruct, const char *packInstName, const packInstruct_t *myPackTable, irodsProt_t irodsProt)
Definition: packStruct.cpp:63
getHostForGet.h
USER_SOCK_OPEN_ERR
@ USER_SOCK_OPEN_ERR
Definition: rodsErrorTable.h:235
PASSMSG
#define PASSMSG(message_, prev_error_)
Definition: irods_error.hpp:119
RODS_VERSION_T
#define RODS_VERSION_T
Definition: rodsDef.h:225
irods::NETWORK_OP_WRITE_HEADER
const std::string NETWORK_OP_WRITE_HEADER("network_write_header")
rcGlobalExtern.h
rsComm_t::reconnectedSock
int reconnectedSock
Definition: rcConnect.h:167
sockClientStart
irods::error sockClientStart(irods::network_object_ptr _ptr, rodsEnv *_env)
Definition: sockComm.cpp:47
SYS_SOCK_ACCEPT_ERR
@ SYS_SOCK_ACCEPT_ERR
Definition: rodsErrorTable.h:71
readReconMsg
irods::error readReconMsg(irods::network_object_ptr _ptr, reconnMsg_t **_msg)
Definition: sockComm.cpp:1276
rsComm_t::clientState
procState_t clientState
Definition: rcConnect.h:174
LOG_ERROR
#define LOG_ERROR
Definition: rodsLog.h:43
irods_network_manager.hpp
rcGetHostForGet
int rcGetHostForGet(rcComm_t *conn, dataObjInp_t *dataObjInp, char **outHost)
Definition: rcGetHostForGet.cpp:41
SYS_INVALID_INPUT_PARAM
@ SYS_INVALID_INPUT_PARAM
Definition: rodsErrorTable.h:195
rodsConnect.h
SYS_HEADER_TYPE_LEN_ERR
@ SYS_HEADER_TYPE_LEN_ERR
Definition: rodsErrorTable.h:74
rsAcceptConn
int rsAcceptConn(rsComm_t *svrComm)
Definition: sockComm.cpp:407
readMsgHeader
irods::error readMsgHeader(irods::network_object_ptr _ptr, msgHeader_t *_header, struct timeval *_time_val)
Definition: sockComm.cpp:173
getUdpSockFromPortList
int getUdpSockFromPortList(portList_t *thisPortList)
Definition: sockComm.cpp:1494
try_twice_to_create_socket
int try_twice_to_create_socket(void)
Definition: sockComm.cpp:795
GET_OPR
#define GET_OPR
Definition: dataObjInpOut.h:168
rodsEnv::rodsUserName
char rodsUserName[64]
Definition: getRodsEnv.h:9
RODS_RECONNECT_T
#define RODS_RECONNECT_T
Definition: rodsDef.h:228
portList_t::portNum
int portNum
Definition: dataObjInpOut.h:30
getTcpPortFromPortList
int getTcpPortFromPortList(portList_t *thisPortList)
Definition: sockComm.cpp:1482
msgHeader::msgLen
int msgLen
Definition: rodsDef.h:212
SP_OPTION
#define SP_OPTION
Definition: rodsDef.h:263
rcComm_t::remoteAddr
struct sockaddr_in remoteAddr
Definition: rcConnect.h:102
SUCCESS
#define SUCCESS()
Definition: irods_error.hpp:121
irods_network_factory.hpp
SYS_HEADER_READ_LEN_ERR
@ SYS_HEADER_READ_LEN_ERR
Definition: rodsErrorTable.h:72
startupPack::clientUser
char clientUser[64]
Definition: rodsDef.h:240
irodsProt_t
irodsProt_t
Definition: rodsDef.h:147
svrSwitchConnect
int svrSwitchConnect(rsComm_t *rsComm)
Definition: sockComm.cpp:1408
version_t::apiVersion
char apiVersion[64]
Definition: rodsDef.h:289
SYS_SOCK_OPEN_ERR
@ SYS_SOCK_OPEN_ERR
Definition: rodsErrorTable.h:68
SYS_READ_MSG_BODY_LEN_ERR
@ SYS_READ_MSG_BODY_LEN_ERR
Definition: rodsErrorTable.h:156
PROCESSING_STATE
@ PROCESSING_STATE
Definition: rcConnect.h:42
irods::error::code
long long code() const
Definition: irods_error.cpp:194
startupPack::proxyRodsZone
char proxyRodsZone[64]
Definition: rodsDef.h:239
irods::network_factory
irods::error network_factory(rcComm_t *, irods::network_object_ptr &)
Definition: irods_network_factory.cpp:8
irods::first_class_object_ptr
boost::shared_ptr< first_class_object > first_class_object_ptr
Definition: irods_first_class_object.hpp:47
addUdpSockToPortList
int addUdpSockToPortList(portList_t *thisPortList, int udpsock)
Definition: sockComm.cpp:1487
RECEIVING_STATE
@ RECEIVING_STATE
Definition: rcConnect.h:43
LOG_DEBUG
#define LOG_DEBUG
Definition: rodsLog.h:23
rodsSetSockOpt
int rodsSetSockOpt(int sock, int tcp_buffer_size)
Definition: sockComm.cpp:598
Jcenv
jmp_buf Jcenv
Definition: sockComm.cpp:29
rcConnect
rcComm_t * rcConnect(const char *rodsHost, int rodsPort, const char *userName, const char *rodsZone, int reconnFlag, rErrMsg_t *errMsg)
Definition: rcConnect.cpp:30
myWrite
int myWrite(int sock, void *buf, int len, int *bytesWritten)
Definition: rcMisc.cpp:4610
irods::network_ptr
boost::shared_ptr< network > network_ptr
Definition: irods_network_types.hpp:19
MAX_CONN_RETRY_CNT
#define MAX_CONN_RETRY_CNT
Definition: sockComm.h:21
rcComm_t::clientUser
userInfo_t clientUser
Definition: rcConnect.h:104
writeMsgHeader
irods::error writeMsgHeader(irods::network_object_ptr _ptr, msgHeader_t *_header)
Definition: sockComm.cpp:435
getIrodsErrno
int getIrodsErrno(int irodError)
Definition: rcMisc.cpp:3272
USER_SOCK_CONNECT_ERR
@ USER_SOCK_CONNECT_ERR
Definition: rodsErrorTable.h:236
DataObjInp
Definition: dataObjInpOut.h:65
rsComm_t::remoteAddr
struct sockaddr_in remoteAddr
Definition: rcConnect.h:150
irods_network_constants.hpp
MAX_NAME_LEN
#define MAX_NAME_LEN
Definition: rodsDef.h:61
terminate_irods_processes.e
e
Definition: terminate_irods_processes.py:19
SYS_EXCEED_CONNECT_CNT
@ SYS_EXCEED_CONNECT_CNT
Definition: rodsErrorTable.h:77
startupPack::reconnFlag
int reconnFlag
Definition: rodsDef.h:236
version_t::cookie
int cookie
Definition: rodsDef.h:292
portList_t
Definition: dataObjInpOut.h:29
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
sockClientStop
irods::error sockClientStop(irods::network_object_ptr _ptr, rodsEnv *_env)
Definition: sockComm.cpp:80
userInfo_t::rodsZone
char rodsZone[64]
Definition: rodsUser.h:67
startupPack::proxyUser
char proxyUser[64]
Definition: rodsDef.h:238
irods::NETWORK_OP_READ_HEADER
const std::string NETWORK_OP_READ_HEADER("network_read_header")
irods::log
void log(const error &)
Definition: irods_log.cpp:13
mySockClose
int mySockClose(int sock)
Definition: sockComm.cpp:1573
LOG_NOTICE
#define LOG_NOTICE
Definition: rodsLog.h:33
SYS_PORT_RANGE_EXHAUSTED
@ SYS_PORT_RANGE_EXHAUSTED
Definition: rodsErrorTable.h:216
startupPack::apiVersion
char apiVersion[64]
Definition: rodsDef.h:243
setSockAddr
int setSockAddr(struct sockaddr_in *remoteAddr, const char *rodsHost, int rodsPort)
Definition: rcConnect.cpp:233
ERROR
#define ERROR(code_, message_)
Definition: irods_error.hpp:117
RodsPackTable
const packInstruct_t RodsPackTable[]
Definition: rodsPackTable.h:61
BytesBuf
Definition: rodsDef.h:197
irods::error
Definition: irods_error.hpp:23
getUdpPortFromPortList
int getUdpPortFromPortList(portList_t *thisPortList)
Definition: sockComm.cpp:1475
run_tests.results
def results
Definition: run_tests.py:154
startupPack::irodsProt
irodsProt_t irodsProt
Definition: rodsDef.h:235
rodsEnv::rodsClientServerNegotiation
char rodsClientServerNegotiation[256]
Definition: getRodsEnv.h:23
irods::do_client_server_negotiation_for_client
bool do_client_server_negotiation_for_client()
Definition: irods_client_negotiation.cpp:187
SYS_INVALID_PROTOCOL_TYPE
@ SYS_INVALID_PROTOCOL_TYPE
Definition: rodsErrorTable.h:152
miscServerFunct.hpp
int
typedef int((*funcPtr)())
connectToRhostWithTout
int connectToRhostWithTout(struct sockaddr *sin)
Definition: sockComm.cpp:902
CLOSE_SOCK
#define CLOSE_SOCK
Definition: sockComm.h:36
irods::NETWORK_OP_CLIENT_STOP
const std::string NETWORK_OP_CLIENT_STOP("network_client_stop")
irods::NETWORK_OP_READ_BODY
const std::string NETWORK_OP_READ_BODY("network_read_body")
version_t::relVersion
char relVersion[64]
Definition: rodsDef.h:288
rcGetHostForPut
int rcGetHostForPut(rcComm_t *conn, dataObjInp_t *dataObjInp, char **outHost)
Definition: rcGetHostForPut.cpp:44
startupPack::option
char option[256]
Definition: rodsDef.h:244
startupPack::connectCnt
int connectCnt
Definition: rodsDef.h:237
getHostForPut.h
portList_t::sock
int sock
Definition: dataObjInpOut.h:32
DataObjInp::oprType
int oprType
Definition: dataObjInpOut.h:72
version_t::status
int status
Definition: rodsDef.h:287
irods::network_object_ptr
boost::shared_ptr< network_object > network_object_ptr
Definition: irods_network_object.hpp:78
rcComm_t::portNum
int portNum
Definition: rcConnect.h:99
irods::CFG_SERVER_PORT_RANGE_START_KW
const std::string CFG_SERVER_PORT_RANGE_START_KW("server_port_range_start")
rcDisconnect
int rcDisconnect(rcComm_t *conn)
Definition: rcConnect.cpp:246
rodsLogError
void rodsLogError(int level, int errCode, char *formatStr,...)
Definition: rodsLog.cpp:422
sockOpenForInConn
int sockOpenForInConn(rsComm_t *rsComm, int *portNum, char **addr, int proto)
Definition: sockComm.cpp:289
sendStartupPack
int sendStartupPack(rcComm_t *conn, int connectCnt, int reconnFlag)
Definition: sockComm.cpp:1079
packStruct
int packStruct(const void *inStruct, bytesBuf_t **packedResult, const char *packInstName, const packInstruct_t *myPackTable, int packFlag, irodsProt_t irodsProt)
Definition: packStruct.cpp:21
rcComm_t::svrVersion
version_t * svrVersion
Definition: rcConnect.h:105
USER_SOCK_CONNECT_TIMEDOUT
@ USER_SOCK_CONNECT_TIMEDOUT
Definition: rodsErrorTable.h:268
startupPack
Definition: rodsDef.h:234
irods::exception
Definition: irods_exception.hpp:15
getTcpSockFromPortList
int getTcpSockFromPortList(portList_t *thisPortList)
Definition: sockComm.cpp:1501
SYS_SOCK_BIND_ERR
@ SYS_SOCK_BIND_ERR
Definition: rodsErrorTable.h:70
rcComm_t::reconnectedSock
int reconnectedSock
Definition: rcConnect.h:112
irods::CFG_SERVER_PORT_RANGE_END_KW
const std::string CFG_SERVER_PORT_RANGE_END_KW("server_port_range_end")
DEF_NUMBER_SVR_PORT
#define DEF_NUMBER_SVR_PORT
Definition: sockComm.h:16
sockComm.h
rodsSleep
int rodsSleep(int sec, int microSec)
Definition: sockComm.cpp:1270
THIS_ADDRESS
#define THIS_ADDRESS
Definition: getHostForPut.h:7
irods::client_server_negotiation_for_client
error client_server_negotiation_for_client(irods::network_object_ptr, const std::string &, std::string &)
Definition: irods_client_negotiation.cpp:247
set_tcp_buffer_size
int set_tcp_buffer_size(const int sock, const int tcp_buffer_size, const int socket_option_number)
Definition: sockComm.cpp:575
REQ_SVR_NEG
#define REQ_SVR_NEG
Definition: rodsDef.h:272
freeBBuf
int freeBBuf(bytesBuf_t *myBBuf)
Definition: rcMisc.cpp:88
irods_random.hpp
version_t
Definition: rodsDef.h:286
rcReconnect
int rcReconnect(rcComm_t **conn, char *newHost, rodsEnv *myEnv, int reconnFlag)
Definition: sockComm.cpp:1547
rcComm_t::irodsProt
irodsProt_t irodsProt
Definition: rcConnect.h:96
setConnAddr
int setConnAddr(rcComm_t *conn)
Definition: sockComm.cpp:1015
rcComm_t::windowSize
int windowSize
Definition: rcConnect.h:111
connectToRhostWithRaddr
int connectToRhostWithRaddr(struct sockaddr_in *remoteAddr, int windowSize, int timeoutFlag)
Definition: sockComm.cpp:810
rstrcpy
char * rstrcpy(char *dest, const char *src, int maxLen)
Definition: stringOpr.cpp:51
clientLogin
int clientLogin(rcComm_t *conn, const char *_context, const char *_scheme_override)
Definition: clientLogin.cpp:222
readVersion
irods::error readVersion(irods::network_object_ptr _ptr, version_t **_version)
Definition: sockComm.cpp:484
rodsEnv
Definition: getRodsEnv.h:8
version_t::reconnPort
int reconnPort
Definition: rodsDef.h:290
clearBBuf
int clearBBuf(bytesBuf_t *myBBuf)
Definition: rcMisc.cpp:101
NAME_LEN
#define NAME_LEN
Definition: rodsDef.h:55
SYS_HEADER_WRITE_LEN_ERR
@ SYS_HEADER_WRITE_LEN_ERR
Definition: rodsErrorTable.h:73
CODE
#define CODE(code_)
Definition: irods_error.hpp:120
sockCommNetworkInterface.hpp
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
create_nonblocking_socket
int create_nonblocking_socket(void)
Definition: sockComm.cpp:879
rsComm_t::sock
int sock
Definition: rcConnect.h:147
sendReconnMsg
irods::error sendReconnMsg(irods::network_object_ptr _ptr, reconnMsg_t *_msg)
Definition: sockComm.cpp:1366
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: sockComm.cpp:236
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: sockComm.cpp:1221
READ_VERSION_TOUT_SEC
#define READ_VERSION_TOUT_SEC
Definition: sockComm.h:25
irods_network_plugin.hpp
irods_client_server_negotiation.hpp
rcComm_t::negotiation_results
char negotiation_results[(1024+64)]
Definition: rcConnect.h:125
addUdpPortToPortList
int addUdpPortToPortList(portList_t *thisPortList, int udpport)
Definition: sockComm.cpp:1468
USER__NULL_INPUT_ERR
@ USER__NULL_INPUT_ERR
Definition: rodsErrorTable.h:247
irods::NETWORK_OP_AGENT_START
const std::string NETWORK_OP_AGENT_START("network_agent_start")
SYS_BAD_INPUT
@ SYS_BAD_INPUT
Definition: rodsErrorTable.h:215
USER_RODS_HOSTNAME_ERR
@ USER_RODS_HOSTNAME_ERR
Definition: rodsErrorTable.h:234
rcComm_t::sock
int sock
Definition: rcConnect.h:98