sa_len.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, see
  13. <http://www.gnu.org/licenses/>. */
  14. #include <sys/socket.h>
  15. #include <netinet/in.h>
  16. #include <sys/un.h>
  17. #if 0
  18. #include <netipx/ipx.h>
  19. #include <netash/ash.h>
  20. #include <netatalk/at.h>
  21. #include <netax25/ax25.h>
  22. #include <neteconet/ec.h>
  23. #include <netpacket/packet.h>
  24. #include <netrose/rose.h>
  25. #endif
  26. int __libc_sa_len (sa_family_t af) attribute_hidden;
  27. int __libc_sa_len (sa_family_t af)
  28. {
  29. switch (af)
  30. {
  31. #if 0
  32. case AF_APPLETALK:
  33. return sizeof (struct sockaddr_at);
  34. case AF_ASH:
  35. return sizeof (struct sockaddr_ash);
  36. case AF_AX25:
  37. return sizeof (struct sockaddr_ax25);
  38. case AF_ECONET:
  39. return sizeof (struct sockaddr_ec);
  40. case AF_ROSE:
  41. return sizeof (struct sockaddr_rose);
  42. case AF_PACKET:
  43. return sizeof (struct sockaddr_ll);
  44. #endif
  45. case AF_INET:
  46. return sizeof (struct sockaddr_in);
  47. #ifdef __UCLIBC_HAS_IPV6__
  48. case AF_INET6:
  49. return sizeof (struct sockaddr_in6);
  50. #endif
  51. #if 0
  52. case AF_IPX:
  53. return sizeof (struct sockaddr_ipx);
  54. #endif
  55. case AF_LOCAL:
  56. return sizeof (struct sockaddr_un);
  57. }
  58. return 0;
  59. }