Lines Matching refs:raw_size

116 sd_lldp_neighbor *lldp_neighbor_new(size_t raw_size) {  in lldp_neighbor_new()  argument
119 if (raw_size > SIZE_MAX - ALIGN(sizeof(sd_lldp_neighbor))) in lldp_neighbor_new()
122 n = malloc0(ALIGN(sizeof(sd_lldp_neighbor)) + raw_size); in lldp_neighbor_new()
126 n->raw_size = raw_size; in lldp_neighbor_new()
176 if (n->raw_size < sizeof(struct ether_header)) in lldp_neighbor_parse()
199 left = n->raw_size - sizeof(struct ether_header); in lldp_neighbor_parse()
358 if (a->raw_size != b->raw_size) in lldp_neighbor_equal()
361 return memcmp(LLDP_NEIGHBOR_RAW(a), LLDP_NEIGHBOR_RAW(b), a->raw_size) == 0; in lldp_neighbor_equal()
386 *size = n->raw_size; in sd_lldp_neighbor_get_raw()
644 int sd_lldp_neighbor_from_raw(sd_lldp_neighbor **ret, const void *raw, size_t raw_size) { in sd_lldp_neighbor_from_raw() argument
649 assert_return(raw || raw_size <= 0, -EINVAL); in sd_lldp_neighbor_from_raw()
651 n = lldp_neighbor_new(raw_size); in sd_lldp_neighbor_from_raw()
655 memcpy_safe(LLDP_NEIGHBOR_RAW(n), raw, raw_size); in sd_lldp_neighbor_from_raw()
669 assert(n->raw_size >= sizeof(struct ether_header)); in sd_lldp_neighbor_tlv_rewind()
672 return n->rindex < n->raw_size; in sd_lldp_neighbor_tlv_rewind()
680 if (n->rindex == n->raw_size) /* EOF */ in sd_lldp_neighbor_tlv_next()
683 if (n->rindex + 2 > n->raw_size) /* Truncated message */ in sd_lldp_neighbor_tlv_next()
687 if (n->rindex + 2 + length > n->raw_size) in sd_lldp_neighbor_tlv_next()
691 return n->rindex < n->raw_size; in sd_lldp_neighbor_tlv_next()
698 if (n->rindex == n->raw_size) /* EOF */ in sd_lldp_neighbor_tlv_get_type()
701 if (n->rindex + 2 > n->raw_size) in sd_lldp_neighbor_tlv_get_type()
740 if (n->rindex + 2 + length > n->raw_size) in sd_lldp_neighbor_tlv_get_oui()
772 if (n->rindex + 2 > n->raw_size) in sd_lldp_neighbor_tlv_get_raw()
776 if (n->rindex + 2 + length > n->raw_size) in sd_lldp_neighbor_tlv_get_raw()