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#define FILESYSTEM_SOCKET_PREFIX "/tmp/"
21#define ANDROID_RESERVED_SOCKET_PREFIX "/dev/socket/"
22
23/*
24 * Set up a given sockaddr_un, to have it refer to the given
25 * name in the given namespace. The namespace must be one
26 * of <code>ANDROID_SOCKET_NAMESPACE_ABSTRACT</code>,
27 * <code>ANDROID_SOCKET_NAMESPACE_RESERVED</code>, or
28 * <code>ANDROID_SOCKET_NAMESPACE_FILESYSTEM</code>. Upon success,
29 * the pointed at sockaddr_un is filled in and the pointed at
30 * socklen_t is set to indicate the final length. This function
31 * will fail if the namespace is invalid (not one of the indicated
32 * constants) or if the name is too long.
33 *
34 * @return 0 on success or -1 on failure
35 */
36int socket_make_sockaddr_un(const char *name, int namespaceId,
37        struct sockaddr_un *p_addr, socklen_t *alen);
38
39#endif
40