|
1 /* |
|
2 * Copyright 2007 Baylor University |
|
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 _PROPHET_LINK_H_ |
|
18 #define _PROPHET_LINK_H_ |
|
19 |
|
20 #include "prophet/Link.h" |
|
21 #include "contacts/Link.h" |
|
22 |
|
23 namespace dtn |
|
24 { |
|
25 |
|
26 class ProphetLink : public prophet::Link |
|
27 { |
|
28 |
|
29 public: |
|
30 ProphetLink(const LinkRef& link) |
|
31 : ref_("ProphetLink") |
|
32 { |
|
33 ref_ = link; |
|
34 } |
|
35 |
|
36 ~ProphetLink() |
|
37 { |
|
38 ref_ = NULL; |
|
39 } |
|
40 |
|
41 const LinkRef& ref() const { return ref_; } |
|
42 |
|
43 ///@{ Virtual from prophet::Link |
|
44 const char* nexthop() const |
|
45 { |
|
46 return (ref().object() == NULL) ? "" : ref()->nexthop(); |
|
47 } |
|
48 const char* remote_eid() const |
|
49 { |
|
50 return (ref().object() == NULL) ? "" : ref()->remote_eid().c_str(); |
|
51 } |
|
52 ///@} |
|
53 |
|
54 protected: |
|
55 |
|
56 LinkRef ref_; ///< DTN Link object |
|
57 }; // class ProphetLink |
|
58 |
|
59 }; // namespace dtn |
|
60 |
|
61 #endif // _PROPHET_LINK_H_ |