#include <freedb/freedb.hxx>
Inheritance diagram for FreedbRemote:
Public Methods | |
FreedbRemote (string servername="freedb.freedb.org") | |
The class constructor. | |
~FreedbRemote () | |
The class destructor. | |
vector< SearchResult > | search () const |
void | doHandshake (string username, string clientname, string version) const |
Sends the handshake to the server. | |
Protected Methods | |
void | connect (string servername="freedb.freedb.org") |
Attempts to connect to a freedb server. | |
void | disconnect () |
Disconnects a connection to a remote server if one exists. | |
void | sendCommand (string command) const |
Helper function to send a CDDBP command to the server. | |
string | getResponseLine (bool stripcr=true) const |
Helper function to get a line of response from the server. |
Note that the constructor tries to connect to the specified server/the default server, as it is vital for an object of this class to have a connection.
Definition at line 190 of file freedb.hxx.
|
The class destructor. The destructor will attempt to disconnect. Definition at line 15 of file freedb_remote.cxx. References disconnect(). |
|
Attempts to connect to a freedb server. You have to call this function to utilize a remote freedb server. All low-level C chores like socket initializiation, dns querying are done by this function. Clean C++ exception throwing is employed to guarantee easy error handling. It is imperative that you enclose a call to this function in a try-block with a catch(const Error& err) following it. The reserved error codes 600-699 may be returned by this function. Other functions requiring a connection will test if one exists to prevent the programmer from trying things he shouldn't.
Definition at line 86 of file freedb_remote.cxx. References CDDBP_PORT, Error::errcode, Error::errmsg, Error::extinfo, getResponseLine(), and stoi(). Referenced by FreedbRemote(). |
|
Sends the handshake to the server. A valid CDDBP handshake is created from the given parameters and sent to the server. The handshake must be done after connecting before other commands are issued. If a handshake was already performed, error code 402 "Already shook hands" is set and an exception thrown.
Definition at line 220 of file freedb_remote.cxx. References Error::errcode, Error::errmsg, Error::extinfo, getResponseLine(), sendCommand(), and stoi(). |
|
Helper function to get a line of response from the server. A line of response is a string of arbitrary data that is terminated by a newline, often consisting of a response code (e.g. 200), a space and additional information. You cannot (and should not) use this function directly. If you really need to send a custom command to the server, derive your own class from class CDDB.
Definition at line 48 of file freedb_remote.cxx. Referenced by connect(), and doHandshake(). |
|
Helper function to send a CDDBP command to the server.
Definition at line 28 of file freedb_remote.cxx. Referenced by disconnect(), and doHandshake(). |