EMANE  1.0.1
transportbuilder.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-2014,2016 - Adjacent Link LLC, Bridgewater,
3  * New Jersey
4  * Copyright (c) 2008-2011 - DRS CenGen, LLC, Columbia, Maryland
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  * * Neither the name of DRS CenGen, LLC nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 #ifndef EMANETRANSPORTBUILDER_HEADER_
36 #define EMANETRANSPORTBUILDER_HEADER_
37 
38 #include "emane/types.h"
41 #include "emane/transport.h"
42 #include "emane/nemlayer.h"
44 
45 #include <string>
46 #include <list>
47 #include <memory>
48 
49 namespace EMANE
50 {
51  namespace Application
52  {
53  using TransportAdapters = std::list<std::unique_ptr<TransportAdapter>>;
54 
62  {
63  public:
68 
73 
90  std::unique_ptr<TransportManager>
91  buildTransportManager(const uuid_t & uuid,
92  TransportAdapters & adapters,
93  const ConfigurationUpdateRequest& request) const;
94 
95 
112  std::unique_ptr<TransportAdapter>
113  buildTransportAdapter(std::unique_ptr<NEMLayer> & pTransport,
114  const ConfigurationUpdateRequest & request) const;
115 
133  std::unique_ptr<NEMLayer>
135  const std::string & sLibraryFile,
136  const ConfigurationUpdateRequest & request,
137  bool bSkipConfigure = false) const;
138 
139 
166  template<typename T>
167  std::pair<T *,std::unique_ptr<TransportAdapter>>
169  const ConfigurationUpdateRequest& request,
170  const std::string & sPlatformEndpoint,
171  const std::string & sTransportEndpoint) const;
172 
173  private:
174  PlatformServiceProvider * newPlatformService() const;
175 
176  std::unique_ptr<TransportAdapter>
177  buildTransportWithAdapter_i(Transport * pTransport,
178  PlatformServiceProvider * pProvider,
179  const ConfigurationUpdateRequest & request,
180  const std::string & sPlatformEndpoint,
181  const std::string & sTransportEndpoint) const;
182  };
183  }
184 }
185 
187 
188 
189 #endif //EMANETRANSPORTBUILDER_HEADER_
std::unique_ptr< NEMLayer > buildTransport(NEMId id, const std::string &sLibraryFile, const ConfigurationUpdateRequest &request, bool bSkipConfigure=false) const
Base class for all transports.
Definition: transport.h:49
std::list< std::unique_ptr< TransportAdapter > > TransportAdapters
std::unique_ptr< TransportAdapter > buildTransportAdapter(std::unique_ptr< NEMLayer > &pTransport, const ConfigurationUpdateRequest &request) const
std::pair< T *, std::unique_ptr< TransportAdapter > > buildTransportWithAdapter(const NEMId id, const ConfigurationUpdateRequest &request, const std::string &sPlatformEndpoint, const std::string &sTransportEndpoint) const
Build an instance of the transport named by the template parameter. T must be a subclass of EMANE::Tr...
The PlatformServiceProvider interface provides access to emulator services.
std::uint16_t NEMId
Definition: types.h:52
Provides methods for contructing transports and a manager to contain and control them as a a group...
std::vector< ConfigurationNameStringValues > ConfigurationUpdateRequest
std::unique_ptr< TransportManager > buildTransportManager(const uuid_t &uuid, TransportAdapters &adapters, const ConfigurationUpdateRequest &request) const
Definition: agent.h:43