blob: 8e3e8df66bd29fbeeb4fcc1b43a16afdfd14b88d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
/* nhrp_interface.h - NHRP configuration per interface definitions
*
* Copyright (C) 2007 Timo Teräs <timo.teras@iki.fi>
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 or later as
* published by the Free Software Foundation.
*
* See http://www.gnu.org/ for details.
*/
#ifndef NHRP_INTERFACE_H
#define NHRP_INTERFACE_H
#include "nhrp_packet.h"
#include "nhrp_peer.h"
#define NHRP_INTERFACE_FLAG_NON_CACHING 0x0001 /* Do not cache entries */
#define NHRP_INTERFACE_FLAG_SHORTCUT 0x0002 /* Create shortcut routes */
#define NHRP_INTERFACE_FLAG_REDIRECT 0x0004 /* Send redirects */
#define NHRP_INTERFACE_FLAG_SHORTCUT_DEST 0x0008 /* Advertise routes */
#define NHRP_INTERFACE_FLAG_CONFIGURED 0x0010 /* Found in config file */
#define NHRP_INTERFACE_NBMA_HASH_SIZE 256
struct nhrp_interface {
struct list_head name_list_entry;
struct hlist_node index_list_entry;
/* Configured information */
char name[16];
unsigned int flags;
unsigned int holding_time;
struct nhrp_buffer *auth_token;
unsigned int route_table;
/* Cached from kernel interface */
unsigned int index, link_index;
uint32_t gre_key;
uint16_t afnum;
uint16_t mtu, nbma_mtu;
struct nhrp_address nbma_address;
struct nhrp_cie nat_cie;
/* Actually, we should have list of protocol addresses;
* we might have multiple address and multiple protocol types */
struct nhrp_address protocol_address;
int protocol_address_prefix;
/* Peer cache is interface specific */
struct list_head peer_list;
struct hlist_head nbma_hash[NHRP_INTERFACE_NBMA_HASH_SIZE];
/* Multicast related stuff */
struct list_head mcast_list;
int mcast_mask;
int mcast_numaddr;
struct nhrp_address *mcast_addr;
};
typedef int (*nhrp_interface_enumerator)(void *ctx, struct nhrp_interface *iface);
void nhrp_interface_cleanup(void);
void nhrp_interface_hash(struct nhrp_interface *iface);
int nhrp_interface_foreach(nhrp_interface_enumerator enumerator, void *ctx);
struct nhrp_interface *nhrp_interface_get_by_name(const char *name, int create);
struct nhrp_interface *nhrp_interface_get_by_index(unsigned int index, int create);
struct nhrp_interface *nhrp_interface_get_by_nbma(struct nhrp_address *addr);
struct nhrp_interface *nhrp_interface_get_by_protocol(struct nhrp_address *addr);
int nhrp_interface_run_script(struct nhrp_interface *iface, char *action);
struct nhrp_peer *nhrp_interface_find_peer(struct nhrp_interface *iface, const struct nhrp_address *nbma);
void nhrp_interface_resolve_nbma(struct nhrp_interface *iface,
struct nhrp_address *nbmadest,
struct nhrp_address *nbma);
#endif
|