1645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez// Copyright 2014 The Chromium Authors. All rights reserved. 2645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez// Use of this source code is governed by a BSD-style license that can be 3645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez// found in the LICENSE file. 4645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez 5645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_ 6645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez#define MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_ 7645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez 8645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez#include <stdint.h> 9645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez 10645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez#include "mojo/public/cpp/bindings/lib/bindings_internal.h" 11645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez 12645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chaveznamespace mojo { 13645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chaveznamespace internal { 14645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez 15645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez#pragma pack(push, 1) 16645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez 17645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavezstruct MessageHeader : internal::StructHeader { 18645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez // Interface ID for identifying multiple interfaces running on the same 19645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez // message pipe. 20645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez uint32_t interface_id; 21645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez // Message name, which is scoped to the interface that the message belongs to. 22645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez uint32_t name; 23645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez // 0 or either of the enum values defined above. 24645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez uint32_t flags; 25645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez // Unused padding to make the struct size a multiple of 8 bytes. 26645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez uint32_t padding; 27645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez}; 28645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavezstatic_assert(sizeof(MessageHeader) == 24, "Bad sizeof(MessageHeader)"); 29645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez 30645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavezstruct MessageHeaderWithRequestID : MessageHeader { 31645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez // Only used if either kFlagExpectsResponse or kFlagIsResponse is set in 32645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez // order to match responses with corresponding requests. 33645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez uint64_t request_id; 34645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez}; 35645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavezstatic_assert(sizeof(MessageHeaderWithRequestID) == 32, 36645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez "Bad sizeof(MessageHeaderWithRequestID)"); 37645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez 38645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez#pragma pack(pop) 39645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez 40645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez} // namespace internal 41645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez} // namespace mojo 42645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez 43645501c2ab19a559ce82a1d5a29ced159a4c30fbLuis Hector Chavez#endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_ 44