socket_local.h 1.4 KB

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