IBR-DTNSuite  0.10
StreamDataSegment.h
Go to the documentation of this file.
1 /*
2  * StreamDataSegment.h
3  *
4  * Copyright (C) 2011 IBR, TU Braunschweig
5  *
6  * Written-by: Johannes Morgenroth <morgenroth@ibr.cs.tu-bs.de>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 
22 
23 #ifndef STREAMDATASEGMENT_H_
24 #define STREAMDATASEGMENT_H_
25 
26 #include <ibrdtn/data/Number.h>
27 #include <stdlib.h>
28 #include <iostream>
29 #include <stdint.h>
30 
31 namespace dtn
32 {
33  namespace streams
34  {
36  {
37  public:
39  {
45  };
46 
48  {
50  MSG_MARK_END = 0x01
51  };
52 
54  {
59  };
60 
61  StreamDataSegment(SegmentType type, const dtn::data::Number &size); // creates a ACK or DATA segment
62  StreamDataSegment(SegmentType type = MSG_KEEPALIVE); // Creates a Keep-Alive Message
63  StreamDataSegment(ShutdownReason reason, const dtn::data::Number &reconnect = 0); // Creates a Shutdown Message
64 
65  virtual ~StreamDataSegment();
66 
70  uint8_t _flags;
71 
72  friend std::ostream &operator<<(std::ostream &stream, const StreamDataSegment &seg);
73  friend std::istream &operator>>(std::istream &stream, StreamDataSegment &seg);
74  };
75  }
76 }
77 
78 #endif /* STREAMDATASEGMENT_H_ */