Radix cross Linux

The main Radix cross Linux repository contains the build scripts of packages, which have the most complete and common functionality for desktop machines

452 Commits   2 Branches   1 Tag
   351         kx /*
   351         kx     $Id: cddb_ni.h,v 1.32 2009/03/01 03:28:07 jcaratzas Exp $
   351         kx 
   351         kx     Copyright (C) 2003, 2004, 2005 Kris Verbeeck <airborne@advalvas.be>
   351         kx 
   351         kx     This library is free software; you can redistribute it and/or
   351         kx     modify it under the terms of the GNU Library General Public
   351         kx     License as published by the Free Software Foundation; either
   351         kx     version 2 of the License, or (at your option) any later version.
   351         kx 
   351         kx     This library is distributed in the hope that it will be useful,
   351         kx     but WITHOUT ANY WARRANTY; without even the implied warranty of
   351         kx     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   351         kx     Library General Public License for more details.
   351         kx 
   351         kx     You should have received a copy of the GNU Library General Public
   351         kx     License along with this library; if not, write to the
   351         kx     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   351         kx     Boston, MA  02111-1307, USA.
   351         kx */
   351         kx 
   351         kx #ifndef CDDB_NI_H
   351         kx #define CDDB_NI_H 1
   351         kx 
   351         kx #ifdef __cplusplus
   351         kx     extern "C" {
   351         kx #endif
   351         kx 
   351         kx 
   351         kx #if HAVE_CONFIG_H
   351         kx #  include <config.h>
   351         kx #endif
   351         kx 
   351         kx #ifdef HAVE_ICONV_H
   351         kx #  include <iconv.h>
   351         kx #else
   351         kx    typedef void *iconv_t;       /* for code uniformity */
   351         kx #endif
   351         kx 
   351         kx #ifdef HAVE_WINDOWS_H
   351         kx #include <windows.h>
   351         kx #endif
   351         kx 
   351         kx #ifdef HAVE_WINSOCK2_H
   351         kx #include <winsock2.h>
   351         kx #ifndef ETIMEDOUT
   351         kx #define ETIMEDOUT   WSAETIMEDOUT
   351         kx #endif
   351         kx #ifndef EWOULDBLOCK
   351         kx #define EWOULDBLOCK WSAEWOULDBLOCK
   351         kx #endif
   351         kx #ifndef EINPROGRESS
   351         kx #define EINPROGRESS WSAEINPROGRESS
   351         kx #endif
   351         kx #endif
   351         kx 
   351         kx #include "cddb/cddb_regex.h"
   351         kx #include "cddb/cddb.h"
   351         kx #include "cddb/cddb_conn_ni.h"
   351         kx #include "cddb/cddb_net.h"
   351         kx #include "cddb/cddb_cmd_ni.h"
   351         kx #include "cddb/cddb_log_ni.h"
   351         kx 
   351         kx 
   351         kx #define FALSE          0
   351         kx #define TRUE           1
   351         kx 
   351         kx #define CHR_CR         '\r'
   351         kx #define CHR_LF         '\n'
   351         kx #define CHR_EOS        '\0'
   351         kx #define CHR_SPACE      ' '
   351         kx #define CHR_DOT        '.'
   351         kx 
   351         kx #define DEFAULT_BUF_SIZE 1024
   351         kx 
   351         kx #define CLIENT_NAME    PACKAGE
   351         kx #define CLIENT_VERSION VERSION
   351         kx 
   351         kx #define DEFAULT_USER        "anonymous"
   351         kx #define DEFAULT_HOST        "localhost"
   351         kx #define DEFAULT_SERVER      "gnudb.gnudb.org"
   351         kx #define DEFAULT_PORT        8880
   351         kx #define DEFAULT_TIMEOUT     10
   351         kx #define DEFAULT_PATH_QUERY  "/~cddb/cddb.cgi"
   351         kx #define DEFAULT_PATH_SUBMIT "/~cddb/submit.cgi"
   351         kx #define DEFAULT_CACHE       ".cddbslave"
   351         kx #define DEFAULT_PROXY_PORT  8080
   351         kx 
   351         kx #define DEFAULT_PROTOCOL_VERSION 6
   351         kx #define SERVER_CHARSET           "UTF8"
   351         kx 
   351         kx 
   351         kx #define FREE_NOT_NULL(p) if (p) { free(p); p = NULL; }
   351         kx #define CONNECTION_OK(c) (c->socket != -1)
   351         kx #define STR_OR_NULL(s) ((s) ? s : "NULL")
   351         kx #define STR_OR_EMPTY(s) ((s) ? s : "")
   351         kx 
   351         kx #define RETURN_STR_OR_EMPTY(s) \
   351         kx             return (!s && (libcddb_flags() & CDDB_F_EMPTY_STR)) ? "" : s
   351         kx 
   351         kx #define ASSERT(cond, error) \
   351         kx             if (!(cond)) { return error; }
   351         kx #define ASSERT_NOT_NULL(ptr) \
   351         kx             ASSERT(ptr!=NULL, CDDB_ERR_INVALID)
   351         kx #define ASSERT_RANGE(num,lo,hi) \
   351         kx             ASSERT((num>=lo)&&(num<=hi), CDDB_ERR_INVALID)
   351         kx 
   351         kx 
   351         kx /* --- type definitions */
   351         kx 
   351         kx 
   351         kx /** Actual definition of track structure. */
   351         kx struct cddb_track_s
   351         kx {
   351         kx     int num;                    /**< track number on the disc */
   351         kx     int frame_offset;           /**< frame offset of the track on the disc */
   351         kx     int length;                 /**< track length in seconds */
   351         kx     char *title;                /**< track title */
   351         kx     char *artist;               /**< (optional) track artist */
   351         kx     char *ext_data;             /**< (optional) extended disc data */
   351         kx     struct cddb_track_s *prev;  /**< pointer to previous track, or NULL */
   351         kx     struct cddb_track_s *next;  /**< pointer to next track, or NULL */
   351         kx     struct cddb_disc_s *disc;   /**< disc of which this is a track */
   351         kx };
   351         kx 
   351         kx /** Actual definition of disc structure. */
   351         kx struct cddb_disc_s
   351         kx {
   351         kx     unsigned int revision;      /**< revision number */
   351         kx     unsigned int discid;        /**< four byte disc ID */
   351         kx     cddb_cat_t category;        /**< CDDB category */
   351         kx     char *genre;                /**< disc genre */
   351         kx     char *title;                /**< disc title */
   351         kx     char *artist;               /**< disc artist */
   351         kx     unsigned int length;        /**< disc length in seconds */
   351         kx     unsigned int year;          /**< (optional) disc year YYYY */
   351         kx     char *ext_data;             /**< (optional) extended disc data  */
   351         kx     int track_cnt;              /**< number of tracks on the disc */
   351         kx     cddb_track_t *tracks;       /**< pointer to the first track */
   351         kx     cddb_track_t *iterator;     /**< track iterator */
   351         kx };
   351         kx 
   351         kx 
   351         kx /* --- global variables */
   351         kx 
   351         kx 
   351         kx /** Server connection used especially for text searches. */
   351         kx extern cddb_conn_t *cddb_search_conn;
   351         kx 
   351         kx 
   351         kx /* --- non-exported function prototypes */
   351         kx 
   351         kx 
   351         kx unsigned int libcddb_flags(void);
   351         kx 
   351         kx /**
   351         kx  * Convert a string to a new character encoding according to the given
   351         kx  * conversion descriptor.
   351         kx  */
   351         kx int cddb_str_iconv(iconv_t cd, ICONV_CONST char *in, char **out);
   351         kx 
   351         kx /**
   351         kx  * Converts all disc and track strings to user character encoding.
   351         kx  */
   351         kx int cddb_disc_iconv(iconv_t cd, cddb_disc_t *disc);
   351         kx 
   351         kx /**
   351         kx  * Converts all track strings to user character encoding.
   351         kx  */
   351         kx int cddb_track_iconv(iconv_t cd, cddb_track_t *track);
   351         kx 
   351         kx /**
   351         kx  * Converts all site strings to user character encoding.
   351         kx  */
   351         kx int cddb_site_iconv(iconv_t cd, cddb_site_t *site);
   351         kx 
   351         kx /**
   351         kx  * Base64 encode the source string and write it to the destination
   351         kx  * buffer.  The destination buffer should be large enough (= 4/3 of
   351         kx  * src string length).
   351         kx  */
   351         kx void cddb_b64_encode(char *dst, const char *src);
   351         kx 
   351         kx 
   351         kx #ifdef __cplusplus
   351         kx     }
   351         kx #endif
   351         kx 
   351         kx #endif /* CDDB_NI_H */