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