libnl 1.1

include/netlink/route/rtnl.h

00001 /*
00002  * netlink/route/rtnl.h         Routing Netlink
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 #ifndef NETLINK_RTNL_H_
00013 #define NETLINK_RTNL_H_
00014 
00015 #include <netlink/netlink.h>
00016 
00017 #ifdef __cplusplus
00018 extern "C" {
00019 #endif
00020 
00021 /**
00022  * @name Realms
00023  * @{
00024  */
00025 
00026 typedef uint32_t        realm_t;
00027 
00028 /**
00029  * Mask specying the size of each realm part
00030  * @ingroup rtnl
00031  */
00032 #define RTNL_REALM_MASK (0xFFFF)
00033 
00034 /**
00035  * Extract FROM realm from a realms field
00036  */
00037 #define RTNL_REALM_FROM(realm) ((realm) >> 16)
00038 
00039 /**
00040  * Extract TO realm from a realms field
00041  */
00042 #define RTNL_REALM_TO(realm) ((realm) & RTNL_REALM_MASK)
00043 
00044 /**
00045  * Build a realms field
00046  */
00047 #define RTNL_MAKE_REALM(from, to) \
00048         ((RTNL_REALM_TO(from) << 16) & RTNL_REALM_TO(to))
00049 
00050 /** @} */
00051 
00052 
00053 /* General */
00054 extern int              nl_rtgen_request(struct nl_handle *, int, int, int);
00055 
00056 /* Routing Type Translations */
00057 extern char *           nl_rtntype2str(int, char *, size_t);
00058 extern int              nl_str2rtntype(const char *);
00059 
00060 /* Scope Translations */
00061 extern char *           rtnl_scope2str(int, char *, size_t);
00062 extern int              rtnl_str2scope(const char *);
00063 
00064 /* Realms Translations */
00065 extern char *           rtnl_realms2str(uint32_t, char *, size_t);
00066 
00067 #ifdef __cplusplus
00068 }
00069 #endif
00070 
00071 #endif