// Copyright 1997-2000 Omni Development, Inc.  All rights reserved.
//
// This software may only be used and reproduced according to the
// terms in the file OmniSourceLicense.html, which should be
// distributed with this project and can also be found at
// http://www.omnigroup.com/DeveloperResources/OmniSourceLicense.html.
//
// $Header: /Network/Source/CVS/OmniGroup/./Applications/OmniCD/OmniCDDB/CDDBDatabase.h,v 1.5 2000/09/12 19:07:51 bungi Exp $

#import <OmniFoundation/OmniFoundation.h>

#import "FrameworkDefines.h"

@class ONSocketStream;

OmniCDDB_EXTERN NSString *CDDBServerHostNameKey;
OmniCDDB_EXTERN NSString *CDDBServerPortKey;
OmniCDDB_EXTERN NSString *CDDBServerProtocolKey;
OmniCDDB_EXTERN NSString *CDDBServerFormPathKey;
OmniCDDB_EXTERN NSString *CDDBServerDescriptionKey;

OmniCDDB_EXTERN NSString *CDDBDiscArtistKey;
OmniCDDB_EXTERN NSString *CDDBDiscTitleKey;
OmniCDDB_EXTERN NSString *CDDBExtendedDiscInfoKey;
OmniCDDB_EXTERN NSString *CDDBTrackInfoKey;
OmniCDDB_EXTERN NSString *CDDBTrackTitleKey;
OmniCDDB_EXTERN NSString *CDDBExtendedTrackInfoKey;


typedef struct _CDDBTableOfContentsEntry {
    int	minutes;
    int	seconds;
    int logicalBlockAddress;
} CDDBTableOfContentsEntry;

@interface CDDBDatabase : OFObject
{
    ONSocketStream            *_socketStream;
    BOOL                       _usingHTTP;
    NSString                  *_lastReply;
    unsigned int               _lastReplyIntValue;
    NSString                  *_helloString;
}

//
// Low level commands
//

- (void) connect;
- (void) disconnect;

- (BOOL)sendCommand:(NSString *)command;
- (BOOL)sendCommandFormat:(NSString *)aFormat, ...;
- (BOOL)readResponse;


//
// Higher level commands
//

- (NSArray *) serverList;

- (NSArray *) categories;
- (NSDictionary *) statistics;
- (NSArray *) categoriesOrderedByStatistic;

- (NSDictionary *) readDiscWithSignature: (NSString *) signature
                                category: (NSString *) category;

- (NSArray *) sendQueryForEntries: (const CDDBTableOfContentsEntry *) entries
                       entryCount: (unsigned int) entryCount
                  durationSeconds: (unsigned int) durationSeconds;


@end
