libnl 1.1
lib/family.c
00001 /*
00002  * lib/family.c         Netlink Family
00003  *
00004  *      This 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 version 2.1
00007  *      of the License.
00008  *
00009  * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
00010  */
00011 
00012 /**
00013  * @defgroup nlfam Netlink Families
00014  * @brief
00015  *
00016  * @{
00017  */
00018 
00019 #include <netlink-local.h>
00020 #include <netlink/netlink.h>
00021 #include <netlink/utils.h>
00022 
00023 /**
00024  * @name Netlink Family Name Translation
00025  * @{
00026  */
00027 
00028 static struct trans_tbl nlfamilies[] = {
00029         __ADD(NETLINK_ROUTE,route)
00030         __ADD(NETLINK_USERSOCK,usersock)
00031         __ADD(NETLINK_FIREWALL,firewall)
00032         __ADD(NETLINK_INET_DIAG,inetdiag)
00033         __ADD(NETLINK_NFLOG,nflog)
00034         __ADD(NETLINK_XFRM,xfrm)
00035         __ADD(NETLINK_SELINUX,selinux)
00036         __ADD(NETLINK_ISCSI,iscsi)
00037         __ADD(NETLINK_AUDIT,audit)
00038         __ADD(NETLINK_FIB_LOOKUP,fib_lookup)
00039         __ADD(NETLINK_CONNECTOR,connector)
00040         __ADD(NETLINK_NETFILTER,netfilter)
00041         __ADD(NETLINK_IP6_FW,ip6_fw)
00042         __ADD(NETLINK_DNRTMSG,dnrtmsg)
00043         __ADD(NETLINK_KOBJECT_UEVENT,kobject_uevent)
00044         __ADD(NETLINK_GENERIC,generic)
00045         __ADD(NETLINK_SCSITRANSPORT,scsitransport)
00046         __ADD(NETLINK_ECRYPTFS,ecryptfs)
00047 };
00048 
00049 char * nl_nlfamily2str(int family, char *buf, size_t size)
00050 {
00051         return __type2str(family, buf, size, nlfamilies,
00052                           ARRAY_SIZE(nlfamilies));
00053 }
00054 
00055 int nl_str2nlfamily(const char *name)
00056 {
00057         return __str2type(name, nlfamilies, ARRAY_SIZE(nlfamilies));
00058 }
00059 
00060 /** @} */
00061 
00062 /** @} */