LCOV - code coverage report
Current view: top level - plugins/vrrp - vrrp_packet.h (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 0 2 0.0 %
Date: 2023-10-26 01:39:38 Functions: 0 1 0.0 %

          Line data    Source code
       1             : 
       2             : /*
       3             :  * vrrp_packet.h - vrrp protocol/packet definitions
       4             :  *
       5             :  * Copyright 2019-2020 Rubicon Communications, LLC (Netgate)
       6             :  *
       7             :  * SPDX-License-Identifier: Apache-2.0
       8             :  *
       9             :  */
      10             : #ifndef __included_vrrp_packet_h__
      11             : #define __included_vrrp_packet_h__
      12             : 
      13             : #include <vnet/vnet.h>
      14             : 
      15             : typedef CLIB_PACKED (struct
      16             :                      {
      17             :                      /* 4 bits for version (always 2 or 3), 4 bits for type (always 1) */
      18             :                      u8 vrrp_version_and_type;
      19             :                      /* VR ID */
      20             :                      u8 vr_id;
      21             :                      /* priority of sender on this VR. value of 0 means a master is abdicating */
      22             :                      u8 priority;
      23             :                      /* count of addresses being backed up by the VR */
      24             :                      u8 n_addrs;
      25             :                      /* max advertisement interval - first 4 bits are reserved and must be 0 */
      26             :                      u16 rsvd_and_max_adv_int;
      27             :                      /* checksum */
      28             :                      u16 checksum;
      29             :                      }) vrrp_header_t;
      30             : 
      31             : typedef CLIB_PACKED (struct
      32             :                      {
      33             :                      ip4_header_t ip4; vrrp_header_t vrrp;
      34             :                      }) ip4_and_vrrp_header_t;
      35             : 
      36             : typedef CLIB_PACKED (struct
      37             :                      {
      38             :                      ip6_header_t ip6; vrrp_header_t vrrp;
      39             :                      }) ip6_and_vrrp_header_t;
      40             : 
      41             : /* the high 4 bits of the advertisement interval are "reserved" and
      42             :  * should be ignored on reception. swap byte order and mask out those bits.
      43             :  */
      44             : always_inline u16
      45           0 : vrrp_adv_int_from_packet (vrrp_header_t * pkt)
      46             : {
      47           0 :   return clib_net_to_host_u16 (pkt->rsvd_and_max_adv_int) & ((u16) 0x0fff);
      48             : }
      49             : 
      50             : /* Fields from VRRP advertisement packets needed by main thread */
      51             : typedef struct vrrp_input_process_args
      52             : {
      53             :   u32 vr_index;
      54             :   ip46_address_t src_addr;
      55             :   u8 priority;
      56             :   u8 max_adv_int;
      57             : } vrrp_input_process_args_t;
      58             : 
      59             : #endif /* __included_vrrp_packet_h__ */
      60             : 
      61             : /*
      62             :  * fd.io coding-style-patch-verification: ON
      63             :  *
      64             :  * Local Variables:
      65             :  * eval: (c-set-style "gnu")
      66             :  * End:
      67             :  */

Generated by: LCOV version 1.14