cddb_site.h File Reference

#include "cddb/cddb_error.h"

Go to the source code of this file.

Defines

#define CDDB_SITE_H   1

Typedefs

typedef cddb_site_s cddb_site_t
 The CDDB site structure.

Enumerations

enum  cddb_protocol_t { PROTO_UNKNOWN = 0, PROTO_CDDBP, PROTO_HTTP }
 Enumeration defining the CDDB protocol supported by a specific site. More...

Functions

cddb_site_tcddb_site_new (void)
 Creates a new CDDB site structure.
cddb_error_t cddb_site_destroy (cddb_site_t *site)
 Free all resources associated with the given CDDB site structure.
cddb_site_tcddb_site_clone (cddb_site_t *site)
 Creates a clone of the given site.
cddb_error_t cddb_site_get_address (const cddb_site_t *site, const char **address, unsigned int *port)
 Get the site's address.
cddb_error_t cddb_site_set_address (cddb_site_t *site, const char *address, unsigned int port)
 Set the site's address.
cddb_protocol_t cddb_site_get_protocol (const cddb_site_t *site)
 Get the protocol used by the site.
cddb_error_t cddb_site_set_protocol (cddb_site_t *site, cddb_protocol_t proto)
 Set the protocol used by the site.
cddb_error_t cddb_site_get_query_path (const cddb_site_t *site, const char **path)
 Get the query path in case the HTTP protocol is used.
cddb_error_t cddb_site_set_query_path (cddb_site_t *site, const char *path)
 Set the query path in case the HTTP protocol is used.
cddb_error_t cddb_site_get_submit_path (const cddb_site_t *site, const char **path)
 Get the submit path in case the HTTP protocol is used.
cddb_error_t cddb_site_set_submit_path (cddb_site_t *site, const char *path)
 Set the submit path in case the HTTP protocol is used.
cddb_error_t cddb_site_get_location (const cddb_site_t *site, float *latitude, float *longitude)
 Get the site's location.
cddb_error_t cddb_site_set_location (cddb_site_t *site, float latitude, float longitude)
 Set the site's location.
cddb_error_t cddb_site_get_description (const cddb_site_t *site, const char **desc)
 Get a description of the site.
cddb_error_t cddb_site_set_description (cddb_site_t *site, const char *desc)
 Set a description for the site.
int cddb_site_parse (cddb_site_t *site, const char *line)
 Parses one line of data as returned by the sites command and populates the given structure.
cddb_error_t cddb_site_print (const cddb_site_t *site)
 Prints information about the site on stdout.


Define Documentation

#define CDDB_SITE_H   1
 


Typedef Documentation

typedef struct cddb_site_s cddb_site_t
 

The CDDB site structure.

Contains all information about one particular CDDB server.


Enumeration Type Documentation

enum cddb_protocol_t
 

Enumeration defining the CDDB protocol supported by a specific site.

Enumerator:
PROTO_UNKNOWN  Unknown protocol.
PROTO_CDDBP  FreeDB custom protocol.
PROTO_HTTP  Command tunneling over HTTP.


Function Documentation

cddb_site_t* cddb_site_clone cddb_site_t site  ) 
 

Creates a clone of the given site.

Parameters:
site The CDDB site structure.

cddb_error_t cddb_site_destroy cddb_site_t site  ) 
 

Free all resources associated with the given CDDB site structure.

Parameters:
site The CDDB site structure.

cddb_error_t cddb_site_get_address const cddb_site_t site,
const char **  address,
unsigned int *  port
 

Get the site's address.

Parameters:
site The CDDB site structure.
address The address of the server upon returning.
port The port of the server upon returning.
Returns:
Error code: CDDB_ERR_OK or CDDB_ERR_INVALID.

cddb_error_t cddb_site_get_description const cddb_site_t site,
const char **  desc
 

Get a description of the site.

Parameters:
site The CDDB site structure.
desc The description upon returning.
Returns:
Error code: CDDB_ERR_OK or CDDB_ERR_INVALID.

cddb_error_t cddb_site_get_location const cddb_site_t site,
float *  latitude,
float *  longitude
 

Get the site's location.

Parameters:
site The CDDB site structure.
latitude Will contain the server's latitude upon returning. A positive number is used for the northern hemisphere, a negative one for the southern hemisphere.
longitude Will contain the server's longitude upon returning. A positive number is used for the eastern hemisphere, a negative one for the western hemisphere.
Returns:
Error code: CDDB_ERR_OK or CDDB_ERR_INVALID.

