diff options
author | Abdullah Sowayan <sowayan@users.noreply.github.com> | 2007-08-13 20:30:44 +0000 |
---|---|---|
committer | Abdullah Sowayan <sowayan@users.noreply.github.com> | 2007-08-13 20:30:44 +0000 |
commit | 672ab112d516c1596fe81caee6aa84e568dfc63a (patch) | |
tree | 5fd5f3625a122d12a7655b339556af152eb6fa72 /ACE/ace/QoS | |
parent | 1b54dadf27412a4be9ecfbe7afa66ea29b9c397d (diff) | |
download | ATCD-672ab112d516c1596fe81caee6aa84e568dfc63a.tar.gz |
Mon Aug 13 20:27:43 UTC 2007 Abdullah Sowayan <abdullah.sowayan@lmco.com>
Diffstat (limited to 'ACE/ace/QoS')
-rw-r--r-- | ACE/ace/QoS/QoS_Session_Impl.cpp | 340 |
1 files changed, 167 insertions, 173 deletions
diff --git a/ACE/ace/QoS/QoS_Session_Impl.cpp b/ACE/ace/QoS/QoS_Session_Impl.cpp index 4f313d1f069..e46b6e4422b 100644 --- a/ACE/ace/QoS/QoS_Session_Impl.cpp +++ b/ACE/ace/QoS/QoS_Session_Impl.cpp @@ -57,18 +57,18 @@ rsvp_callback (rapi_sid_t /* sid */, if (!flow_spec_list) { ACE_DEBUG ((LM_DEBUG, - "(%N|%l) Null flow_spec_list\n")); + "(%N|%l) Null flow_spec_list\n")); } else { // Extended Legacy format. csxp = &flow_spec_list->specbody_qosx; if(!csxp) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N|%l) Null csxp\n"), - -1); - } + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N|%l) Null csxp\n"), + -1); + } } ACE_QoS ace_qos = qos_session->qos (); @@ -82,139 +82,133 @@ rsvp_callback (rapi_sid_t /* sid */, "No. of TSpecs received : %d %d\n", flow_spec_no, &flow_spec_list->len)); - ACE_Flow_Spec *receiving_fs = 0; - - if (flow_spec_no != 0) - { - - ACE_NEW_RETURN (receiving_fs, - ACE_Flow_Spec, - -1); - - ACE_NEW_RETURN (receiving_fs, - ACE_Flow_Spec ((u_long)csxp->xspec_r, - (u_long)csxp->xspec_b, - (u_long)csxp->xspec_p, - 0, - csxp->xspec_S, - 1, - csxp->xspec_M, - csxp->xspec_m, - 25, - 0), - -1); - - - ACE_DEBUG ((LM_DEBUG, - "\nTSpec :\n" - "\t Spec Type = %d\n" - "\t Rate = %f\n" - "\t Bucket = %f\n" - "\t Peak = %f\n" - "\t MPU = %d\n" - "\t MDU = %d\n" - "\t TTL = %d\n", - csxp->spec_type, - csxp->xspec_r, - csxp->xspec_b, - csxp->xspec_p, - csxp->xspec_m, - csxp->xspec_M, - 25)); - - } - // Set the sending flowspec QoS of the given session. - ace_qos.receiving_flowspec (receiving_fs); - - qos_session->rsvp_event_type (ACE_QoS_Session::RSVP_PATH_EVENT); - + ACE_Flow_Spec *receiving_fs = 0; + + if (flow_spec_no != 0) + { + ACE_NEW_RETURN (receiving_fs, + ACE_Flow_Spec, + -1); + + ACE_NEW_RETURN (receiving_fs, + ACE_Flow_Spec ((u_long)csxp->xspec_r, + (u_long)csxp->xspec_b, + (u_long)csxp->xspec_p, + 0, + csxp->xspec_S, + 1, + csxp->xspec_M, + csxp->xspec_m, + 25, + 0), + -1); + + ACE_DEBUG ((LM_DEBUG, + "\nTSpec :\n" + "\t Spec Type = %d\n" + "\t Rate = %f\n" + "\t Bucket = %f\n" + "\t Peak = %f\n" + "\t MPU = %d\n" + "\t MDU = %d\n" + "\t TTL = %d\n", + csxp->spec_type, + csxp->xspec_r, + csxp->xspec_b, + csxp->xspec_p, + csxp->xspec_m, + csxp->xspec_M, + 25)); + } + + // Set the sending flowspec QoS of the given session. + ace_qos.receiving_flowspec (receiving_fs); + + qos_session->rsvp_event_type (ACE_QoS_Session::RSVP_PATH_EVENT); } - break; case RAPI_RESV_EVENT: { - ACE_DEBUG ((LM_DEBUG, - "RSVP RESV Event received\n" - "No. of FlowSpecs received : %d\n", - flow_spec_no)); - - ACE_Flow_Spec *sending_flow = 0; - - if (flow_spec_no != 0) - { - ACE_NEW_RETURN (sending_flow, - ACE_Flow_Spec, - -1); - - // Choose based on the service type : [QOS_GUARANTEEDX/QOS_CNTR_LOAD]. - switch (csxp->spec_type) - { - case QOS_GUARANTEEDX: - // Slack term in MICROSECONDS - sending_flow->delay_variation (csxp->xspec_S); - - // @@How does the guaranteed rate parameter map to the ACE_Flow_Spec. - // Note there is no break !! - - case QOS_CNTR_LOAD: - - // qos_service_type. - sending_flow->service_type (csxp->spec_type); - // Token Bucket Average Rate (B/s) - sending_flow->token_rate ((u_long)csxp->xspec_r); - // Token Bucket Rate (B) - sending_flow->token_bucket_size ((u_long)csxp->xspec_b); - // Peak Data Rate (B/s) - sending_flow->peak_bandwidth ((u_long)csxp->xspec_p); - // Minimum Policed Unit (B) - sending_flow->minimum_policed_size (csxp->xspec_m); - // Max Packet Size (B) - sending_flow->max_sdu_size (csxp->xspec_M); - - break; - - default: - ACE_ERROR_RETURN ((LM_ERROR, - "(%N|%l) Unknown flowspec type: %u.\n", csxp->spec_type), - -1); - }; - } - ace_qos.sending_flowspec (sending_flow); - - qos_session->rsvp_event_type (ACE_QoS_Session::RSVP_RESV_EVENT); + ACE_DEBUG ((LM_DEBUG, + "RSVP RESV Event received\n" + "No. of FlowSpecs received : %d\n", + flow_spec_no)); + + ACE_Flow_Spec *sending_flow = 0; + + if (flow_spec_no != 0) + { + ACE_NEW_RETURN (sending_flow, + ACE_Flow_Spec, + -1); + + // Choose based on the service type : [QOS_GUARANTEEDX/QOS_CNTR_LOAD]. + switch (csxp->spec_type) + { + case QOS_GUARANTEEDX: + // Slack term in MICROSECONDS + sending_flow->delay_variation (csxp->xspec_S); + + // @@How does the guaranteed rate parameter map to the ACE_Flow_Spec. + // Note there is no break !! + + case QOS_CNTR_LOAD: + // qos_service_type. + sending_flow->service_type (csxp->spec_type); + // Token Bucket Average Rate (B/s) + sending_flow->token_rate ((u_long)csxp->xspec_r); + // Token Bucket Rate (B) + sending_flow->token_bucket_size ((u_long)csxp->xspec_b); + // Peak Data Rate (B/s) + sending_flow->peak_bandwidth ((u_long)csxp->xspec_p); + // Minimum Policed Unit (B) + sending_flow->minimum_policed_size (csxp->xspec_m); + // Max Packet Size (B) + sending_flow->max_sdu_size (csxp->xspec_M); + break; + + default: + ACE_ERROR_RETURN ((LM_ERROR, + "(%N|%l) Unknown flowspec type: %u.\n", csxp->spec_type), + -1); + } + } + + ace_qos.sending_flowspec (sending_flow); + qos_session->rsvp_event_type (ACE_QoS_Session::RSVP_RESV_EVENT); } break; case RAPI_PATH_ERROR: { - ACE_DEBUG ((LM_DEBUG, - "PATH ERROR Event received\n" - "Code=%d Val=%d Node= %s\n", - errcode, - errvalue, - ACE_OS::inet_ntoa(((sockaddr_in *)errnode)->sin_addr))); - qos_session->rsvp_event_type (ACE_QoS_Session::RSVP_PATH_ERROR); + ACE_DEBUG ((LM_DEBUG, + "PATH ERROR Event received\n" + "Code=%d Val=%d Node= %s\n", + errcode, + errvalue, + ACE_OS::inet_ntoa(((sockaddr_in *)errnode)->sin_addr))); + qos_session->rsvp_event_type (ACE_QoS_Session::RSVP_PATH_ERROR); } break; case RAPI_RESV_ERROR: { - ACE_DEBUG ((LM_DEBUG, - "RESV ERROR Event received\n" - "Code=%d Val=%d Node= %s\n", - errcode, - errvalue, - ACE_OS::inet_ntoa(((sockaddr_in *)errnode)->sin_addr))); - qos_session->rsvp_event_type (ACE_QoS_Session::RSVP_RESV_ERROR); + ACE_DEBUG ((LM_DEBUG, + "RESV ERROR Event received\n" + "Code=%d Val=%d Node= %s\n", + errcode, + errvalue, + ACE_OS::inet_ntoa(((sockaddr_in *)errnode)->sin_addr))); + qos_session->rsvp_event_type (ACE_QoS_Session::RSVP_RESV_ERROR); } break; case RAPI_RESV_CONFIRM: { - ACE_DEBUG ((LM_DEBUG, - "RESV CONFIRM Event received\n")); - qos_session->rsvp_event_type (ACE_QoS_Session::RSVP_RESV_CONFIRM); + ACE_DEBUG ((LM_DEBUG, + "RESV CONFIRM Event received\n")); + qos_session->rsvp_event_type (ACE_QoS_Session::RSVP_RESV_CONFIRM); } break; @@ -238,7 +232,7 @@ ACE_RAPI_Session::ACE_RAPI_Session (void) ACE_TRACE ("ACE_RAPI_Session::ACE_RAPI_Session"); //this->source_port (DEFAULT_SOURCE_SENDER_PORT); ACE_NEW (this->src_addr_, - ACE_INET_Addr ("0")); + ACE_INET_Addr ("0")); } // Open a RAPI QoS session [dest IP, dest port, Protocol ID]. @@ -248,10 +242,10 @@ ACE_RAPI_Session::open (ACE_INET_Addr dest_addr, { char buf [BUFSIZ]; dest_addr.addr_to_string (buf, - BUFSIZ); + BUFSIZ); ACE_DEBUG ((LM_DEBUG, - "In RAPI SESSION OPEN %s\n", - buf)); + "In RAPI SESSION OPEN %s\n", + buf)); this->dest_addr_ = dest_addr; this->protocol_id_ = protocol_id; @@ -338,21 +332,21 @@ ACE_RAPI_Session::sending_qos (const ACE_QoS &ace_qos) if (sending_flowspec == 0) { int result = rapi_sender (this->session_id_, - 0, - 0, - 0, - 0, - 0, - 0, - 25) ; + 0, + 0, + 0, + 0, + 0, + 0, + 25); if (result != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "(%N|%l) rapi_sender error %d:\n\tPATH Generation can't be started\n", - result), - -1); + ACE_ERROR_RETURN ((LM_ERROR, + "(%N|%l) rapi_sender error %d:\n\tPATH Generation can't be started\n", + result), + -1); else - ACE_DEBUG ((LM_DEBUG, - "rapi_sender () call succeeds with PATH Tear! \n")); + ACE_DEBUG ((LM_DEBUG, + "rapi_sender () call succeeds with PATH Tear! \n")); return 0; } @@ -402,28 +396,28 @@ ACE_RAPI_Session::sending_qos (const ACE_QoS &ace_qos) int result = rapi_sender(this->session_id_, - 0, - (sockaddr *) this->src_addr_->get_addr (), - 0, - t_spec, - 0, - 0, - sending_flowspec->ttl ()) ; + 0, + (sockaddr *) this->src_addr_->get_addr (), + 0, + t_spec, + 0, + 0, + sending_flowspec->ttl ()) ; /* int result = rapi_sender(this->session_id_, - 0, - (sockaddr *) sender_addr.get_addr (), - 0, - t_spec, - 0, - 0, - sending_flowspec->ttl ()) ; + 0, + (sockaddr *) sender_addr.get_addr (), + 0, + t_spec, + 0, + 0, + sending_flowspec->ttl ()) ; */ if(result!= 0) ACE_ERROR_RETURN ((LM_ERROR, "(%N|%l) rapi_sender error %d:\n\tPATH Generation can't be started\n", - result), + result), -1); else ACE_DEBUG ((LM_DEBUG, @@ -440,29 +434,29 @@ ACE_RAPI_Session::receiving_qos (const ACE_QoS &ace_qos) if (receiving_flowspec == 0) { if (rapi_reserve(this->session_id_, - 0, - // Setting the RAPI_REQ_CONFIRM flag requests confirmation - // of the resevation, by means of a confirmation upcall of - // type RAPI_RESV_CONFIRM. - // (sockaddr *)receiver_addr.get_addr (), - 0, - RAPI_RSTYLE_WILDCARD, - // This applies the flowspec to all the senders. Given this, - // @@I am passing the filter_spec to be null, hoping this will work. - 0, - 0, - 0, - 0, - // The filter spec is NULL. This should work since the RSTYLE is - // WILDCARD. - 0, - 0) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%N|%l)rapi_reserve () error:\n\tRESV Generation can't be started\n"), - -1); + 0, + // Setting the RAPI_REQ_CONFIRM flag requests confirmation + // of the resevation, by means of a confirmation upcall of + // type RAPI_RESV_CONFIRM. + // (sockaddr *)receiver_addr.get_addr (), + 0, + RAPI_RSTYLE_WILDCARD, + // This applies the flowspec to all the senders. Given this, + // @@I am passing the filter_spec to be null, hoping this will work. + 0, + 0, + 0, + 0, + // The filter spec is NULL. This should work since the RSTYLE is + // WILDCARD. + 0, + 0) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "(%N|%l)rapi_reserve () error:\n\tRESV Generation can't be started\n"), + -1); else - ACE_DEBUG ((LM_DEBUG, - "rapi_reserve () for RESV Tear call succeeds \n")); + ACE_DEBUG ((LM_DEBUG, + "rapi_reserve () for RESV Tear call succeeds \n")); return 0; } |