File: cddb.c

package info (click to toggle)
libcddb 1.3.2-6
  • links: PTS
  • area: main
  • in suites: bullseye, buster
  • size: 2,276 kB
  • sloc: sh: 10,946; ansic: 4,721; makefile: 44
file content (77 lines) | stat: -rw-r--r-- 1,963 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
    $Id: cddb.c,v 1.3 2006/10/15 11:51:33 airborne Exp $

    Copyright (C) 2003, 2004, 2005 Kris Verbeeck <airborne@advalvas.be>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA  02111-1307, USA.
*/


#include "cddb/cddb_ni.h"


/* --- global variables */


cddb_conn_t *cddb_search_conn;

/** Library initialized or not? */
static int initialized = 0;

/** Library flags. */
static unsigned int _flags = 0;


/* --- public functions */


void libcddb_init(void)
{
    if (!initialized) {
        cddb_regex_init();
        initialized = 1;        /* before the call to cddb_new() below to avoid
                                   deadlock */
        /* Initialize connection structure for text search */
        cddb_search_conn = cddb_new();
        cddb_http_enable(cddb_search_conn);
        cddb_set_server_port(cddb_search_conn, 80);
        cddb_set_http_path_query(cddb_search_conn, "/freedb_search.php");
    }
}

void libcddb_shutdown(void)
{
    if (initialized) {
        cddb_regex_destroy();
        cddb_destroy(cddb_search_conn);
        initialized = 0;
    }
}

unsigned int libcddb_flags(void)
{
  return _flags;
}

void libcddb_set_flags(unsigned int flags)
{
    _flags |= flags;
}

void libcddb_reset_flags(unsigned int flags)
{
    _flags &= ~flags;
}