diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-07-08 00:59:51 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-07-08 00:59:51 +0000 |
commit | a840b46208077e92bfeb30147aedc49d9c04aa8e (patch) | |
tree | c9bd9fda4b5432a681cbe6c2545fe446eee031e4 /nuttx/include | |
parent | d5135803d4021ef6fb2d69394cd28fdd665a8bca (diff) | |
download | px4-nuttx-a840b46208077e92bfeb30147aedc49d9c04aa8e.tar.gz px4-nuttx-a840b46208077e92bfeb30147aedc49d9c04aa8e.tar.bz2 px4-nuttx-a840b46208077e92bfeb30147aedc49d9c04aa8e.zip |
More IGMP changes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2777 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include')
-rw-r--r-- | nuttx/include/net/uip/uip-arch.h | 10 | ||||
-rwxr-xr-x | nuttx/include/net/uip/uip-igmp.h | 77 |
2 files changed, 84 insertions, 3 deletions
diff --git a/nuttx/include/net/uip/uip-arch.h b/nuttx/include/net/uip/uip-arch.h index 72288cba6..3184ac0f7 100644 --- a/nuttx/include/net/uip/uip-arch.h +++ b/nuttx/include/net/uip/uip-arch.h @@ -47,7 +47,11 @@ #include <sys/ioctl.h> #include <stdint.h> #include <net/if.h> + #include <net/uip/uip.h> +#ifdef CONFIG_NET_IGMP +# include <net/uip/uip-igmp.h> +#endif /**************************************************************************** * Included Files @@ -169,6 +173,12 @@ struct uip_driver_s uint16_t d_sndlen; + /* IGMP group list */ + +#ifdef CONFIG_NET_IGMP + FAR struct igmp_group_s *grplist; +#endif + /* Driver callbacks */ int (*d_ifup)(struct uip_driver_s *dev); diff --git a/nuttx/include/net/uip/uip-igmp.h b/nuttx/include/net/uip/uip-igmp.h index 7ad105ec3..8f80ac1f2 100755 --- a/nuttx/include/net/uip/uip-igmp.h +++ b/nuttx/include/net/uip/uip-igmp.h @@ -47,8 +47,15 @@ ****************************************************************************/ #include <nuttx/config.h> + +#include <stdint.h> +#include <stdbool.h> + #include <netinet/in.h> +#include <net/uip/uip.h> +#include <net/uip/uip-arch.h> + #ifdef CONFIG_NET_IGMP /**************************************************************************** @@ -67,10 +74,20 @@ #define IGMPv3_MEMBERSHIP_REPORT 0x22 /* IGMP Ver. 3 Membership Report */ #define IGMP_LEAVE_GROUP 0x17 /* Leave Group */ -/* Header sizes */ +/* Header sizes: + * + * UIP_IGMPH_LEN - Size of IGMP header in bytes + * UIP_IPIGMPH_LEN - Size of IP + IGMP header + */ + +#define UIP_IGMPH_LEN 8 +#define UIP_IPIGMPH_LEN (UIP_IGMPH_LEN + UIP_IPH_LEN) + +/* Group membership states */ -#define UIP_IGMPH_LEN 4 /* Size of IGMP header */ -#define UIP_IPIGMPH_LEN (UIP_IGMPH_LEN + UIP_IPH_LEN) /* Size of IP + IGMP header */ +#define IGMP_NON_MEMBER 0 +#define IGMP_DELAYING_MEMBER 1 +#define IGMP_IDLE_MEMBER 2 /**************************************************************************** * Public Types @@ -124,6 +141,43 @@ struct uip_igmphdr_s uint16_t grpaddr[2]; /* 32-bit Group address */ }; +#ifdef CONFIG_NET_IGMP_STATS +struct igmp_stats_s +{ + uint32_t length_errors; + uint32_t chksum_errors; + uint32_t v1_received; + uint32_t joins; + uint32_t leave_sent; + uint32_t ucast_query; + uint32_t report_sent; + uint32_t query_received; + uint32_t report_received; +}; + +# define IGMP_STATINCR(p) ((p)++) +#else +# define IGMP_STATINCR(p) +#endif + +/* This structure represents one group member. There is a list of groups + * for each device interface structure. + * + * There will be a group for the all systems group address but this + * will not run the state machine as it is used to kick off reports + * from all the other groups + */ + +struct igmp_group_s +{ + struct igmp_group_s *next; /* Implements a singly-linked list */ + uip_ipaddr_t grpaddr; /* Group IP address */ + WDOG_ID wdog; /* WDOG used to detect timeouts */ + bool lastrpt; /* Indicates the last to report */ + uint8_t state; /* State of the group */ + uint8_t msgid; /* Pending message ID (if non-zero) */ +}; + /**************************************************************************** * Public Data ****************************************************************************/ @@ -136,10 +190,27 @@ extern "C" { #define EXTERN extern #endif +#ifdef CONFIG_NET_IGMP_STATS +struct igmp_stats_s g_igmpstats; +#endif + +extern uip_ipaddr_t g_allsystems; +extern uip_ipaddr_t g_allrouters; + /**************************************************************************** * Public Function Prototypes ****************************************************************************/ +/**************************************************************************** + * Name: uip_igmpdevinit + * + * Description: + * Called when a new network device is registered to configure that device + * for IGMP support. + * + ****************************************************************************/ + +EXTERN void uip_igmpdevinit(struct uip_driver_s *dev); #undef EXTERN #if defined(__cplusplus) |