00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #ifndef FIP_ND6_DS_H_
00045 #define FIP_ND6_DS_H_
00046
00047 #include <stddef.h>
00048 #include "fip_ds6.h"
00049
00050
00051 typedef fip_ds6_index_t fip_nd6_index_t;
00052
00053 typedef fip_ds6_searchStatus_t fip_nd6_searchStatus_t;
00054
00055
00056 typedef enum {
00057 NS_UNUSED = 0,
00058 NS_STALE,
00059 NS_INCOMPLETE,
00060 NS_PROBE,
00061 NS_REACHABLE
00062 } fip_nd6_nbrstate_t ;
00063
00064
00065
00066 typedef struct {
00067 fip_nd6_nbrstate_t state;
00068 unsigned char isRouter: 1;
00069 unsigned char numEvents: 7;
00070 uint32_t nextEventTime32ms;
00071 fip_ip6addr_t ipaddr;
00072 fip_lladdr_t lladdr;
00073 } fip_nd6_neighbourCache_t;
00074
00075
00076
00077 #define fip_nd6_neighbourCache_getState(ifnum, index) fip_neighbourCache[ifnum][index].state
00078
00079 #define fip_nd6_neighbourCache_setState(ifnum, index, newstate) \
00080 fip_neighbourCache[ifnum][index].state = newstate
00081
00082 #define fip_nd6_neighbourCache_getPtr(ifnum) fip_neighbourCache[ifnum]
00083
00084 #define fip_nd6_neighbourCache_setLLAddr(ifnum, index, thislladdr, thislen) { \
00085 fip_memcpy_ucharLen(fip_neighbourCache[ifnum][index].lladdr.addr, thislladdr, thislen); \
00086 fip_neighbourCache[ifnum][index].lladdr.len = thislen; }
00087
00088 #define fip_nd6_neighbourCache_getLLAddrPtr(ifnum, index) fip_neighbourCache[ifnum][index].lladdr.addr
00089 #define fip_nd6_neighbourCache_getLLAddrLen(ifnum, index) fip_neighbourCache[ifnum][index].lladdr.len
00090
00091 #define fip_nd6_neighbourCache_setIPAddr(ifnum, index, thisipaddr) \
00092 fip_memcpy_ucharLen(fip_neighbourCache[ifnum][index].ipaddr.addr, (thisipaddr), 16)
00093
00094 #define fip_nd6_neighbourCache_getIPAddr(ifnum, index) fip_neighbourCache[ifnum][index].ipaddr
00095
00096
00097 #define fip_nd6_neighbourCache_setIsRouter(ifnum, index, flag)\
00098 fip_neighbourCache[ifnum][index].isRouter = flag
00099
00100 #define fip_nd6_neighbourCache_setNumEvents(ifnum, index, num) \
00101 fip_neighbourCache[ifnum][index].numEvents = num
00102
00103 #define fip_nd6_neighbourCache_getNumEvents(ifnum, index) fip_neighbourCache[ifnum][index].numEvents
00104
00105 #define fip_nd6_neighbourCache_setEventTime32ms(ifnum, index, time) \
00106 fip_neighbourCache[ifnum][index].nextEventTime32ms = time
00107
00108 #define fip_nd6_neighbourCache_getEventTime32ms(ifnum, index) \
00109 fip_neighbourCache[ifnum][index].nextEventTime32ms
00110
00111 fip_nd6_searchStatus_t fip_nd6_neighbourCache_lookupByIp(fip_ifnum_t ifnum, const fip_ip6addr_t * const address);
00112 void fip_nd6_neighbourCache_removeByIndex(fip_ifnum_t ifnum, unsigned char index);
00113 fip_nd6_index_t fip_nd6_neighbourCache_makeRoom(fip_ifnum_t ifnum);
00114 void fip_nd6_neighbourCache_updateLL(fip_ifnum_t ifnum, fip_nd6_index_t index, fip_llptraddr_t lladdr);
00115
00116 extern fip_nd6_neighbourCache_t fip_neighbourCache[FIP_CONF_MAX_INTERFACES][FIP_CONF_ND6_MAX_NEIGHBOURS];
00117
00118
00119
00120 #define MAX_ICMPV6_OPTIONS 10
00121
00122
00123 typedef struct
00124 {
00125 unsigned char type;
00126 unsigned char length;
00127 unsigned char offset;
00128 } fip_nd6_option_t;
00129
00130
00131 typedef struct
00132 {
00133 fip_nd6_option_t options[MAX_ICMPV6_OPTIONS];
00134 unsigned char numOpts;
00135 } fip_nd6_optionStruct_t ;
00136
00137
00138 #endif
00139
00140