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