forked from sonic-net/sonic-sairedis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MACsecManager.h
143 lines (104 loc) · 4.46 KB
/
MACsecManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#pragma once
#include "MACsecAttr.h"
#include "MACsecFilter.h"
#include "MACsecForwarder.h"
namespace saivs
{
class MACsecManager
{
public:
MACsecManager();
virtual ~MACsecManager();
bool create_macsec_port(
_In_ const MACsecAttr &attr);
bool create_macsec_sc(
_In_ const MACsecAttr &attr);
bool create_macsec_sa(
_In_ const MACsecAttr &attr);
bool delete_macsec_port(
_In_ const MACsecAttr &attr);
bool delete_macsec_sc(
_In_ const MACsecAttr &attr);
bool delete_macsec_sa(
_In_ const MACsecAttr &attr);
bool enable_macsec_filter(
_In_ const std::string &macsecInterface,
_In_ bool enable);
bool get_macsec_sa_pn(
_In_ const MACsecAttr &attr,
_Out_ sai_uint64_t &pn) const;
private:
bool create_macsec_egress_sc(
_In_ const MACsecAttr &attr);
bool create_macsec_ingress_sc(
_In_ const MACsecAttr &attr);
bool create_macsec_egress_sa(
_In_ const MACsecAttr &attr);
bool create_macsec_ingress_sa(
_In_ const MACsecAttr &attr);
bool delete_macsec_egress_sc(
_In_ const MACsecAttr &attr);
bool delete_macsec_ingress_sc(
_In_ const MACsecAttr &attr);
bool delete_macsec_egress_sa(
_In_ const MACsecAttr &attr);
bool delete_macsec_ingress_sa(
_In_ const MACsecAttr &attr);
bool add_macsec_filter(
_In_ const std::string &macsecInterface);
bool add_macsec_forwarder(
_In_ const std::string &macsecInterface);
bool delete_macsec_forwarder(
_In_ const std::string &macsecInterface);
bool add_macsec_manager(
_In_ const std::string &macsecInterface,
_In_ std::shared_ptr<HostInterfaceInfo> info);
bool delete_macsec_manager(
_In_ const std::string &macsecInterface);
bool get_macsec_device_info(
_In_ const std::string &macsecDevice,
_Out_ std::string &info) const;
bool is_macsec_device_existing(
_In_ const std::string &macsecDevice) const;
bool get_macsec_sc_info(
_In_ const std::string &macsecDevice,
_In_ sai_int32_t direction,
_In_ const std::string &sci,
_Out_ std::string &info) const;
bool is_macsec_sc_existing(
_In_ const std::string &macsecDevice,
_In_ sai_int32_t direction,
_In_ const std::string &sci) const;
bool get_macsec_sa_info(
_In_ const std::string &macsecDevice,
_In_ sai_int32_t direction,
_In_ const std::string &sci,
_In_ macsec_an_t an,
_Out_ std::string &info) const;
bool is_macsec_sa_existing(
_In_ const std::string &macsecDevice,
_In_ sai_int32_t direction,
_In_ const std::string &sci,
_In_ macsec_an_t an) const;
size_t get_macsec_sa_count(
_In_ const std::string &macsecDevice,
_In_ sai_int32_t direction,
_In_ const std::string &sci) const;
void cleanup_macsec_device() const;
std::string shellquote(
_In_ const std::string &str) const;
bool exec(
_In_ const std::string &command,
_Out_ std::string &output) const;
bool exec(
_In_ const std::string &command) const;
struct MACsecTrafficManager
{
std::shared_ptr<HostInterfaceInfo> m_info;
std::shared_ptr<MACsecFilter> m_ingressFilter;
std::shared_ptr<MACsecFilter> m_egressFilter;
std::shared_ptr<MACsecForwarder> m_forwarder;
};
std::map<std::string, MACsecTrafficManager> m_macsecTrafficManagers;
};
}