XenevaOS
Loading...
Searching...
No Matches
route.h
Go to the documentation of this file.
1
30#ifndef __ROUTE_H__
31#define __ROUTE_H__
32
33#include <stdint.h>
34#include <Net/ipv6.h>
35#include <Fs/vfs.h>
36
37/* Route flags (bitmask). */
38#define RTF_UP 0x01
39#define RTF_HOST 0x02
40#define RTF_GATEWAY 0x04
41#define RTF_LOCAL 0x08
42#define RTF_CONNECTED 0x10
43
44/* Simple Route table entry structure */
53
62
67
68/* Output of an IPv4 FIB lookup (RFC 1122 / 1812 next-hop). */
75
82
83/*
84 * AuRouteTableInitialise -- initialise the kernel route
85 * table
86 */
87extern void AuRouteTableInitialise();
88
89/*
90 * AuRouteTableCreateEntry -- create a new route table
91 * entry and return
92 */
94
95/*
96 * AuRouteTableAdd -- add an entry to route
97 * table
98 * @param entry -- Entry to add
99 */
101
102/*
103 * AuRouteTableDelete -- delete an entry from
104 * route table
105 * @param entry -- entry to delete
106 */
108
109/*
110 * AuRouteSetFlag4 -- set or clear RTF_UP on one IPv4 route.
111 * Two default routes share a prefix; the first RTF_UP entry wins.
112 */
113AU_EXTERN AU_EXPORT int AuRouteSetFlag4(const char* ifname, uint32_t dest, uint32_t netmask, int up);
114
115/*
116 * AuRouteTableGetNumEntry -- returns the number
117 * route entry present in the system
118 */
119extern int AuRouteTableGetNumEntry();
120
121/*
122 * AuRouteTablePopulate -- populates a given memory pointer with
123 * route table entry indexed by entryIndex number
124 * @param whereToPopulate -- memory pointer where to populate
125 * with an entry
126 * @param entryIndex -- entry index number
127 */
128extern void AuRouteTablePopulate(AuRouteEntry* whereToPopulate, int entryIndex);
129
130/*
131 * AuRouteTableDoRouteLookup -- takes the decision on taking
132 * the best route
133 * @param address -- address to take for routing
134 */
136
137/*
138 * AuRouteLookup4 -- fill AuRouteResult for dest (NULL entry on miss).
139 */
140extern int AuRouteLookup4(uint32_t address, AuRouteResult* out);
141
142/*
143 * AuRouteTable6Initialise -- initialise IPv6 route table
144 */
145extern void AuRouteTable6Initialise();
146
151extern int AuRouteLookup6(const ip6_addr* address, AuRouteResult6* out);
152#endif
#define AU_EXTERN
Definition aurora.h:54
#define AU_EXPORT
Definition aurora.h:40
#define out(...)
Definition main.cpp:65
unsigned int uint32_t
Definition acefiex.h:163
unsigned char uint8_t
Definition acefiex.h:161
void AuRouteSetFlag4(void)
@ up
Definition p_spec.h:261
void(* entry)(void *)
Definition process.h:101
struct _route_entry_ AuRouteEntry
void AuRouteTableDelete(AuRouteEntry *entry)
AuRouteTableDelete – delete an entry from route table (including default 0/0).
Definition route.cpp:106
struct _route_entry_info_ AuRouteEntryInfo
int AuRouteLookup4(uint32_t address, AuRouteResult *out)
Definition route.cpp:180
int AuRouteLookup6(const ip6_addr *address, AuRouteResult6 *out)
Definition route.cpp:230
int AuRouteTableGetNumEntry()
AuRouteTableGetNumEntry – returns the number route entry present in the system.
Definition route.cpp:126
void AuRouteTableAdd(AuRouteEntry *entry)
AuRouteTableAdd – add an entry to route table. Allows default route (dest==0 && netmask==0)....
Definition route.cpp:74
struct _au_route_result_ AuRouteResult
AuRouteEntry6 * AuRouteTable6CreateEntry()
Definition route.cpp:203
void AuRouteTablePopulate(AuRouteEntry *whereToPopulate, int entryIndex)
AuRouteTablePopulate – populates a given memory pointer with route table entry indexed by entryIndex ...
Definition route.cpp:130
struct _route_entry6_ AuRouteEntry6
void AuRouteTable6Initialise()
Definition route.cpp:199
struct _au_route_result6_ AuRouteResult6
void AuRouteTable6Add(AuRouteEntry6 *entry)
Definition route.cpp:211
void AuRouteTable6Delete(AuRouteEntry6 *entry)
Definition route.cpp:221
AuRouteEntry * AuRouteTableDoRouteLookup(uint32_t address)
AuRouteTableDoRouteLookup – longest-prefix match; skip !RTF_UP. Prefer LOCAL over CONNECTED over defa...
Definition route.cpp:152
AuRouteEntry * AuRouteTableCreateEntry()
AuRouteTableCreateEntry – create a new route table entry and return.
Definition route.cpp:63
void AuRouteTableInitialise()
AuRouteTableInitialise – initialise the kernel route table.
Definition route.cpp:55
AuRouteEntry6 * AuRouteTableDoRouteLookup6(const ip6_addr *address)
Definition route.cpp:225
Definition vfs.h:129
Definition route.h:76
uint8_t flags
Definition route.h:80
AuVFSNode * nic
Definition route.h:78
ip6_addr nexthop
Definition route.h:79
AuRouteEntry6 * entry
Definition route.h:77
Definition route.h:69
AuVFSNode * nic
Definition route.h:71
uint8_t flags
Definition route.h:73
uint32_t nexthop
Definition route.h:72
AuRouteEntry * entry
Definition route.h:70
Definition ipv6.h:45
Definition route.h:54
ip6_addr gateway
Definition route.h:59
uint8_t prefixLen
Definition route.h:57
ip6_addr dest
Definition route.h:56
ip6_addr ifaddress
Definition route.h:58
char * ifname
Definition route.h:55
uint8_t flags
Definition route.h:60
Definition route.h:45
uint32_t gateway
Definition route.h:50
uint32_t netmask
Definition route.h:48
uint32_t ifaddress
Definition route.h:49
char * ifname
Definition route.h:46
uint32_t dest
Definition route.h:47
uint8_t flags
Definition route.h:51
Definition route.h:63
int index
Definition route.h:64
void * route_entry
Definition route.h:65