~karsten.klagges/openwns-allinone/trunk

« back to all changes in this revision

Viewing changes to modules/nl/ip/src/Component.hpp

  • Committer: Karsten Klagges
  • Date: 2014-08-06 13:03:56 UTC
  • Revision ID: kks@comnets.rwth-aachen.de-20140806130356-aiav38l8m4mm7wup
fixed indentation and precompiled header issue

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 *
26
26
 ******************************************************************************/
27
27
 
28
 
#ifndef IP_COMPONENT_HPP
29
 
#define IP_COMPONENT_HPP
30
 
 
31
 
#include <openwns/ip/VirtualDNS.hpp>
 
28
#pragma once
32
29
#include <openwns/ip/container/DataLink.hpp>
33
30
 
34
31
#include <openwns/service/nl/Service.hpp>
41
38
 
42
39
namespace ip {
43
40
 
44
 
        class UpperConvergence;
45
 
        class LowerConvergence;
46
 
 
47
 
        namespace container {
48
 
                class NeighbourCache;
49
 
        }
50
 
 
51
 
    namespace trace {
52
 
        class TraceCollector;
53
 
    }
54
 
 
55
 
    /**
56
 
         * @brief IPv4 Component realization.
57
 
         *
58
 
         * \pyco{ip.Component.IPv4Component}
59
 
         */
60
 
        class Component:
61
 
                virtual public wns::ldk::Layer,
62
 
                public wns::node::component::Component,
63
 
                public wns::service::nl::DNSService
64
 
        {
65
 
                typedef wns::service::nl::Address Address;
66
 
                typedef wns::service::dll::UnicastDataTransmission DLLDataTransmission;
67
 
        public:
68
 
                /**
69
 
                 * @brief Components take a parent node and a pyconfig::View for
70
 
                 * initialization
71
 
                 * @param[in] _node The parent node.
72
 
                 * @param[in] _pyco Configuration for this component.
73
 
                 */
74
 
                Component(
75
 
                        wns::node::Interface* _node,
76
 
                        const wns::pyconfig::View& _pyco);
77
 
 
78
 
                /**
79
 
                 * @brief Component's destructor.
80
 
                 */
81
 
                virtual ~Component();
82
 
 
83
 
                /**
84
 
                 * @brief DNS lookup
85
 
                 */
86
 
                virtual wns::service::nl::Address
87
 
                lookup(wns::service::nl::FQDN name);
88
 
 
89
 
                /**
90
 
                 * @brief Find partner components within your node as given by
91
 
                 * the configuration.
92
 
                 */
93
 
                virtual void
94
 
                onNodeCreated();
95
 
 
96
 
                /**
97
 
                 * @brief Find peer components in other nodes.
98
 
                 */
99
 
                virtual void
100
 
                onWorldCreated();
101
 
 
102
 
                virtual void
103
 
                onShutdown();
104
 
 
105
 
        private:
106
 
                /**
107
 
                 * @brief add services
108
 
                 */
109
 
                virtual void
110
 
                doStartup();
111
 
 
112
 
                void
113
 
                leaseAddresses();
114
 
 
115
 
                void
116
 
                setupARP();
117
 
 
118
 
                void
119
 
                setupDNS();
120
 
 
121
 
                void
122
 
                setupForwarding();
123
 
 
124
 
                void
125
 
                setupRoutingTable();
126
 
 
127
 
                void
128
 
                setupLowerConvergence();
129
 
 
130
 
                trace::TraceCollector*
131
 
                getTraceCollector();
132
 
 
133
 
                /**
134
 
                 * @brief The logger for this component.
135
 
                 */
136
 
                wns::logger::Logger log;
137
 
 
138
 
                /**
139
 
                 * @brief The Functional Unit Network that implemets IP.
140
 
                 */
141
 
                wns::ldk::fun::Main* fun;
142
 
 
143
 
                wns::service::nl::Address sourceAddress;
144
 
 
145
 
                ip::container::DataLinkContainer dlls;
146
 
 
147
 
                wns::service::nl::FQDN domainName;
148
 
 
149
 
                VirtualDNS* dns;
150
 
 
151
 
                /**
152
 
                 * @brief UpperConvergence for this component, it implements the
153
 
                 * Data transmission service of this component. Packets
154
 
                 * are given to the component's routing functionality.
155
 
                 */
156
 
                UpperConvergence* upperConvergence;
157
 
 
158
 
                /**
159
 
                 * @brief Lower Convergence FU to adapt to the DLL service.
160
 
                 */
161
 
                LowerConvergence* lowerConvergence;
162
 
 
163
 
                /** @brief store the created resolvers for proper deletion */
164
 
                std::list<resolver::ResolverInterface*> resolvers;
165
 
 
166
 
        std::string tunExitName_;
167
 
 
168
 
        std::string dnsZone_;
169
 
        
170
 
        std::string forwdCommandName_;
171
 
 
172
 
        std::string routngCommandName_;
173
 
 
174
 
        std::string lowerConvergenceCommandName_;
175
 
    };
176
 
 
177
 
} // ip
178
 
