1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_ 7 8 #include <stdint.h> 9 10 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" 11 12 namespace mojo { 13 namespace internal { 14 15 #pragma pack(push, 1) 16 17 struct MessageHeader : internal::StructHeader { 18 // Interface ID for identifying multiple interfaces running on the same 19 // message pipe. 20 uint32_t interface_id; 21 // Message name, which is scoped to the interface that the message belongs to. 22 uint32_t name; 23 // 0 or either of the enum values defined above. 24 uint32_t flags; 25 // Unused padding to make the struct size a multiple of 8 bytes. 26 uint32_t padding; 27 }; 28 static_assert(sizeof(MessageHeader) == 24, "Bad sizeof(MessageHeader)"); 29 30 struct MessageHeaderWithRequestID : MessageHeader { 31 // Only used if either kFlagExpectsResponse or kFlagIsResponse is set in 32 // order to match responses with corresponding requests. 33 uint64_t request_id; 34 }; 35 static_assert(sizeof(MessageHeaderWithRequestID) == 32, 36 "Bad sizeof(MessageHeaderWithRequestID)"); 37 38 #pragma pack(pop) 39 40 } // namespace internal 41 } // namespace mojo 42 43 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_ 44