collect-neighbor.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 #ifndef __COLLECT_NEIGHBOR_H__
00053 #define __COLLECT_NEIGHBOR_H__
00054
00055 #include "net/rime/rimeaddr.h"
00056 #include "net/rime/collect-link-estimate.h"
00057 #include "lib/list.h"
00058
00059 struct collect_neighbor_list {
00060 LIST_STRUCT(list);
00061 struct ctimer periodic;
00062 };
00063
00064 struct collect_neighbor {
00065 struct collect_neighbor *next;
00066 rimeaddr_t addr;
00067 uint16_t rtmetric;
00068 uint16_t age;
00069 uint16_t le_age;
00070 struct collect_link_estimate le;
00071 struct timer congested_timer;
00072 };
00073
00074 void collect_neighbor_init(void);
00075
00076 list_t collect_neighbor_list(struct collect_neighbor_list *neighbor_list);
00077
00078 void collect_neighbor_list_new(struct collect_neighbor_list *neighbor_list);
00079
00080 int collect_neighbor_list_add(struct collect_neighbor_list *neighbor_list,
00081 const rimeaddr_t *addr, uint16_t rtmetric);
00082 void collect_neighbor_list_remove(struct collect_neighbor_list *neighbor_list,
00083 const rimeaddr_t *addr);
00084 struct collect_neighbor *collect_neighbor_list_find(struct collect_neighbor_list *neighbor_list,
00085 const rimeaddr_t *addr);
00086 struct collect_neighbor *collect_neighbor_list_best(struct collect_neighbor_list *neighbor_list);
00087 int collect_neighbor_list_num(struct collect_neighbor_list *neighbor_list);
00088 struct collect_neighbor *collect_neighbor_list_get(struct collect_neighbor_list *neighbor_list, int num);
00089 void collect_neighbor_list_purge(struct collect_neighbor_list *neighbor_list);
00090
00091 void collect_neighbor_update_rtmetric(struct collect_neighbor *n,
00092 uint16_t rtmetric);
00093 void collect_neighbor_tx(struct collect_neighbor *n, uint16_t num_tx);
00094 void collect_neighbor_rx(struct collect_neighbor *n);
00095 void collect_neighbor_tx_fail(struct collect_neighbor *n, uint16_t num_tx);
00096 void collect_neighbor_set_congested(struct collect_neighbor *n);
00097 int collect_neighbor_is_congested(struct collect_neighbor *n);
00098
00099 uint16_t collect_neighbor_link_estimate(struct collect_neighbor *n);
00100 uint16_t collect_neighbor_rtmetric_link_estimate(struct collect_neighbor *n);
00101 uint16_t collect_neighbor_rtmetric(struct collect_neighbor *n);
00102
00103
00104 #endif
00105
00106