00001 #ifndef __CONNECTIONPACKET_H 00002 #define __CONNECTIONPACKET_H 00003 00004 #include "NpPacket.h" 00005 00006 class ConnectionPacket : public NpPacket { 00007 public: 00008 ConnectionPacket(); 00009 virtual ~ConnectionPacket() {} 00010 ConnectionPacket(unsigned char* rawData); 00011 virtual unsigned char* getRawData(); 00012 00013 bool hasSpecifiedDestination(); 00014 void setHasSpecifiedDestination(bool); 00015 00016 bool avoidCensoredNodes(); 00017 void setAvoidCensoredNodes(bool); 00018 00019 bool doFastRouting(); 00020 void setDoFastRouting(bool); 00021 00022 SocketAddress getSocketAddress(); 00023 void setSocketAddress(SocketAddress*); 00024 00025 virtual void toStream(std::ostream&); 00026 00027 private: 00028 OS_SPEC_ENUM Offset { 00029 OptionsOffset = NP_HEADER_LENGTH, 00030 PortOffset = NP_HEADER_LENGTH + 1, 00031 IpOffset = NP_HEADER_LENGTH + 3 00032 }; 00033 00034 OS_SPEC_ENUM OptionBits { 00035 SpecifiedDestinationBit = 0x80, 00036 IpVersionBit = 0x40, 00037 AvoidCensoredNodesBit = 0x20, 00038 FastRoutingBit = 0x10 00039 }; 00040 00042 bool m_hasSpecifiedDestination; 00043 00045 bool m_avoidCensoredNodes; 00046 00048 bool m_doFastRouting; 00049 00051 IpAddress m_ip; 00052 00054 unsigned short m_port; 00055 }; 00056 00057 #endif 00058