22 #ifndef NET_SERVERSOCKET_H
23 #define NET_SERVERSOCKET_H
26 #include <QSharedPointer>
27 #include <ktorrent_export.h>
28 #include <util/constants.h>
29 #include <util/bufferpool.h>
41 class KTORRENT_EXPORT ServerSocket :
public QObject
45 typedef QSharedPointer<ServerSocket> Ptr;
51 class KTORRENT_EXPORT ConnectionHandler
54 virtual ~ConnectionHandler() {}
61 virtual void newConnection(
int fd,
const net::Address & addr) = 0;
67 class KTORRENT_EXPORT DataHandler
77 virtual void dataReceived(bt::Buffer::Ptr buffer,
const net::Address & addr) = 0;
106 bool bind(
const QString & ip,bt::Uint16 port);
122 int sendTo(
const QByteArray & data,
const net::Address & addr);
132 int sendTo(
const bt::Uint8* buf,
int size,
const net::Address & addr);
138 void setWriteNotificationsEnabled(
bool on);
144 void setReadNotificationsEnabled(
bool on);
151 bool setTOS(
unsigned char type_of_service);
154 void readyToAccept(
int fd);
155 void readyToRead(
int fd);
156 void readyToWrite(
int fd);
165 #endif // NET_SERVERSOCKET_H