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;
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
00115
00116
00125 cddb_conn_t *cddb_new(void);
00126
00131 void cddb_destroy(cddb_conn_t *c);
00132
00133
00134
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