Main Page | Class List | Directories | File List | Class Members | File Members

cddb_conn.h

Go to the documentation of this file.
00001 /*
00002     $Id: cddb_conn.h,v 1.25 2005/04/16 19:55:58 airborne Exp $
00003 
00004     Copyright (C) 2003, 2004, 2005 Kris Verbeeck <airborne@advalvas.be>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public
00017     License along with this library; if not, write to the
00018     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019     Boston, MA  02111-1307, USA.
00020 */
00021 
00022 #ifndef CDDB_CONN_H
00023 #define CDDB_CONN_H 1
00024 
00025 #ifdef __cplusplus
00026     extern "C" {
00027 #endif
00028 
00029 
00030 #include <stdio.h>
00031 #include <netinet/in.h>
00032 
00033 #define CACHE_OFF  0            
00035 #define CACHE_ON   1            
00036 #define CACHE_ONLY 2            
00043 typedef struct cddb_iconv_s *cddb_iconv_t;
00044 
00049 typedef struct cddb_conn_s 
00050 {
00051     unsigned int buf_size;      
00053     char *line;                 
00055     int is_connected;           
00056     struct sockaddr_in sa;      
00058     int socket;                 
00059     char *server_name;          
00061     int server_port;            
00063     int timeout;                
00067     char *http_path_query;      
00070     char *http_path_submit;     
00073     int is_http_enabled;        
00075     int is_http_proxy_enabled;  
00077     char *http_proxy_server;    
00078     int http_proxy_server_port; 
00080     char *http_proxy_username;  
00081     char *http_proxy_password;  
00082     char *http_proxy_auth;      
00084     FILE *cache_fp;             
00086     int use_cache;              
00088     char *cache_dir;            
00090     int cache_read;             
00093     char *cname;                
00095     char *cversion;             
00097     char *user;                 
00100     char *hostname;             
00104     cddb_error_t errnum;        
00106     cddb_disc_t **query_data;   
00107     int query_idx;              
00108     int query_cnt;              
00110     cddb_iconv_t charset;       
00111 } cddb_conn_t;
00112 
00113 
00114 /* --- construction / destruction --- */
00115 
00116 
00125 cddb_conn_t *cddb_new(void);
00126 
00131 void cddb_destroy(cddb_conn_t *c);
00132 
00133 
00134 /* --- getters & setters --- */
00135 
00136 
00148 int cddb_set_charset(cddb_conn_t *c, const char *cs);
00149 
00156 void cddb_set_buf_size(cddb_conn_t *c, unsigned int size);
00157 
00166 #define cddb_get_server_name(c) (c)->server_name
00167 
00177 void cddb_set_server_name(cddb_conn_t *c, const char *server);
00178 
00187 #define cddb_get_server_port(c) (c)->server_port
00188 
00197 void cddb_set_server_port(cddb_conn_t *c, int port);
00198 
00207 #define cddb_get_timeout(c) (c)->timeout
00208 
00218 #define cddb_set_timeout(c, t) (c)->timeout = t
00219 
00228 #define cddb_get_http_path_query(c) (c)->http_path_query
00229 
00239 void cddb_set_http_path_query(cddb_conn_t *c, const char *path);
00240 
00249 #define cddb_get_http_path_submit(c) (c)->http_path_submit
00250 
00260 void cddb_set_http_path_submit(cddb_conn_t *c, const char *path);
00261 
00272 #define cddb_is_http_enabled(c) (c)->is_http_enabled
00273 
00283 void cddb_http_enable(cddb_conn_t *c);
00284 
00294 void cddb_http_disable(cddb_conn_t *c);
00295 
00308 #define cddb_is_http_proxy_enabled(c) (c)->is_http_proxy_enabled
00309 
00321 void cddb_http_proxy_enable(cddb_conn_t *c);
00322 
00332 void cddb_http_proxy_disable(cddb_conn_t *c);
00333 
00342 #define cddb_get_http_proxy_server_name(c) (c)->http_proxy_server
00343 
00353 void cddb_set_http_proxy_server_name(cddb_conn_t *c, const char *server);
00354 
00363 #define cddb_get_http_proxy_server_port(c) (c)->http_proxy_server_port
00364 
00373 void cddb_set_http_proxy_server_port(cddb_conn_t *c, int port);
00374 
00383 void cddb_set_http_proxy_username(cddb_conn_t* c, const char* username);
00384 
00392 #define cddb_get_http_proxy_username(c) (c)->http_proxy_username
00393 
00402 void cddb_set_http_proxy_password(cddb_conn_t* c, const char* passwd);
00403 
00411 #define cddb_get_http_proxy_password(c) (c)->http_proxy_password
00412 
00419 #define cddb_errno(c) (c)->errnum
00420 
00433 void cddb_set_client(cddb_conn_t *c, const char *cname, const char *cversion);
00434 
00443 int cddb_set_email_address(cddb_conn_t *c, const char *email);
00444 
00458 #define cddb_cache_mode(c) (c)->use_cache
00459 
00471 #define cddb_cache_enable(c) (c)->use_cache = CACHE_ON
00472 
00484 #define cddb_cache_only(c) (c)->use_cache = CACHE_ONLY
00485 
00497 #define cddb_cache_disable(c) (c)->use_cache = CACHE_OFF
00498 
00507 #define cddb_cache_get_dir(c) (c)->cache_dir;
00508 
00521 int cddb_cache_set_dir(cddb_conn_t *c, const char *dir);
00522 
00523 
00524 #ifdef __cplusplus
00525     }
00526 #endif
00527 
00528 #endif /* CDDB_CONN_H */

Generated on Thu Apr 21 21:02:14 2005 for libcddb by  doxygen 1.3.9.1