21 #ifndef NET_SOCKETDEVICE_H
22 #define NET_SOCKETDEVICE_H
24 #include <ktorrent_export.h>
25 #include <util/constants.h>
27 #include <net/address.h>
34 SocketDevice(bt::TransportProtocol proto);
35 virtual ~SocketDevice();
46 virtual int fd()
const = 0;
47 virtual bool ok()
const = 0;
48 virtual int send(
const bt::Uint8* buf,
int len) = 0;
49 virtual int recv(bt::Uint8* buf,
int max_len) = 0;
50 virtual void close() = 0;
51 virtual void setBlocking(
bool on) = 0;
52 virtual Uint32 bytesAvailable()
const = 0;
53 virtual bool setTOS(
unsigned char type_of_service) = 0;
54 virtual bool connectTo(
const Address & addr) = 0;
57 virtual const Address & getPeerName()
const = 0;
58 virtual Address getSockName()
const = 0;
71 virtual void reset() = 0;
73 State state()
const {
return m_state;}
76 virtual void prepare(Poll* p,Poll::Mode mode) = 0;
79 virtual bool ready(
const Poll* p,Poll::Mode mode)
const = 0;
84 bool remote_addr_override;
85 bt::TransportProtocol transport_protocol;
90 #endif // NET_SOCKETDEVICE_H
virtual void reset()=0
reset the socket (i.e. close it and create a new one)
virtual bool connectSuccesFull()=0
See if a connectTo was succesfull in non blocking mode.
virtual void prepare(Poll *p, Poll::Mode mode)=0
Prepare for polling.
bt::TransportProtocol transportProtocol() const
Get the used transport protocol for this SocketDevice.
virtual bool ready(const Poll *p, Poll::Mode mode) const =0
Check if the socket is ready according to the poll.
void setRemoteAddress(const Address &a)