summaryrefslogtreecommitdiff
path: root/libndp
diff options
context:
space:
mode:
authorJiri Pirko <jiri@resnulli.us>2013-06-13 16:10:50 +0200
committerJiri Pirko <jiri@resnulli.us>2013-06-13 16:12:09 +0200
commit69d1c977b4770e651db6bc498fdca9c3061cef8c (patch)
tree6e6fe8ddb46b9a0e76e7aedef6e1a460ff7c69d5 /libndp
parent39e1f53dd4efc00b84ff097b15558747c92593f2 (diff)
downloadlibndp-69d1c977b4770e651db6bc498fdca9c3061cef8c.tar.gz
add flag getters for prefix option
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Diffstat (limited to 'libndp')
-rw-r--r--libndp/libndp.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/libndp/libndp.c b/libndp/libndp.c
index 20efe90..0600e59 100644
--- a/libndp/libndp.c
+++ b/libndp/libndp.c
@@ -1266,6 +1266,66 @@ uint32_t ndp_msg_opt_prefix_preferred_time(struct ndp_msg *msg, int offset)
}
/**
+ * ndp_msg_opt_prefix_flag_on_link:
+ * @msg: message structure
+ * @offset: in-message offset
+ *
+ * Get on-link flag.
+ * User should use this function only inside ndp_msg_opt_for_each_offset()
+ * macro loop.
+ *
+ * Returns: on-link flag.
+ **/
+NDP_EXPORT
+bool ndp_msg_opt_prefix_flag_on_link(struct ndp_msg *msg, int offset)
+{
+ struct nd_opt_prefix_info *pi =
+ ndp_msg_payload_opts_offset(msg, offset);
+
+ return pi->nd_opt_pi_flags_reserved & ND_OPT_PI_FLAG_ONLINK;
+}
+
+/**
+ * ndp_msg_opt_prefix_flag_auto_addr_conf:
+ * @msg: message structure
+ * @offset: in-message offset
+ *
+ * Get autonomous address-configuration flag.
+ * User should use this function only inside ndp_msg_opt_for_each_offset()
+ * macro loop.
+ *
+ * Returns: autonomous address-configuration flag.
+ **/
+NDP_EXPORT
+bool ndp_msg_opt_prefix_flag_auto_addr_conf(struct ndp_msg *msg, int offset)
+{
+ struct nd_opt_prefix_info *pi =
+ ndp_msg_payload_opts_offset(msg, offset);
+
+ return pi->nd_opt_pi_flags_reserved & ND_OPT_PI_FLAG_AUTO;
+}
+
+/**
+ * ndp_msg_opt_prefix_flag_router_addr:
+ * @msg: message structure
+ * @offset: in-message offset
+ *
+ * Get router address flag.
+ * User should use this function only inside ndp_msg_opt_for_each_offset()
+ * macro loop.
+ *
+ * Returns: router address flag.
+ **/
+NDP_EXPORT
+bool ndp_msg_opt_prefix_flag_router_addr(struct ndp_msg *msg, int offset)
+{
+ struct nd_opt_prefix_info *pi =
+ ndp_msg_payload_opts_offset(msg, offset);
+
+ return pi->nd_opt_pi_flags_reserved & ND_OPT_PI_FLAG_RADDR;
+}
+
+/**
* ndp_msg_opt_mtu:
* @msg: message structure
* @offset: in-message offset