00001 #ifndef QPID_CLIENT_FLOWCONTROL_H
00002 #define QPID_CLIENT_FLOWCONTROL_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 namespace qpid {
00026 namespace client {
00027
00047 struct FlowControl {
00048 static const uint32_t UNLIMITED=0xFFFFFFFF;
00049 FlowControl(uint32_t messages_=0, uint32_t bytes_=0, bool window_=false)
00050 : messages(messages_), bytes(bytes_), window(window_) {}
00051
00052 static FlowControl messageCredit(uint32_t messages_) { return FlowControl(messages_,UNLIMITED,false); }
00053 static FlowControl messageWindow(uint32_t messages_) { return FlowControl(messages_,UNLIMITED,true); }
00054 static FlowControl byteCredit(uint32_t bytes_) { return FlowControl(UNLIMITED,bytes_,false); }
00055 static FlowControl byteWindow(uint32_t bytes_) { return FlowControl(UNLIMITED,bytes_,true); }
00056 static FlowControl unlimited() { return FlowControl(UNLIMITED, UNLIMITED, false); }
00057 static FlowControl zero() { return FlowControl(0, 0, false); }
00058
00060 uint32_t messages;
00062 uint32_t bytes;
00064 bool window;
00065
00066 bool operator==(const FlowControl& x) {
00067 return messages == x.messages && bytes == x.bytes && window == x.window;
00068 };
00069 };
00070
00071 }}
00072
00073 #endif