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

Changeset 4522


Ignore:
Timestamp:
Oct 6, 2009, 1:45:06 PM (8 years ago)
Author:
stud-dettling
Message:
  • Next step for AHO phase 1.
Location:
qos-nslp/branches/20090610-qos-nslp-aho
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • qos-nslp/branches/20090610-qos-nslp-aho/include/QoS_StateModule.h

    r4506 r4522  
    156156  bool is_last_signaling_hop(const ntlp::mri_pathcoupled* flow_mri, bool down = true) const;
    157157  bool is_last_signaling_hop(const ntlp::mri_explicitsigtarget* mri) const;
     158  bool is_flow_source(const ntlp::mri_pathcoupled* mri) const;
     159  bool is_flow_destination(const ntlp::mri_pathcoupled* mri) const;
    158160  static const char *const errstr[];
    159161
  • qos-nslp/branches/20090610-qos-nslp-aho/src/QoS_StateModule.cpp

    r4509 r4522  
    117117                return false;
    118118        }
     119}
     120
     121
     122/** returns whether this entity is the source of the flow
     123 * described by the given PC-MRI.
     124 * @param pc_mri PC-MRI
     125 */
     126bool
     127state_manager::is_flow_source(const ntlp::mri_pathcoupled* mri) const
     128{
     129  // choose own address for comparison
     130  const hostaddress& flow_src = mri->get_sourceaddress();
     131
     132  if (addresses->addr_is(flow_src, AddressList::ConfiguredAddr_P) ||
     133      addresses->addr_is(flow_src, AddressList::LocalAddr_P)) {
     134        return true;
     135  }
     136  else {
     137        return false;
     138  }
     139}
     140
     141
     142/** returns whether this entity is the destination of the flow
     143 * described by the given PC-MRI.
     144 * @param pc_mri PC-MRI
     145 */
     146bool
     147state_manager::is_flow_destination(const ntlp::mri_pathcoupled* mri) const
     148{
     149  // choose own address for comparison
     150  const hostaddress& flow_dest = mri->get_destaddress();
     151
     152  if (addresses->addr_is(flow_dest, AddressList::ConfiguredAddr_P) ||
     153      addresses->addr_is(flow_dest, AddressList::LocalAddr_P)) {
     154        return true;
     155  }
     156  else {
     157        return false;
     158  }
    119159}
    120160
     
    40164056/**
    40174057 * Process event which indicates necessity of a network change
    4018  * @param cur_address the current interface address which will change
     4058 * @param iface the affected network interface
     4059 * @param l2_ap_n the layer 2 address of the new access point
     4060 * @param l3_ar_n the layer 3 address of the new access router
    40194061 */
    40204062void state_manager::process_aho_event(const string iface, macaddress &l2_ap_n, hostaddress &l3_ar_n) {
     
    40394081/**
    40404082 * Process event which indicates an occured network change
    4041  * @param new_address the new interface address
     4083 * @param iface the affected network interface
     4084 * @param l2_ap_n the layer 2 address of the new access point
     4085 * @param l3_ar_n the layer 3 address of the new access router
     4086 * @param l3_mn the new layer 3 address of the mobile node
    40424087 */
    40434088void state_manager::process_ho_event(const string iface, macaddress &l2_ap_n, hostaddress &l3_ar_n, hostaddress &l3_mn) {
     
    40724117        l3_ar_n = reinterpret_cast<hostaddress *>(param1);
    40734118        if(l3_ar_n == NULL) {
    4074                 ILog(state_manager::modname, "aho_phase_1: Missing parameter l3_ar_n!");
     4119                ERRLog(state_manager::modname, "aho_phase_1: Missing parameter l3_ar_n!");
    40754120                return;
    40764121        }
     
    41034148                DLog(state_manager::modname, "PC-MRI src address: " << pc_mri->get_sourceaddress());
    41044149                DLog(state_manager::modname, "PC-MRI dst address: " << pc_mri->get_destaddress());
    4105                 DLog(state_manager::modname, "PC-MRI downstream: " << (pc_mri->get_downstream() ? "true" : "false" ));
    4106                 DLog(state_manager::modname, "context->get_downstream(): " << (down ? "true" : "false" ));
     4150                DLog(state_manager::modname, "PC-MRI downstream: " << (pc_mri->get_downstream() ? "true" : "false"));
     4151                DLog(state_manager::modname, "context->get_downstream(): " << (down ? "true" : "false"));
     4152                DLog(state_manager::modname, "is_flow_source(): " << (is_flow_source(pc_mri) ? "true" : "false"));
     4153                DLog(state_manager::modname, "is_flow_destination(): " << (is_flow_destination(pc_mri) ? "true" : "false"));
    41074154               
    41084155
     
    41434190                // for the moment this is enough
    41444191                hostaddress orig_sig_addr;
     4192                /*
    41454193                if(down) {
    41464194                        orig_sig_addr = pc_mri->get_sourceaddress();
     
    41504198                        orig_sig_addr = pc_mri->get_destaddress();
    41514199                        pc_mri->set_destaddress(*l3_ar_n);
     4200                }
     4201                */
     4202                if(is_flow_source(pc_mri)) {
     4203                        orig_sig_addr = pc_mri->get_sourceaddress();
     4204                        pc_mri->set_downstream(true);
     4205                }
     4206                else if(is_flow_destination(pc_mri)) {
     4207                        orig_sig_addr = pc_mri->get_destaddress();
     4208                        pc_mri->set_downstream(false);
     4209                }
     4210                else {
     4211                        ERRLog(state_manager::modname, "AHO not implemented for case where mobile node isn't endpoint of a flow!");
     4212                        return;
    41524213                }
    41534214                mri_explicitsigtarget *est_mri = new mri_explicitsigtarget(*pc_mri, orig_sig_addr, *l3_ar_n);
Note: See TracChangeset for help on using the changeset viewer.