razor.h
changeset 27 5dbd81809d26
child 28 c8958f67afd8
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/razor.h	Tue Sep 18 15:02:04 2007 -0400
     1.3 @@ -0,0 +1,83 @@
     1.4 +#ifndef _RAZOR_H_
     1.5 +#define _RAZOR_H_
     1.6 +
     1.7 +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
     1.8 +
     1.9 +struct array {
    1.10 +	void *data;
    1.11 +	int size, alloc;
    1.12 +};
    1.13 +
    1.14 +struct razor_set_section {
    1.15 +	unsigned int type;
    1.16 +	unsigned int offset;
    1.17 +	unsigned int size;
    1.18 +};
    1.19 +
    1.20 +struct razor_set_header {
    1.21 +	unsigned int magic;
    1.22 +	unsigned int version;
    1.23 +	struct razor_set_section sections[0];
    1.24 +};
    1.25 +
    1.26 +#define RAZOR_MAGIC 0x7a7a7a7a
    1.27 +#define RAZOR_VERSION 1
    1.28 +
    1.29 +#define RAZOR_PACKAGES 0
    1.30 +#define RAZOR_REQUIRES 1
    1.31 +#define RAZOR_PROVIDES 2
    1.32 +#define RAZOR_STRING_POOL 3
    1.33 +#define RAZOR_PROPERTY_POOL 4
    1.34 +
    1.35 +struct razor_package {
    1.36 +	unsigned long name;
    1.37 +	unsigned long version;
    1.38 +	unsigned long requires;
    1.39 +	unsigned long provides;
    1.40 +};
    1.41 +
    1.42 +struct razor_property {
    1.43 +	unsigned long name;
    1.44 +	unsigned long version;
    1.45 +	unsigned long packages;
    1.46 +};
    1.47 +
    1.48 +struct razor_set {
    1.49 +	struct array buckets;
    1.50 +	struct array string_pool;
    1.51 +	struct array property_pool;
    1.52 + 	struct array packages;
    1.53 + 	struct array requires;
    1.54 + 	struct array provides;
    1.55 +	struct razor_set_header *header;
    1.56 +};
    1.57 +
    1.58 +struct import_property_context {
    1.59 +	struct array *all;
    1.60 +	struct array package;
    1.61 +};
    1.62 +
    1.63 +struct import_context {
    1.64 +	struct razor_set *set;
    1.65 +	struct import_property_context requires;
    1.66 +	struct import_property_context provides;
    1.67 +	struct razor_package *package;
    1.68 +	unsigned long *requires_map;
    1.69 +	unsigned long *provides_map;
    1.70 +};
    1.71 +
    1.72 +void import_context_add_package(struct import_context *ctx,
    1.73 +				const char *name, const char *version);
    1.74 +void import_context_add_property(struct import_context *ctx,
    1.75 +				 struct import_property_context *pctx,
    1.76 +				 const char *name, const char *version);
    1.77 +void import_context_finish_package(struct import_context *ctx);
    1.78 +
    1.79 +unsigned long razor_set_tokenize(struct razor_set *set, const char *string);
    1.80 +void razor_prepare_import(struct import_context *ctx);
    1.81 +struct razor_set *razor_finish_import(struct import_context *ctx);
    1.82 +
    1.83 +struct razor_set *razor_import_rzr_files(int count, const char **files);
    1.84 +struct razor_set *razor_set_create_from_yum_filelist(int fd);
    1.85 +
    1.86 +#endif /* _RAZOR_H_ */