|
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 _IPTUNNEL_H_ |
|
18 #define _IPTUNNEL_H_ |
|
19 |
|
20 #include <oasys/debug/Log.h> |
|
21 |
|
22 #include <dtn_api.h> |
|
23 #include <APIBundleQueue.h> |
|
24 |
|
25 namespace dtntunnel { |
|
26 |
|
27 /** |
|
28 * Pure virtual base class for tunneling of IP protocols. |
|
29 */ |
|
30 class IPTunnel : public oasys::Logger { |
|
31 public: |
|
32 /// Constructor |
|
33 IPTunnel(const char* classname, const char* logpath) |
|
34 : Logger(classname, "%s", logpath) {} |
|
35 |
|
36 /// Destructor |
|
37 virtual ~IPTunnel() {} |
|
38 |
|
39 /// Add a new listener |
|
40 virtual void add_listener(in_addr_t listen_addr, |
|
41 u_int16_t listen_port, |
|
42 in_addr_t remote_addr, |
|
43 u_int16_t remote_port) = 0; |
|
44 |
|
45 /// Handle a newly arriving bundle. The tunnel should take |
|
46 /// ownership of the bundle structure and handle cleanup. |
|
47 virtual void handle_bundle(dtn::APIBundle* data) = 0; |
|
48 }; |
|
49 |
|
50 } // namespace dtntunnel |
|
51 |
|
52 #endif /* _IPTUNNEL_H_ */ |