rtnl.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * netlink/route/rtnl.h Routing Netlink
  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-2008 Thomas Graf <tgraf@suug.ch>
  10. */
  11. #ifndef NETLINK_RTNL_H_
  12. #define NETLINK_RTNL_H_
  13. #include <netlink/netlink.h>
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. /**
  18. * @name Realms
  19. * @{
  20. */
  21. /**
  22. * Mask specying the size of each realm part
  23. * @ingroup rtnl
  24. */
  25. #define RTNL_REALM_MASK (0xFFFF)
  26. /**
  27. * Extract FROM realm from a realms field
  28. */
  29. #define RTNL_REALM_FROM(realm) ((realm) >> 16)
  30. /**
  31. * Extract TO realm from a realms field
  32. */
  33. #define RTNL_REALM_TO(realm) ((realm) & RTNL_REALM_MASK)
  34. /**
  35. * Build a realms field
  36. */
  37. #define RTNL_MAKE_REALM(from, to) \
  38. ((RTNL_REALM_TO(from) << 16) & RTNL_REALM_TO(to))
  39. /** @} */
  40. /* General */
  41. extern int nl_rtgen_request(struct nl_sock *, int, int, int);
  42. /* Routing Type Translations */
  43. extern char * nl_rtntype2str(int, char *, size_t);
  44. extern int nl_str2rtntype(const char *);
  45. /* Scope Translations */
  46. extern char * rtnl_scope2str(int, char *, size_t);
  47. extern int rtnl_str2scope(const char *);
  48. /* Realms Translations */
  49. extern char * rtnl_realms2str(uint32_t, char *, size_t);
  50. #ifdef __cplusplus
  51. }
  52. #endif
  53. #endif