10 #include "iwvstream.h"
11 #include "wvtimeutils.h"
12 #include "wvstreamsdebugger.h"
73 virtual void seterr(
int _errnum);
76 void seterr(WVSTRING_FORMAT_DECL)
80 virtual bool isok()
const;
83 virtual size_t read(
void *buf,
size_t count);
94 virtual size_t read(
WvBuf &outbuf,
size_t count);
109 virtual size_t write(
const void *buf,
size_t count);
118 virtual size_t write(
WvBuf &inbuf,
size_t count = INT_MAX);
130 { max_outbuf_size = size; }
146 virtual size_t uread(
void *buf,
size_t count)
156 virtual size_t uwrite(
const void *buf,
size_t count)
176 char separator =
'\n',
int readahead = 1024)
183 char separator =
'\n',
int readahead = 1024)
185 return getline(time_t(wait_msec), separator, readahead);
190 char separator =
'\n',
int readahead = 1024)
192 return getline(time_t(wait_msec), separator, readahead);
200 char *
getline(
char,
int i = 0);
201 char *
getline(
bool,
int i = 0);
216 int readahead = 1024);
223 int readahead = 1024);
233 { queue_min = count; }
248 outbuf_delayed_flush = is_delayed;
249 want_to_flush = !is_delayed;
259 { is_auto_flush = is_automatic; }
267 virtual bool flush(time_t msec_timeout);
377 {
return _select(msec_timeout,
false,
false,
false,
true); }
416 bool readable,
bool writable,
bool isex =
false)
417 {
return _select(msec_timeout, readable, writable, isex,
false); }
434 void force_select(
bool readable,
bool writable,
bool isexception =
false);
441 bool isexception =
false);
525 void alarm(time_t msec_timeout);
548 size_t operator() (WVSTRING_FORMAT_DECL)
551 const char *wsname()
const
552 {
return my_wsname; }
554 { my_wsname = wsname; }
555 void set_wsname(WVSTRING_FORMAT_DECL)
556 { set_wsname(
WvString(WVSTRING_FORMAT_CALL)); }
558 const char *wstype()
const {
return "WvStream"; }
560 WSID wsid()
const {
return my_wsid; }
561 static IWvStream *find_by_wsid(WSID wsid);
564 {
return attrs.get(name); }
569 #ifdef __WVSTREAM_UNIT_TEST
572 {
return outbuf.
used(); }
574 {
return inbuf.
used(); }
581 { attrs.set(name, value); }
587 void _build_selectinfo(SelectInfo &si, time_t msec_timeout,
588 bool readable,
bool writable,
bool isexcept,
594 int _do_select(SelectInfo &si);
598 bool _process_selectinfo(SelectInfo &si,
bool forceable);
604 bool flush_outbuf(time_t msec_timeout);
608 virtual bool flush_internal(time_t msec_timeout);
613 virtual int getrfd()
const;
614 virtual int getwfd()
const;
618 friend class WvHTTPClientProxyStream;
622 IWvStreamCallback callfunc;
623 wv::function<void*(void*)> call_ctx;
625 IWvStreamCallback readcb, writecb, exceptcb, closecb;
627 size_t max_outbuf_size;
628 bool outbuf_delayed_flush;
638 time_t autoclose_time;
658 static void debugger_streams_display_header(
WvStringParm cmd,
659 WvStreamsDebugger::ResultCallback result_cb);
660 static void debugger_streams_display_one_stream(
WvStream *s,
662 WvStreamsDebugger::ResultCallback result_cb);
663 static void debugger_streams_maybe_display_one_stream(
WvStream *s,
666 WvStreamsDebugger::ResultCallback result_cb);
670 bool _select(time_t msec_timeout,
671 bool readable,
bool writable,
bool isexcept,
674 void legacy_callback();
679 static void add_debugger_commands();
683 WvStreamsDebugger::ResultCallback result_cb,
void *);
686 WvStreamsDebugger::ResultCallback result_cb,
void *);
700 #endif // __WVSTREAM_H