* Copyright 2003-2011, Haiku, Inc.
* Distributed under the terms of the MIT license.
*
* Authors:
* Tyler Akidau, haiku@akidau.net
*/
#ifndef _DISC_H
#define _DISC_H
#include <errno.h>
#include <new>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ByteOrder.h>
#include <KernelExport.h>
#include <scsi.h>
#include "Debug.h"
#include "scsi-mmc.h"
class List;
class Session;
checked table of contents for a CD-ROM.
*/
class Disc {
public:
Disc(int fd);
~Disc();
status_t InitCheck();
Session* GetSession(int32 index);
void Dump();
static const int kBlockSize = 2048;
private:
uint32 _AdjustForYellowBook(
cdrom_full_table_of_contents_entry
entries[],
uint32 count);
status_t _ParseTableOfContents(
cdrom_full_table_of_contents_entry
entries[],
uint32 count);
void _SortAndRemoveDuplicates();
status_t _CheckForErrorsAndWarnings();
private:
status_t fInitStatus;
List* fSessionList;
};
on a Disc.
*/
class Session {
public:
~Session();
off_t Offset() { return fOffset; }
off_t Size() { return fSize; }
uint32 BlockSize() { return fBlockSize; }
int32 Index() { return fIndex; }
uint32 Flags() { return fFlags; }
const char* Type() { return fType; }
private:
friend class Disc;
Session(off_t offset, off_t size,
uint32 blockSize, int32 index, uint32 flags,
const char* type);
Session(const Session& other);
Session& operator=(const Session& other);
private:
off_t fOffset;
off_t fSize;
uint32 fBlockSize;
int32 fIndex;
uint32 fFlags;
char* fType;
};
#endif