- add third_party src.
[platform/framework/web/crosswalk.git] / src / native_client / src / public / name_service.h
1 /*
2  * Copyright (c) 2011 The Native Client Authors. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the LICENSE file.
5  */
6
7 #ifndef _NATIVE_CLIENT_SRC_PUBLIC_NAME_SERVICE_H_
8 #define _NATIVE_CLIENT_SRC_PUBLIC_NAME_SERVICE_H_
9
10 #define NACL_NAME_SERVICE_CONNECTION_MAX  8
11
12 #define NACL_NAME_SERVICE_SUCCESS                 0
13 #define NACL_NAME_SERVICE_NAME_NOT_FOUND          1
14 #define NACL_NAME_SERVICE_DUPLICATE_NAME          2
15 #define NACL_NAME_SERVICE_INSUFFICIENT_RESOURCES  3
16 #define NACL_NAME_SERVICE_PERMISSION_DENIED       4
17 #define NACL_NAME_SERVICE_INVALID_ARGUMENT        5
18
19 #define NACL_NAME_SERVICE_LIST            "list::C"
20 /* output buffer contains NUL separated names */
21
22 #define NACL_NAME_SERVICE_INSERT          "insert:sih:i"
23 /* object name, max access mode, descriptor -> status */
24
25 #define NACL_NAME_SERVICE_DELETE          "delete:s:i"
26 /* object name -> status */
27
28 #define NACL_NAME_SERVICE_LOOKUP_DEPRECATED "lookup:s:ih"
29 /*
30  * object name -> status, descriptor; flags curried to be RDONLY.
31  * deprecated; for ABI backward compatibility while TC and apps are
32  * updated.
33  */
34
35 #define NACL_NAME_SERVICE_LOOKUP          "lookup:si:ih"
36 /* object name, flags -> status, descriptor */
37
38 #define NACL_NAME_SERVICE_TAKE_OWNERSHIP  "take_ownership::"
39 /*
40  * make the name service immutable by all other connections.  when the
41  * owner connection is closed, the name service may become writable to
42  * all again.  does not have to be implemented by all name services.
43  */
44
45 /*
46  * Mode argument for insert and flags argument lookup must contain in
47  * the NACL_ABI_O_ACCMODE bit field one of
48  *
49  * NACL_ABI_O_RDONLY
50  * NACL_ABI_O_WRONLY
51  * NACL_ABI_O_RDWR
52  *
53  * and lookup flags argument may also contain any of
54  *
55  * NACL_ABI_O_CREAT
56  * NACL_ABI_O_TRUNC
57  * NACL_ABI_O_APPEND
58  *
59  * though whether the latter flag bits are supported or not depends on
60  * the name service.
61  *
62  * Connection capabilities should be looked up with O_RDWR.  An fstat
63  * is required if client code needs to distinguish between a (file)
64  * descriptor for which the read and write syscalls work and a
65  * connection capability, though it's better to just attempt the
66  * syscall(s) and detect the failure.
67  *
68  * When lookup occurs and asks for RDONLY, if a name entry with that
69  * name with either RDONLY or RDWR mode exists, then that entry is
70  * returned; otherwise a NACL_NAME_SERVICE_NAME_NOT_FOUND or
71  * NACL_NAME_SERVICE_PERMISSION_DENIED status is returned.
72  */
73
74 #endif  /* _NATIVE_CLIENT_SRC_PUBLIC_NAME_SERVICE_H_ */