00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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;
00081 FILE *cache_fp;
00083 int use_cache;
00085 char *cache_dir;
00087 int cache_read;
00090 char *cname;
00092 char *cversion;
00094 char *user;
00097 char *hostname;
00101 cddb_error_t errnum;
00103 cddb_disc_t **query_data;
00104 int query_idx;
00105 int query_cnt;
00107 cddb_iconv_t charset;
00108 } cddb_conn_t;
00109
00110
00111
00112
00113
00122 cddb_conn_t *cddb_new(void);
00123
00128 void cddb_destroy(cddb_conn_t *c);
00129
00130
00131
00132
00133
00145 int cddb_set_charset(cddb_conn_t *c, const char *cs);
00146
00153 void cddb_set_buf_size(cddb_conn_t *c, unsigned int size);
00154
00163 #define cddb_get_server_name(c) (c)->server_name
00164
00174 void cddb_set_server_name(cddb_conn_t *c, const char *server);
00175
00184 #define cddb_get_server_port(c) (c)->server_port
00185
00194 void cddb_set_server_port(cddb_conn_t *c, int port);
00195
00204 #define cddb_get_timeout(c) (c)->timeout
00205
00215 #define cddb_set_timeout(c, t) (c)->timeout = t
00216
00225 #define cddb_get_http_path_query(c) (c)->http_path_query
00226
00236 void cddb_set_http_path_query(cddb_conn_t *c, const char *path);
00237
00246 #define cddb_get_http_path_submit(c) (c)->http_path_submit
00247
00257 void cddb_set_http_path_submit(cddb_conn_t *c, const char *path);
00258
00269 #define cddb_is_http_enabled(c) (c)->is_http_enabled
00270
00280 void cddb_http_enable(cddb_conn_t *c);
00281
00291 void cddb_http_disable(cddb_conn_t *c);
00292
00305 #define cddb_is_http_proxy_enabled(c) (c)->is_http_proxy_enabled
00306
00318 void cddb_http_proxy_enable(cddb_conn_t *c);
00319
00329 void cddb_http_proxy_disable(cddb_conn_t *c);
00330
00339 #define cddb_get_http_proxy_server_name(c) (c)->http_proxy_server
00340
00350 void cddb_set_http_proxy_server_name(cddb_conn_t *c, const char *server);
00351
00360 #define cddb_get_http_proxy_server_port(c) (c)->http_proxy_server_port
00361
00370 void cddb_set_http_proxy_server_port(cddb_conn_t *c, int port);
00371
00378 #define cddb_errno(c) (c)->errnum
00379
00392 void cddb_set_client(cddb_conn_t *c, const char *cname, const char *cversion);
00393
00402 int cddb_set_email_address(cddb_conn_t *c, const char *email);
00403
00417 #define cddb_cache_mode(c) (c)->use_cache
00418
00430 #define cddb_cache_enable(c) (c)->use_cache = CACHE_ON
00431
00443 #define cddb_cache_only(c) (c)->use_cache = CACHE_ONLY
00444
00456 #define cddb_cache_disable(c) (c)->use_cache = CACHE_OFF
00457
00466 #define cddb_cache_get_dir(c) (c)->cache_dir;
00467
00480 int cddb_cache_set_dir(cddb_conn_t *c, const char *dir);
00481
00482
00483 #ifdef __cplusplus
00484 }
00485 #endif
00486
00487 #endif