NSIS-ka
A free C++ implementation of NSIS protocols

Changeset 4489


Ignore:
Timestamp:
Sep 25, 2009, 3:03:53 PM (8 years ago)
Author:
stud-terziyska
Message:

RMF-Erweiterung

Location:
qos-nslp/branches/20090914-emiliyana09/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • qos-nslp/branches/20090914-emiliyana09/src/QoS_NSLP_Client_API.cpp

    r4005 r4489  
    4646        qspec::qspec_object *qos_desired = new qspec::qspec_object(ot_qos_desired);
    4747        qos_desired->set_parameter(new qspec::t_mod(bandwidth, 100000, bandwidth, 1500));
     48        qos_desired->set_parameter(new qspec::admission_priority(ap_high_priority_flow));
    4849        q_pdu->set_object(qos_desired);
    4950
     
    9192        qspec::qspec_object *qos_desired = new qspec::qspec_object(ot_qos_desired);
    9293        qos_desired->set_parameter(new qspec::t_mod(bandwidth, 100000, bandwidth, 1500));
     94        qos_desired->set_parameter(new qspec::admission_priority(ap_high_priority_flow));
    9395        q_pdu->set_object(qos_desired);
    9496
     
    134136                qspec::qspec_object *qos_desired = new qspec::qspec_object(ot_qos_desired);
    135137                qos_desired->set_parameter(new qspec::t_mod(bandwidth, 100000, bandwidth, 1500));
     138                qos_desired->set_parameter(new qspec::admission_priority(ap_high_priority_flow));
    136139                q_pdu->set_object(qos_desired);
    137140        }
  • qos-nslp/branches/20090914-emiliyana09/src/QoS_StateModule.cpp

    r4210 r4489  
    15361536    if (q) {
    15371537      qspec_pdu* q_pdu = q->get_qspec_class();
    1538         bool success_reserve = rmf_admin->reserve_ressources(q_pdu);
     1538        bool success_reserve = rmf_admin->reserve_resources(q_pdu);
    15391539
    15401540        if (!success_reserve) {
     
    19981998        context->set_context_qspec(local_qspec);
    19991999        context->unlock();
    2000         if (!(rmf_adm->reserve_ressources(q_pdu))) {
     2000        if (!(rmf_adm->reserve_resources(q_pdu))) {
    20012001                nslpres = error_no_bandwidth;
    20022002                Log(ERROR_LOG, LOG_NORMAL, state_manager::modname, "not enough bandwidth!");
     
    21272127            forw = true;
    21282128            qspec_pdu* q_pdu = send_qspec->get_qspec_class();
    2129             bool success_reserve = rmf_admin->reserve_ressources(q_pdu);
     2129            bool success_reserve = rmf_admin->reserve_resources(q_pdu);
    21302130            if (!success_reserve) {
    21312131              nslpres = error_no_bandwidth;
     
    24432443void state_manager::delete_context(NSLP_Context* context)
    24442444{
    2445   // release reserved ressources, stop timer for lifetime, delete state
     2445  // release reserved resources, stop timer for lifetime, delete state
    24462446  uint128 s_sid, b_sid;
    24472447  bool bound_session;
     
    24542454  qspec_pdu* q_pdu = local_qspec->get_qspec_class();
    24552455  if (q_pdu) {
    2456     rmf_admin->release_ressources(q_pdu);
     2456    rmf_admin->release_resources(q_pdu);
    24572457  }
    24582458  id_t lifetime_timer_id;
  • qos-nslp/branches/20090914-emiliyana09/src/rmf.cpp

    r4004 r4489  
    2727/***** class rmf *****/
    2828
    29 const uint32 rmf::max_avail_bandwidth_default = 10000;
     29const uint32 rmf::max_avail_bandwidth_default = 1000000000;
    3030
    3131const uint32 rmf::reserved_default = 0;
    3232
     33long rmf::AF_available_bandwidth= 400000000;    // in bit/s
     34long rmf::EF_available_bandwidth= 600000000;    // in bit/s
     35long rmf::EF_res_avg_rate= 0;                           // in bit/s
     36long rmf::BE_available_bandwidth= 600000000;    // in bit/s
     37
     38       
    3339/** Default constructor for RMF function without any params. All values will be set to the default values.
    3440  */
    3541rmf::rmf() {
    36         set_max_avail_bandwidth(10000);
     42        set_max_avail_bandwidth(10000000);
    3743        set_default_reserved();
    3844        get_avail_bandwidth(available_bandwidth);
    39 } // end constructor
     45        } // end constructor
     46
     47
     48//void rmf::set_AF_available_bandwidth(long a) {
     49//static AF_available_bandwidth = a;
     50//}
     51
    4052
    4153/** This function sets the maximum available bandwidth to a default value.
     
    7991} // end get
    8092
    81 /** This function reserves bandwidth.
    82   * @param r this variable specifies the amount of bandwidth to be reserved.
    83   * @returns TRUE if reservation was successfull, otherwise FALSE will be returned.
    84   */
    85 bool rmf::reserve_bandwidth(uint32 r) {
    86     bool is_ok = false;
    87     uint32 a;
    88     calculate_avail_bandwidth(a);
    89     if (r < a) {
    90         reserved_bandwidth = reserved_bandwidth + r;
    91         available_bandwidth = available_bandwidth - r;
    92         calculate_avail_bandwidth(available_bandwidth);
    93         is_ok = true;
    94     }
    95     return is_ok;
    96 } // end reserve bandwidth
    97 
    98 /** This function releases some reserved bandwidth.
    99   * @param r this variable specifies the amount of bandwidth to be released.
    100   */
    101 void rmf::release_bandwidth(uint32 r) {
    102     reserved_bandwidth = reserved_bandwidth - r;
    103     available_bandwidth = available_bandwidth + r;
    104     calculate_avail_bandwidth(available_bandwidth);
    105 }
    106 
    10793/** This function processes QSPEC object e.g. from QUERY message.
    10894  * @param q current QSPEC to be processed.
     
    114100}
    115101
    116 /** This function reserves ressources as specified in QSPEC object.
    117   * @param q current QSPEC containing ressources to be reserved.
     102/** This function reserves resources as specified in QSPEC object.
     103  * @param q current QSPEC containing resources to be reserved.
    118104  */
    119 bool rmf::reserve_ressources(qspec_pdu* q)
     105bool rmf::reserve_resources(qspec_pdu* q)
    120106{
    121   EVLog("QoS RMF", "RESERVE ressources");
    122 
    123   return true;
     107   
     108        bool result = false;
     109       
     110        qspec::qspec_object *ob = q->get_object(0);
     111       
     112        admission_priority *ad_pr = (admission_priority*) ob->get_parameter(9);
     113        t_mod *tmd = (t_mod*) ob->get_parameter(1);
     114        long *afb = &AF_available_bandwidth;
     115        long *efb = &EF_available_bandwidth;
     116        long *ef_avg_rate = &EF_res_avg_rate;
     117        long *beb = &BE_available_bandwidth;
     118       
     119       
     120        EVLog("QoS RMF", "QoS-desired average rate: " << tmd->get_rate());
     121        EVLog("QoS RMF", "QoS-desired peak data rate: " << tmd->get_peak_data_rate());
     122        EVLog("QoS RMF", "QoS-desired bucket depth: " << tmd->get_bucket_depth());
     123        EVLog("QoS RMF", "QoS-desired mpu: " << tmd->get_min_policed_unit());
     124       
     125        if ( ad_pr->get_y2171value() == 1) {   
     126                       
     127                if ((AF_available_bandwidth - tmd->get_peak_data_rate())>0) {   
     128                        EVLog("QoS RMF", "RESERVE resources for AF");   
     129                        *afb -= tmd->get_peak_data_rate();
     130                        result = true;
     131               
     132                        }
     133        }
     134       
     135       
     136        if ( (ad_pr->get_y2171value()) == 2) {
     137                if((EF_available_bandwidth - tmd->get_peak_data_rate())>0) {
     138                        EVLog("QoS RMF", "RESERVE resources for EF");
     139                        *efb -= tmd->get_peak_data_rate();             
     140                        *ef_avg_rate += tmd->get_rate();
     141                        result = true;
     142                }
     143        }
     144       
     145         if ( (ad_pr->get_y2171value()) == 0) {
     146                if (BE_available_bandwidth - EF_res_avg_rate - tmd->get_rate()) {       
     147                        EVLog("QoS RMF", "RESERVE resources for BE");   
     148                        *beb -= *ef_avg_rate - tmd->get_rate();
     149                        result = true;
     150                }
     151         }
     152               
     153 
     154        return result;
    124155}
    125156
    126 /** This function releases ressources as specified in QSPEC object.
    127   * @param q current QSPEC containing ressources to be released.
     157/** This function releases resources as specified in QSPEC object.
     158  * @param q current QSPEC containing resources to be released.
    128159  */
    129 void rmf::release_ressources(qspec_pdu* q)
     160void rmf::release_resources(qspec_pdu* q)
    130161{
    131   EVLog("QoS RMF", "RELEASE ressources");
    132 
     162  EVLog("QoS RMF", "RELEASE resources");
     163 
     164        qspec::qspec_object *ob = q->get_object(0);
     165        admission_priority *ad_pr = (admission_priority*) ob->get_parameter(9);
     166        t_mod *tmd = (t_mod*) ob->get_parameter(1);
     167        long *afb = &AF_available_bandwidth;
     168        long *efb = &EF_available_bandwidth;
     169        long *ef_avg_rate = &EF_res_avg_rate;
     170        long *beb = &BE_available_bandwidth;   
     171       
     172        if (( ad_pr->get_y2171value())==1) {
     173                EVLog("QoS RMF", "RELEASE resources for AF");                   
     174                *afb += tmd->get_peak_data_rate();
     175        }
     176       
     177        if ( (ad_pr->get_y2171value())==2) {
     178                EVLog("QoS RMF", "RELEASE resources for EF");
     179                *efb += tmd->get_peak_data_rate();
     180                *ef_avg_rate -= tmd->get_rate();
     181        }
     182       
     183        if ( (ad_pr->get_y2171value())==0) {
     184                EVLog("QoS RMF", "RELEASE resources for BE");
     185                *beb -= *ef_avg_rate + tmd->get_rate();
     186        }
     187       
    133188}
    134189
Note: See TracChangeset for help on using the changeset viewer.