1
#include "source/common/network/application_protocol.h"
2

            
3
#include "envoy/registry/registry.h"
4
#include "envoy/stream_info/filter_state.h"
5

            
6
#include "source/common/common/macros.h"
7

            
8
namespace Envoy {
9
namespace Network {
10

            
11
51615
const std::string& ApplicationProtocols::key() {
12
51615
  CONSTRUCT_ON_FIRST_USE(std::string, "envoy.network.application_protocols");
13
51615
}
14

            
15
class ApplicationProtocolsObjectFactory : public StreamInfo::FilterState::ObjectFactory {
16
public:
17
1672
  std::string name() const override { return ApplicationProtocols::key(); }
18
  std::unique_ptr<StreamInfo::FilterState::Object>
19
1
  createFromBytes(absl::string_view data) const override {
20
1
    const std::vector<std::string> parts = absl::StrSplit(data, ',');
21
1
    return std::make_unique<ApplicationProtocols>(parts);
22
1
  }
23
};
24

            
25
REGISTER_FACTORY(ApplicationProtocolsObjectFactory, StreamInfo::FilterState::ObjectFactory);
26
} // namespace Network
27
} // namespace Envoy