LCOV - code coverage report
Current view: top level - vnsw/agent/uve - l4_port_bitmap.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 2 2 100.0 %
Date: 2026-11-09 02:10:49 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 {
      20     1788696 :         PortBitmap() : counts_(), bitmap_(), bitmap_old_() {}
      21        6552 :         ~PortBitmap() {}
      22             : 
      23             :         uint32_t counts_[kBucketCount];
      24             :         uint32_t bitmap_[kBmapCount];
      25             :         uint32_t bitmap_old_[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             : 
      40             :     PortBitmap tcp_sport_;
      41             :     PortBitmap tcp_dport_;
      42             :     PortBitmap udp_sport_;
      43             :     PortBitmap udp_dport_;
      44             : };
      45             : 
      46             : #endif // vnsw_agent_flow_uve_h

Generated by: LCOV version 1.14