add binary data structure definitions and image writer function prototypes
This commit is contained in:
52
src/bin.h
Normal file
52
src/bin.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#ifndef BIN_H_
|
||||
#define BIN_H_
|
||||
|
||||
#include <blue/core/endian.h>
|
||||
|
||||
#define EC3_SIGNATURE 0x45433358
|
||||
|
||||
#define EC3_VERSION_1_0 0x0100
|
||||
|
||||
#define EC3_CLUSTER_16K 0x00u
|
||||
#define EC3_CLUSTER_32K 0x01u
|
||||
#define EC3_CLUSTER_64K 0x02u
|
||||
#define EC3_CLUSTER_128K 0x03u
|
||||
#define EC3_CLUSTER_256K 0x04u
|
||||
#define EC3_CLUSTER_512K 0x05u
|
||||
#define EC3_CLUSTER_1M 0x06u
|
||||
|
||||
#define EC3_TAG_VOLU 0x564F4C55
|
||||
#define EC3_TAG_CTAB 0x43544142
|
||||
#define EC3_TAG_XATR 0x58415452
|
||||
#define EC3_TAG_STAB 0x53544142
|
||||
#define EC3_TAG_MFST 0x4D465354
|
||||
#define EC3_TAG_BLOB 0x424C4F42
|
||||
#define EC3_TAG_EXEC 0x45584543
|
||||
#define EC3_TAG_CERT 0x43455254
|
||||
#define EC3_TAG_CSIG 0x43534947
|
||||
|
||||
#define EC3_TAG_SIGNED 0x00000001u
|
||||
#define EC3_TAG_COMPRESSED 0x00000002u
|
||||
#define EC3_TAG_ENCRYPTED 0x00000004u
|
||||
|
||||
struct ec3_header {
|
||||
b_i32 h_sig;
|
||||
b_i16 h_version;
|
||||
b_i16 h_cluster_size;
|
||||
b_i64 h_tag_table_offset;
|
||||
b_i64 h_tag_count;
|
||||
b_i64 h_app_magic;
|
||||
};
|
||||
|
||||
struct ec3_tag_table_entry {
|
||||
b_i32 tag_type;
|
||||
b_i32 tag_flags;
|
||||
b_i32 tag_checksum;
|
||||
b_i32 tag_reserved1;
|
||||
b_i64 tag_ident;
|
||||
b_i64 tag_offset;
|
||||
b_i64 tag_size;
|
||||
b_i64 tag_reserved2;
|
||||
};
|
||||
|
||||
#endif
|
||||
12
src/status.h
Normal file
12
src/status.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef STATUS_H_
|
||||
#define STATUS_H_
|
||||
|
||||
enum ec3_status {
|
||||
EC3_SUCCESS = 0,
|
||||
EC3_ERR_NO_MEMORY,
|
||||
EC3_ERR_NO_ENTRY,
|
||||
EC3_ERR_NOT_SUPPORTED,
|
||||
EC3_ERR_BAD_STATE,
|
||||
};
|
||||
|
||||
#endif
|
||||
22
src/write.h
Normal file
22
src/write.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef WRITE_H_
|
||||
#define WRITE_H_
|
||||
|
||||
#include "status.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
struct ec3_writer;
|
||||
struct ec3_tag_writer;
|
||||
|
||||
extern enum ec3_status ec3_writer_create(void);
|
||||
extern void ec3_writer_destroy(struct ec3_writer *w);
|
||||
extern void ec3_writer_write_image(struct ec3_writer *w, FILE *fp);
|
||||
|
||||
extern enum ec3_status ec3_writer_create_tag(
|
||||
struct ec3_writer *w,
|
||||
uint32_t tag_type,
|
||||
uint64_t tag_ident,
|
||||
struct ec3_tag_writer **out_writer);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user