sa_len.c 1.9 KB

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