Cleaning old .h :

- Delete unimplemented function and unused structures
- Remove misleading configuration options
- Transfer some comments from 6lowmac to framer-802154
(doc/uip6-doc.txt should be cleaned as well)
This commit is contained in:
Vincent Brillault 2011-07-11 12:04:52 +02:00
parent c699ccbe30
commit b0907f0344
4 changed files with 67 additions and 240 deletions

View file

@ -54,9 +54,24 @@
#define PRINTADDR(addr)
#endif
/** \brief The sequence number (0x00 - 0xff) added to the transmitted
* data or MAC command frame. The default is a random value within
* the range.
*/
static uint8_t mac_dsn;
static uint8_t initialized = 0;
/** \brief The 16-bit identifier of the PAN on which the device is
* sending to. If this value is 0xffff, the device is not
* associated.
*/
static const uint16_t mac_dst_pan_id = IEEE802154_PANID;
/** \brief The 16-bit identifier of the PAN on which the device is
* operating. If this value is 0xffff, the device is not
* associated.
*/
static const uint16_t mac_src_pan_id = IEEE802154_PANID;
/*---------------------------------------------------------------------------*/
@ -145,7 +160,7 @@ create(void)
/* Set the source PAN ID to the global variable. */
params.src_pid = mac_src_pan_id;
/*
* Set up the source address using only the long address mode for
* phase 1.

View file

@ -477,9 +477,9 @@ eventhandler(process_event_t ev, process_data_t data)
* check the different timers for neighbor discovery and
* stateless autoconfiguration
*/
/*if(data == &uip_nd6_timer_periodic &&
etimer_expired(&uip_nd6_timer_periodic)) {
uip_nd6_periodic();
/*if(data == &uip_ds6_timer_periodic &&
etimer_expired(&uip_ds6_timer_periodic)) {
uip_ds6_periodic();
tcpip_ipv6_output();
}*/
#if !UIP_CONF_ROUTER

View file

