sa_len.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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)
  30. {
  31. switch (af)
  32. {
  33. #if 0
  34. case AF_APPLETALK:
  35. return sizeof (struct sockaddr_at);
  36. case AF_ASH:
  37. return sizeof (struct sockaddr_ash);
  38. case AF_AX25:
  39. return sizeof (struct sockaddr_ax25);
  40. case AF_ECONET:
  41. return sizeof (struct sockaddr_ec);
  42. case AF_ROSE:
  43. return sizeof (struct sockaddr_rose);
  44. case AF_PACKET:
  45. return sizeof (struct sockaddr_ll);
  46. #endif
  47. case AF_INET:
  48. return sizeof (struct sockaddr_in);
  49. case AF_INET6:
  50. return sizeof (struct sockaddr_in6);
  51. case AF_IPX:
  52. return sizeof (struct sockaddr_ipx);
  53. case AF_LOCAL:
  54. return sizeof (struct sockaddr_un);
  55. }
  56. return 0;
  57. }