IBR-DTNSuite  0.10
StreamContactHeader.h
Go to the documentation of this file.
1 /*
2  * StreamContactHeader.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 
24 #ifndef STREAMCONTACTHEADER_H_
25 #define STREAMCONTACTHEADER_H_
26 
27 
28 #include "ibrdtn/data/EID.h"
29 #include "ibrdtn/data/Exceptions.h"
30 #include <sys/types.h>
31 #include <stdint.h>
32 
33 
34 using namespace dtn::data;
35 
36 namespace dtn
37 {
38  namespace streams
39  {
40  static const unsigned char TCPCL_VERSION = 3;
41 
43  {
44  public:
46  {
47  REQUEST_ACKNOWLEDGMENTS = 1 << 0,
48  REQUEST_FRAGMENTATION = 1 << 1,
49  REQUEST_NEGATIVE_ACKNOWLEDGMENTS = 1 << 2,
50  /* this flag is implementation specific and not in the draft */
51  REQUEST_TLS = 1 << 7,
52  HANDSHAKE_SENDONLY = 0x80
53  };
54 
56  StreamContactHeader(EID localeid);
57  virtual ~StreamContactHeader();
58 
59  StreamContactHeader& operator=(const StreamContactHeader &other);
60 
61  const EID getEID() const;
62 
65  uint16_t _keepalive;
66 
67  friend std::ostream &operator<<(std::ostream &stream, const StreamContactHeader &h);
68  friend std::istream &operator>>(std::istream &stream, StreamContactHeader &h);
69  };
70  }
71 }
72 
73 #endif /* STREAMCONTACTHEADER_H_ */