MCPcopy Create free account
hub / github.com/apache/trafficserver / Common

Class Common

include/cripts/Bundles/Common.hpp:32–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30namespace cripts::Bundle
31{
32class Common : public cripts::Bundle::Base
33{
34 using super_type = cripts::Bundle::Base;
35 using self_type = Common;
36
37 using RecordsList = std::vector<std::pair<const cripts::Records *, const cripts::Records::ValueType>>;
38
39public:
40 using super_type::Base;
41
42 bool Validate(std::vector<cripts::Bundle::Error> &errors) const override;
43
44 // This is the factory to create an instance of this bundle
45 static self_type &
46 _activate(cripts::Instance &inst)
47 {
48 auto *entry = new self_type();
49
50 inst.AddBundle(entry);
51
52 return *entry;
53 }
54
55 [[nodiscard]] const cripts::string &
56 Name() const override
57 {
58 return _name;
59 }
60
61 self_type &
62 dscp(int val)
63 {
64 NeedCallback(cripts::Callbacks::DO_REMAP);
65 _dscp = val;
66
67 return *this;
68 }
69
70 self_type &via_header(const cripts::string_view &destination, const cripts::string_view &value);
71 self_type &set_config(const cripts::string_view name, const cripts::Records::ValueType &value);
72 self_type &set_config(const std::vector<std::pair<const cripts::string_view, const cripts::Records::ValueType>> &configs);
73
74 void doRemap(cripts::Context *context) override;
75
76private:
77 static const cripts::string _name;
78 int _dscp = 0;
79 std::pair<int, bool> _client_via = {0, false}; // Flag indicates if it's been set at all
80 std::pair<int, bool> _origin_via = {0, false};
81 RecordsList _configs;
82};
83
84} // namespace cripts::Bundle

Callers

nothing calls this directly

Calls 1

AddBundleMethod · 0.80

Tested by

no test coverage detected