LCOV - code coverage report
Current view: top level - network/netdev - macsec.h (source / functions) Hit Total Coverage
Test: main_coverage.info Lines: 0 1 0.0 %
Date: 2019-08-22 15:41:25 Functions: 0 1 0.0 %

          Line data    Source code
       1             : /* SPDX-License-Identifier: LGPL-2.1+ */
       2             : #pragma once
       3             : 
       4             : #include <netinet/in.h>
       5             : #include <linux/if_macsec.h>
       6             : 
       7             : #include "in-addr-util.h"
       8             : #include "netdev.h"
       9             : #include "networkd-util.h"
      10             : #include "sparse-endian.h"
      11             : 
      12             : /* See the definition of MACSEC_NUM_AN in kernel's drivers/net/macsec.c */
      13             : #define MACSEC_MAX_ASSOCIATION_NUMBER 4
      14             : 
      15             : typedef struct MACsec MACsec;
      16             : 
      17             : typedef union MACsecSCI {
      18             :         uint64_t as_uint64;
      19             : 
      20             :         struct {
      21             :                 struct ether_addr mac;
      22             :                 be16_t port;
      23             :         } _packed_;
      24             : } MACsecSCI;
      25             : 
      26             : assert_cc(sizeof(MACsecSCI) == sizeof(uint64_t));
      27             : 
      28             : typedef struct SecurityAssociation {
      29             :         uint8_t association_number;
      30             :         uint32_t packet_number;
      31             :         uint8_t key_id[MACSEC_KEYID_LEN];
      32             :         uint8_t *key;
      33             :         uint32_t key_len;
      34             :         char *key_file;
      35             :         int activate;
      36             :         int use_for_encoding;
      37             : } SecurityAssociation;
      38             : 
      39             : typedef struct TransmitAssociation {
      40             :         MACsec *macsec;
      41             :         NetworkConfigSection *section;
      42             : 
      43             :         SecurityAssociation sa;
      44             : } TransmitAssociation;
      45             : 
      46             : typedef struct ReceiveAssociation {
      47             :         MACsec *macsec;
      48             :         NetworkConfigSection *section;
      49             : 
      50             :         MACsecSCI sci;
      51             :         SecurityAssociation sa;
      52             : } ReceiveAssociation;
      53             : 
      54             : typedef struct ReceiveChannel {
      55             :         MACsec *macsec;
      56             :         NetworkConfigSection *section;
      57             : 
      58             :         MACsecSCI sci;
      59             :         ReceiveAssociation *rxsa[MACSEC_MAX_ASSOCIATION_NUMBER];
      60             :         unsigned n_rxsa;
      61             : } ReceiveChannel;
      62             : 
      63             : struct MACsec {
      64             :         NetDev meta;
      65             : 
      66             :         uint16_t port;
      67             :         int encrypt;
      68             :         uint8_t encoding_an;
      69             : 
      70             :         OrderedHashmap *receive_channels;
      71             :         OrderedHashmap *receive_channels_by_section;
      72             :         OrderedHashmap *transmit_associations_by_section;
      73             :         OrderedHashmap *receive_associations_by_section;
      74             : };
      75             : 
      76           0 : DEFINE_NETDEV_CAST(MACSEC, MACsec);
      77             : extern const NetDevVTable macsec_vtable;
      78             : 
      79             : CONFIG_PARSER_PROTOTYPE(config_parse_macsec_port);
      80             : CONFIG_PARSER_PROTOTYPE(config_parse_macsec_hw_address);
      81             : CONFIG_PARSER_PROTOTYPE(config_parse_macsec_packet_number);
      82             : CONFIG_PARSER_PROTOTYPE(config_parse_macsec_key_id);
      83             : CONFIG_PARSER_PROTOTYPE(config_parse_macsec_key);
      84             : CONFIG_PARSER_PROTOTYPE(config_parse_macsec_key_file);
      85             : CONFIG_PARSER_PROTOTYPE(config_parse_macsec_sa_activate);
      86             : CONFIG_PARSER_PROTOTYPE(config_parse_macsec_use_for_encoding);

Generated by: LCOV version 1.14