📄 route_cache.h
字号:
/* this file implements the data structure for storing the route cache.* It is basically a linked list.* This code has been modified from the flood_id_queue.c of NIST's kernel-AODV* implementation by Luke Klein-Berndt.* --Vikas Kawadia May 19,2002*/ #ifndef ROUTE_CACHE_H#define ROUTE_CACHE_H#include <linux/module.h>#include <linux/kernel.h>#include <linux/skbuff.h>#include <linux/in.h>#include "utils.h"/* an entry of the route cache */struct route_cache_entry{ u_int32_t dst_ip; // destination ip of the packet u_int64_t last_use_time; // time route was last used int valid_flag; struct route_cache_entry *prev; struct route_cache_entry *next;};/* initialize the cache */int init_route_cache( void );/* find an entry based on dst_ip */// needed to update the last_use_time whenever neededstruct route_cache_entry *find_route_cache_entry(u_int32_t dst_ip, int vFlag);/* print the cache to system logs */void print_route_cache();/* you're right. free memory, clenaup etc */void cleanup_route_cache();/* insert a new entry in to the cache */int insert_route_cache_entry(u_int32_t dst_ip, u_int64_t last_use_time, int vFlag);/* output the stuff to /proc. Called when the proc file is read by somebody from userspace */int read_route_cache_proc(char *buffer, char **buffer_location, off_t offset, int buffer_length,int *eof,void *data);/*Route cache keeps on growing. So we need to keep a check on the size.This function deletes the entries whose last_use_time is older than EXPIRE_TIME defined in module.h.I dont know when to call this function. will think about it. --vikasFIXME*/void delete_old_route_cache_entries(void );#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -