|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
25 if (dscp != DSCP_Invalid && dscp != DSCP_Undefined) {
26 packetPriority = ((int)dscp) << 2;
35 if (level != PacketPriorityInvalid && level != PacketPriorityUndefined) {
36 packetPriority = ((int)level) << 2;
44 size_t p = priority.find(
':');
45 if (p == std::string::npos) {
49 std::string key = priority.substr(0, p);
50 std::string value = priority.substr(p + 1);
51 if (key.length() <= 0 || value.length() <= 0) {
57 if (level != PacketPriorityInvalid && level != PacketPriorityUndefined) {
58 setPacketPriorityByLevel(level);
61 }
else if (key ==
"DSCP") {
63 if (dscp != DSCP_Invalid && dscp != DSCP_Undefined) {
64 setPacketPriorityByDscp(dscp);
67 }
else if (key ==
"TOS") {
69 int tos = strtol(value.c_str(), &p, 10);
70 if (p ==
nullptr && tos >= 0) {
71 setPacketPrioritybyTOS(tos);
82 switch (packetPriority) {
130 return DSCP_Undefined;
136 switch (packetPriority) {
138 return PacketPriorityInvalid;
140 return PacketPriorityNormal;
142 return PacketPriorityLow;
144 return PacketPriorityHigh;
146 return PacketPriorityCritical;
148 return PacketPriorityUndefined;
215 return PacketPriorityNormal;
217 return PacketPriorityLow;
219 return PacketPriorityHigh;
221 return PacketPriorityCritical;
223 return PacketPriorityInvalid;
constexpr yarp::conf::vocab32_t createVocab(char a, char b=0, char c=0, char d=0)
static PacketPriorityDSCP getDSCPByVocab(int vocab)
returns the IPV4/6 DSCP value given as DSCP code
bool setPacketPriority(const std::string &priority)
sets the packet priority from a string.
PacketPriorityLevel getPacketPriorityAsLevel() const
returns the packet TOS value
static PacketPriorityLevel getLevelByVocab(int vocab)
returns the priority level
void setPacketPriorityByLevel(PacketPriorityLevel level)
sets the packet priority given as PacketPriorityLevel
PacketPriorityDSCP getPacketPriorityAsDSCP() const
returns the packet DSCP class
NetInt32 encode(const std::string &str)
Convert a string into a vocabulary identifier.
PacketPriorityDSCP
The PacketPriorityDSCP defines the packets quality of service (priority) using DSCP.
PacketPriorityLevel
The PacketPriorityLevel defines the packets quality of service (priority) levels.
void setPacketPriorityByDscp(PacketPriorityDSCP dscp)
sets the packet priority given as DSCP class