#ifndef __DECODE_VLAN_H__
#define __DECODE_VLAN_H__
+/* return vlan id in host byte order */
uint16_t DecodeVLANGetId(const struct Packet_ *, uint8_t layer);
/** Vlan type */
#define GET_VLAN_ID(vlanh) ((uint16_t)(ntohs((vlanh)->vlan_cfi) & 0x0FFF))
#define GET_VLAN_PROTO(vlanh) ((ntohs((vlanh)->protocol)))
+/* return vlan id in host byte order */
#define VLAN_GET_ID1(p) DecodeVLANGetId((p), 0)
#define VLAN_GET_ID2(p) DecodeVLANGetId((p), 1)
switch (p->vlan_idx) {
case 1:
json_object_set_new(js, "vlan",
- json_integer(ntohs(VLAN_GET_ID1(p))));
+ json_integer(VLAN_GET_ID1(p)));
break;
case 2:
js_vlan = json_array();
if (unlikely(js != NULL)) {
json_array_append_new(js_vlan,
- json_integer(ntohs(VLAN_GET_ID1(p))));
+ json_integer(VLAN_GET_ID1(p)));
json_array_append_new(js_vlan,
- json_integer(ntohs(VLAN_GET_ID2(p))));
+ json_integer(VLAN_GET_ID2(p)));
json_object_set_new(js, "vlan", js_vlan);
}
break;