Back to index

glibc  2.9
sa_len.c
Go to the documentation of this file.
00001 /* Copyright (C) 1998, 1999, 2002, 2007 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #include <sys/socket.h>
00020 
00021 #include <netash/ash.h>
00022 #include <netatalk/at.h>
00023 #include <netax25/ax25.h>
00024 #include <neteconet/ec.h>
00025 #include <netinet/in.h>
00026 #include <netipx/ipx.h>
00027 #include <netpacket/packet.h>
00028 #include <netrose/rose.h>
00029 #include <netiucv/iucv.h>
00030 #include <sys/un.h>
00031 
00032 int
00033 __libc_sa_len (sa_family_t af)
00034 {
00035   switch (af)
00036     {
00037     case AF_APPLETALK:
00038       return sizeof (struct sockaddr_at);
00039     case AF_ASH:
00040       return sizeof (struct sockaddr_ash);
00041     case AF_AX25:
00042       return sizeof (struct sockaddr_ax25);
00043     case AF_ECONET:
00044       return sizeof (struct sockaddr_ec);
00045     case AF_INET:
00046       return sizeof (struct sockaddr_in);
00047     case AF_INET6:
00048       return sizeof (struct sockaddr_in6);
00049     case AF_IPX:
00050       return sizeof (struct sockaddr_ipx);
00051 #ifdef NEED_AF_IUCV
00052     case AF_IUCV:
00053       return sizeof (struct sockaddr_iucv);
00054 #endif
00055     case AF_LOCAL:
00056       return sizeof (struct sockaddr_un);
00057     case AF_PACKET:
00058       return sizeof (struct sockaddr_ll);
00059     case AF_ROSE:
00060       return sizeof (struct sockaddr_rose);
00061     }
00062   return 0;
00063 }
00064 INTDEF(__libc_sa_len)