master
h 29 lines 894 Bytes
Raw
1 // Copyright (C) Microsoft Corporation. All rights reserved.
2 #pragma once
3
4 #include <optional>
5 #include "address.h"
6 #include "Protocol.h"
7
8 /*
9 Currently Rule only supports family, table, priority, input or output interface, source IP and protocol (tcp/udp).
10 It can be extended destination IP and source/destination port.
11 */
12 struct Rule
13 {
14 int family = AF_INET;
15 int routingTable = -1;
16 int priority = -1;
17 std::string iif;
18 std::string oif;
19 std::optional<Protocol> protocol;
20 std::optional<Address> sourceAddress;
21
22 Rule(int family, int routingTable, int priority);
23
24 Rule(int family, int routingTable, int priority, std::optional<Protocol> protocol);
25
26 Rule(int family, int routingTable, int priority, const std::string& oif, std::optional<Protocol> protocol);
27 };
28
29 std::ostream& operator<<(std::ostream& out, const Rule& rule);