📄 tunnel.h
字号:
/* $Id: tunnel.h,v 1.34 2001/02/25 09:37:22 jm Exp $ * Tunnel interface header * * Dynamic hierarchial IP tunnel * Copyright (C) 1998-2001, Dynamics group * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. See README and COPYING for * more details. */#ifndef TUNNEL_H#define TUNNEL_H#include <net/if.h> /* for IFNAMSIZ */#include <sys/time.h>#include <unistd.h>#include "message.h"#include "hashtable.h"#define TUNNEL_NO_ENCAPS 0#define TUNNEL_IPIP 1#define TUNNEL_GRE 2#define TUNNEL_NOT_CONNECTED 0#define TUNNEL_UP 1#define TUNNEL_DOWN 2/* how often (interval in seconds) delayed deletion checking should be forced * (can be done more often if agent is processing commands) */#define TUNNEL_DELAYED_CHECK_INTERVAL 3struct tunnel { struct node hashnode; char device[IFNAMSIZ]; /* tunnel device name */ int number; /* tunnel device number */ struct in_addr dst_addr; /* destination of the tunnel */ int to_ha_table_id; /* routing table which has a default * route to this tunnel (MN=>HA data) * -1 = no routing table associated */ int to_mn_table_id; /* routing table which has the MN host routes for * data from this tunnel * -1 = no routing table associated */ int ref; /* number of references to this tunnel (do not remove the * tunnel, if greater than zero */ struct timeval zero_ref_tstamp; /* delay tunnel deletion */ int type; /* IPIP, GRE */ __u32 key; /* key for GRE tunnels */ int direction; /* TUNNEL_UP / TUNNEL_DOWN for connected tunnels */ int do_not_remove; /* 1 = leave the tunnel up even if ref == 0 * (used mainly for the default IPIP up tunnel in * the lower FAs) */};struct tunnel_key { struct in_addr dst_addr; /* destination of the tunnel */ int type; /* IPIP, GRE */ __u32 key; /* key for GRE tunnels */};typedef struct tunnel TUNNEL;typedef struct hashtable HASH;HASH *tunnel_init(char *start_dev, int table_start, int table_end);int tunnel_destroy_hash(HASH *hash);void tunnel_check_delayed(HASH *hash, int force);int tunnel_delete_ptr(TUNNEL *data, int force);int tunnel_delete(HASH *hash, struct in_addr dst_addr, int force, int type, __u32 key);TUNNEL *tunnel_fetch(HASH *hash, struct in_addr dst_addr, int type, __u32 key);TUNNEL *tunnel_add(HASH *hash, struct in_addr dst_addr, char *dev, struct in_addr local_addr, int set_link_up, int type, int key);void tunnel_set_remove(TUNNEL *tunl, int remove);void tunnel_set_remove_all(HASH *hash, struct in_addr dst_addr);int tunnel_connect(TUNNEL *up, TUNNEL *down, struct in_addr mn_addr, int reverse, char *force_route_dev, char *force_reverse_dev);int tunnel_unconnect(TUNNEL *up, TUNNEL *down, struct in_addr mn_addr, int reverse, int force, char *force_route_dev, char *force_reverse_dev);int tunnel_delayed_exists(HASH *hash);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -