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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
/*
* Copyright c Realtek Semiconductor Corporation, 2008
* All rights reserved.
*
* Program : route table driver
* Abstract :
* Author : hyking (hyking_liu@realsil.com.cn)
*/
#ifndef RTL865X_ROUTE_H
#define RTL865X_ROUTE_H
#include <net/rtl/rtl865x_route_api.h>
typedef struct rtl865x_route_s
{
struct rtl865x_route_s *next;
ipaddr_t ipAddr; /* Destination IP Address */
ipaddr_t ipMask; /* Network mask */
ipaddr_t nextHop; /* next hop IP address */
ipaddr_t srcIp; /* source IP address,only for multiple wan now*/
uint32 valid:1,
process:4, /* 000: PPPoE, 001: L2, 010: ARP, 100: CPU, 101: NextHop, 110: Drop*/
asicIdx:4;
uint32 ref_count; /*referrence count*/
rtl865x_netif_local_t *dstNetif; /*destination network interface*/
/* nexthop informaiton */
union {
struct
{
uint32 arpsta; /* ARP Table Starting address */
uint32 arpend; /* ARP Table Ending address */
uint32 arpIpIdx; /* External IP selection index */
} arp;
struct
{
void *macInfo; /*direct nexthop's mac information*/
}direct;
struct
{
void *macInfo; /*pppoe server's mac information*/
rtl865x_ppp_t *pppInfo;
}pppoe;
struct
{
uint32 nxtHopSta; /* pointer to Nexthop table: starting range */
uint32 nxtHopEnd; /* pointer to Nexthop table: ending range */
uint8 nhalog; /* algo. for load balance */
uint8 ipDomain; /* IP domain */
} nxthop;
} un;
} rtl865x_route_t;
#define RT_DEFAULT_RT_NEXTHOP_CPU 0x00
#define RT_DEFAULT_RT_NEXTHOP_NORMAL 0x01
/* process: */
#define RT_PPPOE 0x00
#define RT_L2 0x01
#define RT_ARP 0x02
#define RT_CPU 0x04
#define RT_NEXTHOP 0x05
#define RT_DROP 0x06
/* nhalog: */
#define RT_ALOG_PACKET 0x00
#define RT_ALOG_SESSION 0x01
#define RT_ALOG_SIP 0x02
/* ipDomain: */
#define RT_DOMAIN_4_1 0x00
#define RT_DOMAIN_4_2 0x01
#define RT_DOMAIN_4_3 0x02
#define RT_DOMAIN_4_4 0x03
#define RT_DOMAIN_8_1 0x04
#define RT_DOMAIN_8_2 0x05
#define RT_DOMAIN_16_1 0x06
int32 rtl865x_initRouteTable(void);
int32 rtl865x_reinitRouteTable(void);
//int32 rtl865x_addRoute(ipaddr_t ipAddr, ipaddr_t ipMask, ipaddr_t nextHop, int8 * ifName);
//int32 rtl865x_delRoute(ipaddr_t ipAddr, ipaddr_t ipMask);
int32 rtl865x_getRouteEntry(ipaddr_t dst, rtl865x_route_t *rt);
#if defined (CONFIG_RTL_LOCAL_PUBLIC)
int rtl865x_getLanRoute(rtl865x_route_t routeTbl[], int tblSize);
#endif
#endif
|