@ -48,8 +48,8 @@
#include "net/uip.h"
#include "sys/stimer.h"
/**
* \name General
* @{
* \name General
* @{
*/
/** \brief HOP LIMIT to be used when sending ND messages (255) */
#define UIP_ND6_HOP_LIMIT 255
@ -59,27 +59,10 @@
#define UIP_ND6_DEF_MAXDADNS 1
/** \name Configuration options */
/** @{ */
#ifndef UIP_CONF_ND6_MAX_NEIGHBORS
/** \brief max number of entries in the neighbor cache */
#define UIP_CONF_ND6_MAX_NEIGHBORS 4
#endif /*UIP_CONF_ND6_MAX_NEIGHBORS*/
#ifndef UIP_CONF_ND6_MAX_DEFROUTERS
/** \brief max number of entries in the default router cache */
#define UIP_CONF_ND6_MAX_DEFROUTERS 2
#endif /*UIP_CONF_ND6_MAX_DEFROUTERS*/
#ifndef UIP_CONF_ND6_MAX_PREFIXES
/** \brief max number of entries in the prefix list */
#define UIP_CONF_ND6_MAX_PREFIXES 2
#endif /*UIP_CONF_ND6_MAX_PREFIXES*/
/** @} */
/** \name RFC 4861 Host constant */
/** @{ */
#define UIP_ND6_MAX_RTR_SOLICITATION_DELAY 1
#define UIP_ND6_RTR_SOLICITATION_INTERVAL 4
#define UIP_ND6_MAX_RTR_SOLICITATION_DELAY 1
#define UIP_ND6_RTR_SOLICITATION_INTERVAL 4
#define UIP_ND6_MAX_RTR_SOLICITATIONS 3
/** @} */
@ -115,7 +98,7 @@
#ifdef UIP_CONF_ND6_RETRANS_TIMER
#define UIP_ND6_RETRANS_TIMER UIP_CONF_ND6_RETRANS_TIMER
#else
#define UIP_ND6_RETRANS_TIMER 1000
#define UIP_ND6_RETRANS_TIMER 1000
#endif
#define UIP_ND6_DELAY_FIRST_PROBE_TIME 5
#define UIP_ND6_MIN_RANDOM_FACTOR(x) (x / 2)
@ -140,8 +123,8 @@
/** \name ND6 message length (excluding options) */
/** @{ */
#define UIP_ND6_NA_LEN 20
#define UIP_ND6_NS_LEN 20
#define UIP_ND6_NA_LEN 20
#define UIP_ND6_NS_LEN 20
#define UIP_ND6_RA_LEN 12
#define UIP_ND6_RS_LEN 4
/** @} */
@ -160,7 +143,7 @@
#define UIP_ND6_OPT_SHORT_LLAO_LEN 8
#define UIP_ND6_OPT_LONG_LLAO_LEN 16
/** \brief length of a ND6 LLAO option for 802.15.4 */
#define UIP_ND6_OPT_LLAO_LEN UIP_ND6_OPT_LONG_LLAO_LEN
#define UIP_ND6_OPT_LLAO_LEN UIP_ND6_OPT_LONG_LLAO_LEN
#else /*UIP_CONF_LL_802154*/
#if UIP_CONF_LL_80211
/* If the interface is 802.11 */
@ -179,93 +162,18 @@
#define UIP_ND6_NA_FLAG_ROUTER 0x80
#define UIP_ND6_NA_FLAG_SOLICITED 0x40
#define UIP_ND6_NA_FLAG_OVERRIDE 0x20
#define UIP_ND6_RA_FLAG_ONLINK 0x80
#define UIP_ND6_RA_FLAG_AUTONOMOUS 0x40
#define UIP_ND6_RA_FLAG_ONLINK 0x80
#define UIP_ND6_RA_FLAG_AUTONOMOUS 0x40
/** @} */
/**
* \brief Possible states for the neighbor cache entries
*
* NO_STATE is for implementation purposes: a router entry contains a pointer
* to a neighbor entry, which holds its ip address. If we do not know the LL
* address of the router, we do not have to create a neighbor entry as per
* RFC 4861. However, we still need to have the IP of the router stored in a
* neighbor entry, hence we create an entry in the NO_STATE state
*/
typedef enum {
INCOMPLETE = 0,
REACHABLE = 1,
STALE = 2,
DELAY = 3,
PROBE = 4,
NO_STATE = 5
} uip_neighbor_state;
/**
* \name ND structures
* @{
*/
/** \brief An entry in the neighbor cache */
struct uip_nd6_neighbor {
uip_ipaddr_t ipaddr;
uip_lladdr_t lladdr;
u8_t isrouter;
uip_neighbor_state state;
struct stimer reachable;
struct stimer last_send; /**< last time a ND message was sent */
u8_t count_send; /**< how many ND message were already sent */
u8_t used; /**< brief is this neighbor currently used */
#if UIP_CONF_IPV6_QUEUE_PKT
u8_t queue_buf[UIP_BUFSIZE - UIP_LLH_LEN];
/**< buffer to hold one packet during address resolution */
u8_t queue_buf_len;
/**< length of the pkt in buffer, used as "boolean" as well*/
#endif /*UIP_CONF_QUEUE_PKT*/
};
/** \brief An entry in the default router list */
struct uip_nd6_defrouter {
struct uip_nd6_neighbor *nb;
struct stimer lifetime;
/**< the lifetime contained in RA corresponds to the interval field
* of the timer
*/
u8_t used; /**< Is this default router entry currently used */
};
/** \brief A prefix list entry */
struct uip_nd6_prefix {
uip_ipaddr_t ipaddr;
u8_t length;
/**< we do not use preferred lifetime, which is always smaller than
* valid lifetime (for addr, preferred->deprecated)
*/
struct stimer vlifetime;
u8_t is_infinite; /**< Is the prefix lifetime INFINITE */
u8_t used; /**< Is this prefix entry currently used */
};
/** @} */
extern struct etimer uip_nd6_timer_periodic;
/**
* \note
* We do not use a destination cache, do next-hop determination each time
* a packet needs to be sent. (info such as rtt, path mtu could be stored
* in uip_conn)
*
*/
/**
* \name ND message structures
* @{
*/
/**
/**
* \brief A neighbor solicitation constant part
*
*
* Possible option is: SLLAO
*/
typedef struct uip_nd6_ns {
@ -275,19 +183,19 @@ typedef struct uip_nd6_ns {
/**
* \brief A neighbor advertisement constant part.
*
*
* Possible option is: TLLAO
*/
*/
typedef struct uip_nd6_na {
uint8_t flagsreserved;
uint8_t reserved[3];
uip_ipaddr_t tgtipaddr;
} uip_nd6_na;
/**
/**
* \brief A router solicitation constant part
*
* Possible option is: SLLAO
*
* Possible option is: SLLAO
*/
typedef struct uip_nd6_rs {
uint32_t reserved;
@ -295,7 +203,7 @@ typedef struct uip_nd6_rs {
/**
* \brief A router advertisement constant part
*
*
* Possible options are: SLLAO, MTU, Prefix Information
*/
typedef struct uip_nd6_ra {
@ -308,13 +216,13 @@ typedef struct uip_nd6_ra {
/**
* \brief A redirect message constant part
*
*
* Possible options are: TLLAO, redirected header
*/
typedef struct uip_nd6_redirect {
uint32_t reserved;
uip_ipaddr_t tgtipaddress;
uip_ipaddr_t destipaddress;
uip_ipaddr_t tgtipaddress;
uip_ipaddr_t destipaddress;
} uip_nd6_redirect;
/** @} */
@ -357,102 +265,6 @@ typedef struct uip_nd6_opt_redirected_hdr {
} uip_nd6_opt_redirected_hdr;
/** @} */
/**
* \name ND Neighbor Cache, Router List and Prefix List handling functions
* @{
*/
/**
* \brief Initialize Neighbor Discovery structures
*/
void uip_nd6_init(void);
/**
* \brief Periodic processing of Neighbor Discovery Structures
*/
void uip_nd6_periodic(void);
/**
* \brief Look for a neighbor cache entry corresponding to a specific IP
* address
* \param ipaddr the specific IP address
* \return the corresponding neighbor cache entry
*/
struct uip_nd6_neighbor *uip_nd6_nbrcache_lookup(uip_ipaddr_t *ipaddr);
/**
* \brief Add a neighbor cache entry
* \param ipaddr the IP address of the entry
* \param lladdr the layer 2 address of the entry
* \param isrouter true is the entry is a router
* \param state the state of the entry
* \return the new neighbor or updated cache entry
*/
struct uip_nd6_neighbor * uip_nd6_nbrcache_add(uip_ipaddr_t *ipaddr,
uip_lladdr_t *lladdr,
u8_t isrouter,
uip_neighbor_state state);
/**
* \brief Returns a default router
*/
struct uip_nd6_defrouter * uip_nd6_choose_defrouter(void);
/**
* \brief Find a default router corresponding to a given neighbor cache entry
* \param neighbor the neighbor cache entry
* \return the corresponding router if any
*/
struct uip_nd6_defrouter *
uip_nd6_defrouter_lookup(struct uip_nd6_neighbor *neighbor);
/**
* \brief Remove a default router
* \param router to be removed
*/
void uip_nd6_defrouter_rm(struct uip_nd6_defrouter *router);
/**
* \brief Add a default router
* \param neighbor the corresponding neighbor cache entry
* \param interval the lifetime of the router
* \return the new or updated defrouter entry
*/
struct uip_nd6_defrouter *
uip_nd6_defrouter_add(struct uip_nd6_neighbor *neighbor, unsigned long interval);
/**
* \brief Check if an IP address in on-link by looking at prefix list
* \param ipaddr an IP address
* \return true if on-link
*/
u8_t uip_nd6_is_addr_onlink(uip_ipaddr_t *ipaddr);
/**
* \brief Find a given prefix
* \param ipaddr an IP address
* \return the corresponding prefix if any
*/
struct uip_nd6_prefix *
uip_nd6_prefix_lookup(uip_ipaddr_t *ipaddr);
/**
* \brief Add a prefix
* \param ipaddr the IP address of the prefix
* \param length the length of the prefix
* \param interval the lifetime of the prefix
* \return the new or updated prefix entry
*/
struct uip_nd6_prefix *
uip_nd6_prefix_add(uip_ipaddr_t *ipaddr, u8_t length, unsigned long interval);
/**
* \brief Remove a prefix from th eprefix list
* \param prefix pointer to the prefix to be removed
*/
void
uip_nd6_prefix_rm(struct uip_nd6_prefix *prefix);
/** @} */
/**
* \name ND Messages Processing and Generation
* @{
@ -467,7 +279,7 @@ void
* address)
*
* We do:
* - if the tgt belongs to me, reply, otherwise ignore
* - if the tgt belongs to me, reply, otherwise ignore
* - if i was performing DAD for the same address, two cases:
* -- I already sent a NS, hence I win
* -- I did not send a NS yet, hence I lose
@ -476,13 +288,13 @@ void
* address resolution, or DAD and there is a conflict), we do it in this
* function: set src, dst, tgt address in the three cases, then for all cases
* set the rest, including SLLAO
*
*
*/
void
uip_nd6_ns_input(void);
/**
* \brief Send a neighbor solicitation, send a Neighbor Advertisement
* \brief Send a neighbor solicitation, send a Neighbor Advertisement
* \param src pointer to the src of the NS if known
* \param dest pointer to ip address to send the NS, for DAD or ADDR Resol,
* MUST be NULL, for NUD, must be correct unicast dest
@ -496,13 +308,13 @@ uip_nd6_ns_input(void);
* solicitation. Otherwise, any one of the addresses assigned to the
* interface should be used."
* This is why we have a src ip address as argument. If NULL, we will do
* src address selection, otherwise we use the argument.
*
* src address selection, otherwise we use the argument.
*
* - we check if it is a NS for Address resolution or NUD, if yes we include
* a SLLAO option, otherwise no.
*/
void
uip_nd6_ns_output(uip_ipaddr_t *src, uip_ipaddr_t *dest, uip_ipaddr_t *tgt);
uip_nd6_ns_output(uip_ipaddr_t *src, uip_ipaddr_t *dest, uip_ipaddr_t *tgt);
/**
* \brief Process a Neighbor Advertisement
@ -528,7 +340,7 @@ uip_nd6_na_input(void);
#if UIP_ND6_SEND_RA
/**
* \brief Process a Router Solicitation
*
*
*/
void uip_nd6_rs_input(void);
@ -543,12 +355,12 @@ void uip_nd6_ra_output(uip_ipaddr_t *dest);
/**
* \brief Send a Router Solicitation
*
*
* src is chosen through the uip_netif_select_src function. If src is
* unspecified (i.e. we do not have a preferred address yet), then we do not
* put a SLLAO option (MUST NOT in RFC 4861). Otherwise we do.
*
* RS message format,
* RS message format,
* possible option is SLLAO, MUST NOT be included if source = unspecified
* SHOULD be included otherwise
*/
@ -559,7 +371,7 @@ void uip_nd6_rs_output(void);
* \brief process a Router Advertisement
*
* - Possible actions when receiving a RA: add router to router list,
* recalculate reachable time, update link hop limit, update retrans timer.
* recalculate reachable time, update link hop limit, update retrans timer.
* - If MTU option: update MTU.
* - If SLLAO option: update entry in neighbor cache
* - If prefix option: start autoconf, add prefix to prefix list
@ -570,13 +382,13 @@ uip_nd6_ra_input(void);
void
uip_appserver_addr_get(uip_ipaddr_t *ipaddr);
uip_appserver_addr_get(uip_ipaddr_t *ipaddr);
/*--------------------------------------*/
/******* ANNEX - message formats ********/
/*--------------------------------------*/
/*
* RS format. possible option is SLLAO
/*
* RS format. possible option is SLLAO
* 0 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@ -644,7 +456,7 @@ uip_appserver_addr_get(uip_ipaddr_t *ipaddr);
* | Options ...
* +-+-+-+-+-+-+-+-+-+-+-+-
*
*
*
* Redirect message format. Possible options are TLLAO and Redirected header
*
* 0 1 2 3
@ -673,7 +485,7 @@ uip_appserver_addr_get(uip_ipaddr_t *ipaddr);
* | Options ...
* +-+-+-+-+-+-+-+-+-+-+-+-
*
*
*
* SLLAO/TLLAO option:
* 0 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
@ -681,7 +493,7 @@ uip_appserver_addr_get(uip_ipaddr_t *ipaddr);
* | Type | Length | Link-Layer Address ...
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
*
*
* Prefix information option
* 0 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
@ -712,8 +524,8 @@ uip_appserver_addr_get(uip_ipaddr_t *ipaddr);
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | MTU |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
*
*
*
* Redirected header option
*
* 0 1 2 3
@ -728,7 +540,7 @@ uip_appserver_addr_get(uip_ipaddr_t *ipaddr);
* | |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
*/
*/
#endif /* __UIP_ND6_H__ */
/** @} */

View file

@ -194,12 +194,12 @@
#define UIP_CONF_IPV6_QUEUE_PKT 0
#endif
#ifndef UIP_CONF_IPV6_CHECKS
#ifndef UIP_CONF_IPV6_CHECKS
/** Do we do IPv6 consistency checks (highly recommended, default: yes) */
#define UIP_CONF_IPV6_CHECKS 1
#endif
#ifndef UIP_CONF_IPV6_REASSEMBLY
#ifndef UIP_CONF_IPV6_REASSEMBLY
/** Do we do IPv6 fragmentation (default: no) */
#define UIP_CONF_IPV6_REASSEMBLY 0
#endif
@ -209,19 +209,19 @@
#define UIP_CONF_NETIF_MAX_ADDRESSES 3
#endif
#ifndef UIP_CONF_ND6_MAX_PREFIXES
#ifndef UIP_CONF_DS6_PREFIX_NBU
/** Default number of IPv6 prefixes associated to the node's interface */
#define UIP_CONF_ND6_MAX_PREFIXES 3
#define UIP_CONF_DS6_PREFIX_NBU 2
#endif
#ifndef UIP_CONF_ND6_MAX_NEIGHBORS
#ifndef UIP_CONF_DS6_NBR_NBU
/** Default number of neighbors that can be stored in the %neighbor cache */
#define UIP_CONF_ND6_MAX_NEIGHBORS 4
#define UIP_CONF_DS6_NBR_NBU 4
#endif
#ifndef UIP_CONF_ND6_MAX_DEFROUTERS
#ifndef UIP_CONF_DS6_DEFRT_NBU
/** Minimum number of default routers */
#define UIP_CONF_ND6_MAX_DEFROUTERS 2
#define UIP_CONF_DS6_DEFRT_NBU 2
#endif
/** @} */