-
Notifications
You must be signed in to change notification settings - Fork 2
/
rpmstruct.h
95 lines (73 loc) · 1.91 KB
/
rpmstruct.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#ifndef __MAKERPM_RPMSTRUCT_H
#define __MAKERPM_RPMSTRUCT_H
namespace rpm {
struct lead_t {
unsigned char magic[4];
unsigned char major;
unsigned char minor;
uint16_t type;
uint16_t archnum;
char name[66];
uint16_t osnum;
uint16_t signature_type; /* Signature header type (RPMSIG_HEADERSIG) */
char reserved[16]; /* Pad to 96 bytes -- 8 byte aligned! */
static const size_t SIZE = 96;
lead_t(const std::string& _name = "") {
magic[0] = 0xed;
magic[1] = 0xab;
magic[2] = 0xee;
magic[3] = 0xdb;
major = 3;
minor = 0;
type = 0;
archnum = 256; // A big-endian 1.
osnum = 256; // A big-endian 1.
signature_type = 1280; // A big-endian 5.
::strncpy(name, _name.c_str(), 65);
name[65] = '\0';
}
};
struct index_t {
unsigned char magic[8];
uint32_t nentries;
uint32_t size;
static const size_t SIZE = 16;
struct entry_t {
enum {
TYPE_NULL = 0,
TYPE_CHAR = 1,
TYPE_INT8 = 2,
TYPE_INT16 = 3,
TYPE_INT32 = 4,
TYPE_INT64 = 5,
TYPE_STRING = 6,
TYPE_BIN = 7,
TYPE_STRING_ARRAY = 8,
TYPE_I18STRING = 9
};
uint32_t tag;
uint32_t type;
uint32_t offset;
uint32_t count;
static const size_t SIZE = 16;
};
std::vector<entry_t> entries;
size_t store_off;
size_t data_off;
index_t() {
magic[0] = 0x8e;
magic[1] = 0xad;
magic[2] = 0xe8;
magic[3] = 0x01;
magic[4] = 0x00;
magic[5] = 0x00;
magic[6] = 0x00;
magic[7] = 0x00;
nentries = 0;
size = 0;
store_off = 0;
data_off = 0;
}
};
}
#endif