#ifndef LIBRARIES_CDDB_H
#define LIBRARIES_CDDB_H

/*
**  $VER: cddb.h 44.20 (08.08.2001)
**  cddb.library defines and structures
**
**  Copyright © 2001 by Thomas@Igracki.de
**  All Rights Reserved.
*/

#ifndef EXEC_LIBRARIES_H
#include <exec/libraries.h>
#endif

#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif

#ifndef UTILITY_TAGITEM_H
#include <utility/tagitem.h>
#endif

#ifndef INTUITION_CLASSUSR_H
#include <intuition/classusr.h>
#endif

#define CDDB_NAME  "cddb.library";
#define CDDB_VERSION 44;


/************************************************************************
*                                                                       *
*    the max. size (incl ending 0 byte!) of various used strings        *
*                                                                       *
************************************************************************/

#define CDDB_MAXLENCATEG  30
#define CDDB_MAXLENARTIST 100
#define CDDB_MAXLENDTITLE 100
#define CDDB_MAXLENTTITLE 100
#define CDDB_MAXTRACKS    99


/************************************************************************
*                                                                       *
*    error codes from CDDB_Get()                                        *
*                                                                       *
************************************************************************/

#define CDDBERR_NOERROR       0  /* entry found */
#define CDDBERR_NOTCPSTACK    1  /* No TCP/IP stack is running, go online first! */
#define CDDBERR_RESOLVE       2  /* failed to resolve the host */
#define CDDBERR_SOCKET        3  /* s.Socket() failed */
#define CDDBERR_CONNECT       4  /* s.Connect() failed */
#define CDDBERR_SERVERERROR   5  /* Server comes up with an error after connect */
#define CDDBERR_HELLO         6  /* Hello cmd failed */
#define CDDBERR_QUERY         7  /* Query cmd failed */
#define CDDBERR_QNOMATCH      8  /* No matching discid found in query */
#define CDDBERR_QINEXACTMATCH 9  /* Inexact matches found in query */
#define CDDBERR_NOTAGS        10 /* You must specify the minimal tags aDiscID, aCateg, aArtist, aDTitle, aTTitles! */
#define CDDBERR_NOCDINFO      11 /* failed to save a cd entry */
#define CDDBERR_COUNT         12 /* internal err count */

/************************************************************************
*                                                                       *
*    tag-function call flags                                            *
*                                                                       *
************************************************************************/

/* attributes for GetCDDDB */

#define CDDB_aDiscID       (TAG_USER + 1) /* LONGPTR: place here a variable for the discID */
#define CDDB_aCateg        (TAG_USER + 2) /* STRPTR: place here a variable for the category */
#define CDDB_aArtist       (TAG_USER + 3) /* STRPTR: place here a variable for the artist */
#define CDDB_aDTitle       (TAG_USER + 4) /* STRPTR: place here a variable for the disc title */
#define CDDB_aTTitles      (TAG_USER + 5) /* PTR TO ARRAY MAX(INTEGER) OF STRPTR: place here a variable for the track titles,
                                           * an array of allocated (not NIL!) STRPTR's */
#define CDDB_aStatusHook   (TAG_USER + 6) /* HookPtr: gets called with the current status while getting an entry */
#define CDDB_aMultiGetHook (TAG_USER + 7) /* HookPtr: gets called after an entry is successfully received, so another CD can be scanned */
#define CDDB_aForceOnline  (TAG_USER + 8) /* BOOLEAN: Force to go online, if MultiHook = NIL and the disc is already known. */


/************************************************************************
*                                                                       *
*    the structs                                                        *
*                                                                       *
************************************************************************/


/* next 2 are from BurnIts CDDB_cdinfo */
struct CDDB_MSFtime
{
	UBYTE msf_Min;
	UBYTE msf_Sec;
	UBYTE msf_Frame;
	UBYTE reserved;
};

struct CDDB_CDInfo
{
    struct CDDB_MSFtime cdi_MSF[100];
    ULONG cdi_Tracks;
    ULONG cdi_Time;
    ULONG cdi_DiscID;
};


struct CDDBP_StatusHook
{
	ULONG sh_MethodID;
	char *sh_Str;
};


struct CDDBP_MultiGetHook
{
	ULONG mgh_MethodID;
	short mgh_Err; /* see above 'Error codes' */
	ULONG mgh_DiscID;
	char  mgh_Categ[CDDB_MAXLENCATEG]; /* I don't know exactly the length */
	char  mgh_Artist[CDDB_MAXLENARTIST]; /* I don't know exactly the length */
	char  mgh_DTitle[CDDB_MAXLENDTITLE]; /* I don't know exactly the length */
	char  *mgh_TTitles[CDDB_MAXTRACKS];
	APTR mgh_UserData; /* for you! */
};


struct CDDB_Track
{
	char  tr_Title[CDDB_MAXLENTTITLE];
	short tr_Length; /* in seconds */
};


struct CDDB_KnownCD
{
	ULONG kcd_DiscID;
	short kcd_Length; /* in seconds */
	short kcd_NumTracks; /* number of tracks */
	char  kcd_Categ[CDDB_MAXLENCATEG];
	char  kcd_Artist[CDDB_MAXLENARTIST];
	char  kcd_Title[CDDB_MAXLENDTITLE];
	struct CDDB_Track *kcd_Track[CDDB_MAXTRACKS];
        /* is this correct? orig: ARRAY MAXTRACKS OF TrackPtr*/
};


#endif /* LIBRARIES_CDDB_H */
