00001 #ifndef _FLOWPACKET_H__
00002 #define _FLOWPACKET_H__
00003
00004
00005 namespace awds {
00006
00009 class FlowPacket : public SrcPacket {
00010 public:
00011
00012 static const size_t OffsetFlowDest = SrcPacketEnd;
00013 static const size_t OffsetFlowId = OffsetFlowDest + NodeId::size;
00014 static const size_t OffsetFlowType = OffsetFlowId + 4;
00015 static const size_t FlowPacketEnd = OffsetFlowType + 4;
00016
00017 FlowPacket(BasePacket &p) : SrcPacket(p) {}
00018
00019 uint32_t getFlowId() const {
00020 return fromArray<uint32_t>(packet.buffer + OffsetFlowId);
00021 }
00022
00023 void setFlowId(uint32_t flowid) {
00024 toArray<uint32_t>(flowid, packet.buffer + OffsetFlowId);
00025 }
00026
00027 NodeId getFlowDest() const {
00028 NodeId ret;
00029 ret.fromArray(packet.buffer + OffsetFlowDest);
00030 return ret;
00031 }
00032
00033 void setFlowDest(const NodeId& id) const {
00034 id.toArray(packet.buffer + OffsetFlowDest);
00035 }
00036
00037 uint32_t getFlowType() const {
00038 return fromArray<uint32_t>(packet.buffer + OffsetFlowType);
00039 }
00040
00041 void setFlowType(uint32_t type) {
00042 toArray<uint32_t>(type, packet.buffer + OffsetFlowType);
00043 }
00044
00045 };
00046
00047 }
00048
00049 #endif //FLOWPACKET_H__
00050
00051
00052
00053
00054
00055