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_DELAY,
00060 NS_PROBE,
00061 NS_REACHABLE
00062 } fip_nd6_nbrstate_t ;
00063
00064
00065 typedef struct {
00066 fip_ip6addr_t ipaddr;
00067 fip_lladdr_t lladdr;
00068 fip_nd6_nbrstate_t state;
00069 unsigned char isRouter: 1;
00070 } fip_nd6_neighbourCache_t;
00071
00072
00073 #define fip_nd6_neighbourCache_setState(index, newstate) \
00074 fip_neighbourCache[index].state = newstate
00075
00076 #define fip_nd6_neighbourCache_getPtr() fip_neighbourCache
00077
00078 #define fip_nd6_neighbourCache_setLLAddr(index, thislladdr, thislen) { \
00079 fip_memcpy_ucharLen(fip_neighbourCache[index].lladdr.addr, thislladdr, thislen); \
00080 fip_neighbourCache[index].lladdr.len = thislen; }
00081
00082 #define fip_nd6_neighbourCache_getLLAddrPtr(index) fip_neighbourCache[index].lladdr.addr
00083 #define fip_nd6_neighbourCache_getLLAddrLen(index) fip_neighbourCache[index].lladdr.len
00084
00085 #define fip_nd6_neighbourCache_setIPAddr(index, thisipaddr) \
00086 fip_memcpy_ucharLen(fip_neighbourCache[index].ipaddr.addr, (thisipaddr), 16)
00087
00088 #define fip_nd6_neighbourCache_setIsRouter(index, flag)\
00089 fip_neighbourCache[index].isRouter = flag
00090
00091
00092 #define fip_nd6_neighbourCache_lookupByIp(address) \
00093 fip_ds6_searchList( (unsigned char *)fip_nd6_neighbourCache_getPtr(), \
00094 sizeof(fip_nd6_neighbourCache_t), \
00095 FIP_CONF_ND6_MAX_NEIGHBOURS, \
00096 \
00097 offsetof(fip_nd6_neighbourCache_t, ipaddr), \
00098 \
00099 address, 16)
00100
00101 fip_nd6_index_t fip_nd6_neighbourCache_makeRoom(void);
00102
00103 extern fip_nd6_neighbourCache_t fip_neighbourCache[FIP_CONF_ND6_MAX_NEIGHBOURS];
00104
00105
00106 #endif
00107
00108