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)  

libtcp.cpp
Go to the documentation of this file.
1 // =-=-=-=-=-=-=-
2 // irods includes
3 #include "rodsDef.h"
4 #include "msParam.h"
5 #include "rcConnect.h"
6 #include "sockComm.h"
7 
8 // =-=-=-=-=-=-=-
11 #include "irods_tcp_object.hpp"
12 #include "irods_stacktrace.hpp"
14 
15 // =-=-=-=-=-=-=-
16 // stl includes
17 #include <sstream>
18 #include <string>
19 #include <iostream>
20 
21 // =-=-=-=-=-=-=-
22 // local function to read a buffer from a socket
24  int _socket,
25  void* _buffer,
26  int _length,
27  int& _bytes_read,
28  struct timeval* _time_value ) {
29  // =-=-=-=-=-=-=-
30  // Initialize the file descriptor set
31  fd_set set;
32  FD_ZERO( &set );
33  FD_SET( _socket, &set );
34 
35  // =-=-=-=-=-=-=-
36  // local copy of time value?
37  struct timeval timeout;
38  if ( _time_value != NULL ) {
39  timeout = ( *_time_value );
40  }
41 
42  // =-=-=-=-=-=-=-
43  // local working variables
44  int len_to_read = _length;
45  char* read_ptr = static_cast<char*>( _buffer );
46 
47  // =-=-=-=-=-=-=-
48  // reset bytes read
49  _bytes_read = 0;
50 
51  while ( len_to_read > 0 ) {
52  if ( nullptr != _time_value ) {
53  const int status = select( _socket + 1, &set, NULL, NULL, &timeout );
54  if ( status == 0 ) { // the select has timed out
55  return ERROR( SYS_SOCK_READ_TIMEDOUT, boost::format("socket timeout with [%d] bytes read") % _bytes_read);
56  } else if ( status < 0 ) {
57  if ( errno == EINTR ) {
58  continue;
59  } else {
60  return ERROR( SYS_SOCK_READ_ERR - errno, boost::format("error on select after [%d] bytes read") % _bytes_read);
61  }
62  } // else
63  } // if tv
64 
65  int num_bytes = read( _socket, ( void * ) read_ptr, len_to_read );
66  if ( num_bytes < 0 ) {
67  if ( EINTR == errno ) {
68  errno = 0;
69  num_bytes = 0;
70  } else {
71  return ERROR(SYS_SOCK_READ_ERR - errno, boost::format("error reading from socket after [%d] bytes read") % _bytes_read);
72  }
73  } else if ( num_bytes == 0 ) {
74  break;
75  }
76 
77  len_to_read -= num_bytes;
78  read_ptr += num_bytes;
79  _bytes_read += num_bytes;
80  } // while
81 
82  return CODE( _length - len_to_read );
83 } // tcp_socket_read
84 
85 // =-=-=-=-=-=-=-
86 // local function to write a buffer to a socket
88  int _socket,
89  void* _buffer,
90  int _length,
91  int& _bytes_written ) {
92  // =-=-=-=-=-=-=-
93  // local variables for write
94  int len_to_write = _length;
95  char* write_ptr = static_cast<char*>( _buffer );
96 
97  // =-=-=-=-=-=-=-
98  // reset bytes written
99  _bytes_written = 0;
100 
101  // =-=-=-=-=-=-=-
102  // loop while there is data to read
103  while ( len_to_write > 0 ) {
104  int num_bytes = write( _socket,
105  static_cast<void*>( write_ptr ),
106  len_to_write );
107  // =-=-=-=-=-=-=-
108  // error trapping the write
109  if ( num_bytes <= 0 ) {
110  // =-=-=-=-=-=-=-
111  // gracefully handle an interrupt
112  if ( errno == EINTR ) {
113  errno = 0;
114  num_bytes = 0;
115 
116  }
117  else {
118  break;
119 
120  }
121  }
122 
123  // =-=-=-=-=-=-=-
124  // increment working variables
125  len_to_write -= num_bytes;
126  write_ptr += num_bytes;
127  _bytes_written += num_bytes;
128 
129  }
130 
131  // =-=-=-=-=-=-=-
132  // and were done? report length not written
133  return CODE( _length - len_to_write );
134 
135 } // tcp_socket_write
136 
137 // =-=-=-=-=-=-=-
138 //
141  return SUCCESS();
142 
143 } // tcp_start
144 
145 // =-=-=-=-=-=-=-
146 //
149  return SUCCESS();
150 
151 } // tcp_end
152 
153 // =-=-=-=-=-=-=-
154 //
157  return SUCCESS();
158 
159 } // tcp_end
160 
161 // =-=-=-=-=-=-=-
162 //
164  irods::plugin_context& _ctx,
165  void* _buffer,
166  struct timeval* _time_val ) {
167  // =-=-=-=-=-=-=-
168  // check the context
169  irods::error ret = _ctx.valid< irods::tcp_object >();
170  if ( !ret.ok() ) {
171  return PASS( ret );
172  }
173 
174  // =-=-=-=-=-=-=-
175  // extract the useful bits from the context
176  irods::tcp_object_ptr tcp = boost::dynamic_pointer_cast< irods::tcp_object >( _ctx.fco() );
177  int socket_handle = tcp->socket_handle();
178 
179  // =-=-=-=-=-=-=-
180  // read the header length packet */
181  int header_length = 0;
182  int bytes_read = 0;
183  ret = tcp_socket_read(
184  socket_handle,
185  static_cast<void*>( &header_length ),
186  sizeof( header_length ),
187  bytes_read,
188  _time_val );
189  if (!ret.ok()) {
190  return PASS(ret);
191  }
192 
193  if (bytes_read != sizeof(header_length)) {
194  return ERROR(SYS_HEADER_READ_LEN_ERR, boost::format("only read [%d] of [%d]") % bytes_read % sizeof(header_length));
195  }
196 
197  header_length = ntohl( header_length );
198 
199  // check head length against expected size range
200  if ( header_length > MAX_NAME_LEN ||
201  header_length <= 0 ) {
202  std::stringstream msg;
203  msg << "header length is out of range: "
204  << header_length
205  << " expected >= 0 and < "
206  << MAX_NAME_LEN;
207  return ERROR( SYS_HEADER_READ_LEN_ERR, msg.str() );
208  }
209 
210  // now read the actual header
211  ret = tcp_socket_read(
212  socket_handle,
213  _buffer,
214  header_length,
215  bytes_read,
216  _time_val );
217 
218  if (!ret.ok()) {
219  return PASS(ret);
220  }
221 
222  if (bytes_read != header_length) {
223  return ERROR(SYS_HEADER_READ_LEN_ERR, boost::format("only read [%d] of [%d]") % bytes_read % header_length);
224  }
225 
226  rodsLog(LOG_DEBUG8, "received header: len = %d\n%.*s\n", header_length, bytes_read, static_cast<char*>( _buffer ) );
227 
228  return SUCCESS();
229 } // tcp_read_msg_header
230 
231 // =-=-=-=-=-=-=-
232 //
234  irods::plugin_context& _ctx,
235  bytesBuf_t* _header ) {
236  // =-=-=-=-=-=-=-
237  // check the context
238  irods::error ret = _ctx.valid< irods::tcp_object >();
239  if ( !ret.ok() ) {
240  return PASS( ret );
241  }
242 
243  // =-=-=-=-=-=-=-
244  // log debug information if appropriate
245  if ( getRodsLogLevel() >= LOG_DEBUG8 ) {
246  printf( "sending header: len = %d\n%.*s\n",
247  _header->len,
248  _header->len,
249  ( char * ) _header->buf );
250  }
251 
252  // =-=-=-=-=-=-=-
253  // extract the useful bits from the context
254  irods::tcp_object_ptr tcp = boost::dynamic_pointer_cast< irods::tcp_object >( _ctx.fco() );
255  int socket_handle = tcp->socket_handle();
256 
257  // =-=-=-=-=-=-=-
258  // convert host byte order to network byte order
259  int header_length = htonl( _header->len );
260 
261  // =-=-=-=-=-=-=-
262  // write the length of the header to the socket
263  int bytes_written = 0;
264  ret = tcp_socket_write(
265  socket_handle,
266  &header_length,
267  sizeof( header_length ),
268  bytes_written );
269  if ( !ret.ok() ||
270  bytes_written != sizeof( header_length ) ) {
271  std::stringstream msg;
272  msg << "wrote "
273  << bytes_written
274  << " expected " << header_length;
275  return ERROR( SYS_HEADER_WRITE_LEN_ERR - errno,
276  msg.str() );
277  }
278 
279  // =-=-=-=-=-=-=-
280  // now send the actual header
281  ret = tcp_socket_write(
282  socket_handle,
283  _header->buf,
284  _header->len,
285  bytes_written );
286  if ( !ret.ok() ||
287  bytes_written != _header->len ) {
288  std::stringstream msg;
289  msg << "wrote "
290  << bytes_written
291  << " expected " << _header->len;
292  return ERROR( SYS_HEADER_WRITE_LEN_ERR - errno,
293  msg.str() );
294  }
295 
296  return SUCCESS();
297 
298 } // tcp_write_msg_header
299 
300 // =-=-=-=-=-=-=-
301 //
303  irods::plugin_context& _ctx,
304  const char* _msg_type,
305  bytesBuf_t* _msg_buf,
306  bytesBuf_t* _stream_bbuf,
307  bytesBuf_t* _error_buf,
308  int _int_info,
309  irodsProt_t _protocol ) {
310  // =-=-=-=-=-=-=-
311  // check the context
312  irods::error ret = _ctx.valid< irods::tcp_object >();
313  if ( !ret.ok() ) {
314  return PASS( ret );
315  }
316 
317  // =-=-=-=-=-=-=-
318  // check the params
319  if ( !_msg_type ) {
320  return ERROR( SYS_INVALID_INPUT_PARAM, "null msg type" );
321  }
322 
323 
324  // =-=-=-=-=-=-=-
325  // extract the useful bits from the context
326  irods::tcp_object_ptr tcp = boost::dynamic_pointer_cast< irods::tcp_object >( _ctx.fco() );
327  int socket_handle = tcp->socket_handle();
328 
329  // =-=-=-=-=-=-=-
330  // initialize a new header
331  msgHeader_t msg_header;
332  memset( &msg_header, 0, sizeof( msg_header ) );
333 
334  snprintf( msg_header.type, HEADER_TYPE_LEN, "%s", _msg_type );
335  msg_header.intInfo = _int_info;
336 
337  // =-=-=-=-=-=-=-
338  // initialize buffer lengths
339  if ( _msg_buf ) {
340  msg_header.msgLen = _msg_buf->len;
341  }
342  if ( _stream_bbuf ) {
343  msg_header.bsLen = _stream_bbuf->len;
344  }
345  if ( _error_buf ) {
346  msg_header.errorLen = _error_buf->len;
347  }
348 
349  // =-=-=-=-=-=-=-
350  // send the header
351  ret = writeMsgHeader(
352  tcp,
353  &msg_header );
354  if ( !ret.ok() ) {
355  return PASSMSG( "writeMsgHeader failed", ret );
356  }
357 
358  // =-=-=-=-=-=-=-
359  // send the message buffer
360  int bytes_written = 0;
361  if ( _msg_buf && _msg_buf->len > 0 ) {
362  if ( XML_PROT == _protocol &&
363  getRodsLogLevel() >= LOG_DEBUG8 ) {
364  printf( "sending msg: \n%.*s\n", _msg_buf->len, ( char* ) _msg_buf->buf );
365  }
366  ret = tcp_socket_write(
367  socket_handle,
368  _msg_buf->buf,
369  _msg_buf->len,
370  bytes_written );
371  if ( !ret.ok() ) {
372  return PASS( ret );
373  }
374 
375  } // if msgLen > 0
376 
377  // =-=-=-=-=-=-=-
378  // send the error buffer
379  if ( _error_buf && _error_buf->len > 0 ) {
380  if ( XML_PROT == _protocol &&
381  getRodsLogLevel() >= LOG_DEBUG8 ) {
382  printf( "sending msg: \n%.*s\n", _error_buf->len, ( char* ) _error_buf->buf );
383 
384  }
385 
386  ret = tcp_socket_write(
387  socket_handle,
388  _error_buf->buf,
389  _error_buf->len,
390  bytes_written );
391  if ( !ret.ok() ) {
392  return PASS( ret );
393  }
394 
395  } // if errorLen > 0
396 
397  // =-=-=-=-=-=-=-
398  // send the stream buffer
399  if ( _stream_bbuf && _stream_bbuf->len > 0 ) {
400  if ( XML_PROT == _protocol &&
401  getRodsLogLevel() >= LOG_DEBUG8 ) {
402  printf( "sending msg: \n%.*s\n", _stream_bbuf->len, ( char* ) _stream_bbuf->buf );
403  }
404 
405  ret = tcp_socket_write(
406  socket_handle,
407  _stream_bbuf->buf,
408  _stream_bbuf->len,
409  bytes_written );
410  if ( !ret.ok() ) {
411  return PASS( ret );
412  }
413 
414  } // if bsLen > 0
415 
416  return SUCCESS();
417 
418 } // tcp_send_rods_msg
419 
420 // =-=-=-=-=-=-=-
421 // helper fcn to read a bytes buf
423  int _socket_handle,
424  int _length,
425  bytesBuf_t* _buffer,
426  irodsProt_t _protocol,
427  struct timeval* _time_val ) {
428  // =-=-=-=-=-=-=-
429  // trap input buffer ptr
430  if ( !_buffer || !_buffer->buf ) {
432  "null buffer ptr" );
433  }
434 
435  int bytes_read = 0;
436 
437  // read buffer
439  _socket_handle,
440  _buffer->buf,
441  _length,
442  bytes_read,
443  _time_val );
444  _buffer->len = bytes_read;
445 
446  // log transaction if requested
447  if ( _protocol == XML_PROT ) {
448  rodsLog(LOG_DEBUG8, "received msg: \n%.*s\n", _buffer->len, ( char* )_buffer->buf );
449  }
450 
451  if (!ret.ok()) {
452  free(_buffer->buf);
453  return PASS(ret);
454  }
455 
456  if (bytes_read != _length) {
457  free(_buffer->buf);
458  return ERROR(SYS_READ_MSG_BODY_LEN_ERR, boost::format("only read [%d] of [%d]") % bytes_read % _length);
459  }
460 
461  return SUCCESS();
462 
463 } // read_bytes_buf
464 
465 // =-=-=-=-=-=-=-
466 // read a message body off of the socket
468  irods::plugin_context& _ctx,
469  msgHeader_t* _header,
470  bytesBuf_t* _input_struct_buf,
471  bytesBuf_t* _bs_buf,
472  bytesBuf_t* _error_buf,
473  irodsProt_t _protocol,
474  struct timeval* _time_val ) {
475 
476  // =-=-=-=-=-=-=-
477  // client make the assumption that we clear the error
478  // buffer for them
479  if ( _error_buf ) {
480  memset( _error_buf, 0, sizeof( bytesBuf_t ) );
481 
482  }
483 
484  // =-=-=-=-=-=-=-
485  // check the context
486  irods::error ret = _ctx.valid< irods::tcp_object >();
487  if ( !ret.ok() ) {
488  return PASS( ret );
489  }
490 
491  // =-=-=-=-=-=-=-
492  // extract the useful bits from the context
493  irods::tcp_object_ptr tcp = boost::dynamic_pointer_cast< irods::tcp_object >( _ctx.fco() );
494  int socket_handle = tcp->socket_handle();
495 
496  // =-=-=-=-=-=-=-
497  // trap header ptr
498  if ( !_header ) {
500  "null header ptr" );
501  }
502 
503  // =-=-=-=-=-=-=-
504  // reset error buf
505  // NOTE :: do not reset bs buf as it can be reused
506  // on the client side
507  if ( _error_buf ) {
508  }
509 
510  // =-=-=-=-=-=-=-
511  // read input buffer
512  if ( 0 != _input_struct_buf ) {
513  if ( _header->msgLen > 0 ) {
514  _input_struct_buf->buf = malloc( _header->msgLen + 1 );
515 
516  ret = read_bytes_buf(
517  socket_handle,
518  _header->msgLen,
519  _input_struct_buf,
520  _protocol,
521  _time_val );
522  if ( !ret.ok() ) {
523  return PASS( ret );
524  }
525 
526  }
527  else {
528  // =-=-=-=-=-=-=-
529  // ensure msg len is 0 as this can cause issues
530  // in the agent
531  _input_struct_buf->len = 0;
532 
533  }
534 
535  } // input buffer
536 
537  // =-=-=-=-=-=-=-
538  // read error buffer
539  if ( 0 != _error_buf ) {
540  if ( _header->errorLen > 0 ) {
541  _error_buf->buf = malloc( _header->errorLen + 1 );
542  ret = read_bytes_buf(
543  socket_handle,
544  _header->errorLen,
545  _error_buf,
546  _protocol,
547  _time_val );
548  if ( !ret.ok() ) {
549  return PASS( ret );
550  }
551  }
552  else {
553  _error_buf->len = 0;
554 
555  }
556 
557  } // error buffer
558 
559  // =-=-=-=-=-=-=-
560  // read bs buffer
561  if ( 0 != _bs_buf ) {
562  if ( _header->bsLen > 0 ) {
563  // do not repave bs buf as it can be
564  // reused by the client
565  if ( _bs_buf->buf == NULL ) {
566  _bs_buf->buf = malloc( _header->bsLen + 1 );
567 
568  }
569  else if ( _header->bsLen > _bs_buf->len ) {
570  free( _bs_buf->buf );
571  _bs_buf->buf = malloc( _header->bsLen + 1 );
572 
573  }
574 
575  ret = read_bytes_buf(
576  socket_handle,
577  _header->bsLen,
578  _bs_buf,
579  _protocol,
580  _time_val );
581  if ( !ret.ok() ) {
582  return PASS( ret );
583  }
584  }
585  else {
586  _bs_buf->len = 0;
587 
588  }
589 
590  } // bs buffer
591 
592  return SUCCESS();
593 
594 } // tcp_read_msg_body
595 
596 // =-=-=-=-=-=-=-
597 // stubs for ops that the tcp plug does
598 // not need to support - accept etc
601  rodsEnv* ) {
602  return SUCCESS();
603 
604 } // tcp_success_stub
605 
607  irods::plugin_context& _ctx,
608  rodsEnv* _env ) {
609  return SUCCESS();
610 }
611 
614  return SUCCESS();
615 
616 } // tcp_success_stub
617 
620  return SUCCESS();
621 
622 } // tcp_success_stub
623 
624 // =-=-=-=-=-=-=-
625 // derive a new tcp network plugin from
626 // the network plugin base class for handling
627 // tcp communications
629  public:
631  const std::string& _nm,
632  const std::string& _ctx ) :
633  irods::network(
634  _nm,
635  _ctx ) {
636  } // ctor
637 
639  }
640 
641 }; // class tcp_network_plugin
642 
643 
644 
645 // =-=-=-=-=-=-=-
646 // factory function to provide instance of the plugin
647 extern "C"
649  const std::string& _inst_name,
650  const std::string& _context ) {
651  // =-=-=-=-=-=-=-
652  // create a tcp network object
654  _inst_name,
655  _context );
656 
657  // =-=-=-=-=-=-=-
658  // fill in the operation table mapping call
659  // names to function names
660  using namespace irods;
661  using namespace std;
662  tcp->add_operation<rodsEnv*>(
664  function<error(plugin_context&,rodsEnv*)>(
665  tcp_client_start ) );
666  tcp->add_operation<rodsEnv*>(
668  function<error(plugin_context&,rodsEnv*)>(
669  tcp_client_stop ) );
670  tcp->add_operation(
672  function<error(plugin_context&)>(
673  tcp_agent_start ) );
674  tcp->add_operation(
676  function<error(plugin_context&)>(
677  tcp_agent_stop ) );
678  tcp->add_operation<void*, struct timeval*>(
680  function<error(plugin_context&,void*, struct timeval*)>(
684  function<error(plugin_context&,msgHeader_t*,bytesBuf_t*,bytesBuf_t*,bytesBuf_t*,irodsProt_t,struct timeval*)>(
685  tcp_read_msg_body ) );
686  tcp->add_operation<bytesBuf_t*>(
688  function<error(plugin_context&,bytesBuf_t*)>(
692  function<error(plugin_context&,const char*,bytesBuf_t*,bytesBuf_t*,bytesBuf_t*,int,irodsProt_t)>(
693  tcp_send_rods_msg ) );
694 
695  irods::network* net = dynamic_cast< irods::network* >( tcp );
696 
697  return net;
698 
699 } // plugin_factory
msgHeader::errorLen
int errorLen
Definition: rodsDef.h:213
rodsLog
void rodsLog(int level, const char *formatStr,...)
Definition: rodsLog.cpp:86
irods::tcp_object
Definition: irods_tcp_object.hpp:14
tcp_client_stop
irods::error tcp_client_stop(irods::plugin_context &, rodsEnv *)
Definition: libtcp.cpp:599
msgHeader::bsLen
int bsLen
Definition: rodsDef.h:214
NULL
#define NULL
Definition: rodsDef.h:70
tcp_read_msg_body
irods::error tcp_read_msg_body(irods::plugin_context &_ctx, msgHeader_t *_header, bytesBuf_t *_input_struct_buf, bytesBuf_t *_bs_buf, bytesBuf_t *_error_buf, irodsProt_t _protocol, struct timeval *_time_val)
Definition: libtcp.cpp:467
irods::tcp_object_ptr
boost::shared_ptr< tcp_object > tcp_object_ptr
Definition: irods_tcp_object.hpp:53
msgHeader
Definition: rodsDef.h:210
tcp_socket_write
irods::error tcp_socket_write(int _socket, void *_buffer, int _length, int &_bytes_written)
Definition: libtcp.cpp:87
irods::NETWORK_OP_WRITE_BODY
const std::string NETWORK_OP_WRITE_BODY("network_write_body")
BytesBuf::buf
void * buf
Definition: rodsDef.h:199
msParam.h
irods::plugin_context::valid
virtual error valid()
Definition: irods_plugin_context.hpp:77
tcp_agent_stop
irods::error tcp_agent_stop(irods::plugin_context &)
Definition: libtcp.cpp:612
HEADER_TYPE_LEN
#define HEADER_TYPE_LEN
Definition: rodsDef.h:53
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")
plugin_factory
irods::network * plugin_factory(const std::string &_inst_name, const std::string &_context)
Definition: libtcp.cpp:648
XML_PROT
@ XML_PROT
Definition: rodsDef.h:149
irods::NETWORK_OP_CLIENT_START
const std::string NETWORK_OP_CLIENT_START("network_client_start")
rcConnect.h
irods::network
Definition: irods_network_plugin.hpp:18
LOG_DEBUG8
#define LOG_DEBUG8
Definition: rodsLog.h:21
PASSMSG
#define PASSMSG(message_, prev_error_)
Definition: irods_error.hpp:119
irods::NETWORK_OP_WRITE_HEADER
const std::string NETWORK_OP_WRITE_HEADER("network_write_header")
irods::plugin_context
Definition: irods_plugin_context.hpp:18
SYS_INVALID_INPUT_PARAM
@ SYS_INVALID_INPUT_PARAM
Definition: rodsErrorTable.h:195
tcp_network_plugin
Definition: libtcp.cpp:628
BytesBuf::len
int len
Definition: rodsDef.h:198
SYS_READ_MSG_BODY_INPUT_ERR
@ SYS_READ_MSG_BODY_INPUT_ERR
Definition: rodsErrorTable.h:79
msgHeader::msgLen
int msgLen
Definition: rodsDef.h:212
SUCCESS
#define SUCCESS()
Definition: irods_error.hpp:121
SYS_HEADER_READ_LEN_ERR
@ SYS_HEADER_READ_LEN_ERR
Definition: rodsErrorTable.h:72
irodsProt_t
irodsProt_t
Definition: rodsDef.h:147
SYS_READ_MSG_BODY_LEN_ERR
@ SYS_READ_MSG_BODY_LEN_ERR
Definition: rodsErrorTable.h:156
SYS_SOCK_READ_ERR
@ SYS_SOCK_READ_ERR
Definition: rodsErrorTable.h:181
getRodsLogLevel
int getRodsLogLevel()
Definition: rodsLog.cpp:344
irods
Definition: apiHandler.hpp:35
rodsDef.h
tcp_start
irods::error tcp_start(irods::plugin_context &)
Definition: libtcp.cpp:139
tcp_read_msg_header
irods::error tcp_read_msg_header(irods::plugin_context &_ctx, void *_buffer, struct timeval *_time_val)
Definition: libtcp.cpp:163
tcp_client_start
irods::error tcp_client_start(irods::plugin_context &_ctx, rodsEnv *_env)
Definition: libtcp.cpp:606
irods_network_constants.hpp
tcp_write_msg_header
irods::error tcp_write_msg_header(irods::plugin_context &_ctx, bytesBuf_t *_header)
Definition: libtcp.cpp:233
MAX_NAME_LEN
#define MAX_NAME_LEN
Definition: rodsDef.h:61
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
irods::NETWORK_OP_READ_HEADER
const std::string NETWORK_OP_READ_HEADER("network_read_header")
read_bytes_buf
irods::error read_bytes_buf(int _socket_handle, int _length, bytesBuf_t *_buffer, irodsProt_t _protocol, struct timeval *_time_val)
Definition: libtcp.cpp:422
ERROR
#define ERROR(code_, message_)
Definition: irods_error.hpp:117
BytesBuf
Definition: rodsDef.h:197
irods::error
Definition: irods_error.hpp:23
writeMsgHeader
irods::error writeMsgHeader(irods::network_object_ptr, msgHeader_t *)
Definition: sockComm.cpp:435
int
typedef int((*funcPtr)())
irods::network::network
network(const std::string &_inst, const std::string &_ctx)
Definition: irods_network_plugin.hpp:22
irods::NETWORK_OP_CLIENT_STOP
const std::string NETWORK_OP_CLIENT_STOP("network_client_stop")
SYS_SOCK_READ_TIMEDOUT
@ SYS_SOCK_READ_TIMEDOUT
Definition: rodsErrorTable.h:180
irods::NETWORK_OP_READ_BODY
const std::string NETWORK_OP_READ_BODY("network_read_body")
msgHeader::intInfo
int intInfo
Definition: rodsDef.h:215
error
int error
Definition: filesystem.cpp:101
irods::plugin_base::add_operation
error add_operation(const std::string &_op, std::function< error(plugin_context &)> _f)
Definition: irods_plugin_base.hpp:122
irods::plugin_context::fco
virtual first_class_object_ptr fco()
Definition: irods_plugin_context.hpp:102
tcp_shutdown
irods::error tcp_shutdown(irods::plugin_context &)
Definition: libtcp.cpp:155
tcp_network_plugin::tcp_network_plugin
tcp_network_plugin(const std::string &_nm, const std::string &_ctx)
Definition: libtcp.cpp:630
sockComm.h
tcp_socket_read
irods::error tcp_socket_read(int _socket, void *_buffer, int _length, int &_bytes_read, struct timeval *_time_value)
Definition: libtcp.cpp:23
rodsEnv
Definition: getRodsEnv.h:8
SYS_HEADER_WRITE_LEN_ERR
@ SYS_HEADER_WRITE_LEN_ERR
Definition: rodsErrorTable.h:73
tcp_end
irods::error tcp_end(irods::plugin_context &)
Definition: libtcp.cpp:147
CODE
#define CODE(code_)
Definition: irods_error.hpp:120
sockCommNetworkInterface.hpp
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
tcp_agent_start
irods::error tcp_agent_start(irods::plugin_context &)
Definition: libtcp.cpp:618
irods_tcp_object.hpp
tcp_send_rods_msg
irods::error tcp_send_rods_msg(irods::plugin_context &_ctx, const char *_msg_type, bytesBuf_t *_msg_buf, bytesBuf_t *_stream_bbuf, bytesBuf_t *_error_buf, int _int_info, irodsProt_t _protocol)
Definition: libtcp.cpp:302
tcp_network_plugin::~tcp_network_plugin
~tcp_network_plugin()
Definition: libtcp.cpp:638
irods_network_plugin.hpp
irods::NETWORK_OP_AGENT_START
const std::string NETWORK_OP_AGENT_START("network_agent_start")