|
1 /* |
|
2 * Copyright 2004-2006 Intel Corporation |
|
3 * |
|
4 * Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 * you may not use this file except in compliance with the License. |
|
6 * You may obtain a copy of the License at |
|
7 * |
|
8 * http://www.apache.org/licenses/LICENSE-2.0 |
|
9 * |
|
10 * Unless required by applicable law or agreed to in writing, software |
|
11 * distributed under the License is distributed on an "AS IS" BASIS, |
|
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 * See the License for the specific language governing permissions and |
|
14 * limitations under the License. |
|
15 */ |
|
16 |
|
17 #ifndef _INTERFACE_H_ |
|
18 #define _INTERFACE_H_ |
|
19 |
|
20 #include <oasys/debug/Log.h> |
|
21 #include <vector> |
|
22 |
|
23 namespace dtn { |
|
24 |
|
25 class ConvergenceLayer; |
|
26 class CLInfo; |
|
27 |
|
28 /** |
|
29 * Abstraction of a local dtn interface. |
|
30 * |
|
31 * Generally, interfaces are created by the configuration file / |
|
32 * console. |
|
33 */ |
|
34 class Interface { |
|
35 public: |
|
36 // Accessors |
|
37 const std::string& name() const { return name_; } |
|
38 const std::string& proto() const { return proto_; } |
|
39 ConvergenceLayer* clayer() const { return clayer_; } |
|
40 CLInfo* cl_info() const { return cl_info_; } |
|
41 |
|
42 /** |
|
43 * Store the ConvergenceLayer specific state. |
|
44 */ |
|
45 void set_cl_info(CLInfo* cl_info) |
|
46 { |
|
47 ASSERT((cl_info_ == NULL && cl_info != NULL) || |
|
48 (cl_info_ != NULL && cl_info == NULL)); |
|
49 |
|
50 cl_info_ = cl_info; |
|
51 } |
|
52 |
|
53 protected: |
|
54 friend class InterfaceTable; |
|
55 |
|
56 Interface(const std::string& name, |
|
57 const std::string& proto, |
|
58 ConvergenceLayer* clayer); |
|
59 ~Interface(); |
|
60 |
|
61 std::string name_; ///< Name of the interface |
|
62 std::string proto_; ///< What type of CL |
|
63 ConvergenceLayer* clayer_; ///< Convergence layer to use |
|
64 CLInfo* cl_info_; ///< Convergence layer specific state |
|
65 }; |
|
66 |
|
67 } // namespace dtn |
|
68 |
|
69 #endif /* _INTERFACE_H_ */ |