Go to the documentation of this file.00001
00002
00003
00004 #include "tao/orbconf.h"
00005
00006 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
00007
00008 #include "tao/RTCORBA/Linear_Network_Priority_Mapping.h"
00009 #include "tao/debug.h"
00010
00011 #include "ace/Sched_Params.h"
00012 #include "ace/Log_Msg.h"
00013
00014 ACE_RCSID (RTCORBA,
00015 Linear_Network_Priority_Mapping,
00016 "$Id: Linear_Network_Priority_Mapping.cpp 76593 2007-01-25 19:19:27Z johnnyw $")
00017
00018 #define IPDSFIELD_DSCP_DEFAULT 0x00
00019 #define IPDSFIELD_DSCP_CS1 0x08
00020 #define IPDSFIELD_DSCP_CS2 0x10
00021 #define IPDSFIELD_DSCP_CS3 0x18
00022 #define IPDSFIELD_DSCP_CS4 0x20
00023 #define IPDSFIELD_DSCP_CS5 0x28
00024 #define IPDSFIELD_DSCP_CS6 0x30
00025 #define IPDSFIELD_DSCP_CS7 0x38
00026 #define IPDSFIELD_DSCP_AF11 0x0A
00027 #define IPDSFIELD_DSCP_AF12 0x0C
00028 #define IPDSFIELD_DSCP_AF13 0x0E
00029 #define IPDSFIELD_DSCP_AF21 0x12
00030 #define IPDSFIELD_DSCP_AF22 0x14
00031 #define IPDSFIELD_DSCP_AF23 0x16
00032 #define IPDSFIELD_DSCP_AF31 0x1A
00033 #define IPDSFIELD_DSCP_AF32 0x1C
00034 #define IPDSFIELD_DSCP_AF33 0x1E
00035 #define IPDSFIELD_DSCP_AF41 0x22
00036 #define IPDSFIELD_DSCP_AF42 0x24
00037 #define IPDSFIELD_DSCP_AF43 0x26
00038 #define IPDSFIELD_ECT_MASK 0x02
00039 #define IPDSFIELD_CE_MASK 0x01
00040 #define IPDSFIELD_DSCP_EF 0x2E
00041
00042 static int const dscp[] =
00043 {
00044 IPDSFIELD_DSCP_DEFAULT ,
00045 IPDSFIELD_DSCP_CS1 ,
00046 IPDSFIELD_DSCP_CS2 ,
00047 IPDSFIELD_DSCP_CS3 ,
00048 IPDSFIELD_DSCP_CS4 ,
00049 IPDSFIELD_DSCP_CS5 ,
00050 IPDSFIELD_DSCP_CS6 ,
00051 IPDSFIELD_DSCP_CS7 ,
00052 IPDSFIELD_DSCP_AF11 ,
00053 IPDSFIELD_DSCP_AF12 ,
00054 IPDSFIELD_DSCP_AF13 ,
00055 IPDSFIELD_DSCP_AF21 ,
00056 IPDSFIELD_DSCP_AF22 ,
00057 IPDSFIELD_DSCP_AF23 ,
00058 IPDSFIELD_DSCP_AF31 ,
00059 IPDSFIELD_DSCP_AF32 ,
00060 IPDSFIELD_DSCP_AF33 ,
00061 IPDSFIELD_DSCP_AF41 ,
00062 IPDSFIELD_DSCP_AF42 ,
00063 IPDSFIELD_DSCP_AF43 ,
00064 IPDSFIELD_DSCP_EF
00065 };
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00095
00096 TAO_Linear_Network_Priority_Mapping::TAO_Linear_Network_Priority_Mapping (long)
00097 {
00098 }
00099
00100 CORBA::Boolean
00101 TAO_Linear_Network_Priority_Mapping::to_network (
00102 RTCORBA::Priority corba_priority,
00103 RTCORBA::NetworkPriority &network_priority)
00104 {
00105 if (TAO_debug_level)
00106 ACE_DEBUG ((LM_DEBUG,
00107 "TAO_Linear_Network_Priority_Mapping::to_network corba_priority %d\n",
00108 corba_priority));
00109
00110 int const total_slots = sizeof (dscp) / sizeof (int);
00111
00112 int array_slot =
00113 static_cast<int> (((corba_priority - RTCORBA::minPriority) / double (RTCORBA::maxPriority - RTCORBA::minPriority)) * total_slots);
00114
00115 if (array_slot == total_slots)
00116 array_slot -= 1;
00117
00118 network_priority = dscp[array_slot];
00119
00120 if (TAO_debug_level)
00121 ACE_DEBUG ((LM_DEBUG,
00122 "TAO_Linear_Network_Priority_Mapping::to_network = %x\n",
00123 network_priority));
00124
00125 return 1;
00126 }
00127
00128 CORBA::Boolean
00129 TAO_Linear_Network_Priority_Mapping::to_CORBA (RTCORBA::NetworkPriority network_priority,
00130 RTCORBA::Priority &)
00131 {
00132 if (TAO_debug_level)
00133 ACE_DEBUG ((LM_DEBUG,
00134 "TAO_Linear_Network_Priority_Mapping::to_CORBA network_priority %d\n",
00135 network_priority));
00136
00137 return 0;
00138 }
00139
00140 TAO_END_VERSIONED_NAMESPACE_DECL
00141
00142 #endif