libnl  1.1.4
family.c
1 /*
2  * lib/family.c Netlink Family
3  *
4  * This 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 version 2.1
7  * of the License.
8  *
9  * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
10  */
11 
12 /**
13  * @defgroup nlfam Netlink Families
14  * @brief
15  *
16  * @{
17  */
18 
19 #include <netlink-local.h>
20 #include <netlink/netlink.h>
21 #include <netlink/utils.h>
22 
23 /**
24  * @name Netlink Family Name Translation
25  * @{
26  */
27 
28 static struct trans_tbl nlfamilies[] = {
29  __ADD(NETLINK_ROUTE,route)
30  __ADD(NETLINK_USERSOCK,usersock)
31  __ADD(NETLINK_FIREWALL,firewall)
32  __ADD(NETLINK_INET_DIAG,inetdiag)
33  __ADD(NETLINK_NFLOG,nflog)
34  __ADD(NETLINK_XFRM,xfrm)
35  __ADD(NETLINK_SELINUX,selinux)
36  __ADD(NETLINK_ISCSI,iscsi)
37  __ADD(NETLINK_AUDIT,audit)
38  __ADD(NETLINK_FIB_LOOKUP,fib_lookup)
39  __ADD(NETLINK_CONNECTOR,connector)
40  __ADD(NETLINK_NETFILTER,netfilter)
41  __ADD(NETLINK_IP6_FW,ip6_fw)
42  __ADD(NETLINK_DNRTMSG,dnrtmsg)
43  __ADD(NETLINK_KOBJECT_UEVENT,kobject_uevent)
44  __ADD(NETLINK_GENERIC,generic)
45  __ADD(NETLINK_SCSITRANSPORT,scsitransport)
46  __ADD(NETLINK_ECRYPTFS,ecryptfs)
47 };
48 
49 char * nl_nlfamily2str(int family, char *buf, size_t size)
50 {
51  return __type2str(family, buf, size, nlfamilies,
52  ARRAY_SIZE(nlfamilies));
53 }
54 
55 int nl_str2nlfamily(const char *name)
56 {
57  return __str2type(name, nlfamilies, ARRAY_SIZE(nlfamilies));
58 }
59 
60 /** @} */
61 
62 /** @} */