family.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. * @defgroup nlfam Netlink Families
  13. * @brief
  14. *
  15. * @{
  16. */
  17. #include <netlink-local.h>
  18. #include <netlink/netlink.h>
  19. #include <netlink/utils.h>
  20. /**
  21. * @name Netlink Family Name Translation
  22. * @{
  23. */
  24. static struct trans_tbl nlfamilies[] = {
  25. __ADD(NETLINK_ROUTE,route)
  26. __ADD(NETLINK_USERSOCK,usersock)
  27. __ADD(NETLINK_FIREWALL,firewall)
  28. __ADD(NETLINK_INET_DIAG,inetdiag)
  29. __ADD(NETLINK_NFLOG,nflog)
  30. __ADD(NETLINK_XFRM,xfrm)
  31. __ADD(NETLINK_SELINUX,selinux)
  32. __ADD(NETLINK_ISCSI,iscsi)
  33. __ADD(NETLINK_AUDIT,audit)
  34. __ADD(NETLINK_FIB_LOOKUP,fib_lookup)
  35. __ADD(NETLINK_CONNECTOR,connector)
  36. __ADD(NETLINK_NETFILTER,netfilter)
  37. __ADD(NETLINK_IP6_FW,ip6_fw)
  38. __ADD(NETLINK_DNRTMSG,dnrtmsg)
  39. __ADD(NETLINK_KOBJECT_UEVENT,kobject_uevent)
  40. __ADD(NETLINK_GENERIC,generic)
  41. __ADD(NETLINK_SCSITRANSPORT,scsitransport)
  42. __ADD(NETLINK_ECRYPTFS,ecryptfs)
  43. };
  44. char * nl_nlfamily2str(int family, char *buf, size_t size)
  45. {
  46. return __type2str(family, buf, size, nlfamilies,
  47. ARRAY_SIZE(nlfamilies));
  48. }
  49. int nl_str2nlfamily(const char *name)
  50. {
  51. return __str2type(name, nlfamilies, ARRAY_SIZE(nlfamilies));
  52. }
  53. /** @} */
  54. /** @} */