File: natfork.h

package info (click to toggle)
natlog 1.01.0-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 956 kB
  • ctags: 343
  • sloc: cpp: 1,737; makefile: 140; sh: 123
file content (53 lines) | stat: -rw-r--r-- 952 bytes parent folder | download
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
46
47
48
49
50
51
52
53
#ifndef INCLUDED_NATFORK_
#define INCLUDED_NATFORK_

#include <ostream>
#include <memory>

#include <bobcat/fork>
#include <bobcat/multistreambuf>

namespace FBB
{
    class SyslogStream;
}

class Options;

class NatFork: public FBB::Fork
{
    enum Mode
    {
        CONNTRACK,
        PCAP
    };

    Options &d_options;

    std::unique_ptr<FBB::SyslogStream> d_syslog;

    FBB::MultiStreambuf d_multiStreambuf;
    std::ostream d_stdMsg;

    Mode d_mode;

    public:
        NatFork();

        void run();

    private:
        void setupStdMsg();
        void checkSyslogParam(char const *label, std::string const &actual, 
                                                 std::string const &err);
        void setupDaemonMsg();
        void setupNonDaemonMsg();

        void handleChildStatus();
        void conntrackMode();

        virtual void parentProcess() override;
        virtual void childProcess() override;
};
        
#endif