sa_len.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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, write to the Free
  13. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  14. 02111-1307 USA. */
  15. #define __FORCE_GLIBC
  16. #include <features.h>
  17. #include <sys/socket.h>
  18. #include <netinet/in.h>
  19. #include <netipx/ipx.h>
  20. #include <sys/un.h>
  21. #if 0
  22. #include <netash/ash.h>
  23. #include <netatalk/at.h>
  24. #include <netax25/ax25.h>
  25. #include <neteconet/ec.h>
  26. #include <netpacket/packet.h>
  27. #include <netrose/rose.h>
  28. #endif
  29. int __libc_sa_len (sa_family_t af) attribute_hidden;
  30. int __libc_sa_len (sa_family_t af)
  31. {
  32. switch (af)
  33. {
  34. #if 0
  35. case AF_APPLETALK:
  36. return sizeof (struct sockaddr_at);
  37. case AF_ASH:
  38. return sizeof (struct sockaddr_ash);
  39. case AF_AX25:
  40. return sizeof (struct sockaddr_ax25);
  41. case AF_ECONET:
  42. return sizeof (struct sockaddr_ec);
  43. case AF_ROSE:
  44. return sizeof (struct sockaddr_rose);
  45. case AF_PACKET:
  46. return sizeof (struct sockaddr_ll);
  47. #endif
  48. case AF_INET:
  49. return sizeof (struct sockaddr_in);
  50. #ifdef __UCLIBC_HAS_IPV6__
  51. case AF_INET6:
  52. return sizeof (struct sockaddr_in6);
  53. #endif
  54. #if 0
  55. case AF_IPX:
  56. return sizeof (struct sockaddr_ipx);
  57. #endif
  58. case AF_LOCAL:
  59. return sizeof (struct sockaddr_un);
  60. }
  61. return 0;
  62. }