journal: add basic object definition for signatures

This commit is contained in:
Lennart Poettering 2012-06-05 20:45:54 +02:00
parent 23b0b2b264
commit 8144056fa6
2 changed files with 22 additions and 0 deletions

View File

@ -29,13 +29,17 @@
#include "macro.h" #include "macro.h"
typedef struct Header Header; typedef struct Header Header;
typedef struct ObjectHeader ObjectHeader; typedef struct ObjectHeader ObjectHeader;
typedef union Object Object; typedef union Object Object;
typedef struct DataObject DataObject; typedef struct DataObject DataObject;
typedef struct FieldObject FieldObject; typedef struct FieldObject FieldObject;
typedef struct EntryObject EntryObject; typedef struct EntryObject EntryObject;
typedef struct HashTableObject HashTableObject; typedef struct HashTableObject HashTableObject;
typedef struct EntryArrayObject EntryArrayObject; typedef struct EntryArrayObject EntryArrayObject;
typedef struct SignatureObject SignatureObject;
typedef struct EntryItem EntryItem; typedef struct EntryItem EntryItem;
typedef struct HashItem HashItem; typedef struct HashItem HashItem;
@ -48,6 +52,7 @@ enum {
OBJECT_DATA_HASH_TABLE, OBJECT_DATA_HASH_TABLE,
OBJECT_FIELD_HASH_TABLE, OBJECT_FIELD_HASH_TABLE,
OBJECT_ENTRY_ARRAY, OBJECT_ENTRY_ARRAY,
OBJECT_SIGNATURE,
_OBJECT_TYPE_MAX _OBJECT_TYPE_MAX
}; };
@ -115,6 +120,14 @@ _packed_ struct EntryArrayObject {
le64_t items[]; le64_t items[];
}; };
#define SIGNATURE_LENGTH 160
_packed_ struct SignatureObject {
ObjectHeader object;
le64_t from;
uint8_t signature[SIGNATURE_LENGTH];
};
union Object { union Object {
ObjectHeader object; ObjectHeader object;
DataObject data; DataObject data;
@ -122,6 +135,7 @@ union Object {
EntryObject entry; EntryObject entry;
HashTableObject hash_table; HashTableObject hash_table;
EntryArrayObject entry_array; EntryArrayObject entry_array;
SignatureObject signature;
}; };
enum { enum {
@ -135,6 +149,10 @@ enum {
HEADER_INCOMPATIBLE_COMPRESSED = 1 HEADER_INCOMPATIBLE_COMPRESSED = 1
}; };
enum {
HEADER_COMPATIBLE_SIGNED = 1
};
_packed_ struct Header { _packed_ struct Header {
uint8_t signature[8]; /* "LPKSHHRH" */ uint8_t signature[8]; /* "LPKSHHRH" */
uint32_t compatible_flags; uint32_t compatible_flags;

View File

@ -1702,6 +1702,10 @@ void journal_file_dump(JournalFile *f) {
case OBJECT_ENTRY_ARRAY: case OBJECT_ENTRY_ARRAY:
printf("Type: OBJECT_ENTRY_ARRAY\n"); printf("Type: OBJECT_ENTRY_ARRAY\n");
break; break;
case OBJECT_SIGNATURE:
printf("Type: OBJECT_SIGNATURE\n");
break;
} }
if (o->object.flags & OBJECT_COMPRESSED) if (o->object.flags & OBJECT_COMPRESSED)