Implement set-field for IPv6 ND fields (nd_target, nd_sll, and nd_tll).
[cascardo/ovs.git] / lib / ofpbuf.h
index ea03c9d..4e7038d 100644 (file)
@@ -76,7 +76,7 @@ struct ofpbuf {
                                    or UINT16_MAX. */
     uint16_t l4_ofs;            /* Transport-level header offset from 'frame',
                                    or UINT16_MAX. */
-    struct list list_node;      /* Private list element for use by owner. */
+    struct ovs_list list_node;  /* Private list element for use by owner. */
 };
 
 static inline void * ofpbuf_data(const struct ofpbuf *);
@@ -104,6 +104,7 @@ static inline const void *ofpbuf_get_tcp_payload(const struct ofpbuf *);
 static inline const void *ofpbuf_get_udp_payload(const struct ofpbuf *);
 static inline const void *ofpbuf_get_sctp_payload(const struct ofpbuf *);
 static inline const void *ofpbuf_get_icmp_payload(const struct ofpbuf *);
+static inline const void *ofpbuf_get_nd_payload(const struct ofpbuf *);
 
 void ofpbuf_use(struct ofpbuf *, void *, size_t);
 void ofpbuf_use_stack(struct ofpbuf *, void *, size_t);
@@ -160,8 +161,8 @@ static inline void *ofpbuf_try_pull(struct ofpbuf *, size_t);
 void *ofpbuf_steal_data(struct ofpbuf *);
 
 char *ofpbuf_to_string(const struct ofpbuf *, size_t maxbytes);
-static inline struct ofpbuf *ofpbuf_from_list(const struct list *);
-void ofpbuf_list_delete(struct list *);
+static inline struct ofpbuf *ofpbuf_from_list(const struct ovs_list *);
+void ofpbuf_list_delete(struct ovs_list *);
 static inline bool ofpbuf_equal(const struct ofpbuf *, const struct ofpbuf *);
 
 \f
@@ -263,7 +264,7 @@ static inline void *ofpbuf_try_pull(struct ofpbuf *b, size_t size)
         ? ofpbuf_pull(b, size) : NULL;
 }
 
-static inline struct ofpbuf *ofpbuf_from_list(const struct list *list)
+static inline struct ofpbuf *ofpbuf_from_list(const struct ovs_list *list)
 {
     return CONTAINER_OF(list, struct ofpbuf, list_node);
 }
@@ -374,6 +375,12 @@ static inline const void *ofpbuf_get_icmp_payload(const struct ofpbuf *b)
         ? (const char *)ofpbuf_l4(b) + ICMP_HEADER_LEN : NULL;
 }
 
+static inline const void *ofpbuf_get_nd_payload(const struct ofpbuf *b)
+{
+    return OVS_LIKELY(ofpbuf_l4_size(b) >= ND_MSG_LEN)
+        ? (const char *)ofpbuf_l4(b) + ND_MSG_LEN : NULL;
+}
+
 #ifdef DPDK_NETDEV
 BUILD_ASSERT_DECL(offsetof(struct ofpbuf, mbuf) == 0);