Line data Source code
1 : /* 2 : * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. 3 : */ 4 : 5 : #ifndef vnsw_agent_flow_uve_h 6 : #define vnsw_agent_flow_uve_h 7 : 8 : #include <virtual_machine_types.h> 9 : #include <virtual_network_types.h> 10 : #include <vrouter_types.h> 11 : #include <port_bmap_types.h> 12 : 13 : struct L4PortBitmap { 14 : static const uint16_t kPortPerBucket = 256; 15 : static const uint16_t kBucketCount = (0x10000 / kPortPerBucket); 16 : static const uint16_t kBitsPerEntry = (sizeof(uint32_t) * 8); 17 : static const uint16_t kBmapCount = (kBucketCount / kBitsPerEntry); 18 : struct PortBitmap { 19 103740 : PortBitmap() : counts_(), bitmap_(), bitmap_old_() {} 20 380 : ~PortBitmap() {} 21 : 22 : uint32_t counts_[kBucketCount]; 23 : uint32_t bitmap_[kBmapCount]; 24 : uint32_t bitmap_old_[kBmapCount]; 25 : 26 : void AddPort(uint16_t port); 27 : bool Sync(std::vector<uint32_t> &bmap); 28 : void Encode(std::vector<uint32_t> &bmap); 29 : void Reset(); 30 : }; 31 : 32 : L4PortBitmap(); 33 : ~L4PortBitmap(); 34 : 35 : void AddPort(uint8_t proto, uint16_t sport, uint16_t dport); 36 : void Encode(PortBucketBitmap &bmap); 37 : void Reset(); 38 : 39 : PortBitmap tcp_sport_; 40 : PortBitmap tcp_dport_; 41 : PortBitmap udp_sport_; 42 : PortBitmap udp_dport_; 43 : }; 44 : 45 : #endif // vnsw_agent_flow_uve_h