123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- #include <opc/config.h>
- #include <opc/file.h>
- #include <opc/container.h>
- #ifndef OPC_ZIP_H
- #define OPC_ZIP_H
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #define OPC_DEFAULT_GROWTH_HINT 512
-
- typedef struct OPC_ZIP_STRUCT opcZip;
-
- typedef struct OPC_ZIPINPUTSTREAM_STRUCT opcZipInputStream;
-
- typedef struct OPC_ZIPOUTPUTSTREAM_STRUCT opcZipOutputStream;
-
- typedef struct OPC_ZIP_SEGMENT_INFO_STRUCT {
- xmlChar name[OPC_MAX_PATH];
- opc_uint32_t name_len;
- opc_uint32_t segment_number;
- opc_bool_t last_segment;
- opc_bool_t rels_segment;
- opc_uint32_t header_size;
- opc_uint32_t min_header_size;
- opc_uint32_t trailing_bytes;
- opc_uint32_t compressed_size;
- opc_uint32_t uncompressed_size;
- opc_uint16_t bit_flag;
- opc_uint32_t data_crc;
- opc_uint16_t compression_method;
- opc_ofs_t stream_ofs;
- opc_uint16_t growth_hint;
- } opcZipSegmentInfo_t;
-
- typedef int opcZipLoaderOpenCallback(void *iocontext);
-
- typedef int opcZipLoaderSkipCallback(void *iocontext);
-
- typedef int opcZipLoaderReadCallback(void *iocontext, char *buffer, int len);
-
- typedef int opcZipLoaderCloseCallback(void *iocontext);
-
- typedef opc_error_t (opcZipLoaderSegmentCallback_t)(void *iocontext, void *userctx, opcZipSegmentInfo_t *info, opcZipLoaderOpenCallback *open, opcZipLoaderReadCallback *read, opcZipLoaderCloseCallback *close, opcZipLoaderSkipCallback *skip);
-
- opc_error_t opcZipLoader(opcIO_t *io, void *userctx, opcZipLoaderSegmentCallback_t *segmentCallback);
-
- typedef opc_error_t (opcZipSegmentReleaseCallback)(opcZip *zip, opc_uint32_t segment_id);
-
- void opcZipClose(opcZip *zip, opcZipSegmentReleaseCallback* releaseCallback);
-
- opcZip *opcZipCreate(opcIO_t *io);
-
- opc_error_t opcZipCommit(opcZip *zip, opc_bool_t trim);
-
- opc_error_t opcZipGC(opcZip *zip);
-
- opc_uint32_t opcZipLoadSegment(opcZip *zip, const xmlChar *partName, opc_bool_t rels_segment, opcZipSegmentInfo_t *info);
-
- opc_uint32_t opcZipCreateSegment(opcZip *zip,
- const xmlChar *partName,
- opc_bool_t relsSegment,
- opc_uint32_t segment_size,
- opc_uint32_t growth_hint,
- opc_uint16_t compression_method,
- opc_uint16_t bit_flag);
-
- opcZipInputStream *opcZipOpenInputStream(opcZip *zip, opc_uint32_t segment_id);
-
- opc_error_t opcZipCloseInputStream(opcZip *zip, opcZipInputStream *stream);
-
- opc_uint32_t opcZipReadInputStream(opcZip *zip, opcZipInputStream *stream, opc_uint8_t *buf, opc_uint32_t buf_len);
-
- opcZipOutputStream *opcZipCreateOutputStream(opcZip *zip,
- opc_uint32_t *segment_id,
- const xmlChar *partName,
- opc_bool_t relsSegment,
- opc_uint32_t segment_size,
- opc_uint32_t growth_hint,
- opc_uint16_t compression_method,
- opc_uint16_t bit_flag);
-
- opcZipOutputStream *opcZipOpenOutputStream(opcZip *zip, opc_uint32_t *segment_id);
-
- opc_error_t opcZipCloseOutputStream(opcZip *zip, opcZipOutputStream *stream, opc_uint32_t *segment_id);
-
- opc_uint32_t opcZipWriteOutputStream(opcZip *zip, opcZipOutputStream *stream, const opc_uint8_t *buf, opc_uint32_t buf_len);
-
- opc_uint32_t opcZipGetFirstSegmentId(opcZip *zip);
-
- opc_uint32_t opcZipGetNextSegmentId(opcZip *zip, opc_uint32_t segment_id);
-
- opc_error_t opcZipGetSegmentInfo(opcZip *zip, opc_uint32_t segment_id, const xmlChar **name, opc_bool_t *rels_segment, opc_uint32_t *crc);
-
- opc_bool_t opcZipSegmentDelete(opcZip *zip, opc_uint32_t *first_segment, opc_uint32_t *last_segment, opcZipSegmentReleaseCallback* releaseCallback);
- #ifdef __cplusplus
- }
- #endif
-
- #endif
|