cddb_protocol_t cddb_site_get_protocol const cddb_site_t site  ) 
 

Get the protocol used by the site.

See also:
cddb_protocol_t
Parameters:
site The CDDB site structure.
Returns:
The protocol.

cddb_error_t cddb_site_get_query_path const cddb_site_t site,
const char **  path
 

Get the query path in case the HTTP protocol is used.

Parameters:
site The CDDB site structure.
path The query path upon returning.
Returns:
Error code: CDDB_ERR_OK or CDDB_ERR_INVALID.

cddb_error_t cddb_site_get_submit_path const cddb_site_t site,
const char **  path
 

Get the submit path in case the HTTP protocol is used.

Parameters:
site The CDDB site structure.
path The submit path upon returning.
Returns:
Error code: CDDB_ERR_OK or CDDB_ERR_INVALID.

cddb_site_t* cddb_site_new void   ) 
 

Creates a new CDDB site structure.

Returns:
The CDDB site structure or NULL if memory allocation failed.

int cddb_site_parse cddb_site_t site,
const char *  line
 

Parses one line of data as returned by the sites command and populates the given structure.

Parameters:
site The CDDB site structure.
line The result line.
Returns:
True in case of success or false on failure.

cddb_error_t cddb_site_print const cddb_site_t site  ) 
 

Prints information about the site on stdout.

This is just a debugging routine to display the structure's content.

Parameters:
site The CDDB site structure.
Returns:
Error code: CDDB_ERR_OK or CDDB_ERR_INVALID.

cddb_error_t cddb_site_set_address cddb_site_t site,
const char *  address,
unsigned int  port
 

Set the site's address.

A copy of the address string is made. So the caller should free any memory associated with the input parameter.

Parameters:
site The CDDB site structure.
address The address of the server.
port The port of the server.
Returns:
Error code: CDDB_ERR_OK, CDDB_ERR_INVALID or CDDB_ERR_OUT_OF_MEMORY.

cddb_error_t cddb_site_set_description cddb_site_t site,
const char *  desc
 

Set a description for the site.

A copy of the description string is made. So the caller should free any memory associated with the input parameter.

Parameters:
site The CDDB site structure.
desc The description. A value of NULL deletes the current description.
Returns:
Error code: CDDB_ERR_OK, CDDB_ERR_INVALID or CDDB_ERR_OUT_OF_MEMORY.

cddb_error_t cddb_site_set_location cddb_site_t site,
float  latitude,
float  longitude
 

Set the site's location.

Parameters:
site The CDDB site structure.
latitude The server's latitude. Use a positive number for the northern hemisphere, a negative one for the southern hemisphere.
longitude The server's longitude. Use a positive number for the eastern hemisphere, a negative one for the western hemisphere.
Returns:
Error code: CDDB_ERR_OK or CDDB_ERR_INVALID.

cddb_error_t cddb_site_set_protocol cddb_site_t site,
cddb_protocol_t  proto
 

Set the protocol used by the site.

See also:
cddb_protocol_t
Parameters:
site The CDDB site structure.
proto The protocol.
Returns:
Error code: CDDB_ERR_OK or CDDB_ERR_INVALID.

cddb_error_t cddb_site_set_query_path cddb_site_t site,
const char *  path
 

Set the query path in case the HTTP protocol is used.

A copy of the path string is made. So the caller should free any memory associated with the input parameter.

Parameters:
site The CDDB site structure.
path The query path. A value of NULL deletes the current path.
Returns:
Error code: CDDB_ERR_OK, CDDB_ERR_INVALID or CDDB_ERR_OUT_OF_MEMORY.

cddb_error_t cddb_site_set_submit_path cddb_site_t site,
const char *  path
 

Set the submit path in case the HTTP protocol is used.

A copy of the path string is made. So the caller should free any memory associated with the input parameter.

Parameters:
site The CDDB site structure.
path The query path. A value of NULL deletes the current path.
Returns:
Error code: CDDB_ERR_OK, CDDB_ERR_INVALID or CDDB_ERR_OUT_OF_MEMORY.


Generated on Sun Oct 15 14:49:15 2006 for libcddb by  doxygen 1.4.6