IBR-DTNSuite  0.8
ibrdtn/ibrdtn/streams/StreamContactHeader.h
Go to the documentation of this file.
00001 /*
00002  * StreamContactHeader.h
00003  *
00004  *  Created on: 30.06.2009
00005  *      Author: morgenro
00006  */
00007 
00008 
00009 
00010 #ifndef STREAMCONTACTHEADER_H_
00011 #define STREAMCONTACTHEADER_H_
00012 
00013 
00014 #include "ibrdtn/data/EID.h"
00015 #include "ibrdtn/data/Exceptions.h"
00016 #include <sys/types.h>
00017 
00018 
00019 using namespace dtn::data;
00020 
00021 namespace dtn
00022 {
00023         namespace streams
00024         {
00025                 static const unsigned char TCPCL_VERSION = 3;
00026 
00027                 class StreamContactHeader
00028                 {
00029                 public:
00030                         enum HEADER_BITS
00031                         {
00032                                 REQUEST_ACKNOWLEDGMENTS = 1 << 0,
00033                                 REQUEST_FRAGMENTATION = 1 << 1,
00034                                 REQUEST_NEGATIVE_ACKNOWLEDGMENTS = 1 << 2,
00035                                 /* this flag is implementation specific and not in the draft */
00036                                 REQUEST_TLS = 1 << 7
00037                         };
00038 
00039                         StreamContactHeader();
00040                         StreamContactHeader(EID localeid);
00041                         virtual ~StreamContactHeader();
00042 
00043                         StreamContactHeader& operator=(const StreamContactHeader &other);
00044 
00045                         const EID getEID() const;
00046 
00047                         EID _localeid;
00048                         char _flags;
00049                         u_int16_t _keepalive;
00050 
00051                         friend std::ostream &operator<<(std::ostream &stream, const StreamContactHeader &h);
00052                         friend std::istream &operator>>(std::istream &stream, StreamContactHeader &h);
00053                 };
00054         }
00055 }
00056 
00057 #endif /* STREAMCONTACTHEADER_H_ */