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

Changeset 4450


Ignore:
Timestamp:
Sep 22, 2009, 5:23:44 PM (8 years ago)
Author:
stud-dettling
Message:
  • Added network notification module and network notification client (nwnclient).
Location:
ntlp/branches/20090610-qos-nslp-aho
Files:
4 added
9 edited

Legend:

Unmodified
Added
Removed
  • ntlp/branches/20090610-qos-nslp-aho/Makefile

    r3184 r4450  
    6868
    6969gist:
    70         $(MAKE) -C $(GIST_SRC) -$(MAKEFLAGS)
     70        $(MAKE) -C $(GIST_SRC)
    7171
    7272setperms:
    73         $(MAKE) -C $(GIST_SRC) -$(MAKEFLAGS) setperms
     73        $(MAKE) -C $(GIST_SRC) setperms
    7474
    7575libs:
    76         $(MAKE) -C $(GIST_SRC) -$(MAKEFLAGS) libs
     76        $(MAKE) -C $(GIST_SRC) libs
    7777
    7878test: gist
    79         $(MAKE) -C $@ -$(MAKEFLAGS) test
     79        $(MAKE) -C $@ test
    8080
    8181tests:
    82         for dir in $(MKSUBDIRS); do $(MAKE) -C $$dir -$(MAKEFLAGS) tests ; done
     82        for dir in $(MKSUBDIRS); do $(MAKE) -C $$dir tests ; done
    8383
    8484docs:
     
    102102
    103103clean: localclean
    104         for dir in $(MKSUBDIRS); do $(MAKE) -C $$dir -$(MAKEFLAGS) clean ; done
     104        for dir in $(MKSUBDIRS); do $(MAKE) -C $$dir clean ; done
    105105
    106106distclean: clean localclean cleandocs
    107         - for dir in $(MKSUBDIRS); do $(MAKE) -C $$dir -$(MAKEFLAGS) distclean ; done
     107        - for dir in $(MKSUBDIRS); do $(MAKE) -C $$dir distclean ; done
    108108
    109109distrib: distclean README
     
    136136
    137137depend:
    138         - for dir in $(MKSUBDIRS); do $(MAKE) -C $$dir -$(MAKEFLAGS) depend ; done
     138        - for dir in $(MKSUBDIRS); do $(MAKE) -C $$dir depend ; done
    139139
    140140freshdepend:
    141         - for dir in $(MKSUBDIRS); do $(MAKE) -C $$dir -$(MAKEFLAGS) freshdepend ; done
     141        - for dir in $(MKSUBDIRS); do $(MAKE) -C $$dir freshdepend ; done
    142142
    143143$(TOPLEVELMAKEINC):
  • ntlp/branches/20090610-qos-nslp-aho/include/apimessage.h

    r3565 r4450  
    193193            route_changed_status_home_binding,
    194194            route_changed_status_binding
     195
     196#ifdef USE_AHO
     197            ,
     198            anticipated_handover_event,
     199            handover_event
     200#endif
    195201        }; // end error_t
    196202
     
    229235        void set_messagestatus(uint32 nslpid, sessionid* sid, msghandle_t nslpmsghandle, tx_attr_t tx_attr, error_t error);
    230236        void set_networknotification(uint32 nslpid, sessionid* sid, mri* mr, error_t notify, uint32 sii_handle=0);
     237#ifdef USE_AHO
     238        void set_networknotification(nslpdata* data, uint32 nslpid, sessionid* sid, mri* mr, error_t notify, uint32 sii_handle=0);
     239#endif
    231240        void set_setstatelifetime(mri* mr, uint32 state_lifetime);
    232241        void set_invalidateroutingstate(uint32 nslpid, mri* mr, status_t status, bool urgent);
  • ntlp/branches/20090610-qos-nslp-aho/include/ntlp_global_constants.h

    r2639 r4450  
    4141  extern const char *const gist_unix_domain_socket_defaultpath;
    4242  extern const char *const gist_configfilename;
     43#ifdef USE_AHO
     44  extern const char *const gist_nwn_unix_domain_socket_defaultpath;
     45#endif
    4346
    4447#ifndef NTLP_GLOBAL_CONSTANTS_CPP
  • ntlp/branches/20090610-qos-nslp-aho/src/Makefile

    r3701 r4450  
    1414#     DEBUGGING      Enable debugging (default: active)
    1515#     OPTIMIZATION   Optimize using the given flags (default: '')
     16#     USE_AHO        Enable NetworkNotificationModule
    1617#
    1718# Don't forget to run "make clean" before changing these variables!
     
    6364NTLPEXE         = gistka
    6465
     66# maybe obsolete ??
    6567TARGETS = $(NTLPEXE) test_objectpool libs
    6668
     
    7072NTLP_PDUOBJS := $(patsubst %.cpp,%.o,$(NTLP_PDUSRC))
    7173
    72 TMP_NTLP_SRCS =  $(wildcard *.cpp) $(NTLP_PDUSRC)
     74TMP1_NTLP_SRCS =  $(wildcard *.cpp) $(NTLP_PDUSRC)
     75
    7376ifndef USE_FLOWINFO
    74 NTLP_SRCS = $(filter-out flowinfo.cpp, $(TMP_NTLP_SRCS))
     77TMP2_NTLP_SRCS = $(filter-out flowinfo.cpp, $(TMP1_NTLP_SRCS))
    7578else
    76 NTLP_SRCS = $(TMP_NTLP_SRCS)
     79TMP2_NTLP_SRCS = $(TMP1_NTLP_SRCS)
    7780CFLAGS += $(FLOWINFO_CFLAGS)
    7881endif
     82
     83
     84ifeq ($(USE_AHO), 1)
     85TMP3_NTLP_SRCS = $(TMP2_NTLP_SRCS)
     86CFLAGS += -D USE_AHO
     87else
     88TMP3_NTLP_SRCS = $(filter-out network_notification_module.cpp, $(TMP2_NTLP_SRCS))
     89endif
     90NTLP_SRCS = $(filter-out nwnclient.cpp, $(TMP3_NTLP_SRCS))
     91
     92
    7993NTLP_OBJS=  $(patsubst %.cpp,%.o,$(NTLP_SRCS))
     94
    8095
    8196DEPENDFILE := $(wildcard dependfile)
     
    131146SUBDIRS = $(PROTLIB_SRC)
    132147
     148
     149TARGETS2 = protliblib $(GISTLIB) $(NTLPEXE)
     150ifeq ($(USE_AHO), 1)
     151TARGETS2 += nwnclient
     152endif
     153
     154
     155
    133156.SUFFIXES:      .cpp
    134157
     
    146169## ----------------------------------------------------------------------------------------------
    147170
    148 all:    protliblib $(GISTLIB) $(NTLPEXE)
     171#all:   protliblib $(GISTLIB) $(NTLPEXE) $(NWN_CLIENT)
     172all:    $(TARGETS2)
    149173 
    150174.PHONY: all protliblib
     
    165189        $(CPP) -shared -o $@ $?
    166190
     191nwnclient: nwnclient.o
     192        $(CPP) $(CFLAGS) -o $@ nwnclient.o
     193#       $(CPP) $(CFLAGS) -o $@ $@.cpp
     194
     195
    167196test_flowinfo: test_flowinfo.o $(GISTLIB) $(LIBS)
    168197        $(CPP) $(CFLAGS) -o $@ $^  -L . -lGIST $(LIBDIRS) $(SHLIBS) $(STATIC_LIBS)
     
    225254# always checks for new things in protlib subdirs
    226255protliblib:
    227                 $(MAKE) -C $(PROTLIB_SRC) -$(MAKEFLAGS) $(PROTLIB_MAKEFLAGS)
     256                $(MAKE) -C $(PROTLIB_SRC) $(PROTLIB_MAKEFLAGS)
    228257
    229258$(PROTLIB_LIB):
    230                 $(MAKE) -C $(PROTLIB_SRC) -$(MAKEFLAGS) $(PROTLIB_MAKEFLAGS) $(@F)
     259                $(MAKE) -C $(PROTLIB_SRC) $(PROTLIB_MAKEFLAGS) $(@F)
    231260
    232261$(FQUEUE_LIB):
    233                 $(MAKE) -C $(FQUEUE_DIR) -$(MAKEFLAGS)
     262                $(MAKE) -C $(FQUEUE_DIR)
    234263
    235264$(SCTP_LIB):
    236         $(MAKE) -C $(SCTP_DIR) -$(MAKEFLAGS)
     265        $(MAKE) -C $(SCTP_DIR)
    237266
    238267clean: 
    239                 $(RM) $(PDUDIR)/*.o *.o *~ \#*\# core $(INC)/*~ $(GISTLIB) $(GISTLIB_SHARED)
     268                $(RM) $(PDUDIR)/*.o *.o *~ \#*\# core $(INC)/*~ $(GISTLIB) $(GISTLIB_SHARED) nwnclient
    240269
    241270dellogs: 
  • ntlp/branches/20090610-qos-nslp-aho/src/apimessage.cpp

    r3420 r4450  
    155155            "route_changed_status_home_binding",
    156156            "route_changed_status_binding"
     157#ifdef USE_AHO
     158            ,
     159            "anticipated_handover_event",
     160            "handover_event"
     161#endif
    157162    };
    158163
     
    276281    }
    277282
     283    void APIMsg::set_networknotification(nslpdata* data, uint32 nslpid, sessionid* sid, mri* mr, error_t notice, uint32 sii_handle) {
     284
     285        set_networknotification(nslpid, sid, mr, notice, sii_handle);
     286
     287        //take over given objects/pointers
     288        payload_data=data;
     289
     290    }
     291
    278292    void APIMsg::set_setstatelifetime(mri* mr, uint32 state_lifetime){
    279293
  • ntlp/branches/20090610-qos-nslp-aho/src/ntlp_global_constants.cpp

    r2901 r4450  
    3939const char *const gist_unix_domain_socket_defaultpath="/tmp/gist";
    4040const char *const gist_configfilename="gist.conf";
     41#ifdef USE_AHO
     42  const char *const gist_nwn_unix_domain_socket_defaultpath="/tmp/gist_nwn";
     43#endif
    4144// =======================
    4245}
  • ntlp/branches/20090610-qos-nslp-aho/src/ntlp_starter.cpp

    r3701 r4450  
    8282#include "mri_le.h"
    8383#include "mri_est.h"
     84
     85#ifdef USE_AHO
     86#include "network_notification_module.h"
     87#endif
     88
    8489
    8590namespace ntlp {
     
    572577  }
    573578
     579#ifdef USE_AHO
     580  DLog(param.name, "Startup phase 10: Starting NetworkNotification Module");
     581
     582  NetworkNotificationModuleParam nwnpar(gist_nwn_unix_domain_socket_defaultpath);
     583  ThreadStarter<NetworkNotificationModule, NetworkNotificationModuleParam> nwnthread(1, nwnpar);
     584  nwnthread.start_processing();
     585#endif
     586
     587
    574588  ILog(param.name, color[green] << "Startup completed" << color[off]);
    575589
     
    585599  DLog(param.name, "Shutdown phase 1: Asking Modules to stop.");
    586600
     601#ifdef USE_AHO
     602  nwnthread.stop_processing();
     603#endif
    587604  udptpthread.stop_processing();
    588605  udstpthread.stop_processing();
     
    600617  DLog(param.name, "Shutdown phase 2: Forcing down leftover Modules");
    601618
     619#ifdef USE_AHO
     620  nwnthread.abort_processing(true);
     621#endif
    602622  udptpthread.abort_processing(true);
    603623  udstpthread.abort_processing(true);
     
    615635  DLog(param.name, "Shutdown phase 3: Waiting for threads to stop");
    616636
     637#ifdef USE_AHO
     638  nwnthread.wait_until_stopped();
     639#endif
    617640  udptpthread.wait_until_stopped();
    618641  udstpthread.wait_until_stopped();
  • ntlp/branches/20090610-qos-nslp-aho/src/ntlp_statemodule.h

    r3405 r4450  
    4646#include "authorized_peer_db.h"
    4747#include "flowinfo.h"
     48#ifdef USE_AHO
     49#include "network_notification_module.h"
     50#endif
    4851
    4952// forward declaration from timer_module.h
     
    253256  /// process mobility events
    254257  void process_mobility_msg(MobilityMsg* mobmsg);
     258
     259#ifdef USE_AHO
     260  /// process handover events
     261  void process_handover_msg(HandoverMsg* homsg);
     262#endif
    255263       
    256264  /// check if a stackprofile is applicable
  • ntlp/branches/20090610-qos-nslp-aho/src/ntlp_statemodule_main.cpp

    r3568 r4450  
    4949#ifdef USE_FLOWINFO
    5050#include "flowinfo.h"
     51#endif
     52#ifdef USE_AHO
     53#include "network_notification_module.h"
     54#include "nwn_uds_msg.h"
     55#include "nslpdata.h"
    5156#endif
    5257
     
    230235  MobilityMsg *mobmsg = NULL;
    231236#endif
     237#ifdef USE_AHO
     238  HandoverMsg *homsg = NULL;
     239#endif
    232240  // maximum wait period (in ms) at queue
    233241  uint32 wait= param.sleep_time;
     
    320328            delete msg;
    321329          } // end if mobmsg
     330          break;
     331#endif
     332
     333#ifdef USE_AHO
     334        case message::type_handover:
     335          // -----------------------
     336          homsg= dynamic_cast<HandoverMsg*>(msg);
     337          if (homsg)
     338          {
     339            // =====================================================
     340            process_handover_msg(homsg);
     341            // =====================================================
     342          }
     343          else
     344          {
     345            Log(ERROR_LOG,LOG_ALERT, param.name,
     346                "Cannot cast message from "
     347                << msg->get_qaddr_name() << " of " << msg->get_type_name() << " to HandoverMsg");
     348           
     349            delete msg;
     350          } // end if homsg
    322351          break;
    323352#endif
     
    491520}
    492521
     522#ifdef USE_AHO
     523/**
     524 * process handover events dispatched from the unix domain socket interface
     525 * @param homsg -- the message to process
     526 */
     527void
     528Statemodule::process_handover_msg(HandoverMsg* homsg)
     529{
     530  const struct nwn_uds_msg uds_msg = homsg->get_uds_msg();
     531  nslpdata *data = new nslpdata((uchar *)&uds_msg, sizeof(uds_msg));
     532
     533  // Send a NetworkNotification to all registered NSLPs
     534  api_iter cur = param.nslptable.nslptable.begin();
     535  while (cur != param.nslptable.nslptable.end()) {
     536                APIMsg* msg = new APIMsg;
     537                msg->set_source(message::qaddr_coordination);
     538
     539                if (uds_msg.nwn_msg_type == NWN_MSG_TYPE_AHO) {
     540                        msg->set_networknotification(data, (*cur).first, 0, NULL,
     541                                        APIMsg::anticipated_handover_event, 0);
     542                }
     543                else if (uds_msg.nwn_msg_type == NWN_MSG_TYPE_HO) {
     544                        msg->set_networknotification(data, (*cur).first, 0, NULL,
     545                                        APIMsg::handover_event, 0);
     546                }
     547
     548                msg->send_to((*cur).second);
     549
     550                if (uds_msg.nwn_msg_type == NWN_MSG_TYPE_AHO) {
     551                        EVLog(param.name, color[yellow] << "NetworkNotification passed to NSLP instance at address "<< (*cur).second << ": " << msg->get_error_str(APIMsg::anticipated_handover_event) << color[off]);
     552                }
     553                else if (uds_msg.nwn_msg_type == NWN_MSG_TYPE_HO) {
     554                        EVLog(param.name, color[yellow] << "NetworkNotification passed to NSLP instance at address "<< (*cur).second << ": " << msg->get_error_str(APIMsg::handover_event) << color[off]);
     555                }
     556
     557                cur++;
     558        }
     559
     560  delete homsg; 
     561}
     562#endif // USE_AHO
     563
    493564/**
    494565 * Create a local NLI (take the right one from StatemoduleParam, modify RS_Validity_Time)
Note: See TracChangeset for help on using the changeset viewer.