30 #define DIMOF(a) (sizeof(a)/sizeof(a[0]))
74 #define NETTLV_INITPKTOFFSET 14
75 #define NETTLV_HDRSZ 2
96 const unsigned char * tlvp = tlv_vp;
100 return ((((gsize)(byte0&0x1)) << 8) & (gsize)0x1FF)
121 #ifdef PEDANTIC_LLDP_NERD
124 if (NULL == tlv_vp || ((
const guint8*)tlv_vp+
NETTLV_HDRSZ) > (
const guint8*)pktend) {
125 g_warning(
"LLDP Invalid because packet is too short\n");
135 if (tlv_vp >= pktend) {
139 #ifdef PEDANTIC_LLDP_NERD
144 if (next > (
const guint8*)pktend) {
145 g_warning(
"LLDP Invalid because TLV entry extends past end\n");
152 g_warning(
"LLDP Invalid because END item isn't at end of packet\n");
156 if (j <
DIMOF(reqtypes) && ttype != reqtypes[j]) {
157 g_warning(
"LLDP Invalid because required TLV type [%d] isn't present in right position (%d)\n"
163 #ifdef PEDANTIC_LLDP_NERD
165 g_warning(
"LLDP Invalid because final type wasn't LLDP_TLV_END (it was %d)\n"
191 const guint8 * nexttlv;
194 || ((
const guint8*)tlv_vp+
NETTLV_HDRSZ) > (
const guint8*)pktend
203 return nextend > pktend ? NULL : nexttlv;
212 while (NULL != tlv_vp && ((
const guint8*)tlv_vp+
NETTLV_HDRSZ) <= (
const guint8*)pktend) {
226 gconstpointer pktend)
228 const void * tlventry;
231 if (tlventry == NULL) {
243 gconstpointer pktend)
245 const void * tlventry;
248 if (tlventry == NULL) {