summaryrefslogtreecommitdiff
path: root/lib/rpmlead.h
blob: 48d4df287169088718c549d0e073cabe2a2530c6 (plain)
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
#ifndef _H_RPMLEAD
#define _H_RPMLEAD

/** \ingroup lead
 * \file lib/rpmlead.h
 * Routines to read and write an rpm lead structure for a a package.
 */
#ifdef __cplusplus
extern "C" {
#endif

#define RPMLEAD_BINARY 0
#define RPMLEAD_SOURCE 1

#define RPMLEAD_MAGIC0 0xed
#define RPMLEAD_MAGIC1 0xab
#define RPMLEAD_MAGIC2 0xee
#define RPMLEAD_MAGIC3 0xdb

#define RPMLEAD_SIZE 96         /*!< Don't rely on sizeof(struct) */

/** \ingroup lead
 * Write lead to file handle.
 * @param fd		file handle
 * @param h		package header
 * @return		RPMRC_OK on success, RPMRC_FAIL on error
 */
rpmRC rpmLeadWrite(FD_t fd, Header h);

/** \ingroup lead
 * Read lead from file handle.
 * @param fd		file handle
 * @retval type		RPMLEAD_BINARY or RPMLEAD_SOURCE on success
 * @retval emsg		failure message on error (malloced)
 * @return		RPMRC_OK on success, RPMRC_FAIL/RPMRC_NOTFOUND on error
 */
rpmRC rpmLeadRead(FD_t fd, int *type, char **emsg);

#ifdef __cplusplus
}
#endif

#endif	/* _H_RPMLEAD */