|
1 /* |
|
2 * Copyright 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 _NULLCONVERGENCELAYER_H_ |
|
18 #define _NULLCONVERGENCELAYER_H_ |
|
19 |
|
20 #include "ConvergenceLayer.h" |
|
21 |
|
22 namespace dtn { |
|
23 |
|
24 /** |
|
25 * The null convergence layer consumes all bundles immediately and |
|
26 * does no actual transmission, roughly similar to /dev/null. |
|
27 */ |
|
28 class NullConvergenceLayer : public ConvergenceLayer { |
|
29 public: |
|
30 NullConvergenceLayer(); |
|
31 |
|
32 /// Link parameters |
|
33 class Params : public CLInfo { |
|
34 public: |
|
35 virtual ~Params() {} |
|
36 virtual void serialize(oasys::SerializeAction* a); |
|
37 |
|
38 /// Whether or not the link can actually send bundles (default true) |
|
39 bool can_transmit_; |
|
40 }; |
|
41 |
|
42 /// Default parameters |
|
43 static Params defaults_; |
|
44 |
|
45 /// @{ Virtual from ConvergenceLayer |
|
46 bool init_link(const LinkRef& link, int argc, const char* argv[]); |
|
47 bool reconfigure_link(const LinkRef& link, int argc, const char* argv[]); |
|
48 void delete_link(const LinkRef& link); |
|
49 bool open_contact(const ContactRef& contact); |
|
50 void bundle_queued(const LinkRef& link, const BundleRef& bundle); |
|
51 void cancel_bundle(const LinkRef& link, const BundleRef& bundle); |
|
52 /// @} |
|
53 |
|
54 private: |
|
55 /// Helper function to parse link parameters |
|
56 bool parse_link_params(Params* params, |
|
57 int argc, const char** argv, |
|
58 const char** invalidp); |
|
59 }; |
|
60 |
|
61 } // namespace dtn |
|
62 |
|
63 #endif /* _NULLCONVERGENCELAYER_H_ */ |