libktorrent  2.1.1
Public Types | Public Member Functions | List of all members
bt::Packet Class Reference

#include <packet.h>

Public Types

typedef QSharedPointer< PacketPtr
 

Public Member Functions

 Packet (const BitSet &bs)
 
 Packet (const Request &req, Uint8 type)
 
 Packet (Uint16 port)
 
 Packet (Uint32 chunk, Uint8 type)
 
 Packet (Uint32 index, Uint32 begin, Uint32 len, Chunk *ch)
 
 Packet (Uint8 ext_id, const QByteArray &ext_data)
 
 Packet (Uint8 type)
 
Uint8 * getData ()
 
const Uint8 * getData () const
 
Uint32 getDataLength () const
 
Uint8 getType () const
 Get the packet type.
 
bool isOK () const
 
bool isPiece (const Request &req) const
 
Uint32 isSent () const
 Is the packet sent ?
 
PacketmakeRejectOfPiece ()
 
int send (net::SocketDevice *sock, Uint32 max_to_send)
 
bool sending () const
 Are we sending this packet ?
 

Detailed Description

Author
Joris Guisson

Packet off data, which gets sent to a Peer

Definition at line 43 of file packet.h.

Member Function Documentation

◆ isPiece()

bool bt::Packet::isPiece ( const Request req) const

Is this a piece packet which matches a request

Parameters
reqThe request
Returns
If this is a piece in response of this request

◆ makeRejectOfPiece()

Packet* bt::Packet::makeRejectOfPiece ( )

If this packet is a piece, make a reject for it

Returns
The newly created Packet, 0 if this is not a piece

◆ send()

int bt::Packet::send ( net::SocketDevice sock,
Uint32  max_to_send 
)

Send the packet over a SocketDevice

Parameters
sockThe socket
max_to_sendMax bytes to send
Returns
int Return value of send call from SocketDevice

The documentation for this class was generated from the following file: