@@ -68,9 +68,59 @@ class ConnectionHandler {
6868 * after they have been temporarily disabled.
6969 */
7070 virtual void enableListeners () PURE;
71+
72+ /* *
73+ * Used by ConnectionHandler to manage listeners.
74+ */
75+ class ActiveListener {
76+ public:
77+ virtual ~ActiveListener () = default ;
78+
79+ /* *
80+ * @return the tag value as configured.
81+ */
82+ virtual uint64_t listenerTag () PURE;
83+ /* *
84+ * @return the actual Listener object.
85+ */
86+ virtual Listener* listener () PURE;
87+ /* *
88+ * Destroy the actual Listener it wraps.
89+ */
90+ virtual void destroy () PURE;
91+ };
92+
93+ using ActiveListenerPtr = std::unique_ptr<ActiveListener>;
7194};
7295
7396using ConnectionHandlerPtr = std::unique_ptr<ConnectionHandler>;
7497
98+ /* *
99+ * A registered factory interface to create different kinds of
100+ * ActiveUdpListener.
101+ */
102+ class ActiveUdpListenerFactory {
103+ public:
104+ virtual ~ActiveUdpListenerFactory () = default ;
105+
106+ /* *
107+ * Creates an ActiveUdpListener object and a corresponding UdpListener
108+ * according to given config.
109+ * @param parent is the owner of the created ActiveListener objects.
110+ * @param dispatcher is used to create actual UDP listener.
111+ * @param logger might not need to be passed in.
112+ * TODO(danzh): investigate if possible to use statically defined logger in ActiveUdpListener
113+ * implementation instead.
114+ * @param config provides information needed to create ActiveUdpListener and
115+ * UdpListener objects.
116+ * @return the ActiveUdpListener created.
117+ */
118+ virtual ConnectionHandler::ActiveListenerPtr
119+ createActiveUdpListener (ConnectionHandler& parent, Event::Dispatcher& disptacher,
120+ spdlog::logger& logger, Network::ListenerConfig& config) const PURE;
121+ };
122+
123+ using ActiveUdpListenerFactoryPtr = std::unique_ptr<ActiveUdpListenerFactory>;
124+
75125} // namespace Network
76126} // namespace Envoy
0 commit comments