Enforce handling of expected payload versions only.

We have always shipped version 1 payloads, but have never checked the
version number. This change enforces that, so we refuse to process
any other version number.

The new error code kErrorCodeUnsupportedPayloadVersion is added to
report bad payload versions if they are received.

BUG=chromium:312526
TEST=Unittests.

Change-Id: I25c9f7e73c37274527bc7cc9ba9e3d9f4734326c
Reviewed-on: https://chromium-review.googlesource.com/174940
Commit-Queue: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
diff --git a/delta_performer.h b/delta_performer.h
index 7943d7a..a9cbe44 100644
--- a/delta_performer.h
+++ b/delta_performer.h
@@ -36,6 +36,7 @@
 
   static const uint64_t kDeltaVersionSize;
   static const uint64_t kDeltaManifestSizeSize;
+  static const uint64_t kSupportedMajorPayloadVersion;
   static const char kUpdatePayloadPublicKeyPath[];
 
   // Defines the granularity of progress logging in terms of how many "completed
@@ -163,15 +164,18 @@
     public_key_path_ = public_key_path;
   }
 
-  // Returns the byte offset at which the manifest protobuf begins in a
-  // payload.
-  static uint64_t GetManifestOffset();
+  // Returns the byte offset at which the payload version can be found.
+  static uint64_t GetVersionOffset();
 
   // Returns the byte offset where the size of the manifest is stored in
   // a payload. This offset precedes the actual start of the manifest
   // that's returned by the GetManifestOffset method.
   static uint64_t GetManifestSizeOffset();
 
+  // Returns the byte offset at which the manifest protobuf begins in a
+  // payload.
+  static uint64_t GetManifestOffset();
+
  private:
   friend class DeltaPerformerTest;
   FRIEND_TEST(DeltaPerformerTest, IsIdempotentOperationTest);