X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=ofproto%2Fofproto-dpif-ipfix.c;h=08a3fca4c1363dc520a93adb98456f8c1f99ba80;hb=214694add2d8f6b936a1b664fd546e4f1c4967e2;hp=a5298847c6d1213d2d75d693b2507b17ee20c3da;hpb=f51e8ccbbbc8d55a93eb1c76869e647e08d07d6f;p=sliver-openvswitch.git diff --git a/ofproto/ofproto-dpif-ipfix.c b/ofproto/ofproto-dpif-ipfix.c index a5298847c..08a3fca4c 100644 --- a/ofproto/ofproto-dpif-ipfix.c +++ b/ofproto/ofproto-dpif-ipfix.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013 Nicira, Inc. + * Copyright (c) 2012, 2013, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -699,7 +699,6 @@ dpif_ipfix_unref(struct dpif_ipfix *di) OVS_EXCLUDED(mutex) dpif_ipfix_clear(di); dpif_ipfix_bridge_exporter_destroy(&di->bridge_exporter); hmap_destroy(&di->flow_exporter_map); - ovs_refcount_destroy(&di->ref_cnt); free(di); ovs_mutex_unlock(&mutex); } @@ -725,11 +724,11 @@ ipfix_send_msg(const struct collectors *collectors, struct ofpbuf *msg) struct ipfix_header *hdr; /* Adjust the length in the header. */ - hdr = msg->data; - hdr->length = htons(msg->size); + hdr = ofpbuf_data(msg); + hdr->length = htons(ofpbuf_size(msg)); - collectors_send(collectors, msg->data, msg->size); - msg->size = 0; + collectors_send(collectors, ofpbuf_data(msg), ofpbuf_size(msg)); + ofpbuf_set_size(msg, 0); } static uint16_t @@ -853,7 +852,7 @@ ipfix_send_template_msg(struct dpif_ipfix_exporter *exporter, ipfix_init_header(export_time_sec, exporter->seq_number, obs_domain_id, &msg); - set_hdr_offset = msg.size; + set_hdr_offset = ofpbuf_size(&msg); /* Add a Template Set. */ set_hdr = ofpbuf_put_zeros(&msg, sizeof *set_hdr); @@ -868,20 +867,20 @@ ipfix_send_template_msg(struct dpif_ipfix_exporter *exporter, l4 != IPFIX_PROTO_L4_UNKNOWN) { continue; } - tmpl_hdr_offset = msg.size; + tmpl_hdr_offset = ofpbuf_size(&msg); tmpl_hdr = ofpbuf_put_zeros(&msg, sizeof *tmpl_hdr); tmpl_hdr->template_id = htons( ipfix_get_template_id(l2, l3, l4)); field_count = ipfix_define_template_fields(l2, l3, l4, &msg); tmpl_hdr = (struct ipfix_template_record_header*) - ((uint8_t*)msg.data + tmpl_hdr_offset); + ((uint8_t*)ofpbuf_data(&msg) + tmpl_hdr_offset); tmpl_hdr->field_count = htons(field_count); } } } - set_hdr = (struct ipfix_set_header*)((uint8_t*)msg.data + set_hdr_offset); - set_hdr->length = htons(msg.size - set_hdr_offset); + set_hdr = (struct ipfix_set_header*)((uint8_t*)ofpbuf_data(&msg) + set_hdr_offset); + set_hdr->length = htons(ofpbuf_size(&msg) - set_hdr_offset); /* XXX: Add Options Template Sets, at least to define a Flow Keys * Option Template. */ @@ -1085,7 +1084,7 @@ ipfix_cache_entry_init(struct ipfix_flow_cache_entry *entry, ethernet_header_length = (l2 == IPFIX_PROTO_L2_VLAN) ? VLAN_ETH_HEADER_LEN : ETH_HEADER_LEN; - ethernet_total_length = packet->size; + ethernet_total_length = ofpbuf_size(packet); /* Common Ethernet entities. */ { @@ -1155,7 +1154,7 @@ ipfix_cache_entry_init(struct ipfix_flow_cache_entry *entry, data_icmp->icmp_code = ntohs(flow->tp_dst) & 0xff; } - flow_key->flow_key_msg_part_size = msg.size; + flow_key->flow_key_msg_part_size = ofpbuf_size(&msg); { struct timeval now; @@ -1206,7 +1205,7 @@ ipfix_put_data_set(uint32_t export_time_sec, size_t set_hdr_offset; struct ipfix_set_header *set_hdr; - set_hdr_offset = msg->size; + set_hdr_offset = ofpbuf_size(msg); /* Put a Data Set. */ set_hdr = ofpbuf_put_zeros(msg, sizeof *set_hdr); @@ -1260,8 +1259,8 @@ ipfix_put_data_set(uint32_t export_time_sec, entry->maximum_ip_total_length); } - set_hdr = (struct ipfix_set_header*)((uint8_t*)msg->data + set_hdr_offset); - set_hdr->length = htons(msg->size - set_hdr_offset); + set_hdr = (struct ipfix_set_header*)((uint8_t*)ofpbuf_data(msg) + set_hdr_offset); + set_hdr->length = htons(ofpbuf_size(msg) - set_hdr_offset); } /* Send an IPFIX message with a single data record. */