#pragma prototyped
#ifndef _PAXLIB_H
#define _PAXLIB_H 1
#include <ast.h>
#include <error.h>
#include <ls.h>
#include <modex.h>
#if _BLD_DEBUG
#include <vmalloc.h>
#endif
#define PAX_PLUGIN_VERSION AST_PLUGIN_VERSION(20100528L)
#define PAX_IN (1<<0)
#define PAX_OUT (1<<1)
#define PAX_ARCHIVE (1<<2)
#define PAX_COMPRESS (1<<3)
#define PAX_DELTA (1<<4)
#define PAX_DLL (1<<5)
#define PAX_DOS (1<<6)
#define PAX_PSEUDO (1<<7)
#define PAX_COMPRESSED (1<<8)
#define PAX_CONV (1<<9)
#define PAX_DELTAINFO (1<<10)
#define PAX_KEEPSIZE (1<<11)
#define PAX_LINKTYPE (1<<12)
#define PAX_NOHARDLINKS (1<<13)
#define PAX_SLASHDIR (1<<14)
#define PAX_STANDARD (1L<<15)
#define PAX_SUM (1L<<16)
#define PAX_DELTAIO (1L<<17)
#define PAX_APPEND (1L<<18)
#define PAX_FORMAT (1L<<24)
#define PAX_BLOCK 512
#define PAX_DEFBLOCKS 20
#define PAX_DEFBUFFER 16
#define PAX_NOLINK 0
#define PAX_HARDLINK '1'
#define PAX_SOFTLINK '2'
#define PAX_EVENT_BUG_19951031 0x00000001
#define PAX_EVENT_DELTA_EXTEND 0x00000002
#define PAX_EVENT_SKIP_JUNK 0x00000004
struct Pax_s; typedef struct Pax_s Pax_t;
#ifndef Paxarchive_t
struct Paxarchive_s; typedef struct Paxarchive_s Paxarchive_t;
#endif
#ifndef Paxfile_t
struct Paxfile_s; typedef struct Paxfile_s Paxfile_t;
#endif
#ifndef Paxformat_t
struct Paxformat_s; typedef struct Paxformat_s Paxformat_t;
#endif
struct Paxio_s; typedef struct Paxio_s Paxio_t;
struct Paxvalue_s; typedef struct Paxvalue_s Paxvalue_t;
typedef Paxformat_t* (*Paxlib_f)(Pax_t*);
struct Paxvalue_s
{
char* string;
int32_t number;
int32_t fraction;
size_t size;
};
struct Paxio_s
{
int fd;
int eof;
off_t buffersize;
#ifdef _PAX_IO_PRIVATE_
_PAX_IO_PRIVATE_
#endif
};
struct Paxfile_s
{
char* name;
char* path;
char* linkpath;
struct stat* st;
off_t uncompressed;
int linktype;
#ifdef _PAX_FILE_PRIVATE_
_PAX_FILE_PRIVATE_
#endif
};
struct Paxformat_s
{
char* name;
char* match;
char* desc;
int variant;
int32_t flags;
unsigned long regular;
unsigned long special;
int align;
struct Paxformat_s*next;
void* data;
int (*done)(Pax_t*, Paxarchive_t*);
int (*getprologue)(Pax_t*, Paxformat_t*, Paxarchive_t*, Paxfile_t*, unsigned char*, size_t);
int (*getheader)(Pax_t*, Paxarchive_t*, Paxfile_t*);
int (*getdata)(Pax_t*, Paxarchive_t*, Paxfile_t*, int);
int (*gettrailer)(Pax_t*, Paxarchive_t*, Paxfile_t*);
int (*getepilogue)(Pax_t*, Paxarchive_t*);
int (*putprologue)(Pax_t*, Paxarchive_t*, int);
int (*putheader)(Pax_t*, Paxarchive_t*, Paxfile_t*);
int (*putdata)(Pax_t*, Paxarchive_t*, Paxfile_t*, int);
int (*puttrailer)(Pax_t*, Paxarchive_t*, Paxfile_t*);
off_t (*putepilogue)(Pax_t*, Paxarchive_t*);
int (*lookup)(Pax_t*, Paxarchive_t*, Paxfile_t*, int, char**, Sflong_t*);
int (*backup)(Pax_t*, Paxarchive_t*);
unsigned long (*checksum)(Pax_t*, Paxarchive_t*, Paxfile_t*, void*, size_t, unsigned long);
int (*validate)(Pax_t*, Paxarchive_t*, Paxfile_t*);
int (*event)(Pax_t*, Paxarchive_t*, Paxfile_t*, void*, unsigned long);
unsigned long events;
char* details;
};
struct Paxarchive_s
{
char* name;
void* data;
Paxformat_t* format;
int32_t flags;
int incomplete;
int volume;
size_t entries;
size_t entry;
Paxio_t* io;
struct
{
Paxvalue_t comment;
Paxvalue_t head;
Paxvalue_t link;
Paxvalue_t zip;
} stash;
#ifdef _PAX_ARCHIVE_PRIVATE_
_PAX_ARCHIVE_PRIVATE_
#endif
};
struct Pax_s
{
const char* id;
const char* passphrase;
int32_t flags;
int gid;
int keepgoing;
int list;
int modemask;
int strict;
int summary;
int test;
int uid;
int verbose;
int verify;
int warn;
long pid;
off_t buffersize;
char buf[SF_BUFSIZE];
Error_f errorf;
int (*dataf)(Pax_t*, Paxarchive_t*, Paxfile_t*, int, void*, off_t);
void* (*getf)(Pax_t*, Paxarchive_t*, off_t, off_t*);
Sfio_t* (*partf)(Pax_t*, Paxarchive_t*, off_t);
int (*putf)(Pax_t*, Paxarchive_t*, off_t);
off_t (*readf)(Pax_t*, Paxarchive_t*, void*, off_t, off_t, int);
off_t (*seekf)(Pax_t*, Paxarchive_t*, off_t, int, int);
char* (*stashf)(Pax_t*, Paxvalue_t*, const char*, size_t);
int (*syncf)(Pax_t*, Paxarchive_t*, int);
int (*unreadf)(Pax_t*, Paxarchive_t*, void*, off_t);
int (*writef)(Pax_t*, Paxarchive_t*, const void*, off_t);
int (*corruptf)(Pax_t*, Paxarchive_t*, Paxfile_t*, const char*);
int (*checksumf)(Pax_t*, Paxarchive_t*, Paxfile_t*, unsigned long, unsigned long);
int (*nospacef)(Pax_t*);
int (*nextf)(Pax_t*, Paxarchive_t*, size_t, size_t);
#ifdef _PAX_PRIVATE_
_PAX_PRIVATE_
#endif
};
#define paxchecksum(p,a,f,x,v) (*(p)->checksumf)(p,a,f,x,v)
#define paxcorrupt(p,a,f,m) (*(p)->corruptf)(p,a,f,m)
#define paxdata(p,a,f,d,b,n) (*(p)->dataf)(p,a,f,d,b,n)
#define paxget(p,a,o,r) (*(p)->getf)(p,a,o,r)
#define paxnext(p,a,c,n) (*(p)->nextf)(p,a,c,n)
#define paxnospace(p) (*(p)->nospacef)(p)
#define paxpart(p,a,n) (*(p)->partf)(p,a,n)
#define paxput(p,a,b,n) (*(p)->putf)(p,a,b,n)
#define paxread(p,a,b,n,m,f) (*(p)->readf)(p,a,b,n,m,f)
#define paxseek(p,a,o,w,f) (*(p)->seekf)(p,a,o,w,f)
#define paxstash(p,v,s,z) (*(p)->stashf)(p,v,s,z)
#define paxsync(p,a,f) (*(p)->syncf)(p,a,f)
#define paxunread(p,a,b,n) (*(p)->unreadf)(p,a,b,n)
#define paxwrite(p,a,b,n) (*(p)->writef)(p,a,b,n)
#ifdef _PAX_ARCHIVE_PRIVATE_
#define PAXLIB(m)
#define PAXNEXT(m) pax_##m##_next
#else
#ifdef __STDC__
#define PAXLIB(f) extern Paxformat_t* pax_lib(Pax_t* pax) {return &pax_##f##_format;} \
unsigned long plugin_version(void) {return PAX_PLUGIN_VERSION;}
#else
#define PAXLIB(f) extern Paxformat_t* pax_lib(pax) Pax_t* pax; {return &pax_##f##_format;} \
unsigned long plugin_version() {return PAX_PLUGIN_VERSION;}
#endif
#define PAXNEXT(m) 0
#if defined(__EXPORT__)
#define extern __EXPORT__
#endif
extern Paxformat_t* pax_lib(Pax_t*);
#undef extern
#endif
#endif