summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Steven Moreland <smoreland@google.com> 2021-09-02 16:18:14 -0700
committer Steven Moreland <smoreland@google.com> 2021-09-02 16:19:18 -0700
commit14cd3fe65930a33e9dec55f0943fa9474cd78212 (patch)
tree3e1d033402e0d78f5e8b6b8ac301db1c757c131b
parent16d7c90ff1bb4f0771b38ec604c405698b001a44 (diff)
libbinder: static assert wire protocol sizes
These can change until the RPC protocol is frozen (this may be in a later or earlier release), but in the spirit of keeping the tree in as close of a release state as possible, adding these asserts here now. Bug: 182938972 Test: build (build time static asserts) Change-Id: I682a75fb20a1249c4da4a8b6957ae6448b934f9f
-rw-r--r--libs/binder/RpcWireFormat.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/libs/binder/RpcWireFormat.h b/libs/binder/RpcWireFormat.h
index c73d8c2bd8..067c4ad551 100644
--- a/libs/binder/RpcWireFormat.h
+++ b/libs/binder/RpcWireFormat.h
@@ -31,6 +31,7 @@ struct RpcWireAddress {
uint64_t options;
uint8_t address[32];
};
+static_assert(sizeof(RpcWireAddress) == 40);
/**
* This is sent to an RpcServer in order to request a new connection is created,
@@ -43,6 +44,7 @@ struct RpcConnectionHeader {
uint8_t options;
uint8_t reserved1[7];
};
+static_assert(sizeof(RpcConnectionHeader) == 56);
/**
* In response to an RpcConnectionHeader which corresponds to a new session,
@@ -52,6 +54,7 @@ struct RpcNewSessionResponse {
uint32_t version; // maximum supported by callee <= maximum supported by caller
uint8_t reserved[4];
};
+static_assert(sizeof(RpcNewSessionResponse) == 8);
#define RPC_CONNECTION_INIT_OKAY "cci"
@@ -64,6 +67,7 @@ struct RpcOutgoingConnectionInit {
char msg[4];
uint8_t reserved[4];
};
+static_assert(sizeof(RpcOutgoingConnectionInit) == 8);
enum : uint32_t {
/**
@@ -105,6 +109,7 @@ struct RpcWireHeader {
uint32_t reserved[2];
};
+static_assert(sizeof(RpcWireHeader) == 16);
struct RpcWireTransaction {
RpcWireAddress address;
@@ -117,11 +122,13 @@ struct RpcWireTransaction {
uint8_t data[];
};
+static_assert(sizeof(RpcWireTransaction) == 72);
struct RpcWireReply {
int32_t status; // transact return
uint8_t data[];
};
+static_assert(sizeof(RpcWireReply) == 4);
#pragma clang diagnostic pop