all_interfaces.h revision ca12bfac764ba476d6cd062bf1dde12cc64c3f40
1ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch// Use of this source code is governed by a BSD-style license that can be
3ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch// found in the LICENSE file.
4ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch
52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/* Given an interface like this:
72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) *
82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) *   struct PPB_Frob {
92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) *     void (*Flange)(int32_t param1, char* param2);
102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) *     int32_t (*Shlep)(PP_CompletionCallback);
112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) *   };
122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) *
132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * Write a set of macros like this:
142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) *
152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) *   BEGIN_INTERFACE(FrobInterface, PPB_Frob, PPB_FROB_INTERFACE)
162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) *     METHOD2(FrobInterface, void, Flange, int32_t, char*)
172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) *     METHOD1(FrobInterface, int32_t, Shlep, PP_CompletionCallback)
182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) *   END_INTERFACE(FrobInterface, PPB_Frob)
192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */
202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
21c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)BEGIN_INTERFACE(ConsoleInterface, PPB_Console, PPB_CONSOLE_INTERFACE_1_0)
222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD3(ConsoleInterface, void, Log, PP_Instance, PP_LogLevel, struct PP_Var)
232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)END_INTERFACE(ConsoleInterface, PPB_Console)
242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
25c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)BEGIN_INTERFACE(FileIoInterface, PPB_FileIO, PPB_FILEIO_INTERFACE_1_0)
262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD1(FileIoInterface, void, Close, PP_Resource)
272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD1(FileIoInterface, PP_Resource, Create, PP_Resource)
282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD2(FileIoInterface, int32_t, Flush, PP_Resource,
292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)          PP_CompletionCallback)
302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD4(FileIoInterface, int32_t, Open, PP_Resource, PP_Resource, int32_t,
312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)          PP_CompletionCallback)
322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD3(FileIoInterface, int32_t, Query, PP_Resource, PP_FileInfo*,
332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)          PP_CompletionCallback)
342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD5(FileIoInterface, int32_t, Read, PP_Resource, int64_t, char*,
352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)          int32_t, PP_CompletionCallback)
362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD3(FileIoInterface, int32_t, SetLength, PP_Resource, int64_t,
372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)          PP_CompletionCallback)
382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD5(FileIoInterface, int32_t, Write, PP_Resource, int64_t,
392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)          const char*, int32_t, PP_CompletionCallback)
402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)END_INTERFACE(FileIoInterface, PPB_FileIO)
412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
42868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)BEGIN_INTERFACE(FileRefInterface, PPB_FileRef, PPB_FILEREF_INTERFACE_1_1)
432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD2(FileRefInterface, PP_Resource, Create, PP_Resource, const char*)
442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD2(FileRefInterface, int32_t, Delete, PP_Resource, PP_CompletionCallback)
452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD1(FileRefInterface, PP_Var, GetName, PP_Resource)
462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD3(FileRefInterface, int32_t, MakeDirectory, PP_Resource, PP_Bool,
472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)          PP_CompletionCallback)
48868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  METHOD3(FileRefInterface, int32_t, Query, PP_Resource, PP_FileInfo*,
49868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)          PP_CompletionCallback)
50c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  METHOD3(FileRefInterface, int32_t, ReadDirectoryEntries, PP_Resource,
51c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)          const PP_ArrayOutput&, PP_CompletionCallback)
522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)END_INTERFACE(FileRefInterface, PPB_FileRef)
532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
54c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)BEGIN_INTERFACE(FileSystemInterface, PPB_FileSystem,
55c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)                PPB_FILESYSTEM_INTERFACE_1_0)
562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD2(FileSystemInterface, PP_Resource, Create, PP_Instance,
572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)          PP_FileSystemType)
582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD3(FileSystemInterface, int32_t, Open, PP_Resource, int64_t,
592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)          PP_CompletionCallback)
602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)END_INTERFACE(FileSystemInterface, PPB_FileSystem)
612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
62c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)BEGIN_INTERFACE(MessagingInterface, PPB_Messaging, PPB_MESSAGING_INTERFACE_1_0)
632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD2(MessagingInterface, void, PostMessage, PP_Instance, struct PP_Var)
642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)END_INTERFACE(MessagingInterface, PPB_Messaging)
652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
66c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)BEGIN_INTERFACE(VarInterface, PPB_Var, PPB_VAR_INTERFACE_1_1)
672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD2(VarInterface, struct PP_Var, VarFromUtf8, const char *, uint32_t)
682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD2(VarInterface, const char*, VarToUtf8, PP_Var, uint32_t*)
692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)END_INTERFACE(VarInterface, PPB_Var)
702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
71c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)BEGIN_INTERFACE(URLLoaderInterface, PPB_URLLoader, PPB_URLLOADER_INTERFACE_1_0)
722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD1(URLLoaderInterface, PP_Resource, Create, PP_Instance)
732a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD3(URLLoaderInterface, int32_t, Open, PP_Resource, PP_Resource,
742a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)          PP_CompletionCallback)
752a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD1(URLLoaderInterface, PP_Resource, GetResponseInfo, PP_Resource)
762a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD4(URLLoaderInterface, int32_t, ReadResponseBody, PP_Resource, void*,
772a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)          int32_t, PP_CompletionCallback)
782a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD1(URLLoaderInterface, void, Close, PP_Resource)
792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)END_INTERFACE(URLLoaderInterface, PPB_URLLoader)
802a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
812a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)BEGIN_INTERFACE(URLRequestInfoInterface, PPB_URLRequestInfo,
82c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)                PPB_URLREQUESTINFO_INTERFACE_1_0)
832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD1(URLRequestInfoInterface, PP_Resource, Create, PP_Instance)
842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD3(URLRequestInfoInterface, PP_Bool, SetProperty, PP_Resource,
852a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)          PP_URLRequestProperty, PP_Var)
862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)END_INTERFACE(URLRequestInfoInterface, PPB_URLRequestInfo)
872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)BEGIN_INTERFACE(URLResponseInfoInterface, PPB_URLResponseInfo,
89c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)                PPB_URLRESPONSEINFO_INTERFACE_1_0)
902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  METHOD2(URLResponseInfoInterface, PP_Var, GetProperty, PP_Resource,
912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)          PP_URLResponseProperty)
922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)END_INTERFACE(URLResponseInfoInterface, PPB_URLResponseInfo)
93