📄 olsr.h
字号:
#define HELLO_PACKET 1 /* neighborhood info */#define TC_PACKET 2 /* topology information */#define MID_PACKET 3 /* multiple interface Declaration */#define HNA_PACKET 4 /* host and netowrk info*/#define HELLO_REQUEST 5 /* to obtain neighborhood info */#define ROUTE_REQUEST 6 /* to obtain routing table contents */#define ROUTE_RESPONSE 7 /* routing table information */#define OLSRD_TRACEON 8 /* to enable trace fonctionnalities */#define OLSRD_TRACEOFF 9 /* to desable trace fonctionnalities */#define UPDATE_NEIGHBOR 10 /* to update the neighborhood *//* qos message type, added by Y.Ge */#define QOSHELLO_PACKET 11 /* message to inform HELLO sender's busy time */#define QOSTC_PACKET 12 /* message to imform TC originator and MPR selector's busy time */#define OLSRTYPE_MAX 13 /*revised by Y.Ge, original value is 10 */#ifdef OLSRTYPESchar *olsrtypes[OLSRTYPE_MAX] = { "#0", "HELLO MSG", "TC MSG", "MID MSG", "HNA MSG", "HELLO REQUEST", "ROUTE REQUEST", "ROUTE RESPONSE", "TRACE ON MSG", "TRACE OFF MSG", "UPDATE NEIGHBORHOOD MSG", "QOSHELLO MSG", "QOSTC MSG"}; /* revised by Y.Ge based on the definition above */#endif#define MSG_NOBROADCAST 0 /* don't broadcast the msg */#define MSG_BROADCAST 1 /* msg to broadcast */#define HOPCNT_MAX 255 /* changed by Y.Ge. Original value: 16. maximum hops number */#define MAXPACKETSIZE 256 /* max broadcast size */#define MAXVALUE 65535 /* added by Y.Ge, the maximum possible value of sequence numbe -- 2^16-1 *//*CRC HNA add-------------------------------------------------*/#define PREFIXLEN 64 /*network prefix length*/#define GW_PREFIXLEN 0/************* added by Y.Ge **************//* scaling factor to compute vtime */#define SCALING_FACTOR 16/* constants used in hysteresis */#define HYST_SCALING 0.5#define HYST_THRESHOLD_HIGH 0.8#define HYST_THRESHOLD_LOW 0.3/*********** end of revision *************/ /* * Timer values used in managing the routing table. * Neighbor tables are broadcast every HELLO_INTERVAL seconds and topology * tables every TC_INTERVAL. * If changes occur in the MPR Selector set, the next TC information is * sent after TC_MIN_INTERVAL, time starting from the time the last TC * message was sent. * Every update of a neighbor or topology entry forces an entry's timer * to be reset. * After .._HOLD_TIME without updates,the entry is delete. */#define TIMER_RATE 2 /* alarm clocks every 2 seconds */#define HELLO_INTERVAL 2 /* time to supply neighbor database */#define REFRESH_INTERVAL 2 /* added by Y.Ge */#define TC_INTERVAL 5 /* time to supply topology informations */#define MIN_TC_INTERVAL 2 /* min. interval to broadcast topology changes */#define MAX_TC_INTERVAL MIN_TC_INTERVAL /* max. time to delay topology changes */#define HNA_INTERVAL TC_INTERVAL /* time to supple host and network info, revised by Y.Ge according to olsr_v11, the original value is 2 */ #define MID_INTERVAL TC_INTERVAL /* added by Y.Ge *//*#define NEIGHB_HOLD_TIME 20*/ /* time to delete entry in neighbor table */#define NEIGHB_HOLD_TIME (3 * REFRESH_INTERVAL) /*time to delete entry in neighbor table, revised by Y.Ge based on olsr_v11, the original value is 6 */#define TOP_HOLD_TIME (3 * TC_INTERVAL) /* time to delete entry in topology table, revised by Y.Ge based on olsr_v11, the original value is 16 */#define DUPLICATE_HOLD_TIME 30 /* revised by Y.Ge based on olsr_v11, the originaal value is (2 * TC_INTERVAL)*/ #define MID_HOLD_TIME (3 * MID_INTERVAL) /* added by Y.Ge */#define MINUS_TIME -1 /* added by Y.Ge *///CRC HNA add#define HNA_HOLD_TIME (3 * HNA_INTERVAL) /* time to delete hna entry in routing table, revised by Y.Ge based on olsr_v11, the original value is 20 */#define HNA_DUPLICATE_HOLD_TIME 10#endif /* protocols/olsrd.h */struct neighbor_2_list_entry *olsr_find_2_hop_neighbors_with_1_link();struct iface_addr_list_entry*olsr_find_will_always_neighbor(); //added by Y.Geintolsr_chosen_mpr(struct neighbor_entry *one_hop_neighbor,olsr_u16_t *two_hop_covered_count);voidolsr_calculate_neighbors(olsr_u16_t *two_hop_count);struct neighbor_entry *olsr_find_maximum_covered(int willingness); //"willingness" is added by Y.Gevoidolsr_calculate_mpr();/************** added by Y.Ge ************//*** compute vtime ***/olsr_u8_tolsr_compute_vtime (int input_time);floatolsr_compute_time_from_vtime (olsr_u8_t vtime_value);/************* end of revision **********/intolsr_timed_out(struct timeval *timer);voidolsr_init_timer(olsr_u32_t time_value,struct timeval *hold_timer);/************* added by Y.Ge ************/voidolsr_assign_timer(const struct timeval *given_timer, struct timeval *change_timer);voidtimerminus (struct timeval *change_timer);olsr_u8_tcompare_timer(const struct timeval *timer_a, const struct timeval *timer_b);/************* end of revision **********/voidolsr_linking_this_2_entries(struct neighbor_entry *neighbor,struct neighbor_2_entry *two_hop_neighbor);voidolsr_linking_neighbor_main_neighbor(struct neighbor_entry *neighbor,struct main_addr_neigh_entry *main_address_neighbor); //added by Y.Geintolsr_lookup_my_own_address (struct olsr_ip_addr *rcvd_interface_addr); //added by Y.Ge. IF the address is one of my interface address, RETURN 1; otherwise, RETURN 0voidolsr_process_message_neighbors(struct neighbor_entry *neighbor,struct hello_message *message, int iface_index); //"iface_index" is addedd by Y.Geintolsr_process_received_hello_no_hyst(struct hello_message *message, int index); //added by Y.Geintolsr_process_received_hello_with_hyst(struct hello_message *message, int index); //added by Y.Geintolsr_process_received_hello(struct hello_message *message, int index); //"index" added by Y.Ge, the interface index the HELLO is received/* qos OLSR */intolsr_process_received_qos_hello (int index, struct qos_hello_message *message); //added by Y.Geintolsr_process_received_qos_tc(int index, struct tc_message *message,struct tc_message **message_out, struct qos_tc_message *qosmessage, struct qos_tc_message **qosmessage_out); //added by Y.Geintolsr_process_received_tc(int index, struct tc_message *message,struct tc_message **message_out); //"index" added by Y.Ge, the interface index the HELLO is receivedintolsr_process_received_mid (int index, struct mid_message *message, struct mid_message **message_out); //added by Y.Ge//CRC HNA add/*--------------------------------------------------------------------------*/struct hna_net_addr*olsr_lookup_default_gateway(struct hna_message* message);voidolsr_config_care_of_address(struct hna_message* message);voidolsr_wait_route_table_clear();voidolsr_send_radvd(struct olsr_ip_addr* radvdaddr);voidolsr_process_received_default_gateway(struct hna_message* message);voidolsr_time_out_gw();intolsr_process_received_hna(int index, struct hna_message *message,struct hna_message **message_out);//"index" added by Y.Ge, the interface index the HNA is received/*---------------------------------------------------------------------------------*/voidolsr_delete_time_out_entries();voidolsr_release_tables(int number);voidolsr_init_tables();intolsr_build_hello_packet(struct hello_message *message, int iface_index); //"iface_index" is added by Y.Geintolsr_build_tc_packet(struct tc_message *message, int iface_index); //"iface_index" is added by Y.Geintolsr_build_qos_tc_packet(struct qos_tc_message *message, int iface_index); //added by Y.Ge, qos OLSRintolsr_build_mid_packet (struct mid_message *message, int iface_index); //added by Y.Geintolsr_build_routing_packet(struct rt_message **message);voidolsr_print_tables();char *convert_sockaddr_to_string(struct sockaddr *address_to_convert);voidolsr_hashing(struct olsr_ip_addr *address,olsr_u32_t *h);char *convert_address_to_string(const struct olsr_ip_addr *address);voidolsr_init_trace_route_file();voidolsr_init_trace_hysteresis_file();/* float hysteresis (float, short unsigned int, short unsigned int); */ //commented by Y.Gefloat hysteresis (float, int); //added by Y.Geint wrap_around_compare (int, int);// added by Y.Ge, IF s1 > s2, RETURN 1; IF s1 < s2 RETURN -1; IF s1 = s2, RETURN 0int olsr_forward_unknown_packets (int message_type, struct olsr_ip_addr *sender, struct olsr_ip_addr *originator, int message_seq, int index); //added by Y.Ge//CRC add for HNA/*-------------------------------------------------------------------------------*/voidolsr_time_out_hna();voidmobile_start_hello();voidexecute_radvd();/*-------------------------------------------------------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -