chiark / gitweb /
journal: add basic object definition for signatures
authorLennart Poettering <lennart@poettering.net>
Tue, 5 Jun 2012 18:45:54 +0000 (20:45 +0200)
committerLennart Poettering <lennart@poettering.net>
Sat, 16 Jun 2012 22:03:12 +0000 (00:03 +0200)
src/journal/journal-def.h
src/journal/journal-file.c

index 53f1e22..86aef8f 100644 (file)
 #include "macro.h"
 
 typedef struct Header Header;
+
 typedef struct ObjectHeader ObjectHeader;
 typedef union Object Object;
+
 typedef struct DataObject DataObject;
 typedef struct FieldObject FieldObject;
 typedef struct EntryObject EntryObject;
 typedef struct HashTableObject HashTableObject;
 typedef struct EntryArrayObject EntryArrayObject;
+typedef struct SignatureObject SignatureObject;
+
 typedef struct EntryItem EntryItem;
 typedef struct HashItem HashItem;
 
@@ -48,6 +52,7 @@ enum {
         OBJECT_DATA_HASH_TABLE,
         OBJECT_FIELD_HASH_TABLE,
         OBJECT_ENTRY_ARRAY,
+        OBJECT_SIGNATURE,
         _OBJECT_TYPE_MAX
 };
 
@@ -115,6 +120,14 @@ _packed_ struct EntryArrayObject {
         le64_t items[];
 };
 
+#define SIGNATURE_LENGTH 160
+
+_packed_ struct SignatureObject {
+        ObjectHeader object;
+        le64_t from;
+        uint8_t signature[SIGNATURE_LENGTH];
+};
+
 union Object {
         ObjectHeader object;
         DataObject data;
@@ -122,6 +135,7 @@ union Object {
         EntryObject entry;
         HashTableObject hash_table;
         EntryArrayObject entry_array;
+        SignatureObject signature;
 };
 
 enum {
@@ -135,6 +149,10 @@ enum {
         HEADER_INCOMPATIBLE_COMPRESSED = 1
 };
 
+enum {
+        HEADER_COMPATIBLE_SIGNED = 1
+};
+
 _packed_ struct Header {
         uint8_t signature[8]; /* "LPKSHHRH" */
         uint32_t compatible_flags;
index bbe00ab..8f301b8 100644 (file)
@@ -1702,6 +1702,10 @@ void journal_file_dump(JournalFile *f) {
                 case OBJECT_ENTRY_ARRAY:
                         printf("Type: OBJECT_ENTRY_ARRAY\n");
                         break;
+
+                case OBJECT_SIGNATURE:
+                        printf("Type: OBJECT_SIGNATURE\n");
+                        break;
                 }
 
                 if (o->object.flags & OBJECT_COMPRESSED)