sa_len.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. case AF_INET6:
  51. return sizeof (struct sockaddr_in6);
  52. case AF_IPX:
  53. return sizeof (struct sockaddr_ipx);
  54. case AF_LOCAL:
  55. return sizeof (struct sockaddr_un);
  56. }
  57. return 0;
  58. }