+/*
+ * Function: lacp_uint16_set
+ * Purpose:
+ * Set a field in a structure that's at least 16 bits to the given
+ * value, putting it into network byte order
+ */
+static __inline__ void
+lacp_uint16_set(uint8_t * field, uint16_t value)
+{
+ uint16_t tmp_value = htons(value);
+ memcpy((void *)field, (void *)&tmp_value, sizeof(uint16_t));
+ return;
+}
+
+/*
+ * Function: lacp_uint16_get
+ * Purpose:
+ * Get a field in a structure that's at least 16 bits, converting
+ * to host byte order.
+ */
+static __inline__ uint16_t
+lacp_uint16_get(const uint8_t * field)
+{
+ uint16_t tmp_field;
+ memcpy((void *)&tmp_field, (void *)field, sizeof(uint16_t));
+ return (ntohs(tmp_field));
+}
+
+/*
+ * Function: lacp_uint32_set
+ * Purpose:
+ * Set a field in a structure that's at least 32 bits to the given
+ * value, putting it into network byte order
+ */
+static __inline__ void
+lacp_uint32_set(uint8_t * field, uint32_t value)
+{
+ uint32_t tmp_value = htonl(value);
+ memcpy((void *)field, (void *)&tmp_value, sizeof(uint32_t));
+ return;
+}
+
+/*
+ * Function: lacp_uint32_get
+ * Purpose:
+ * Get a field in a structure that's at least 32 bits, converting
+ * to host byte order.
+ */
+static __inline__ uint32_t
+lacp_uint32_get(const uint8_t * field)
+{
+ uint32_t tmp_field;
+ memcpy((void *)&tmp_field, (void *)field, sizeof(uint32_t));
+ return (ntohl(tmp_field));
+}