#endif //_IP_COMPONENT_HPP
 
41
class UpperConvergence;
 
42
class LowerConvergence;
 
43
class VirtualDNS;
 
44
 
 
45
namespace container {
 
46
class NeighbourCache;
 
47
}
 
48
 
 
49
namespace trace {
 
50
class TraceCollector;
 
51
}
 
52
 
 
53
/**
 
54
 * @brief IPv4 Component realization.
 
55
 *
 
56
 * \pyco{ip.Component.IPv4Component}
 
57
 */
 
58
class Component:
 
59
        virtual public wns::ldk::Layer,
 
60
        public wns::node::component::Component,
 
61
        public wns::service::nl::DNSService
 
62
{
 
63
    typedef wns::service::nl::Address Address;
 
64
    typedef wns::service::dll::UnicastDataTransmission DLLDataTransmission;
 
65
public:
 
66
    /**
 
67
     * @brief Components take a parent node and a pyconfig::View for
 
68
     * initialization
 
69
     * @param[in] _node The parent node.
 
70
     * @param[in] _pyco Configuration for this component.
 
71
     */
 
72
    Component(
 
73
        wns::node::Interface* _node,
 
74
        const wns::pyconfig::View& _pyco);
 
75
 
 
76
    /**
 
77
     * @brief Component's destructor.
 
78
     */
 
79
    virtual ~Component();
 
80
 
 
81
    /**
 
82
     * @brief DNS lookup
 
83
     */
 
84
    virtual wns::service::nl::Address
 
85
    lookup(wns::service::nl::FQDN name);
 
86
 
 
87
    /**
 
88
     * @brief Find partner components within your node as given by
 
89
     * the configuration.
 
90
     */
 
91
    virtual void
 
92
    onNodeCreated();
 
93
 
 
94
    /**
 
95
     * @brief Find peer components in other nodes.
 
96
     */
 
97
    virtual void
 
98
    onWorldCreated();
 
99
 
 
100
    virtual void
 
101
    onShutdown();
 
102
 
 
103
private:
 
104
    /**
 
105
     * @brief add services
 
106
     */
 
107
    virtual void
 
108
    doStartup();
 
109
 
 
110
    void
 
111
    leaseAddresses();
 
112
 
 
113
    void
 
114
    setupARP();
 
115
 
 
116
    void
 
117
    setupDNS();
 
118
 
 
119
    void
 
120
    setupForwarding();
 
121
 
 
122
    void
 
123
    setupRoutingTable();
 
124
 
 
125
    void
 
126
    setupLowerConvergence();
 
127
 
 
128
    trace::TraceCollector*
 
129
    getTraceCollector();
 
130
 
 
131
    /**
 
132
     * @brief The logger for this component.
 
133
     */
 
134
    wns::logger::Logger log;
 
135
 
 
136
    /**
 
137
     * @brief The Functional Unit Network that implemets IP.
 
138
     */
 
139
    wns::ldk::fun::Main* fun;
 
140
 
 
141
    wns::service::nl::Address sourceAddress;
 
142
 
 
143
    ip::container::DataLinkContainer dlls;
 
144
 
 
145
    wns::service::nl::FQDN domainName;
 
146
 
 
147
    VirtualDNS* dns;
 
148
 
 
149
    /**
 
150
     * @brief UpperConvergence for this component, it implements the
 
151
     * Data transmission service of this component. Packets
 
152
     * are given to the component's routing functionality.
 
153
     */
 
154
    UpperConvergence* upperConvergence;
 
155
 
 
156
    /**
 
157
     * @brief Lower Convergence FU to adapt to the DLL service.
 
158
     */
 
159
    LowerConvergence* lowerConvergence;
 
160
 
 
161
    /** @brief store the created resolvers for proper deletion */
 
162
    std::list<resolver::ResolverInterface*> resolvers;
 
163
 
 
164
    std::string tunExitName_;
 
165
 
 
166
    std::string dnsZone_;
 
167
 
 
168
    std::string forwdCommandName_;
 
169
 
 
170
    std::string routngCommandName_;
 
171
 
 
172
    std::string lowerConvergenceCommandName_;
 
173
};
 
174
 
 
175
}
179
176
 
180
177