| 1 | // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 | // for details. All rights reserved. Use of this source code is governed by a |
| 3 | // BSD-style license that can be found in the LICENSE file. |
| 4 | |
| 5 | #ifndef RUNTIME_BIN_IO_SERVICE_H_ |
| 6 | #define RUNTIME_BIN_IO_SERVICE_H_ |
| 7 | |
| 8 | #if defined(DART_IO_SECURE_SOCKET_DISABLED) |
| 9 | #error "io_service.h can only be included on builds with IO and SSL enabled" |
| 10 | #endif |
| 11 | |
| 12 | #include "bin/builtin.h" |
| 13 | #include "bin/utils.h" |
| 14 | |
| 15 | namespace dart { |
| 16 | namespace bin { |
| 17 | |
| 18 | // This list must be kept in sync with the list in sdk/lib/io/io_service.dart |
| 19 | #define IO_SERVICE_REQUEST_LIST(V) \ |
| 20 | V(File, Exists, 0) \ |
| 21 | V(File, Create, 1) \ |
| 22 | V(File, Delete, 2) \ |
| 23 | V(File, Rename, 3) \ |
| 24 | V(File, Copy, 4) \ |
| 25 | V(File, Open, 5) \ |
| 26 | V(File, ResolveSymbolicLinks, 6) \ |
| 27 | V(File, Close, 7) \ |
| 28 | V(File, Position, 8) \ |
| 29 | V(File, SetPosition, 9) \ |
| 30 | V(File, Truncate, 10) \ |
| 31 | V(File, Length, 11) \ |
| 32 | V(File, LengthFromPath, 12) \ |
| 33 | V(File, LastAccessed, 13) \ |
| 34 | V(File, SetLastAccessed, 14) \ |
| 35 | V(File, LastModified, 15) \ |
| 36 | V(File, SetLastModified, 16) \ |
| 37 | V(File, Flush, 17) \ |
| 38 | V(File, ReadByte, 18) \ |
| 39 | V(File, WriteByte, 19) \ |
| 40 | V(File, Read, 20) \ |
| 41 | V(File, ReadInto, 21) \ |
| 42 | V(File, WriteFrom, 22) \ |
| 43 | V(File, CreateLink, 23) \ |
| 44 | V(File, DeleteLink, 24) \ |
| 45 | V(File, RenameLink, 25) \ |
| 46 | V(File, LinkTarget, 26) \ |
| 47 | V(File, Type, 27) \ |
| 48 | V(File, Identical, 28) \ |
| 49 | V(File, Stat, 29) \ |
| 50 | V(File, Lock, 30) \ |
| 51 | V(Socket, Lookup, 31) \ |
| 52 | V(Socket, ListInterfaces, 32) \ |
| 53 | V(Socket, ReverseLookup, 33) \ |
| 54 | V(Directory, Create, 34) \ |
| 55 | V(Directory, Delete, 35) \ |
| 56 | V(Directory, Exists, 36) \ |
| 57 | V(Directory, CreateTemp, 37) \ |
| 58 | V(Directory, ListStart, 38) \ |
| 59 | V(Directory, ListNext, 39) \ |
| 60 | V(Directory, ListStop, 40) \ |
| 61 | V(Directory, Rename, 41) \ |
| 62 | V(SSLFilter, ProcessFilter, 42) |
| 63 | |
| 64 | #define DECLARE_REQUEST(type, method, id) k##type##method##Request = id, |
| 65 | |
| 66 | class IOService { |
| 67 | public: |
| 68 | enum { IO_SERVICE_REQUEST_LIST(DECLARE_REQUEST) }; |
| 69 | |
| 70 | static Dart_Port GetServicePort(); |
| 71 | |
| 72 | private: |
| 73 | DISALLOW_ALLOCATION(); |
| 74 | DISALLOW_IMPLICIT_CONSTRUCTORS(IOService); |
| 75 | }; |
| 76 | |
| 77 | } // namespace bin |
| 78 | } // namespace dart |
| 79 | |
| 80 | #endif // RUNTIME_BIN_IO_SERVICE_H_ |
| 81 | |