1 /*
2  * Copyright (C) 2006 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __SOCKET_LOCAL_H
18 #define __SOCKET_LOCAL_H
19 
20 #include <sys/socket.h>
21 
22 #define FILESYSTEM_SOCKET_PREFIX "/tmp/"
23 #define ANDROID_RESERVED_SOCKET_PREFIX "/dev/socket/"
24 
25 /*
26  * Set up a given sockaddr_un, to have it refer to the given
27  * name in the given namespace. The namespace must be one
28  * of <code>ANDROID_SOCKET_NAMESPACE_ABSTRACT</code>,
29  * <code>ANDROID_SOCKET_NAMESPACE_RESERVED</code>, or
30  * <code>ANDROID_SOCKET_NAMESPACE_FILESYSTEM</code>. Upon success,
31  * the pointed at sockaddr_un is filled in and the pointed at
32  * socklen_t is set to indicate the final length. This function
33  * will fail if the namespace is invalid (not one of the indicated
34  * constants) or if the name is too long.
35  *
36  * @return 0 on success or -1 on failure
37  */
38 int socket_make_sockaddr_un(const char *name, int namespaceId,
39         struct sockaddr_un *p_addr, socklen_t *alen);
40 
41 #endif
42