Apache Mesos
action.hpp
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #ifndef __LINUX_ROUTING_FILTER_ACTION_HPP__
18 #define __LINUX_ROUTING_FILTER_ACTION_HPP__
19 
20 #include <set>
21 #include <string>
22 
23 namespace routing {
24 namespace action {
25 
26 // Base class for filter actions.
27 class Action
28 {
29 public:
30  virtual ~Action() {}
31 
32 protected:
33  // Hide the default constructor.
34  Action() {}
35 };
36 
37 
38 // Represents an action that redirects a packet to a given link.
39 // Currently, kernel only supports redirecting to the egress of a
40 // given link.
41 struct Redirect : public Action
42 {
43  explicit Redirect(const std::string& _link)
44  : link(_link) {}
45 
46  // The link to which the packet will be redirected.
47  std::string link;
48 };
49 
50 
51 // Represents an action that mirrors a packet to a set of links.
52 // Currently, kernel only supports mirroring to the egress of each
53 // link.
54 struct Mirror : public Action
55 {
56  explicit Mirror(const std::set<std::string>& _links)
57  : links(_links) {}
58 
59  // The set of links to which the packet will be mirrored.
60  std::set<std::string> links;
61 };
62 
63 
64 // Represents an action that stops the packet from being sent to the
65 // next filter.
66 struct Terminal : public Action {};
67 
68 } // namespace action {
69 } // namespace routing {
70 
71 #endif // __LINUX_ROUTING_FILTER_ACTION_HPP__
virtual ~Action()
Definition: action.hpp:30
Action()
Definition: action.hpp:34
std::set< std::string > links
Definition: action.hpp:60
Definition: action.hpp:66
Definition: action.hpp:41
Mirror(const std::set< std::string > &_links)
Definition: action.hpp:56
Redirect(const std::string &_link)
Definition: action.hpp:43
Definition: action.hpp:27
Definition: action.hpp:54
std::string link
Definition: action.hpp:47