aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/www/www.h
blob: ee1f62944757f7d6c32bc19e788e2005f09b58f2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#pragma once

#include <library/cpp/messagebus/ybus.h>
#include <library/cpp/messagebus/oldmodule/module.h>
 
#include <util/generic/ptr.h> 
#include <util/generic/string.h>
#include <library/cpp/cgiparam/cgiparam.h>

namespace NBus {
    class TBusWww: public TAtomicRefCount<TBusWww> {
    public:
        struct TLink {
            TString Title;
            TString Href;
        };

        struct TOptionalParams {
            TVector<TLink> ParentLinks;
        };

        TBusWww();
        ~TBusWww();

        void RegisterClientSession(TBusClientSessionPtr);
        void RegisterServerSession(TBusServerSessionPtr);
        void RegisterQueue(TBusMessageQueuePtr);
        void RegisterModule(TBusModule*);

        void ServeHttp(IOutputStream& httpOutputStream, const TCgiParameters& queryArgs, const TOptionalParams& params = TOptionalParams());

        struct TImpl;
        THolder<TImpl> Impl;
    };

    class TBusWwwHttpServer {
    public:
        TBusWwwHttpServer(TIntrusivePtr<TBusWww> www, unsigned port);
        ~TBusWwwHttpServer();

        struct TImpl;
        THolder<TImpl> Impl;
    };

}