Public Member Functions | List of all members
BPrivate::Network::BUrlProtocolListener Class Reference

Abstract interface for handling BUrlRequest events. More...

Inherited by BPrivate::Network::BUrlProtocolAsynchronousListener.

Public Member Functions

virtual void BytesWritten (BUrlRequest *caller, size_t bytesWritten)
 Called each time a block of data is written. More...
 
virtual bool CertificateVerificationFailed (BUrlRequest *caller, BCertificate &certificate, const char *message)
 Called when cerificate verification failed. More...
 
virtual void ConnectionOpened (BUrlRequest *caller)
 Called when the socket is opened. More...
 
virtual void DebugMessage (BUrlRequest *caller, BUrlProtocolDebugMessage type, const char *text)
 Called each time a debug message is emitted. More...
 
virtual void DownloadProgress (BUrlRequest *caller, off_t bytesReceived, off_t bytesTotal)
 Called each time a block of data is downloaded. More...
 
virtual void HeadersReceived (BUrlRequest *caller)
 Called when all of the server response metadata (such as headers) have been read and parsed. More...
 
virtual void HostnameResolved (BUrlRequest *caller, const char *ip)
 Called when the final IP is discovered. More...
 
virtual void RequestCompleted (BUrlRequest *caller, bool success)
 Called once the request is complete. More...
 
virtual void ResponseStarted (BUrlRequest *caller)
 Called when the request has been emitted and the server begins to reply. More...
 
virtual void UploadProgress (BUrlRequest *caller, off_t bytesSent, off_t bytesTotal)
 Called each time a block of data is sent. More...
 

Detailed Description

Abstract interface for handling BUrlRequest events.

BUrlProtocolListener is the base class for handling networking events from BUrlRequest.

Member Function Documentation

◆ BytesWritten()

void BUrlProtocolListener::BytesWritten ( BUrlRequest caller,
size_t  size 
)
virtual

Called each time a block of data is written.

This callback is called whenever a block of data is written to the BDataIO associated with the request. If no BDataIO is associated, the callback will not be invoked.

Frequency: Zero or more

Parameters
callerThe BUrlRequest that invoked this callback.
sizeSize of the written data block.

◆ CertificateVerificationFailed()

bool BUrlProtocolListener::CertificateVerificationFailed ( BUrlRequest caller,
BCertificate &  certificate,
const char *  message 
)
virtual

Called when cerificate verification failed.

Frequency: Once

Parameters
callerThe BUrlRequest that invoked this callback.
certificateThe SSL certificate of which validation failed.
messageThe error message describing the issue.
Returns
true to ignore and proceed with the request, false to abort.

◆ ConnectionOpened()

void BUrlProtocolListener::ConnectionOpened ( BUrlRequest caller)
virtual

Called when the socket is opened.

Frequency: Once

Parameters
callerThe BUrlRequest that invoked this callback.

◆ DebugMessage()

void BUrlProtocolListener::DebugMessage ( BUrlRequest caller,
BUrlProtocolDebugMessage  type,
const char *  text 
)
virtual

Called each time a debug message is emitted.

Frequency: Zero or more

Parameters
callerThe BUrlRequest that invoked this callback.
typeType of the message.
textThe message.

◆ DownloadProgress()

void BUrlProtocolListener::DownloadProgress ( BUrlRequest caller,
off_t  bytesReceived,
off_t  bytesTotal 
)
virtual

Called each time a block of data is downloaded.

This callback might still be invoked even when no BDataIO is associated with the request, as data can still be downloaded and discarded so that the request can be completed and the socket can be reused.

Frequency: Zero or more

Parameters
callerThe BUrlRequest that invoked this callback.
bytesReceivedNumber of data bytes received. This is the number of bytes received prior to any processing and can be smaller than the size of the data block written to the output BDataIO as the transport might be compressed.
bytesTotalTotal number of data bytes expected. 0 will be passed if the total number of data bytes is not available.

◆ HeadersReceived()

void BUrlProtocolListener::HeadersReceived ( BUrlRequest caller)
virtual

Called when all of the server response metadata (such as headers) have been read and parsed.

Frequency: Once

Parameters
callerThe BUrlRequest that invoked this callback.

◆ HostnameResolved()

void BUrlProtocolListener::HostnameResolved ( BUrlRequest caller,
const char *  ip 
)
virtual

Called when the final IP is discovered.

Frequency: Once

Parameters
callerThe BUrlRequest that invoked this callback.
ipString representing the IP address of the resource host.

◆ RequestCompleted()

void BUrlProtocolListener::RequestCompleted ( BUrlRequest caller,
bool  success 
)
virtual

Called once the request is complete.

Frequency: Once

Parameters
callerThe BUrlRequest that invoked this callback.
successWhether the request has been successfully completed.

◆ ResponseStarted()

void BUrlProtocolListener::ResponseStarted ( BUrlRequest caller)
virtual

Called when the request has been emitted and the server begins to reply.

Typically this callback will be called when the HTTP status code is received.

Frequency: Once

Parameters
callerThe BUrlRequest that invoked this callback.

◆ UploadProgress()

void BUrlProtocolListener::UploadProgress ( BUrlRequest caller,
off_t  bytesSent,
off_t  bytesTotal 
)
virtual

Called each time a block of data is sent.

Note
Currently this callback is never called.
Parameters
callerThe BUrlRequest that invoked this callback.
bytesSentNumber of data bytes sent.
bytesTotalTotal number of data bytes left.