Committer: Tim Just <tim.just@xxxxxxxxxxxxxx> Date: Tue Mar 02 15:48:42 2010 +0100 Revision: 3600 Revision-id: tim.just@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Branch nick: tiny Log: Relay and registration service now use libmodularization for maintenance. Modified: M hipd/hiprelay.c M hipd/hiprelay.h M hipd/init.c M hipd/maintenance.c M hipd/registration.c M hipd/registration.h === modified file 'hipd/hiprelay.c' --- hipd/hiprelay.c 2010-03-02 14:26:57 +0000 +++ hipd/hiprelay.c 2010-03-02 14:48:42 +0000 @@ -386,16 +386,18 @@ * @brief Clear the expired records from the relay hashtable. * */ -void hip_relht_maintenance() +int hip_relht_maintenance() { if (hiprelay_ht == NULL) { - return; + return 0; } unsigned int tmp = ((struct lhash_st *) hiprelay_ht)->down_load; ((struct lhash_st *) hiprelay_ht)->down_load = 0; hip_ht_doall(hiprelay_ht, (LHASH_DOALL_FN_TYPE) LHASH_DOALL_FN(hip_relht_rec_free_expired)); ((struct lhash_st *) hiprelay_ht)->down_load = tmp; + + return 0; } void hip_relht_free_all_of_type(const hip_relrec_type_t type) === modified file 'hipd/hiprelay.h' --- hipd/hiprelay.h 2010-02-22 18:30:02 +0000 +++ hipd/hiprelay.h 2010-03-02 14:48:42 +0000 @@ -300,7 +300,7 @@ * @todo a REG_RESPONSE with zero lifetime should be sent to each client whose * registration is cancelled. */ -void hip_relht_maintenance(void); +int hip_relht_maintenance(void); /** * Allocates a new relay record. === modified file 'hipd/init.c' --- hipd/init.c 2010-03-02 10:34:29 +0000 +++ hipd/init.c 2010-03-02 14:48:42 +0000 @@ -518,6 +518,9 @@ hip_init_handle_functions(); + hip_register_maint_function(&hip_relht_maintenance, 0); + hip_register_maint_function(&hip_registration_maintenance, 0); + #ifndef CONFIG_HIP_OPENWRT #ifdef CONFIG_HIP_DEBUG hip_print_sysinfo(); @@ -961,6 +964,8 @@ hip_uninit_handle_functions(); + hip_uninit_maint_functions(); + #ifdef CONFIG_HIP_OPPORTUNISTIC hip_oppdb_uninit(); #endif === modified file 'hipd/maintenance.c' --- hipd/maintenance.c 2010-03-02 14:26:57 +0000 +++ hipd/maintenance.c 2010-03-02 14:48:42 +0000 @@ -217,10 +217,6 @@ hip_run_maint_functions(); - hip_relht_maintenance(); - - hip_registration_maintenance(); - out_err: return err; === modified file 'hipd/registration.c' --- hipd/registration.c 2010-03-02 14:26:57 +0000 +++ hipd/registration.c 2010-03-02 14:48:42 +0000 @@ -85,11 +85,13 @@ * An expired pending requests is one that has not been deleted within * @c HIP_PENDING_REQUEST_LIFETIME seconds. */ -void hip_registration_maintenance() +int hip_registration_maintenance() { while (hip_del_pending_request_by_expiration() == 0) { ; } + + return 0; } /** === modified file 'hipd/registration.h' --- hipd/registration.h 2010-02-17 13:08:39 +0000 +++ hipd/registration.h 2010-03-02 14:48:42 +0000 @@ -53,7 +53,7 @@ * Uninitializes the services. Removes all pending requests. */ void hip_uninit_services(void); -void hip_registration_maintenance(void); +int hip_registration_maintenance(void); int hip_set_srv_status(uint8_t reg_type, hip_srv_status_t status); int hip_set_srv_min_lifetime(uint8_t reg_type, uint8_t lifetime); int hip_set_srv_max_lifetime(uint8_t reg_type, uint8_t lifetime);